(*** This bug was imported into bugs.kde.org ***) Package: kword Version: KDE 2.2.0 CVS/CVSup/Snapshot Severity: normal Installed from: Compiled sources Compiler: Not Specified OS: Linux OS/Compiler notes: Not Specified Hi David/Werner As discussed on the koffice list however I make a bug report so it will not be "forgotten" > > > > > 3) Just discovered that when the file does not exist (see 1) (when > > > > > using the open recent file dialog) the user can't press "ok". > > > > > Perfect but: shouldn't the file be removed from the open recent > > > > > file list in this case? > > > > > > > > (Werner ?) > > > > I think the idea is that we don't want to check all the files > > > > initially (too slow) and we can't remove the file once you select it > > > > either (too "jumpy"). > > Hmmm... well it would be possible but it either is a pain > to write or a pain to use. Just imagine you have some "recent > files" on your favourite ftp server and everytime you start > up KWord we start to check all those files. If we do it in a > synchronous way you'll have to wait minutes to start KWord > if we don't wait for the results you still would get invalid > items. > > One solution which should be quite okay is that we delete the > entry of any non existant file you select once. We have to > check those files anyway and then we could remove them from > the config file if it's not available anymore. Okay? > > Ciao > Werner (Submitted via bugs.kde.org)
Hi I have a reference to a file in my "Window" menu on Kdevelop (1.4.1 on KDE 2.1.1) and the file is no longer there. Since it has the same filename but different location to a file that I am using I ocasionally click on it to be told the file is not there. Surely better to remove the menu entry when this happens? Ta Dave
The second reporter identified the problem in KDevelop, so this isn't strictly a KOffice problem, but a broader KDE issue.
Maybe it would be possible to file off some kind of minimal KIO:stat() per URL inside KRecentFilesAction::loadEntries(), and delete things from the list if the stat() says it doesn't exist. That would at least deal with the most common case. I think most people would be willing to tolerate the system not realising that they had deleted a file if it was during that session.
The code is pretty trivial: The svn diff: Index: kactionclasses.cpp =================================================================== --- kactionclasses.cpp (revisión: 409943) +++ kactionclasses.cpp (copia de trabajo) @@ -34,6 +34,7 @@ #include <qobjectlist.h> #include <qwhatsthis.h> #include <qtimer.h> +#include <qfile.h> #include <dcopclient.h> #include <dcopref.h> @@ -1119,7 +1120,7 @@ QString value; QString oldGroup; QStringList lst; - + oldGroup = config->group(); if (groupname.isEmpty()) @@ -1132,8 +1133,12 @@ key = QString( "File%1" ).arg( i ); value = config->readPathEntry( key ); - if (!value.isNull()) + if (!value.isNull()) + { + KURL addr(value); + if( !addr.isLocalFile() || QFile(addr.path()).exists()) lst.append( value ); + } } I've tested it and works ok.
SVN commit 502014 by braxton: Don't restore files to recent files list that don't exist anymore. Same for KURLComboBox. based on a patch by Jordi Polo <mumismo@wanadoo.es> BUG: 27581 M +6 -0 kdeui/kactionclasses.cpp M +6 -0 kio/kfile/kurlcombobox.cpp --- branches/KDE/3.5/kdelibs/kdeui/kactionclasses.cpp #502013:502014 @@ -34,6 +34,7 @@ #include <qobjectlist.h> #include <qwhatsthis.h> #include <qtimer.h> +#include <qfile.h> #include <dcopclient.h> #include <dcopref.h> @@ -1187,6 +1188,11 @@ key = QString( "File%1" ).arg( i ); value = config->readPathEntry( key ); url = KURL::fromPathOrURL( value ); + + // Don't restore if file doesn't exist anymore + if (url.isLocalFile() && !QFile(url.path()).exists()) + continue; + nameKey = QString( "Name%1" ).arg( i ); nameValue = config->readPathEntry( nameKey, url.fileName() ); title = nameValue + " [" + value + "]"; --- branches/KDE/3.5/kdelibs/kio/kfile/kurlcombobox.cpp #502013:502014 @@ -180,6 +180,12 @@ } u = KURL::fromPathOrURL( *it ); + // Don't restore if file doesn't exist anymore + if (u.isLocalFile() && !QFile(u.path()).exists()) { + ++it; + continue; + } + item = new KURLComboItem; item->url = u; item->pixmap = getPixmap( u );