Akonadi Trashhandling

End of February I attended the annual pim meeting in osnabrück for the first time. There I started the akonadi trashhandling, which I need for MindMirror. The idea is to have a uniform way of handling trashed/deleted items in akonadi.

The general idea is to have to ways to separate trash from you normal items:

  • Mark them as trash but keep them in the same akonadi collection:
    This would i.e. allow a resource to map the deleted flag to i.e. the imap deleted flag.
    Of course, if the resource doesn’t support that, all items will remain visible for remote locations (i.e. gmail).
  • Mark them as trash and move them to a separate collection:
    This can be configured on a per resource basis, and allows to collect trash in i.e. another resource.
    This allows that trash is effectively hidden also to synchronised resources, but the downside is that your trash is not available on remote locations (except if you use another resource with sync as trash location).

Of course it is up to the application to use either way, but it should be quite easy to add trash support to applications, including standard actions to move to trash and restore from trash.

Heres what it consists of and what it can do for you(developers):

TrashJob
Marks an entity as trash with the EntityDeletedAttribute and moves it to a configured trash collection (if configured).

The default behaviour is to move the item to the trash collection which is configured in TrashSettings. If this trash collection is not available, the entity is kept in place.

All sub entites of a collection which is marked as trash are also marked as trash, and get the parent collection of the collection which was marked as trash as restore collection. This ensures that it is possible to restore items from trash, which were originally moved to trash together with the parent collection.

The job has also an option to automatically delete items which are already marked as trash.

RestoreJob
Restore the entity from the trash collection to the original collection and remove the EntityDeletedAttribute.

By default the RestoreJob tries to move the entity back to the original location, which is saved in the EntityDeletedAttribute.
If this collection is not available anymore, it tries the original resource root as fallback, if also not available it aborts.

For this case it is possible to configure a special restore collection on the job, to which the item is restored.

If the move was successful the EntityDeletedAttribute is removed from the entity (and from all subentities).

EntityDeletedAttribute
Marks the entity as deleted and stores the restore collection/resource.
Resources could map this flag to an appropriate flag as the MarkAsDeleted flag in IMAP.

TrashSettings
Store a trashcollection for a resource.

In the future further trash related settings, as the time before the janitor agent deletes items could be stored here.

TODO: atm. the settings are never removed. Even if the configured resource or trash collection is removed (not sure if this is ever done).

TrashFilterProxyModel
Either shows all items with the EntityDeletedAttribute or hides all entities with the EntityDeletedAttribute.
It is using a KRecursiveProxyModel, so also trash items which are in a non trash collection are shown in the trash.

StandardActions
Provides 6 standard actions:

  • MoveItemToTrash
  • MoveCollectionToTrash
  • RestoreItemFromTrash
  • RestoreCollectionFromTrash
  • MoveToTrashRestoreCollection
  • MoveToTrashRestoreItem

While the first 4 are trivial, the last two provide a single action, which changes its behaviour depending if the EntityDeletedAttribute is set or not. As it doesn’t make sense to restore entites which are not in trash or move entities to trash which are in trash, I believe it is the most common usecase and what I use myself.
All new actions need the EntityDeletedAttribute fetched in order to work properly.
I had to add some bits to the internal structure of the standardactionmanager to make it possible to change description/icon/etc. for a single action, everything existing should continue to work as expected though.

Trash Janitor Agent (TODO)
Goes trough all collections, and deletes items after a configured period of time, if they are marked as trash.
This configuration is in TrashSettings on a per resource basis, but could be overridden by a configuration in the EntityDeletedAttribute

This is not work in progress atm. but more a concept. I also don’t plan to add this anytime soon, so feel free to do it if you need it now, I’d be happy to help.

Announcing Project MindMirror

So MindMirror is the Project I’ve been working towards for the last couple of months.
Steven already mentioned it in the report from the kdepim meeting in osnabrück, I named it notetaker back then as I couldn’t decide for a name, but here’s finally my first blog post about it.

History/Motivation

I was always unhappy with the available solutions for taskmanagement and notetaking. I tried various online tools (which just don’t cut it if you’re sitting in a train…) like evernote, toodledo, doit and some others. After figuring out that online tools are definitely not for me, I decided looking for desktop apps.

Chandler and KJots were the ones I liked the most, KJots being super simple and fast for notes, Chandler has bit more to offer (including todos) but is not really fast, and doesn’t integrate with any webservice.

So I figured out already two years ago that I will have to create my own app, to help my ridcolously bad memory and my habit of being as unorganized as possible.
What I really wanted was an application which does not differentiate between notes and todos, as the frequently evolve from one to another (at least in my world). I wanted a place where I can store my thoughts, todos, events without having to think where it belongs.
Basically just a place where I can dump everything, and retrieve it later on as needed.

