KRecentFilesAction broken

Albert Astals Cid aacid at
Sun Jul 23 21:19:09 BST 2006

Hi, KRecentFilesAction is broken in its current state.

First there is a problem that makes its crash when used, the problem is 
KRecentFilesAction::addUrl when adding an url that is already there.

The problem is this:
 * You click on a entry of the menu and
     emit urlSelected(d->m_urls[action]);
    is called

 * From your code you have connected this signal to openurl that calls
      KRecentFilesAction::addUrl( const KUrl& url, const QString& name )

in that particular piece of code if the url is already there it is removed and 
added again. The problem is that when remoing it, the url you get as 
parameter becomes invalid and so it crashes.

Attached is a simple solution that has the problem of not making the already 
there url "climb" to the first position. Anyone thinks is there a better 
solution or should i extend this to make the "climbing" of the already there 

Another problem i find is that KRecentFilesAction uses kselectaction that 
creates the menu with radio items, i don't think it's good to have it that 
way. Do you agree it should be changed back to using "normal" menu entries?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: krecentfilesaction.patch
Type: text/x-diff
Size: 1571 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list