Bug 86783 - Contact list doesn't get resorted after renaming a contact
Summary: Contact list doesn't get resorted after renaming a contact
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: Contact list (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-08 12:32 UTC by Till Gerken
Modified: 2004-08-17 02:20 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Till Gerken 2004-08-08 12:32:58 UTC
Version:           0.8.922 (CVS >= 20040717) (using KDE 3.2.92 (3.3 beta2), compiled sources)
Compiler:          gcc version 3.3.4 (Debian 1:3.3.4-3)
OS:                Linux (i686) release 2.6.5

If you rename a contact, it stays at the same position in the contact list even though it should move to another when the contact list is alphabetically sorted.

It's handy from a usability point of view (the contact doesn't suddenly pop up at a different spot), Konqueror for example doesn't resort the list of files as well after having renamed an entry.

Still, it might have to be changed.
Comment 1 Richard Smith 2004-08-08 16:52:49 UTC
CVS commit by lilachaze: 

Fixed a bug where renaming a metacontact would not resort the contact list.
Rearranged code to ensure names in the contact list and in the contact list
view stay in sync.

Matt: can you please backport this too?

CCMAIL: 86783@bugs.kde.org
CCMAIL: matt@matt.rogers.name


  M +2 -5      kopetegroupviewitem.cpp   1.30
  M +7 -6      kopetemetacontactlvi.cpp   1.90


--- kdenetwork/kopete/kopete/contactlist/kopetegroupviewitem.cpp  #1.29:1.30
@@ -167,5 +167,5 @@ void KopeteGroupViewItem::refreshDisplay
         // the sorting itself is rather slow. Therefore we call delayedSort, which tries
         // to group multiple sort requests into one.
-        if ( KopeteContactListView *lv = dynamic_cast<KopeteContactListView *>( listView() ) )
+        if ( ListView::ListView *lv = dynamic_cast<ListView::ListView *>( listView() ) )
                 lv->delayedSort();
         else
@@ -192,8 +192,5 @@ void KopeteGroupViewItem::okRename( int 
         //kdDebug(14000) << k_funcinfo << endl;
         KListViewItem::okRename(col);
-        if ( col == 0 )
-                group()->setDisplayName(text(0));
         setRenameEnabled( 0, false );
-        refreshDisplayName();
 }
 
@@ -267,5 +264,5 @@ void KopeteGroupViewItem::setText( int c
 {
         if ( column == 0 )
-                d->name->setText( text );
+                group()->setDisplayName( text );
         else
                 KListViewItem::setText( column, text );

--- kdenetwork/kopete/kopete/contactlist/kopetemetacontactlvi.cpp  #1.89:1.90
@@ -435,4 +435,10 @@ void KopeteMetaContactLVI::slotDisplayNa
 {
         d->nameText->setText( m_metaContact->displayName() );
+
+        // delay the sort if we can
+        if ( ListView::ListView *lv = dynamic_cast<ListView::ListView *>( listView() ) )
+                lv->delayedSort();
+        else
+                listView()->sort();
 }
 
@@ -469,5 +475,4 @@ void KopeteMetaContactLVI::okRename( int
 {
         KListViewItem::okRename( col );
-        rename( text( 0 ) );
         setRenameEnabled( 0, false );
 }
@@ -894,5 +899,5 @@ void KopeteMetaContactLVI::setText( int 
 {
         if ( column == 0 )
-                d->nameText->setText( text );
+                rename( text );
         else
                 KListViewItem::setText( column, text );


Comment 2 Matt Rogers 2004-08-17 02:20:37 UTC
CVS commit by mattr: 

Backport the fix for 86783. Should be in KDE 3.3.1

CCMAIL: 86783-done@bugs.kde.org


  M +2 -5      kopetegroupviewitem.cpp   1.29.2.1
  M +7 -6      kopetemetacontactlvi.cpp   1.89.2.1


--- kdenetwork/kopete/kopete/contactlist/kopetegroupviewitem.cpp  #1.29:1.29.2.1
@@ -167,5 +167,5 @@ void KopeteGroupViewItem::refreshDisplay
         // the sorting itself is rather slow. Therefore we call delayedSort, which tries
         // to group multiple sort requests into one.
-        if ( KopeteContactListView *lv = dynamic_cast<KopeteContactListView *>( listView() ) )
+        if ( ListView::ListView *lv = dynamic_cast<ListView::ListView *>( listView() ) )
                 lv->delayedSort();
         else
@@ -192,8 +192,5 @@ void KopeteGroupViewItem::okRename( int 
         //kdDebug(14000) << k_funcinfo << endl;
         KListViewItem::okRename(col);
-        if ( col == 0 )
-                group()->setDisplayName(text(0));
         setRenameEnabled( 0, false );
-        refreshDisplayName();
 }
 
@@ -267,5 +264,5 @@ void KopeteGroupViewItem::setText( int c
 {
         if ( column == 0 )
-                d->name->setText( text );
+                group()->setDisplayName( text );
         else
                 KListViewItem::setText( column, text );

--- kdenetwork/kopete/kopete/contactlist/kopetemetacontactlvi.cpp  #1.89:1.89.2.1
@@ -435,4 +435,10 @@ void KopeteMetaContactLVI::slotDisplayNa
 {
         d->nameText->setText( m_metaContact->displayName() );
+
+        // delay the sort if we can
+        if ( ListView::ListView *lv = dynamic_cast<ListView::ListView *>( listView() ) )
+                lv->delayedSort();
+        else
+                listView()->sort();
 }
 
@@ -469,5 +475,4 @@ void KopeteMetaContactLVI::okRename( int
 {
         KListViewItem::okRename( col );
-        rename( text( 0 ) );
         setRenameEnabled( 0, false );
 }
@@ -894,5 +899,5 @@ void KopeteMetaContactLVI::setText( int 
 {
         if ( column == 0 )
-                d->nameText->setText( text );
+                rename( text );
         else
                 KListViewItem::setText( column, text );