void Application::slotConnectionValidatorResult(ConnectionValidator::Status status) { qDebug() << "Connection Validator Result: " << _conValidator->statusString(status); QStringList startupFails; if( status == ConnectionValidator::Connected ) { FolderMan *folderMan = FolderMan::instance(); qDebug() << "######## Connection and Credentials are ok!"; folderMan->setSyncEnabled(true); // queue up the sync for all folders. folderMan->slotScheduleAllFolders(); } else { // if we have problems here, it's unlikely that syncing will work. FolderMan::instance()->setSyncEnabled(false); startupFails = _conValidator->errors(); _startupNetworkError = _conValidator->networkError(); if (_userTriggeredConnect) { _userTriggeredConnect = false; } QTimer::singleShot(30*1000, this, SLOT(slotCheckConnection())); } _gui->startupConnected( (status == ConnectionValidator::Connected), startupFails); _conValidator->deleteLater(); }
void AccountSettings::slotRemoveCurrentFolder() { QModelIndex selected = ui->_folderList->selectionModel()->currentIndex(); if( selected.isValid() ) { QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString(); qDebug() << "Remove Folder alias " << alias; if( !alias.isEmpty() ) { // remove from file system through folder man // _model->removeRow( selected.row() ); int ret = QMessageBox::question( this, tr("Confirm Folder Remove"), tr("<p>Do you really want to stop syncing the folder <i>%1</i>?</p>" "<p><b>Note:</b> This will not remove the files from your client.</p>").arg(alias), QMessageBox::Yes|QMessageBox::No ); if( ret == QMessageBox::No ) { return; } FolderMan *folderMan = FolderMan::instance(); folderMan->slotRemoveFolder( alias ); setFolderList(folderMan->map()); emit folderChanged(); slotCheckConnection(); } } }
void AccountSettings::slotAddFolder( Folder *folder ) { if( ! folder || folder->alias().isEmpty() ) return; QStandardItem *item = new QStandardItem(); folderToModelItem( item, folder ); _model->appendRow( item ); slotCheckConnection(); }
void Application::slotownCloudWizardDone( int res ) { FolderMan *folderMan = FolderMan::instance(); if( res == QDialog::Accepted ) { int cnt = folderMan->setupFolders(); qDebug() << "Set up " << cnt << " folders."; // We have some sort of configuration. Enable autostart Utility::setLaunchOnStartup(_theme->appName(), _theme->appNameGUI(), true); } folderMan->setSyncEnabled( true ); if( res == QDialog::Accepted ) { slotCheckConnection(); } }
void Application::slotCredentialsFetched() { Account *account = AccountManager::instance()->account(); Q_ASSERT(account); disconnect(account->credentials(), SIGNAL(fetched()), this, SLOT(slotCredentialsFetched())); if (!account->credentials()->ready()) { // User canceled the connection or did not give a password account->setState(Account::SignedOut); return; } if (account->state() == Account::InvalidCredidential) { // Then we ask again for the credidentials if they are wrong again account->setState(Account::Disconnected); } slotCheckConnection(); }
AccountSettings::AccountSettings(QWidget *parent) : QWidget(parent), ui(new Ui::AccountSettings), _item(0) { ui->setupUi(this); _model = new FolderStatusModel; FolderStatusDelegate *delegate = new FolderStatusDelegate; ui->_folderList->setItemDelegate( delegate ); ui->_folderList->setModel( _model ); ui->_folderList->setMinimumWidth( 300 ); ui->_folderList->setEditTriggers( QAbstractItemView::NoEditTriggers ); ui->_ButtonRemove->setEnabled(false); ui->_ButtonReset->setEnabled(false); ui->_ButtonEnable->setEnabled(false); ui->_ButtonInfo->setEnabled(false); ui->_ButtonAdd->setEnabled(true); connect(ui->_ButtonRemove, SIGNAL(clicked()), this, SLOT(slotRemoveCurrentFolder())); connect(ui->_ButtonReset, SIGNAL(clicked()), this, SLOT(slotResetCurrentFolder())); connect(ui->_ButtonEnable, SIGNAL(clicked()), this, SLOT(slotEnableCurrentFolder())); connect(ui->_ButtonInfo, SIGNAL(clicked()), this, SLOT(slotInfoAboutCurrentFolder())); connect(ui->_ButtonAdd, SIGNAL(clicked()), this, SLOT(slotAddFolder())); connect(ui->modifyAccountButton, SIGNAL(clicked()), SLOT(slotOpenAccountWizard())); connect(ui->ignoredFilesButton, SIGNAL(clicked()), SLOT(slotIgnoreFilesEditor()));; connect(ui->_folderList, SIGNAL(clicked(QModelIndex)), SLOT(slotFolderActivated(QModelIndex))); connect(ui->_folderList, SIGNAL(doubleClicked(QModelIndex)),SLOT(slotDoubleClicked(QModelIndex))); ownCloudInfo *ocInfo = ownCloudInfo::instance(); slotUpdateQuota(ocInfo->lastQuotaTotalBytes(), ocInfo->lastQuotaUsedBytes()); connect(ocInfo, SIGNAL(quotaUpdated(qint64,qint64)), SLOT(slotUpdateQuota(qint64,qint64))); ui->connectLabel->setWordWrap( true ); setFolderList(FolderMan::instance()->map()); slotCheckConnection(); }
void AccountSettings::slotRemoveCurrentFolder() { QModelIndex selected = ui->_folderList->selectionModel()->currentIndex(); if( selected.isValid() ) { int row = selected.row(); QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString(); qDebug() << "Remove Folder alias " << alias; if( !alias.isEmpty() ) { // remove from file system through folder man // _model->removeRow( selected.row() ); int ret = QMessageBox::question( this, tr("Confirm Folder Remove"), tr("<p>Do you really want to stop syncing the folder <i>%1</i>?</p>" "<p><b>Note:</b> This will not remove the files from your client.</p>").arg(alias), QMessageBox::Yes|QMessageBox::No ); if( ret == QMessageBox::No ) { return; } /* Remove the selected item from the timer hash. */ QStandardItem *item = NULL; if( selected.isValid() ) item = _model->itemFromIndex(selected); if( selected.isValid() && item && _hideProgressTimers.contains(item) ) { QTimer *t = _hideProgressTimers[item]; t->stop(); _hideProgressTimers.remove(item); delete(t); } FolderMan *folderMan = FolderMan::instance(); folderMan->slotRemoveFolder( alias ); _model->removeRow(row); emit folderChanged(); slotCheckConnection(); } } }
void Application::slotConnectionValidatorResult(ConnectionValidator::Status status) { qDebug() << "Connection Validator Result: " << _conValidator->statusString(status); QStringList startupFails; if( status == ConnectionValidator::Connected ) { FolderMan *folderMan = FolderMan::instance(); qDebug() << "######## Connection and Credentials are ok!"; folderMan->setSyncEnabled(true); // queue up the sync for all folders. folderMan->slotScheduleAllFolders(); if(!_connectionMsgBox.isNull()) { _connectionMsgBox->close(); } } else { // if we have problems here, it's unlikely that syncing will work. FolderMan::instance()->setSyncEnabled(false); startupFails = _conValidator->errors(); _startupNetworkError = _conValidator->networkError(); if (_userTriggeredConnect) { if(_connectionMsgBox.isNull()) { _connectionMsgBox = new QMessageBox(QMessageBox::Warning, tr("Connection failed"), _conValidator->errors().join(". ").append('.'), QMessageBox::Ok, 0); _connectionMsgBox->setAttribute(Qt::WA_DeleteOnClose); _connectionMsgBox->open(); _userTriggeredConnect = false; } } QTimer::singleShot(30*1000, this, SLOT(slotCheckConnection())); } _gui->startupConnected( (status == ConnectionValidator::Connected), startupFails); _conValidator->deleteLater(); }