Bug 96669 - cannot rename folders via kontact plugin
Summary: cannot rename folders via kontact plugin
Status: RESOLVED FIXED
Alias: None
Product: akregator
Classification: Applications
Component: kontact plugin (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-09 22:20 UTC by _
Modified: 2005-06-28 08:32 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 _ 2005-01-09 22:20:31 UTC
Version:            (using KDE KDE 3.3.2)
Installed from:    Compiled From Sources
Compiler:          gcc 3.4.3 
OS:                Linux

Currently it is impossible to rename folders via the kontact plugin as changes are not saved - restarting Kontact and adding a feed will undo the changes made.
Comment 1 Frank Osterfeld 2005-01-13 17:08:00 UTC
Weird, most of the time it works here, but not always. The function which saves the list is called in all cases though.
Comment 2 Frank Osterfeld 2005-02-20 19:18:47 UTC
CVS commit by osterfeld: 

don't break in-place renaming
BUG: 96669


  M +12 -4     feedstree.cpp   1.44
  M +1 -1      feedstree.h   1.22


--- kdepim/akregator/src/feedstree.h  #1.21:1.22
@@ -148,5 +148,5 @@ namespace Akregator
             virtual void slotSelectionChanged(QListViewItem* item);
             virtual void slotContextMenu(KListView* list, QListViewItem* item, const QPoint& p);
-            virtual void slotItemRenamed(QListViewItem* item);
+            virtual void slotItemRenamed(QListViewItem* item, const QString&, int);
             virtual void slotFeedFetchStarted(Feed* feed);
             virtual void slotFeedFetchAborted(Feed* feed);

--- kdepim/akregator/src/feedstree.cpp  #1.43:1.44
@@ -51,5 +51,5 @@ FeedsTree::FeedsTree( QWidget *parent, c
     connect( this, SIGNAL(dropped(QDropEvent*,QListViewItem*)), this, SLOT(slotDropped(QDropEvent*,QListViewItem*)) );
     connect( this, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotSelectionChanged(QListViewItem*)) );
-    connect( this, SIGNAL(itemRenamed(QListViewItem*)), this, SLOT(slotItemRenamed(QListViewItem*)) );
+    connect( this, SIGNAL(itemRenamed(QListViewItem*, const QString&, int)), this, SLOT(slotItemRenamed(QListViewItem*, const QString&, int)) );
     connect( this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)), this, SLOT(slotContextMenu(KListView*, QListViewItem*, const QPoint&)) );
     
@@ -245,4 +245,8 @@ void FeedsTree::movableDropEvent(QListVi
 void FeedsTree::keyPressEvent(QKeyEvent* e)
 {
+    // handle return in in-place renaming, otherwise ignore events
+    if (isRenaming() && e->key() == Qt::Key_Enter)
+        KListView::keyPressEvent(e);
+    else
     e->ignore();    
 }
@@ -509,9 +513,13 @@ void FeedsTree::slotSelectionChanged(QLi
 }
 
-void FeedsTree::slotItemRenamed(QListViewItem* item)
+void FeedsTree::slotItemRenamed(QListViewItem* item, const QString& text, int)
 {
+    kdDebug() << "FeedsTree::slotItemRenamed(): enter" << endl;
     TreeNodeItem* ni = static_cast<TreeNodeItem*> (item);
     if ( ni && ni->node() )
-        ni->node()->setTitle( item->text(0) );
+    {
+        kdDebug() << "renamed item to \"" << text << "\"" << endl;
+        ni->node()->setTitle(text);
+    }
 }
 


Comment 3 Frank Osterfeld 2005-06-28 08:32:45 UTC
SVN commit 429576 by osterfeld:

fix in-place renaming by connecting to both QListView::itemRenamed(QLI*, col, QString) and KListView::itemRenamed(QLI*, QString, col) 
signals

The QListView version works for folders and feeds, the KListView version works for Tag nodes. super strange
BUG: 102099
CCBUG: 96669, 93480


 M  +14 -27    feedlistview.cpp  
 M  +2 -1      feedlistview.h  


--- trunk/KDE/kdepim/akregator/src/feedlistview.cpp #429575:429576
@@ -267,6 +267,7 @@
     
     connect( this, SIGNAL(dropped(QDropEvent*,QListViewItem*)), this, SLOT(slotDropped(QDropEvent*,QListViewItem*)) );
     connect( this, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotSelectionChanged(QListViewItem*)) );
+    connect( this, SIGNAL(itemRenamed(QListViewItem*, int, const QString&)), this, SLOT(slotItemRenamed(QListViewItem*, int, const QString&)) );
     connect( this, SIGNAL(itemRenamed(QListViewItem*, const QString&, int)), this, SLOT(slotItemRenamed(QListViewItem*, const QString&, int)) );
     connect( this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)), this, SLOT(slotContextMenu(KListView*, QListViewItem*, const QPoint&)) );
     connect( &(d->autoopentimer), SIGNAL( timeout() ), this, SLOT( openFolder() ) );
@@ -558,28 +559,6 @@
     KListView::contentsDragMoveEvent(event);
 }
 
-/*
-void FeedListView::keyPressEvent(QKeyEvent* e)
-{
-    switch(e->key())
-    {
-        case Key_Alt+Key_Up:
-        case Key_Alt+Key_Down:
-        case Key_Alt+Key_Left:    
-        case Key_Alt+Key_Right:
-            KListView::keyPressEvent(e);    
-            break;
-        case Key_Left:
-        case Key_Right:
-        case Key_Up:
-        case Key_Down:
-            e->ignore();
-            break;
-        default:
-            KListView::keyPressEvent(e);    
-     }
-}*/
-
 bool FeedListView::acceptDrag(QDropEvent *e) const
 {
     if (!acceptDrops() || !itemsMovable())
@@ -815,16 +794,24 @@
         emit signalNodeSelected(ni->node());
 }
 
-void FeedListView::slotItemRenamed(QListViewItem* item, const QString& text, int)
+void FeedListView::slotItemRenamed(QListViewItem* item, int col, const QString& text)
 {
-    kdDebug() << "FeedListView::slotItemRenamed(): enter" << endl;
     TreeNodeItem* ni = dynamic_cast<TreeNodeItem*> (item);
-    if ( ni && ni->node() )
+    if ( !ni || !ni->node() )
+        return;
+    if (col == 0)
     {
-        kdDebug() << "renamed item to \"" << text << "\"" << endl;
-        ni->node()->setTitle(text);
+        if (text != ni->node()->title())
+        {
+            kdDebug() << "renamed item to \"" << text << "\"" << endl;
+            ni->node()->setTitle(text);
+        }
     }
 }
+void FeedListView::slotItemRenamed(QListViewItem* item, const QString& text, int col)
+{
+    slotItemRenamed(item, col, text);
+}
 
 void FeedListView::slotContextMenu(KListView* list, QListViewItem* item, const QPoint& p)
 {
--- trunk/KDE/kdepim/akregator/src/feedlistview.h #429575:429576
@@ -164,7 +164,8 @@
             
             virtual void slotSelectionChanged(QListViewItem* item);
             virtual void slotContextMenu(KListView* list, QListViewItem* item, const QPoint& p);
-            virtual void slotItemRenamed(QListViewItem* item, const QString&, int);
+            virtual void slotItemRenamed(QListViewItem* item, int col, const QString& text);
+            virtual void slotItemRenamed(QListViewItem* item, const QString& text, int col);
             virtual void slotFeedFetchStarted(Feed* feed);
             virtual void slotFeedFetchAborted(Feed* feed);
             virtual void slotFeedFetchError(Feed* feed);