bool MonolithicApplication::init() { if (!Quassel::init()) // parse args return false; connect(Client::coreConnection(), SIGNAL(startInternalCore()), SLOT(startInternalCore())); // FIXME what's this for? if (isOptionSet("port")) { startInternalCore(); } return QtUiApplication::init(); }
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(this); emit connectToInternalCore(Client::instance()->signalProxy()); }
void CoreConnection::connectToCurrentAccount() { if (_authHandler) { qWarning() << Q_FUNC_INFO << "Already connected!"; return; } resetConnection(false); if (currentAccount().isInternal()) { if (Quassel::runMode() != Quassel::Monolithic) { qWarning() << "Cannot connect to internal core in client-only mode!"; return; } emit startInternalCore(); InternalPeer *peer = new InternalPeer(); _peer = peer; Client::instance()->signalProxy()->addPeer(peer); // sigproxy will take ownership emit connectToInternalCore(peer); setState(Connected); return; } _authHandler = new ClientAuthHandler(currentAccount(), this); connect(_authHandler, SIGNAL(disconnected()), SLOT(coreSocketDisconnected())); connect(_authHandler, SIGNAL(connectionReady()), SLOT(onConnectionReady())); connect(_authHandler, SIGNAL(socketError(QAbstractSocket::SocketError,QString)), SLOT(coreSocketError(QAbstractSocket::SocketError,QString))); connect(_authHandler, SIGNAL(transferProgress(int,int)), SLOT(updateProgress(int,int))); connect(_authHandler, SIGNAL(requestDisconnect(QString,bool)), SLOT(disconnectFromCore(QString,bool))); connect(_authHandler, SIGNAL(errorMessage(QString)), SIGNAL(connectionError(QString))); connect(_authHandler, SIGNAL(errorPopup(QString)), SIGNAL(connectionErrorPopup(QString)), Qt::QueuedConnection); connect(_authHandler, SIGNAL(statusMessage(QString)), SIGNAL(connectionMsg(QString))); connect(_authHandler, SIGNAL(encrypted(bool)), SIGNAL(encrypted(bool))); connect(_authHandler, SIGNAL(startCoreSetup(QVariantList)), SIGNAL(startCoreSetup(QVariantList))); connect(_authHandler, SIGNAL(coreSetupFailed(QString)), SIGNAL(coreSetupFailed(QString))); connect(_authHandler, SIGNAL(coreSetupSuccessful()), SIGNAL(coreSetupSuccess())); connect(_authHandler, SIGNAL(userAuthenticationRequired(CoreAccount*,bool*,QString)), SIGNAL(userAuthenticationRequired(CoreAccount*,bool*,QString))); connect(_authHandler, SIGNAL(handleNoSslInClient(bool*)), SIGNAL(handleNoSslInClient(bool*))); connect(_authHandler, SIGNAL(handleNoSslInCore(bool*)), SIGNAL(handleNoSslInCore(bool*))); #ifdef HAVE_SSL connect(_authHandler, SIGNAL(handleSslErrors(const QSslSocket*,bool*,bool*)), SIGNAL(handleSslErrors(const QSslSocket*,bool*,bool*))); #endif connect(_authHandler, SIGNAL(loginSuccessful(CoreAccount)), SLOT(onLoginSuccessful(CoreAccount))); connect(_authHandler, SIGNAL(handshakeComplete(RemotePeer*,Protocol::SessionState)), SLOT(onHandshakeComplete(RemotePeer*,Protocol::SessionState))); setState(Connecting); _authHandler->connectToCore(); }
void MainWin::init() { connect(Client::instance(), SIGNAL(networkCreated(NetworkId)), SLOT(clientNetworkCreated(NetworkId))); connect(Client::instance(), SIGNAL(networkRemoved(NetworkId)), SLOT(clientNetworkRemoved(NetworkId))); connect(Client::messageModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), SLOT(messagesInserted(const QModelIndex &, int, int))); connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showChannelList(NetworkId)), SLOT(showChannelList(NetworkId))); // Setup Dock Areas setDockNestingEnabled(true); setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); // Order is sometimes important setupActions(); setupBufferWidget(); setupMenus(); setupTopicWidget(); setupChatMonitor(); setupNickWidget(); setupInputWidget(); setupStatusBar(); setupToolBars(); setupSystray(); setupTitleSetter(); setupHotList(); #ifndef HAVE_KDE QtUi::registerNotificationBackend(new TaskbarNotificationBackend(this)); QtUi::registerNotificationBackend(new SystrayNotificationBackend(this)); # ifdef HAVE_PHONON QtUi::registerNotificationBackend(new PhononNotificationBackend(this)); # endif # ifdef HAVE_DBUS QtUi::registerNotificationBackend(new DesktopNotificationBackend(this)); # endif #else /* HAVE_KDE */ QtUi::registerNotificationBackend(new KNotificationBackend(this)); #endif /* HAVE_KDE */ setDisconnectedState(); // Disable menus and stuff #ifdef HAVE_KDE setAutoSaveSettings(); #endif // restore mainwin state QtUiSettings s; restoreStateFromSettings(s); // restore locked state of docks QtUi::actionCollection("General")->action("LockLayout")->setChecked(s.value("LockLayout", false).toBool()); if(Quassel::runMode() != Quassel::Monolithic) { showCoreConnectionDlg(true); // autoconnect if appropriate } else { startInternalCore(); } }