Further I wanted it to integrate well with existing solutions, such as KOrganizer, GMail, Evernote, etc.

With akonadi and nepomuk slowly evolving I was finally given the tools to start this task.
So I started last year the project MindMirror.

While the inital development started at a quick pace, I soon faced difficulties in the akonadi and nepomuk internals which occupied me for quite some time.
I spent a lot of time hacking on QProxyModels (the ETM, my own section model, …), also a conceptually proper Nepomuk integration was not easy and is still work in progress. Further I got sidetracked by the trashhandling implementation in akonadi (not yet in master), after attending the kdepim meeting, but more on that in another post.

Now that the needed fixes and additions slowly make their way into master, I feel that I can start spreading the word about this new tool.

MindMirror

MindMirror is supposed to be an interface to store everything you have to remember in form of Notes, Todos and Events. It is designed to be an additional Interface to the calendarview of KOrganizer and not to replace anything.
I try to keep the UI minimalistic, far from the full blown Interface of the KOrganizer Incidence editor. This means also ignoring some features, at least for now (I’ll probably add the option to open the fullblown editor).

Idea is, that a minimum effort is needed to enter something. You can simply create a new item (note/todo/event) and start typing right away, without another click needed. The focus will automatically move to the right fields to minimize user interaction. The UI is reduced to the minimum: title, text, an (optional) due date and a status are all that is usually needed IMHO. The status is the simplified version of the 10 priority levels a task can have in korganizer (States being Later/Now/Done). This gives some simple priority management, which is actually useful.

Organizing/Workflow

So the idea is, that you don’t have to organize the information when you enter it but rather later on (i.e. end of the day), if organisation is needed at all. This avoids breaking your workflow. To further improve this i.e. a krunner can be written so you don’t even need to open MindMirror.

For simple, short term notes, fulltext search and a list of the latest created notes should be enough to find your item again (I hope at least).

If you’re working on a long term project thought, it can be useful to organize your items in a treelike structure, which is typically solved using folders and alike.

MindMirror is not much different, you can organize your items into “Topics” (which can have subtopics and so on). The main difference to a folderstructure is, that you can add an item to several topics at the same time (the UI-parts are still missing currently), which should allow for a little more flexibilty.

Also the organisation of items is done through nepomuk, meaning that the “Topics” are actually pimo:topics and the whole structure is stored in nepomuk. Of course it is also possible to tag you items in MindMirror, so I hope this allows to fill Nepomuk with some more useful information.

With the means of nepomuk it is also possible to attach/link arbitrary documents, emails, to your notes/todos, which gets us one step closer to have everything at hand to fulfil a task.

When you’re done editing an item, don’t even bother saving, everything is already saved as you finish typing.

UI

 

The Userinterface consists of a single view, with the left pane for control/sorting, the listview in the middle for display of the items, and the editor on the right. I’m not a big fan of interfaces consiting of many tabs and different windows, so I try too keep everything together.

The “Views” which you can see on the topleft control mainly the organisation of the items in the listview:

  • Work Layout:
    This layout is for crossing of items on your todo, list. Only uncompleted todos are shown and your notes are there to support what you’re doing.
  • Organize:
    The organize layout shows all items sorted by date. It’s there to organize your items.
  • Upcoming:
    A list of upcoming events/todos

In the custom view you can control the sections and the shown items manually.

The listview in the middle groups the items in sections, currently we have there ItemType (Todo/Event/Note), Status (Done, Later, Now), and Date. If I manage that items can appear in multiple sections we will have some more possibilities like:

  • by subtopics of the current topic
  • by tags

While the listview already supports showing the todos in their hierarchy, this part is still very buggy and needs quite a bit of work first.

The editor is a normal KRichTextWidget, which allows you to enter RichText. Below you can see some toolviews, most interesting is probably the “Context” view which allows you to relate notes/todos/files/etc. to this item.
Instead of using a tabbed interface or windows when opening notes from there, the breadcrumbs on top are used to navigate back.

I don’t plan to add much more to the UI, as this should be all which is needed. There probably will be a couple of changes, and the UI could use some designer’s love (It’s a bit too grey atm.), but from a feature point of view thats more or less it.
I’ll probably add a fullscreen-mode to the editor and a search view for some more searching options though.

Current State

While it is not yet releaseable and I plan the first release earliest with KDE 4.8 (because of the required dependencies), I already use it in my daily notetaking and todo management (i.e. I drafted this blogpost in MindMirror), and I’m quite happy with the result.

