By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release.
Bug 987 - KNotes not remember open notes
Summary: KNotes not remember open notes
Status: RESOLVED FIXED
Alias: None
Product: TDE
Classification: Unclassified
Component: tdepim (show other bugs)
Version: 3.5.12 [Trinity]
Hardware: All All
: P5 major
Assignee: Slávek Banko
URL:
Depends on:
Blocks:
 
Reported: 2012-05-03 19:00 CDT by Slávek Banko
Modified: 2012-05-23 01:04 CDT (History)
3 users (show)

See Also:
Compiler Version:
TDE Version String:
Application Version:
Application Name:


Attachments
A simple one-line fix (334 bytes, patch)
2012-05-10 13:22 CDT, Slávek Banko
Details | Diff
Do not close notes during saving session (320 bytes, patch)
2012-05-22 00:54 CDT, Slávek Banko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Slávek Banko 2012-05-03 19:00:57 CDT
KNotes not distinguish whether a closing note for the end of the program / session or whether it is closed by the user. Always is saved with HideNote=true. After logging and restoring session, all notes will remain closed even if they were previously open.
Comment 1 Darrell 2012-05-04 11:16:32 CDT
Did this work correctly in previous versions of TDE or KDE 3.5.10?
Comment 2 Slávek Banko 2012-05-04 11:18:05 CDT
(Odpověď na komentář #1)
> Did this work correctly in previous versions of TDE or KDE 3.5.10?

Unfortunately I do not know - I walked from KDE 3.5.10 to Trinity 3.5.12.
Comment 3 Darrell 2012-05-04 12:04:13 CDT
I don't use KNotes and I am unfamiliar. Would you please post the steps I need to perform to test/replicate this bug? Thanks!
Comment 4 Slávek Banko 2012-05-08 10:39:32 CDT
(Odpověď na komentář #3)
> I don't use KNotes and I am unfamiliar. Would you please post the steps I need
> to perform to test/replicate this bug? Thanks!

1. Run KNotes.
2. Create a new note, write something to note and let it open.
3. Log out (with saving session)
4. Log in and wonder why note did not remain open :)
Comment 5 Darrell 2012-05-08 13:13:29 CDT
Confirmed.

Works fine in KDE 3.5.10. :-(
Comment 6 Darrell 2012-05-08 13:29:03 CDT
Does this work correctly in Trinity 3.5.12?
Comment 7 Slávek Banko 2012-05-08 13:40:59 CDT
(Odpověď na komentář #6)
> Does this work correctly in Trinity 3.5.12?

No, it does not work properly in 3.5.12. Therefore I set in the bug report version 3.5.12. As it was before 3.5.12 I have not got to try.
Comment 8 Darrell 2012-05-08 15:18:00 CDT
As restoration works in 3.5.10 and not in 3.5.12 or GIT, then we know the timeline when the bug was introduced. I'll take a guess the bug was introduced in this patch:

http://git.trinitydesktop.org/cgit/tdepim/commit/knotes?id=cc29364f06178f8f6b457384f2ec37a042bd9d43

That patch was merged between 3.5.11 and 3.5.12. Perhaps a C++ guru can look at the patch and notice the cause?
Comment 9 Timothy Pearson 2012-05-08 15:45:29 CDT
(In reply to comment #7)
> (Odpověď na komentář #6)
> > Does this work correctly in Trinity 3.5.12?
> 
> No, it does not work properly in 3.5.12. Therefore I set in the bug report
> version 3.5.12. As it was before 3.5.12 I have not got to try.

It works for me here on Ubuntu, but I always save the session on logout.

I wonder if this is really a bug, as not saving the session would imply discarding all open windows...
Comment 10 Darrell 2012-05-08 16:16:16 CDT
I set the session manager to Restore manually saved session. I opened and edited a KNotes note. I left Konqueror open (minimized) as a second method to verify the session is restored.

From the TDE menu I selected Save Session. I then logged out and logged in. Although KNotes restarted and the KNotes icon was in the system tray, no note appeared on the desktop. Konqueror appeared minimized. Selecting Knotes from the system tray caused the note to appear.
Comment 11 Slávek Banko 2012-05-08 18:37:09 CDT
(Odpověď na komentář #9)
> It works for me here on Ubuntu, but I always save the session on logout.
> 
> I wonder if this is really a bug, as not saving the session would imply
> discarding all open windows...

I use autosave session. For other programs than KNotes I not noticed the problem. (Debian Squeeze)
Comment 12 Slávek Banko 2012-05-10 13:22:21 CDT
Created attachment 617 [details]
A simple one-line fix

Tested and works well. Saving the configuration is done in other places. So in closing it was unnecessary => undesirable.
Comment 13 Timothy Pearson 2012-05-10 14:13:18 CDT
(In reply to comment #12)
> Created attachment 617 [details]
> A simple one-line fix
> 
> Tested and works well. Saving the configuration is done in other places. So in
> closing it was unnecessary => undesirable.

Just to verify, if I edit a note, then immediately close KNotes, will the note be saved or lost?
Comment 14 Slávek Banko 2012-05-10 14:21:59 CDT
(Odpověď na komentář #13)
> (In reply to comment #12)
> > Created attachment 617 [details] [details]
> > A simple one-line fix
> > 
> > Tested and works well. Saving the configuration is done in other places. So in
> > closing it was unnecessary => undesirable.
> 
> Just to verify, if I edit a note, then immediately close KNotes, will the note
> be saved or lost?

Saved, because all notes are saved during the termination KNotes. As I said - saving them anyway carried out elsewhere.
Comment 15 Darrell 2012-05-10 16:51:53 CDT
So the bug was introduced in the patch I referenced in Comment 8.

Slavek's attached patch restores the code to the same as in 3.5.10, which does not exhibit the bug for me on my systems.

That raises the question of why the one-line change was believed necessary from whomever created that original massive patch (Suse? Ubuntu? Debian?). And why the bug is not seen in Ubuntu.

Push the patch to GIT?
Comment 16 Slávek Banko 2012-05-10 18:04:17 CDT
(Odpověď na komentář #15)
> So the bug was introduced in the patch I referenced in Comment 8.
> 
> Slavek's attached patch restores the code to the same as in 3.5.10, which does
> not exhibit the bug for me on my systems.
> 
> That raises the question of why the one-line change was believed necessary from
> whomever created that original massive patch (Suse? Ubuntu? Debian?). And why
> the bug is not seen in Ubuntu.
> 
> Push the patch to GIT?

Yes, it is true. It's in the patches you've said. I looked into the patch before, as you said it well, I looked into it again. When I am there the one-line caught the eye. :)

I do not know who had a rationale, there's added saving. But apparently it caused a problem. In response to closeEvent not distinguish why is the window closes. Such a reason is also the end of session. So I first verified that the saving is done elsewhere and then the I just re-throw this line.

For me has a vote for commit it in the GIT.
Comment 17 Timothy Pearson 2012-05-10 18:09:10 CDT
(In reply to comment #15)
> So the bug was introduced in the patch I referenced in Comment 8.
> 
> Slavek's attached patch restores the code to the same as in 3.5.10, which does
> not exhibit the bug for me on my systems.
> 
> That raises the question of why the one-line change was believed necessary from
> whomever created that original massive patch (Suse? Ubuntu? Debian?). And why
> the bug is not seen in Ubuntu.
> 
> Push the patch to GIT?

Go ahead and push.  No metadata exists explaining why that one-line change was made, so it may not have been needed at all.

Tim
Comment 18 Darrell 2012-05-10 20:05:53 CDT
Pushed to GIT in hash 533f494f.

Resolved.

Thank you!
Comment 19 Slávek Banko 2012-05-21 12:41:43 CDT
After resolving the error 922 (d2f8fca9 patch) notes are now closed during the testing, whether it is possible to log off. However, if the log off is interrupted, notes will remain closed. Hence notes should not be closed so soon.
Comment 20 Timothy Pearson 2012-05-21 13:02:01 CDT
(In reply to comment #19)
> After resolving the error 922 (d2f8fca9 patch) notes are now closed during the
> testing, whether it is possible to log off. However, if the log off is
> interrupted, notes will remain closed. Hence notes should not be closed so
> soon.

This goes much deeper, into the core design of the TDE session manager (smserver) itself.

When you try to log off/shut down/etc., TDE sends out a signal for all open applications to save and close (phase 1).  kate, kwrite, and a host of other applications can intercept this call and prevent logout, but they cannot prevent the phase1 shutdown signal from reaching other applications such as knotes.

Essentially what I am saying is that there is no mechanism in place to "undo" the phase1 shutdown request.  I don't even know what that would look like to be honest, as it would involve relaunching part of the still-unsaved session.

A temporary fix might be to make knotes respond to the phase1 signal by saving its notes but not exiting, and then respond to the phase2 signal by shutting down without saving.
Comment 21 Slávek Banko 2012-05-21 13:09:38 CDT
(Odpověď na komentář #20)
> This goes much deeper, into the core design of the TDE session manager
> (smserver) itself.
> 
> When you try to log off/shut down/etc., TDE sends out a signal for all open
> applications to save and close (phase 1).  kate, kwrite, and a host of other
> applications can intercept this call and prevent logout, but they cannot
> prevent the phase1 shutdown signal from reaching other applications such as
> knotes.
> 
> Essentially what I am saying is that there is no mechanism in place to "undo"
> the phase1 shutdown request.  I don't even know what that would look like to be
> honest, as it would involve relaunching part of the still-unsaved session.
> 
> A temporary fix might be to make knotes respond to the phase1 signal by saving
> its notes but not exiting, and then respond to the phase2 signal by shutting
> down without saving.

The problem is that knotes on signal phase1 closes notes, but shutting down on signal phase2. Closing notes should therefore not be in phase1, but in phase2 - along with shutting down. It must do both simultaneously.
Comment 22 Timothy Pearson 2012-05-21 13:33:47 CDT
> The problem is that knotes on signal phase1 closes notes, but shutting down on
> signal phase2. Closing notes should therefore not be in phase1, but in phase2 -
> along with shutting down. It must do both simultaneously.

Gotcha.  This should be a relatively simple fix unless the knotes developers did something weird in their session handlers.

Tim
Comment 23 Slávek Banko 2012-05-22 00:54:03 CDT
Created attachment 629 [details]
Do not close notes during saving session

Really - fix was quite simple.
Comment 24 Slávek Banko 2012-05-22 18:16:04 CDT
It is interesting that our patch was useful also for upstream KDE 4.x - see:
https://bugs.kde.org/show_bug.cgi?id=300456
Comment 25 Timothy Pearson 2012-05-22 20:42:29 CDT
(In reply to comment #24)
> It is interesting that our patch was useful also for upstream KDE 4.x - see:
> https://bugs.kde.org/show_bug.cgi?id=300456

That's good to hear!

Did you commit this to GIT yet?  If so, please post the GIT short hash to the bug report and mark it RESOLVED FIXED.

Thanks!

Tim
Comment 26 Slávek Banko 2012-05-23 01:04:57 CDT
Fixed in GIT hash c48253a.