TestConfiguration *QtTestTreeItem::debugConfiguration() const { QtTestConfiguration *config = static_cast<QtTestConfiguration *>(testConfiguration()); if (config) config->setRunMode(TestRunMode::Debug); return config; }
void AccountSettings::editAccount(QMailAccount *account) { QMailAccountConfiguration config; if (account->id().isValid()) { config = QMailAccountConfiguration(account->id()); } else { account->setStatus(QMailAccount::UserEditable, true); account->setStatus(QMailAccount::UserRemovable, true); } QDialog *editAccountView; bool wasPreferred(account->status() & QMailAccount::PreferredSender); EditAccount *e = new EditAccount(this, "EditAccount"); e->setAccount(account, &config); editAccountView = e; editAccountView->setMinimumSize(QSize(400,400)); int ret = editAccountView->exec(); delete editAccountView; if (ret == QDialog::Accepted) { QMailAccountId previousPreferredId; if ((account->status() & QMailAccount::PreferredSender) && !wasPreferred) { // This account is now preferred - see if there is a predecessor that must be deselected QMailAccountKey preferredKey(QMailAccountKey::status(QMailAccount::PreferredSender, QMailDataComparator::Includes)); QMailAccountKey typeKey(QMailAccountKey::messageType(account->messageType())); QMailAccountIdList previousIds = QMailStore::instance()->queryAccounts(preferredKey & typeKey); if (!previousIds.isEmpty()) previousPreferredId = previousIds.first(); } preExisting = account->id().isValid(); if (preExisting) { QMailStore::instance()->updateAccount(account, &config); } else { QMailStore::instance()->addAccount(account, &config); accountView->setCurrentIndex(accountModel->index(accountModel->rowCount() - 1, 0)); } if ((account->status() & QMailAccount::PreferredSender) && !wasPreferred) { if (previousPreferredId.isValid()) { QMailAccount previousAccount(previousPreferredId); previousAccount.setStatus(QMailAccount::PreferredSender, false); QMailStore::instance()->updateAccount(&previousAccount); QMessageBox::warning(this, tr("New default account"), tr("<qt>Your previous default mail account has been unchecked</qt>"), QMessageBox::Ok); } } QTimer::singleShot(0, this, SLOT(testConfiguration())); } }
//===================================== // slotFinish //------------------------------------- void SCCFrame::slotFinish ( void ) { SCCWrapPointer< Q3Dict<QString> > mText (getTextPtr()); SCCMessage* mMessageBox = new SCCMessage ( this, getTextPtr(), SaXMessage::FINISH, "FinalSaX","MessageCaption" ); QString result = mMessageBox -> showMessage(); if (result == mText["FinalSave"]) { saveConfiguration(); } if (result == mText["FinalTest"]) { testConfiguration(); } }
void AccountSettings::resetAccount() { QModelIndex index = accountView->currentIndex(); if (!index.isValid()) return; QMailAccount account(accountModel->idFromIndex(index)); QString message = tr("Reset %1?").arg(account.name()); if (QMessageBox::question( this, tr("Reset account"), message, QMessageBox::Yes | QMessageBox::No,QMessageBox::No) == QMessageBox::Yes) { // Load the existing configuration QMailAccountConfiguration config(account.id()); // Delete the account QMailStore::instance()->removeAccount(account.id()); // Add the same account back QMailStore::instance()->addAccount(&account, &config); accountView->setCurrentIndex(accountModel->index(accountModel->rowCount() - 1, 0)); QTimer::singleShot(0, this, SLOT(testConfiguration())); } }