-void IdentitiesDlg::delNick() {
- int row = ui.nickList->currentRow();
- delete ui.nickList->takeItem(row);
- if(row <= ui.nickList->count() - 1) ui.nickList->setCurrentRow(row);
- else if(row > 0) ui.nickList->setCurrentRow(ui.nickList->count()-1);
- nickSelectionChanged();
-}
-
-void IdentitiesDlg::upNick() {
- int row = ui.nickList->currentRow();
- QListWidgetItem *item = ui.nickList->takeItem(row);
- ui.nickList->insertItem(row-1, item);
- ui.nickList->setCurrentRow(row-1);
- nickSelectionChanged();
-}
-
-void IdentitiesDlg::downNick() {
- int row = ui.nickList->currentRow();
- QListWidgetItem *item = ui.nickList->takeItem(row);
- ui.nickList->insertItem(row+1, item);
- ui.nickList->setCurrentRow(row+1);
- nickSelectionChanged();
-}
-
-void IdentitiesDlg::accept() {
- updateIdentity(getCurIdentity());
- QString result = checkValidity();
- if(result.length() == 0) QDialog::accept();
- else {
- QMessageBox::warning(this, tr("Invalid Identity!"),
- tr("One or more of your identities do not contain all necessary information:\n\n%1\n"
- "Please fill in any missing information.").arg(result));
- }
-}
-
-QString IdentitiesDlg::checkValidity() {
- QString reason;
- foreach(QString name, identities.keys()) {
- QString r;
- VarMap id = identities[name].toMap();
- if(name == "Default") name = tr("Default Identity");
- if(id["RealName"].toString().length() == 0) {
- r += tr(" You have not set a real name.");
- }
- if(id["Ident"].toString().length() == 0) {
- r += tr(" You have to specify an Ident.");
- }
- if(id["NickList"].toStringList().size() == 0) {
- r += tr(" You haven't entered any nicknames.");
- }
- if(r.length()>0) {
- reason += tr("[%1]%2\n").arg(name).arg(r);
- }
- }
- return reason;
-}
-
-void IdentitiesDlg::editIdentities() {
- updateIdentity(getCurIdentity());
- IdentitiesEditDlg dlg(this, identities, nameMapping, createDefaultIdentity());