foreach (AccountStatePtr a, problemAccounts) { QString message = tr("Account %1: %2").arg( a->account()->displayName(), a->stateString(a->state())); if (! a->connectionErrors().empty()) { message += QLatin1String("\n"); message += a->connectionErrors().join(QLatin1String("\n")); } messages.append(message); }
QVariant ActivityListModel::data(const QModelIndex &index, int role) const { Activity a; if (!index.isValid()) return QVariant(); a = _finalList.at(index.row()); AccountStatePtr ast = AccountManager::instance()->account(a._accName); QStringList list; switch (role) { case ActivityItemDelegate::PathRole: list = FolderMan::instance()->findFileInLocalFolders(a._file, ast->account()); if( list.count() > 0 ) { return QVariant(list.at(0)); } // File does not exist anymore? Let's try to open its path list = FolderMan::instance()->findFileInLocalFolders(QFileInfo(a._file).path(), ast->account()); if( list.count() > 0 ) { return QVariant(list.at(0)); } return QVariant(); break; case ActivityItemDelegate::ActionIconRole: return QVariant(); // FIXME once the action can be quantified, display on Icon break; case ActivityItemDelegate::UserIconRole: return QIcon(QLatin1String(":/client/resources/account.png")); break; case Qt::ToolTipRole: case ActivityItemDelegate::ActionTextRole: return a._subject; break; case ActivityItemDelegate::LinkRole: return a._link; break; case ActivityItemDelegate::AccountRole: return a._accName; break; case ActivityItemDelegate::PointInTimeRole: return Utility::timeAgoInWords(a._dateTime); break; case ActivityItemDelegate::AccountConnectedRole: return (ast && ast->isConnected()); break; default: return QVariant(); } return QVariant(); }
void FolderMan::setupFoldersHelper(QSettings &settings, AccountStatePtr account, bool backwardsCompatible) { foreach (const auto &folderAlias, settings.childGroups()) { FolderDefinition folderDefinition; if (FolderDefinition::load(settings, folderAlias, &folderDefinition)) { auto defaultJournalPath = folderDefinition.defaultJournalPath(account->account()); // Migration: Old settings don't have journalPath if (folderDefinition.journalPath.isEmpty()) { folderDefinition.journalPath = defaultJournalPath; } // Migration: ._ files sometimes don't work // So if the configured journalPath is the default one ("._sync_*.db") // but the current default doesn't have the underscore, switch to the // new default. See SyncJournalDb::makeDbName(). if (folderDefinition.journalPath.startsWith("._sync_") && defaultJournalPath.startsWith(".sync_")) { folderDefinition.journalPath = defaultJournalPath; } // Migration: If an old db is found, move it to the new name. if (backwardsCompatible) { SyncJournalDb::maybeMigrateDb(folderDefinition.localPath, folderDefinition.absoluteJournalPath()); } Folder *f = addFolderInternal(std::move(folderDefinition), account.data()); if (f) { // Migration: Mark folders that shall be saved in a backwards-compatible way if (backwardsCompatible) { f->setSaveBackwardsCompatible(true); } scheduleFolder(f); emit folderSyncStateChange(f); } } } }