This is to make Quassel suitable for Kubuntu.
You currently cannot connect to a remote core with the monolithic
client. We investigate proper methods to make this possible again
without being uintuitive.
static void logMessage(QtMsgType type, const char *msg);
static inline const QString &debugLog() { return instance()->_debugLogBuffer; }
+ static inline void registerClientSyncer(ClientSyncer *syncer) { emit instance()->newClientSyncer(syncer); }
+
signals:
void sendInput(BufferInfo, QString message);
void requestNetworkStates();
SignalProxy::writeDataToDevice(socket, clientInit);
}
-void ClientSyncer::useInternalCore(AccountId internalAccountId) {
+void ClientSyncer::useInternalCore() {
+ AccountId internalAccountId;
+
+ CoreAccountSettings accountSettings;
+ QList<AccountId> knownAccounts = accountSettings.knownAccounts();
+ foreach(AccountId id, knownAccounts) {
+ if(!id.isValid())
+ continue;
+ QVariantMap data = accountSettings.retrieveAccountData(id);
+ if(data.contains("InternalAccount") && data["InternalAccount"].toBool()) {
+ internalAccountId = id;
+ break;
+ }
+ }
+
+ if(!internalAccountId.isValid()) {
+ for(AccountId i = 1;; i++) {
+ if(!knownAccounts.contains(i)) {
+ internalAccountId = i;
+ break;
+ }
+ }
+ QVariantMap data;
+ data["InternalAccount"] = true;
+ accountSettings.storeAccountData(internalAccountId, data);
+ }
+
coreConnectionInfo["AccountId"] = QVariant::fromValue<AccountId>(internalAccountId);
- emit startInternalCore();
+ emit startInternalCore(this);
emit connectToInternalCore(Client::instance()->signalProxy());
}
void encrypted(bool);
- void startInternalCore();
+ void startInternalCore(ClientSyncer *syncer);
void connectToInternalCore(SignalProxy *proxy);
public slots:
void connectToCore(const QVariantMap &);
void loginToCore(const QString &user, const QString &passwd);
void disconnectFromCore();
- void useInternalCore(AccountId internalAccountId);
+ void useInternalCore();
private slots:
void coreSocketError(QAbstractSocket::SocketError);
setWindowFlags(Qt::Sheet);
clientSyncer = new ClientSyncer(this);
- connect(this, SIGNAL(newClientSyncer(ClientSyncer *)), Client::instance(), SIGNAL(newClientSyncer(ClientSyncer *)));
- emit newClientSyncer(clientSyncer); // announce the new client syncer via the client.
+ Client::registerClientSyncer(clientSyncer);
+// connect(this, SIGNAL(newClientSyncer(ClientSyncer *)), Client::instance(), SIGNAL(newClientSyncer(ClientSyncer *)));
+// emit newClientSyncer(clientSyncer); // announce the new client syncer via the client.
wizard = 0;
}
void CoreConnectDlg::on_useInternalCore_clicked() {
- if(!_internalAccountId.isValid()) {
- _internalAccountId = findFreeAccountId();
- QVariantMap data;
- data["InternalAccount"] = true;
- CoreAccountSettings accountSettings;
- accountSettings.storeAccountData(_internalAccountId, data);
- }
- clientSyncer->useInternalCore(_internalAccountId);
+ clientSyncer->useInternalCore();
ui.loginButtonBox->setStandardButtons(QDialogButtonBox::Cancel);
}
CoreConnectDlg(bool = false, QWidget *parent = 0);
~CoreConnectDlg();
-signals:
- void newClientSyncer(ClientSyncer *);
+// signals:
+// void newClientSyncer(ClientSyncer *);
private slots:
/*** Phase Null: Accounts ***/
#include "chatmonitorview.h"
#include "chatview.h"
#include "client.h"
+#include "clientsyncer.h"
#include "clientbacklogmanager.h"
#include "coreinfodlg.h"
#include "coreconnectdlg.h"
setDisconnectedState(); // Disable menus and stuff
show();
- showCoreConnectionDlg(true); // autoconnect if appropriate
+ if(Quassel::runMode() != Quassel::Monolithic) {
+ showCoreConnectionDlg(true); // autoconnect if appropriate
+ } else {
+ startInternalCore();
+ }
}
MainWin::~MainWin() {
updateIcon();
}
+void MainWin::startInternalCore() {
+ ClientSyncer *syncer = new ClientSyncer();
+ Client::registerClientSyncer(syncer);
+ connect(syncer, SIGNAL(syncFinished()), syncer, SLOT(deleteLater()), Qt::QueuedConnection);
+ syncer->useInternalCore();
+}
+
void MainWin::showCoreConnectionDlg(bool autoConnect) {
CoreConnectDlg(autoConnect, this).exec();
}
void messagesInserted(const QModelIndex &parent, int start, int end);
void showAboutDlg();
void showChannelList(NetworkId netId = NetworkId());
+ void startInternalCore();
void showCoreConnectionDlg(bool autoConnect = false);
void showCoreInfoDlg();
void showSettingsDlg();
}
void MonolithicApplication::newClientSyncer(ClientSyncer *syncer) {
- connect(syncer, SIGNAL(startInternalCore()), this, SLOT(startInternalCore()));
+ connect(syncer, SIGNAL(startInternalCore(ClientSyncer *)), this, SLOT(startInternalCore(ClientSyncer *)));
}
-void MonolithicApplication::startInternalCore() {
+void MonolithicApplication::startInternalCore(ClientSyncer *syncer) {
if(!_internalInitDone) {
_internal->init();
_internalInitDone = true;
}
Core *core = Core::instance();
- ClientSyncer *syncer = static_cast<ClientSyncer *>(sender());
connect(syncer, SIGNAL(connectToInternalCore(SignalProxy *)), core, SLOT(setupInternalClientSession(SignalProxy *)));
connect(core, SIGNAL(sessionState(const QVariant &)), syncer, SLOT(internalSessionStateReceived(const QVariant &)));
}
private slots:
void newClientSyncer(ClientSyncer *syncer);
- void startInternalCore();
+ void startInternalCore(ClientSyncer *syncer);
private:
CoreApplicationInternal *_internal;