Bug 168544

Summary: local inbox is not shown when starting with clean install
Product: [Unmaintained] kmail Reporter: Arnout Boelens <a.m.p.boelens>
Component: folder listAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: giovanni, jjm
Priority: NOR    
Version: 1.10.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Arnout Boelens 2008-08-06 20:42:05 UTC
Version:           1.10.0 (using 4.1.00 (KDE 4.1.0), Debian packages)
Compiler:          cc
OS:                Linux (i686) release 2.6.25-2-686

When starting with a clean install, the folder ".kde4/share/apps/kmail/mail/inbox" does not show up in the folder overview. It seems to related to missing .inbox.* files. When I took another folder, renamed it to "inbox" and also renamed the corresponding .* files, the inbox folder showed up.
Comment 1 Jonathan Marten 2008-08-07 09:43:32 UTC
Confirmed with current trunk.  When starting with the directory ~/.kde/share/apps/kmail/mail and the file ~/.kde/share/config/kmailrc nonexistent,

.kde/share/apps/kmail/mail/inbox
.kde/share/apps/kmail/mail/.inbox.index.ids
.kde/share/apps/kmail/mail/.inbox.index

are created (after cancelling the setup wizard).  However, the "Local Folders" branch in the folder tree only shows outbox, sent-mail, trash, drafts, templates.
Comment 2 Jonathan Marten 2008-08-07 13:25:32 UTC
Nothing to do with the index files, they are created correctly.

The problem stems from commit 702414, "don't initialize favorite folder view with hidden/unused inboxes" - if the inbox is empty and has no accounts associated with it then it is hidden.  This is intended behaviour.

Unfortunately the folder list is not updated if a new account is added that delivers to the inbox, although it does happens when a new message arrives.  This can be taken care of with:

  connect(kmkernel->acctMgr(), SIGNAL(accountAdded(KMAccount *)),
          this, SLOT(slotUnhideLocalInbox()));

in KMFolderTree::connectSignals().  There is a further complication in that when this signal happens, the account's destination folder has not had the account added to it so the inbox still does not appear (the last test in FolderTreeBase::hideLocalInbox() fails).  This can be fixed by doing:

    KMFolder *folder = account->folder();
    if ( folder && !folder->hasAccounts() ) account->setFolder( folder, true );

in AccountManager::add(KMAccount *account).

Not sure if the above has any unwanted side effects, but have tested the changes and they seem to work.
Comment 3 Jonathan Marten 2008-08-08 10:04:40 UTC
SVN commit 843864 by marten:

Set the destination folder for a new account, so that the inbox will appear
if it was previously hidden.

Does this need to be backported to 4.1 branch?

BUG:168544


 M  +4 -0      accountmanager.cpp  
 M  +3 -0      kmfoldertree.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=843864
Comment 4 Giovanni Venturi 2008-09-02 09:45:31 UTC
This regression is also in kmail 1.9.10 released with kde 3.5.10. Can you fix in the 3.5 branch and then close definitively this bug? Thank you.
Comment 5 Jonathan Marten 2008-09-02 20:22:23 UTC
SVN commit 853907 by marten:

Backport of trunk commit 843864 (sorry, missed the 4.1.1 tagging deadline):

Set the destination folder for a new account, so that the inbox will appear
if it was previously hidden.

CCBUG:168544


 M  +4 -0      accountmanager.cpp  
 M  +3 -0      kmfoldertree.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=853907
Comment 6 Jonathan Marten 2008-09-02 20:38:43 UTC
Unlikely to be ever fixed in the 3.5 branch.  There will probably be no further 3.5.x releases, and the kdepim/kmail maintainers have decided that the branch is to be frozen with no further commits.  See
http://lists.kde.org/?l=kde-pim&m=122019733607058&w=2
Comment 7 Giovanni Venturi 2008-09-02 22:59:22 UTC
I understand, but this is a grave regression. Disappear of the inbox folder is 
the worst thing that can happen... Think for a new user that see KDE 3.5.10 for the first time. What does he/she has to think? Better use Thunderbird? I will try to fix this bug myself if it's not to difficult and I will commit it.
Comment 8 Giovanni Venturi 2008-09-02 23:04:10 UTC
I understand, but this is a grave regression. Disappear of the inbox folder is 
the worst thing that can happen... Think for a new user that see KDE 3.5.10 for the first time. What does he/she has to think? Better use Thunderbird? I will try to fix this bug myself if it's not to difficult and I will commit it.