[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/kopete/0.12/kopete/libkopete
From: Matt Rogers <mattr () kde ! org>
Date: 2006-06-17 17:29:24
Message-ID: 1150565364.434463.7931.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 552390 by mattr:
Fix bug 94057. Contacts and groups for the account are now deleted from the
contact list when the account is removed.
BUG: 94057
M +33 -9 kopeteaccountmanager.cpp
--- branches/kopete/0.12/kopete/libkopete/kopeteaccountmanager.cpp #552389:552390
@@ -31,9 +31,12 @@
#include "kopeteaway.h"
#include "kopeteprotocol.h"
#include "kopetecontact.h"
+#include "kopetecontactlist.h"
#include "kopetepluginmanager.h"
#include "kopeteonlinestatus.h"
#include "kopeteonlinestatusmanager.h"
+#include "kopetemetacontact.h"
+#include "kopetegroup.h"
namespace Kopete {
@@ -48,7 +51,7 @@
{
uint priority1 = static_cast<Account*>(a)->priority();
uint priority2 = static_cast<Account*>(b)->priority();
-
+
if( a==b ) //two account are equal only if they are equal :-)
return 0; // remember than an account can be only once on the list, but two \
account may have the same priority when loading else if( priority1 > priority2 )
@@ -114,7 +117,7 @@
if ( it.current()->isConnected() )
it.current()->setAway( false, awayReason );
}
- else
+ else
if(!it.current()->excludeConnect())
it.current()->connect();
}
@@ -153,7 +156,7 @@
{
OnlineStatusManager::Categories katgor=(OnlineStatusManager::Categories)category;
bool anyConnected = isAnyAccountConnected();
-
+
for ( QPtrListIterator<Account> it( d->accounts ); it.current(); ++it )
{
Account *account = it.current();
@@ -219,7 +222,7 @@
{
if( !account || d->accounts.contains( account ) )
return account;
-
+
if( account->accountId().isEmpty() )
{
account->deleteLater();
@@ -236,9 +239,9 @@
}
}
- d->accounts.append( account );
+ d->accounts.append( account );
d->accounts.sort();
-
+
// Connect to the account's status changed signal
connect(account->myself(), SIGNAL(onlineStatusChanged(Kopete::Contact *,
const Kopete::OnlineStatus &, const Kopete::OnlineStatus &)),
@@ -295,6 +298,27 @@
KConfigGroup *configgroup = account->configGroup();
+ // Clean up the contact list
+ QDictIterator<Kopete::Contact> it( account->contacts() );
+ for ( ; it.current(); ++it )
+ {
+ Contact* c = it.current();
+ MetaContact* mc = c->metaContact();
+ if ( mc == ContactList::self()->myself() )
+ continue;
+ mc->removeContact( c );
+ c->deleteLater();
+ if ( mc->contacts().count() == 0 ) //we can delete the metacontact
+ {
+ //get the first group and it's members
+ Group* group = mc->groups().first();
+ QPtrList<MetaContact> groupMembers = group->members();
+ ContactList::self()->removeMetaContact( mc );
+ if ( groupMembers.count() == 1 && groupMembers.findRef( mc ) != -1 )
+ ContactList::self()->removeGroup( group );
+ }
+ }
+
// Clean up the account list
d->accounts.remove( account );
@@ -319,11 +343,11 @@
{
//kdDebug( 14010 ) << k_funcinfo << endl;
d->accounts.sort();
-
+
for ( QPtrListIterator<Account> it( d->accounts ); it.current(); ++it )
{
KConfigBase *config = it.current()->configGroup();
-
+
config->writeEntry( "Protocol", it.current()->protocol()->pluginId() );
config->writeEntry( "AccountId", it.current()->accountId() );
}
@@ -386,7 +410,7 @@
kdDebug( 14010 ) << k_funcinfo <<
"Creating account for '" << accountId << "'" << endl;
-
+
Account *account = 0L;
account = registerAccount( protocol->createNewAccount( accountId ) );
if ( !account )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic