[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [patch] KFileWidget: fix changing the current dir using url combo box
From:       Jarosław Staniek <js () iidea ! pl>
Date:       2008-04-11 15:04:29
Message-ID: 47FF7DFD.9030201 () iidea ! pl
[Download RAW message or body]

for review:

Fix changing the current dir using the 'recent url' combo box.
Upon accepting new url in the 'directory' url combo box, append '/' if needed: 
the combo does not add it, but tokenize() expects it because uses 
KUrl::setFileName(), which would silently remove the last segment of the path.

I guess it was a crossplatform issue.
Without the patch, if you select /home/js/foo/bar from the url combo box, and 
click on file.txt, the resulting url would be /home/js/foo/file.txt, not the 
expected /home/js/foo/bar/file.txt.

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice (http://www.kexi.pl/en, http://www.koffice.org/kexi)
  KDE Libraries for MS Windows (http://windows.kde.org)

["kfilewidget-urlcombo.patch" (text/plain)]

Index: kfile/kfilewidget.cpp
===================================================================
--- kfile/kfilewidget.cpp	(wersja 795837)
+++ kfile/kfilewidget.cpp	(kopia robocza)
@@ -1202,12 +1202,16 @@
 
 void KFileWidgetPrivate::_k_enterUrl( const KUrl& url )
 {
-    q->setUrl( url );
+    KUrl fixedUrl( url );
+    // append '/' if needed: url combo does not add it
+    // tokenize() expects it because uses KUrl::setFileName()
+    fixedUrl.adjustPath( KUrl::AddTrailingSlash );
+    q->setUrl( fixedUrl );
 }
 
 void KFileWidgetPrivate::_k_enterUrl( const QString& url )
 {
-    q->setUrl( KUrl( KUrlCompletion::replacedPath( url, true, true )) );
+    _k_enterUrl( KUrl( KUrlCompletion::replacedPath( url, true, true )) );
 }
 
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic