[Kde-pim] Newbie questions about Akonadi/KDEPIM codebase
Andras Mantia
amantia at kde.org
Wed Nov 14 12:57:38 GMT 2012
Hi,
Yury G. Kudryashov wrote:
> Hi!
>
> I'd like to fix some bugs in Akonadi/KMail2, but I'm completely unfamilair
> with Akonadi codebase. So, could you answer some questions, please?
Great initiative, I'll try to help.
> First of all, the bug I'd like to fix are:
>
> 1. https://bugs.kde.org/show_bug.cgi?id=305987
> "Could not create collection" when adding new top-level mailbox for IMAP
> account
>
> 2. (not found, will report). I have a 'Folder.Subfolder' on server, but
> have no 'Folder'. I have found no way to create 'Folder' without
> recreating the IMAP resource.
>
> Next, my questions.
> Q1. AFAICS, Akonadi::Collection is defined in kdepimlibs, but it is used
> in akonadi. Am I wrong? How does it work?
kdepimlibs has the interface towards the akonadi server. The server stores
itself the collections (folders) and items (mails in kmail case), but how it
does, that is not really important for an application developer. For that
(and for you) what is important is to use the classes from
kdepimlibs/akonadi. So just used Akonadi::Collection. When a collection
related task is performed, the kdepimlibs code translates that task to an
akonadi command (somewhat similar to IMAP commands), that the server parses
and performs the operation.
> Q2. How should parts of KDE-PIM (resource, server, kmail) operate while
> creating a folder? Which signals are sent/slots are called?
Let's take the IMAP case. We have an action for the UI. This can be either
our own action or one of the already predefines actions from
kdepimlibs/akonadi/standardactionmanager.cpp (or
kdepimlibs/akonadi/kmime/standardmailactionmanager.cpp). I don't have the
code in front of me, but I think for folder creation the standard action
manager is used. Anyway, the code would be similar in the slot connected to
the action's triggered() signal, namely to create an
Akonadi::CollectionCreateJob. As written above that sends a command to the
akonadi server to create the collection. The server creates that in the
cache and notifies the resource where the collection belongs to create
itself in the real place as well. In case of IMAP this would be the IMAP
resource (kdepim-runtime/resources/imap) that needs to create the folder on
the IMAP server using IMAP commands (it uses kdepimlibs/kimap for that).
The resource does it in the collectionAdded method, that is called
automatically when new collection are added to the akonadi cache.
I hope this explains what you want, for more exact details look up the code
itself.
>
> Q3. WRT bug#305987, the newly created collection is shown in
> akonadi-console but is not visible in kmail. How is it possible? Where can
> I find the relevant information?
This is something you need to debug. KMail might not show because of wrong
flags, wrong mimetype, not being subscribed to it, some other bug, or I
don't know why. :) The folder tree is based on
kdepimlibs/akonadi/entitytreeview that shows the content of an
entitytreemodel (ETM in akonadi slang). The ETM and the view is initialized
somewhere in the KMail startup code.
> P.S.: Sorry if teaching me is harder than fixing the bugs yourself ;)
Np. The cannot create folder bug was "attacked" a few times, but the problem
with it was mostly that it depends on the imap server used. Sincerely I'd
think the bug is somewhere in the IMAP resource/KIMAP library that cannot
handle correctly some of the servers out there, but of course this is just
an assumption and the real bug can be something else.
In any case i'd enable imap debugging
(http://techbase.kde.org/Projects/PIM/Akonadi/Debug_IMAP) and try to see if
everything is fine in the communication.
Andras
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list