MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); accountComboBox = new CComboBox(ui->centralWidget); accountComboBox->setGeometry(10, 10, 200, 25); listWidget = new QListWidget(); accountComboBox->setModel(listWidget->model()); accountComboBox->setView(listWidget); accountComboBox->setEditable(true); //ÉèÖÃQComboBox¿É±à¼ for(int i = 0; i < 3; i++) { AccountItem *accountItem = new AccountItem(); accountItem->setAccountNumber(QString("safe_") + QString::number(i, 10) + QString("@sina.com")); connect(accountItem, SIGNAL(showAccount(QString)), this, SLOT(showAccount(QString))); connect(accountItem, SIGNAL(removeAccount(QString)), this, SLOT(removeAccount(QString))); QListWidgetItem* listItem = new QListWidgetItem(listWidget); listWidget->setItemWidget(listItem, accountItem); } accountComboBox->setItemEnable(listWidget, 2, true); }
void GmailSettings::remove() { removeResource(mMailtransportIdentifier); removeResource(mImapIdentifier); removeIdentity(); removeAccount(); }
void AccountsModel::onGroupChatManagerChanged(qutim_sdk_0_3::GroupChatManager *manager) { Q_ASSERT(qobject_cast<Account*>(sender())); Account *account = static_cast<Account*>(sender()); if (manager) addAccount(account); else removeAccount(account, true); }
void FedgeConfigAccounts::removeAccount(int i) { if (m_config->hasGroup("Account " + QString::number(i + 1))) { moveAccount(i + 1, i); removeAccount(i + 1); } else m_config->deleteGroup("Account " + QString::number(i)); }
void AccountFactory::removeAccount(const std::string& id) { std::lock_guard<std::recursive_mutex> lock(mutex_); if (auto account = getAccount(id)) { removeAccount(*account); } else RING_ERR("No account with ID %s", id.c_str()); }
void KNCollectionView::reloadAccounts() { KNAccountManager *am = knGlobals.accountManager(); QValueList<KNNntpAccount *>::Iterator it; for(it = am->begin(); it != am->end(); ++it) { removeAccount(*it); addAccount(*it); } }
void FedgeConfigAccounts::slotRemove() { int i = accountsBox->index(accountsBox->selectedItem()); if (i == -1) { qWarning("Should not happen: Remove Account with none selected!"); return; } accountsBox->removeItem(i); removeAccount(i); m_changed = true; emit accountsChanged(); }
void NetworkManager::removeAccount(Account *account) { removeAccount(account->protocol()->id(), account->id()); }
void AccountsModel::onAccountDestroyed(Account *account) { removeAccount(account, false); }
AccountSettings::AccountSettings(QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags), preExisting(false), deleteBatchSize(0), deleteProgress(0) { setWindowTitle(tr("Accounts")); QVBoxLayout *vb = new QVBoxLayout(this); vb->setContentsMargins(0, 0, 0, 0); accountModel = new QMailAccountListModel(this); accountModel->setKey(QMailAccountKey::status(QMailAccount::UserEditable, QMailDataComparator::Includes)); accountModel->setSortKey(QMailAccountSortKey::id(Qt::AscendingOrder)); connect(accountModel,SIGNAL(rowsInserted(QModelIndex,int,int)),this,SLOT(updateActions())); connect(accountModel,SIGNAL(rowsRemoved(QModelIndex,int,int)),this,SLOT(updateActions())); accountView = new QListView(this); accountView->setContextMenuPolicy(Qt::ActionsContextMenu); accountView->setModel(accountModel); if (accountModel->rowCount()) accountView->setCurrentIndex(accountModel->index(0, 0)); else //no accounts so automatically add QTimer::singleShot(0,this,SLOT(addAccount())); addAccountAction = new QAction( Qtmail::icon("add"), tr("New"), this ); connect(addAccountAction, SIGNAL(triggered()), this, SLOT(addAccount())); editAccountAction = new QAction(Qtmail::icon("settings"),tr("Edit"), this); connect(editAccountAction,SIGNAL(triggered()),this,SLOT(editCurrentAccount())); accountView->addAction(editAccountAction); resetAccountAction = new QAction( Qtmail::icon("reset"), tr("Reset"), this ); connect(resetAccountAction, SIGNAL(triggered()), this, SLOT(resetAccount())); accountView->addAction(resetAccountAction); removeAccountAction = new QAction( Qtmail::icon("remove"), tr("Remove"), this ); connect(removeAccountAction, SIGNAL(triggered()), this, SLOT(removeAccount())); accountView->addAction(removeAccountAction); QToolBar *buttonBar = new QToolBar(this); buttonBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); buttonBar->addAction(addAccountAction); buttonBar->addSeparator(); buttonBar->addAction(editAccountAction); buttonBar->addAction(resetAccountAction); buttonBar->addAction(removeAccountAction); vb->addWidget(buttonBar); vb->addWidget(accountView); statusDisplay = new StatusBar(this); statusDisplay->setDetailsButtonVisible(false); statusDisplay->setVisible(false); vb->addWidget(statusDisplay); connect(accountView, SIGNAL(activated(QModelIndex)), this, SLOT(editCurrentAccount())); retrievalAction = new QMailRetrievalAction(this); connect(retrievalAction, SIGNAL(activityChanged(QMailServiceAction::Activity)), this, SLOT(activityChanged(QMailServiceAction::Activity))); connect(retrievalAction, SIGNAL(progressChanged(uint, uint)), this, SLOT(displayProgress(uint, uint))); transmitAction = new QMailTransmitAction(this); connect(transmitAction, SIGNAL(activityChanged(QMailServiceAction::Activity)), this, SLOT(activityChanged(QMailServiceAction::Activity))); connect(transmitAction, SIGNAL(progressChanged(uint, uint)), this, SLOT(displayProgress(uint, uint))); }