Bug 71321 - Renaming a contact should work like renaming a group
Summary: Renaming a contact should work like renaming a group
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: Main Application (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-27 20:02 UTC by Casey Allen Shobe
Modified: 2004-02-12 18:45 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 Casey Allen Shobe 2003-12-27 20:02:43 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

Renaming a group brings up a nice window prompting for the new name.  Works well and I have no complaints.

Renaming a contact tries to rename it inline.  This is currently broken in CVS in the sense that Enter does not save the change but opens a single-shot chatwindow (opposite of setting) with weird colors.  Clicking on some other area of the window does cause the change to be saved.  Also, with a focus-follows mouse setting, it's nearly unusable.  Because generally one keeps the contact list at a narrow width, they must move the mouse outside of the window (or it is condusive to do so, if not a requirement) to select the Rename option from the RMB menu.  But when the option is clicked, the window immediately loses focus, and so the action is cancelled before you can make a change.

These two renaming functions need to be consistant.  I vote strongly for the former method.
Comment 1 Olivier Goffart 2003-12-27 21:32:40 UTC
Then i think both two should act like renaming a contact  
(but correctly of course)

Even, i think we shouldn't hack AT ALL this, to allow the user to rename contact like they rename a file in konqueror.
If i remember correctly, Duncan didn't like this way, that's why it is not the case anymore  (the fact that clicking on a item which already have the focus make the rename action start)   But i think KListView has been fixed since that.
Comment 2 Martijn Klingens 2003-12-28 14:04:03 UTC
Subject: Re: [Kopete-devel]  Renaming a contact should work like renaming a group

On Saturday 27 December 2003 21:32, Olivier Goffart wrote:
> Then i think both two should act like renaming a contact
> (but correctly of course)

Yes, me too.

Casey, when I fixed some bugs in the inline renaming I made the code mostly 
equivalent to what Konqueror does. Doesn't the same bug occur there too?

Comment 3 Casey Allen Shobe 2003-12-28 19:30:59 UTC
Olivier,

Konqueror works fine.
#1, I can press enter and the rename is saved.
#2, I can defocus and refocus the window, and Konqueror is still awaiting my renaming.

If Kopete works the same as Konqueror without the bugs, that's a fine solution.
Comment 4 Richard Smith 2004-02-12 14:31:27 UTC
The inline renaming works fine for me with recent KDE CVS and Kopete HEAD. Would anyone object to the group rename being switched to an inline rename?
Comment 5 Matt Rogers 2004-02-12 15:55:31 UTC
no, please switch it if you have time. :)
Comment 6 Richard Smith 2004-02-12 18:40:02 UTC
Working on it...
Comment 7 Richard Smith 2004-02-12 18:42:03 UTC
CVS commit by lilachaze: 

Rename groups inline. Need to undo a string change before I can backport...
CCMAIL: 71321@bugs.kde.org


  M +4 -20     kopetecontactlistview.cpp   1.72
  M +5 -3      kopetegroupviewitem.cpp   1.15


--- kdenetwork/kopete/kopete/contactlist/kopetecontactlistview.cpp  #1.71:1.72
@@ -1461,5 +1461,5 @@ void KopeteContactListView::updateAction
         else if(groups.count() == 1 && contacts.isEmpty())
         {
-                actionRename->setText(i18n("Rename Group..."));
+                actionRename->setText(i18n("Rename Group"));
                 actionRemove->setText(i18n("Remove Group"));
                 actionRename->setEnabled(true);
@@ -1669,30 +1669,14 @@ void KopeteContactListView::slotRemove()
 void KopeteContactListView::slotRename()
 {
-        KopeteMetaContactLVI *metaLVI = dynamic_cast<KopeteMetaContactLVI *>( currentItem() );
-        if ( metaLVI )
+        if ( KopeteMetaContactLVI *metaLVI = dynamic_cast<KopeteMetaContactLVI *>( currentItem() ) )
         {
                 metaLVI->slotRename();
         }
-        else if ( KopeteContactList::contactList()->selectedGroups().count() == 1 )
+        else if ( KopeteGroupViewItem *groupLVI = dynamic_cast<KopeteGroupViewItem *>( currentItem() ) )
         {
-                // Not a meta contact, so rename the group instead
-                // FIXME: Shouldn't this be moved to a method KopeteGroupLVI::rename()? - Martijn
                 if ( !KopetePrefs::prefs()->sortByGroup() )
                         return;
 
-                KopeteGroup *group = KopeteContactList::contactList()->selectedGroups().first();
-
-                bool ok;
-#if KDE_IS_VERSION( 3, 1, 90 )
-                QString newname = KInputDialog::getText
-#else
-                QString newname = KLineEditDlg::getText
-#endif
-                        ( i18n( "Rename Group" ), i18n( "Please enter the new name for group '%1':" ).arg( group->displayName() ),
-                        group->displayName(), &ok );
-
-                if ( !ok )
-                        return;
-                group->setDisplayName( newname );
+                groupLVI->startRename( 0 );
         }
 }

--- kdenetwork/kopete/kopete/contactlist/kopetegroupviewitem.cpp  #1.14:1.15
@@ -99,6 +99,6 @@ void KopeteGroupViewItem::refreshDisplay
         }
 
