Finalizing changes to the identities interface -> breaking protocol
authorMarcus Eggenberger <egs@quassel-irc.org>
Sat, 20 Dec 2008 17:49:00 +0000 (18:49 +0100)
committerMarcus Eggenberger <egs@quassel-irc.org>
Thu, 25 Dec 2008 23:03:49 +0000 (00:03 +0100)
25 files changed:
src/client/CMakeLists.txt
src/client/client.cpp
src/client/client.h
src/client/clientidentity.cpp [new file with mode: 0644]
src/client/clientidentity.h [new file with mode: 0644]
src/common/identity.cpp
src/common/identity.h
src/common/signalproxy.cpp
src/common/syncableobject.cpp
src/common/syncableobject.h
src/core/CMakeLists.txt
src/core/SQL/upgradeSchema.sh
src/core/coreidentity.cpp [new file with mode: 0644]
src/core/coreidentity.h [new file with mode: 0644]
src/core/corenetwork.cpp
src/core/corenetwork.h
src/core/coresession.cpp
src/core/coresession.h
src/core/ircserverhandler.cpp
src/core/userinputhandler.cpp
src/qtui/settingspages/identitiessettingspage.cpp
src/qtui/settingspages/identitiessettingspage.h
src/qtui/settingspages/identitiessettingspage.ui
src/uisupport/networkmodelactionprovider.cpp
version.inc

