X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=92be56ef4e340b6a0d8d73ed5e78905596519faf;hp=52a2d13f831066f4475d4416e7aed65bbb664279;hb=236dda81632fa792e788d45b0f4f31b973823f7f;hpb=3c2914faeb01f3bc32e29f40179ae88040fbcf59 diff --git a/src/client/client.cpp b/src/client/client.cpp index 52a2d13f..92be56ef 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -25,6 +25,7 @@ #include "buffermodel.h" #include "buffersettings.h" #include "buffersyncer.h" +#include "bufferviewconfig.h" #include "bufferviewmanager.h" #include "clientbacklogmanager.h" #include "clientirclisthelper.h" @@ -81,6 +82,7 @@ Client::Client(QObject *parent) _messageProcessor(0), _connectedToCore(false), _syncedToCore(false), + _internalCore(false), _debugLog(&_debugLogBuffer) { _signalProxy->synchronize(_ircListHelper); @@ -115,7 +117,7 @@ void Client::init() { p->attachSlot(SIGNAL(identityCreated(const Identity &)), this, SLOT(coreIdentityCreated(const Identity &))); p->attachSlot(SIGNAL(identityRemoved(IdentityId)), this, SLOT(coreIdentityRemoved(IdentityId))); - p->attachSignal(this, SIGNAL(requestCreateNetwork(const NetworkInfo &)), SIGNAL(createNetwork(const NetworkInfo &))); + p->attachSignal(this, SIGNAL(requestCreateNetwork(const NetworkInfo &, const QStringList &)), SIGNAL(createNetwork(const NetworkInfo &, const QStringList &))); p->attachSignal(this, SIGNAL(requestRemoveNetwork(NetworkId)), SIGNAL(removeNetwork(NetworkId))); p->attachSlot(SIGNAL(networkCreated(NetworkId)), this, SLOT(coreNetworkCreated(NetworkId))); p->attachSlot(SIGNAL(networkRemoved(NetworkId)), this, SLOT(coreNetworkRemoved(NetworkId))); @@ -165,8 +167,8 @@ const Network * Client::network(NetworkId networkid) { else return 0; } -void Client::createNetwork(const NetworkInfo &info) { - emit instance()->requestCreateNetwork(info); +void Client::createNetwork(const NetworkInfo &info, const QStringList &persistentChannels) { + emit instance()->requestCreateNetwork(info, persistentChannels); } void Client::removeNetwork(NetworkId id) { @@ -275,6 +277,7 @@ void Client::setConnectedToCore(AccountId id, QIODevice *socket) { socket->setParent(0); signalProxy()->addPeer(socket); } + _internalCore = !socket; _connectedToCore = true; setCurrentCoreAccount(id); } @@ -296,6 +299,10 @@ void Client::setSyncedToCore() { Q_ASSERT(!_bufferViewManager); _bufferViewManager = new BufferViewManager(signalProxy(), this); connect(bufferViewManager(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog())); + connect(bufferViewManager(), SIGNAL(initDone()), this, SLOT(createDefaultBufferView())); + + createDefaultIdentity(); + createDefaultNetworks(); _syncedToCore = true; emit connected(); @@ -307,8 +314,35 @@ void Client::requestInitialBacklog() { Client::backlogManager()->requestInitialBacklog(); } -void Client::setSecuredConnection() { - emit securedConnection(); +void Client::createDefaultBufferView() { + if(bufferViewManager()->bufferViewConfigs().isEmpty()) { + BufferViewConfig config(-1); + config.setBufferViewName(tr("All Buffers")); + config.initSetBufferList(networkModel()->allBufferIdsSorted()); + bufferViewManager()->requestCreateBufferView(config.toVariantMap()); + } +} + +void Client::createDefaultIdentity() { + if(_identities.isEmpty()) { + Identity identity; + identity.setToDefaults(); + identity.setIdentityName(tr("Default Identity")); + createIdentity(identity); + } +} + +void Client::createDefaultNetworks() { + if(_networks.isEmpty()) { + QStringList defaultNets = Network::presetNetworks(true); + foreach(QString net, defaultNets) { + NetworkInfo info = Network::networkInfoFromPreset(net); + if(info.networkName.isEmpty()) + continue; + QStringList defaultChans = Network::presetDefaultChannels(net); + createNetwork(info, defaultChans); + } + } } void Client::disconnectFromCore() {