Bug 303117

Summary: starting kmail2 for first time does not create drafts folder
Product: [Applications] kmail2 Reporter: Martin Koller <kollix>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: christiandehne, ht990332, modellbaukeller, montel, pancho.s, shahin.azad
Priority: NOR    
Version: 4.9.4   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 4.10.2
Sentry Crash Report:

Description Martin Koller 2012-07-06 15:38:10 UTC
I have KDE/4.9 compiled from source and start kmail for the first time with my test user
(removed .kde4 .local .config from below ~ before starting the KDE session inside a Xephyr Xserver).
kmail creates "Local Folders" and below are 3 folders:inbox, outbox, sent-mail
and another top-level folder "Notes".
But no "drafts" folder.
When I now click on "New mail", enter a test subject and some text, close the composer and select "Save as Draft" then an error dialog shows up telling me:
Failed to save the message: Unknown collection.



Reproducible: Always
Comment 1 Martin Koller 2012-07-06 15:45:23 UTC
I just found the following sentence in kmails help page:
"Invoking KMail for the first time creates a folder called Mail in your home folder. This folder contains the initial folders (inbox, outbox, sent-mail, trash and drafts)."

Beside that it does not create a folder called Mail in my home folder but a folder called 
~/.local/share/local-mail/
it does not contain trash and drafts
Comment 2 Laurent Montel 2012-07-07 10:04:43 UTC
Can't reproduce. Don't know.
I started a new user.
but do you stopped akonadi before to remove all ?
Comment 3 Martin Koller 2012-07-07 10:29:13 UTC
Yes, no process is running for my testuser.
Let me explain my setup:
I'm running a normal KDE session as user koller but I want to test the self-compiled KDE stuff (a different version than the session from user "koller"). In a konsole I "su - kdetrunk" to a new testuser.
Under this user "kdetrunk" I'm testing now this KDE/4.9 within a Xephyr session.
The self-compiled KDE is installed under /home/KDE4

I start everything with this script and the "clean" argument:
===========================
#!/bin/sh

#clean up previous KDE4 stuff
if [ "$1" = "clean" ]
then
  cd
  rm -Rf /tmp/kde-kdetrunk /var/tmp/kdecache-kdetrunk .kde4 .config .local .qt .strigi .xine
fi

# no KDE3 in PATH
export PATH=/home/KDE4/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin

Xephyr :4 -ac -screen 1280/278x800/200 -nolisten inet6  -nodri -noxv -fakexa -name TEST &
export DISPLAY=:4
echo "display set to:" $DISPLAY
sleep 5
startkde
===========================

If you want I can check other things,debug flags, attach a debugger etc.
Just tell me in which source the directories should be created
Comment 4 Shahin Azad 2012-08-21 08:52:26 UTC
Same problem with Arch Linux and KDE 4.9 (3.4.9-1-ARCH).
Comment 5 modellbaukeller 2012-09-12 08:37:18 UTC
Same issues here with 4.9.1 as mentioned above; i've tried several test-users, problem stays the same.
Comment 6 Christian Trippe 2012-11-18 21:19:53 UTC
Problem still exists with 4.9.3 on openSUSE.
Comment 7 Bernd Oliver Sünderhauf 2012-11-24 21:00:41 UTC
Same problem on a new German language Chakra 2012.10 install with KDE 4.9.2 (in the meantime updated to 4.9.3).

The language is relevant, because kmail surprisingly created the following folders in ~/.local/share/local-mail:
- Postausgang
- Posteingang
- .Posteingang.directory
- trash
- .trash.directory
- Versendete Nachrichten
A folder "drafts" (or "Entwürfe") is missing.

Actually I don't think it's a good idea to use localized names for the standard folders, at least not in the file system, but that might a different issue.
Comment 8 Martin Koller 2012-12-25 18:49:21 UTC
I tried again with a new user on openSuse 12.1, KDE 4.9.4, german language
Simply logging into KDE for the first time and start kmail
I still have this situation: 

Below ~/.local/share it creates a folder "akonadi_maildir_resource_0" with the following subfolders ONLY:
Postausgang
Posteingang
Versendete Nachrichten

(in english this would be: outbox, inbox, sent mails)
Comment 9 David Faure 2013-03-02 21:18:36 UTC
Git commit 60b1b80f5749b08d63d34b9049a80c9433aaa799 by David Faure.
Committed on 02/03/2013 at 22:18.
Pushed by dfaure into branch 'KDE/4.10'.

The overuse of the [ ] operator on QHashes, lead to storing invalid collections.
Related: bug 285532, bug 307016
FIXED-IN: 4.10.2
REVIEW: 109208

M  +7    -23   akonadi/specialcollections.cpp

http://commits.kde.org/kdepimlibs/60b1b80f5749b08d63d34b9049a80c9433aaa799