Bug 55470 - Writing directory name in save dialog saves the file into the directory with the same name as the directory
Summary: Writing directory name in save dialog saves the file into the directory with ...
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Frameworks and Libraries
Component: kfile (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Carsten Pfeiffer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-03 15:41 UTC by Julio Gazquez
Modified: 2003-03-04 12:40 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 Julio Gazquez 2003-03-03 15:41:59 UTC
Version:           desconocido (using KDE 3.1.0)
Installed from:    compiled sources
Compiler:          gcc version 2.95.3 20010315 (release)
OS:          Linux (i686) release 2.4.18

Do a small document in Kwrite or whatever
Open Save or Save as dialog
Type the name of a subdirectory and press enter in order to change into that directory.
The view doesn't change to that directory but saves the file into the directory with same name as the directory (e.g. "./dirname/dirname")
Comment 1 Carsten Pfeiffer 2003-03-04 12:40:35 UTC
Subject: KDE_3_1_BRANCH: kdelibs/kio/kfile

CVS commit by pfeiffer: 

backport "pressing return activates slotOk twice" fix
CCMAIL: 55470-close@bugs.kde.org


  M +7 -0      kfiledialog.cpp   1.327.2.7


--- kdelibs/kio/kfile/kfiledialog.cpp  #1.327.2.6:1.327.2.7
@@ -396,4 +396,5 @@ void KFileDialog::slotOk()
                 selectedURL = ops->url();
                 selectedURL.addPath( text ); // works for filenames and relative paths
+                selectedURL.cleanPath (); // fix "dir/../"
             }
         } else // complete URL
@@ -1150,4 +1151,10 @@ void KFileDialog::urlEntered(const KURL&
 void KFileDialog::locationActivated( const QString& url )
 {
+    // This guard prevents any URL _typed_ by the user from being interpreted
+    // twice (by returnPressed/slotOk and here, activated/locationActivated)
+    // after the user presses Enter.  Without this, _both_ setSelection and
+    // slotOk would "u.addPath( url )" ...so instead we leave it up to just
+    // slotOk....
+    if (!locationEdit->lineEdit()->edited())
     setSelection( url );
 }