Bug 301088

Summary: Cannot delete an IMAP folder, although it can create folders
Product: [Applications] kmail2 Reporter: Octavian Petre <octavsly>
Component: foldersAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: amantia, thomas
Priority: NOR    
Version: 4.9.1   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 4.10.2
Sentry Crash Report:
Attachments: akonadi debug output

Description Octavian Petre 2012-06-03 08:04:19 UTC
kmail2 cannot delete IMAP folders while creating one is no problem. 

Folders can be deleted with another e-mail program such as thunderbird.

Reproducible: Always

Steps to Reproduce:
1. Create a folder on in an IMAP account
2. Try to deleted
3. Operations seems to be successful but the folder with come back within a second
Actual Results:  
The folder cannot be deleted.

Expected Results:  
The folder should be deleted.
Comment 1 hsc 2012-09-19 17:26:54 UTC
reproduceable on kmail2 4.9.1 using kubuntu packages
Comment 2 Thomas Tanghus 2013-01-05 21:03:25 UTC
Created attachment 76217 [details]
akonadi debug output

Confirmed on Kubuntu 12.10 with KDE 4.5.5
When trying to delete a folder in a folder here INBOX.Lists.boxeehacks - akonadi complains it cannot be found, and reinserts it in the list:

NotificationManager::notify ( Collection (144, .boxeehacks) in collection 82 modified parts (uidnext, collectionflags, uidvalidity) )
NotificationManager::notify ( Collection (144, .boxeehacks) in collection 82 modified parts (collectionquota, imapacl, timestamp, imapquota) )
NotificationManager::notify ( Collection (144, .boxeehacks) in collection 82 removed )
AgentBase(akonadi_imap_resource_1): Failed to find the folder to be deleted, restoring folder list.
NotificationManager::notify ( Collection (145, .boxeehacks) in collection 82 added )
NotificationManager::notify ( Collection (145, .boxeehacks) in collection 82 modified parts (uidnext, collectionflags, uidvalidity) )
NotificationManager::notify ( Collection (145, .boxeehacks) in collection 82 modified parts (collectionquota, imapacl, timestamp, imapquota) )
Comment 3 Thomas Tanghus 2013-01-05 21:05:37 UTC
(In reply to comment #2)
> Confirmed on Kubuntu 12.10 with KDE 4.5.5

I mean 4.9.5 of course ;)
Comment 4 András Manţia 2013-03-28 21:45:47 UTC
Git commit d8fd7a28e7d6d8a89dd398311d423118ff529718 by Andras Mantia.
Committed on 28/03/2013 at 22:45.
Pushed by amantia into branch 'KDE/4.10'.

1) Fix creation of new toplevel folders (and all its subfolder): it used to generate a broken remote id and separtor ("i") causing weird problems.
2) Make sure toplevel imap folders are shown immediately, without a need to sync the account (workarounds an ETM bug 291143)
3) Warn the user if creating a folder failed on server-side and remove the folder locally. Otherwise if creation failed, it was impossible to create again a folder with the same name,
as it was already a folder with that name in the akonadi cache...
4) Make sure deleting folder "foo" doesn't deleted all folders starting with "foo" as it did before.
5) Just fix folder deletion. :) It could fail in certain cases.
6) Fix and adapt the tests.

Reporters of closed bugs: if you can still see the bug in 4.10.2, please reopen and state the details.

REVIEW: 109276
FIXED-IN: 4.10.2291143291143
Related: bug 312435, bug 305269, bug 292418, bug 305987, bug 291143

M  +6    -1    resources/imap/addcollectiontask.cpp
M  +1    -1    resources/imap/changecollectiontask.cpp
M  +16   -0    resources/imap/imapresource.cpp
M  +7    -0    resources/imap/imapresource.h
M  +11   -8    resources/imap/removecollectionrecursivetask.cpp
M  +1    -0    resources/imap/removecollectionrecursivetask.h
M  +10   -0    resources/imap/resourcetask.cpp
M  +2    -0    resources/imap/resourcetask.h
M  +4    -1    resources/imap/tests/dummyresourcestate.cpp
M  +7    -5    resources/imap/tests/testremovecollectiontask.cpp

http://commits.kde.org/kdepim-runtime/d8fd7a28e7d6d8a89dd398311d423118ff529718