Bug 303763

Summary: recent documents can't be cleared
Product: [Applications] calligracommon Reporter: Franz Trischberger <franz.trischberger>
Component: generalAssignee: Calligra Bugs <calligra-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: cbo, kossebau
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Franz Trischberger 2012-07-18 21:01:14 UTC
Going to "recent files -> clear list" does nothing, in all components.

Reproducible: Always
Comment 1 Camilla Boemann 2012-07-18 21:11:57 UTC
works perfectly well for me in master.

You are welcome to keep investigating and if you can come up with proof it's not a local issue i'll be more than happy to reopen
Comment 2 Franz Trischberger 2012-07-19 06:13:13 UTC
Sorry, it was late yesterday, so this report stayed rather short.
Of course something happens: The menu entry gets cleared. But the recent files don't get deleted from config, The menu is filled again at the next start. This is reproducable for me on 3 different PCs, all running Gentoo.
I have opened an ODT long time ago through kio_fish. Now everytime I start words I'm asked for the password for kwallet (why, BTW.? Should't it be enough to ask on load? Is it because of the thumbnail?)
I will look if I can find the cause, but won't spend too much time. Office Suites don't have high priority for me, as I do most of my work with tex or use plain text files.
Comment 3 Camilla Boemann 2012-07-19 06:15:04 UTC
and confirmed
Comment 4 Camilla Boemann 2012-07-19 06:19:27 UTC
Friedrich, this second part about thumbnails may be of intererest to you. Well be free to solve the first part too.
Comment 5 Franz Trischberger 2012-07-19 06:32:03 UTC
    KSharedConfigPtr configPtr = componentData().isValid() ? componentData().config() : KGlobal::config();
    d->recent->saveEntries(configPtr->group("RecentFiles"));

Place this in the KoMainWindow-Destrucor, and everything works as it should.
I don't know if componentData() can ever be invalid in the destructor, just copied the parts from loading recent files in the constructor.
You probably also want to connect KRecentFilesAction::recentListCleared to some slot to clear the Recent Documents view on the startup page, when someone triggers the clear recent files-action in the menu ;)
Comment 6 Franz Trischberger 2012-07-19 06:54:42 UTC
(In reply to comment #5)
> 
>     KSharedConfigPtr configPtr = componentData().isValid() ?
> componentData().config() : KGlobal::config();
>     d->recent->saveEntries(configPtr->group("RecentFiles"));

Oops, just realised void KoMainWindow::saveRecentFiles() ;) Makes things easier.
Comment 7 Friedrich W. H. Kossebau 2012-07-20 14:40:25 UTC
(In reply to comment #2)
> Sorry, it was late yesterday, so this report stayed rather short.
> Of course something happens: The menu entry gets cleared. But the recent
> files don't get deleted from config, The menu is filled again at the next
> start. This is reproducable for me on 3 different PCs, all running Gentoo.
> I have opened an ODT long time ago through kio_fish. Now everytime I start
> words I'm asked for the password for kwallet (why, BTW.? Should't it be
> enough to ask on load? Is it because of the thumbnail?)

Could be very much because of the thumbnail. Will investigate. For remote files in the recent file list indeed the thumbnail fetching should only be done if possible without user interaction.
Comment 8 T Zachmann 2012-07-26 06:32:21 UTC
Git commit 46e4c4b885f90a004d4eb3afd36258db9a3e79ee by Thorsten Zachmann.
Committed on 26/07/2012 at 08:28.
Pushed by zachmann into branch 'calligra/2.5'.

Write recent file list when it is cleared

When the recent file list is cleared it is not saved to the config file and therefore
the files reappear on the next opening of the document.
REVIEW: 105735
(cherry picked from commit bf7d2fbcf6d9940bf85185aa68bf9cfa3df0b44f)

M  +1    -0    libs/main/KoMainWindow.cpp
M  +4    -5    libs/main/KoMainWindow.h

http://commits.kde.org/calligra/46e4c4b885f90a004d4eb3afd36258db9a3e79ee