void AccountSettings::folderToModelItem( QStandardItem *item, Folder *f ) { if( ! item || !f ) return; item->setData( f->nativePath(), FolderStatusDelegate::FolderPathRole ); item->setData( f->remotePath(), FolderStatusDelegate::FolderSecondPathRole ); item->setData( f->alias(), FolderStatusDelegate::FolderAliasRole ); item->setData( f->syncEnabled(), FolderStatusDelegate::FolderSyncEnabled ); SyncResult res = f->syncResult(); SyncResult::Status status = res.status(); QStringList errorList = res.errorStrings(); Theme *theme = Theme::instance(); item->setData( theme->statusHeaderText( status ), Qt::ToolTipRole ); if( f->syncEnabled() ) { if( status == SyncResult::SyncPrepare ) { if( _wasDisabledBefore ) { // if the folder was disabled before, set the sync icon item->setData( theme->syncStateIcon( SyncResult::SyncRunning), FolderStatusDelegate::FolderStatusIconRole ); } // we keep the previous icon for the SyncPrepare state. } else if( status == SyncResult::Undefined ) { // startup, the sync was never done. qDebug() << "XXX FIRST time sync, setting icon to sync running!"; item->setData( theme->syncStateIcon( SyncResult::SyncRunning), FolderStatusDelegate::FolderStatusIconRole ); } else { // kepp the previous icon for the prepare phase. if( status == SyncResult::Problem) { item->setData( theme->syncStateIcon( SyncResult::Success), FolderStatusDelegate::FolderStatusIconRole ); } else { item->setData( theme->syncStateIcon( status ), FolderStatusDelegate::FolderStatusIconRole ); } } } else { item->setData( theme->folderDisabledIcon( ), FolderStatusDelegate::FolderStatusIconRole ); // size 48 before _wasDisabledBefore = false; } item->setData( theme->statusHeaderText( status ), FolderStatusDelegate::FolderStatus ); if( errorList.isEmpty() ) { if( (status == SyncResult::Error || status == SyncResult::SetupError || status == SyncResult::SyncAbortRequested || status == SyncResult::Unavailable)) { errorList << theme->statusHeaderText(status); } } item->setData( errorList, FolderStatusDelegate::FolderErrorMsg); bool ongoing = false; item->setData( QVariant(res.warnCount()), FolderStatusDelegate::WarningCount ); if( status == SyncResult::SyncRunning ) { ongoing = true; } item->setData( ongoing, FolderStatusDelegate::SyncRunning); }
void Folder::slotSyncFinished(const SyncResult &result) { _watcher->setEventsEnabledDelayed(2000); _pollTimer.start(); qDebug() << "OO folder slotSyncFinished: result: " << int(result.status()); emit syncStateChange(); }
void SettingsDialogMac::slotSyncStateChange(const QString& alias) { FolderMan *folderMan = FolderMan::instance(); SyncResult state = folderMan->accountStatus(folderMan->map().values()); QIcon accountIcon = Theme::instance()->syncStateIcon(state.status()); setPreferencesPanelIcon(_accountIdx, accountIcon); Folder *folder = folderMan->folder(alias); if( folder ) { _accountSettings->slotUpdateFolderState(folder); } }
void Folder::slotSyncFinished(const SyncResult &result) { _watcher->setEventsEnabledDelayed(2000); qDebug() << "OO folder slotSyncFinished: result: " << int(result.status()); emit syncStateChange(); // reenable the poll timer if folder is sync enabled if( syncEnabled() ) { qDebug() << "* " << alias() << "Poll timer enabled with " << _pollTimer->interval() << "milliseconds"; _pollTimer->start(); } else { qDebug() << "* Not enabling poll timer for " << alias(); _pollTimer->stop(); } }
void Folder::slotSyncFinished(const SyncResult &result) { #ifdef USE_INOTIFY _watcher->setEventsEnabled(true); #endif qDebug() << "OO folder slotSyncFinished: result: " << int(result.status()) << " local: " << result.localRunOnly(); emit syncStateChange(); // reenable the poll timer if folder is sync enabled if( syncEnabled() ) { qDebug() << "* " << alias() << "Poll timer enabled with " << _pollTimer->interval() << "milliseconds"; _pollTimer->start(); } else { qDebug() << "* Not enabling poll timer for " << alias(); _pollTimer->stop(); } }
void AccountSettings::folderToModelItem( QStandardItem *item, Folder *f ) { if( ! item || !f ) return; item->setData( f->nativePath(), FolderStatusDelegate::FolderPathRole ); item->setData( f->secondPath(), FolderStatusDelegate::FolderSecondPathRole ); item->setData( f->alias(), FolderStatusDelegate::FolderAliasRole ); item->setData( f->syncEnabled(), FolderStatusDelegate::FolderSyncEnabled ); SyncResult res = f->syncResult(); SyncResult::Status status = res.status(); QStringList errorList = res.errorStrings(); Theme *theme = Theme::instance(); item->setData( theme->statusHeaderText( status ), Qt::ToolTipRole ); if( f->syncEnabled() ) { item->setData( theme->syncStateIcon( status ), FolderStatusDelegate::FolderStatusIconRole ); } else { item->setData( theme->folderDisabledIcon( ), FolderStatusDelegate::FolderStatusIconRole ); // size 48 before } item->setData( theme->statusHeaderText( status ), FolderStatusDelegate::FolderStatus ); if( errorList.isEmpty() ) { if( (status == SyncResult::Error || status == SyncResult::SetupError || status == SyncResult::SyncAbortRequested || status == SyncResult::Unavailable)) { errorList << theme->statusHeaderText(status); } } item->setData( errorList, FolderStatusDelegate::FolderErrorMsg); bool ongoing = false; item->setData( QVariant(res.warnCount()), FolderStatusDelegate::WarningCount ); if( status == SyncResult::SyncRunning ) { ongoing = true; } item->setData( ongoing, FolderStatusDelegate::SyncRunning); }
void AccountSettings::folderToModelItem( QStandardItem *item, Folder *f ) { if( ! item || !f ) return; item->setData( f->nativePath(), FolderStatusDelegate::FolderPathRole ); item->setData( f->secondPath(), FolderStatusDelegate::FolderSecondPathRole ); item->setData( f->alias(), FolderStatusDelegate::FolderAliasRole ); item->setData( f->syncEnabled(), FolderStatusDelegate::FolderSyncEnabled ); SyncResult res = f->syncResult(); SyncResult::Status status = res.status(); QString errors = res.errorStrings().join(QLatin1String("<br/>")); Theme *theme = Theme::instance(); item->setData( theme->statusHeaderText( status ), Qt::ToolTipRole ); if( f->syncEnabled() ) { item->setData( theme->syncStateIcon( status ), FolderStatusDelegate::FolderStatusIconRole ); } else { item->setData( theme->folderDisabledIcon( ), FolderStatusDelegate::FolderStatusIconRole ); // size 48 before } item->setData( theme->statusHeaderText( status ), FolderStatusDelegate::FolderStatus ); item->setData( errors, FolderStatusDelegate::FolderErrorMsg ); }
void SettingsDialog::slotUpdateAccountState() { FolderMan *folderMan = FolderMan::instance(); SyncResult state = folderMan->accountStatus(folderMan->map().values()); _accountItem->setIcon(Theme::instance()->syncStateIcon(state.status())); }