I still have that pending patch for few weeks now. - It remove the (useless) warning before deleting the old empty metacontact when you move contact to another metacontacts. - It merge automatically contact with the same custom display name (if set) into the same metacontact
As this is a behaviour change, i'm asking the list if there are objections before commiting. Le jeudi 3 avril 2008, Olivier Goffart a écrit : > Hi. > > There is currently a discussion on the xmpp standard mailinglist about > metacontact. > > Someone came with a complex specification to store metacontact link > serverside. > > And another guy came with a very simple idea : two contact that are in the > same group and have the same name are in the same metacontact. > The name here is the name attribute of the jabber roster, which in kopete > terms is the custom display name >+ > Personally, I like that idea. > > That mean we could not have anymore two metacontact with the same name in > the same group without them to be merged. > Does anyone has an objection to this? > > I doubd that many people have the case of several meta contact with the > same display name on the same group. (In fact i have, for all my 4 contacts > with 3 subcontact each, representing myself in another account, but i > would change their name ;-p) > > > (In case you wonder, by default, there is no custom displayname. the > nickname is displayed instead but would not be taken in account for > metacontact merging. That mean that two guys with the name nick would not > be in the same metacontact)
Index: libkopete/kopetemetacontact.cpp
===================================================================
--- libkopete/kopetemetacontact.cpp (revision 793573)
+++ libkopete/kopetemetacontact.cpp (working copy)
@@ -572,6 +572,24 @@
}
else
{
+ //check if there is another contact with the same display name.
+ //if this is the case, merge them
+ if(!name.isEmpty())
+ foreach(MetaContact *m, ContactList::self()->metaContacts())
+ {
+ if( m != this && m->customDisplayName() == name)
+ {
+ //merge
+ while(!m->d->contacts.isEmpty())
+ {
+ m->d->contacts.first()->setMetaContact(this);
+ }
+ //the contact will be automatically removed when the last contact is removed
+ //that's why we merge othe other into this one and not the opposite;
+ break;
+ }
+ }
+
const QString old = d->displayName;
d->displayName = name;
@@ -1118,6 +1136,9 @@
{
return d->contacts;
}
+
+
+
} //END namespace Kopete
#include "kopetemetacontact.moc"
Index: libkopete/kopetecontact.cpp
===================================================================
--- libkopete/kopetecontact.cpp (revision 793573)
+++ libkopete/kopetecontact.cpp (working copy)
@@ -337,24 +337,11 @@
if( old )
{
- int result=KMessageBox::No;
- if( old->isTemporary() )
- result=KMessageBox::Yes;
- else if( old->contacts().count()==1 )
- { //only one contact, including this one, that mean the contact will be empty efter the move
- result = KMessageBox::questionYesNoCancel( Kopete::UI::Global::mainWidget(), i18n( "You are moving the contact `%1' to the meta contact `%2'.\n"
- "`%3' will be empty afterwards. Do you want to delete this contact?",
- contactId(), m ? m->displayName() : QString(), old->displayName())
- , i18n( "Move Contact" ), KStandardGuiItem::del(), KGuiItem( i18n( "&Keep" ) )
- , KStandardGuiItem::cancel(), QString::fromLatin1("delete_old_contact_when_move") );
- if(result==KMessageBox::Cancel)
- return;
- }
old->removeContact( this );
disconnect( old, SIGNAL( aboutToSave( Kopete::MetaContact * ) ),
protocol(), SLOT( slotMetaContactAboutToSave( Kopete::MetaContact * ) ) );
- if(result==KMessageBox::Yes)
+ if(old->contacts().isEmpty())
{
//remove the old metacontact. (this delete the MC)
ContactList::self()->removeMetaContact(old);
Index: libkopete/kopetecontact.h
===================================================================
--- libkopete/kopetecontact.h (revision 793573)
+++ libkopete/kopetecontact.h (working copy)
@@ -143,13 +143,12 @@
* \brief Move this contact to a new MetaContact.
* This basically reparents the contact and updates the internal
* data structures.
- * If the old contact is going to be empty, a question may ask to the user if it wants to delete the old contact.
+ * If the old contact is going to be empty, the old contact will be removed.
*
* @param m The new MetaContact to move this contact to
*/
void setMetaContact(MetaContact *m);
-
/**
* @brief Get whether this contact is online.
* @return @c true if the contact is online, @c false otherwise.
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ kopete-devel mailing list [email protected] https://mail.kde.org/mailman/listinfo/kopete-devel
