Prevent trying to rescan paused dirs
* Exclude paused dirs when rescanning all dirs to prevent errors * Disable rescanning particular dir via gui if paused
This commit is contained in:
parent
fc307f0911
commit
aca7f61c84
|
@ -9,7 +9,7 @@ set(META_APP_DESCRIPTION "Tray application for Syncthing")
|
||||||
set(META_APP_CATEGORIES "System;Utility;Network;FileTransfer")
|
set(META_APP_CATEGORIES "System;Utility;Network;FileTransfer")
|
||||||
set(META_VERSION_MAJOR 0)
|
set(META_VERSION_MAJOR 0)
|
||||||
set(META_VERSION_MINOR 6)
|
set(META_VERSION_MINOR 6)
|
||||||
set(META_VERSION_PATCH 2)
|
set(META_VERSION_PATCH 3)
|
||||||
set(META_VERSION_EXACT_SONAME ON)
|
set(META_VERSION_EXACT_SONAME ON)
|
||||||
|
|
||||||
project(${META_PROJECT_NAME})
|
project(${META_PROJECT_NAME})
|
||||||
|
|
|
@ -350,12 +350,17 @@ void SyncthingConnection::rescan(const QString &dirId, const QString &relpath)
|
||||||
/*!
|
/*!
|
||||||
* \brief Requests rescanning all directories.
|
* \brief Requests rescanning all directories.
|
||||||
*
|
*
|
||||||
|
* Note that rescan is only requested for unpaused directories because requesting rescan for
|
||||||
|
* paused directories only leads to an error.
|
||||||
|
*
|
||||||
* The signal error() is emitted when the request was not successful.
|
* The signal error() is emitted when the request was not successful.
|
||||||
*/
|
*/
|
||||||
void SyncthingConnection::rescanAllDirs()
|
void SyncthingConnection::rescanAllDirs()
|
||||||
{
|
{
|
||||||
for (const SyncthingDir &dir : m_dirs) {
|
for (const SyncthingDir &dir : m_dirs) {
|
||||||
rescan(dir.id);
|
if (!dir.paused) {
|
||||||
|
rescan(dir.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,11 @@ void DirButtonsItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
||||||
|
|
||||||
// draw buttons
|
// draw buttons
|
||||||
const int buttonY = option.rect.y() + centerObj(option.rect.height(), 16);
|
const int buttonY = option.rect.y() + centerObj(option.rect.height(), 16);
|
||||||
painter->drawPixmap(option.rect.right() - 52, buttonY, 16, 16, m_refreshIcon);
|
const bool dirPaused = index.data(SyncthingDirectoryModel::DirectoryPaused).toBool();
|
||||||
painter->drawPixmap(
|
if (!dirPaused) {
|
||||||
option.rect.right() - 34, buttonY, 16, 16, index.data(SyncthingDirectoryModel::DirectoryPaused).toBool() ? m_resumeIcon : m_pauseIcon);
|
painter->drawPixmap(option.rect.right() - 52, buttonY, 16, 16, m_refreshIcon);
|
||||||
|
}
|
||||||
|
painter->drawPixmap(option.rect.right() - 34, buttonY, 16, 16, dirPaused ? m_resumeIcon : m_pauseIcon);
|
||||||
painter->drawPixmap(option.rect.right() - 16, buttonY, 16, 16, m_folderIcon);
|
painter->drawPixmap(option.rect.right() - 16, buttonY, 16, 16, m_folderIcon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,9 @@ void DirView::mouseReleaseEvent(QMouseEvent *event)
|
||||||
const QRect itemRect(visualRect(clickedIndex));
|
const QRect itemRect(visualRect(clickedIndex));
|
||||||
if (pos.x() > itemRect.right() - 58) {
|
if (pos.x() > itemRect.right() - 58) {
|
||||||
if (pos.x() < itemRect.right() - 34) {
|
if (pos.x() < itemRect.right() - 34) {
|
||||||
emit scanDir(*dir);
|
if (!dir->paused) {
|
||||||
|
emit scanDir(*dir);
|
||||||
|
}
|
||||||
} else if (pos.x() < itemRect.right() - 17) {
|
} else if (pos.x() < itemRect.right() - 17) {
|
||||||
emit pauseResumeDir(*dir);
|
emit pauseResumeDir(*dir);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue