[PATCH] Config options to hide the recent documents/apps in Kickoff

Aaron J. Seigo aseigo at kde.org
Tue May 6 19:51:54 CEST 2008


On Tuesday 06 May 2008, Martin Graesslin wrote:
> this is my first hack on plasma code, so please be gentle ;-) I know soft

cool; welcome to plasma =)

> freeze for 4.1 has allready happened, but perhaps this could be included
> anyway.

at the very least we can get it in for 4.2. kickoff does need some additional 
flexibility in this regard.

> A friend of mine was a little bit worried as there was no option to hide
> the recent documents or the recent apps. We looked both for it and tried
> and did not find anything. So I did a little bit of coding today.

nicely done =)

> The patch offers checkboxes in the config to display the recent docs and to
> display the recent apps.

i think this is ok for 4.1, but perhaps we can revisit this dialog in 4.2.

code-wise, i like the direction. reading the patch, the following occurred to 
me, however:

instead of displayRecentApps() and displayRecentDocuments() in Launcher, 
define an enum in the Kickoff namespace called something like 
InterfaceComponents (perhaps in core/models.h?). it would be something like:

InterfaceComponent { RecentApps = 1,
                                      RecentDocuments = 2, ... etc }
Q_DECLARE_FLAGS(InterfaceComponents, InterfaceComponent)

then in Launcher there'd just be:

void setShowComponent(InterfaceComponent component, bool display);
bool showComponent(InterfaceComponent component) const;
InterfaceComponents shownComponents() const;

that should simplify the API a bit, and keep us from adding more and more such 
methods over time: we just add to the enum.

then this:

+    cg.writeEntry("DisplayRecentsApps", displayRecentApps);
+    cg.writeEntry("DisplayRecentsDocuments", displayRecentDocuments);

would become:

KConfigGroup displayConfig(&cg, "Display");
cg.writeEntry("RecentApps", d->display & RecentApps);
.. etc

(i recommend putting it in a subgroup called "Display" for tidiness)

this approach also means that this:

RecentlyUsedModel(QObject *parent = 0, bool displayRecentApps = true, bool 
displayRecentDocuments = true);

becomes:

RecentlyUsedModel(Kickoff::InterfaceComponents show, QObject *parent = 0);

(hm.. that ctor should be marked as explicit, as well; but that's not the 
fault of your patch =)

strings of bools in method signatures makes for hard to read (and therefore 
maintain) code, so we try and avoid that.

> If both are deselected the tab's still there. But 
> I guess this could be changed ;-)

probably should, yes....



p.s. our coding style can be found at 
http://techbase.kde.org/Policies/Kdelibs_Coding_Style; in particular 
something like this:

+        if( !displayRecentApps )
+            return;

should be:

+        if (!displayRecentApps) {
+            return;
+        }

note the mandatory {}s and whitespace usage. minor details, but we try and 
keep things consistent; not that we're 100% successful ;)

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Trolltech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080506/b6a4c273/attachment.pgp 


More information about the Panel-devel mailing list