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); } }
// Method executed when the user ends has finished the basic setup. void OwncloudSetupWizard::slotAssistantFinished( int result ) { FolderMan *folderMan = FolderMan::instance(); if( result == QDialog::Rejected ) { qDebug() << "Rejected the new config, use the old!"; } else if( result == QDialog::Accepted ) { // This may or may not wipe all folder definitions, depending // on whether a new account is activated or the existing one // is changed. auto account = applyAccountChanges(); QString localFolder = QDir::fromNativeSeparators(_ocWizard->localFolder()); if( !localFolder.endsWith(QLatin1Char('/'))) { localFolder.append(QLatin1Char('/')); } bool startFromScratch = _ocWizard->field("OCSyncFromScratch").toBool(); if (!startFromScratch || ensureStartFromScratch(localFolder)) { qDebug() << "Adding folder definition for" << localFolder << _remoteFolder; FolderDefinition folderDefinition; auto alias = Theme::instance()->appName(); int count = 0; folderDefinition.alias = alias; while (folderMan->folder(folderDefinition.alias)) { // There is already a folder configured with this name and folder names need to be unique folderDefinition.alias = alias + QString::number(++count); } folderDefinition.localPath = localFolder; folderDefinition.targetPath = _remoteFolder; auto f = folderMan->addFolder(account, folderDefinition); if (f) { f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, _ocWizard->selectiveSyncBlacklist()); } _ocWizard->appendToConfigurationLog(tr("<font color=\"green\"><b>Local sync folder %1 successfully created!</b></font>").arg(localFolder)); } } // notify others. emit ownCloudWizardDone( result ); }
void AccountSettings::slotResetCurrentFolder() { QModelIndex selected = ui->_folderList->selectionModel()->currentIndex(); if( selected.isValid() ) { QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString(); int ret = QMessageBox::question( 0, tr("Confirm Folder Reset"), tr("<p>Do you really want to reset folder <i>%1</i> and rebuild your client database?</p>" "<p><b>Note:</b> While no files will be removed, this can cause significant data " "traffic and take several minutes to hours, depending on the size of the folder.</p>").arg(alias), QMessageBox::Yes|QMessageBox::No ); if( ret == QMessageBox::Yes ) { FolderMan *folderMan = FolderMan::instance(); Folder *f = folderMan->folder(alias); f->slotTerminateSync(); f->wipe(); folderMan->slotScheduleAllFolders(); } } }
void AccountSettings::slotResetCurrentFolder() { QModelIndex selected = ui->_folderList->selectionModel()->currentIndex(); if( selected.isValid() ) { QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString(); int ret = QMessageBox::question( 0, tr("Confirm Folder Reset"), tr("<p>Do you really want to reset folder <i>%1</i> and rebuild your client database?</p>" "<p><b>Note:</b> This function is designed for maintenance purposes only. " "No files will be removed, but this can cause significant data traffic and " "take several minutes or hours to complete, depending on the size of the folder. " "Only use this option if advised by your administrator.</p>").arg(alias), QMessageBox::Yes|QMessageBox::No ); if( ret == QMessageBox::Yes ) { FolderMan *folderMan = FolderMan::instance(); Folder *f = folderMan->folder(alias); f->slotTerminateSync(true); f->wipe(); folderMan->slotScheduleAllFolders(); } } }