forked from blue/squawk
first attempt to remove accounts
This commit is contained in:
parent
8432a574b9
commit
234697050b
14 changed files with 190 additions and 14 deletions
|
@ -36,6 +36,9 @@ void Squawk::onAccounts()
|
|||
connect(accounts, SIGNAL(destroyed(QObject*)), this, SLOT(onAccountsClosed(QObject*)));
|
||||
connect(accounts, SIGNAL(newAccount(const QMap<QString, QVariant>&)), this, SIGNAL(newAccountRequest(const QMap<QString, QVariant>&)));
|
||||
connect(accounts, SIGNAL(changeAccount(const QString&, const QMap<QString, QVariant>&)), this, SIGNAL(modifyAccountRequest(const QString&, const QMap<QString, QVariant>&)));
|
||||
connect(accounts, SIGNAL(connectAccount(const QString&)), this, SIGNAL(connectAccount(const QString&)));
|
||||
connect(accounts, SIGNAL(disconnectAccount(const QString&)), this, SIGNAL(disconnectAccount(const QString&)));
|
||||
connect(accounts, SIGNAL(removeAccount(const QString&)), this, SIGNAL(removeAccountRequest(const QString&)));
|
||||
|
||||
accounts->show();
|
||||
} else {
|
||||
|
@ -249,3 +252,23 @@ void Squawk::responseArchive(const QString& account, const QString& jid, const s
|
|||
itr->second->responseArchive(list);
|
||||
}
|
||||
}
|
||||
|
||||
void Squawk::removeAccount(const QString& account)
|
||||
{
|
||||
Conversations::const_iterator itr = conversations.begin();
|
||||
while (itr != conversations.end()) {
|
||||
if (itr->first.account == account) {
|
||||
Conversations::const_iterator lItr = itr;
|
||||
++itr;
|
||||
Conversation* conv = lItr->second;
|
||||
disconnect(conv, SIGNAL(destroyed(QObject*)), this, SLOT(onConversationClosed(QObject*)));
|
||||
disconnect(conv, SIGNAL(sendMessage(const Shared::Message&)), this, SLOT(onConversationMessage(const Shared::Message&)));
|
||||
disconnect(conv, SIGNAL(requestArchive(const QString&)), this, SLOT(onConversationRequestArchive(const QString&)));
|
||||
conv->close();
|
||||
conversations.erase(lItr);
|
||||
} else {
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
rosterModel.removeAccount(account);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue