Bug 335703

Summary: cannot create a sticky note by knotes
Product: [Applications] knotes Reporter: Shmuel <sabinun>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: knut.hildebrandt, myriam, wbauer1
Priority: NOR    
Version: 4.13   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed In: 4.14
Attachments: Terminal messages on 1st execution with skip migration
Setup dialogue of Knotes showing two collection of which one is a maildir-resource
Akonadi setup-dialogue showing the Maildir-Resource for my local mail
Akonadi setup-dialogue showing the AKnotes-Resource created after migration

Description Shmuel 2014-06-02 15:48:59 UTC
executing knotes in terminal crashed with message:
 "QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave." . 
executing knotes -version: 
Qt: 4.8.6 
KDE Development Platform 4.13.0 
KNotes 4.13

Reproducible: Always

Steps to Reproduce:
1. execute /usr/lib/knotes in terminal
2.
3.
Actual Results:  
I got the message twice on terminal:
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.



computer: Lenovo E530c
KUBUNTU 14.04-desktop-amd64
last updtates done on 2014-JUN-02
Comment 1 Shmuel 2014-06-02 15:51:33 UTC
none
Comment 2 Knut Hildebrandt 2014-07-04 12:19:14 UTC
Was about to create a new bug report when I came across this one. Hope the problems are relatet.

After upgrading KDE for 4.12 to 4.13 I had to migrate Knotes, since it now depends on Akonadi. After some problems in the beginning I managed to migrate and launch Knotes and get the indicator displayed. Knotes even finds my old notes after I switched the collection from pre-selected local-mail to the notes resource. Thus I thought everything is okay until I tried to create my first new note. This simply doesn't work. For testing purposes I started Knotes in a terminal and - as I suspected - the is an error message, when I try to create a new note. It reads as follows:

Error during fetch:  "Collection 23458 does not exist" 

Any idea what this means and, even more important, how I can fix the problem?

Cheers

Knut
Comment 3 Myriam Schweingruber 2014-07-04 12:43:22 UTC
Just upgrade to a more recent KDE 4.13.x release, this was fixed in the 4.13.1 IIRC

