Monday, February 20, 2012

FolderView Fixes Part I

Hello fellow KDE devs and users!

Let me present myself. I'm a 3rd year student doing a course in IT and a long time KDE user and RedHat fan. I've been with KDE ever since I got my first computer some 5 years ago, that is, KDE 3.5 on SUSE then some Fedora Core, probably 7, and was one of the first users to install KDE 4.0 on their production system - the source was the famous Fedora 9 KDE 4.0 Live CD. I still remember that early morning in spring when I got up to install F9 (or was it FC9?) onto the computer. Since then I've been with Fedora and KDE 4.

I think I had even used Gnome with FC8 for some time. The wallpaper that changed its color tint during the day, just like the Google Phatasea theme (the best one - why did you kill it, Google?), was the best thing I've even seen in Linux. Maybe I need to try to reproduce that with the modern Plasma wallpaper technology.. sadly, they dropped it with FC9, I think.

At the end of January 2012, I got a sponsorship from Blue Systems GmbH ( and started working on the FolderView Plasma applet. The FolderView applet allows you to place a folder on the desktop for quick access when used as an applet, but most importantly, it allows you to use the desktop the conventional Windows way - that is, as an icon store. The former is pretty useful when working on a certain task to have the necessary files handy, whereas the latter is absolutely crucial for those distros that want to embrace a more traditional desktop paradigm, for example, in order to aid Windows users in their migration to the Linux OS, or to create a KDE3 feel. Either way, it is really important to have this Plasma component as polished as possible - it is the first thing the user see on login, and if they come from Windows, FolderView may well be the first Linux desktop component they see in their entire life.

Now you may be surprised here, but it has a lot of bugs!

Well, used to.

I'm glad to tell you that more than half of the FolderView bugs have been fixed by now. What remains is mostly containment and multi-screen bugs, and those will have been fixed for 4.8.1.

Here goes the list of the fixes with comments where appropriate:

  • (#268641) Automatically enable / disable selection marker - if KDE is set to double-click, no need for the "+" sign
  • (no bug #) If KDE is set to double-click, shrink the icons only once on double-clicking them
  • (no bug #) On double-clicking an icon with KDE set to double-click, repaint the icon after shrink (icons used to stick) - debugged by me, final patch and commit by aseigo
  • (#291140) Some configuration related problems where the FolderView would not apply settings on the fly when used as a containment - aseigo had broken that, I made him fix the thing back ;)
  • (no bug #) Account for the SVG margins in IconView::itemSize() - when the text width is used to calculate the item frame width, this is noticeable
  • (no bug #) kdelibs/plasma/widgets/iconwidget.cpp - same as (2), but for the Icon widget
  • (#247144) Fix the 1px offset in air/widgets/viewitem.svgz - now that was one hell of a bug!
    I spent 1.5 days looking for the source of the issue. I quickly narrowed it down to the wrong size of the "normal-right-border" element in viewitem.svgz (the frame you see around the FolderView icons), which was 9px wide as opposed to all the other border elements (8px). Now what? Marco Martin found out that the PNG of the shadow for that element was incorrect and 9px wide instead of the required 8px. And I was digging through the source of the Plasma::FrameSvg class. All I needed was in fact to get an SVG expert  to have a close look at viewitem.svgz. Thank you a lot Marco!
  • (#211002) Make the popup view inherit the parent IconView sorting & filtering settings
  • similar to #211002 Make the popup view inherit the parent icon view selection marker settings
  • (#290694) (Part I) Correctly handle Plasma theme change - thanks goes to Marco again, he noticed there was a slot name collision when I pointed him to the relevant slot in the FolderView class, though Marco still insists it's my bugfix ;). When the applet is on the desktop, the outer frame will be immediately repainted on Plasma theme change, just as it should be
  • (no bug #) Apply icon flow settings in configChanged() - icon flow settings will be applied when you click "Apply", as they should be
  • (no bug #) Read icon size settings in FolderView::init() - don't lose the custom icon size settings between plasma restarts
  • (#261207) Apply custom text line count setting in the list view - this, used with a small icon size and a slim plasma theme, can save quite some vertical space in the list view
  • (#290694) (Part II) Relayout the items using the updated grid and item size - on Plasma theme change, the SVG margins change, and so should the positions of the items in the icon and list views
  • Fix item sorting - fix sorting by size and type, introduce a three-level fall-back for sorting by name, sort folders by child items count when sorting by size. Thanks goes to Peter Penz for the three-level file name sorting fall-back code!
  • (no bug #) Enable  on-hover item animation only for a certain level of graphics effects (Low CPU == effect off)
    This introduced a new KGlobalSettings category, SETTINGS_STYLE, which is currently only used when the graphic effects level changes - you're welcome to notify about style configuration changes using this category.
  • (#244557) Fix icon scaling when the FolderView applet is in panel - behave similar to the Trash applet when in panel
This is of course not all what needs to be done, but it at least makes FolderView usable. Bug #268641 needs further fixing as I occasionally learnt yesterday - with some icon sizes, the marker occludes the icon partially (at 22px) or even completely (at 16px). There are some visual glitches remaining, and of course a lot of features to implement.

Now for the time frames. The fixes listed above will all be available in 4.8.1, along with some yet to be done bug fixes. There is one 4.9 feature currently, the ability to sort icons ascending or descending when FolderView is used as a containment.

I also need to tell you about one important bit of polish that depends on a fix in Qt. Namely, if you drag some icons around in FolderView, you will see some  ugly artefacts. I've created a review request in Gerrit, the Qt code review system, but the Trolls refuse to accept the patch until I do a similar fix for Qt5. Now drag and drop in Qt5 is broken, as in, the drag pixmap is not displayed at all! And the Trolls want me to fix all the drag'n'drop code in Qt5, after which they will gladly accept my Qt4 patch. Well, as they say, you fight fire with fire! I've talked to Jonathan Riddell of KUbuntu fame, and he promised to post the patch to the kde-packagers mailing list. This means that the patch will be applied by the distros on the next Qt release. Take it, trolls! :) (no offence here - but I need to get the applet fixed, Qt5 is a mirage at the moment and will remain a mirage until two or more major KDE releases)

What I've done is more than half of the job. The other part will have been done before the 4.8.1 tagging. I encourage you to check out and build kde-baseapps master and have a look at the improved FolderView applet!

Best regards,
Ignat Semenov


  1. Not that I use Folder View that much myself, but I agree it is quite crucial for KDE for it is the first impression most KDE new comers will get to deal with. Because of that, I truly appreciate your efforts in improving KDE!


  2. Bravo Ignat! Thanks for donating your time to fix/improve folderview. Your job is really appreciated.

  3. Hey Ignat, nice to see you on the Planet. I've seen your very useful patches on Reviewboard, thanks for all your work!

    In my opinion this is exactly what KDE software needs - polishing. I look forward to reading your future posts.

    P.S. Regarding the wallpaper thing - have you tried Redshift, which adjusts the color temperature of your monitor? There's also a Day and Night Wallpaper:

    1. Thank YOU Hans for that blog post in December ;)
      You probably will be seeing much less patches of mine on the RR - I've grown up a bit and submit some stuff myself, or discussing it on IRC.
      Thanks for the link, will have a look. Oh, now I see that the kde-look entry has some code to help me write an analog of that FC8 wallpaper, nice.

  4. "#211002 Make the popup view inherit the parent IconView sorting & filtering settings"

    Not sure whether inheriting filter settings is a good idea.

    For example, I have one folderview widget on my main desktop, which shows my home directory, but has a filter to only show directories, not files.
    So it acts as a convenient entry point to browse the main folders ("Documents", "Downloads", "Music", etc.) in my home dir.
    However, inside the popup view for each of the folders, I do expect to see all files, not just subfolders.
    I'm sure some other users have similar use-cases...

    1. Well yes, indeed. Looking at that commit, it also allowed to set up the sorting according to the parent view, and some more stuff, and then the filtering. OK, we'll discuss it, indeed, I may have to change the filtering part of the commit.

  5. Thanks!
    I've noticed some small bugs in 4.8.0, and I'm glad to see them listed on your list. Rock on!

    1. TY :) Nice to know there's some eagle-eyed users out there, too. Do report those glitches if you see them! Sooner or later a dev like me will step up to fix the small visual bugs, it's not useless.

  6. While I really like your polishing work, isn't it wasted? With Plasma applets migrating to QML does it even make sense to fix C++ applets instead of rewriting them in QML?

    1. Well, yeah, we've decided on keeping and maintaining the C++ version of folderview for now. I'll give it a bit of refactoring to make it a proper PopupApplet (to kill some custom^W duplicated code), but it will still remain C++. I don't know QML at the moment and to be honest with you, the non-imperative nature of the language kind of drives me off. Not to mention that the data logic is still C++, so the QML port would retain all the C++ model code (70-80% of the current foderview) and only kill the painting code - but I would still have to write all the binding code and stuff. Not worth the effort for this one.

  7. Great to see so much polishing being done to the FolderView. I use it for two things:

    - One (fish://) view of my account at the university.
    - One (sftp://) view of my account at

    There's one little problem I have though. When I log on to my KDE, it takes a bit of time for the network to come up (WPA authentication et.c., I'm using NetworkManager), and once it finally does the FolderView seems to be unaware of this. Before I could just select the FolderView and hit F5 to reload it once the network is up, but nowadays I have to enter the settings and enter the URL again, only then will the FolderView reconnect and show the remote folder. Could this be improved?

    In my setup I'm using a password-less KWallet that stores my SSH passphrase and then KSSHAskpass on top of that, so I don't have to enter any more passwords than my local login password.

    Would be great if FolderView would somehow listen to "network up" events and reload remote folders when it happens.

    Thanks for your great work.

    1. Yes, I remember there was a similar BR.. probably about Nepomuk or something. This is most probably KIO related, probably just needs to listen to a KIO signal somewhere. When I come to fixing the Nepomuk update issue, I will solve this as well.

      Now please, in order for this not to get lost:, product plasma, component widget-folderview. Thank you in advance :)

  8. Thanks for working on the FolderView applet. This applet could be even more useful if it had the same behaviour when it is in a panel. Currently, the folder view applet is almost useless when it is in a panel, because you cannot navigate the filesystem. Instead, it would be great to click (or hover) on a directory and have a popup showing the content of that directory. This would make it to open a file located in your filesystem very easy: click on the folder view icon in the panel and navigate through the subdirectories, or, by only using the keyboard, use the applet shortcut (which at the moment it seems not to work), which opens the list of the files in the configured folder, and navigate with the arrow keys. In my opinion, this is much more comfortable than it is now, with the applet on the desktop: you have to show the desktop (Ctrl+F12 or Meta+F12) and use the mouse to navigate through the subdirectories.

    I hope I've been able to explain myself. Is there any plan to implement the described behavior?

    Anyway, thanks a lot.

    1. Thank you for the input! Now let us break this into pieces.

      1)Open the FW with a shortcut when it is in the panel -> port to PopupApplet, which is planned for 4.9.
      2)Directory popups when in the panel are unavailable due to the focus problems -> port to PopupApplet.
      3)Keyboard navigation is currently unimplemented in the list view, it seems, sounds like 4.9 as well.

  9. Hi Ignat,

    keep up the good work.
    I have a question about "Blue Systems GmbH". Just answer as much as you can. Who exactly are those guys? They seem to appear out of nowhere and just throw some money at KDE. First I noticed them when Mint received sponsorship, then I discovered Netrunner, now this project. Their web site is not very helpful, it contains no explanation, just few links.
    Did KDE have rich uncle that died few weeks ago or is this some sort of "a random rich guy fell in love with KDE" story?
    Don't get me wrong, I love their work. I'm just curious.
    Any info on this would be appreciated.


    1. Well, you see, all I know is what I've said in the blog. Moreover, I don't really think it matters at all, they help me and some other guys help KDE and that's awesome. :)