index f10489f..f000508 100644 (file)
@@ -13,6 +13,7 @@ set(SOURCES
     buffersettings.cpp
     client.cpp
     clientbacklogmanager.cpp
     buffersettings.cpp
     client.cpp
     clientbacklogmanager.cpp
+    clientidentity.cpp
     clientirclisthelper.cpp
     clientsettings.cpp
     clientsyncer.cpp
     clientirclisthelper.cpp
     clientsettings.cpp
     clientsyncer.cpp
@@ -31,6 +32,7 @@ set(MOC_HDRS
     client.h
     clientbacklogmanager.h
     clientcoreinfo.h
     client.h
     clientbacklogmanager.h
     clientcoreinfo.h
+    clientidentity.h
     clientirclisthelper.h
     clientsyncer.h
     irclistmodel.h
     clientirclisthelper.h
     clientsyncer.h
     irclistmodel.h
index 575314c..310e8e4 100644 (file)
@@ -28,7 +28,7 @@
 #include "bufferviewmanager.h"
 #include "clientbacklogmanager.h"
 #include "clientirclisthelper.h"
 #include "bufferviewmanager.h"
 #include "clientbacklogmanager.h"
 #include "clientirclisthelper.h"
-#include "identity.h"
+#include "clientidentity.h"
 #include "ircchannel.h"
 #include "ircuser.h"
 #include "message.h"
 #include "ircchannel.h"
 #include "ircuser.h"
 #include "message.h"
@@ -110,7 +110,7 @@ void Client::init() {
   p->attachSignal(this, SIGNAL(sendInput(BufferInfo, QString)));
   p->attachSignal(this, SIGNAL(requestNetworkStates()));
 
   p->attachSignal(this, SIGNAL(sendInput(BufferInfo, QString)));
   p->attachSignal(this, SIGNAL(requestNetworkStates()));
 
-  p->attachSignal(this, SIGNAL(requestCreateIdentity(const Identity &)), SIGNAL(createIdentity(const Identity &)));
+  p->attachSignal(this, SIGNAL(requestCreateIdentity(const Identity &, const QVariantMap &)), SIGNAL(createIdentity(const Identity &, const QVariantMap &)));
   p->attachSignal(this, SIGNAL(requestRemoveIdentity(IdentityId)), SIGNAL(removeIdentity(IdentityId)));
   p->attachSlot(SIGNAL(identityCreated(const Identity &)), this, SLOT(coreIdentityCreated(const Identity &)));
   p->attachSlot(SIGNAL(identityRemoved(IdentityId)), this, SLOT(coreIdentityRemoved(IdentityId)));
   p->attachSignal(this, SIGNAL(requestRemoveIdentity(IdentityId)), SIGNAL(removeIdentity(IdentityId)));
   p->attachSlot(SIGNAL(identityCreated(const Identity &)), this, SLOT(coreIdentityCreated(const Identity &)));
   p->attachSlot(SIGNAL(identityRemoved(IdentityId)), this, SLOT(coreIdentityRemoved(IdentityId)));
@@ -214,13 +214,16 @@ QList<IdentityId> Client::identityIds() {
   return instance()->_identities.keys();
 }
 
   return instance()->_identities.keys();
 }
 
-const Identity * Client::identity(IdentityId id) {
+const Identity *Client::identity(IdentityId id) {
   if(instance()->_identities.contains(id)) return instance()->_identities[id];
   else return 0;
 }
 
   if(instance()->_identities.contains(id)) return instance()->_identities[id];
   else return 0;
 }
 
-void Client::createIdentity(const Identity &id) {
-  emit instance()->requestCreateIdentity(id);
+void Client::createIdentity(const CertIdentity &id) {
+  QVariantMap additional;
+  additional["KeyPem"] = id.sslKey().toPem();
+  additional["CertPem"] = id.sslCert().toPem();
+  emit instance()->requestCreateIdentity(id, additional);
 }
 
 void Client::updateIdentity(IdentityId id, const QVariantMap &ser) {
 }
 
 void Client::updateIdentity(IdentityId id, const QVariantMap &ser) {
@@ -346,10 +349,10 @@ void Client::disconnectedFromCore() {
   }
   Q_ASSERT(_networks.isEmpty());
 
   }
   Q_ASSERT(_networks.isEmpty());
 
-  QHash<IdentityId, Identity*>::iterator idIter = _identities.begin();
+  QHash<IdentityId, Identity *>::iterator idIter = _identities.begin();
   while(idIter != _identities.end()) {
   while(idIter != _identities.end()) {
+    emit identityRemoved(idIter.key());
     Identity *id = idIter.value();
     Identity *id = idIter.value();
-    emit identityRemoved(id->id());
     idIter = _identities.erase(idIter);
     id->deleteLater();
   }
     idIter = _identities.erase(idIter);
     id->deleteLater();
   }
index 40949ac..610e732 100644 (file)
@@ -34,6 +34,7 @@ class MessageModel;
 class AbstractMessageProcessor;
 
 class Identity;
 class AbstractMessageProcessor;
 
 class Identity;
+class CertIdentity;
 class Network;
 
 class AbstractUi;
 class Network;
 
 class AbstractUi;
@@ -68,14 +69,14 @@ public:
   static const Network * network(NetworkId);
 
   static QList<IdentityId> identityIds();
   static const Network * network(NetworkId);
 
   static QList<IdentityId> identityIds();
-  static const Identity * identity(IdentityId);
+  static const Identity *identity(IdentityId);
 
   //! Request creation of an identity with the given data.
   /** The request will be sent to the core, and will be propagated back to all the clients
    *  with a new valid IdentityId.
    *  \param identity The identity template for the new identity. It does not need to have a valid ID.
    */
 
   //! Request creation of an identity with the given data.
   /** The request will be sent to the core, and will be propagated back to all the clients
    *  with a new valid IdentityId.
    *  \param identity The identity template for the new identity. It does not need to have a valid ID.
    */
-  static void createIdentity(const Identity &identity);
+  static void createIdentity(const CertIdentity &identity);
 
   //! Request update of an identity with the given data.
   /** The request will be sent to the core, and will be propagated back to all the clients.
 
   //! Request update of an identity with the given data.
   /** The request will be sent to the core, and will be propagated back to all the clients.
@@ -141,7 +142,7 @@ signals:
   void identityRemoved(IdentityId id);
 
   //! Sent to the core when an identity shall be created. Should not be used elsewhere.
   void identityRemoved(IdentityId id);
 
   //! Sent to the core when an identity shall be created. Should not be used elsewhere.
-  void requestCreateIdentity(const Identity &);
+  void requestCreateIdentity(const Identity &, const QVariantMap &);
   //! Sent to the core when an identity shall be removed. Should not be used elsewhere.
   void requestRemoveIdentity(IdentityId);
 
   //! Sent to the core when an identity shall be removed. Should not be used elsewhere.
   void requestRemoveIdentity(IdentityId);
 
diff --git a/src/client/clientidentity.cpp b/src/client/clientidentity.cpp
new file mode 100644 (file)
index 0000000..1d93d64
--- /dev/null
@@ -0,0 +1,99 @@
+/***************************************************************************
+ *   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 "clientidentity.h"
+
+#include "client.h"
+#include "signalproxy.h"
+
+CertIdentity::CertIdentity(IdentityId id, QObject *parent)
+  : Identity(id, parent),
+    _certManager(0),
+    _isDirty(false)
+{
+}
+
+CertIdentity::CertIdentity(const Identity &other, QObject *parent)
+  : Identity(other, parent),
+    _certManager(0),
+    _isDirty(false)
+{
+}
+
+CertIdentity::CertIdentity(const CertIdentity &other, QObject *parent)
+  : Identity(other, parent),
+    _certManager(0),
+    _isDirty(other._isDirty),
+    _sslKey(other._sslKey),
+    _sslCert(other._sslCert)
+{
+}
+
+void CertIdentity::enableEditSsl(bool enable) {
+  if(!enable || _certManager)
+    return;
+
+  _certManager = new ClientCertManager(id(), this);
+  if(isValid()) { // this means we are not a newly created Identity but have a proper Id
+    Client::signalProxy()->synchronize(_certManager);
+    connect(_certManager, SIGNAL(updated(const QVariantMap &)), this, SLOT(markClean()));
+    connect(_certManager, SIGNAL(initDone()), this, SLOT(markClean()));
+  }
+}
+
+void CertIdentity::setSslKey(const QSslKey &key) {
+  if(key.toPem() == _sslKey.toPem())
+    return;
+  _sslKey = key;
+  _isDirty = true;
+}
+
+void CertIdentity::setSslCert(const QSslCertificate &cert) {
+  if(cert.toPem() == _sslCert.toPem())
+    return;
+  _sslCert = cert;
+  _isDirty = true;
+}
+
+void CertIdentity::requestUpdateSslSettings() {
+  if(!_certManager)
+    return;
+
+  _certManager->requestUpdate(_certManager->toVariantMap());
+}
+
+void CertIdentity::markClean() {
+  _isDirty = false;
+  emit sslSettingsUpdated();
+}
+
+// ========================================
+//  ClientCertManager
+// ========================================
+void ClientCertManager::setSslKey(const QByteArray &encoded) {
+  QSslKey key(encoded, QSsl::Rsa);
+  if(key.isNull())
+    key = QSslKey(encoded, QSsl::Dsa);
+  _certIdentity->setSslKey(key);
+}
+
+void ClientCertManager::setSslCert(const QByteArray &encoded) {
+  _certIdentity->setSslCert(QSslCertificate(encoded));
+}
diff --git a/src/client/clientidentity.h b/src/client/clientidentity.h
new file mode 100644 (file)
index 0000000..680ac95
--- /dev/null
@@ -0,0 +1,81 @@
+/***************************************************************************
+ *   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 CLIENTIDENTITY_H
+#define CLIENTIDENTITY_H
+
+#include "identity.h"
+
+class ClientCertManager;
+
+class CertIdentity : public Identity {
+  Q_OBJECT
+
+public:
+  CertIdentity(IdentityId id = 0, QObject *parent = 0);
+  CertIdentity(const Identity &other, QObject *parent = 0);
+  CertIdentity(const CertIdentity &other, QObject *parent = 0);
+
+  void enableEditSsl(bool enable = true);
+  inline bool isDirty() const { return _isDirty; }
+
+  inline const QSslKey &sslKey() const { return _sslKey; }
+  inline const QSslCertificate &sslCert() const { return _sslCert; }
+
+  void setSslKey(const QSslKey &key);
+  void setSslCert(const QSslCertificate &cert);
+
+public slots:
+  void requestUpdateSslSettings();
+
+signals:
+  void sslSettingsUpdated();
+
+private slots:
+  void markClean();
+
+private:
+  ClientCertManager *_certManager;
+  bool _isDirty;
+  QSslKey _sslKey;
+  QSslCertificate _sslCert;
+};
+
+// ========================================
+//  ClientCertManager
+// ========================================
+class ClientCertManager : public CertManager {
+  Q_OBJECT
+
+public:
+  ClientCertManager(IdentityId id, CertIdentity *parent) : CertManager(id, parent), _certIdentity(parent) {}
+
+  virtual inline const QSslKey &sslKey() const { return _certIdentity->sslKey(); }
+  virtual inline const QSslCertificate &sslCert() const { return _certIdentity->sslCert(); }
+
+public slots:
+  virtual void setSslKey(const QByteArray &encoded);
+  virtual void setSslCert(const QByteArray &encoded);
+
+private:
+  CertIdentity *_certIdentity;
+};
+
+#endif //CLIENTIDENTITY_H
index eff5021..da10fb0 100644 (file)
@@ -86,10 +86,10 @@ void Identity::setToDefaults() {
 
 /*** setters ***/
 
 
 /*** setters ***/
 
-// NOTE: DO NOT USE ON SYNCHRONIZED OBJECTS!
 void Identity::setId(IdentityId _id) {
   _identityId = _id;
 void Identity::setId(IdentityId _id) {
   _identityId = _id;
-  setObjectName(QString::number(id().toInt()));
+  emit idSet(_id);
+  renameObject(QString::number(id().toInt()));
 }
 
 void Identity::setIdentityName(const QString &identityName) {
 }
 
 void Identity::setIdentityName(const QString &identityName) {
@@ -228,3 +228,4 @@ QDataStream &operator>>(QDataStream &in, Identity &id) {
   id.fromVariantMap(i);
   return in;
 }
   id.fromVariantMap(i);
   return in;
 }
+
index bd1eaa5..a71e0ee 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef IDENTITY_H
 #define IDENTITY_H
 
 #ifndef IDENTITY_H
 #define IDENTITY_H
 
+#include <QByteArray>
 #include <QDataStream>
 #include <QMetaType>
 #include <QString>
 #include <QDataStream>
 #include <QMetaType>
 #include <QString>
@@ -55,6 +56,8 @@ class Identity : public SyncableObject {
 public:
   Identity(IdentityId id = 0, QObject *parent = 0);
   Identity(const Identity &other, QObject *parent = 0);
 public:
   Identity(IdentityId id = 0, QObject *parent = 0);
   Identity(const Identity &other, QObject *parent = 0);
+  inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
+
   void setToDefaults();
 
   bool operator==(const Identity &other);
   void setToDefaults();
 
   bool operator==(const Identity &other);
@@ -153,4 +156,33 @@ QDataStream &operator>>(QDataStream &in, Identity &identity);
 
 Q_DECLARE_METATYPE(Identity)
 
 
 Q_DECLARE_METATYPE(Identity)
 
-#endif
+#ifdef HAVE_SSL
+#include <QSslKey>
+#include <QSslCertificate>
+
+class CertManager : public SyncableObject {
+  Q_OBJECT
+  Q_PROPERTY(QByteArray sslKey READ sslKeyPem WRITE setSslKey STORED false)
+  Q_PROPERTY(QByteArray sslCert READ sslCertPem WRITE setSslCert STORED false)
+
+public:
+  CertManager(IdentityId id, QObject *parent = 0) : SyncableObject(QString::number(id.toInt()), parent) {}
+  inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
+
+  virtual const QSslKey &sslKey() const = 0;
+  inline QByteArray sslKeyPem() const { return sslKey().toPem(); }
+  virtual const QSslCertificate &sslCert() const = 0;
+  inline QByteArray sslCertPem() const { return sslCert().toPem(); }
+
+public slots:
+  inline virtual void setSslKey(const QByteArray &encoded) { emit sslKeySet(encoded); }
+  inline virtual void setSslCert(const QByteArray &encoded) { emit sslCertSet(encoded); }
+
+signals:
+  void sslKeySet(const QByteArray &);
+  void sslCertSet(const QByteArray &);
+};
+
+#endif // HAVE_SSL
+
+#endif // IDENTITY_H
index c551c24..58b9eda 100644 (file)
@@ -407,7 +407,7 @@ void SignalProxy::removePeerBySender() {
 
 void SignalProxy::objectRenamed(const QString &newname, const QString &oldname) {
   SyncableObject *syncObject = qobject_cast<SyncableObject *>(sender());
 
 void SignalProxy::objectRenamed(const QString &newname, const QString &oldname) {
   SyncableObject *syncObject = qobject_cast<SyncableObject *>(sender());
-  const QMetaObject *meta = syncObject->metaObject();
+  const QMetaObject *meta = syncObject->syncMetaObject();
   const QByteArray className(meta->className());
   objectRenamed(className, newname, oldname);
 
   const QByteArray className(meta->className());
   objectRenamed(className, newname, oldname);
 
index 248ccc9..96b159b 100644 (file)
@@ -34,6 +34,14 @@ SyncableObject::SyncableObject(QObject *parent)
 {
 }
 
 {
 }
 
+SyncableObject::SyncableObject(const QString &objectName, QObject *parent)
+  : QObject(parent),
+    _initialized(false),
+    _allowClientUpdates(false)
+{
+  setObjectName(objectName);
+}
+
 SyncableObject::SyncableObject(const SyncableObject &other, QObject *parent)
   : QObject(parent),
     _initialized(other._initialized),
 SyncableObject::SyncableObject(const SyncableObject &other, QObject *parent)
   : QObject(parent),
     _initialized(other._initialized),
index 482470a..dfe3887 100644 (file)
@@ -18,8 +18,8 @@
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
-#ifndef _SYNCABLEOBJECT_H_
-#define _SYNCABLEOBJECT_H_
+#ifndef SYNCABLEOBJECT_H
+#define SYNCABLEOBJECT_H
 
 #include <QDataStream>
 #include <QMetaType>
 
 #include <QDataStream>
 #include <QMetaType>
@@ -31,6 +31,7 @@ class SyncableObject : public QObject {
 
 public:
   SyncableObject(QObject *parent = 0);
 
 public:
   SyncableObject(QObject *parent = 0);
+  SyncableObject(const QString &objectName, QObject *parent = 0);
   SyncableObject(const SyncableObject &other, QObject *parent = 0);
 
   //! Stores the object's state into a QVariantMap.
   SyncableObject(const SyncableObject &other, QObject *parent = 0);
 
   //! Stores the object's state into a QVariantMap.
@@ -61,7 +62,7 @@ public:
 public slots:
   virtual void setInitialized();
   void requestUpdate(const QVariantMap &properties);
 public slots:
   virtual void setInitialized();
   void requestUpdate(const QVariantMap &properties);
-  void update(const QVariantMap &properties);
+  virtual void update(const QVariantMap &properties);
 
 protected:
   void renameObject(const QString &newName);
 
 protected:
   void renameObject(const QString &newName);
index 77525fb..c4cd518 100644 (file)
@@ -16,6 +16,7 @@ set(SOURCES
     corebufferviewconfig.cpp
     corebufferviewmanager.cpp
     corecoreinfo.cpp
     corebufferviewconfig.cpp
     corebufferviewmanager.cpp
     corecoreinfo.cpp
+    coreidentity.cpp
     coreircchannel.cpp
     coreirclisthelper.cpp
     corenetwork.cpp
     coreircchannel.cpp
     coreirclisthelper.cpp
     corenetwork.cpp
@@ -39,6 +40,7 @@ set(MOC_HDRS
     corebufferviewconfig.h
     corebufferviewmanager.h
     corecoreinfo.h
     corebufferviewconfig.h
     corebufferviewmanager.h
     corecoreinfo.h
+    coreidentity.h
     coreircchannel.h
     coreirclisthelper.h
     corenetwork.h
     coreircchannel.h
     coreirclisthelper.h
     corenetwork.h
index 0fcb651..e67331d 100755 (executable)
@@ -12,7 +12,7 @@ fi
 
 cd $TARGET_DIR
 
 
 cd $TARGET_DIR
 
-CURRENT_VERSION=`ls | sort -n | tail -n1`
+CURRENT_VERSION=$(ls | sort -n | tail -n1)
 
 if [ ! $CURRENT_VERSION ]; then
     echo "no previous schema found to upgrade from"
 
 if [ ! $CURRENT_VERSION ]; then
     echo "no previous schema found to upgrade from"
@@ -22,6 +22,7 @@ fi
 ((NEW_VERSION=$CURRENT_VERSION + 1))
 
 mkdir $NEW_VERSION
 ((NEW_VERSION=$CURRENT_VERSION + 1))
 
 mkdir $NEW_VERSION
-svn add $NEW_VERSION
-find $CURRENT_VERSION -depth 1 \! -name "upgrade_*" \! -name ".*" -exec svn mv {} $NEW_VERSION \;
-svn cp ${CURRENT_VERSION}/upgrade_999_version.sql $NEW_VERSION
+git add $NEW_VERSION
+find $CURRENT_VERSION -depth 1 \! -name "upgrade_*" \! -name ".*" -exec git mv {} $NEW_VERSION \;
+cp ${CURRENT_VERSION}/upgrade_999_version.sql $NEW_VERSION
+git add ${NEW_VERSION}/upgrade_999_version.sql
diff --git a/src/core/coreidentity.cpp b/src/core/coreidentity.cpp
new file mode 100644 (file)
index 0000000..dfad2e9
--- /dev/null
@@ -0,0 +1,89 @@
+/***************************************************************************
+ *   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 "coreidentity.h"
+
+#include "coresession.h"
+#include "coreusersettings.h"
+#include "signalproxy.h"
+
+CoreIdentity::CoreIdentity(IdentityId id, SignalProxy *proxy, CoreSession *parent)
+  : Identity(id, parent),
+    _certManager(new CoreCertManager(this)),
+    _coreSession(parent)
+{
+  proxy->synchronize(_certManager);
+  connect(this, SIGNAL(idSet(IdentityId)), _certManager, SLOT(setId(IdentityId)));
+}
+
+CoreIdentity::CoreIdentity(const Identity &other, SignalProxy *proxy, CoreSession *parent)
+  : Identity(other, parent),
+    _certManager(new CoreCertManager(this)),
+    _coreSession(parent)
+{
+  proxy->synchronize(_certManager);
+  connect(this, SIGNAL(idSet(IdentityId)), _certManager, SLOT(setId(IdentityId)));
+}
+
+void CoreIdentity::update(const QVariantMap &properties) {
+  SyncableObject::update(properties);
+  save();
+}
+
+void CoreIdentity::save() {
+  CoreUserSettings s(_coreSession->user());
+  s.storeIdentity(*this);
+}
+
+void CoreIdentity::setSslKey(const QByteArray &encoded) {
+  QSslKey key(encoded, QSsl::Rsa);
+  if(key.isNull())
+    key = QSslKey(encoded, QSsl::Dsa);
+  setSslKey(key);
+}
+
+void CoreIdentity::setSslCert(const QByteArray &encoded) {
+  setSslCert(QSslCertificate(encoded));
+}
+
+
+// ========================================
+//  CoreCertManager
+// ========================================
+CoreCertManager::CoreCertManager(CoreIdentity *identity)
+  : CertManager(identity->id(), identity),
+    _identity(identity)
+{
+  setAllowClientUpdates(true);
+}
+
+void CoreCertManager::setSslKey(const QByteArray &encoded) {
+  identity()->setSslKey(encoded);
+  CertManager::setSslKey(encoded);
+}
+
+void CoreCertManager::setSslCert(const QByteArray &encoded) {
+  identity()->setSslCert(encoded);
+  CertManager::setSslCert(encoded);
+}
+
+void CoreCertManager::setId(IdentityId id) {
+  renameObject(QString::number(id.toInt()));
+}
diff --git a/src/core/coreidentity.h b/src/core/coreidentity.h
new file mode 100644 (file)
index 0000000..f22ea44
--- /dev/null
@@ -0,0 +1,83 @@
+/***************************************************************************
+ *   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 COREIDENTITY_H
+#define COREIDENTITY_H
+
+#include "identity.h"
+
+#include <QSslKey>
+#include <QSslCertificate>
+
+class CoreCertManager;
+class CoreSession;
+class SignalProxy;
+
+class CoreIdentity : public Identity {
+  Q_OBJECT
+
+public:
+  CoreIdentity(IdentityId id, SignalProxy *proxy, CoreSession *parent);
+  CoreIdentity(const Identity &other, SignalProxy *proxy, CoreSession *parent);
+
+  inline const QSslKey &sslKey() const { return _sslKey; }
+  inline void setSslKey(const QSslKey &key) { _sslKey = key; }
+  void setSslKey(const QByteArray &encoded);
+  inline const QSslCertificate &sslCert() const { return _sslCert; }
+  inline void setSslCert(const QSslCertificate &cert) { _sslCert = cert; }
+  void setSslCert(const QByteArray &encoded);
+
+public slots:
+  virtual void update(const QVariantMap &properties);
+  void save();
+
+private:
+  QSslKey _sslKey;
+  QSslCertificate _sslCert;
+
+  CoreCertManager *_certManager;
+  CoreSession *_coreSession;
+};
+
+
+// ========================================
+//  CoreCertManager
+// ========================================
+class CoreCertManager : public CertManager {
+  Q_OBJECT
+
+public:
+  CoreCertManager(CoreIdentity *identity);
+
+  inline CoreIdentity *identity() const { return _identity; }
+  virtual inline const QSslKey &sslKey() const { return identity()->sslKey(); }
+  virtual inline const QSslCertificate &sslCert() const { return identity()->sslCert(); }
+
+public slots:
+  virtual void setSslKey(const QByteArray &encoded);
+  virtual void setSslCert(const QByteArray &encoded);
+
+  void setId(IdentityId id);
+
+private:
+  CoreIdentity *_identity;
+};
+
+#endif //COREIDENTITY_H
index b3cbfc0..8911cb0 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "core.h"
 #include "coresession.h"
 
 #include "core.h"
 #include "coresession.h"
-#include "identity.h"
+#include "coreidentity.h"
 
 #include "ircserverhandler.h"
 #include "userinputhandler.h"
 
 #include "ircserverhandler.h"
 #include "userinputhandler.h"
@@ -133,7 +133,7 @@ void CoreNetwork::connectToIrc(bool reconnecting) {
     qWarning() << "Server list empty, ignoring connect request!";
     return;
   }
     qWarning() << "Server list empty, ignoring connect request!";
     return;
   }
-  Identity *identity = identityPtr();
+  CoreIdentity *identity = identityPtr();
   if(!identity) {
     qWarning() << "Invalid identity configures, ignoring connect request!";
     return;
   if(!identity) {
     qWarning() << "Invalid identity configures, ignoring connect request!";
     return;
@@ -285,7 +285,7 @@ void CoreNetwork::socketInitialized() {
     return;
 #endif
 
     return;
 #endif
 
-  Identity *identity = identityPtr();
+  CoreIdentity *identity = identityPtr();
   if(!identity) {
     qCritical() << "Identity invalid!";
     disconnectFromIrc();
   if(!identity) {
     qCritical() << "Identity invalid!";
     disconnectFromIrc();
index 8cbe9b8..a0b7fee 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "coresession.h"
 
 
 #include "coresession.h"
 
-class Identity;
+class CoreIdentity;
 class IrcServerHandler;
 class UserInputHandler;
 class CtcpHandler;
 class IrcServerHandler;
 class UserInputHandler;
 class CtcpHandler;
@@ -48,7 +48,7 @@ public:
   ~CoreNetwork();
   inline virtual const QMetaObject *syncMetaObject() const { return &Network::staticMetaObject; }
 
   ~CoreNetwork();
   inline virtual const QMetaObject *syncMetaObject() const { return &Network::staticMetaObject; }
 
-  inline Identity *identityPtr() const { return coreSession()->identity(identity()); }
+  inline CoreIdentity *identityPtr() const { return coreSession()->identity(identity()); }
   inline CoreSession *coreSession() const { return _coreSession; }
 
   inline IrcServerHandler *ircServerHandler() const { return _ircServerHandler; }
   inline CoreSession *coreSession() const { return _coreSession; }
 
   inline IrcServerHandler *ircServerHandler() const { return _ircServerHandler; }
index 2e9184c..2649824 100644 (file)
 #include "coreirclisthelper.h"
 #include "storage.h"
 
 #include "coreirclisthelper.h"
 #include "storage.h"
 
+#include "coreidentity.h"
 #include "corenetwork.h"
 #include "ircuser.h"
 #include "ircchannel.h"
 #include "corenetwork.h"
 #include "ircuser.h"
 #include "ircchannel.h"
-#include "identity.h"
 
 #include "util.h"
 #include "coreusersettings.h"
 
 #include "util.h"
 #include "coreusersettings.h"
@@ -64,7 +64,7 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent)
 
   p->attachSignal(this, SIGNAL(identityCreated(const Identity &)));
   p->attachSignal(this, SIGNAL(identityRemoved(IdentityId)));
 
   p->attachSignal(this, SIGNAL(identityCreated(const Identity &)));
   p->attachSignal(this, SIGNAL(identityRemoved(IdentityId)));
-  p->attachSlot(SIGNAL(createIdentity(const Identity &)), this, SLOT(createIdentity(const Identity &)));
+  p->attachSlot(SIGNAL(createIdentity(const Identity &, const QVariantMap &)), this, SLOT(createIdentity(const Identity &, const QVariantMap &)));
   p->attachSlot(SIGNAL(removeIdentity(IdentityId)), this, SLOT(removeIdentity(IdentityId)));
 
   p->attachSignal(this, SIGNAL(networkCreated(NetworkId)));
   p->attachSlot(SIGNAL(removeIdentity(IdentityId)), this, SLOT(removeIdentity(IdentityId)));
 
   p->attachSignal(this, SIGNAL(networkCreated(NetworkId)));
@@ -117,7 +117,7 @@ CoreNetwork *CoreSession::network(NetworkId id) const {
   return 0;
 }
 
   return 0;
 }
 
-Identity *CoreSession::identity(IdentityId id) const {
+CoreIdentity *CoreSession::identity(IdentityId id) const {
   if(_identities.contains(id)) return _identities[id];
   return 0;
 }
   if(_identities.contains(id)) return _identities[id];
   return 0;
 }
@@ -126,27 +126,13 @@ void CoreSession::loadSettings() {
   CoreUserSettings s(user());
 
   foreach(IdentityId id, s.identityIds()) {
   CoreUserSettings s(user());
 
   foreach(IdentityId id, s.identityIds()) {
-    Identity *i = new Identity(s.identity(id), this);
-    if(!i->isValid()) {
-      qWarning() << "Invalid identity! Removing...";
-      s.removeIdentity(id);
-      delete i;
-      continue;
-    }
-    if(_identities.contains(i->id())) {
-      qWarning() << "Duplicate identity, ignoring!";
-      delete i;
-      continue;
-    }
-    connect(i, SIGNAL(updated(const QVariantMap &)), this, SLOT(identityUpdated(const QVariantMap &)));
-    _identities[i->id()] = i;
-    signalProxy()->synchronize(i);
+    createIdentity(s.identity(id));
   }
   if(!_identities.count()) {
   }
   if(!_identities.count()) {
-    Identity i(1);
-    i.setToDefaults();
-    i.setIdentityName(tr("Default Identity"));
-    createIdentity(i);
+    Identity identity;
+    identity.setToDefaults();
+    identity.setIdentityName(tr("Default Identity"));
+    createIdentity(identity);
   }
 
   foreach(NetworkInfo info, Core::networks(user())) {
   }
 
   foreach(NetworkInfo info, Core::networks(user())) {
@@ -279,21 +265,35 @@ void CoreSession::scriptRequest(QString script) {
 
 /*** Identity Handling ***/
 
 
 /*** Identity Handling ***/
 
-void CoreSession::createIdentity(const Identity &id) {
-  // find free ID
-  int i;
-  for(i = 1; i <= _identities.count(); i++) {
-    if(!_identities.keys().contains(i)) break;
+void CoreSession::createIdentity(const Identity &identity, const QVariantMap &additional) {
+  if(_identities.contains(identity.id())) {
+    qWarning() << "duplicate Identity:" << identity.id();
+    return;
   }
   }
-  //qDebug() << "found free id" << i;
-  Identity *newId = new Identity(id, this);
-  newId->setId(i);
-  _identities[i] = newId;
-  signalProxy()->synchronize(newId);
-  CoreUserSettings s(user());
-  s.storeIdentity(*newId);
-  connect(newId, SIGNAL(updated(const QVariantMap &)), this, SLOT(identityUpdated(const QVariantMap &)));
-  emit identityCreated(*newId);
+
+  int id = identity.id().toInt();
+  bool newId = !identity.isValid();
+  CoreIdentity *coreIdentity = new CoreIdentity(identity, signalProxy(), this);
+  if(additional.contains("KeyPem"))
+    coreIdentity->setSslKey(additional["KeyPem"].toByteArray());
+  if(additional.contains("CertPem"))
+    coreIdentity->setSslCert(additional["CertPem"].toByteArray());
+  if(newId) {
+    // find free ID
+    for(id = 1; id <= _identities.count(); id++) {
+      if(!_identities.keys().contains(id))
+       break;
+    }
+    coreIdentity->setId(id);
+    coreIdentity->save();
+  }
+
+  _identities[id] = coreIdentity;
+  qDebug() << id << coreIdentity->id();
+  signalProxy()->synchronize(coreIdentity);
+
+  if(newId)
+    emit identityCreated(*coreIdentity);
 }
 
 void CoreSession::removeIdentity(IdentityId id) {
 }
 
 void CoreSession::removeIdentity(IdentityId id) {
@@ -306,16 +306,6 @@ void CoreSession::removeIdentity(IdentityId id) {
   }
 }
 
   }
 }
 
-void CoreSession::identityUpdated(const QVariantMap &data) {
-  IdentityId id = data.value("identityId", 0).value<IdentityId>();
-  if(!id.isValid() || !_identities.contains(id)) {
-    qWarning() << "Update request for unknown identity received!";
-    return;
-  }
-  CoreUserSettings s(user());
-  s.storeIdentity(*_identities.value(id));
-}
-
 /*** Network Handling ***/
 
 void CoreSession::createNetwork(const NetworkInfo &info_) {
 /*** Network Handling ***/
 
 void CoreSession::createNetwork(const NetworkInfo &info_) {
index 8fa8725..f8ada9a 100644 (file)
@@ -33,6 +33,7 @@ class CoreBacklogManager;
 class CoreBufferViewManager;
 class CoreIrcListHelper;
 class Identity;
 class CoreBufferViewManager;
 class CoreIrcListHelper;
 class Identity;
+class CoreIdentity;
 class NetworkConnection;
 class CoreNetwork;
 struct NetworkInfo;
 class NetworkConnection;
 class CoreNetwork;
 struct NetworkInfo;
@@ -51,7 +52,7 @@ public:
   inline UserId user() const { return _user; }
   CoreNetwork *network(NetworkId) const;
   NetworkConnection *networkConnection(NetworkId) const;
   inline UserId user() const { return _user; }
   CoreNetwork *network(NetworkId) const;
   NetworkConnection *networkConnection(NetworkId) const;
-  Identity *identity(IdentityId) const;
+  CoreIdentity *identity(IdentityId) const;
 
   QVariant sessionState();
 
 
   QVariant sessionState();
 
@@ -77,7 +78,7 @@ public slots:
   //! Create an identity and propagate the changes to the clients.
   /** \param identity The identity to be created.
    */
   //! Create an identity and propagate the changes to the clients.
   /** \param identity The identity to be created.
    */
-  void createIdentity(const Identity &identity);
+  void createIdentity(const Identity &identity, const QVariantMap &additional = QVariantMap());
 
   //! Remove identity and propagate that fact to the clients.
   /** \param identity The identity to be removed.
 
   //! Remove identity and propagate that fact to the clients.
   /** \param identity The identity to be removed.
@@ -89,8 +90,8 @@ public slots:
    */
   void createNetwork(const NetworkInfo &info);
 
    */
   void createNetwork(const NetworkInfo &info);
 
-  //! Remove identity and propagate that fact to the clients.
-  /** \param identity The identity to be removed.
+  //! Remove network and propagate that fact to the clients.
+  /** \param network The id of the network to be removed.
    */
   void removeNetwork(NetworkId network);
 
    */
   void removeNetwork(NetworkId network);
 
@@ -145,8 +146,6 @@ private slots:
 
   void destroyNetwork(NetworkId);
 
 
   void destroyNetwork(NetworkId);
 
-  void identityUpdated(const QVariantMap &);
-
   void storeBufferLastSeenMsg(BufferId buffer, const MsgId &msgId);
 
   void scriptRequest(QString script);
   void storeBufferLastSeenMsg(BufferId buffer, const MsgId &msgId);
 
   void scriptRequest(QString script);
@@ -165,7 +164,7 @@ private:
   // QHash<NetworkId, NetworkConnection *> _connections;
   QHash<NetworkId, CoreNetwork *> _networks;
   //  QHash<NetworkId, CoreNetwork *> _networksToRemove;
   // QHash<NetworkId, NetworkConnection *> _connections;
   QHash<NetworkId, CoreNetwork *> _networks;
   //  QHash<NetworkId, CoreNetwork *> _networksToRemove;
-  QHash<IdentityId, Identity *> _identities;
+  QHash<IdentityId, CoreIdentity *> _identities;
 
   BufferSyncer *_bufferSyncer;
   CoreBacklogManager *_backlogManager;
 
   BufferSyncer *_bufferSyncer;
   CoreBacklogManager *_backlogManager;
index 06f968c..5c0684a 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "coresession.h"
 #include "coreirclisthelper.h"
 
 #include "coresession.h"
 #include "coreirclisthelper.h"
-#include "identity.h"
+#include "coreidentity.h"
 #include "ctcphandler.h"
 
 #include "ircuser.h"
 #include "ctcphandler.h"
 
 #include "ircuser.h"
index 8e6896f..15c89b2 100644 (file)
@@ -22,7 +22,7 @@
 #include "util.h"
 
 #include "ctcphandler.h"
 #include "util.h"
 
 #include "ctcphandler.h"
-#include "identity.h"
+#include "coreidentity.h"
 #include "ircuser.h"
 
 #include <QDebug>
 #include "ircuser.h"
 
 #include <QDebug>
index 8dd9c0d..e51fa7a 100644 (file)
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
+#include "identitiessettingspage.h"
+
 #include <QInputDialog>
 #include <QInputDialog>
+#include <QFileDialog>
+#include <QDesktopServices>
 #include <QMessageBox>
 #include <QMessageBox>
-
-#include "identitiessettingspage.h"
+#include <QSslKey>
 
 #include "client.h"
 #include "iconloader.h"
 
 #include "client.h"
 #include "iconloader.h"
+#include "signalproxy.h"
 
 IdentitiesSettingsPage::IdentitiesSettingsPage(QWidget *parent)
 
 IdentitiesSettingsPage::IdentitiesSettingsPage(QWidget *parent)
-  : SettingsPage(tr("General"), tr("Identities"), parent) {
+  : SettingsPage(tr("General"), tr("Identities"), parent),
+    _editSsl(false)
+{
 
   ui.setupUi(this);
   ui.renameIdentity->setIcon(BarIcon("edit-rename"));
 
   ui.setupUi(this);
   ui.renameIdentity->setIcon(BarIcon("edit-rename"));
@@ -69,6 +75,12 @@ IdentitiesSettingsPage::IdentitiesSettingsPage(QWidget *parent)
 
   connect(ui.nicknameList, SIGNAL(itemSelectionChanged()), this, SLOT(setWidgetStates()));
 
 
   connect(ui.nicknameList, SIGNAL(itemSelectionChanged()), this, SLOT(setWidgetStates()));
 
+#ifdef HAVE_SSL
+  ui.keyAndCertSettings->setCurrentIndex(1);
+#else
+  ui.keyAndCertSettings->setCurrentIndex(0);
+#endif
+
   // 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()));
   // 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()));
@@ -99,18 +111,18 @@ void IdentitiesSettingsPage::coreConnectionStateChanged(bool state) {
 
 void IdentitiesSettingsPage::save() {
   setEnabled(false);
 
 void IdentitiesSettingsPage::save() {
   setEnabled(false);
-  QList<Identity *> toCreate, toUpdate;
+  QList<CertIdentity *> toCreate, toUpdate;
   // we need to remove our temporarily created identities.
   // these are going to be re-added after the core has propagated them back...
   // we need to remove our temporarily created identities.
   // these are going to be re-added after the core has propagated them back...
-  QHash<IdentityId, Identity *>::iterator i = identities.begin();
+  QHash<IdentityId, CertIdentity *>::iterator i = identities.begin();
   while(i != identities.end()) {
     if((*i)->id() < 0) {
   while(i != identities.end()) {
     if((*i)->id() < 0) {
-      Identity *temp = *i;
+      CertIdentity *temp = *i;
       i = identities.erase(i);
       toCreate.append(temp);
       ui.identityList->removeItem(ui.identityList->findData(temp->id().toInt()));
     } else {
       i = identities.erase(i);
       toCreate.append(temp);
       ui.identityList->removeItem(ui.identityList->findData(temp->id().toInt()));
     } else {
-      if(**i != *Client::identity((*i)->id())) {
+      if(**i != *Client::identity((*i)->id()) || (*i)->isDirty()) {
         toUpdate.append(*i);
       }
       ++i;
         toUpdate.append(*i);
       }
       ++i;
@@ -158,10 +170,11 @@ bool IdentitiesSettingsPage::testHasChanged() {
   } else {
     if(currentId != 0) {
       changedIdentities.removeAll(currentId);
   } else {
     if(currentId != 0) {
       changedIdentities.removeAll(currentId);
-      Identity temp(currentId, this);
+      CertIdentity temp(currentId, this);
       saveToIdentity(&temp);
       temp.setIdentityName(identities[currentId]->identityName());
       saveToIdentity(&temp);
       temp.setIdentityName(identities[currentId]->identityName());
-      if(temp != *Client::identity(currentId)) changedIdentities.append(currentId);
+      if(temp != *Client::identity(currentId) || temp.isDirty())
+       changedIdentities.append(currentId);
     }
     return changedIdentities.count();
   }
     }
     return changedIdentities.count();
   }
@@ -188,7 +201,10 @@ bool IdentitiesSettingsPage::aboutToSave() {
 }
 
 void IdentitiesSettingsPage::clientIdentityCreated(IdentityId id) {
 }
 
 void IdentitiesSettingsPage::clientIdentityCreated(IdentityId id) {
-  insertIdentity(new Identity(*Client::identity(id), this));
+  CertIdentity *identity = new CertIdentity(*Client::identity(id), this);
+  identity->enableEditSsl(_editSsl);
+  insertIdentity(identity);
+  connect(identity, SIGNAL(sslSettingsUpdated()), this, SLOT(clientIdentityUpdated()));
   connect(Client::identity(id), SIGNAL(updatedRemotely()), this, SLOT(clientIdentityUpdated()));
 }
 
   connect(Client::identity(id), SIGNAL(updatedRemotely()), this, SLOT(clientIdentityUpdated()));
 }
 
@@ -202,10 +218,16 @@ void IdentitiesSettingsPage::clientIdentityUpdated() {
     qWarning() << "Unknown identity to update:" << clientIdentity->identityName();
     return;
   }
     qWarning() << "Unknown identity to update:" << clientIdentity->identityName();
     return;
   }
-  Identity *identity = identities[clientIdentity->id()];
-  if(identity->identityName() != clientIdentity->identityName()) renameIdentity(identity->id(), clientIdentity->identityName());
+
+  CertIdentity *identity = identities[clientIdentity->id()];
+
+  if(identity->identityName() != clientIdentity->identityName())
+    renameIdentity(identity->id(), clientIdentity->identityName());
+
   identity->update(*clientIdentity);
   identity->update(*clientIdentity);
-  if(identity->id() == currentId) displayIdentity(identity, true);
+
+  if(identity->id() == currentId)
+    displayIdentity(identity, true);
 }
 
 void IdentitiesSettingsPage::clientIdentityRemoved(IdentityId id) {
 }
 
 void IdentitiesSettingsPage::clientIdentityRemoved(IdentityId id) {
@@ -216,7 +238,7 @@ void IdentitiesSettingsPage::clientIdentityRemoved(IdentityId id) {
   }
 }
 
   }
 }
 
-void IdentitiesSettingsPage::insertIdentity(Identity *identity) {
+void IdentitiesSettingsPage::insertIdentity(CertIdentity *identity) {
   IdentityId id = identity->id();
   identities[id] = identity;
   if(id == 1) {
   IdentityId id = identity->id();
   identities[id] = identity;
   if(id == 1) {
@@ -264,7 +286,7 @@ void IdentitiesSettingsPage::on_identityList_currentIndexChanged(int index) {
   }
 }
 
   }
 }
 
-void IdentitiesSettingsPage::displayIdentity(Identity *id, bool dontsave) {
+void IdentitiesSettingsPage::displayIdentity(CertIdentity *id, bool dontsave) {
   if(currentId != 0 && !dontsave && identities.contains(currentId)) {
     saveToIdentity(identities[currentId]);
   }
   if(currentId != 0 && !dontsave && identities.contains(currentId)) {
     saveToIdentity(identities[currentId]);
   }
@@ -292,10 +314,12 @@ void IdentitiesSettingsPage::displayIdentity(Identity *id, bool dontsave) {
     ui.kickReason->setText(id->kickReason());
     ui.partReason->setText(id->partReason());
     ui.quitReason->setText(id->quitReason());
     ui.kickReason->setText(id->kickReason());
     ui.partReason->setText(id->partReason());
     ui.quitReason->setText(id->quitReason());
+    showKeyState(id->sslKey());
+    showCertState(id->sslCert());
   }
 }
 
   }
 }
 
-void IdentitiesSettingsPage::saveToIdentity(Identity *id) {
+void IdentitiesSettingsPage::saveToIdentity(CertIdentity *id) {
   id->setRealName(ui.realName->text());
   QStringList nicks;
   for(int i = 0; i < ui.nicknameList->count(); i++) {
   id->setRealName(ui.realName->text());
   QStringList nicks;
   for(int i = 0; i < ui.nicknameList->count(); i++) {
@@ -317,6 +341,8 @@ void IdentitiesSettingsPage::saveToIdentity(Identity *id) {
   id->setKickReason(ui.kickReason->text());
   id->setPartReason(ui.partReason->text());
   id->setQuitReason(ui.quitReason->text());
   id->setKickReason(ui.kickReason->text());
   id->setPartReason(ui.partReason->text());
   id->setQuitReason(ui.quitReason->text());
+  id->setSslKey(QSslKey(ui.keyTypeLabel->property("sslKey").toByteArray(), (QSsl::KeyAlgorithm)(ui.keyTypeLabel->property("sslKeyType").toInt())));
+  id->setSslCert(QSslCertificate(ui.certOrgLabel->property("sslCert").toByteArray()));
 }
 
 void IdentitiesSettingsPage::on_addIdentity_clicked() {
 }
 
 void IdentitiesSettingsPage::on_addIdentity_clicked() {
@@ -328,7 +354,8 @@ void IdentitiesSettingsPage::on_addIdentity_clicked() {
       if(!identities.keys().contains(-id.toInt())) break;
     }
     id = -id.toInt();
       if(!identities.keys().contains(-id.toInt())) break;
     }
     id = -id.toInt();
-    Identity *newId = new Identity(id, this);
+    CertIdentity *newId = new CertIdentity(id, this);
+    newId->enableEditSsl(_editSsl);
     if(dlg.duplicateId() != 0) {
       // duplicate
       newId->update(*identities[dlg.duplicateId()]);
     if(dlg.duplicateId() != 0) {
       // duplicate
       newId->update(*identities[dlg.duplicateId()]);
@@ -421,9 +448,101 @@ void IdentitiesSettingsPage::on_nickDown_clicked() {
   }
 }
 
   }
 }
 
+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);
+}
+
+void IdentitiesSettingsPage::on_clearOrLoadKeyButton_clicked() {
+  QSslKey key;
+
+  if(ui.keyTypeLabel->property("sslKey").toByteArray().isEmpty()) {
+    QString keyFileName = QFileDialog::getOpenFileName(this, tr("Load a Key"), QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
+    QFile keyFile(keyFileName);
+    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 showKey;
+      }
+    }
+  }
+
+ showKey:
+  showKeyState(key);
+  widgetHasChanged();
+}
+
+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()) {
+    QString certFileName = QFileDialog::getOpenFileName(this, tr("Load a Certificate"), QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
+    QFile certFile(certFileName);
+    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;
+    }
+  }
+
+  showCertState(cert);
+  widgetHasChanged();
+}
+
+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());
+ }
+
 /*****************************************************************************************/
 
 /*****************************************************************************************/
 
-CreateIdentityDlg::CreateIdentityDlg(QAbstractItemModel *model, QWidget *parent) : QDialog(parent) {
+CreateIdentityDlg::CreateIdentityDlg(QAbstractItemModel *model, QWidget *parent)
+  : QDialog(parent)
+{
   ui.setupUi(this);
 
   ui.identityList->setModel(model);  // now we use the identity list of the main page... Trolltech <3
   ui.setupUi(this);
 
   ui.identityList->setModel(model);  // now we use the identity list of the main page... Trolltech <3
@@ -449,8 +568,9 @@ void CreateIdentityDlg::on_identityName_textChanged(const QString &text) {
 
 /*********************************************************************************************/
 
 
 /*********************************************************************************************/
 
-SaveIdentitiesDlg::SaveIdentitiesDlg(const QList<Identity *> &toCreate, const QList<Identity *> &toUpdate, const QList<IdentityId> &toRemove, QWidget *parent)
-  : QDialog(parent) { //, toCreate(tocreate), toUpdate(toupdate), toRemove(toremove) {
+SaveIdentitiesDlg::SaveIdentitiesDlg(const QList<CertIdentity *> &toCreate, const QList<CertIdentity *> &toUpdate, const QList<IdentityId> &toRemove, QWidget *parent)
+  : QDialog(parent)
+{
   ui.setupUi(this);
   ui.abort->setIcon(SmallIcon("dialog-cancel"));
 
   ui.setupUi(this);
   ui.abort->setIcon(SmallIcon("dialog-cancel"));
 
@@ -463,10 +583,10 @@ SaveIdentitiesDlg::SaveIdentitiesDlg(const QList<Identity *> &toCreate, const QL
     connect(Client::instance(), SIGNAL(identityCreated(IdentityId)), this, SLOT(clientEvent()));
     connect(Client::instance(), SIGNAL(identityRemoved(IdentityId)), this, SLOT(clientEvent()));
 
     connect(Client::instance(), SIGNAL(identityCreated(IdentityId)), this, SLOT(clientEvent()));
     connect(Client::instance(), SIGNAL(identityRemoved(IdentityId)), this, SLOT(clientEvent()));
 
-    foreach(Identity *id, toCreate) {
+    foreach(CertIdentity *id, toCreate) {
       Client::createIdentity(*id);
     }
       Client::createIdentity(*id);
     }
-    foreach(Identity *id, toUpdate) {
+    foreach(CertIdentity *id, toUpdate) {
       const Identity *cid = Client::identity(id->id());
       if(!cid) {
         qWarning() << "Invalid client identity!";
       const Identity *cid = Client::identity(id->id());
       if(!cid) {
         qWarning() << "Invalid client identity!";
@@ -475,6 +595,7 @@ SaveIdentitiesDlg::SaveIdentitiesDlg(const QList<Identity *> &toCreate, const QL
       }
       connect(cid, SIGNAL(updatedRemotely()), this, SLOT(clientEvent()));
       Client::updateIdentity(id->id(), id->toVariantMap());
       }
       connect(cid, SIGNAL(updatedRemotely()), this, SLOT(clientEvent()));
       Client::updateIdentity(id->id(), id->toVariantMap());
+      id->requestUpdateSslSettings();
     }
     foreach(IdentityId id, toRemove) {
       Client::removeIdentity(id);
     }
     foreach(IdentityId id, toRemove) {
       Client::removeIdentity(id);
index c0c862b..9b750e2 100644 (file)
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
-#ifndef _IDENTITIESSETTINGSPAGE_H_
-#define _IDENTITIESSETTINGSPAGE_H_
+#ifndef IDENTITIESSETTINGSPAGE_H
+#define IDENTITIESSETTINGSPAGE_H
 
 
-#include "identity.h"
+#include "clientidentity.h"
 #include "settingspage.h"
 
 #include "ui_identitiessettingspage.h"
 #include "settingspage.h"
 
 #include "ui_identitiessettingspage.h"
@@ -34,105 +34,109 @@ class QAbstractItemModel;
 class IdentitiesSettingsPage : public SettingsPage {
   Q_OBJECT
 
 class IdentitiesSettingsPage : public SettingsPage {
   Q_OBJECT
 
-  public:
-    IdentitiesSettingsPage(QWidget *parent = 0);
+public:
+  IdentitiesSettingsPage(QWidget *parent = 0);
 
 
-    bool aboutToSave();
+  bool aboutToSave();
 
 
-  public slots:
-    void save();
-    void load();
+public slots:
+  void save();
+  void load();
 
 
-  private slots:
-    void coreConnectionStateChanged(bool);
-    void clientIdentityCreated(IdentityId);
-    void clientIdentityUpdated();
-    void clientIdentityRemoved(IdentityId);
+private slots:
+  void coreConnectionStateChanged(bool);
+  void clientIdentityCreated(IdentityId);
+  void clientIdentityUpdated();
+  void clientIdentityRemoved(IdentityId);
 
 
-    void on_identityList_currentIndexChanged(int index);
+  void on_identityList_currentIndexChanged(int index);
 
 
-    void on_addIdentity_clicked();
-    void on_deleteIdentity_clicked();
-    void on_renameIdentity_clicked();
+  void on_addIdentity_clicked();
+  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();
+  void on_addNick_clicked();
+  void on_deleteNick_clicked();
+  void on_renameNick_clicked();
+  void on_nickUp_clicked();
+  void on_nickDown_clicked();
 
 
-    void widgetHasChanged();
-    void setWidgetStates();
+  void on_continueUnsecured_clicked();
+  void on_clearOrLoadKeyButton_clicked();
+  void on_clearOrLoadCertButton_clicked();
+  void widgetHasChanged();
+  void setWidgetStates();
 
 
-  private:
-    Ui::IdentitiesSettingsPage ui;
+private:
+  Ui::IdentitiesSettingsPage ui;
 
 
-    QHash<IdentityId, Identity *> identities;
-    IdentityId currentId;
+  QHash<IdentityId, CertIdentity *> identities;
+  IdentityId currentId;
 
 
-    QList<IdentityId> changedIdentities;  // for setting the widget changed state
-    QList<IdentityId> deletedIdentities;
+  QList<IdentityId> changedIdentities;  // for setting the widget changed state
+  QList<IdentityId> deletedIdentities;
 
 
-    void insertIdentity(Identity *identity);
-    void removeIdentity(Identity *identity);
-    void renameIdentity(IdentityId id, const QString &newName);
-    void displayIdentity(Identity *, bool dontsave = false);
-    void saveToIdentity(Identity *);
+  bool _editSsl;
 
 
-    bool testHasChanged();
+  void insertIdentity(CertIdentity *identity);
+  void removeIdentity(Identity *identity);
+  void renameIdentity(IdentityId id, const QString &newName);
+  void displayIdentity(CertIdentity *, bool dontsave = false);
+  void saveToIdentity(CertIdentity *);
+
+  void showKeyState(const QSslKey &key);
+  void showCertState(const QSslCertificate &cert);
+
+  bool testHasChanged();
 };
 
 class CreateIdentityDlg : public QDialog {
   Q_OBJECT
 
 };
 
 class CreateIdentityDlg : public QDialog {
   Q_OBJECT
 
-  public:
-    CreateIdentityDlg(QAbstractItemModel *model, QWidget *parent = 0);
+public:
+  CreateIdentityDlg(QAbstractItemModel *model, QWidget *parent = 0);
 
 
-    QString identityName() const;
-    IdentityId duplicateId() const;
+  QString identityName() const;
+  IdentityId duplicateId() const;
 
 
-  private slots:
-    void on_identityName_textChanged(const QString &text);
+private slots:
+  void on_identityName_textChanged(const QString &text);
 
 
-  private:
-    Ui::CreateIdentityDlg ui;
+private:
+  Ui::CreateIdentityDlg ui;
 };
 
 class SaveIdentitiesDlg : public QDialog {
   Q_OBJECT
 
 };
 
 class SaveIdentitiesDlg : public QDialog {
   Q_OBJECT
 
-  public:
-    SaveIdentitiesDlg(const QList<Identity *> &toCreate, const QList<Identity *> &toUpdate, const QList<IdentityId> &toRemove, QWidget *parent = 0);
-
-  private slots:
-    void clientEvent();
-
-  private:
-    Ui::SaveIdentitiesDlg ui;
+public:
+  SaveIdentitiesDlg(const QList<CertIdentity *> &toCreate, const QList<CertIdentity *> &toUpdate, const QList<IdentityId> &toRemove, QWidget *parent = 0);
 
 
-    //QList<Identity *> toCreate, toUpdate;
-    //QList<IdentityId> toRemove;
+private slots:
+  void clientEvent();
 
 
-    int numevents, rcvevents;
+private:
+  Ui::SaveIdentitiesDlg ui;
 
 
+  int numevents, rcvevents;
 };
 
 class NickEditDlg : public QDialog {
   Q_OBJECT
 
 };
 
 class NickEditDlg : public QDialog {
   Q_OBJECT
 
-  public:
-    NickEditDlg(const QString &oldnick, const QStringList &existing = QStringList(), QWidget *parent = 0);
+public:
+  NickEditDlg(const QString &oldnick, const QStringList &existing = QStringList(), QWidget *parent = 0);
 
 
-    QString nick() const;
+  QString nick() const;
 
 
-  private slots:
-    void on_nickEdit_textChanged(const QString &);
+private slots:
+  void on_nickEdit_textChanged(const QString &);
 
 
-  private:
-    Ui::NickEditDlg ui;
+private:
+  Ui::NickEditDlg ui;
 
 
-    QString oldNick;
-    QStringList existing;
+  QString oldNick;
+  QStringList existing;
 
 };
 
 
 };
 
index d88df56..cb88372 100644 (file)
    <rect>
     <x>0</x>
     <y>0</y>
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>602</width>
-    <height>450</height>
+    <width>430</width>
+    <height>492</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <string/>
   </property>
    </rect>
   </property>
   <property name="windowTitle" >
    <string/>
   </property>
-  <layout class="QVBoxLayout" >
+  <layout class="QVBoxLayout" name="verticalLayout_13" >
    <item>
    <item>
-    <layout class="QVBoxLayout" >
+    <layout class="QHBoxLayout" >
      <item>
      <item>
-      <layout class="QHBoxLayout" >
+      <widget class="QComboBox" name="identityList" >
+       <property name="insertPolicy" >
+        <enum>QComboBox::InsertAtBottom</enum>
+       </property>
+       <property name="duplicatesEnabled" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QToolButton" name="renameIdentity" >
+       <property name="toolTip" >
+        <string>Rename Identity</string>
+       </property>
+       <property name="text" >
+        <string>...</string>
+       </property>
+       <property name="icon" >
+        <iconset>
+         <normaloff>:/22x22/actions/oxygen/22x22/actions/edit-rename.png</normaloff>:/22x22/actions/oxygen/22x22/actions/edit-rename.png</iconset>
+       </property>
+       <property name="iconSize" >
+        <size>
+         <width>22</width>
+         <height>22</height>
+        </size>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QToolButton" name="addIdentity" >
+       <property name="toolTip" >
+        <string>Add Identity</string>
+       </property>
+       <property name="text" >
+        <string>Add...</string>
+       </property>
+       <property name="icon" >
+        <iconset>
+         <normaloff>:/22x22/actions/oxygen/22x22/actions/list-add-user.png</normaloff>:/22x22/actions/oxygen/22x22/actions/list-add-user.png</iconset>
+       </property>
+       <property name="iconSize" >
+        <size>
+         <width>22</width>
+         <height>22</height>
+        </size>
+       </property>
+       <property name="toolButtonStyle" >
+        <enum>Qt::ToolButtonIconOnly</enum>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QToolButton" name="deleteIdentity" >
+       <property name="toolTip" >
+        <string>Remove Identity</string>
+       </property>
+       <property name="text" >
+        <string>...</string>
+       </property>
+       <property name="icon" >
+        <iconset>
+         <normaloff>:/22x22/actions/oxygen/22x22/actions/list-remove-user.png</normaloff>:/22x22/actions/oxygen/22x22/actions/list-remove-user.png</iconset>
+       </property>
+       <property name="iconSize" >
+        <size>
+         <width>22</width>
+         <height>22</height>
+        </size>
+       </property>
+      </widget>
+     </item>
+    </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>
        <item>
-        <widget class="QComboBox" name="identityList" >
-         <property name="insertPolicy" >
-          <enum>QComboBox::InsertAtBottom</enum>
+        <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>
          </property>
-         <property name="duplicatesEnabled" >
-          <bool>true</bool>
+         <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>
          </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>
        </item>
        <item>
-        <widget class="QToolButton" name="renameIdentity" >
+        <widget class="QGroupBox" name="detachAwayEnabled" >
          <property name="toolTip" >
          <property name="toolTip" >
-          <string>Rename Identity</string>
+          <string>Set away when all clients have detached from the core</string>
          </property>
          </property>
-         <property name="text" >
-          <string>...</string>
+         <property name="title" >
+          <string>Away On Detach</string>
          </property>
          </property>
-         <property name="icon" >
-          <iconset>
-           <normaloff>:/22x22/actions/oxygen/22x22/actions/edit-rename.png</normaloff>:/22x22/actions/oxygen/22x22/actions/edit-rename.png</iconset>
+         <property name="checkable" >
+          <bool>true</bool>
          </property>
          </property>
-         <property name="iconSize" >
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
+         <property name="checked" >
+          <bool>false</bool>
          </property>
          </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>
        </item>
        <item>
-        <widget class="QToolButton" name="addIdentity" >
-         <property name="toolTip" >
-          <string>Add Identity</string>
+        <widget class="QGroupBox" name="autoAwayEnabled" >
+         <property name="enabled" >
+          <bool>false</bool>
          </property>
          </property>
-         <property name="text" >
-          <string>Add...</string>
+         <property name="toolTip" >
+          <string>Not implemented yet</string>
          </property>
          </property>
-         <property name="icon" >
-          <iconset>
-           <normaloff>:/22x22/actions/oxygen/22x22/actions/list-add-user.png</normaloff>:/22x22/actions/oxygen/22x22/actions/list-add-user.png</iconset>
+         <property name="title" >
+          <string>Away On Idle</string>
          </property>
          </property>
-         <property name="iconSize" >
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
+         <property name="checkable" >
+          <bool>true</bool>
          </property>
          </property>
-         <property name="toolButtonStyle" >
-          <enum>Qt::ToolButtonIconOnly</enum>
+         <property name="checked" >
+          <bool>false</bool>
          </property>
          </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>
         </widget>
        </item>
        <item>
-        <widget class="QToolButton" name="deleteIdentity" >
-         <property name="toolTip" >
-          <string>Remove Identity</string>
-         </property>
-         <property name="text" >
-          <string>...</string>
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
          </property>
          </property>
-         <property name="icon" >
-          <iconset>
-           <normaloff>:/22x22/actions/oxygen/22x22/actions/list-remove-user.png</normaloff>:/22x22/actions/oxygen/22x22/actions/list-remove-user.png</iconset>
-         </property>
-         <property name="iconSize" >
+         <property name="sizeHint" stdset="0" >
           <size>
           <size>
-           <width>22</width>
-           <height>22</height>
+           <width>20</width>
+           <height>40</height>
           </size>
          </property>
           </size>
          </property>
-        </widget>
+        </spacer>
        </item>
       </layout>
        </item>
       </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>570</width>
-          <height>355</height>
-         </rect>
-        </property>
-        <attribute name="title" >
-         <string>General</string>
-        </attribute>
-        <layout class="QVBoxLayout" >
+     </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>
          <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>
+          <widget class="QLabel" name="label_2" >
+           <property name="text" >
+            <string>Ident:</string>
+           </property>
+          </widget>
          </item>
          <item>
          </item>
          <item>
-          <widget class="QGroupBox" name="groupBox" >
-           <property name="title" >
-            <string>Nicknames</string>
+          <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>
            </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>
+          </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>
               </property>
-              <property name="dragDropMode" >
-               <enum>QAbstractItemView::NoDragDrop</enum>
+             </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>
               </property>
-              <property name="selectionBehavior" >
-               <enum>QAbstractItemView::SelectRows</enum>
+             </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>
               </property>
              </widget>
             </item>
-            <item>
-             <layout class="QVBoxLayout" >
+           </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>
               <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>
+               <widget class="QLabel" name="label_8" >
                 <property name="text" >
                 <property name="text" >
-                 <string>&amp;Add...</string>
+                 <string>You need an SSL Capable Client to edit your Cores SSL Key and Certificate</string>
                 </property>
                 </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 name="alignment" >
+                 <set>Qt::AlignCenter</set>
                 </property>
                 </property>
-                <property name="iconSize" >
-                 <size>
-                  <width>16</width>
-                  <height>16</height>
-                 </size>
+                <property name="wordWrap" >
+                 <bool>true</bool>
                 </property>
                </widget>
               </item>
                 </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>
               <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>
+               <widget class="QLabel" name="label_7" >
                 <property name="text" >
                 <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>
+                 <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>
-                <property name="text" >
-                 <string>Re&amp;name...</string>
+                <property name="alignment" >
+                 <set>Qt::AlignCenter</set>
                 </property>
                 </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 name="wordWrap" >
+                 <bool>true</bool>
                 </property>
                </widget>
               </item>
               <item>
                 </property>
                </widget>
               </item>
               <item>
-               <layout class="QHBoxLayout" >
+               <layout class="QHBoxLayout" name="horizontalLayout_2" >
                 <item>
                 <item>
-                 <spacer>
+                 <spacer name="horizontalSpacer" >
                   <property name="orientation" >
                    <enum>Qt::Horizontal</enum>
                   </property>
                   <property name="sizeHint" stdset="0" >
                    <size>
                   <property name="orientation" >
                    <enum>Qt::Horizontal</enum>
                   </property>
                   <property name="sizeHint" stdset="0" >
                    <size>
-                    <width>0</width>
+                    <width>40</width>
                     <height>20</height>
                    </size>
                   </property>
                  </spacer>
                 </item>
                 <item>
                     <height>20</height>
                    </size>
                   </property>
                  </spacer>
                 </item>
                 <item>
-                 <widget class="QToolButton" name="nickUp" >
-                  <property name="toolTip" >
-                   <string>Move upwards in list</string>
-                  </property>
+                 <widget class="QPushButton" name="continueUnsecured" >
                   <property name="text" >
                   <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>
+                   <string>continue</string>
                   </property>
                  </widget>
                 </item>
                 <item>
                   </property>
                  </widget>
                 </item>
                 <item>
-                 <widget class="QToolButton" name="nickDown" >
-                  <property name="toolTip" >
-                   <string>Move downwards in list</string>
+                 <spacer name="horizontalSpacer_3" >
+                  <property name="orientation" >
+                   <enum>Qt::Horizontal</enum>
                   </property>
                   </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="groupBox_4" >
+             <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" >
                   <property name="text" >
-                   <string>...</string>
+                   <string>Key Type:</string>
                   </property>
                   </property>
-                  <property name="icon" >
-                   <iconset>
-                    <normaloff>:/16x16/actions/oxygen/16x16/actions/go-down.png</normaloff>:/16x16/actions/oxygen/16x16/actions/go-down.png</iconset>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QLabel" name="keyTypeLabel" >
+                  <property name="text" >
+                   <string>No Key loaded</string>
                   </property>
                  </widget>
                 </item>
                 <item>
                   </property>
                  </widget>
                 </item>
                 <item>
-                 <spacer>
+                 <spacer name="horizontalSpacer_2" >
                   <property name="orientation" >
                    <enum>Qt::Horizontal</enum>
                   </property>
                   <property name="sizeHint" stdset="0" >
                    <size>
                   <property name="orientation" >
                    <enum>Qt::Horizontal</enum>
                   </property>
                   <property name="sizeHint" stdset="0" >
                    <size>
-                    <width>0</width>
+                    <width>40</width>
                     <height>20</height>
                    </size>
                   </property>
                  </spacer>
                 </item>
                     <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>
               </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>
              </layout>
-            </item>
-           </layout>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-       <widget class="QWidget" name="awayTab" >
-        <property name="geometry" >
-         <rect>
-          <x>0</x>
-          <y>0</y>
-          <width>570</width>
-          <height>355</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>
+            </widget>
+           </item>
+           <item>
+            <widget class="QGroupBox" name="groupBox_7" >
+             <property name="title" >
+              <string>Use SSL Certificate</string>
+             </property>
+             <layout class="QHBoxLayout" name="horizontalLayout_6" >
+              <property name="spacing" >
+               <number>0</number>
+              </property>
               <item>
               <item>
-               <widget class="QLabel" name="autoAwayLabel_2" >
-                <property name="text" >
-                 <string>minutes of being idle</string>
+               <layout class="QVBoxLayout" name="verticalLayout_10" >
+                <property name="spacing" >
+                 <number>0</number>
                 </property>
                 </property>
-               </widget>
+                <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>
               </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>
+               <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>
               </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>570</width>
-          <height>355</height>
-         </rect>
-        </property>
-        <attribute name="title" >
-         <string>Advanced</string>
-        </attribute>
-        <layout class="QVBoxLayout" >
-         <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>
             </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>
-          <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>
-     </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>
    </item>
   </layout>
  </widget>
    <slot>setEnabled(bool)</slot>
    <hints>
     <hint type="sourcelabel" >
    <slot>setEnabled(bool)</slot>
    <hints>
     <hint type="sourcelabel" >
-     <x>126</x>
-     <y>327</y>
+     <x>157</x>
+     <y>382</y>
     </hint>
     <hint type="destinationlabel" >
     </hint>
     <hint type="destinationlabel" >
-     <x>315</x>
-     <y>328</y>
+     <x>454</x>
+     <y>382</y>
     </hint>
    </hints>
   </connection>
     </hint>
    </hints>
   </connection>
    <slot>setEnabled(bool)</slot>
    <hints>
     <hint type="sourcelabel" >
    <slot>setEnabled(bool)</slot>
    <hints>
     <hint type="sourcelabel" >
-     <x>33</x>
-     <y>214</y>
+     <x>64</x>
+     <y>256</y>
     </hint>
     <hint type="destinationlabel" >
     </hint>
     <hint type="destinationlabel" >
-     <x>204</x>
-     <y>218</y>
+     <x>343</x>
+     <y>256</y>
     </hint>
    </hints>
   </connection>
     </hint>
    </hints>
   </connection>
index 12fd2e4..e490992 100644 (file)
@@ -27,7 +27,7 @@
 #include "buffermodel.h"
 #include "buffersettings.h"
 #include "iconloader.h"
 #include "buffermodel.h"
 #include "buffersettings.h"
 #include "iconloader.h"
-#include "identity.h"
+#include "clientidentity.h"
 #include "network.h"
 #include "util.h"
 
 #include "network.h"
 #include "util.h"
 
index f445fd7..431b92e 100644 (file)
@@ -1,9 +1,9 @@
 //! This is the fallback version number in case we can't autogenerate one
 baseVersion = "0.3.1";
 
 //! This is the fallback version number in case we can't autogenerate one
 baseVersion = "0.3.1";
 
-protocolVersion = 8;       //< Version of the client/core protocol
-coreNeedsProtocol   = 8;   //< Minimum protocol version the core needs
-clientNeedsProtocol = 8;   //< Minimum protocol version the client needs
+protocolVersion = 9;       //< Version of the client/core protocol
+coreNeedsProtocol   = 9;   //< Minimum protocol version the core needs
+clientNeedsProtocol = 9;   //< Minimum protocol version the client needs
 
 distCommittish = $Format:%H$
 distCommitDate = $Format:%at$
 
 distCommittish = $Format:%H$
 distCommitDate = $Format:%at$