There is still some work to be done until it’s fully stable though.

Integration / Collaboration with other applications

Using akonadi for datastorage, namely the akonotes resource for notes and the ical resource for calendar items, you can have the same items in KOrganizer, KJots and MindMirror (and of course every other application which uses akonadi).
This is of course key for event and todo management, as MindMirror does not have it’s own calendarview: KOrganizer is the calendarview.

I do think akonadi is the way to go for data which should be synchronisable to cellphones, webservices, etc.
Nepomuk is also good candidate, but it makes perfectly sense to separate the synchronisation part in akonadi
(maybe as a long term future nepomuk could completely encapsulate akonadi, but thats another story).
Anyways thats why I do not plan to intergrate with applications not using akonadi (in short term).
Since the nepomuk feeders feed the data from akonadi to nepomuk, most of the data is also available trough nepomuk (which might be a way to work with other apps using nepomuk only).

Of course I looked at many other programs like basket, semnotes, kjots, korganizer, zanshin, etc. to see if a couple of modifications would bring my to my target, but I don’t think so. Neither interface wise nor functionality wise any of those programs suits my needs, although all of them have some very nice ideas.

Future Plans

Apart from the obvious plans like having an awsome ui and being super userfriendly, there are also some plans for akonadi in general:

  • Inline pictures in notes
  • Synchronisation plugin for evernote (akonotes resource)
  • krunner (I read there is already something cooking in the zanshin project)
  • Search View with an additional list of item (files, emails, etc.) related to the search (aka. “Contextview”)

I’m sure I won’t run out of work =)

Codebase

While the codebase is generally in an ok state, it needs some cleanup and documentation.
There are still some classes with names that don’t really make much sense anymore, but that will be fixed.

Also for building some kdelibs code is needed (trashhandling and some etm fixes), which is partially only available in my private repos. Anyways, if anyone really feels like building, contact me, but be prepared =)

The code is currently here.

Also, contributions are, as always, more than welcome =)

Hello Planet

Hey,

Since I’m new to the planet, I’ll start with an introductionary post.

This is a long postponed step to start my own blog, so it is finally publicly visible what I’m up to.

My name’s Christian Mollekopf, but I tend use Chris as an abbreviation to avoid confusion that I’m christian in terms of the religion (Use whatever you like though, as long as you know what you mean =). I live near Zurich, Switzerland, so I’m native (swiss-) german speaking.

While I’m currently finishing my first year for the bachelor of computer science, there is still plenty of time to hack on KDE.

After being a KDE user for a bit, my first real contribution was the taskbar rewrite back in 2008. After finishing the major part of the work I got tangled up in the UI bits, got frustrated and basically took a 2 Year break from the development (with a couple of retries, but nothing successful).

Still, I kept following the ml and also kept my devel build up to date, because I always knew that I want to get back to helping to shape the most awesome and innovative desktop environment I know. Of course also not last because working with the KDE guys was a tremendous learning experience for me. Aaron Seigo basically mentored my little project back then, and I often think I learned more in this project than the school has taught me so far.

So while still occasionally trying to get D&D nicely working for the manual grouping in the taskbar, I eventually gave up on it when QML appeared on the horizon and I figured it would be easier to implement it in a QML plasmoid than the currently existing buggy QGridLayout.

Anyhow, I needed to find a new niche for my development, and with akonadi and nepomuk  slowly building up, two new very interesting technologies  started to mature.

Since I tend to forget basically everything, and I’m a big fan of todo lists and organizers (in theory…), but never really got around using them, because I don’t like writing on paper (can’t sync to my phone and I can hardly read what I write=), and all the tools I found suck in one way or another (at least for the todolist and notetaking part), I figured eventually that I will have to develop my own Todo-Notetaking-Organizer hybrid. Obviously being able to sync to various webservices, so I can sync to my android phone (via gmail and evernote for instance), and fulltext indexing of all items was also on the wishlist, so I was really looking forward to the upcoming akonadi and nepomuk technologies which provide the perfect pillars for such a project.

So when I started my studies last year, I also started to get really bored (surprise!) and started finally my long planned pet project…

I’ll keep the interesting bits for the next entry =)

Hello world!

Welcome to WordPress.com. After you read this, you should delete and write your own post, with a new title above. Or hit Add New on the left (of the admin dashboard) to start a fresh post.

Here are some suggestions for your first post.

  1. You can find new ideas for what to blog about by reading the Daily Post.
  2. Add PressThis to your browser. It creates a new blog post for you about any interesting  page you read on the web.
  3. Make some changes to this page, and then hit preview on the right. You can alway preview any post or edit you before you share it to the world.