[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#570977: Please provide way to customize default favorites list for new users



tags 570977 + patch
thanks

Here is a draft patch based on the code in KDE 3
(/kdebase/kicker/kicker/core/containerarea.cpp).  I would very much
like input on the code used to locate the config file.  Is kickoff the
correct name for this system?  Is the file name default-favorites
good?  What about its location?  I believe it will put it under
/usr/share/apps/kickoff/default-favorites or
/usr/share/kde4/apps/kickoff/default-favorites, but have not verified
this.

diff -ur kdebase-workspace-4.3.4/plasma/applets/kickoff/core/favoritesmodel.cpp kdebase-workspace-4.3.4-pere/plasma/applets/kickoff/core/favoritesmodel.cpp
--- kdebase-workspace-4.3.4/plasma/applets/kickoff/core/favoritesmodel.cpp	2009-05-14 19:26:34.000000000 +0200
+++ kdebase-workspace-4.3.4-pere/plasma/applets/kickoff/core/favoritesmodel.cpp	2010-04-05 08:02:46.000000000 +0200
@@ -31,6 +31,7 @@
 #include <KService>
 #include <kdebug.h>
 #include <KUrl>
+#include <KStandardDirs>
 
 using namespace Kickoff;
 
@@ -105,7 +106,26 @@
     static QList<QString> defaultFavorites()
     {
         QList<QString> applications;
-        applications << "konqbrowser" << "kmail" << "systemsettings" << "dolphin";
+
+	// XXX Is this the KDE 4 way of finding the path?
+	// XXX Is this a good location for the default-favorites file?
+	QFile f(KStandardDirs::locate("data", "kickoff/default-favorites"));
+	if (f.open(IO_ReadOnly))
+	{
+	    QTextStream is(&f);
+
+	    while (!is.eof())
+	        applications << is.readLine();
+
+	    f.close();
+	}
+	else
+	{
+	    applications << "konqbrowser"
+			 << "kmail"
+			 << "systemsettings"
+			 << "dolphin";
+	}
 
         QList<QString> desktopFiles;
 

Happy hacking,
-- 
Petter Reinholdtsen



Reply to: