internal refactoring: ripping identity editor and identitory settingspage apart
authorMarcus Eggenberger <egs@quassel-irc.org>
Sat, 14 Feb 2009 18:20:42 +0000 (19:20 +0100)
committerMarcus Eggenberger <egs@quassel-irc.org>
Sun, 15 Feb 2009 13:03:37 +0000 (14:03 +0100)
src/qtui/CMakeLists.txt
src/qtui/settingspages/identitiessettingspage.cpp
src/qtui/settingspages/identitiessettingspage.h
src/qtui/settingspages/identitiessettingspage.ui
src/qtui/settingspages/identityeditwidget.cpp [new file with mode: 0644]
src/qtui/settingspages/identityeditwidget.h [new file with mode: 0644]
src/qtui/settingspages/identityeditwidget.ui [new file with mode: 0644]
src/qtui/settingspages/settingspages.inc

index de9db43..3364c57 100644 (file)
@@ -168,6 +168,7 @@ qt4_wrap_ui(UI ${FORMPATH} ${SPFRM})
 include_directories(${CMAKE_SOURCE_DIR}/src/common
                     ${CMAKE_SOURCE_DIR}/src/client
                     ${CMAKE_SOURCE_DIR}/src/qtui
+                    ${CMAKE_SOURCE_DIR}/src/qtui/settingspages
                     ${CMAKE_SOURCE_DIR}/src/uisupport
                     ${CMAKE_CURRENT_BINARY_DIR})
 
index de7a02b..ca965aa 100644 (file)
 
 #include "identitiessettingspage.h"
 
-#include <QDesktopServices>
-#include <QDragEnterEvent>
-#include <QDropEvent>
-#include <QFileDialog>
 #include <QInputDialog>
 #include <QMessageBox>
 
