OK Folks, my first commit after quite a while, and while Quassel looks the same as...
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 1 Aug 2007 22:38:13 +0000 (22:38 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 1 Aug 2007 22:38:13 +0000 (22:38 +0000)
a lot of changed under the hood. This includes

* Parts of the new settings system, includin session data which is gonna replace Global
* Multi-user core
* Complete separation of core and client even in th monolithic client

Basically now most of the multi-user core and core connection code is in place, as well as
most of the skeleton for the authentification. Since parts of the UI, disconnecting from a core
and connecting to a remote core don't work yet, I have most of it disabled or hidden. Things
will fall back in place piece by piece, without requiring too many changes to the source in
the future I hope.

Oh yeah, due to the new settings stuff, you will have to enter identity, network and other data anew.
Maybe this is a good opportunity to wipe out your .config...

31 files changed:
Quassel.kdevelop.filelist
src/client/CMakeLists.txt
src/client/buffer.cpp
src/client/client.cpp
src/client/client.h
src/client/clientsettings.cpp [new file with mode: 0644]
src/client/clientsettings.h [new file with mode: 0644]
src/client/treemodel.cpp
src/client/treemodel.h
src/common/CMakeLists.txt
src/common/global.h
src/common/main.cpp
src/common/settings.cpp
src/common/settings.h
src/core/core.cpp
src/core/core.h
src/core/coresession.cpp
src/core/server.cpp
src/core/server.h
src/qtgui/CMakeLists.txt
src/qtgui/coreconnectdlg.cpp
src/qtgui/coreconnectdlg.h
src/qtgui/guisettings.cpp [new file with mode: 0644]
src/qtgui/guisettings.h [new file with mode: 0644]
src/qtgui/identities.cpp
src/qtgui/mainwin.cpp
src/qtgui/mainwin.h
src/qtgui/serverlist.cpp
src/qtgui/serverlist.h
src/qtgui/ui/coreconnectdlg.ui
src/qtgui/ui/mainwin.ui

index dc08925..07efc40 100644 (file)
@@ -97,3 +97,7 @@ src/qtgui/ui/nickeditdlg.ui
 src/qtgui/ui/servereditdlg.ui
 src/qtgui/ui/serverlistdlg.ui
 src/qtgui/ui/settingsdlg.ui
+src/client/clientsettings.h
+src/client/clientsettings.cpp
+src/qtgui/guisettings.h
+src/qtgui/guisettings.cpp
index 920eb97..159b4f1 100644 (file)
@@ -1,6 +1,7 @@
-SET(client_SRCS buffer.cpp buffertreemodel.cpp client.cpp clientproxy.cpp treemodel.cpp)
+SET(client_SRCS buffer.cpp buffertreemodel.cpp client.cpp clientproxy.cpp clientsettings.cpp treemodel.cpp)
 SET(client_HDRS )
-SET(client_MOCS buffer.h buffertreemodel.h client.h clientproxy.h treemodel.h)
+SET(client_MOCS buffer.h buffertreemodel.h client.h clientproxy.h clientsettings.h treemodel.h)
 
 QT4_WRAP_CPP(_MOC ${client_MOCS})
 ADD_LIBRARY(client ${client_SRCS} ${_MOC})
+TARGET_LINK_LIBRARIES(client common)
\ No newline at end of file
index 7f4d885..7afc15b 100644 (file)
@@ -43,6 +43,7 @@ Buffer::Buffer(BufferId bufid) {
 }
 
 Buffer::~Buffer() {
+  //qDebug() << "destroying buffer";
   //delete widget;
   /*
   QSettings s;
index 9a74119..b591f2c 100644 (file)
@@ -30,10 +30,12 @@ Client * Client::instanceptr = 0;
 
 bool Client::connectedToCore = false;
 Client::ClientMode Client::clientMode;
+VarMap Client::coreConnectionInfo;
 QHash<BufferId, Buffer *> Client::buffers;
 QHash<uint, BufferId> Client::bufferIds;
 QHash<QString, QHash<QString, VarMap> > Client::nicks;
 QHash<QString, bool> Client::netConnected;
+QStringList Client::netsAwaitingInit;
 QHash<QString, QString> Client::ownNick;
 
 Client *Client::instance() {
@@ -126,15 +128,17 @@ bool Client::isConnected() { return connectedToCore; }
 
 void Client::connectToCore(const VarMap &conn) {
   // TODO implement SSL
+  coreConnectionInfo = conn;
   if(isConnected()) {
-    qDebug() << "Already connected to core!";
+    emit coreConnectionError(tr("Already connected to Core!"));
     return;
   }
   if(conn["Host"].toString().isEmpty()) {
     clientMode = LocalCore;
-    syncToCore();  // TODO send user and pw from conn info
+    syncToCore();
   } else {
     clientMode = RemoteCore;
+    emit coreConnectionMsg(tr("Connecting..."));
     socket.connectToHost(conn["Host"].toString(), conn["Port"].toUInt());
   }
 }
@@ -146,7 +150,14 @@ void Client::disconnectFromCore() {
     disconnectFromLocalCore();
     coreDisconnected();
   }
-  // TODO clear internal data
+  /* Clear internal data. Hopefully nothing relies on it at this point. */
+  coreConnectionInfo.clear();
+  sessionData.clear();
+  //foreach(Buffer *buf, buffers.values()) delete buf;
+  qDebug() << "barfoo";
+  _bufferModel->clear();
+  //qDeleteAll(buffers);
+  qDebug() << "foobar";
 }
 
 void Client::coreConnected() {
@@ -162,9 +173,9 @@ void Client::coreDisconnected() {
 void Client::syncToCore() {
   VarMap state;
   if(clientMode == LocalCore) {
-    state = connectToLocalCore("Default", "password").toMap(); // TODO make this configurable
+    state = connectToLocalCore(coreConnectionInfo["User"].toString(), coreConnectionInfo["Password"].toString()).toMap();
   } else {
-
+    // TODO connect to remote cores
   }
 
   VarMap data = state["CoreData"].toMap();
@@ -176,6 +187,10 @@ void Client::syncToCore() {
   //}
 
   VarMap sessionState = state["SessionState"].toMap();
+  VarMap sessData = sessionState["SessionData"].toMap();
+  foreach(QString key, sessData.keys()) {
+    recvSessionData(key, sessData[key]);
+  }
   QList<QVariant> coreBuffers = sessionState["Buffers"].toList();
   /* make lookups by id faster */
   foreach(QVariant vid, coreBuffers) {
@@ -183,9 +198,17 @@ void Client::syncToCore() {
     bufferIds[id.uid()] = id;  // make lookups by id faster
     buffer(id);                // create all buffers, so we see them in the network views
   }
+  netsAwaitingInit = sessionState["Networks"].toStringList();
   connectedToCore = true;
-  emit connected();
-  emit requestNetworkStates();
+  if(netsAwaitingInit.count()) {
+    emit coreConnectionMsg(tr("Requesting network states..."));
+    emit coreConnectionProgress(0, netsAwaitingInit.count());
+    emit requestNetworkStates();
+  }
+  else {
+    emit coreConnectionProgress(1, 1);
+    emit connected();
+  }
 }
 
 void Client::updateCoreData(UserId, QString key) {
@@ -202,7 +225,6 @@ void Client::recvSessionData(const QString &key, const QVariant &data) {
   sessionData[key] = data;
   emit sessionDataChanged(key, data);
   emit sessionDataChanged(key);
-  qDebug() << "stored data in client:" << key;
 }
 
 void Client::storeSessionData(const QString &key, const QVariant &data) {
@@ -217,6 +239,10 @@ QVariant Client::retrieveSessionData(const QString &key, const QVariant &def) {
   else return def;
 }
 
+QStringList Client::sessionDataKeys() {
+  return instance()->sessionData.keys();
+}
+
 void Client::recvProxySignal(ClientSignal sig, QVariant arg1, QVariant arg2, QVariant arg3) {
   if(clientMode == LocalCore) return;
   QList<QVariant> sigdata;
@@ -244,6 +270,7 @@ void Client::serverHasData() {
 }
 
 void Client::networkConnected(QString net) {
+  Q_ASSERT(!netsAwaitingInit.contains(net));
   netConnected[net] = true;
   BufferId id = statusBufferId(net);
   Buffer *b = buffer(id);
@@ -260,6 +287,12 @@ void Client::networkDisconnected(QString net) {
     b->setActive(false);
   }
   netConnected[net] = false;
+  if(netsAwaitingInit.contains(net)) {
+    qDebug() << "Network" << net << "disconnected while not yet initialized!";
+    netsAwaitingInit.removeAll(net);
+    emit coreConnectionProgress(netConnected.count(), netConnected.count() + netsAwaitingInit.count());
+    if(!netsAwaitingInit.count()) emit connected();
+  }
 }
 
 void Client::updateBufferId(BufferId id) {
@@ -299,6 +332,7 @@ QList<BufferId> Client::allBufferIds() {
 }
 
 void Client::recvNetworkState(QString net, QVariant state) {
+  netsAwaitingInit.removeAll(net);
   netConnected[net] = true;
   setOwnNick(net, state.toMap()["OwnNick"].toString());
   buffer(statusBufferId(net))->setActive(true);
@@ -313,6 +347,8 @@ void Client::recvNetworkState(QString net, QVariant state) {
   foreach(QString nick, n.keys()) {
     addNick(net, nick, n[nick].toMap());
   }
+  emit coreConnectionProgress(netConnected.count(), netConnected.count() + netsAwaitingInit.count());
+  if(!netsAwaitingInit.count()) emit connected();
 }
 
 void Client::recvMessage(const Message &msg) {
index 1b3a4e8..9bb606a 100644 (file)
@@ -57,6 +57,7 @@ class Client : public QObject {
 
     static void storeSessionData(const QString &key, const QVariant &data);
     static QVariant retrieveSessionData(const QString &key, const QVariant &def = QVariant());
+    static QStringList sessionDataKeys();
 
   signals:
     void sendInput(BufferId, QString message);
@@ -71,6 +72,8 @@ class Client : public QObject {
 
     void recvPartialItem(quint32 avail, quint32 size);
     void coreConnectionError(QString errorMsg);
+    void coreConnectionMsg(const QString &msg);
+    void coreConnectionProgress(uint part, uint total);
 
     void connected();
     void disconnected();
@@ -134,10 +137,12 @@ class Client : public QObject {
     quint32 blockSize;
 
     static bool connectedToCore;
+    static VarMap coreConnectionInfo;
     static QHash<BufferId, Buffer *> buffers;
     static QHash<uint, BufferId> bufferIds;
     static QHash<QString, QHash<QString, VarMap> > nicks;
     static QHash<QString, bool> netConnected;
+    static QStringList netsAwaitingInit;
     static QHash<QString, QString> ownNick;
 
     QTimer *layoutTimer;
diff --git a/src/client/clientsettings.cpp b/src/client/clientsettings.cpp
new file mode 100644 (file)
index 0000000..6f40a23
--- /dev/null
@@ -0,0 +1,87 @@
+/***************************************************************************
+ *   Copyright (C) 2005-07 by The Quassel IRC Development Team             *
+ *   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) any later version.                                   *
+ *                                                                         *
+ *   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 "client.h"
+#include "clientsettings.h"
+
+#include <QStringList>
+
+ClientSettings::ClientSettings(QString g) : Settings(g) {
+
+
+}
+
+ClientSettings::~ClientSettings() {
+
+
+}
+
+QStringList ClientSettings::sessionKeys() {
+  return Client::sessionDataKeys();
+}
+
+void ClientSettings::setSessionValue(const QString &key, const QVariant &data) {
+  Client::storeSessionData(key, data);
+}
+
+QVariant ClientSettings::sessionValue(const QString &key, const QVariant &def) {
+  return Client::retrieveSessionData(key, def);
+}
+
+/***********************************************************************************************/
+
+AccountSettings::AccountSettings() : ClientSettings("Accounts") {
+
+
+}
+
+QStringList AccountSettings::knownAccounts() {
+  return localChildGroups();
+}
+
+QString AccountSettings::lastAccount() {
+  return localValue("LastAccount", "").toString();
+}
+
+void AccountSettings::setLastAccount(const QString &account) {
+  setLocalValue("LastAccount", account);
+}
+
+QString AccountSettings::autoConnectAccount() {
+  return localValue("AutoConnectAccount", "").toString();
+}
+
+void AccountSettings::setAutoConnectAccount(const QString &account) {
+  setLocalValue("AutoConnectAccount", account);
+}
+
+void AccountSettings::setValue(const QString &account, const QString &key, const QVariant &data) {
+  setLocalValue(QString("%1/%2").arg(account).arg(key), data);
+}
+
+QVariant AccountSettings::value(const QString &account, const QString &key, const QVariant &def) {
+  return localValue(QString("%1/%2").arg(account).arg(key), def);
+}
+
+void AccountSettings::removeAccount(const QString &account) {
+  removeLocalKey(account);
+}
+
+
diff --git a/src/client/clientsettings.h b/src/client/clientsettings.h
new file mode 100644 (file)
index 0000000..b14cb45
--- /dev/null
@@ -0,0 +1,61 @@
+/***************************************************************************
+ *   Copyright (C) 2005-07 by The Quassel IRC Development Team             *
+ *   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) any later version.                                   *
+ *                                                                         *
+ *   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 _CLIENTSETTINGS_H_
+#define _CLIENTSETTINGS_H_
+
+#include "settings.h"
+
+class ClientSettings : public Settings {
+  Q_OBJECT
+
+  public:
+    virtual ~ClientSettings();
+
+  protected:
+    ClientSettings(QString group = "General");
+
+    //virtual QStringList allSessionKeys() = 0;
+    virtual QStringList sessionKeys();
+
+    virtual void setSessionValue(const QString &key, const QVariant &data);
+    virtual QVariant sessionValue(const QString &key, const QVariant &def = QVariant());
+
+};
+
+class AccountSettings : public ClientSettings {
+  Q_OBJECT
+
+  public:
+    AccountSettings();
+
+    QStringList knownAccounts();
+    QString lastAccount();
+    void setLastAccount(const QString &account);
+    QString autoConnectAccount();
+    void setAutoConnectAccount(const QString &account);
+
+    void setValue(const QString &account, const QString &key, const QVariant &data);
+    QVariant value(const QString &account, const QString &key, const QVariant &def = QVariant());
+    void removeAccount(const QString &account);
+
+};
+
+#endif
index fef6a21..0d6111f 100644 (file)
@@ -194,6 +194,7 @@ bool TreeModel::removeRows(int row, int count, const QModelIndex &parent) {
   
   
   beginRemoveRows(parent, row, row + count - 1);
+
   for(int i = row + count - 1; i >= 0; i--) {
     item->removeChild(i);
   }
index f979d11..2b7928c 100644 (file)
@@ -71,11 +71,12 @@ public:
   int rowCount(const QModelIndex &parent = QModelIndex()) const;
   int columnCount(const QModelIndex &parent = QModelIndex()) const;
 
+  void clear();
+
 protected:
   bool removeRow(int row, const QModelIndex &parent = QModelIndex());
   bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
-  void clear();
-  
+
   TreeItem *rootItem;
 };
 
index d44d9c7..d63db6b 100644 (file)
@@ -1,6 +1,6 @@
 SET(common_SRCS global.cpp logger.cpp message.cpp settings.cpp util.cpp ircuser.cpp)
-SET(common_HDRS message.h settings.h util.h)
-SET(common_MOCS global.h logger.h ircuser.h quasselui.h)
+SET(common_HDRS message.h util.h)
+SET(common_MOCS global.h logger.h ircuser.h quasselui.h settings.h)
 
 QT4_WRAP_CPP(_MOC ${common_MOCS})
 ADD_LIBRARY(common ${common_SRCS} ${_MOC})
index 2723b66..efa27aa 100644 (file)
@@ -27,6 +27,8 @@
 #define BACKLOG_FORMAT 2
 #define BACKLOG_STRING "QuasselIRC Backlog File"
 
+#define DEFAULT_PORT 4242
+
 class Global;
 
 #include <QHash>
index c53daab..c47d8b7 100644 (file)
@@ -64,7 +64,7 @@ int main(int argc, char **argv) {
   Core::instance();  // create and init the core
 #endif
 
-  Settings::init();
+  //Settings::init();
 
 #ifndef BUILD_CORE
   Style::init();
index 77144c7..4f06185 100644 (file)
  ***************************************************************************/
 
 #include <QSettings>
+#include <QStringList>
+#include <QDebug>
 
 #include "settings.h"
 
-Settings *settings;
+Settings::Settings(QString g) : QObject(), group(g) {
+
 
-void Settings::init() {
-  curProfile = QObject::tr("Default");
 }
-/*
+
 Settings::~Settings() {
-  qDebug() << "destructing";
 
 }
-*/
 
-void Settings::setProfile(const QString &profile) {
-  curProfile = profile;
+void Settings::setGroup(QString g) {
+  group = g;
+
+}
+
+QStringList Settings::allLocalKeys() {
+  QSettings s;
+  s.beginGroup(group);
+  return s.allKeys();
+}
+
+QStringList Settings::localChildKeys() {
+  QSettings s;
+  s.beginGroup(group);
+  return s.childKeys();
 }
 
-void Settings::setGuiValue(const QString &key, const QVariant &value) {
+QStringList Settings::localChildGroups() {
   QSettings s;
-  //s.setValue("GUI/Default/BufferStates/QuakeNet/#quassel/voicedExpanded", true);
-  //QString k = QString("GUI/%1/%2").arg(curProfile).arg(key);
-  s.setValue(QString("GUI/%1/%2").arg(curProfile).arg(key), value);
+  s.beginGroup(group);
+  return s.childGroups();
 }
 
-QVariant Settings::guiValue(const QString &key, const QVariant &defaultValue) {
+void Settings::setLocalValue(const QString &key, const QVariant &data) {
   QSettings s;
-  return s.value(QString("GUI/%1/%2").arg(curProfile).arg(key), defaultValue);
+  s.beginGroup(group);
+  s.setValue(key, data);
 }
 
-void Settings::setCoreValue(const QString &user, const QString &key, const QVariant &value) {
+QVariant Settings::localValue(const QString &key, const QVariant &def) {
   QSettings s;
-  s.setValue(QString("Core/%1/%2").arg(user).arg(key), value);
+  s.beginGroup(group);
+  return s.value(key, def);
 }
 
-QVariant Settings::coreValue(const QString &user, const QString &key, const QVariant &defaultValue) {
+void Settings::removeLocalKey(const QString &key) {
   QSettings s;
-  return s.value(QString("Core/%1/%2").arg(user).arg(key), defaultValue);
+  s.beginGroup(group);
+  s.remove(key);
 }
 
-QString Settings::curProfile;
index 4ef2664..efa03d7 100644 (file)
 #include <QString>
 #include <QVariant>
 
-class Settings {
+class Settings : public QObject {
+  Q_OBJECT
 
   public:
-    //Settings();
-    //~Settings();
-    static void init();
-    static void setProfile(const QString &string);
-    static QString profile();
+    virtual ~Settings();
 
-    static void setGuiValue(const QString &key, const QVariant &value);
-    static QVariant guiValue (const QString &key, const QVariant &defaultValue = QVariant());
-    static void setCoreValue(const QString &user, const QString &key, const QVariant &value);
-    static QVariant coreValue (const QString &user, const QString& key, const QVariant &defaultValue = QVariant());
+    static void setGuiValue(QString, QVariant) {};
+    static QVariant guiValue(QString, QVariant = QVariant()) { return QVariant(); }
+  protected:
+    Settings(QString group = "General");
 
-  private:
-    static QString curProfile;
+    void setGroup(QString group);
 
+    virtual QStringList allLocalKeys();
+    virtual QStringList localChildKeys();
+    virtual QStringList localChildGroups();
+    //virtual QStringList allSessionKeys() = 0;
+    virtual QStringList sessionKeys() = 0;
+
+    virtual void setLocalValue(const QString &key, const QVariant &data);
+    virtual QVariant localValue(const QString &key, const QVariant &def = QVariant());
+
+    virtual void setSessionValue(const QString &key, const QVariant &data) = 0;
+    virtual QVariant sessionValue(const QString &key, const QVariant &def = QVariant()) = 0;
+
+    virtual void removeLocalKey(const QString &key);
+
+    QString group;
 };
 
-//extern Settings *settings;
+
 
 #endif
index e6b8c7f..9385c64 100644 (file)
@@ -179,7 +179,7 @@ QVariant Core::connectLocalClient(QString user, QString passwd) {
   return reply;
 }
 
-QVariant Core::disconnectLocalClient() {
+void Core::disconnectLocalClient() {
   qDebug() << "Local client disconnected.";
   instance()->guiUser = 0;
   Global::setGuiUser(0);
index 374d821..15a2e90 100644 (file)
@@ -43,11 +43,11 @@ class Core : public QObject {
     static CoreSession * createSession(UserId);
 
     static QVariant connectLocalClient(QString user, QString passwd);
-    static QVariant disconnectLocalClient();
+    static void disconnectLocalClient();
 
   private slots:
     void recvProxySignal(CoreSignal, QVariant, QVariant, QVariant);
-    bool startListening(uint port = 4242);
+    bool startListening(uint port = DEFAULT_PORT);
     void stopListening();
     void incomingConnection();
     void clientHasData();
index 4946711..e10b359 100644 (file)
@@ -181,7 +181,7 @@ QVariant CoreSession::sessionState() {
   mutex.lock();
   v["SessionData"] = sessionData;
   mutex.unlock();
-
+  v["Networks"] = QVariant(servers.keys());
   return v;
 }
 
index 44d66ab..6bccd56 100644 (file)
@@ -24,6 +24,8 @@
 #include <QDateTime>
 
 #include "util.h"
+#include "core.h"
+#include "coresession.h"
 
 Server::Server(UserId uid, QString net) : user(uid), network(net) {
   QString MQUOTE = QString('\020');
@@ -68,8 +70,11 @@ void Server::sendState() {
 
 void Server::connectToIrc(QString net) {
   if(net != network) return; // not me!
-  networkSettings = Global::data(user, "Networks").toMap()[net].toMap();
-  identity = Global::data(user, "Identities").toMap()[networkSettings["Identity"].toString()].toMap();
+  CoreSession *sess = Core::session(user);
+  //networkSettings = Global::data(user, "Networks").toMap()[net].toMap();
+  networkSettings = sess->retrieveSessionData("Networks").toMap()[net].toMap();
+  //identity = Global::data(user, "Identities").toMap()[networkSettings["Identity"].toString()].toMap();
+  identity = sess->retrieveSessionData("Identities").toMap()[networkSettings["Identity"].toString()].toMap();
   QList<QVariant> servers = networkSettings["Servers"].toList();
   QString host = servers[0].toMap()["Address"].toString();
   quint16 port = servers[0].toMap()["Port"].toUInt();
index bcc7ffd..dd8aac9 100644 (file)
@@ -31,8 +31,6 @@
 #include "message.h"
 #include "serverinfo.h"
 
-#define DEFAULT_PORT 6667
-
 
 /*!
  * This is a server object, managing a single connection to an IRC server, handling the associated channels and so on.
index cef85a4..d50af80 100644 (file)
@@ -1,8 +1,8 @@
 SET(qtgui_SRCS bufferview.cpp bufferviewfilter.cpp bufferwidget.cpp channelwidgetinput.cpp chatline.cpp chatwidget.cpp coreconnectdlg.cpp
-             identities.cpp mainwin.cpp qtgui.cpp serverlist.cpp settingsdlg.cpp settingspages.cpp style.cpp tabcompleter.cpp)
+             guisettings.cpp identities.cpp mainwin.cpp qtgui.cpp serverlist.cpp settingsdlg.cpp settingspages.cpp style.cpp tabcompleter.cpp)
 SET(qtgui_HDRS style.h)
 SET(qtgui_MOCS bufferview.h bufferviewfilter.h bufferwidget.h channelwidgetinput.h chatline.h chatwidget.h coreconnectdlg.h
-              identities.h mainwin.h qtgui.h serverlist.h settingsdlg.h settingspages.h tabcompleter.h)
+              guisettings.h identities.h mainwin.h qtgui.h serverlist.h settingsdlg.h settingspages.h tabcompleter.h)
 SET(qtgui_UICS identitiesdlg.ui identitieseditdlg.ui networkeditdlg.ui mainwin.ui
              nickeditdlg.ui serverlistdlg.ui servereditdlg.ui coreconnectdlg.ui ircwidget.ui
              bufferviewwidget.ui bufferwidget.ui settingsdlg.ui
@@ -19,4 +19,4 @@ QT4_WRAP_CPP(_MOC ${qtgui_MOCS})
 #INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
 
 ADD_LIBRARY(qtgui ${qtgui_SRCS} ${_MOC} ${_UIC})
-TARGET_LINK_LIBRARIES(qtgui common)
\ No newline at end of file
+TARGET_LINK_LIBRARIES(qtgui common client)
\ No newline at end of file
index 102c3cc..90efe6f 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005/06 by The Quassel Team                             *
+ *   Copyright (C) 2005-07 by The Quassel Team                             *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
 #include "clientproxy.h"
 #include "global.h"
 #include "client.h"
+#include "clientsettings.h"
+
+CoreConnectDlg::CoreConnectDlg(QWidget *parent, bool /*doAutoConnect*/) : QDialog(parent) {
+  ui.setupUi(this); //qDebug() << "new dlg";
 
-CoreConnectDlg::CoreConnectDlg(QWidget *parent) : QDialog(parent) {
-  ui.setupUi(this);
-  ui.progressBar->hide();
   coreState = 0;
-  QSettings s;
-  /*
-  connect(ui.hostName, SIGNAL(textChanged(QString)), this, SLOT(hostEditChanged(QString)));
-  connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(hostSelected()));
-
-  ui.hostName->setText(s.value("GUI/CoreHost", "localhost").toString());
-  ui.hostName->setSelection(0, ui.hostName->text().length());
-  ui.hostPort->setValue(s.value("GUI/CorePort", 4242).toInt());
-  ui.autoConnect->setChecked(s.value("GUI/CoreAutoConnect", true).toBool());
-  if(s.value("GUI/CoreAutoConnect").toBool()) {
-    hostSelected();
+  if(Global::runMode == Global::Monolithic) {
+    connect(ui.internalCore, SIGNAL(toggled(bool)), ui.hostEdit, SLOT(setDisabled(bool)));
+    connect(ui.internalCore, SIGNAL(toggled(bool)), ui.port, SLOT(setDisabled(bool)));
+    ui.internalCore->setChecked(true);
+  } else {
+    ui.internalCore->hide();
+  }
+  connect(ui.newAccount, SIGNAL(clicked()), this, SLOT(createAccount()));
+  connect(ui.delAccount, SIGNAL(clicked()), this, SLOT(removeAccount()));
+  connect(ui.buttonBox1, SIGNAL(accepted()), this, SLOT(doConnect()));
+  connect(ui.hostEdit, SIGNAL(textChanged(const QString &)), this, SLOT(checkInputValid()));
+  connect(ui.userEdit, SIGNAL(textChanged(const QString &)), this, SLOT(checkInputValid()));
+  connect(ui.internalCore, SIGNAL(toggled(bool)), this, SLOT(checkInputValid()));
+  connect(ui.accountList, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(accountChanged(const QString &)));
+  connect(ui.autoConnect, SIGNAL(clicked(bool)), this, SLOT(autoConnectToggled(bool)));
+
+  connect(Client::instance(), SIGNAL(coreConnectionMsg(const QString &)), ui.connectionStatus, SLOT(setText(const QString &)));
+  connect(Client::instance(), SIGNAL(coreConnectionProgress(uint, uint)), this, SLOT(updateProgressBar(uint, uint)));
+  connect(Client::instance(), SIGNAL(coreConnectionError(QString)), this, SLOT(coreConnectionError(QString)));
+  connect(Client::instance(), SIGNAL(connected()), this, SLOT(coreConnected()));
+
+  AccountSettings s;
+  ui.accountList->addItems(s.knownAccounts());
+  curacc = s.lastAccount();
+  if(!ui.accountList->count()) {
+    //if(doAutoConnect) reject();
+    /*
+    setAccountEditEnabled(false);
+    QString newacc = QInputDialog::getText(this, tr("Create Account"), tr(
+                                           "In order to connect to a Quassel Core, you need to create an account.<br>"
+                                           "Please enter a name for this account now:"), QLineEdit::Normal, tr("Default"));
+    if(!newacc.isEmpty()) {
+      ui.accountList->addItem(newacc);
+      ui.hostEdit->setText("localhost");
+      ui.port->setValue(DEFAULT_PORT);
+      ui.internalCore->setChecked(false);
+      setAccountEditEnabled(true);
+    }
+    */
+    // FIXME We create a default account here that just connects to the internal core
+    curacc = "Default";
+    ui.accountList->addItem("Default");
+    ui.internalCore->setChecked(true);
+    ui.userEdit->setText("Default");
+    ui.passwdEdit->setText("password");
+    ui.rememberPasswd->setChecked(true);
+    accountChanged(curacc);
+    ui.passwdEdit->setText("password");
+    ui.accountList->setCurrentIndex(0);
+    ui.autoConnect->setChecked(true);
+    autoConnectToggled(true);
+
+  } else {
+    if(!curacc.isEmpty()) {
+      //if(doAutoConnect) { qDebug() << "auto";
+      //  AccountSettings s;
+      //  int idx = ui.accountList->findText(s.autoConnectAccount());
+      //  if(idx < 0) reject();
+      //  else {
+      //    ui.accountList->setCurrentIndex(idx);
+      //    doConnect();
+      //  }
+      //} else {
+        int idx = ui.accountList->findText(curacc);
+        ui.accountList->setCurrentIndex(idx);
+      //}
+    }
+  }
+}
+
+void CoreConnectDlg::setAccountEditEnabled(bool en) {
+  ui.accountList->setEnabled(en);
+  ui.hostEdit->setEnabled(en && !ui.internalCore->isChecked());
+  ui.userEdit->setEnabled(en);
+  ui.passwdEdit->setEnabled(en);
+  ui.port->setEnabled(en && !ui.internalCore->isChecked());
+  ui.editAccount->setEnabled(en);
+  ui.delAccount->setEnabled(en);
+  ui.internalCore->setEnabled(en);
+  ui.rememberPasswd->setEnabled(en);
+  //ui.autoConnect->setEnabled(en);
+  ui.autoConnect->setEnabled(false); // FIXME temporär
+  ui.buttonBox1->button(QDialogButtonBox::Ok)->setEnabled(en && checkInputValid());
+}
+
+void CoreConnectDlg::accountChanged(const QString &text) {
+  AccountSettings s;
+  if(!curacc.isEmpty()) {
+    VarMap oldAcc;
+    oldAcc["User"] = ui.userEdit->text();
+    oldAcc["Host"] = ui.hostEdit->text();
+    oldAcc["Port"] = ui.port->value();
+    oldAcc["InternalCore"] = ui.internalCore->isChecked();
+    if(ui.rememberPasswd->isChecked()) oldAcc["Password"] = ui.passwdEdit->text();
+    s.setValue(curacc, "AccountData", oldAcc);
+  }
+  ui.autoConnect->setChecked(false);
+  if(!text.isEmpty()) { // empty text: just save stuff
+    curacc = text;
+    s.setLastAccount(curacc);
+    VarMap newAcc = s.value(curacc, "AccountData").toMap();
+    ui.userEdit->setText(newAcc["User"].toString());
+    ui.hostEdit->setText(newAcc["Host"].toString());
+    ui.port->setValue(newAcc["Port"].toInt());
+    ui.internalCore->setChecked(newAcc["InternalCore"].toBool());
+    if(newAcc.contains("Password")) {
+      ui.passwdEdit->setText(newAcc["Password"].toString());
+      ui.rememberPasswd->setChecked(true);
+    } else ui.rememberPasswd->setChecked(false);
+    if(s.autoConnectAccount() == curacc) ui.autoConnect->setChecked(true);
+  }
+}
+
+void CoreConnectDlg::autoConnectToggled(bool autoConnect) {
+  AccountSettings s;
+  if(autoConnect) s.setAutoConnectAccount(curacc);
+  else s.setAutoConnectAccount("");
+}
+
+bool CoreConnectDlg::checkInputValid() {
+  bool res = (ui.internalCore->isChecked() || ui.hostEdit->text().count()) && ui.userEdit->text().count();
+  ui.buttonBox1->button(QDialogButtonBox::Ok)->setEnabled(res);
+  return res;
+}
+
+void CoreConnectDlg::createAccount() {
+  QString accname = QInputDialog::getText(this, tr("Create Account"), tr("Please enter a name for the new account:"));
+  if(accname.isEmpty()) return;
+  if(ui.accountList->findText(accname) >= 0) {
+    QMessageBox::warning(this, tr("Account name already exists!"), tr("An account named '%1' already exists, and account names must be unique!").arg(accname));
+    return;
+  }
+  VarMap defdata;
+  ui.accountList->addItem(accname);
+  ui.accountList->setCurrentIndex(ui.accountList->findText(accname));
+  setAccountEditEnabled(true);
+}
+
+void CoreConnectDlg::removeAccount() {
+  QString acc = ui.accountList->currentText();
+  int res = QMessageBox::warning(this, tr("Delete account?"), tr("Do you really want to delete the data for the account '%1'?<br>"
+                                                       "Note that this only affects your local account settings and will not remove "
+                                                       "any data from the core.").arg(acc),
+                             QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
+  if(res == QMessageBox::Yes) {
+    AccountSettings s;
+    s.removeAccount(acc);
+    curacc = "";
+    ui.accountList->removeItem(ui.accountList->findText(acc));
+    if(!ui.accountList->count()) setAccountEditEnabled(false);
+  }
+}
+
+bool CoreConnectDlg::willDoInternalAutoConnect() {
+  AccountSettings s;
+  if(ui.autoConnect->isChecked() && s.autoConnectAccount() == curacc && ui.internalCore->isChecked()) {
+    return true;
+  }
+  return false;
+}
+
+void CoreConnectDlg::doAutoConnect() {
+  AccountSettings s;
+  if(s.autoConnectAccount() == curacc) {
+    doConnect();
   }
-  */
+}
+
+void CoreConnectDlg::doConnect() {
+  accountChanged(); // save current account info
+
+  VarMap conninfo;
+  ui.stackedWidget->setCurrentIndex(1);
+  if(ui.internalCore->isChecked()) {
+    ui.connectionGroupBox->setTitle(tr("Connecting to internal core"));
+    ui.connectionProgress->hide();
+  } else {
+    ui.connectionGroupBox->setTitle(tr("Connecting to %1").arg(ui.hostEdit->text()));
+    conninfo["Host"] = ui.hostEdit->text();
+    conninfo["Post"] = ui.port->value();
+  }
+  conninfo["User"] = ui.userEdit->text();
+  conninfo["Password"] = ui.passwdEdit->text();
+  ui.profileLabel->hide(); ui.guiProfile->hide();
+  ui.newGuiProfile->hide(); ui.alwaysUseProfile->hide();
+  ui.connectionProgress->show();
+  try {
+    Client::instance()->connectToCore(conninfo);
+  } catch(Exception e) {
+    QString msg;
+    //if(!e.msg().isEmpty()) msg = tr("<br>%1").arg(e.msg()); // FIXME throw more detailed (vulgo: any) error msg
+    coreConnectionError(tr("Invalid user or password. Pleasy try again.%1").arg(msg));
+    //QMessageBox::warning(this, tr("Unknown account"), tr("Invalid user or password. Pleasy try again.%1").arg(msg));
+    //cancelConnect();
+    return;
+  }
+}
+
+void CoreConnectDlg::cancelConnect() {
+  ui.stackedWidget->setCurrentIndex(0);
 }
 
 void CoreConnectDlg::setStartState() { /*
@@ -49,10 +237,11 @@ void CoreConnectDlg::setStartState() { /*
   ui.buttonBox->button(QDialogButtonBox::Ok)->show();
   ui.hostName->setEnabled(true); ui.hostPort->setEnabled(true);
   ui.hostName->setSelection(0, ui.hostName->text().length()); */
+  ui.stackedWidget->setCurrentIndex(0);
 }
 
-void CoreConnectDlg::hostEditChanged(QString txt) {
-  ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(txt.length());
+void CoreConnectDlg::hostEditChanged(QString /*txt*/) {
+  //ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(txt.length());
 }
 
 void CoreConnectDlg::hostSelected() { /*
@@ -78,22 +267,27 @@ void CoreConnectDlg::coreConnected() { /*
   VarMap initmsg;
   initmsg["GUIProtocol"] = GUI_PROTOCOL;
   // FIXME guiProxy->send(GS_CLIENT_INIT, QVariant(initmsg)); */
+  ui.connectionStatus->setText(tr("Connected to core."));
+  accept();
 }
 
 void CoreConnectDlg::coreConnectionError(QString err) {
+  ui.stackedWidget->setCurrentIndex(0);
+  show(); // just in case we started hidden
   QMessageBox::warning(this, tr("Connection Error"), tr("<b>Could not connect to Quassel Core!</b><br>\n") + err, QMessageBox::Retry);
   disconnect(ClientProxy::instance(), 0, this, 0);
-  ui.autoConnect->setChecked(false);
+  //ui.autoConnect->setChecked(false);
   setStartState();
 }
 
-void CoreConnectDlg::updateProgressBar(quint32 recv, quint32 avail) {
-  ui.progressBar->setMaximum(avail);
-  ui.progressBar->setValue(recv);
+void CoreConnectDlg::updateProgressBar(uint partial, uint total) {
+  ui.connectionProgress->setMaximum(total);
+  ui.connectionProgress->setValue(partial);
+  //qDebug() << "progress:" << partial << total;
 }
 
 void CoreConnectDlg::recvCoreState(QVariant state) {
-  ui.progressBar->hide();
+  //ui.progressBar->hide();
   coreState = state;
   accept();
 }
index 53fc425..056e9ab 100644 (file)
 #define _CORECONNECTDLG_H
 
 #include "ui_coreconnectdlg.h"
+#include "global.h"
 
 class CoreConnectDlg: public QDialog {
   Q_OBJECT
 
   public:
-    CoreConnectDlg(QWidget *);
+    CoreConnectDlg(QWidget *parent, bool doAutoConnect = false);
     QVariant getCoreState();
 
+    bool willDoInternalAutoConnect();
+
+  public slots:
+    void doAutoConnect();
+
   private slots:
+    void createAccount();
+    void removeAccount();
+    void accountChanged(const QString & = "");
+    void setAccountEditEnabled(bool);
+    void autoConnectToggled(bool);
+    bool checkInputValid();
     void hostEditChanged(QString);
     void hostSelected();
+    void doConnect();
 
     void coreConnected();
     void coreConnectionError(QString);
-    void updateProgressBar(quint32 bytes, quint32 avail);
+    //void coreConnectionMsg(const QString &);
+    //void coreConnectionProgress(uint partial, uint total);
+    void updateProgressBar(uint partial, uint total);
     void recvCoreState(QVariant);
 
   private:
     Ui::CoreConnectDlg ui;
     QVariant coreState;
 
+    void cancelConnect();
     void setStartState();
+    VarMap accountData;
+    QString curacc;
 };
 
 #endif
diff --git a/src/qtgui/guisettings.cpp b/src/qtgui/guisettings.cpp
new file mode 100644 (file)
index 0000000..9151cb7
--- /dev/null
@@ -0,0 +1,19 @@
+/***************************************************************************
+ *   Copyright (C) 2005-07 by The Quassel IRC Development Team             *
+ *   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) any later version.                                   *
+ *                                                                         *
+ *   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.             *
+ ***************************************************************************/
diff --git a/src/qtgui/guisettings.h b/src/qtgui/guisettings.h
new file mode 100644 (file)
index 0000000..a34f57b
--- /dev/null
@@ -0,0 +1,48 @@
+/***************************************************************************
+ *   Copyright (C) 2005-07 by The Quassel IRC Development Team             *
+ *   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) any later version.                                   *
+ *                                                                         *
+ *   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 _GUISETTINGS_H_
+#define _GUISETTINGS_H_
+
+#include "clientsettings.h"
+
+class GuiSettings : public ClientSettings {
+  Q_OBJECT
+
+  public:
+    GuiSettings();
+
+
+};
+
+class GuiProfile : public ClientSettings {
+  Q_OBJECT
+
+  public:
+    GuiProfile();
+
+    static QStringList availableProfiles();
+    static GuiProfile *profile(QString name);
+
+    
+
+};
+
+#endif
index 3161717..b085014 100644 (file)
@@ -19,6 +19,7 @@
  ***************************************************************************/
 
 #include "identities.h"
+#include "client.h"
 
 IdentitiesDlg::IdentitiesDlg(QWidget *parent, QString selected) : QDialog(parent) {
   ui.setupUi(this);
@@ -26,7 +27,7 @@ IdentitiesDlg::IdentitiesDlg(QWidget *parent, QString selected) : QDialog(parent
 
   connect(ui.enableAutoAway, SIGNAL(stateChanged(int)), this, SLOT(autoAwayChecked()));
 
-  identities = Global::data("Identities").toMap();
+  identities = Client::retrieveSessionData("Identities").toMap();
   foreach(QString name, identities.keys()) {
     nameMapping[name] = name;
   }
@@ -236,9 +237,9 @@ void IdentitiesDlg::accept() {
   updateIdentity(getCurIdentity());
   QString result = checkValidity();
   if(result.length() == 0) {
-    Global::putData("Identities", identities);
+    Client::storeSessionData("Identities", identities);
     // We have to care about renamed identities and update the network list appropriately...
-    VarMap networks = Global::data("Networks").toMap();
+    VarMap networks = Client::retrieveSessionData("Networks").toMap();
     foreach(QString netname, networks.keys()) {
       VarMap net = networks[netname].toMap();
       if(nameMapping.contains(net["Identity"].toString())) {
@@ -246,7 +247,7 @@ void IdentitiesDlg::accept() {
       } else net["Identity"] = "Default";
       networks[netname] = net;
     }
-    Global::putData("Networks", networks);
+    Client::storeSessionData("Networks", networks);
     QDialog::accept();
   } else {
     QMessageBox::warning(this, tr("Invalid Identity!"),
index 6b89e20..8398042 100644 (file)
@@ -46,12 +46,12 @@ void MainWin::init() {
 
   show();
 
-  VarMap connInfo;
-  connInfo["User"] = "Default";
-  connInfo["Password"] = "password";
-  connectToCore(connInfo);
+  //VarMap connInfo;
+  //connInfo["User"] = "Default";
+  //connInfo["Password"] = "password";
+  //connectToCore(connInfo);
 
-  statusBar()->showMessage(tr("Ready."));
+  statusBar()->showMessage(tr("Not connected to core."));
   systray = new QSystemTrayIcon(this);
   systray->setIcon(QIcon(":/qirc-icon.png"));
   systray->show();
@@ -71,10 +71,14 @@ void MainWin::init() {
   if(s.contains("MainWinState")) restoreState(s.value("MainWinState").toByteArray());
   s.endGroup();
 
-  s.beginGroup("Buffers");
-  QString net = s.value("CurrentNetwork", "").toString();
-  QString buf = s.value("CurrentBuffer", "").toString();
-  s.endGroup();
+  //s.beginGroup("Buffers");
+  //QString net = s.value("CurrentNetwork", "").toString();
+  //QString buf = s.value("CurrentBuffer", "").toString();
+  //s.endGroup();
+
+  disconnectedFromCore();  // Disable menus and stuff
+  showCoreConnectionDlg(true); // autoconnect if appropriate
+  //ui.actionConnectCore->activate(QAction::Trigger);
 }
 
 MainWin::~MainWin() {
@@ -95,6 +99,8 @@ void MainWin::setupSettingsDlg() {
 */
 
 void MainWin::setupMenus() {
+  connect(ui.actionConnectCore, SIGNAL(triggered()), this, SLOT(showCoreConnectionDlg()));
+  connect(ui.actionDisconnectCore, SIGNAL(triggered()), Client::instance(), SLOT(disconnectFromCore()));
   connect(ui.actionNetworkList, SIGNAL(triggered()), this, SLOT(showServerList()));
   connect(ui.actionEditIdentities, SIGNAL(triggered()), serverListDlg, SLOT(editIdentities()));
   connect(ui.actionSettingsDlg, SIGNAL(triggered()), this, SLOT(showSettingsDlg()));
@@ -109,12 +115,12 @@ void MainWin::setupViews() {
   
   BufferTreeModel *model = Client::bufferModel();
   connect(model, SIGNAL(bufferSelected(Buffer *)), this, SLOT(showBuffer(Buffer *)));
-  
+
   addBufferView(tr("All Buffers"), model, BufferViewFilter::AllNets, QStringList());
-  addBufferView(tr("All Channels"), model, BufferViewFilter::AllNets|BufferViewFilter::NoQueries|BufferViewFilter::NoServers, QStringList());
-  addBufferView(tr("All Queries"), model, BufferViewFilter::AllNets|BufferViewFilter::NoChannels|BufferViewFilter::NoServers, QStringList());
-  addBufferView(tr("All Networks"), model, BufferViewFilter::AllNets|BufferViewFilter::NoChannels|BufferViewFilter::NoQueries, QStringList());
-  addBufferView(tr("Full Custom"), model, BufferViewFilter::FullCustom, QStringList());
+  //addBufferView(tr("All Channels"), model, BufferViewFilter::AllNets|BufferViewFilter::NoQueries|BufferViewFilter::NoServers, QStringList());
+  //addBufferView(tr("All Queries"), model, BufferViewFilter::AllNets|BufferViewFilter::NoChannels|BufferViewFilter::NoServers, QStringList());
+  //addBufferView(tr("All Networks"), model, BufferViewFilter::AllNets|BufferViewFilter::NoChannels|BufferViewFilter::NoQueries, QStringList());
+  //addBufferView(tr("Full Custom"), model, BufferViewFilter::FullCustom, QStringList());
   
   ui.menuViews->addSeparator();
 }
@@ -140,16 +146,43 @@ void MainWin::connectedToCore() {
   foreach(BufferId id, Client::allBufferIds()) {
     emit requestBacklog(id, 100, -1);
   }
+
+  ui.menuViews->setEnabled(true);
+  ui.menuCore->setEnabled(true);
+  ui.actionDisconnectCore->setEnabled(false); // FIXME
+  ui.actionNetworkList->setEnabled(true);
+  ui.bufferWidget->show();
 }
 
 void MainWin::disconnectedFromCore() {
-
+  ui.menuViews->setEnabled(false);
+  ui.menuCore->setEnabled(false);
+  ui.actionDisconnectCore->setEnabled(false);
+  ui.actionNetworkList->setEnabled(false);
+  ui.bufferWidget->hide();
+  ui.actionConnectCore->setEnabled(false); // FIXME
+  qDebug() << "mainwin disconnected";
 }
 
 AbstractUiMsg *MainWin::layoutMsg(const Message &msg) {
   return new ChatLine(msg);
 }
 
+void MainWin::showCoreConnectionDlg(bool autoConnect) {
+  coreConnectDlg = new CoreConnectDlg(this, autoConnect);
+  connect(coreConnectDlg, SIGNAL(finished(int)), this, SLOT(coreConnectionDlgFinished(int)));
+  coreConnectDlg->setModal(true);
+  if(!autoConnect || !coreConnectDlg->willDoInternalAutoConnect())
+    coreConnectDlg->show(); // avoid flicker and show dlg only if we do remote connect, which needs a progress bar
+  if(autoConnect) coreConnectDlg->doAutoConnect();
+}
+
+void MainWin::coreConnectionDlgFinished(int /*code*/) {
+
+  delete coreConnectDlg;
+}
+
+
 void MainWin::showServerList() {
 //  if(!serverListDlg) {
 //    serverListDlg = new ServerListDlg(this);
index 24e6ccb..60ffc18 100644 (file)
@@ -57,6 +57,8 @@ class MainWin : public QMainWindow {
 
     void showServerList();
     void showSettingsDlg();
+    void showCoreConnectionDlg(bool autoConnect = false);
+    void coreConnectionDlgFinished(int result);
 
     void showBuffer(BufferId);
     void showBuffer(Buffer *);
@@ -86,6 +88,7 @@ class MainWin : public QMainWindow {
     SettingsDlg *settingsDlg;
 
     uint currentBuffer;
+    QString currentProfile;
 
     QList<QDockWidget *> netViews;
 
index 9b36fcc..b1b68ba 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "serverlist.h"
 #include "identities.h"
+#include "client.h"
 #include "clientproxy.h"
 
 /* NOTE: This dialog holds not only the server list, but also the identities.
@@ -36,15 +37,16 @@ ServerListDlg::ServerListDlg(QWidget *parent) : QDialog(parent) {
 
   updateNetworkTree();
   connect(ui.networkTree, SIGNAL(itemSelectionChanged()), this, SLOT(updateButtons()));
+  connect(Client::instance(), SIGNAL(sessionDataChanged(const QString &)), this, SLOT(updateNetworkTree()));
 
   settings.endGroup();
   // check if we already have a valid identity
-  if(!Global::data("Identities", VarMap()).toMap().contains("Default")) editIdentities(true);
+  //if(!Global::data("Identities", VarMap()).toMap().contains("Default")) editIdentities(true); // FIXME
   connect(this, SIGNAL(requestConnect(QStringList)), ClientProxy::instance(), SLOT(gsRequestConnect(QStringList)));
 
   // Autoconnect
   QStringList list;
-  VarMap networks = Global::data("Networks").toMap();
+  VarMap networks = Client::retrieveSessionData("Networks").toMap();
   foreach(QString net, networks.keys()) {
     if(networks[net].toMap()["AutoConnect"].toBool()) {
       list << net;
@@ -58,7 +60,7 @@ ServerListDlg::~ServerListDlg() {
 }
 
 void ServerListDlg::updateNetworkTree() {
-  VarMap networks = Global::data("Networks").toMap();
+  VarMap networks = Client::retrieveSessionData("Networks").toMap();
   //QStringList headers;
   //headers << "Network" << "Autoconnect";
   ui.networkTree->clear();
@@ -92,7 +94,7 @@ void ServerListDlg::updateNetworkTree() {
     //item->setCheckState(1, Qt::Unchecked);
   }
   ui.networkTree->sortItems(0, Qt::AscendingOrder);
-
+  updateButtons();
 }
 
 void ServerListDlg::updateButtons() {
@@ -110,23 +112,23 @@ bool ServerListDlg::showOnStartup() {
 void ServerListDlg::on_addButton_clicked() {
   NetworkEditDlg dlg(this, VarMap());
   if(dlg.exec() == QDialog::Accepted) {
-    VarMap networks = Global::data("Networks").toMap();
+    VarMap networks = Client::retrieveSessionData("Networks").toMap();
     VarMap net = dlg.getNetwork();
     networks[net["Name"].toString()] = net;
-    Global::putData("Networks", networks);
+    Client::storeSessionData("Networks", networks);
     updateNetworkTree();
   }
 }
 
 void ServerListDlg::on_editButton_clicked() {
   QString curnet = ui.networkTree->currentItem()->text(0);
-  VarMap networks = Global::data("Networks").toMap();
+  VarMap networks = Client::retrieveSessionData("Networks").toMap();
   NetworkEditDlg dlg(this, networks[curnet].toMap());
   if(dlg.exec() == QDialog::Accepted) {
     VarMap net = dlg.getNetwork();
     networks.remove(curnet);
     networks[net["Name"].toString()] = net;
-    Global::putData("Networks", networks);
+    Client::storeSessionData("Networks", networks);
     updateNetworkTree();
   }
 }
@@ -134,12 +136,12 @@ void ServerListDlg::on_editButton_clicked() {
 void ServerListDlg::on_deleteButton_clicked() {
   if(QMessageBox::warning(this, tr("Remove Network?"), tr("Are you sure you want to delete the selected network(s)?"),
                         QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
-    VarMap networks = Global::data("Networks").toMap();
+    VarMap networks = Client::retrieveSessionData("Networks").toMap();
     QList<QTreeWidgetItem *> sel = ui.networkTree->selectedItems();
     foreach(QTreeWidgetItem *item, sel) {
       networks.remove(item->text(0));
     }
-    Global::putData("Networks", networks);
+    Client::storeSessionData("Networks", networks);
     updateNetworkTree();
   }
 }
@@ -183,14 +185,14 @@ NetworkEditDlg::NetworkEditDlg(QWidget *parent, VarMap _network) : QDialog(paren
 
   connect(ui.serverList, SIGNAL(itemSelectionChanged()), this, SLOT(updateServerButtons()));
 
-  VarMap identities = Global::data("Identities").toMap();
+  VarMap identities = Client::retrieveSessionData("Identities").toMap();
 
   ui.identityList->addItem(tr("Default Identity"));
   foreach(QString id, identities.keys()) {
     if(id != "Default") ui.identityList->addItem(id);
   }
   QStringList groups; groups << "";
-  VarMap nets = Global::data("Networks").toMap();
+  VarMap nets = Client::retrieveSessionData("Networks").toMap();
   foreach(QString net, nets.keys()) {
     QString gr = nets[net].toMap()["Group"].toString();
     if(!groups.contains(gr) && !gr.isEmpty()) {
@@ -273,7 +275,7 @@ void NetworkEditDlg::accept() {
 
 QString NetworkEditDlg::checkValidity() {
   QString r;
-  VarMap nets = Global::data("Networks").toMap();
+  VarMap nets = Client::retrieveSessionData("Networks").toMap();
   if(ui.networkName->text() != oldName && nets.keys().contains(ui.networkName->text())) {
     r += tr(" Network name already exists.");
   }
@@ -338,7 +340,7 @@ void NetworkEditDlg::on_editIdentities_clicked() {
   else id = "Default";
   IdentitiesDlg dlg(this, id);
   if(dlg.exec() == QDialog::Accepted) {
-    VarMap identities = Global::data("Identities").toMap();
+    VarMap identities = Client::retrieveSessionData("Identities").toMap();
     ui.identityList->clear();
     ui.identityList->addItem(tr("Default Identity"));
     foreach(QString i, identities.keys()) {
index 706e023..aa4c825 100644 (file)
@@ -50,6 +50,7 @@ class ServerListDlg : public QDialog {
 
   private slots:
     void updateButtons();
+    void updateNetworkTree();
     void on_showOnStartup_stateChanged(int);
     void on_addButton_clicked();
     void on_editButton_clicked();
@@ -58,7 +59,6 @@ class ServerListDlg : public QDialog {
   private:
     Ui::ServerListDlg ui;
 
-    void updateNetworkTree();
     //VarMap networks;
     //VarMap identities;  <-- this is now stored in global
 };
index 1311565..4610cea 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>498</width>
-    <height>270</height>
+    <width>484</width>
+    <height>215</height>
    </rect>
   </property>
   <property name="sizePolicy" >
    <bool>false</bool>
   </property>
   <layout class="QVBoxLayout" >
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <property name="leftMargin" >
+    <number>0</number>
+   </property>
+   <property name="topMargin" >
+    <number>0</number>
+   </property>
+   <property name="rightMargin" >
+    <number>0</number>
+   </property>
+   <property name="bottomMargin" >
+    <number>0</number>
+   </property>
    <item>
-    <widget class="QGroupBox" name="groupBox" >
-     <property name="title" >
-      <string>Core Connection Settings</string>
-     </property>
-     <layout class="QHBoxLayout" >
-      <item>
-       <layout class="QGridLayout" >
-        <item row="0" column="0" colspan="2" >
-         <widget class="QComboBox" name="connectProfileName" />
-        </item>
-        <item row="1" column="0" >
-         <widget class="QLabel" name="label_2" >
-          <property name="text" >
-           <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
-p, li { white-space: pre-wrap; }
-&lt;/style>&lt;/head>&lt;body style=" font-family:'Bitstream Vera Sans'; font-size:11pt; font-weight:400; font-style:normal;">
-&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Host:&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="1" >
-         <widget class="QLabel" name="hostName" >
-          <property name="text" >
-           <string>quassel.mindpool.net:4242</string>
-          </property>
-         </widget>
-        </item>
-        <item row="2" column="0" >
-         <widget class="QLabel" name="label_3" >
-          <property name="text" >
-           <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
-p, li { white-space: pre-wrap; }
-&lt;/style>&lt;/head>&lt;body style=" font-family:'Bitstream Vera Sans'; font-size:11pt; font-weight:400; font-style:normal;">
-&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">User:&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
-          </property>
-         </widget>
-        </item>
-        <item row="2" column="1" >
-         <widget class="QLabel" name="user" >
-          <property name="text" >
-           <string>quasseluser</string>
-          </property>
-         </widget>
-        </item>
-        <item row="3" column="0" >
-         <widget class="QLabel" name="label_4" >
-          <property name="text" >
-           <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
-p, li { white-space: pre-wrap; }
-&lt;/style>&lt;/head>&lt;body style=" font-family:'Bitstream Vera Sans'; font-size:11pt; font-weight:400; font-style:normal;">
-&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Password:&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
-          </property>
-         </widget>
-        </item>
-        <item row="3" column="1" >
-         <widget class="QLineEdit" name="passwdEdit" >
-          <property name="echoMode" >
-           <enum>QLineEdit::Password</enum>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="2" >
-         <widget class="QPushButton" name="editConnectProfile" >
-          <property name="text" >
-           <string>Edit...</string>
-          </property>
-         </widget>
-        </item>
-        <item row="0" column="2" >
-         <widget class="QPushButton" name="newConnectProfile" >
-          <property name="text" >
-           <string>New...</string>
-          </property>
-         </widget>
-        </item>
-        <item row="3" column="2" >
-         <widget class="QCheckBox" name="rememberPasswd" >
-          <property name="text" >
-           <string>Remember</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
-    <widget class="QProgressBar" name="progressBar" >
-     <property name="value" >
+    <widget class="QStackedWidget" name="stackedWidget" >
+     <property name="currentIndex" >
       <number>0</number>
      </property>
-     <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
-     </property>
+     <widget class="QWidget" name="page" >
+      <layout class="QGridLayout" >
+       <item row="0" column="0" >
+        <widget class="QGroupBox" name="groupBox" >
+         <property name="title" >
+          <string>Account Settings</string>
+         </property>
+         <layout class="QGridLayout" >
+          <item rowspan="2" row="0" column="0" >
+           <widget class="QLabel" name="label_5" >
+            <property name="text" >
+             <string>Account:</string>
+            </property>
+           </widget>
+          </item>
+          <item rowspan="2" row="0" column="1" colspan="2" >
+           <widget class="QComboBox" name="accountList" >
+            <property name="editable" >
+             <bool>false</bool>
+            </property>
+            <property name="insertPolicy" >
+             <enum>QComboBox::InsertAlphabetically</enum>
+            </property>
+           </widget>
+          </item>
+          <item rowspan="2" row="0" column="3" >
+           <widget class="QToolButton" name="editAccount" >
+            <property name="text" >
+             <string>...</string>
+            </property>
+            <property name="icon" >
+             <iconset resource="../../images/icons.qrc" >:/default/edit.png</iconset>
+            </property>
+           </widget>
+          </item>
+          <item rowspan="2" row="0" column="4" >
+           <widget class="QToolButton" name="newAccount" >
+            <property name="text" >
+             <string>...</string>
+            </property>
+            <property name="icon" >
+             <iconset resource="../../images/icons.qrc" >:/default/edit_add.png</iconset>
+            </property>
+           </widget>
+          </item>
+          <item rowspan="2" row="0" column="5" colspan="2" >
+           <widget class="QToolButton" name="delAccount" >
+            <property name="text" >
+             <string>...</string>
+            </property>
+            <property name="icon" >
+             <iconset resource="../../images/icons.qrc" >:/default/edit_remove.png</iconset>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="6" >
+           <spacer>
+            <property name="orientation" >
+             <enum>Qt::Horizontal</enum>
+            </property>
+            <property name="sizeHint" >
+             <size>
+              <width>20</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+          <item row="2" column="0" >
+           <widget class="QLabel" name="label_2" >
+            <property name="text" >
+             <string>Host:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="1" colspan="2" >
+           <widget class="QLineEdit" name="hostEdit" />
+          </item>
+          <item row="2" column="3" colspan="4" >
+           <widget class="QCheckBox" name="internalCore" >
+            <property name="text" >
+             <string>Use internal</string>
+            </property>
+            <property name="checked" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="3" column="0" >
+           <widget class="QLabel" name="label" >
+            <property name="text" >
+             <string>Port:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="3" column="1" >
+           <widget class="QSpinBox" name="port" >
+            <property name="minimum" >
+             <number>1024</number>
+            </property>
+            <property name="maximum" >
+             <number>65535</number>
+            </property>
+            <property name="value" >
+             <number>4242</number>
+            </property>
+           </widget>
+          </item>
+          <item row="3" column="2" >
+           <spacer>
+            <property name="orientation" >
+             <enum>Qt::Horizontal</enum>
+            </property>
+            <property name="sizeHint" >
+             <size>
+              <width>211</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+          <item row="4" column="0" >
+           <widget class="QLabel" name="label_3" >
+            <property name="text" >
+             <string>User:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="4" column="1" colspan="2" >
+           <widget class="QLineEdit" name="userEdit" />
+          </item>
+          <item row="5" column="0" >
+           <widget class="QLabel" name="label_4" >
+            <property name="text" >
+             <string>Password:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="5" column="1" colspan="2" >
+           <widget class="QLineEdit" name="passwdEdit" >
+            <property name="echoMode" >
+             <enum>QLineEdit::Password</enum>
+            </property>
+           </widget>
+          </item>
+          <item row="5" column="3" colspan="4" >
+           <widget class="QCheckBox" name="rememberPasswd" >
+            <property name="text" >
+             <string>Remember</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item row="1" column="0" >
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="2" column="0" >
+        <layout class="QHBoxLayout" >
+         <property name="spacing" >
+          <number>6</number>
+         </property>
+         <property name="leftMargin" >
+          <number>0</number>
+         </property>
+         <property name="topMargin" >
+          <number>0</number>
+         </property>
+         <property name="rightMargin" >
+          <number>0</number>
+         </property>
+         <property name="bottomMargin" >
+          <number>0</number>
+         </property>
+         <item>
+          <widget class="QCheckBox" name="autoConnect" >
+           <property name="text" >
+            <string>Always use this account</string>
+           </property>
+           <property name="checked" >
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer>
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" >
+            <size>
+             <width>101</width>
+             <height>31</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QDialogButtonBox" name="buttonBox1" >
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="standardButtons" >
+            <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="page_2" >
+      <layout class="QVBoxLayout" >
+       <item>
+        <widget class="QGroupBox" name="connectionGroupBox" >
+         <property name="title" >
+          <string>Connecting to...</string>
+         </property>
+         <layout class="QVBoxLayout" >
+          <item>
+           <widget class="QLabel" name="connectionStatus" >
+            <property name="text" >
+             <string>Connecting...</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QProgressBar" name="connectionProgress" >
+            <property name="value" >
+             <number>0</number>
+            </property>
+            <property name="orientation" >
+             <enum>Qt::Horizontal</enum>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <layout class="QHBoxLayout" >
+            <item>
+             <widget class="QLabel" name="profileLabel" >
+              <property name="text" >
+               <string>GUI Profile:</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QComboBox" name="guiProfile" >
+              <property name="sizePolicy" >
+               <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="newGuiProfile" >
+              <property name="sizePolicy" >
+               <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="text" >
+               <string>New...</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="alwaysUseProfile" >
+            <property name="text" >
+             <string>Always use this profile</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item>
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>20</width>
+           <height>31</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" >
+         <item>
+          <spacer>
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" >
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QDialogButtonBox" name="buttonBox2" >
+           <property name="standardButtons" >
+            <set>QDialogButtonBox::Abort|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
     </widget>
    </item>
-   <item>
-    <layout class="QHBoxLayout" >
-     <property name="spacing" >
-      <number>6</number>
-     </property>
-     <property name="leftMargin" >
-      <number>0</number>
-     </property>
-     <property name="topMargin" >
-      <number>0</number>
-     </property>
-     <property name="rightMargin" >
-      <number>0</number>
-     </property>
-     <property name="bottomMargin" >
-      <number>0</number>
-     </property>
-     <item>
-      <widget class="QCheckBox" name="autoConnect" >
-       <property name="text" >
-        <string>Connect automatically</string>
-       </property>
-       <property name="checked" >
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer>
-       <property name="orientation" >
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" >
-        <size>
-         <width>101</width>
-         <height>31</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QDialogButtonBox" name="buttonBox" >
-       <property name="orientation" >
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="standardButtons" >
-        <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
   </layout>
  </widget>
- <includes/>
  <resources>
   <include location="../../images/icons.qrc" />
  </resources>
  <connections>
   <connection>
-   <sender>buttonBox</sender>
+   <sender>buttonBox1</sender>
    <signal>rejected()</signal>
    <receiver>CoreConnectDlg</receiver>
    <slot>reject()</slot>
index 82c7e6e..9a35511 100644 (file)
      <x>0</x>
      <y>0</y>
      <width>800</width>
-     <height>28</height>
+     <height>32</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuConnection" >
     <property name="title" >
      <string>Connection</string>
     </property>
-    <widget class="QMenu" name="menuConnectCore" >
-     <property name="title" >
-      <string>Connect to Core</string>
-     </property>
-     <addaction name="actionInternal" />
-    </widget>
-    <addaction name="menuConnectCore" />
+    <addaction name="actionConnectCore" />
     <addaction name="actionDisconnectCore" />
     <addaction name="separator" />
     <addaction name="actionNetworkList" />
    </property>
   </action>
   <action name="actionDisconnectCore" >
+   <property name="enabled" >
+    <bool>false</bool>
+   </property>
    <property name="text" >
     <string>Disconnect from Core</string>
    </property>
   </action>
+  <action name="actionConnectCore" >
+   <property name="enabled" >
+    <bool>false</bool>
+   </property>
+   <property name="text" >
+    <string>Connect to Core...</string>
+   </property>
+  </action>
  </widget>
  <customwidgets>
   <customwidget>