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:
Martchus 2017-07-16 21:08:38 +02:00
parent fc307f0911
commit aca7f61c84
4 changed files with 15 additions and 6 deletions

View File

@ -9,7 +9,7 @@ set(META_APP_DESCRIPTION "Tray application for Syncthing")
set(META_APP_CATEGORIES "System;Utility;Network;FileTransfer")
set(META_VERSION_MAJOR 0)
set(META_VERSION_MINOR 6)
set(META_VERSION_PATCH 2)
set(META_VERSION_PATCH 3)
set(META_VERSION_EXACT_SONAME ON)
project(${META_PROJECT_NAME})

View File

@ -350,12 +350,17 @@ void SyncthingConnection::rescan(const QString &dirId, const QString &relpath)
/*!
* \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.
*/
void SyncthingConnection::rescanAllDirs()
{
for (const SyncthingDir &dir : m_dirs) {
rescan(dir.id);
if (!dir.paused) {
rescan(dir.id);
}
}
}

View File

@ -59,9 +59,11 @@ void DirButtonsItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
// draw buttons
const int buttonY = option.rect.y() + centerObj(option.rect.height(), 16);
painter->drawPixmap(option.rect.right() - 52, buttonY, 16, 16, m_refreshIcon);
painter->drawPixmap(
option.rect.right() - 34, buttonY, 16, 16, index.data(SyncthingDirectoryModel::DirectoryPaused).toBool() ? m_resumeIcon : m_pauseIcon);
const bool dirPaused = index.data(SyncthingDirectoryModel::DirectoryPaused).toBool();
if (!dirPaused) {
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);
}
}

View File

@ -41,7 +41,9 @@ void DirView::mouseReleaseEvent(QMouseEvent *event)
const QRect itemRect(visualRect(clickedIndex));
if (pos.x() > itemRect.right() - 58) {
if (pos.x() < itemRect.right() - 34) {
emit scanDir(*dir);
if (!dir->paused) {
emit scanDir(*dir);
}
} else if (pos.x() < itemRect.right() - 17) {
emit pauseResumeDir(*dir);
} else {