*** This bug has been marked as a duplicate of bug 333640 ***
Comment 4 Wolfgang Bauer 2014-07-04 12:53:50 UTC
(In reply to comment #3)
> Just upgrade to a more recent KDE 4.13.x release, this was fixed in the
> 4.13.1 IIRC
Sorry, but this does not sound like a duplicate.
He says that the notes were migrated and he can actually see them.
But creating a _new_ note doesn't work.

The OP's problem may be a duplicate to bug#333640 though, or maybe even bug#334027 .

@Knut Hildebrand:
Enter KNotes' settings, switch to collections, and select a different "folder where the note will be saved".
Apparently your current one doesn't exist.

Enabling _all_ notes collections there might help as well.
Comment 5 Myriam Schweingruber 2014-07-04 13:08:58 UTC
All these bugs that appeared in 4.13.0 were related, just upgrade to 4.13.1 or later
Comment 6 Wolfgang Bauer 2014-07-04 16:50:19 UTC
(In reply to comment #5)
> All these bugs that appeared in 4.13.0 were related, just upgrade to 4.13.1
> or later
That's not very helpful.

As you can read in https://bugs.kde.org/show_bug.cgi?id=333640#c62 I did encounter something similar as Knut Hildebrand describes as well.
And that was with 4.13.2.

If there's no valid collection set as default, creating new notes will fail.
And this is _not_ fixed in 4.13.1 obviously.
Comment 7 Wolfgang Bauer 2014-07-05 11:36:38 UTC
Shmuel (the OP here) wrote in the other big report:
5th JUL 2014 - KNotes still don't work"
/etc/issue      display: Ubuntu 14.04 LTS /n /l
KDE version:  4.13.2
knotes -version    display:  4.13.2  

Clicking KNots icon with right mouse button, choosing "New Note" -  nothing seen.
Running knotes on konsole displays message:
"QDBusconnection: session D-Bus connection created before QCoreApplication. 
Application may misbehaven. knotes already started"

I'm reopening this one therefore.
This is not at all a duplicate of the other one.
This one is about not being able to create a _new_ note, the other one is about the migration from old notes not working (which is fixed).
Comment 8 Shmuel 2014-07-05 15:33:59 UTC
Created attachment 87578 [details]
Terminal messages on 1st execution with skip migration

I had no previous notes. As at my prveious comment the meessage contained "knotes already started" I quit the program and executed it on terminal again. A window was opened. I clicked "Skip migration". The result messages are in my attachment, with hope it may help. Thanks.
Comment 9 Wolfgang Bauer 2014-07-05 16:23:58 UTC
Do you get an error when you try to create a note?

Does it work when you don't skip the migration?

Maybe you do not even have a akonotes resource.
The migration should make sure that there is one, even if you don't have any old notes.
Check in knotes' settings whether there are collections listed there and enabled, as already mentioned in comment#4.
And if there are none, enter Systemsettings->Personal Information->Configure Akonadi Resources and add one.
Comment 10 Shmuel 2014-07-06 17:52:58 UTC
Asking for "New Note" displays on terminal:
Error during fetch:  "Invalid collection given." 

Problem solved. I found the way how to define the collection folder, 
in the configuration > Collections window.

My fault is the result of assumption: The folder to save notes was shown. I selected it and clicked OK, but that was not enough. I had to click the down-right buttomn to select the folder again and finish with OK twice. Sorry for my confusion.

You may close this bug.
Comment 11 Wolfgang Bauer 2014-07-06 19:58:35 UTC
(In reply to comment #10)
> Asking for "New Note" displays on terminal:
> Error during fetch:  "Invalid collection given." 
> 
> Problem solved. I found the way how to define the collection folder, 
> in the configuration > Collections window.
> 
> My fault is the result of assumption: The folder to save notes was shown. I
> selected it and clicked OK, but that was not enough. I had to click the
> down-right buttomn to select the folder again and finish with OK twice.
> Sorry for my confusion.
Ok, as I suspected. Apparently a non-existent collection was selected.
After you selected the existing one it works.

Good to hear that you can create notes now.

> You may close this bug.
Well, IMHO this is still a valid bug, because such a thing should not happen.

knotes definitely should present the user a comprehensible error message in such a case. At the moment, it just silently fails (except for a message in the terminal which most users won't see).

Or even better, it could open a dialog to pick a valid collection.
Comment 12 Knut Hildebrandt 2014-07-06 23:03:56 UTC
Okay, problem solved for me too. I went back to the configuration dialogue again and saw that I have to select the notes resource twice, once for showing notes and once for storing notes. That's a bit confusing and does not make sense to me and thus I had overlooked it.

BTW, in the dialogue there are always two resources displayed, the notes resource pointing to the directory where my notes were stored after migrating and furthermore a maildir resource pointing to my local mail directory. The latter was even pre-selected if I remember right.

This is the KNotes I've on my systen:

KNotes
Version 4.13.2
Using KDE Development Platform 4.13.2 optimized by The Chakra Project

Hope my remarks will help in further development. And thanks for you help.

Knut
Comment 13 Wolfgang Bauer 2014-07-07 08:19:28 UTC
(In reply to comment #12)
> Okay, problem solved for me too. I went back to the configuration dialogue
> again and saw that I have to select the notes resource twice, once for
> showing notes and once for storing notes. That's a bit confusing and does
> not make sense to me and thus I had overlooked it.

Well, you can have more than one akonotes resource, so there's the possibility to only show specific collections/resources and to select where notes are stored.

> BTW, in the dialogue there are always two resources displayed, the notes
> resource pointing to the directory where my notes were stored after
> migrating and furthermore a maildir resource pointing to my local mail
> directory. The latter was even pre-selected if I remember right.

Hm, this should not happen. Knotes should only show Akonotes resources.
I haven't seen such a thing, and cannot reproduce it. Knotes only shows Akonotes resources here.
Probably that maildir resource is configured wrongly? Is it really a maildir resource? Or is it maybe an Akonotes resource pointing to your local mail directory?
You can check either in Systemsettings->Personal Information->Akonadi Resources Configuration, or in akonadiconsole  (the directory where the resource stores its files can be changed in the resource's settings).

You might want to file a separate bug report about this (i.e. that knotes shows a maildir resource).
Comment 14 Knut Hildebrandt 2014-07-07 10:53:20 UTC
(In reply to comment #13)
> Well, you can have more than one akonotes resource, so there's the
> possibility to only show specific collections/resources and to select where
> notes are stored.

Well, I understand this idea even though I find it confusing, moreover since after migration the correct resource has not been selected.

> Hm, this should not happen. Knotes should only show Akonotes resources.
> I haven't seen such a thing, and cannot reproduce it. Knotes only shows
> Akonotes resources here.
> Probably that maildir resource is configured wrongly? Is it really a maildir
> resource? Or is it maybe an Akonotes resource pointing to your local mail
> directory?
> You can check either in Systemsettings->Personal Information->Akonadi
> Resources Configuration, or in akonadiconsole  (the directory where the
> resource stores its files can be changed in the resource's settings).

I made some screen-shots that you can see how Akonadi and Knotes are configured. The one showing the Knotes setup-dialogue shows both resources I can choose from. The other two let you see, how they were defined, one is a maildir-resource the other a aknotes-resource. 

But one thing gets obvious too, Akonadi seems to have severe problems with localization. The contact-resource exists three times even though only one is being displayed in Kontact. I assume this is  'cause I changed the language of the PIM-applications several time. Some of the applications use German, others Spanish and once a while I change to English for testing purposes. 

> You might want to file a separate bug report about this (i.e. that knotes
> shows a maildir resource).

Shall I file a bug report regarding the aknotes-resource?

Cheers

Knut
Comment 15 Knut Hildebrandt 2014-07-07 10:58:56 UTC
Created attachment 87609 [details]
Setup dialogue of Knotes showing two collection of which one is a maildir-resource
Comment 16 Knut Hildebrandt 2014-07-07 11:00:53 UTC
Created attachment 87610 [details]
Akonadi setup-dialogue showing the Maildir-Resource for my local mail
Comment 17 Knut Hildebrandt 2014-07-07 11:01:55 UTC
Created attachment 87611 [details]
Akonadi setup-dialogue showing the AKnotes-Resource created after migration
Comment 18 Wolfgang Bauer 2014-07-07 16:59:04 UTC
(In reply to comment #14)
> Well, I understand this idea even though I find it confusing, moreover since
> after migration the correct resource has not been selected.
Well, this seems to be a problem, yes. 
But I tried now again, and the migration does not set a default collection for saving notes.

OTOH, I tried on a fresh account as well with skipping the migration. In that case no valid default collection is set.
Not even the default notes resource is enabled to show notes (same problem exists in KOrganizer and KAddressbook, that's another bug that's already been reported some time ago).

> I made some screen-shots that you can see how Akonadi and Knotes are
> configured. The one showing the Knotes setup-dialogue shows both resources I
> can choose from. The other two let you see, how they were defined, one is a
> maildir-resource the other a aknotes-resource. 
Are you sure?
It is named "Notizen", so I would guess that it's rather an akonotes resource.
But apparently it is pointing to your local mail folder. As akonotes resources also store the notes in maildir format, this is absolutely valid. 

Your actual maildir resource is named "Maildir" according to your second screenshot.

> But one thing gets obvious too, Akonadi seems to have severe problems with
> localization. The contact-resource exists three times even though only one
> is being displayed in Kontact.
AFAIK the resource's name is stored in the database as string. It doesn't get localized when shown, just when the resource is created with the default name.
Since you can change the name to anything you like, it's not feasible to localize it I'd say.

Btw, AFAIK the possibility to rename collections in knotes has been added for 4.14.
For now you have to use akonadiconsole for this. ("Browser" tab, right-click on the collection and choose "Folder Properties")

> > You might want to file a separate bug report about this (i.e. that knotes
> > shows a maildir resource).
> 
> Shall I file a bug report regarding the aknotes-resource?
Well, if it is indeed an akonotes resource, it is no bug that knotes shows it.
How and why it got created the way it is, is a different question of course.

Maybe you had some stray configuration files laying around, or some garbage in the database.

Just remove it in Systemsettings or akonadiconsole, the one named "Notizen" that is.
Don't worry that you lose  your local mail, removing a resource does _not_ remove the data it stored.

But to recap, IMO this bug report boils down to two things:
- _no_ default notes collection is set automatically, when you skip the migration (on a fresh user account f.e.). The user has to set one manually.
- knotes silently fais when you try to create a note and there is no default collection set. It should tell the user about the problem, and maybe even show a dialog to pick one in that case.
Comment 19 Wolfgang Bauer 2014-07-07 17:00:51 UTC
(In reply to comment #18)
> (In reply to comment #14)
> > Well, I understand this idea even though I find it confusing, moreover since
> > after migration the correct resource has not been selected.
> Well, this seems to be a problem, yes. 
> But I tried now again, and the migration does not set a default collection
> for saving notes.
Sorry, that was a typing error.
The migration _does_ set a default collection for saving notes.

Only when you skip the migration, no default collection is set, and creating notes fails. (at least in my test now)
Comment 20 Knut Hildebrandt 2014-07-07 22:27:50 UTC
Okay, lets try and dig a bit deeper into the problem. I try to remember all the steps I had to go through to migrate from KDE 4.12.x to 4.13.2.

After installing 4.13.2 Kmail got totally confused. The configuration of all my mail-accounts seemed to have gone.  None of the hand picked icons I had set were displayed nor the folder names. Moreover I had two resources shown which both pointed to my local-mail directory. One could display all the mails archived there but somehow localization did  not work. Neither the German nor Spanish names for standard-folders were displayed nor the standard icons for inbox, draft etc.. All I got to see were the blue folder-icons and the English directory names.The other folder looked right, but none of the stored mails could be seen.

Honestly I don't remember what I did exactly to fix this problem, but I think I played all the akonadi and nepomuk stuff back from a backup and ran nepomukbaloomigrator after. Then everything looked right. Only loss were the "categories" I had used in KAdressbook and the notes I had attached  to my mails. Already filed a bug report about this.

Next step was getting Kalarm and Knotes working. After a few try-and-error attempts I first got all my reminders in Kalarm displayed and after executing knotes-migrator I had two AkoNotes-resources shown in Akonadi but no notes in Knotes. By now there is only one resource left, the one named "Notas locales". This is the one which points to the directory where my notes were stored after migration and where I save new notes now. The second resource I deleted, if I remember right.

Apart from the above mentioned "Notas locales" there are no more AkoNotes resources present in my Akonadi resource list. The second collection one can see in the Knotes setup dialogue points to my local-mail directory.  And there is only a MailDir-Resource named "Carpetas locales" present in Akonadi.

Maybe it is helpful to mention that I use KDE and its PIM-suite for more than ten years migrating step by step from KDE 3.5.x to 4.x. Meanwhile I also migrated from Suse to Kubuntu and recently to Chakra Linux. Thus there might be some leftovers in the configuration file I'm not aware of ;-)

(In reply to comment #18)
> (In reply to comment #14)

> > I made some screen-shots that you can see how Akonadi and Knotes are
> > configured. The one showing the Knotes setup-dialogue shows both resources I
> > can choose from. The other two let you see, how they were defined, one is a
> > maildir-resource the other a aknotes-resource.

> Are you sure?
> It is named "Notizen", so I would guess that it's rather an akonotes
> resource.

I see that it is named "Notizen", but there is no resource named "Notizen" any more. There was one, if I recall it correctly, which pointed to my local-mail directory.That was the second Akonotes resource that appeared after migration. Since it didn't make sense to me to have it I just deleted it.  


> Your actual maildir resource is named "Maildir" according to your second
> screenshot.

Yep, in the screnn-shot it is called "Maildir", but right now it is called "Carpetas locales" even though I did not change my language settings. Only thing I did meanwhile, I hibernated my laptop (Ruhezustand). Very confusing:


> > > You might want to file a separate bug report about this (i.e. that knotes
> > > shows a maildir resource).

> > Shall I file a bug report regarding the aknotes-resource?

> Just remove it in Systemsettings or akonadiconsole, the one named "Notizen"
> that is.

There was no resource named "Notizen" I could remove in akonadiconsole. But I removed the two additional akonadi-contacts-resouces and it did not cause any harm.

Well, for me everything works fine, at least for the moment. Hope to have made migration a bit easier for others with these remarks. And hopefully these problems get solved in future releases.

Cheers

Knut
Comment 21 Wolfgang Bauer 2014-07-08 20:19:03 UTC
(In reply to comment #20)
> After installing 4.13.2 Kmail got totally confused.
I had no problem with any update here.

> Honestly I don't remember what I did exactly to fix this problem, but I
> think I played all the akonadi and nepomuk stuff back from a backup and ran
> nepomukbaloomigrator after. Then everything looked right. Only loss were the
> "categories" I had used in KAdressbook and the notes I had attached  to my
> mails. Already filed a bug report about this.
Well, maybe you messed something up when restoring the backup?
Like leaving akonadi config files in the system that are not contained in the backup, or forgetting to restore some files?

Could explain your problems now.

But this is not really related to this bug report.

> Apart from the above mentioned "Notas locales" there are no more AkoNotes
> resources present in my Akonadi resource list. The second collection one can
> see in the Knotes setup dialogue points to my local-mail directory.  And
> there is only a MailDir-Resource named "Carpetas locales" present in Akonadi.
Well, but why is it called "Notizen" then?
I think there's still something wrong with the Akonadi database.
But this sure sounds related to your restore from the backup.

Maybe try to run "akonadictl fsck".

Or maybe look at the database directly and remove it there, via akonadiconsole f.e.
If you need help with that better ask in the forum though.

This is a bug report, not a user support thread.

I don't think it makes sense to report a separate bug report about that maildir resource being shown in knotes though, as it is likely caused by an inconsistent Akonadi database.

> Well, for me everything works fine, at least for the moment. Hope to have
> made migration a bit easier for others with these remarks. And hopefully
> these problems get solved in future releases.
But this bug report is about not being able to create notes.
Not about the migration.

The OP even skipped the migration, and I can reproduce here that there is no default collection selected in that case.

Your remarks would be better suited to a forum or mailinglist thread I think, not a bug report for a completely different issue where you seem to have experienced something similar as well but because of completely other reasons.

---------------------------------------------------------------------------------------------------------------

So that it doesn't get lost between all that other text, I repeat again here what IMHO this bug report is about:
- _no_ default notes collection to store notes is set automatically when you skip the migration (on a fresh user account f.e.). The user has to set one manually.
- knotes silently fails when you try to create a note and there is no default collection set. It should tell the user about the problem, and maybe even show a dialog to pick one in that case.
Comment 22 Wolfgang Bauer 2014-07-30 15:27:53 UTC
I tried again now with a completely fresh User account, and knotes (4.13.3) did behave ok:
- when creating a new note, it opened a dialog asking in which collection the note should be stored (offering to set it as default as well)
- afterwards it also asked whether that collection should be enabled, so that its notes are visible.

It did show the same behavior when I copied over old (legacy) notes to a fresh user account and skipped the offered migration. I.e. when creating a new note, it asked where to store it and whether to enable that collection.

The second case definitely behaved differently when I tried with 4.13.2 (see comment#18 and comment#19), so either this got fixed in the meantime, or there's another factor causing the problem.

What I can still reproduce though is that creating new notes silently fails if the default collection doesn't exist any more, f.e. because the user deleted it in Systemsettings->Personal Information->Configure Akonadi Resources.
IMHO knotes should ask for a collection in this case as well.

Steps to reproduce:
- set a default collection to save notes to in knotes' settings
- make sure knotes works, i.e. you can create notes
- quit knotes (not sure if this is necessary but I did it in my test)
- open systemsettings->Personal Information->Configure Akonadi Resources and delete the akonotes resource that has been set as default in step#1
- start knotes again
When you now try to create a new note, nothing happens. You only will get the message 'Error during fetch:  "Collection xxx does not exist"' if you started it in a konsole.
It should show a dialog in this case as well.
Comment 23 Laurent Montel 2014-07-30 18:42:42 UTC
Git commit 45b952fc0ea2616e2619d445732f51d4d073f76a by Montel Laurent.
Committed on 30/07/2014 at 18:41.
Pushed by mlaurent into branch 'KDE/4.14'.

Fix Bug 335703 - cannot create a sticky note by knotes

Inform when collection is invalid. Now we can reselect new collection

M  +18   -3    noteshared/job/createnewnotejob.cpp
M  +1    -0    noteshared/job/createnewnotejob.h

http://commits.kde.org/kdepim/45b952fc0ea2616e2619d445732f51d4d073f76a
Comment 24 Christoph Feck 2014-08-18 13:23:45 UTC
Wolfgang, did the previous commit fixed the issue? Please add a comment or change the status of this bug.
Comment 25 Wolfgang Bauer 2014-08-18 15:06:27 UTC
(In reply to Christoph Feck from comment #24)
> Wolfgang, did the previous commit fixed the issue?
Well, I tried knotes 4.13.3 with that commit added, and it did show a warning dialog in case of an invalid collection, which also offers you to select a collection.
I saw the following issue though: the dialog to pick the collection was empty, and didn't actually show any of the existing collections/resources (in the case of no default collection set at all, i.e. on a fresh account e.g., this did work).
To be sure I wanted to retest it with 4.14 RC1, but wasn't able to until now.

I'd say let's close this bug, as creating a note does not silently fail any more. I will open a new bug report if I can reproduce that issue with the empty "pick collections" dialog in 4.14 final.
Comment 26 Wolfgang Bauer 2014-08-21 18:38:10 UTC
PS: This seems to work fine now in 4.14 AFAICT.
Comment 27 Wolfgang Bauer 2014-08-21 18:46:54 UTC
(In reply to Wolfgang Bauer from comment #26)
> PS: This seems to work fine now in 4.14 AFAICT.

Oops, sorry.
Everything's fine when there's no default collection set, a dialog appears to select the collection and shows all available collections as it should.

If there's an invalid collection set, an error dialog pops up asking whether you want to select a collection (unlocalized and with typos, I think that's fixed in master). If you choose "Yes", the dialog to pick the collection is empty.
As I said, I'm going to open a new bug report for this.

And I also can reproduce that knotes often doesn't remember the default collection when you set it in the settings, as mentioned in comment#10.
I will file this separately as well.
Comment 28 Christoph Feck 2014-09-14 12:03:20 UTC
Wolfgang, if comment #27 is still an issue, could you clarify in new bug reports?
Comment 29 Wolfgang Bauer 2014-09-18 10:43:11 UTC
(In reply to Christoph Feck from comment #28)
> Wolfgang, if comment #27 is still an issue, could you clarify in new bug
> reports?

Yes, that was my plan anyway.

Sorry for the delay, but here they are:
bug#339167
bug#339168
Comment 30 Wolfgang Bauer 2014-09-18 11:30:15 UTC
And another new bug I noticed, when verifying the other two problems: :-(
bug#339169

Sounds a bit related to what Knut Hildebrand described, but I did not see this in 4.13 at all, although I did try a few things there...