KFileDialog not remembering the last dir when using startdir keywords

Guillaume Laurent glaurent at telegraph-road.org
Thu Mar 6 00:17:32 GMT 2003


There's a bug (IMHO, unless that's expected behavior ?) in the way KFileDialog 
remembers the last directory when a keyword (':myapplication') is specified 
for the start dir, e.g. :

KFileDialog::getOpenURL(":ROSEGARDEN", "*.rg|Rosegarden-4 files\n*|All files", 
this, i18n("Open File"));

The problem is that the last directory will be remembered properly only if it 
is visited for the first time. For instance, given two dirs foo/ and bar/ 
both containing files the app can load. If the user loads a file from foo/, 
then subsequent invocation of the file dialog will be set to foo/, no pb so 
far. If he then switches to bar/ and loads a file from there, the dialog will 
be set to bar/. But if he then tries to load a file from foo/ again, the 
dialog will remain set on bar/, which is most annoying. The bug is in 
KRecentDirs::add() :

   KConfig *config = recentdirs_readList(key, result, false);
   if (!result.contains(directory))
      result.prepend(directory);

Unless this is how it's supposed to work, I'd like to submit a patch so that 

if (result.contains(directory)) {
 result.remove(directory)
 result.prepend(directory)
}

so the last dir is properly remembered in all cases. Is that ok ?

-- 
					Guillaume.
					http://www.telegraph-road.org




More information about the kde-core-devel mailing list