Monday, February 27, 2012

Have you ever experienced this bug?

Hello fellow KDE devs and users!

Community help is needed with a difficult to reproduce bug.

The bug looks like this:if your desktop is set to FolderView (right click->View->Layout->Folder View->Apply), on plasma-desktop restart or KDE login, you are presented with an empty desktop and a scrollbar on the left, even if there are files in the directory displayed by the folderview containment. Scrolling to the very bottom does not reveal the icons. Setting the desktop to Desktop and then back to FolderView remedies the problem, but on the next KDE login, you may well experience the bug again.

The relevant entry:

I'd like to know if you have experienced this bug, under which KDE version, and any other steps to reproduce the bug.

Please add comments directly to that Bugzilla entry to avoid duplication and lost data. Thank you in advance!

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