Thursday, August 8, 2013

FolderView update

Hello planet,


Well I think it's time for a small update on porting the FolderView applet to QML.

First of all, I've dubbed it QuickFolder for now, this is the name under which it exists in  the kde-baseapps repo. The reason is that both codebases need to coexist for a while for me to carry over the old (existing) code to the new applet.


The repository I'm currently working in is a personal clone, and can be found via quickgit.kde.org:


http://quickgit.kde.org/?p=clones%2Fkde-baseapps%2Fisemenov%2Ffvqml.git


Branch plasma/isemenov/qml.


Now my impression of this work is that it's quite, I'd even say *very* challenging at times, since for me, QML is an unknown technology and I'm lazy to thoroughly read through all the docs (of which there are lots, as usual). So big thanks goes to all the people who help me out on irc in #plasma and #qt-quick.


For now we are sticking to QML1, well there is no solid reason that I could name out of my head, although the QML1 choice may be subject to change in the future.


So for now, we've done three milestones, even if minor per se:

  • get the view to show a model
  • get the view selection based on applet/containment to work (different implementations required, for a certain reason)
  • get the selection to work (click, shift, ctrl selection implemented, rubberband / shift in a free layout to be done yet, a lot of fun to be had)
  • and, today, we finished the basic context menu implementation, i.e. got it to show where we need it to.

Now the context menu could be done in QML components easily, but unfortunately we depend on a specific menu implementation - KonqPopupMenu, which is a C++ menu library. Thus we are forced to stick to that, and come up with a solution to show the menu at the correct coordinates.


Technical - the menu works like this: for a delegate that the user right-clicks, we pass that delegate in a QVariant to the C++ side, and then perform some coordinate mapping magic to get the menu to show at the said delegate's position. Then we offset the menu a little to show it right under the cursor, as common.


While these achievements may sound minor, for me, who hasn't done any solid programming from the ground up for a long time, this is a lot of fun and also challenge :)


Acknowledgements go to Eike Hein (Taskbar is a great reference), all the Plasma QML crew, and folk from #qt-quick (esp. jpnurmi).