Bug 140197

Summary: 'del' doesn't work in the main playlist after right-clicking in files browser
Product: [Applications] amarok Reporter: richlv
Component: generalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Slackware   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description richlv 2007-01-17 17:18:16 UTC
Version:           svn 623546 (using KDE KDE 3.5.4)
Installed from:    Slackware Packages
OS:                Linux

have some track in the playlist, go to 'files' browser.
right click on any file, dismiss the menu.

attempt to delete any track in the main playlist with keyboard key 'delete/del' - it does not work anymore.

restarting amarok or switching to another browser makes 'del' work again (but switching to files browser in the same session makes it unusable again)
Comment 1 Ian Monroe 2007-01-22 06:27:52 UTC
SVN commit 626089 by ianmonroe:

Fixed regression: the DEL key no longer worked in the
playlist after opening the File Browser context menu. 

BUG: 140197


 M  +2 -0      ChangeLog  
 M  +15 -10    src/mydiroperator.cpp  
 M  +2 -0      src/mydiroperator.h  


--- trunk/extragear/multimedia/amarok/ChangeLog #626088:626089
@@ -98,6 +98,8 @@
     * Amarok now saves playlists with relative paths by default.
 
   BUGFIXES:
+    * Fixed regression: the DEL key no longer worked in the 
+      playlist after opening the File Browser context menu. (BR 140197)
     * Smart playlists now work correctly with "is not" filters containing
       numbers. Patch by Felix Rotthowe <felix.rotthowe@cs.uni-dortmund.de>. 
     * Context browser would not display updated covers correctly. (BR 130518)
--- trunk/extragear/multimedia/amarok/src/mydiroperator.cpp #626088:626089
@@ -9,16 +9,7 @@
 {
     m_medium = medium;
     setDirLister( new MyDirLister( true ) );
-    //the delete key event was being eaten with the file browser open
-    //so folks couldn't use the del key to remove items from the playlist
-    //refer to KDirOperator::setupActions() to understand this code
-    KActionCollection* dirActionCollection = static_cast<KActionCollection*>(KDirOperator::child("KDirOperator::myActionCollection"));
-    if(dirActionCollection)
-    {
-        KAction* trash = dirActionCollection->action("trash");
-        if(trash)
-            trash->setEnabled(false);
-    }
+    reenableDeleteKey();
 }
 
 void
@@ -39,4 +30,18 @@
     setURL(tmp, true);
 }
 
+
+//BEGIN private methods
+void
+MyDirOperator::reenableDeleteKey()
+{
+    KActionCollection* dirActionCollection = static_cast<KActionCollection*>(KDirOperator::child("KDirOperator::myActionCollection"));
+    if( dirActionCollection )
+    {
+        KAction* trash = dirActionCollection->action("trash");
+        if(trash)
+            trash->setEnabled(false);
+    }
+}
+//END private methods
 #include "mydiroperator.moc"
--- trunk/extragear/multimedia/amarok/src/mydiroperator.h #626088:626089
@@ -20,12 +20,14 @@
         //reimplemented due to a bug in KDirOperator::activatedMenu ( KDE 3.4.2 ) - See Bug #103305
         virtual void activatedMenu (const KFileItem *, const QPoint &pos) {
             updateSelectionDependentActions();
+            reenableDeleteKey();
             static_cast<KActionMenu*>(actionCollection()->action("popupMenu"))->popupMenu()->popup( pos );
         }
         void myHome();
         void myCdUp();
 
     private:
+        void reenableDeleteKey();
     Medium *m_medium;
 
 };