@@ -35,70 +31,25 @@ IdentitiesSettingsPage::IdentitiesSettingsPage(QWidget *parent)
   : SettingsPage(tr("General"), tr("Identities"), parent),
     _editSsl(false)
 {
-
   ui.setupUi(this);
   ui.renameIdentity->setIcon(BarIcon("edit-rename"));
   ui.addIdentity->setIcon(BarIcon("list-add-user"));
   ui.deleteIdentity->setIcon(BarIcon("list-remove-user"));
-  ui.addNick->setIcon(SmallIcon("list-add"));
-  ui.deleteNick->setIcon(SmallIcon("edit-delete"));
-  ui.renameNick->setIcon(SmallIcon("edit-rename"));
-  ui.nickUp->setIcon(SmallIcon("go-up"));
-  ui.nickDown->setIcon(SmallIcon("go-down"));
 
   coreConnectionStateChanged(Client::isConnected());  // need a core connection!
-  setWidgetStates();
   connect(Client::instance(), SIGNAL(coreConnectionStateChanged(bool)), this, SLOT(coreConnectionStateChanged(bool)));
+
   connect(Client::instance(), SIGNAL(identityCreated(IdentityId)), this, SLOT(clientIdentityCreated(IdentityId)));
   connect(Client::instance(), SIGNAL(identityRemoved(IdentityId)), this, SLOT(clientIdentityRemoved(IdentityId)));
 
-  currentId = 0;
-
-  // We need to know whenever the state of input widgets changes...
-  //connect(ui.identityList, SIGNAL(editTextChanged(const QString &)), this, SLOT(widgetHasChanged()));
-  connect(ui.realName, SIGNAL(textEdited(const QString &)), this, SLOT(widgetHasChanged()));
-  connect(ui.nicknameList, SIGNAL(itemChanged(QListWidgetItem *)), this, SLOT(widgetHasChanged()));
-  connect(ui.awayNick, SIGNAL(textEdited(const QString &)), this, SLOT(widgetHasChanged()));
-  connect(ui.awayNickEnabled, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
-  connect(ui.awayReason, SIGNAL(textEdited(const QString &)), this, SLOT(widgetHasChanged()));
-  connect(ui.awayReasonEnabled, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
-  connect(ui.autoAwayEnabled, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
-  connect(ui.autoAwayTime, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
-  connect(ui.autoAwayReason, SIGNAL(textEdited(const QString &)), this, SLOT(widgetHasChanged()));
-  connect(ui.autoAwayReasonEnabled, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
-  connect(ui.detachAwayEnabled, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
-  connect(ui.detachAwayReason, SIGNAL(textEdited(const QString &)), this, SLOT(widgetHasChanged()));
-  connect(ui.detachAwayReasonEnabled, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
-  connect(ui.ident, SIGNAL(textEdited(const QString &)), this, SLOT(widgetHasChanged()));
-  connect(ui.kickReason, SIGNAL(textEdited(const QString &)), this, SLOT(widgetHasChanged()));
-  connect(ui.partReason, SIGNAL(textEdited(const QString &)), this, SLOT(widgetHasChanged()));
-  connect(ui.quitReason, SIGNAL(textEdited(const QString &)), this, SLOT(widgetHasChanged()));
-
-  connect(ui.nicknameList, SIGNAL(itemSelectionChanged()), this, SLOT(setWidgetStates()));
-
-  // we would need this if we enabled drag and drop in the nicklist...
-  //connect(ui.nicknameList, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(setWidgetStates()));
-  //connect(ui.nicknameList->model(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(nicklistHasChanged()));
-
+  connect(ui.identityEditor, SIGNAL(widgetHasChanged()), this, SLOT(widgetHasChanged()));
 #ifdef HAVE_SSL
-  ui.sslKeyGroupBox->setAcceptDrops(true);
-  ui.sslKeyGroupBox->installEventFilter(this);
-  ui.sslCertGroupBox->setAcceptDrops(true);
-  ui.sslCertGroupBox->installEventFilter(this);
+  connect(ui.identityEditor, SIGNAL(requestEditSsl()), this, SLOT(continueUnsecured()));
 #endif
-}
 
-void IdentitiesSettingsPage::setWidgetStates() {
-  if(ui.nicknameList->selectedItems().count()) {
-    ui.renameNick->setEnabled(true);
-    ui.nickUp->setEnabled(ui.nicknameList->row(ui.nicknameList->selectedItems()[0]) > 0);
-    ui.nickDown->setEnabled(ui.nicknameList->row(ui.nicknameList->selectedItems()[0]) < ui.nicknameList->count()-1);
-  } else {
-    ui.renameNick->setDisabled(true);
-    ui.nickUp->setDisabled(true);
-    ui.nickDown->setDisabled(true);
-  }
-  ui.deleteNick->setEnabled(ui.nicknameList->count() > 1);
+  currentId = 0;
+
+  //connect(ui.identityList, SIGNAL(editTextChanged(const QString &)), this, SLOT(widgetHasChanged()));
 }
 
 void IdentitiesSettingsPage::coreConnectionStateChanged(bool connected) {
@@ -106,14 +57,14 @@ void IdentitiesSettingsPage::coreConnectionStateChanged(bool connected) {
   if(connected) {
 #ifdef HAVE_SSL
     if(Client::signalProxy()->isSecure()) {
-      ui.keyAndCertSettings->setCurrentIndex(2);
+      ui.identityEditor->setSslState(IdentityEditWidget::AllowSsl);
       _editSsl = true;
     } else {
-      ui.keyAndCertSettings->setCurrentIndex(1);
+      ui.identityEditor->setSslState(IdentityEditWidget::UnsecureSsl);
       _editSsl = false;
     }
 #else
-    ui.keyAndCertSettings->setCurrentIndex(0);
+    ui.identityEditor->setSslState(IdentityEditWidget::NoSsl);
 #endif
     load();
   } else {
@@ -122,6 +73,19 @@ void IdentitiesSettingsPage::coreConnectionStateChanged(bool connected) {
   }
 }
 
+#ifdef HAVE_SSL
+void IdentitiesSettingsPage::continueUnsecured() {
+  _editSsl = true;
+
+  QHash<IdentityId, CertIdentity *>::iterator idIter;
+  for(idIter = identities.begin(); idIter != identities.end(); idIter++) {
+    idIter.value()->enableEditSsl();
+  }
+
+  ui.identityEditor->setSslState(IdentityEditWidget::AllowSsl);
+}
+#endif
+
 void IdentitiesSettingsPage::save() {
   setEnabled(false);
   QList<CertIdentity *> toCreate, toUpdate;
@@ -184,7 +148,7 @@ bool IdentitiesSettingsPage::testHasChanged() {
     if(currentId != 0) {
       changedIdentities.removeAll(currentId);
       CertIdentity temp(currentId, this);
-      saveToIdentity(&temp);
+      ui.identityEditor->saveToIdentity(&temp);
       temp.setIdentityName(identities[currentId]->identityName());
       if(temp != *Client::identity(currentId) || temp.isDirty())
        changedIdentities.append(currentId);
@@ -194,7 +158,7 @@ bool IdentitiesSettingsPage::testHasChanged() {
 }
 
 bool IdentitiesSettingsPage::aboutToSave() {
-  saveToIdentity(identities[currentId]);
+  ui.identityEditor->saveToIdentity(identities[currentId]);
   QList<int> errors;
   foreach(Identity *id, identities.values()) {
     if(id->identityName().isEmpty()) errors.append(1);
@@ -244,7 +208,7 @@ void IdentitiesSettingsPage::clientIdentityUpdated() {
   identity->copyFrom(*clientIdentity);
 
   if(identity->id() == currentId)
-    displayIdentity(identity, true);
+    ui.identityEditor->displayIdentity(identity);
 }
 
 void IdentitiesSettingsPage::clientIdentityRemoved(IdentityId id) {
@@ -292,80 +256,25 @@ void IdentitiesSettingsPage::removeIdentity(Identity *id) {
 }
 
 void IdentitiesSettingsPage::on_identityList_currentIndexChanged(int index) {
+  CertIdentity *previousIdentity = 0;
+  if(currentId != 0 && identities.contains(currentId))
+    previousIdentity = identities[currentId];
+
   if(index < 0) {
     //ui.identityList->setEditable(false);
-    displayIdentity(0);
+    ui.identityEditor->displayIdentity(0, previousIdentity);
+    currentId = 0;
   } else {
     IdentityId id = ui.identityList->itemData(index).toInt();
-    if(identities.contains(id)) displayIdentity(identities[id]);
+    if(identities.contains(id)) {
+      ui.identityEditor->displayIdentity(identities[id], previousIdentity);
+      currentId = id;
+    }
     ui.deleteIdentity->setEnabled(id != 1); // default identity cannot be deleted
     ui.renameIdentity->setEnabled(id != 1); // ...or renamed
   }
 }
 
-void IdentitiesSettingsPage::displayIdentity(CertIdentity *id, bool dontsave) {
-  if(currentId != 0 && !dontsave && identities.contains(currentId)) {
-    saveToIdentity(identities[currentId]);
-  }
-  if(id) {
-    currentId = id->id();
-    ui.realName->setText(id->realName());
-    ui.nicknameList->clear();
-    ui.nicknameList->addItems(id->nicks());
-    //for(int i = 0; i < ui.nicknameList->count(); i++) {
-    //  ui.nicknameList->item(i)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
-    //}
-    if(ui.nicknameList->count()) ui.nicknameList->setCurrentRow(0);
-    ui.awayNick->setText(id->awayNick());
-    ui.awayNickEnabled->setChecked(id->awayNickEnabled());
-    ui.awayReason->setText(id->awayReason());
-    ui.awayReasonEnabled->setChecked(id->awayReasonEnabled());
-    ui.autoAwayEnabled->setChecked(id->autoAwayEnabled());
-    ui.autoAwayTime->setValue(id->autoAwayTime());
-    ui.autoAwayReason->setText(id->autoAwayReason());
-    ui.autoAwayReasonEnabled->setChecked(id->autoAwayReasonEnabled());
-    ui.detachAwayEnabled->setChecked(id->detachAwayEnabled());
-    ui.detachAwayReason->setText(id->detachAwayReason());
-    ui.detachAwayReasonEnabled->setChecked(id->detachAwayReasonEnabled());
-    ui.ident->setText(id->ident());
-    ui.kickReason->setText(id->kickReason());
-    ui.partReason->setText(id->partReason());
-    ui.quitReason->setText(id->quitReason());
-#ifdef HAVE_SSL
-    showKeyState(id->sslKey());
-    showCertState(id->sslCert());
-#endif
-  }
-}
-
-void IdentitiesSettingsPage::saveToIdentity(CertIdentity *id) {
-  id->setRealName(ui.realName->text());
-  QStringList nicks;
-  for(int i = 0; i < ui.nicknameList->count(); i++) {
-    nicks << ui.nicknameList->item(i)->text();
-  }
-  id->setNicks(nicks);
-  id->setAwayNick(ui.awayNick->text());
-  id->setAwayNickEnabled(ui.awayNickEnabled->isChecked());
-  id->setAwayReason(ui.awayReason->text());
-  id->setAwayReasonEnabled(ui.awayReasonEnabled->isChecked());
-  id->setAutoAwayEnabled(ui.autoAwayEnabled->isChecked());
-  id->setAutoAwayTime(ui.autoAwayTime->value());
-  id->setAutoAwayReason(ui.autoAwayReason->text());
-  id->setAutoAwayReasonEnabled(ui.autoAwayReasonEnabled->isChecked());
-  id->setDetachAwayEnabled(ui.detachAwayEnabled->isChecked());
-  id->setDetachAwayReason(ui.detachAwayReason->text());
-  id->setDetachAwayReasonEnabled(ui.detachAwayReasonEnabled->isChecked());
-  id->setIdent(ui.ident->text());
-  id->setKickReason(ui.kickReason->text());
-  id->setPartReason(ui.partReason->text());
-  id->setQuitReason(ui.quitReason->text());
-#ifdef HAVE_SSL
-  id->setSslKey(QSslKey(ui.keyTypeLabel->property("sslKey").toByteArray(), (QSsl::KeyAlgorithm)(ui.keyTypeLabel->property("sslKeyType").toInt())));
-  id->setSslCert(QSslCertificate(ui.certOrgLabel->property("sslCert").toByteArray()));
-#endif
-}
-
 void IdentitiesSettingsPage::on_addIdentity_clicked() {
   CreateIdentityDlg dlg(ui.identityList->model(), this);
   if(dlg.exec() == QDialog::Accepted) {
@@ -415,207 +324,6 @@ void IdentitiesSettingsPage::on_renameIdentity_clicked() {
   }
 }
 
-void IdentitiesSettingsPage::on_addNick_clicked() {
-  QStringList existing;
-  for(int i = 0; i < ui.nicknameList->count(); i++) existing << ui.nicknameList->item(i)->text();
-  NickEditDlg dlg(QString(), existing, this);
-  if(dlg.exec() == QDialog::Accepted) {
-    ui.nicknameList->addItem(dlg.nick());
-    ui.nicknameList->setCurrentRow(ui.nicknameList->count()-1);
-    setWidgetStates();
-    widgetHasChanged();
-  }
-}
-
-void IdentitiesSettingsPage::on_deleteNick_clicked() {
-  // no confirmation, since a nickname is really nothing hard to recreate
-  if(ui.nicknameList->selectedItems().count()) {
-    delete ui.nicknameList->takeItem(ui.nicknameList->row(ui.nicknameList->selectedItems()[0]));
-    ui.nicknameList->setCurrentRow(qMin(ui.nicknameList->currentRow()+1, ui.nicknameList->count()-1));
-    setWidgetStates();
-    widgetHasChanged();
-  }
-}
-
-void IdentitiesSettingsPage::on_renameNick_clicked() {
-  if(!ui.nicknameList->selectedItems().count()) return;
-  QString old = ui.nicknameList->selectedItems()[0]->text();
-  QStringList existing;
-  for(int i = 0; i < ui.nicknameList->count(); i++) existing << ui.nicknameList->item(i)->text();
-  NickEditDlg dlg(old, existing, this);
-  if(dlg.exec() == QDialog::Accepted) {
-    ui.nicknameList->selectedItems()[0]->setText(dlg.nick());
-  }
-
-}
-
-void IdentitiesSettingsPage::on_nickUp_clicked() {
-  if(!ui.nicknameList->selectedItems().count()) return;
-  int row = ui.nicknameList->row(ui.nicknameList->selectedItems()[0]);
-  if(row > 0) {
-    ui.nicknameList->insertItem(row-1, ui.nicknameList->takeItem(row));
-    ui.nicknameList->setCurrentRow(row-1);
-    setWidgetStates();
-    widgetHasChanged();
-  }
-}
-
-void IdentitiesSettingsPage::on_nickDown_clicked() {
-  if(!ui.nicknameList->selectedItems().count()) return;
-  int row = ui.nicknameList->row(ui.nicknameList->selectedItems()[0]);
-  if(row < ui.nicknameList->count()-1) {
-    ui.nicknameList->insertItem(row+1, ui.nicknameList->takeItem(row));
-    ui.nicknameList->setCurrentRow(row+1);
-    setWidgetStates();
-    widgetHasChanged();
-  }
-}
-
-#ifdef HAVE_SSL
-void IdentitiesSettingsPage::on_continueUnsecured_clicked() {
-  _editSsl = true;
-
-  QHash<IdentityId, CertIdentity *>::iterator idIter;
-  for(idIter = identities.begin(); idIter != identities.end(); idIter++) {
-    idIter.value()->enableEditSsl();
-  }
-
-  ui.keyAndCertSettings->setCurrentIndex(2);
-}
-
-bool IdentitiesSettingsPage::eventFilter(QObject *watched, QEvent *event) {
-  bool isCert = (watched == ui.sslCertGroupBox);
-  switch(event->type()) {
-  case QEvent::DragEnter:
-    sslDragEnterEvent(static_cast<QDragEnterEvent *>(event));
-    return true;
-  case QEvent::Drop:
-    sslDropEvent(static_cast<QDropEvent *>(event), isCert);
-    return true;
-  default:
-    return false;
-  }
-}
-
-void IdentitiesSettingsPage::sslDragEnterEvent(QDragEnterEvent *event) {
-  if(event->mimeData()->hasFormat("text/uri-list") || event->mimeData()->hasFormat("text/uri")) {
-    event->setDropAction(Qt::CopyAction);
-    event->accept();
-  }
-}
-
-void IdentitiesSettingsPage::sslDropEvent(QDropEvent *event, bool isCert) {
-  QByteArray rawUris;
-  if(event->mimeData()->hasFormat("text/uri-list"))
-    rawUris = event->mimeData()->data("text/uri-list");
-  else
-    rawUris = event->mimeData()->data("text/uri");
-
-  QTextStream uriStream(rawUris);
-  QString filename = QUrl(uriStream.readLine()).toLocalFile();
-
-  if(isCert) {
-    QSslCertificate cert = certByFilename(filename);
-    if(cert.isValid())
-      showCertState(cert);
-  } else {
-    QSslKey key = keyByFilename(filename);
-    if(!key.isNull())
-      showKeyState(key);
-  }
-  event->accept();
-  widgetHasChanged();
-}
-
-void IdentitiesSettingsPage::on_clearOrLoadKeyButton_clicked() {
-  QSslKey key;
-
-  if(ui.keyTypeLabel->property("sslKey").toByteArray().isEmpty())
-    key = keyByFilename(QFileDialog::getOpenFileName(this, tr("Load a Key"), QDesktopServices::storageLocation(QDesktopServices::HomeLocation)));
-
-  showKeyState(key);
-  widgetHasChanged();
-}
-
-QSslKey IdentitiesSettingsPage::keyByFilename(const QString &filename) {
-  QSslKey key;
-
-  QFile keyFile(filename);
-  keyFile.open(QIODevice::ReadOnly);
-  QByteArray keyRaw = keyFile.read(2 << 20);
-  keyFile.close();
-
-  for(int i = 0; i < 2; i++) {
-    for(int j = 0; j < 2; j++) {
-      key = QSslKey(keyRaw, (QSsl::KeyAlgorithm)j, (QSsl::EncodingFormat)i);
-      if(!key.isNull())
-       goto returnKey;
-    }
-  }
- returnKey:
-  return key;
-}
-
-void IdentitiesSettingsPage::showKeyState(const QSslKey &key) {
-  if(key.isNull()) {
-    ui.keyTypeLabel->setText(tr("No Key loaded"));
-    ui.clearOrLoadKeyButton->setText(tr("Load"));
-  } else {
-    switch(key.algorithm()) {
-    case QSsl::Rsa:
-      ui.keyTypeLabel->setText(tr("RSA"));
-      break;
-    case QSsl::Dsa:
-      ui.keyTypeLabel->setText(tr("DSA"));
-      break;
-    default:
-      ui.keyTypeLabel->setText(tr("No Key loaded"));
-    }
-    ui.clearOrLoadKeyButton->setText(tr("Clear"));
-  }
-  ui.keyTypeLabel->setProperty("sslKey", key.toPem());
-  ui.keyTypeLabel->setProperty("sslKeyType", (int)key.algorithm());
-}
-
-void IdentitiesSettingsPage::on_clearOrLoadCertButton_clicked() {
-  QSslCertificate cert;
-
-  if(ui.certOrgLabel->property("sslCert").toByteArray().isEmpty())
-    cert = certByFilename(QFileDialog::getOpenFileName(this, tr("Load a Certificate"), QDesktopServices::storageLocation(QDesktopServices::HomeLocation)));
-
-  showCertState(cert);
-  widgetHasChanged();
-}
-
-QSslCertificate IdentitiesSettingsPage::certByFilename(const QString &filename) {
-  QSslCertificate cert;
-  QFile certFile(filename);
-  certFile.open(QIODevice::ReadOnly);
-  QByteArray certRaw = certFile.read(2 << 20);
-  certFile.close();
-
-  for(int i = 0; i < 2; i++) {
-    cert = QSslCertificate(certRaw, (QSsl::EncodingFormat)i);
-    if(cert.isValid())
-      break;
-  }
-  return cert;
-}
-
-void IdentitiesSettingsPage::showCertState(const QSslCertificate &cert) {
-  if(!cert.isValid()) {
-    ui.certOrgLabel->setText(tr("No Certificate loaded"));
-    ui.certCNameLabel->setText(tr("No Certificate loaded"));
-    ui.clearOrLoadCertButton->setText(tr("Load"));
-  } else {
-    ui.certOrgLabel->setText(cert.subjectInfo(QSslCertificate::Organization));
-    ui.certCNameLabel->setText(cert.subjectInfo(QSslCertificate::CommonName));
-    ui.clearOrLoadCertButton->setText(tr("Clear"));
-  }
-  ui.certOrgLabel->setProperty("sslCert", cert.toPem());
- }
-#endif //HAVE_SSL
-
 /*****************************************************************************************/
 
 CreateIdentityDlg::CreateIdentityDlg(QAbstractItemModel *model, QWidget *parent)
index 7c97916..a6d21b2 100644 (file)
 #include "clientidentity.h"
 #include "settingspage.h"
 
+#include "identityeditwidget.h"
+
 #include "ui_identitiessettingspage.h"
 #include "ui_createidentitydlg.h"
 #include "ui_saveidentitiesdlg.h"
-#include "ui_nickeditdlg.h"
-
-#ifdef HAVE_SSL
-#include <QSslCertificate>
-#include <QSslKey>
-#endif
 
 class QAbstractItemModel;
 
@@ -48,11 +44,6 @@ public slots:
   void save();
   void load();
 
-#ifdef HAVE_SSL
-protected:
-  virtual bool eventFilter(QObject *watched, QEvent *event);
-#endif
-
 private slots:
   void coreConnectionStateChanged(bool);
   void clientIdentityCreated(IdentityId);
@@ -65,24 +56,10 @@ private slots:
   void on_deleteIdentity_clicked();
   void on_renameIdentity_clicked();
 
-  void on_addNick_clicked();
-  void on_deleteNick_clicked();
-  void on_renameNick_clicked();
-  void on_nickUp_clicked();
-  void on_nickDown_clicked();
-
 #ifdef HAVE_SSL
-  void on_continueUnsecured_clicked();
-  void on_clearOrLoadKeyButton_clicked();
-  void on_clearOrLoadCertButton_clicked();
+  void continueUnsecured();
 #endif
   void widgetHasChanged();
-  void setWidgetStates();
-
-#ifdef HAVE_SSL
-  void sslDragEnterEvent(QDragEnterEvent *event);
-  void sslDropEvent(QDropEvent *event, bool isCert);
-#endif
 
 private:
   Ui::IdentitiesSettingsPage ui;
@@ -98,8 +75,6 @@ private:
   void insertIdentity(CertIdentity *identity);
   void removeIdentity(Identity *identity);
   void renameIdentity(IdentityId id, const QString &newName);
-  void displayIdentity(CertIdentity *, bool dontsave = false);
-  void saveToIdentity(CertIdentity *);
 
 #ifdef HAVE_SSL
   QSslKey keyByFilename(const QString &filename);
@@ -111,6 +86,9 @@ private:
   bool testHasChanged();
 };
 
+// ==============================
+//  Various Dialogs
+// ==============================
 class CreateIdentityDlg : public QDialog {
   Q_OBJECT
 
@@ -127,6 +105,8 @@ private:
   Ui::CreateIdentityDlg ui;
 };
 
+
+
 class SaveIdentitiesDlg : public QDialog {
   Q_OBJECT
 
@@ -142,23 +122,6 @@ private:
   int numevents, rcvevents;
 };
 
-class NickEditDlg : public QDialog {
-  Q_OBJECT
-
-public:
-  NickEditDlg(const QString &oldnick, const QStringList &existing = QStringList(), QWidget *parent = 0);
-
-  QString nick() const;
 
-private slots:
-  void on_nickEdit_textChanged(const QString &);
-
-private:
-  Ui::NickEditDlg ui;
-
-  QString oldNick;
-  QStringList existing;
-
-};
 
 #endif
index f4edd33..ed9c5b3 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>430</width>
-    <height>492</height>
+    <width>256</width>
+    <height>183</height>
    </rect>
   </property>
   <property name="windowTitle" >
     </layout>
    </item>
    <item>
-    <widget class="QTabWidget" name="tabWidget" >
-     <property name="currentIndex" >
-      <number>0</number>
-     </property>
-     <widget class="QWidget" name="generalTab" >
-      <property name="geometry" >
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>400</width>
-        <height>399</height>
-       </rect>
-      </property>
-      <attribute name="title" >
-       <string>General</string>
-      </attribute>
-      <layout class="QVBoxLayout" >
-       <item>
-        <layout class="QHBoxLayout" >
-         <item>
-          <widget class="QLabel" name="label" >
-           <property name="text" >
-            <string>Real Name:</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QLineEdit" name="realName" >
-           <property name="whatsThis" >
-            <string>The "Real Name" is shown in /whois.</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <widget class="QGroupBox" name="groupBox" >
-         <property name="title" >
-          <string>Nicknames</string>
-         </property>
-         <layout class="QHBoxLayout" >
-          <item>
-           <widget class="QListWidget" name="nicknameList" >
-            <property name="sizePolicy" >
-             <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
-              <horstretch>1</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-            <property name="showDropIndicator" stdset="0" >
-             <bool>true</bool>
-            </property>
-            <property name="dragEnabled" >
-             <bool>false</bool>
-            </property>
-            <property name="dragDropMode" >
-             <enum>QAbstractItemView::NoDragDrop</enum>
-            </property>
-            <property name="selectionBehavior" >
-             <enum>QAbstractItemView::SelectRows</enum>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <layout class="QVBoxLayout" >
-            <item>
-             <widget class="QPushButton" name="addNick" >
-              <property name="sizePolicy" >
-               <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="toolTip" >
-               <string>Add Nickname</string>
-              </property>
-              <property name="text" >
-               <string>&amp;Add...</string>
-              </property>
-              <property name="icon" >
-               <iconset>
-                <normaloff>:/16x16/actions/oxygen/16x16/actions/list-add.png</normaloff>:/16x16/actions/oxygen/16x16/actions/list-add.png</iconset>
-              </property>
-              <property name="iconSize" >
-               <size>
-                <width>16</width>
-                <height>16</height>
-               </size>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QPushButton" name="deleteNick" >
-              <property name="sizePolicy" >
-               <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="toolTip" >
-               <string>Remove Nickname</string>
-              </property>
-              <property name="text" >
-               <string>Remove</string>
-              </property>
-              <property name="icon" >
-               <iconset>
-                <normaloff>:/16x16/actions/oxygen/16x16/actions/edit-delete.png</normaloff>:/16x16/actions/oxygen/16x16/actions/edit-delete.png</iconset>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QPushButton" name="renameNick" >
-              <property name="sizePolicy" >
-               <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="toolTip" >
-               <string>Rename Identity</string>
-              </property>
-              <property name="text" >
-               <string>Re&amp;name...</string>
-              </property>
-              <property name="icon" >
-               <iconset>
-                <normaloff>:/16x16/actions/oxygen/16x16/actions/edit-rename.png</normaloff>:/16x16/actions/oxygen/16x16/actions/edit-rename.png</iconset>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <layout class="QHBoxLayout" >
-              <item>
-               <spacer>
-                <property name="orientation" >
-                 <enum>Qt::Horizontal</enum>
-                </property>
-                <property name="sizeHint" stdset="0" >
-                 <size>
-                  <width>0</width>
-                  <height>20</height>
-                 </size>
-                </property>
-               </spacer>
-              </item>
-              <item>
-               <widget class="QToolButton" name="nickUp" >
-                <property name="toolTip" >
-                 <string>Move upwards in list</string>
-                </property>
-                <property name="text" >
-                 <string>...</string>
-                </property>
-                <property name="icon" >
-                 <iconset>
-                  <normaloff>:/16x16/actions/oxygen/16x16/actions/go-up.png</normaloff>:/16x16/actions/oxygen/16x16/actions/go-up.png</iconset>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="QToolButton" name="nickDown" >
-                <property name="toolTip" >
-                 <string>Move downwards in list</string>
-                </property>
-                <property name="text" >
-                 <string>...</string>
-                </property>
-                <property name="icon" >
-                 <iconset>
-                  <normaloff>:/16x16/actions/oxygen/16x16/actions/go-down.png</normaloff>:/16x16/actions/oxygen/16x16/actions/go-down.png</iconset>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <spacer>
-                <property name="orientation" >
-                 <enum>Qt::Horizontal</enum>
-                </property>
-                <property name="sizeHint" stdset="0" >
-                 <size>
-                  <width>0</width>
-                  <height>20</height>
-                 </size>
-                </property>
-               </spacer>
-              </item>
-             </layout>
-            </item>
-            <item>
-             <spacer>
-              <property name="orientation" >
-               <enum>Qt::Vertical</enum>
-              </property>
-              <property name="sizeHint" stdset="0" >
-               <size>
-                <width>124</width>
-                <height>76</height>
-               </size>
-              </property>
-             </spacer>
-            </item>
-           </layout>
-          </item>
-         </layout>
-        </widget>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="awayTab" >
-      <property name="geometry" >
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>400</width>
-        <height>399</height>
-       </rect>
-      </property>
-      <attribute name="title" >
-       <string>A&amp;way</string>
-      </attribute>
-      <layout class="QVBoxLayout" name="verticalLayout_4" >
-       <item>
-        <widget class="QGroupBox" name="groupBox_2" >
-         <property name="title" >
-          <string>Default Away Settings</string>
-         </property>
-         <layout class="QVBoxLayout" name="verticalLayout_3" >
-          <item>
-           <layout class="QGridLayout" >
-            <item row="0" column="1" >
-             <widget class="QLineEdit" name="awayNick" >
-              <property name="enabled" >
-               <bool>false</bool>
-              </property>
-              <property name="toolTip" >
-               <string>Nick to be used when being away</string>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="0" >
-             <widget class="QCheckBox" name="awayReasonEnabled" >
-              <property name="toolTip" >
-               <string>Default away reason</string>
-              </property>
-              <property name="text" >
-               <string>Away Reason:</string>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="1" >
-             <widget class="QLineEdit" name="awayReason" >
-              <property name="enabled" >
-               <bool>false</bool>
-              </property>
-              <property name="toolTip" >
-               <string>Default away reason</string>
-              </property>
-             </widget>
-            </item>
-            <item row="0" column="0" >
-             <widget class="QCheckBox" name="awayNickEnabled" >
-              <property name="enabled" >
-               <bool>false</bool>
-              </property>
-              <property name="toolTip" >
-               <string>Nick to be used when being away</string>
-              </property>
-              <property name="text" >
-               <string>Away Nick:</string>
-              </property>
-             </widget>
-            </item>
-           </layout>
-          </item>
-         </layout>
-        </widget>
-       </item>
-       <item>
-        <widget class="QGroupBox" name="detachAwayEnabled" >
-         <property name="toolTip" >
-          <string>Set away when all clients have detached from the core</string>
-         </property>
-         <property name="title" >
-          <string>Away On Detach</string>
-         </property>
-         <property name="checkable" >
-          <bool>true</bool>
-         </property>
-         <property name="checked" >
-          <bool>false</bool>
-         </property>
-         <layout class="QVBoxLayout" name="verticalLayout" >
-          <item>
-           <layout class="QHBoxLayout" name="horizontalLayout" >
-            <item>
-             <widget class="QCheckBox" name="detachAwayReasonEnabled" >
-              <property name="toolTip" >
-               <string>Override default away reason for auto-away on detach</string>
-              </property>
-              <property name="text" >
-               <string>Away Reason:</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QLineEdit" name="detachAwayReason" >
-              <property name="enabled" >
-               <bool>false</bool>
-              </property>
-              <property name="toolTip" >
-               <string>Override default away reason for auto-away on detach</string>
-              </property>
-             </widget>
-            </item>
-           </layout>
-          </item>
-         </layout>
-        </widget>
-       </item>
-       <item>
-        <widget class="QGroupBox" name="autoAwayEnabled" >
-         <property name="enabled" >
-          <bool>false</bool>
-         </property>
-         <property name="toolTip" >
-          <string>Not implemented yet</string>
-         </property>
-         <property name="title" >
-          <string>Away On Idle</string>
-         </property>
-         <property name="checkable" >
-          <bool>true</bool>
-         </property>
-         <property name="checked" >
-          <bool>false</bool>
-         </property>
-         <layout class="QVBoxLayout" name="verticalLayout_2" >
-          <item>
-           <layout class="QHBoxLayout" >
-            <item>
-             <widget class="QLabel" name="autoAwayLabel_1" >
-              <property name="text" >
-               <string>Set away after</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QSpinBox" name="autoAwayTime" />
-            </item>
-            <item>
-             <widget class="QLabel" name="autoAwayLabel_2" >
-              <property name="text" >
-               <string>minutes of being idle</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <spacer>
-              <property name="orientation" >
-               <enum>Qt::Horizontal</enum>
-              </property>
-              <property name="sizeHint" stdset="0" >
-               <size>
-                <width>40</width>
-                <height>20</height>
-               </size>
-              </property>
-             </spacer>
-            </item>
-           </layout>
-          </item>
-          <item>
-           <layout class="QGridLayout" >
-            <item row="0" column="0" >
-             <widget class="QCheckBox" name="autoAwayReasonEnabled" >
-              <property name="text" >
-               <string>Away Reason:</string>
-              </property>
-             </widget>
-            </item>
-            <item row="0" column="1" >
-             <widget class="QLineEdit" name="autoAwayReason" >
-              <property name="enabled" >
-               <bool>false</bool>
-              </property>
-             </widget>
-            </item>
-           </layout>
-          </item>
-         </layout>
-        </widget>
-       </item>
-       <item>
-        <spacer>
-         <property name="orientation" >
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" stdset="0" >
-          <size>
-           <width>20</width>
-           <height>40</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="advancedTab" >
-      <property name="geometry" >
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>400</width>
-        <height>399</height>
-       </rect>
-      </property>
-      <attribute name="title" >
-       <string>Advanced</string>
-      </attribute>
-      <layout class="QVBoxLayout" name="verticalLayout_12" >
-       <item>
-        <layout class="QHBoxLayout" >
-         <item>
-          <widget class="QLabel" name="label_2" >
-           <property name="text" >
-            <string>Ident:</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QLineEdit" name="ident" >
-           <property name="whatsThis" >
-            <string>The "ident" is part of your hostmask and, together with your host, uniquely identifies you within the IRC network.</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <widget class="QGroupBox" name="groupBox_3" >
-         <property name="title" >
-          <string>Messages</string>
-         </property>
-         <layout class="QVBoxLayout" >
-          <item>
-           <layout class="QGridLayout" >
-            <item row="1" column="0" >
-             <widget class="QLabel" name="label_3" >
-              <property name="text" >
-               <string>Part Reason:</string>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="1" >
-             <widget class="QLineEdit" name="partReason" />
-            </item>
-            <item row="0" column="1" >
-             <widget class="QLineEdit" name="kickReason" />
-            </item>
-            <item row="2" column="0" >
-             <widget class="QLabel" name="label_5" >
-              <property name="text" >
-               <string>Quit Reason:</string>
-              </property>
-             </widget>
-            </item>
-            <item row="2" column="1" >
-             <widget class="QLineEdit" name="quitReason" />
-            </item>
-            <item row="0" column="0" >
-             <widget class="QLabel" name="label_4" >
-              <property name="text" >
-               <string>Kick Reason:</string>
-              </property>
-             </widget>
-            </item>
-           </layout>
-          </item>
-         </layout>
-        </widget>
-       </item>
-       <item>
-        <widget class="QStackedWidget" name="keyAndCertSettings" >
-         <property name="styleSheet" >
-          <string notr="true" />
-         </property>
-         <property name="lineWidth" >
-          <number>0</number>
-         </property>
-         <property name="currentIndex" >
-          <number>0</number>
-         </property>
-         <widget class="QWidget" name="pageNoSsl" >
-          <layout class="QVBoxLayout" name="verticalLayout_8" >
-           <property name="margin" >
-            <number>0</number>
-           </property>
-           <item>
-            <widget class="QGroupBox" name="groupBox_6" >
-             <property name="title" >
-              <string/>
-             </property>
-             <layout class="QVBoxLayout" name="verticalLayout_9" >
-              <item>
-               <widget class="QLabel" name="label_8" >
-                <property name="text" >
-                 <string>You need an SSL Capable Client to edit your Cores SSL Key and Certificate</string>
-                </property>
-                <property name="alignment" >
-                 <set>Qt::AlignCenter</set>
-                </property>
-                <property name="wordWrap" >
-                 <bool>true</bool>
-                </property>
-               </widget>
-              </item>
-             </layout>
-            </widget>
-           </item>
-          </layout>
-         </widget>
-         <widget class="QWidget" name="pageUnsecure" >
-          <layout class="QVBoxLayout" name="verticalLayout_7" >
-           <property name="margin" >
-            <number>0</number>
-           </property>
-           <item>
-            <widget class="QGroupBox" name="groupBox_5" >
-             <property name="title" >
-              <string/>
-             </property>
-             <layout class="QVBoxLayout" name="verticalLayout_6" >
-              <item>
-               <widget class="QLabel" name="label_7" >
-                <property name="text" >
-                 <string>Warning: you are not connected with a secured connection to the Quassel Core!
-Proceeding will cause an unencrypted transfer of your SSL Key and SSL Certificate!</string>
-                </property>
-                <property name="alignment" >
-                 <set>Qt::AlignCenter</set>
-                </property>
-                <property name="wordWrap" >
-                 <bool>true</bool>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <layout class="QHBoxLayout" name="horizontalLayout_2" >
-                <item>
-                 <spacer name="horizontalSpacer" >
-                  <property name="orientation" >
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0" >
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item>
-                 <widget class="QPushButton" name="continueUnsecured" >
-                  <property name="text" >
-                   <string>Continue</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="horizontalSpacer_3" >
-                  <property name="orientation" >
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0" >
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-               </layout>
-              </item>
-             </layout>
-            </widget>
-           </item>
-          </layout>
-         </widget>
-         <widget class="QWidget" name="pageEditSsl" >
-          <property name="geometry" >
-           <rect>
-            <x>0</x>
-            <y>0</y>
-            <width>360</width>
-            <height>173</height>
-           </rect>
-          </property>
-          <layout class="QVBoxLayout" name="verticalLayout_11" >
-           <property name="spacing" >
-            <number>0</number>
-           </property>
-           <property name="margin" >
-            <number>0</number>
-           </property>
-           <item>
-            <widget class="QGroupBox" name="sslKeyGroupBox" >
-             <property name="styleSheet" >
-              <string notr="true" />
-             </property>
-             <property name="title" >
-              <string>Use SSL Key</string>
-             </property>
-             <property name="checkable" >
-              <bool>false</bool>
-             </property>
-             <property name="checked" >
-              <bool>false</bool>
-             </property>
-             <layout class="QVBoxLayout" name="verticalLayout_5" >
-              <item>
-               <layout class="QHBoxLayout" name="horizontalLayout_3" >
-                <item>
-                 <widget class="QLabel" name="label_6" >
-                  <property name="text" >
-                   <string>Key Type:</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <widget class="QLabel" name="keyTypeLabel" >
-                  <property name="text" >
-                   <string>No Key loaded</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="horizontalSpacer_2" >
-                  <property name="orientation" >
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0" >
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item>
-                 <widget class="QPushButton" name="clearOrLoadKeyButton" >
-                  <property name="text" >
-                   <string>Load</string>
-                  </property>
-                 </widget>
-                </item>
-               </layout>
-              </item>
-             </layout>
-            </widget>
-           </item>
-           <item>
-            <widget class="QGroupBox" name="sslCertGroupBox" >
-             <property name="title" >
-              <string>Use SSL Certificate</string>
-             </property>
-             <layout class="QHBoxLayout" name="horizontalLayout_6" >
-              <property name="spacing" >
-               <number>0</number>
-              </property>
-              <item>
-               <layout class="QVBoxLayout" name="verticalLayout_10" >
-                <property name="spacing" >
-                 <number>0</number>
-                </property>
-                <item>
-                 <layout class="QHBoxLayout" name="horizontalLayout_4" >
-                  <property name="spacing" >
-                   <number>8</number>
-                  </property>
-                  <item>
-                   <widget class="QLabel" name="label_9" >
-                    <property name="text" >
-                     <string>Organisation:</string>
-                    </property>
-                   </widget>
-                  </item>
-                  <item>
-                   <widget class="QLabel" name="certOrgLabel" >
-                    <property name="text" >
-                     <string>No Certificate loaded</string>
-                    </property>
-                   </widget>
-                  </item>
-                  <item>
-                   <spacer name="horizontalSpacer_4" >
-                    <property name="orientation" >
-                     <enum>Qt::Horizontal</enum>
-                    </property>
-                    <property name="sizeHint" stdset="0" >
-                     <size>
-                      <width>40</width>
-                      <height>20</height>
-                     </size>
-                    </property>
-                   </spacer>
-                  </item>
-                 </layout>
-                </item>
-                <item>
-                 <layout class="QHBoxLayout" name="horizontalLayout_5" >
-                  <property name="spacing" >
-                   <number>8</number>
-                  </property>
-                  <item>
-                   <widget class="QLabel" name="label_10" >
-                    <property name="text" >
-                     <string>CommonName:</string>
-                    </property>
-                   </widget>
-                  </item>
-                  <item>
-                   <widget class="QLabel" name="certCNameLabel" >
-                    <property name="text" >
-                     <string>No Certificate loaded</string>
-                    </property>
-                   </widget>
-                  </item>
-                  <item>
-                   <spacer name="horizontalSpacer_5" >
-                    <property name="orientation" >
-                     <enum>Qt::Horizontal</enum>
-                    </property>
-                    <property name="sizeHint" stdset="0" >
-                     <size>
-                      <width>40</width>
-                      <height>20</height>
-                     </size>
-                    </property>
-                   </spacer>
-                  </item>
-                 </layout>
-                </item>
-               </layout>
-              </item>
-              <item>
-               <layout class="QVBoxLayout" name="verticalLayout_14" >
-                <item>
-                 <widget class="QPushButton" name="clearOrLoadCertButton" >
-                  <property name="text" >
-                   <string>Load</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="verticalSpacer_2" >
-                  <property name="orientation" >
-                   <enum>Qt::Vertical</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0" >
-                   <size>
-                    <width>20</width>
-                    <height>40</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-               </layout>
-              </item>
-             </layout>
-            </widget>
-           </item>
-          </layout>
-         </widget>
-        </widget>
-       </item>
-       <item>
-        <spacer name="verticalSpacer" >
-         <property name="orientation" >
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" stdset="0" >
-          <size>
-           <width>20</width>
-           <height>40</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-      </layout>
-     </widget>
-    </widget>
+    <widget class="IdentityEditWidget" native="1" name="identityEditor" />
    </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>IdentityEditWidget</class>
+   <extends>QWidget</extends>
+   <header location="global" >identityeditwidget.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <tabstops>
   <tabstop>identityList</tabstop>
   <tabstop>renameIdentity</tabstop>
   <tabstop>addIdentity</tabstop>
   <tabstop>deleteIdentity</tabstop>
-  <tabstop>tabWidget</tabstop>
-  <tabstop>realName</tabstop>
-  <tabstop>nicknameList</tabstop>
-  <tabstop>addNick</tabstop>
-  <tabstop>deleteNick</tabstop>
-  <tabstop>renameNick</tabstop>
-  <tabstop>nickUp</tabstop>
-  <tabstop>nickDown</tabstop>
-  <tabstop>awayNick</tabstop>
-  <tabstop>awayReasonEnabled</tabstop>
-  <tabstop>awayReason</tabstop>
-  <tabstop>awayNickEnabled</tabstop>
-  <tabstop>autoAwayEnabled</tabstop>
-  <tabstop>autoAwayTime</tabstop>
-  <tabstop>autoAwayReasonEnabled</tabstop>
-  <tabstop>autoAwayReason</tabstop>
-  <tabstop>ident</tabstop>
-  <tabstop>kickReason</tabstop>
-  <tabstop>partReason</tabstop>
-  <tabstop>quitReason</tabstop>
  </tabstops>
  <resources/>
- <connections>
-  <connection>
-   <sender>awayNickEnabled</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>awayNick</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>71</x>
-     <y>128</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>314</x>
-     <y>129</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>awayReasonEnabled</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>awayReason</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>81</x>
-     <y>156</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>306</x>
-     <y>157</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>autoAwayReasonEnabled</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>autoAwayReason</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>157</x>
-     <y>382</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>454</x>
-     <y>382</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>detachAwayReasonEnabled</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>detachAwayReason</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>64</x>
-     <y>256</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>343</x>
-     <y>256</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
+ <connections/>
 </ui>
diff --git a/src/qtui/settingspages/identityeditwidget.cpp b/src/qtui/settingspages/identityeditwidget.cpp
new file mode 100644 (file)
index 0000000..b652c7b
--- /dev/null
@@ -0,0 +1,358 @@
+/***************************************************************************
+ *   Copyright (C) 2005-08 by the Quassel Project                          *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) version 3.                                           *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#include "identityeditwidget.h"
+
+#include <QDesktopServices>
+#include <QDragEnterEvent>
+#include <QDropEvent>
+#include <QFileDialog>
+#include <QUrl>
+
+#include "iconloader.h"
+
+IdentityEditWidget::IdentityEditWidget(QWidget *parent)
+  : QWidget(parent)
+{
+  ui.setupUi(this);
+
+  ui.addNick->setIcon(SmallIcon("list-add"));
+  ui.deleteNick->setIcon(SmallIcon("edit-delete"));
+  ui.renameNick->setIcon(SmallIcon("edit-rename"));
+  ui.nickUp->setIcon(SmallIcon("go-up"));
+  ui.nickDown->setIcon(SmallIcon("go-down"));
+
+  // We need to know whenever the state of input widgets changes...
+  connect(ui.realName, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.nicknameList, SIGNAL(itemChanged(QListWidgetItem *)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.awayNick, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.awayNickEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.awayReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.awayReasonEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.autoAwayEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.autoAwayTime, SIGNAL(valueChanged(int)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.autoAwayReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.autoAwayReasonEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.detachAwayEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.detachAwayReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.detachAwayReasonEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.ident, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.kickReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.partReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
+  connect(ui.quitReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
+
+  setWidgetStates();
+  connect(ui.nicknameList, SIGNAL(itemSelectionChanged()), this, SLOT(setWidgetStates()));
+
+  connect(ui.continueUnsecured, SIGNAL(clicked()), this, SIGNAL(requestEditSsl()));
+
+  // we would need this if we enabled drag and drop in the nicklist...
+  //connect(ui.nicknameList, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(setWidgetStates()));
+  //connect(ui.nicknameList->model(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(nicklistHasChanged()));
+
+#ifdef HAVE_SSL
+  ui.sslKeyGroupBox->setAcceptDrops(true);
+  ui.sslKeyGroupBox->installEventFilter(this);
+  ui.sslCertGroupBox->setAcceptDrops(true);
+  ui.sslCertGroupBox->installEventFilter(this);
+#endif
+}
+
+void IdentityEditWidget::setWidgetStates() {
+  if(ui.nicknameList->selectedItems().count()) {
+    ui.renameNick->setEnabled(true);
+    ui.nickUp->setEnabled(ui.nicknameList->row(ui.nicknameList->selectedItems()[0]) > 0);
+    ui.nickDown->setEnabled(ui.nicknameList->row(ui.nicknameList->selectedItems()[0]) < ui.nicknameList->count()-1);
+  } else {
+    ui.renameNick->setDisabled(true);
+    ui.nickUp->setDisabled(true);
+    ui.nickDown->setDisabled(true);
+  }
+  ui.deleteNick->setEnabled(ui.nicknameList->count() > 1);
+}
+
+void IdentityEditWidget::displayIdentity(CertIdentity *id, CertIdentity *saveId) {
+  if(saveId) {
+    saveToIdentity(saveId);
+  }
+
+  if(!id)
+    return;
+  
+  ui.realName->setText(id->realName());
+  ui.nicknameList->clear();
+  ui.nicknameList->addItems(id->nicks());
+  //for(int i = 0; i < ui.nicknameList->count(); i++) {
+  //  ui.nicknameList->item(i)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
+  //}
+  if(ui.nicknameList->count()) ui.nicknameList->setCurrentRow(0);
+  ui.awayNick->setText(id->awayNick());
+  ui.awayNickEnabled->setChecked(id->awayNickEnabled());
+  ui.awayReason->setText(id->awayReason());
+  ui.awayReasonEnabled->setChecked(id->awayReasonEnabled());
+  ui.autoAwayEnabled->setChecked(id->autoAwayEnabled());
+  ui.autoAwayTime->setValue(id->autoAwayTime());
+  ui.autoAwayReason->setText(id->autoAwayReason());
+  ui.autoAwayReasonEnabled->setChecked(id->autoAwayReasonEnabled());
+  ui.detachAwayEnabled->setChecked(id->detachAwayEnabled());
+  ui.detachAwayReason->setText(id->detachAwayReason());
+  ui.detachAwayReasonEnabled->setChecked(id->detachAwayReasonEnabled());
+  ui.ident->setText(id->ident());
+  ui.kickReason->setText(id->kickReason());
+  ui.partReason->setText(id->partReason());
+  ui.quitReason->setText(id->quitReason());
+#ifdef HAVE_SSL
+  showKeyState(id->sslKey());
+  showCertState(id->sslCert());
+#endif
+  
+}
+
+void IdentityEditWidget::saveToIdentity(CertIdentity *id) {
+  id->setRealName(ui.realName->text());
+  QStringList nicks;
+  for(int i = 0; i < ui.nicknameList->count(); i++) {
+    nicks << ui.nicknameList->item(i)->text();
+  }
+  id->setNicks(nicks);
+  id->setAwayNick(ui.awayNick->text());
+  id->setAwayNickEnabled(ui.awayNickEnabled->isChecked());
+  id->setAwayReason(ui.awayReason->text());
+  id->setAwayReasonEnabled(ui.awayReasonEnabled->isChecked());
+  id->setAutoAwayEnabled(ui.autoAwayEnabled->isChecked());
+  id->setAutoAwayTime(ui.autoAwayTime->value());
+  id->setAutoAwayReason(ui.autoAwayReason->text());
+  id->setAutoAwayReasonEnabled(ui.autoAwayReasonEnabled->isChecked());
+  id->setDetachAwayEnabled(ui.detachAwayEnabled->isChecked());
+  id->setDetachAwayReason(ui.detachAwayReason->text());
+  id->setDetachAwayReasonEnabled(ui.detachAwayReasonEnabled->isChecked());
+  id->setIdent(ui.ident->text());
+  id->setKickReason(ui.kickReason->text());
+  id->setPartReason(ui.partReason->text());
+  id->setQuitReason(ui.quitReason->text());
+#ifdef HAVE_SSL
+  id->setSslKey(QSslKey(ui.keyTypeLabel->property("sslKey").toByteArray(), (QSsl::KeyAlgorithm)(ui.keyTypeLabel->property("sslKeyType").toInt())));
+  id->setSslCert(QSslCertificate(ui.certOrgLabel->property("sslCert").toByteArray()));
+#endif
+}
+
+void IdentityEditWidget::on_addNick_clicked() {
+  QStringList existing;
+  for(int i = 0; i < ui.nicknameList->count(); i++) existing << ui.nicknameList->item(i)->text();
+  NickEditDlg dlg(QString(), existing, this);
+  if(dlg.exec() == QDialog::Accepted) {
+    ui.nicknameList->addItem(dlg.nick());
+    ui.nicknameList->setCurrentRow(ui.nicknameList->count()-1);
+    setWidgetStates();
+    emit widgetHasChanged();
+  }
+}
+
+void IdentityEditWidget::on_deleteNick_clicked() {
+  // no confirmation, since a nickname is really nothing hard to recreate
+  if(ui.nicknameList->selectedItems().count()) {
+    delete ui.nicknameList->takeItem(ui.nicknameList->row(ui.nicknameList->selectedItems()[0]));
+    ui.nicknameList->setCurrentRow(qMin(ui.nicknameList->currentRow()+1, ui.nicknameList->count()-1));
+    setWidgetStates();
+    emit widgetHasChanged();
+  }
+}
+
+void IdentityEditWidget::on_renameNick_clicked() {
+  if(!ui.nicknameList->selectedItems().count()) return;
+  QString old = ui.nicknameList->selectedItems()[0]->text();
+  QStringList existing;
+  for(int i = 0; i < ui.nicknameList->count(); i++) existing << ui.nicknameList->item(i)->text();
+  NickEditDlg dlg(old, existing, this);
+  if(dlg.exec() == QDialog::Accepted) {
+    ui.nicknameList->selectedItems()[0]->setText(dlg.nick());
+  }
+
+}
+
+void IdentityEditWidget::on_nickUp_clicked() {
+  if(!ui.nicknameList->selectedItems().count()) return;
+  int row = ui.nicknameList->row(ui.nicknameList->selectedItems()[0]);
+  if(row > 0) {
+    ui.nicknameList->insertItem(row-1, ui.nicknameList->takeItem(row));
+    ui.nicknameList->setCurrentRow(row-1);
+    setWidgetStates();
+    emit widgetHasChanged();
+  }
+}
+
+void IdentityEditWidget::on_nickDown_clicked() {
+  if(!ui.nicknameList->selectedItems().count()) return;
+  int row = ui.nicknameList->row(ui.nicknameList->selectedItems()[0]);
+  if(row < ui.nicknameList->count()-1) {
+    ui.nicknameList->insertItem(row+1, ui.nicknameList->takeItem(row));
+    ui.nicknameList->setCurrentRow(row+1);
+    setWidgetStates();
+    emit widgetHasChanged();
+  }
+}
+
+#ifdef HAVE_SSL
+void IdentityEditWidget::setSslState(SslState state) {
+  switch(state) {
+  case NoSsl:
+    ui.keyAndCertSettings->setCurrentIndex(0);
+    break;
+  case UnsecureSsl:
+    ui.keyAndCertSettings->setCurrentIndex(1);
+    break;
+  case AllowSsl:
+    ui.keyAndCertSettings->setCurrentIndex(2);
+    break;
+  }
+}
+
+bool IdentityEditWidget::eventFilter(QObject *watched, QEvent *event) {
+  bool isCert = (watched == ui.sslCertGroupBox);
+  switch(event->type()) {
+  case QEvent::DragEnter:
+    sslDragEnterEvent(static_cast<QDragEnterEvent *>(event));
+    return true;
+  case QEvent::Drop:
+    sslDropEvent(static_cast<QDropEvent *>(event), isCert);
+    return true;
+  default:
+    return false;
+  }
+}
+
+void IdentityEditWidget::sslDragEnterEvent(QDragEnterEvent *event) {
+  if(event->mimeData()->hasFormat("text/uri-list") || event->mimeData()->hasFormat("text/uri")) {
+    event->setDropAction(Qt::CopyAction);
+    event->accept();
+  }
+}
+
+void IdentityEditWidget::sslDropEvent(QDropEvent *event, bool isCert) {
+  QByteArray rawUris;
+  if(event->mimeData()->hasFormat("text/uri-list"))
+    rawUris = event->mimeData()->data("text/uri-list");
+  else
+    rawUris = event->mimeData()->data("text/uri");
+
+  QTextStream uriStream(rawUris);
+  QString filename = QUrl(uriStream.readLine()).toLocalFile();
+
+  if(isCert) {
+    QSslCertificate cert = certByFilename(filename);
+    if(cert.isValid())
+      showCertState(cert);
+  } else {
+    QSslKey key = keyByFilename(filename);
+    if(!key.isNull())
+      showKeyState(key);
+  }
+  event->accept();
+  emit widgetHasChanged();
+}
+
+void IdentityEditWidget::on_clearOrLoadKeyButton_clicked() {
+  QSslKey key;
+
+  if(ui.keyTypeLabel->property("sslKey").toByteArray().isEmpty())
+    key = keyByFilename(QFileDialog::getOpenFileName(this, tr("Load a Key"), QDesktopServices::storageLocation(QDesktopServices::HomeLocation)));
+
+  showKeyState(key);
+  emit widgetHasChanged();
+}
+
+QSslKey IdentityEditWidget::keyByFilename(const QString &filename) {
+  QSslKey key;
+
+  QFile keyFile(filename);
+  keyFile.open(QIODevice::ReadOnly);
+  QByteArray keyRaw = keyFile.read(2 << 20);
+  keyFile.close();
+
+  for(int i = 0; i < 2; i++) {
+    for(int j = 0; j < 2; j++) {
+      key = QSslKey(keyRaw, (QSsl::KeyAlgorithm)j, (QSsl::EncodingFormat)i);
+      if(!key.isNull())
+       goto returnKey;
+    }
+  }
+ returnKey:
+  return key;
+}
+
+void IdentityEditWidget::showKeyState(const QSslKey &key) {
+  if(key.isNull()) {
+    ui.keyTypeLabel->setText(tr("No Key loaded"));
+    ui.clearOrLoadKeyButton->setText(tr("Load"));
+  } else {
+    switch(key.algorithm()) {
+    case QSsl::Rsa:
+      ui.keyTypeLabel->setText(tr("RSA"));
+      break;
+    case QSsl::Dsa:
+      ui.keyTypeLabel->setText(tr("DSA"));
+      break;
+    default:
+      ui.keyTypeLabel->setText(tr("No Key loaded"));
+    }
+    ui.clearOrLoadKeyButton->setText(tr("Clear"));
+  }
+  ui.keyTypeLabel->setProperty("sslKey", key.toPem());
+  ui.keyTypeLabel->setProperty("sslKeyType", (int)key.algorithm());
+}
+
+void IdentityEditWidget::on_clearOrLoadCertButton_clicked() {
+  QSslCertificate cert;
+
+  if(ui.certOrgLabel->property("sslCert").toByteArray().isEmpty())
+    cert = certByFilename(QFileDialog::getOpenFileName(this, tr("Load a Certificate"), QDesktopServices::storageLocation(QDesktopServices::HomeLocation)));
+
+  showCertState(cert);
+  emit widgetHasChanged();
+}
+
+QSslCertificate IdentityEditWidget::certByFilename(const QString &filename) {
+  QSslCertificate cert;
+  QFile certFile(filename);
+  certFile.open(QIODevice::ReadOnly);
+  QByteArray certRaw = certFile.read(2 << 20);
+  certFile.close();
+
+  for(int i = 0; i < 2; i++) {
+    cert = QSslCertificate(certRaw, (QSsl::EncodingFormat)i);
+    if(cert.isValid())
+      break;
+  }
+  return cert;
+}
+
+void IdentityEditWidget::showCertState(const QSslCertificate &cert) {
+  if(!cert.isValid()) {
+    ui.certOrgLabel->setText(tr("No Certificate loaded"));
+    ui.certCNameLabel->setText(tr("No Certificate loaded"));
+    ui.clearOrLoadCertButton->setText(tr("Load"));
+  } else {
+    ui.certOrgLabel->setText(cert.subjectInfo(QSslCertificate::Organization));
+    ui.certCNameLabel->setText(cert.subjectInfo(QSslCertificate::CommonName));
+    ui.clearOrLoadCertButton->setText(tr("Clear"));
+  }
+  ui.certOrgLabel->setProperty("sslCert", cert.toPem());
+ }
+#endif //HAVE_SSL
diff --git a/src/qtui/settingspages/identityeditwidget.h b/src/qtui/settingspages/identityeditwidget.h
new file mode 100644 (file)
index 0000000..2879c9f
--- /dev/null
@@ -0,0 +1,112 @@
+/***************************************************************************
+ *   Copyright (C) 2005-08 by the Quassel Project                          *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) version 3.                                           *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef IDENTITYEDITWIDGET_H
+#define IDENTITYEDITWIDGET_H
+
+#include "ui_identityeditwidget.h"
+#include "ui_nickeditdlg.h"
+
+#ifdef HAVE_SSL
+#include <QSslCertificate>
+#include <QSslKey>
+#endif
+
+#include "clientidentity.h"
+
+class IdentityEditWidget : public QWidget {
+  Q_OBJECT
+
+public:
+  IdentityEditWidget(QWidget *parent = 0);
+
+  enum SslState {
+    NoSsl,
+    UnsecureSsl,
+    AllowSsl
+  };
+
+  void displayIdentity(CertIdentity *id, CertIdentity *saveId = 0);
+  void saveToIdentity(CertIdentity *id);
+
+public slots:
+  void setSslState(SslState state);
+
+protected:
+#ifdef HAVE_SSL
+  virtual bool eventFilter(QObject *watched, QEvent *event);
+#endif
+
+signals:
+  void requestEditSsl();
+  void widgetHasChanged();
+
+private slots:
+  void on_addNick_clicked();
+  void on_deleteNick_clicked();
+  void on_renameNick_clicked();
+  void on_nickUp_clicked();
+  void on_nickDown_clicked();
+
+#ifdef HAVE_SSL
+  void on_clearOrLoadKeyButton_clicked();
+  void on_clearOrLoadCertButton_clicked();
+#endif
+  void setWidgetStates();
+
+#ifdef HAVE_SSL
+  void sslDragEnterEvent(QDragEnterEvent *event);
+  void sslDropEvent(QDropEvent *event, bool isCert);
+#endif
+
+private:
+  Ui::IdentityEditWidget ui;
+  bool _editSsl;
+
+#ifdef HAVE_SSL
+  QSslKey keyByFilename(const QString &filename);
+  void showKeyState(const QSslKey &key);
+  QSslCertificate certByFilename(const QString &filename);
+  void showCertState(const QSslCertificate &cert);
+#endif
+
+  bool testHasChanged();
+};
+
+class NickEditDlg : public QDialog {
+  Q_OBJECT
+
+public:
+  NickEditDlg(const QString &oldnick, const QStringList &existing = QStringList(), QWidget *parent = 0);
+
+  QString nick() const;
+
+private slots:
+  void on_nickEdit_textChanged(const QString &);
+
+private:
+  Ui::NickEditDlg ui;
+
+  QString oldNick;
+  QStringList existing;
+
+};
+
+#endif //IDENTITYEDITWIDGET_H
diff --git a/src/qtui/settingspages/identityeditwidget.ui b/src/qtui/settingspages/identityeditwidget.ui
new file mode 100644 (file)
index 0000000..6f847e8
--- /dev/null
@@ -0,0 +1,788 @@
+<ui version="4.0" >
+ <class>IdentityEditWidget</class>
+ <widget class="QWidget" name="IdentityEditWidget" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>393</width>
+    <height>422</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string/>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_13" >
+   <property name="spacing" >
+    <number>0</number>
+   </property>
+   <property name="margin" >
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QTabWidget" name="tabWidget" >
+     <property name="currentIndex" >
+      <number>0</number>
+     </property>
+     <widget class="QWidget" name="generalTab" >
+      <attribute name="title" >
+       <string>General</string>
+      </attribute>
+      <layout class="QVBoxLayout" >
+       <item>
+        <layout class="QHBoxLayout" name="_2" >
+         <item>
+          <widget class="QLabel" name="label" >
+           <property name="text" >
+            <string>Real Name:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLineEdit" name="realName" >
+           <property name="whatsThis" >
+            <string>The "Real Name" is shown in /whois.</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="QGroupBox" name="groupBox" >
+         <property name="title" >
+          <string>Nicknames</string>
+         </property>
+         <layout class="QHBoxLayout" name="_3" >
+          <item>
+           <widget class="QListWidget" name="nicknameList" >
+            <property name="sizePolicy" >
+             <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+              <horstretch>1</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="showDropIndicator" stdset="0" >
+             <bool>true</bool>
+            </property>
+            <property name="dragEnabled" >
+             <bool>false</bool>
+            </property>
+            <property name="dragDropMode" >
+             <enum>QAbstractItemView::NoDragDrop</enum>
+            </property>
+            <property name="selectionBehavior" >
+             <enum>QAbstractItemView::SelectRows</enum>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <layout class="QVBoxLayout" name="_4" >
+            <item>
+             <widget class="QPushButton" name="addNick" >
+              <property name="sizePolicy" >
+               <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="toolTip" >
+               <string>Add Nickname</string>
+              </property>
+              <property name="text" >
+               <string>&amp;Add...</string>
+              </property>
+              <property name="icon" >
+               <iconset>
+                <normaloff>:/16x16/actions/oxygen/16x16/actions/list-add.png</normaloff>:/16x16/actions/oxygen/16x16/actions/list-add.png</iconset>
+              </property>
+              <property name="iconSize" >
+               <size>
+                <width>16</width>
+                <height>16</height>
+               </size>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="deleteNick" >
+              <property name="sizePolicy" >
+               <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="toolTip" >
+               <string>Remove Nickname</string>
+              </property>
+              <property name="text" >
+               <string>Remove</string>
+              </property>
+              <property name="icon" >
+               <iconset>
+                <normaloff>:/16x16/actions/oxygen/16x16/actions/edit-delete.png</normaloff>:/16x16/actions/oxygen/16x16/actions/edit-delete.png</iconset>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="renameNick" >
+              <property name="sizePolicy" >
+               <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="toolTip" >
+               <string>Rename Identity</string>
+              </property>
+              <property name="text" >
+               <string>Re&amp;name...</string>
+              </property>
+              <property name="icon" >
+               <iconset>
+                <normaloff>:/16x16/actions/oxygen/16x16/actions/edit-rename.png</normaloff>:/16x16/actions/oxygen/16x16/actions/edit-rename.png</iconset>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <layout class="QHBoxLayout" name="_5" >
+              <item>
+               <spacer>
+                <property name="orientation" >
+                 <enum>Qt::Horizontal</enum>
+                </property>
+                <property name="sizeHint" stdset="0" >
+                 <size>
+                  <width>0</width>
+                  <height>20</height>
+                 </size>
+                </property>
+               </spacer>
+              </item>
+              <item>
+               <widget class="QToolButton" name="nickUp" >
+                <property name="toolTip" >
+                 <string>Move upwards in list</string>
+                </property>
+                <property name="text" >
+                 <string>...</string>
+                </property>
+                <property name="icon" >
+                 <iconset>
+                  <normaloff>:/16x16/actions/oxygen/16x16/actions/go-up.png</normaloff>:/16x16/actions/oxygen/16x16/actions/go-up.png</iconset>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QToolButton" name="nickDown" >
+                <property name="toolTip" >
+                 <string>Move downwards in list</string>
+                </property>
+                <property name="text" >
+                 <string>...</string>
+                </property>
+                <property name="icon" >
+                 <iconset>
+                  <normaloff>:/16x16/actions/oxygen/16x16/actions/go-down.png</normaloff>:/16x16/actions/oxygen/16x16/actions/go-down.png</iconset>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <spacer>
+                <property name="orientation" >
+                 <enum>Qt::Horizontal</enum>
+                </property>
+                <property name="sizeHint" stdset="0" >
+                 <size>
+                  <width>0</width>
+                  <height>20</height>
+                 </size>
+                </property>
+               </spacer>
+              </item>
+             </layout>
+            </item>
+            <item>
+             <spacer>
+              <property name="orientation" >
+               <enum>Qt::Vertical</enum>
+              </property>
+              <property name="sizeHint" stdset="0" >
+               <size>
+                <width>124</width>
+                <height>76</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="awayTab" >
+      <attribute name="title" >
+       <string>A&amp;way</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout_4" >
+       <item>
+        <widget class="QGroupBox" name="groupBox_2" >
+         <property name="title" >
+          <string>Default Away Settings</string>
+         </property>
+         <layout class="QVBoxLayout" name="verticalLayout_3" >
+          <item>
+           <layout class="QGridLayout" name="_6" >
+            <item row="0" column="1" >
+             <widget class="QLineEdit" name="awayNick" >
+              <property name="enabled" >
+               <bool>false</bool>
+              </property>
+              <property name="toolTip" >
+               <string>Nick to be used when being away</string>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="0" >
+             <widget class="QCheckBox" name="awayReasonEnabled" >
+              <property name="toolTip" >
+               <string>Default away reason</string>
+              </property>
+              <property name="text" >
+               <string>Away Reason:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="1" >
+             <widget class="QLineEdit" name="awayReason" >
+              <property name="enabled" >
+               <bool>false</bool>
+              </property>
+              <property name="toolTip" >
+               <string>Default away reason</string>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="0" >
+             <widget class="QCheckBox" name="awayNickEnabled" >
+              <property name="enabled" >
+               <bool>false</bool>
+              </property>
+              <property name="toolTip" >
+               <string>Nick to be used when being away</string>
+              </property>
+              <property name="text" >
+               <string>Away Nick:</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item>
+        <widget class="QGroupBox" name="detachAwayEnabled" >
+         <property name="toolTip" >
+          <string>Set away when all clients have detached from the core</string>
+         </property>
+         <property name="title" >
+          <string>Away On Detach</string>
+         </property>
+         <property name="checkable" >
+          <bool>true</bool>
+         </property>
+         <property name="checked" >
+          <bool>false</bool>
+         </property>
+         <layout class="QVBoxLayout" name="verticalLayout" >
+          <item>
+           <layout class="QHBoxLayout" name="horizontalLayout" >
+            <item>
+             <widget class="QCheckBox" name="detachAwayReasonEnabled" >
+              <property name="toolTip" >
+               <string>Override default away reason for auto-away on detach</string>
+              </property>
+              <property name="text" >
+               <string>Away Reason:</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLineEdit" name="detachAwayReason" >
+              <property name="enabled" >
+               <bool>false</bool>
+              </property>
+              <property name="toolTip" >
+               <string>Override default away reason for auto-away on detach</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item>
+        <widget class="QGroupBox" name="autoAwayEnabled" >
+         <property name="enabled" >
+          <bool>false</bool>
+         </property>
+         <property name="toolTip" >
+          <string>Not implemented yet</string>
+         </property>
+         <property name="title" >
+          <string>Away On Idle</string>
+         </property>
+         <property name="checkable" >
+          <bool>true</bool>
+         </property>
+         <property name="checked" >
+          <bool>false</bool>
+         </property>
+         <layout class="QVBoxLayout" name="verticalLayout_2" >
+          <item>
+           <layout class="QHBoxLayout" name="_7" >
+            <item>
+             <widget class="QLabel" name="autoAwayLabel_1" >
+              <property name="text" >
+               <string>Set away after</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QSpinBox" name="autoAwayTime" />
+            </item>
+            <item>
+             <widget class="QLabel" name="autoAwayLabel_2" >
+              <property name="text" >
+               <string>minutes of being idle</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <spacer>
+              <property name="orientation" >
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0" >
+               <size>
+                <width>40</width>
+                <height>20</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+           </layout>
+          </item>
+          <item>
+           <layout class="QGridLayout" name="_8" >
+            <item row="0" column="0" >
+             <widget class="QCheckBox" name="autoAwayReasonEnabled" >
+              <property name="text" >
+               <string>Away Reason:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="1" >
+             <widget class="QLineEdit" name="autoAwayReason" >
+              <property name="enabled" >
+               <bool>false</bool>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item>
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0" >
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="advancedTab" >
+      <attribute name="title" >
+       <string>Advanced</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout_12" >
+       <item>
+        <layout class="QHBoxLayout" name="_9" >
+         <item>
+          <widget class="QLabel" name="label_2" >
+           <property name="text" >
+            <string>Ident:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLineEdit" name="ident" >
+           <property name="whatsThis" >
+            <string>The "ident" is part of your hostmask and, together with your host, uniquely identifies you within the IRC network.</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="QGroupBox" name="groupBox_3" >
+         <property name="title" >
+          <string>Messages</string>
+         </property>
+         <layout class="QVBoxLayout" name="_10" >
+          <item>
+           <layout class="QGridLayout" name="_11" >
+            <item row="1" column="0" >
+             <widget class="QLabel" name="label_3" >
+              <property name="text" >
+               <string>Part Reason:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="1" >
+             <widget class="QLineEdit" name="partReason" />
+            </item>
+            <item row="0" column="1" >
+             <widget class="QLineEdit" name="kickReason" />
+            </item>
+            <item row="2" column="0" >
+             <widget class="QLabel" name="label_5" >
+              <property name="text" >
+               <string>Quit Reason:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="2" column="1" >
+             <widget class="QLineEdit" name="quitReason" />
+            </item>
+            <item row="0" column="0" >
+             <widget class="QLabel" name="label_4" >
+              <property name="text" >
+               <string>Kick Reason:</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item>
+        <widget class="QStackedWidget" name="keyAndCertSettings" >
+         <property name="styleSheet" >
+          <string notr="true" />
+         </property>
+         <property name="lineWidth" >
+          <number>0</number>
+         </property>
+         <property name="currentIndex" >
+          <number>0</number>
+         </property>
+         <widget class="QWidget" name="pageNoSsl" >
+          <layout class="QVBoxLayout" name="verticalLayout_8" >
+           <property name="margin" >
+            <number>0</number>
+           </property>
+           <item>
+            <widget class="QGroupBox" name="groupBox_6" >
+             <property name="title" >
+              <string/>
+             </property>
+             <layout class="QVBoxLayout" name="verticalLayout_9" >
+              <item>
+               <widget class="QLabel" name="label_8" >
+                <property name="text" >
+                 <string>You need an SSL Capable Client to edit your Cores SSL Key and Certificate</string>
+                </property>
+                <property name="alignment" >
+                 <set>Qt::AlignCenter</set>
+                </property>
+                <property name="wordWrap" >
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="pageUnsecure" >
+          <layout class="QVBoxLayout" name="verticalLayout_7" >
+           <property name="margin" >
+            <number>0</number>
+           </property>
+           <item>
+            <widget class="QGroupBox" name="groupBox_5" >
+             <property name="title" >
+              <string/>
+             </property>
+             <layout class="QVBoxLayout" name="verticalLayout_6" >
+              <item>
+               <widget class="QLabel" name="label_7" >
+                <property name="text" >
+                 <string>Warning: you are not connected with a secured connection to the Quassel Core!
+Proceeding will cause an unencrypted transfer of your SSL Key and SSL Certificate!</string>
+                </property>
+                <property name="alignment" >
+                 <set>Qt::AlignCenter</set>
+                </property>
+                <property name="wordWrap" >
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <layout class="QHBoxLayout" name="horizontalLayout_2" >
+                <item>
+                 <spacer name="horizontalSpacer" >
+                  <property name="orientation" >
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0" >
+                   <size>
+                    <width>40</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="continueUnsecured" >
+                  <property name="text" >
+                   <string>Continue</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer name="horizontalSpacer_3" >
+                  <property name="orientation" >
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0" >
+                   <size>
+                    <width>40</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+               </layout>
+              </item>
+             </layout>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="pageEditSsl" >
+          <layout class="QVBoxLayout" name="verticalLayout_11" >
+           <property name="spacing" >
+            <number>0</number>
+           </property>
+           <property name="margin" >
+            <number>0</number>
+           </property>
+           <item>
+            <widget class="QGroupBox" name="sslKeyGroupBox" >
+             <property name="styleSheet" >
+              <string notr="true" />
+             </property>
+             <property name="title" >
+              <string>Use SSL Key</string>
+             </property>
+             <property name="checkable" >
+              <bool>false</bool>
+             </property>
+             <property name="checked" >
+              <bool>false</bool>
+             </property>
+             <layout class="QVBoxLayout" name="verticalLayout_5" >
+              <item>
+               <layout class="QHBoxLayout" name="horizontalLayout_3" >
+                <item>
+                 <widget class="QLabel" name="label_6" >
+                  <property name="text" >
+                   <string>Key Type:</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QLabel" name="keyTypeLabel" >
+                  <property name="text" >
+                   <string>No Key loaded</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer name="horizontalSpacer_2" >
+                  <property name="orientation" >
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0" >
+                   <size>
+                    <width>40</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="clearOrLoadKeyButton" >
+                  <property name="text" >
+                   <string>Load</string>
+                  </property>
+                 </widget>
+                </item>
+               </layout>
+              </item>
+             </layout>
+            </widget>
+           </item>
+           <item>
+            <widget class="QGroupBox" name="sslCertGroupBox" >
+             <property name="title" >
+              <string>Use SSL Certificate</string>
+             </property>
+             <layout class="QHBoxLayout" name="horizontalLayout_6" >
+              <property name="spacing" >
+               <number>0</number>
+              </property>
+              <item>
+               <layout class="QVBoxLayout" name="verticalLayout_10" >
+                <property name="spacing" >
+                 <number>0</number>
+                </property>
+                <item>
+                 <layout class="QHBoxLayout" name="horizontalLayout_4" >
+                  <property name="spacing" >
+                   <number>8</number>
+                  </property>
+                  <item>
+                   <widget class="QLabel" name="label_9" >
+                    <property name="text" >
+                     <string>Organisation:</string>
+                    </property>
+                   </widget>
+                  </item>
+                  <item>
+                   <widget class="QLabel" name="certOrgLabel" >
+                    <property name="text" >
+                     <string>No Certificate loaded</string>
+                    </property>
+                   </widget>
+                  </item>
+                  <item>
+                   <spacer name="horizontalSpacer_4" >
+                    <property name="orientation" >
+                     <enum>Qt::Horizontal</enum>
+                    </property>
+                    <property name="sizeHint" stdset="0" >
+                     <size>
+                      <width>40</width>
+                      <height>20</height>
+                     </size>
+                    </property>
+                   </spacer>
+                  </item>
+                 </layout>
+                </item>
+                <item>
+                 <layout class="QHBoxLayout" name="horizontalLayout_5" >
+                  <property name="spacing" >
+                   <number>8</number>
+                  </property>
+                  <item>
+                   <widget class="QLabel" name="label_10" >
+                    <property name="text" >
+                     <string>CommonName:</string>
+                    </property>
+                   </widget>
+                  </item>
+                  <item>
+                   <widget class="QLabel" name="certCNameLabel" >
+                    <property name="text" >
+                     <string>No Certificate loaded</string>
+                    </property>
+                   </widget>
+                  </item>
+                  <item>
+                   <spacer name="horizontalSpacer_5" >
+                    <property name="orientation" >
+                     <enum>Qt::Horizontal</enum>
+                    </property>
+                    <property name="sizeHint" stdset="0" >
+                     <size>
+                      <width>40</width>
+                      <height>20</height>
+                     </size>
+                    </property>
+                   </spacer>
+                  </item>
+                 </layout>
+                </item>
+               </layout>
+              </item>
+              <item>
+               <layout class="QVBoxLayout" name="verticalLayout_14" >
+                <item>
+                 <widget class="QPushButton" name="clearOrLoadCertButton" >
+                  <property name="text" >
+                   <string>Load</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer name="verticalSpacer_2" >
+                  <property name="orientation" >
+                   <enum>Qt::Vertical</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0" >
+                   <size>
+                    <width>20</width>
+                    <height>40</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+               </layout>
+              </item>
+             </layout>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </widget>
+       </item>
+       <item>
+        <spacer name="verticalSpacer" >
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0" >
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index 533d6cb..f33ac22 100644 (file)
@@ -4,6 +4,6 @@
 set(SETTINGSPAGES aliases appearance backlog bufferview color chatmonitor fonts general highlight identities networks)
 
 # Specify additional files (e.g. for subdialogs) here!
-set(SP_SOURCES aliasesmodel.cpp notificationssettingspage.cpp)
-set(SP_HEADERS aliasesmodel.h notificationssettingspage.h previewbufferview.h)
-set(SP_FORMS buffervieweditdlg.ui createidentitydlg.ui saveidentitiesdlg.ui networkadddlg.ui networkeditdlg.ui nickeditdlg.ui servereditdlg.ui)
+set(SP_SOURCES aliasesmodel.cpp identityeditwidget.cpp notificationssettingspage.cpp)
+set(SP_HEADERS aliasesmodel.h identityeditwidget.h notificationssettingspage.h previewbufferview.h)
+set(SP_FORMS buffervieweditdlg.ui createidentitydlg.ui identityeditwidget.ui saveidentitiesdlg.ui networkadddlg.ui networkeditdlg.ui nickeditdlg.ui servereditdlg.ui)