Bug 50374 - delete command in context menu deletes wrong file
Summary: delete command in context menu deletes wrong file
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: VHI critical
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 49898 58922 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-11-07 22:46 UTC by Martin Derungs
Modified: 2003-06-04 18:26 UTC (History)
3 users (show)

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 Martin Derungs 2002-11-07 22:46:58 UTC
Version:           4.0 (KDE 3.0.4) SuSE (using KDE KDE 3.0.4)
Installed from:    SuSE RPMs
Compiler:          gcc 2.95.3 20010315 (SuSE) 
OS:          Linux

Starting point:Konqueror opened as file manager for locally stored files somewhere in the home path (no permissions conflicts). split main view into two views. activate the left view and change directories. right-click on a file, but don't choose any command (just hit 'Esc'). Then right-click on a file in the *right* view. the right view gets the focus (green light in status bar) and the file context menu appears. action:choose "delete" by left-clicking on the context menu command.result: this command deletes the file in the *other* (the left) view, which has been right-clicked before. expected result:the command deletes the file on which you have actually right-clicked.Additional comments:If the dialog "are you sure ..." appears, it asks about deleting the file that actually will be deleted (the wrong one). trying to reproduce this bug, behaviour changes to some weird variations of the bug: sometimes you are prompted *twice* by the "are you sure" dialog, once meaning the right file, once the wrong one. sometimes you are promted twice about the same (the right) file.(btw, I lost my translation work on kbabel because of this bug!!!)
Comment 1 Till Maas 2003-03-01 15:00:39 UTC
I found this bug in Konqueror 3.1.0, too 
Comment 2 John Firebaugh 2003-04-08 06:43:00 UTC
*** Bug 49898 has been marked as a duplicate of this bug. ***
Comment 3 David Faure 2003-05-11 22:47:57 UTC
Subject: kdebase/konqueror

CVS commit by faure: 

Fixed wrong code happening on RMB (on non-active view), which could even result
in the user deleting files from the wrong view! :(

Many many thanks to Georg Robbers for his report, precise investigation, and patch.
One critical bug down :)
(I only slightly modified the patch, to add a comment and a null-pointer-test).

CCMAIL: Georg.Robbers@urz.uni-hd.de, hausmann@kde.org, staikos@kde.org, 50374-done@bugs.kde.org


  M +21 -20    konq_mainwindow.cc   1.1164


--- kdebase/konqueror/konq_mainwindow.cc  #1.1163:1.1164
@@ -3702,20 +3702,18 @@ void KonqMainWindow::slotPopupMenu( KXML
   //kdDebug() << "KonqMainWindow::slotPopupMenu m_oldView=" << m_oldView << " new currentView=" << currentView << " passive:" << currentView->isPassiveMode() << endl;
 
-  if ( m_oldView != currentView )
+  if ( (m_oldView != currentView) && currentView->isPassiveMode() )
   {
-      if ( currentView->isPassiveMode() )
           // Make this view active only temporarily (because it's passive)
           m_currentView = currentView;
-      else
-          m_pViewManager->setActivePart( currentView->part() );
 
-      if ( m_oldView )
-      {
-          if ( m_oldView->browserExtension() )
+      if ( m_oldView && m_oldView->browserExtension() )
               disconnectExtension( m_oldView->browserExtension() );
           if ( m_currentView->browserExtension() )
               connectExtension( m_currentView->browserExtension() );
       }
-  }
+  // Note that if m_oldView!=currentView and currentView isn't passive,
+  // then the KParts mechanism has already noticed the click in it,
+  // but KonqViewManager delays the GUI-rebuilding with a single-shot timer.
+  // Right after the popup shows up, currentView _will_ be m_currentView.
 
   //kdDebug(1202) << "KonqMainWindow::slotPopupMenu( " << client << "...)" << " current view=" << m_currentView << " " << m_currentView->part()->className() << endl;
@@ -3821,14 +3819,17 @@ void KonqMainWindow::slotPopupMenu( KXML
   //<< ", m_currentView = " << m_currentView << endl;
 
-  if ( m_oldView && (m_oldView != currentView) && (currentView == m_currentView) )
+  // Restore current view if current is passive
+  if ( (m_oldView != currentView) && (currentView == m_currentView) && currentView->isPassiveMode() )
   {
+    //kdDebug() << "KonqMainWindow::slotPopupMenu restoring active view " << m_oldView << endl;
     if ( m_currentView->browserExtension() )
       disconnectExtension( m_currentView->browserExtension() );
+    if ( m_oldView )
+    {
     if ( m_oldView->browserExtension() )
+        {
       connectExtension( m_oldView->browserExtension() );
-    // Restore current view if current is passive
-    if ( currentView->isPassiveMode() ) {
-        //kdDebug() << "KonqMainWindow::slotPopupMenu restoring active view " << m_oldView << endl;
         m_currentView = m_oldView;
+        }
         m_oldView->part()->widget()->setFocus();
     }


Comment 4 Waldo Bastian 2003-06-04 18:26:07 UTC
*** Bug 58922 has been marked as a duplicate of this bug. ***