[extra patch] Re: KFileWidget: fix changing the current dir using url combo box

Jaroslaw Staniek js at iidea.pl
Fri Apr 11 23:13:44 BST 2008


David Faure said the following, On 2008-04-11 23:31:
> On Friday 11 April 2008, Jarosław Staniek wrote:
>> 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.
> 
> So it should probably use addPath() instead of setFileName()?

That was somewhat my first thought, but it'd be too easy.
I am afraid we could end up with nonexisting paths like /foo/bar even when 
/foo was a file. In my patch we're appending '/' explicitely when we know that 
the path points to a directory.

Another, and probably the last place when we have to care about trailing 
slashes for dirs, is kdiroperator; see this additional patch:


Index: kfile/kdiroperator.cpp
===================================================================
--- kfile/kdiroperator.cpp      (wersja 795836)
+++ kfile/kdiroperator.cpp      (kopia robocza)
@@ -888,10 +888,11 @@
      else
          newurl = _newurl;

+    newurl.adjustPath( KUrl::AddTrailingSlash );
  #ifdef Q_WS_WIN
      QString pathstr = newurl.toLocalFile();
  #else
-    QString pathstr = newurl.path(KUrl::AddTrailingSlash);
+    QString pathstr = newurl.path();
  #endif
      newurl.setPath(pathstr);


-- 
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)




More information about the kde-core-devel mailing list