-        newText += " (" + QString::number( onlineMemberCount ) + "/" + QString::number( totalMemberCount ) + ")";
         m_renameText = newText;
+        newText += " (" + QString::number( onlineMemberCount ) + "/" + QString::number( totalMemberCount ) + ")";
         //kdDebug( 14000 ) << k_funcinfo << "newText='" << newText << "', old text= " << text( 0 ) << endl;
 
@@ -128,7 +128,9 @@ void KopeteGroupViewItem::startRename( i
 {
         kdDebug(14000) << k_funcinfo << endl;
+        if ( col != 0 ) return;
         refreshDisplayName();
         setText( 0, m_renameText );
-        QListViewItem::startRename(col);
+        setRenameEnabled( 0, true );
+        QListViewItem::startRename( 0 );
 }
 


Comment 8 Richard Smith 2004-02-12 18:45:44 UTC
CVS commit by lilachaze: 

Rename groups inline.
CCMAIL: 71321-done@bugs.kde.org


  M +3 -19     kopetecontactlistview.cpp   1.63.2.2
  M +5 -3      kopetegroupviewitem.cpp   1.13.2.1


--- kdenetwork/kopete/kopete/contactlist/kopetecontactlistview.cpp  #1.63.2.1:1.63.2.2
@@ -1623,30 +1623,14 @@ void KopeteContactListView::slotRemove()
 void KopeteContactListView::slotRename()
 {
-        KopeteMetaContactLVI *metaLVI = dynamic_cast<KopeteMetaContactLVI *>( currentItem() );
-        if ( metaLVI )
+        if ( KopeteMetaContactLVI *metaLVI = dynamic_cast<KopeteMetaContactLVI *>( currentItem() ) )
         {
                 metaLVI->slotRename();
         }
-        else if ( KopeteContactList::contactList()->selectedGroups().count() == 1 )
+        else if ( KopeteGroupViewItem *groupLVI = dynamic_cast<KopeteGroupViewItem *>( currentItem() ) )
         {
-                // Not a meta contact, so rename the group instead
-                // FIXME: Shouldn't this be moved to a method KopeteGroupLVI::rename()? - Martijn
                 if ( !KopetePrefs::prefs()->sortByGroup() )
                         return;
 
-                KopeteGroup *group = KopeteContactList::contactList()->selectedGroups().first();
-
-                bool ok;
-#if KDE_IS_VERSION( 3, 1, 90 )
-                QString newname = KInputDialog::getText
-#else
-                QString newname = KLineEditDlg::getText
-#endif
-                        ( i18n( "Rename Group" ), i18n( "Please enter the new name for group '%1':" ).arg( group->displayName() ),
-                        group->displayName(), &ok );
-
-                if ( !ok )
-                        return;
-                group->setDisplayName( newname );
+                groupLVI->startRename( 0 );
         }
 }

--- kdenetwork/kopete/kopete/contactlist/kopetegroupviewitem.cpp  #1.13:1.13.2.1
@@ -99,6 +99,6 @@ void KopeteGroupViewItem::refreshDisplay
         }
 
-        newText += " (" + QString::number( onlineMemberCount ) + "/" + QString::number( totalMemberCount ) + ")";
         m_renameText = newText;
+        newText += " (" + QString::number( onlineMemberCount ) + "/" + QString::number( totalMemberCount ) + ")";
         //kdDebug( 14000 ) << k_funcinfo << "newText='" << newText << "', old text= " << text( 0 ) << endl;
 
@@ -128,7 +128,9 @@ void KopeteGroupViewItem::startRename( i
 {
         kdDebug(14000) << k_funcinfo << endl;
+        if ( col != 0 ) return;
         refreshDisplayName();
         setText( 0, m_renameText );
-        QListViewItem::startRename(col);
+        setRenameEnabled( 0, true );
+        QListViewItem::startRename( 0 );
 }