How to get Akonadi notes onto Plasma?

Marco Martin notmart at gmail.com
Mon Oct 26 11:38:06 CET 2009


On Monday 26 October 2009, Sebastian Kügler wrote:
> Hey Steve,
> 
> On Friday 23 October 2009 20:01:17 Stephen Kelly wrote:
> > Any more thoughts on the plan and intentions above?
> 
> What you probably want is to be able to display interesting collections of
>  notes, for example an itemview with notes with some specific tag, and
>  being able to display notes separately as individual applets. I'm not sure
>  if extenders is what you actually want here. Slapping 20 extenders on top
>  of each other is visual overkill. Also, dragging an extender from a group
>  (popup applet in the panel, for example) should probably not remove it
>  from that list.

it depends how big is usually the data set in real use case scenario i 
suppose, but yes, an itemview where is possible to drag one outside 
transforming in actual notes applets sounds sensible (closing them would 
delete the note from akonadi? just delete the applet?)

> Here's what came to my mind, partly based how I've done things in Lion
>  Mail, including question marks I've run into...
> The most flexible way to display a collection of notes is using the models
>  akonadi already provides, that gives searching and sorting goodness. Think
>  for example of a listview of (expandable) notes on your desktop. You might
>  have separate "notes collection" applets there, or on different
>  activities. Notes should be draggable. The nicest way I've found to do
>  that was using akonadi:/ URLs pointing to an item. This way, you can just
>  drag and drop notes, also across applications (think of dragging a note
>  from kontact/kjots onto plasma). A quick way to create such an applet is
>  do use a Plasma::PopupApplet and putting a (QWidget-based) listview onto
>  Plasma using a QGraphicsProxyWidget. Longer term, it probably makes more
>  sense to use Plasma Widgets and QGraphicsWidgets for that, but ...
> 
> Something I've been wondering, and maybe someone here shed some light on
>  it, is how we can generally map models onto Plasma. Is creating separate
>  QGraphicsItems on a QGraphicsScene smart? I've heard that QGraphicsView is
>  optimized for many items, but slapping 5000 email widgets into a
>  popupapplet (most of them never ever visible) just doesn't sound right to
>  me. I think the itemviews used in kmail re-use the delegates, right?

the standard qt itemview has a single instance of a delegate, that gets used 
to paint all items. that saves memory but is also a limitation, since any rich 
input with it is pain(tm) and also one ofthe reasons itemviewsng is being 
developed.

the way to go (and also what itemviewsng does afaik, even if i didn't really 
looked at the code) is:
-use a qgraphicswiget per item
-put them in a clipped parent
-have actually instanced only the qgraphicswidgets needed to fit the displayed 
part, plus a bunch offscreen ones in all scrolling directions, to have smooth 
scrolling
-when the view scrolls, recycle the ones that are gone too much off screen and 
put on te other side, miking them load the data of the proper item

this way it takes a bit more memory than usual itemviews but not that much.

now, doing that ourselves is an hell of a job, and i'm still confident some 
day we will be able to use itemviewng
the problem is that we now have several half baked reimplementations of that, 
one totally item based in the netbook sal, one model based in the mediacenter, 
but none of them do the item recycling.

now, i was looking into adding also the possibility to the sal one of hooking 
a model into it (since has slighltly better layout and keyboard navigation), 
if it's -really- needed, but i really really hate to export it ever, since i 
want to throw it away mercilessy the very same moment i can :D

Cheers,
Marco Martin


More information about the Plasma-devel mailing list