Hello community,
here is the log from the commit of package kdebase4-workspace
checked in at Mon Jan 28 01:11:04 CET 2008.
--------
--- KDE/kdebase4-workspace/kdebase4-wallpapers.changes 2008-01-24 21:11:39.000000000 +0100
+++ /mounts/work_src_done/STABLE/kdebase4-workspace/kdebase4-wallpapers.changes 2008-01-28 01:10:38.421126000 +0100
@@ -1,0 +2,5 @@
+Sun Jan 27 22:44:50 CET 2008 - stbinner@suse.de
+
+- add application menu shortening feature and fix alphabetical sort
+
+-------------------------------------------------------------------
kdebase4-workspace.changes: same change
New:
----
short-menus.diff
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ kdebase4-wallpapers.spec ++++++
--- /var/tmp/diff_new_pack.k12298/_old 2008-01-28 01:10:48.000000000 +0100
+++ /var/tmp/diff_new_pack.k12298/_new 2008-01-28 01:10:48.000000000 +0100
@@ -21,7 +21,7 @@
Summary: KDE 4 Wallpapers
Url: http://www.kde.org/
Version: 4.0
-Release: 9
+Release: 12
%define rversion 4.0.0
Source0: kdebase-workspace-%rversion.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -59,6 +59,8 @@
/usr/share/wallpapers
%changelog
+* Sun Jan 27 2008 stbinner@suse.de
+- add application menu shortening feature and fix alphabetical sort
* Wed Jan 23 2008 stbinner@suse.de
- update KDE_4_0_BRANCH.diff (incl. taskbar attention flash)
- don't migrate ~/Desktop icons to Dashboard which will not work
++++++ kdebase4-workspace.spec ++++++
--- /var/tmp/diff_new_pack.k12298/_old 2008-01-28 01:10:48.000000000 +0100
+++ /var/tmp/diff_new_pack.k12298/_new 2008-01-28 01:10:48.000000000 +0100
@@ -22,7 +22,7 @@
Summary: The KDE Workspace Components
Url: http://www.kde.org/
Version: 4.0
-Release: 9
+Release: 12
%define rversion 4.0.0
Source0: kdebase-workspace-%rversion.tar.bz2
Source1: opensuse.png
@@ -48,6 +48,7 @@
Patch16: plasma-iconloader.diff
Patch17: trash-plasmoid.diff
Patch18: startkde-gtk2.diff
+Patch19: short-menus.diff
%kde4_runtime_requires
Conflicts: yast2-theme-NLD
Suggests: kdebase4-ksysguardd
@@ -85,6 +86,7 @@
%patch16
%patch17
%patch18
+%patch19
%build
%cmake_kde4 -d build
@@ -599,6 +601,8 @@
/usr/%_lib/kde4/kgreet_*.so
%changelog
+* Sun Jan 27 2008 stbinner@suse.de
+- add application menu shortening feature and fix alphabetical sort
* Wed Jan 23 2008 stbinner@suse.de
- update KDE_4_0_BRANCH.diff (incl. taskbar attention flash)
- don't migrate ~/Desktop icons to Dashboard which will not work
++++++ short-menus.diff ++++++
Index: plasma/applets/kickoff/applet/applet.cpp
===================================================================
--- plasma/applets/kickoff/applet/applet.cpp (revision 767278)
+++ plasma/applets/kickoff/applet/applet.cpp (working copy)
@@ -48,6 +48,7 @@
Plasma::Icon *icon;
Kickoff::Launcher *launcher;
bool switchTabsOnHover;
+ bool reduceMenuDepth;
int visibleItemsCount;
KDialog *dialog;
@@ -70,6 +71,7 @@
connect(d->icon, SIGNAL(pressed(bool)), this, SLOT(toggleMenu(bool)));
d->switchTabsOnHover = true;
+ d->reduceMenuDepth = true;
d->visibleItemsCount = 10;
}
@@ -82,6 +84,7 @@
{
KConfigGroup cg = config();
d->switchTabsOnHover = cg.readEntry("SwitchTabsOnHover",d->switchTabsOnHover);
+ d->reduceMenuDepth = cg.readEntry("ReduceMenudepth",d->reduceMenuDepth);
d->visibleItemsCount = cg.readEntry("VisibleItemsCount",d->visibleItemsCount);
}
Index: plasma/applets/kickoff/core/applicationmodel.cpp
===================================================================
--- plasma/applets/kickoff/core/applicationmodel.cpp (revision 767278)
+++ plasma/applets/kickoff/core/applicationmodel.cpp (working copy)
@@ -90,7 +90,7 @@
{
if (n1->isDir) {
if (n2->isDir) {
- return n1->appName.compare(n2->appName, Qt::CaseInsensitive) < 0;
+ return n1->genericName.compare(n2->genericName, Qt::CaseInsensitive) < 0;
} else {
return true;
}
@@ -98,7 +98,7 @@
if (n2->isDir) {
return false;
} else {
- return n1->appName.compare(n2->appName, Qt::CaseInsensitive) < 0;
+ return n1->genericName.compare(n2->genericName, Qt::CaseInsensitive) < 0;
}
}
return true;
@@ -118,6 +118,8 @@
}
void fillNode(const QString &relPath, AppNode *node);
+ void addAppNode(const QString &icon, const QString &appName, const QString &genericName,
+ const QString& relPath, const QString &desktopEntry, bool isDir, AppNode *parent);
static QHash iconNameMap();
ApplicationModel *q;
@@ -132,67 +134,118 @@
KServiceGroup::List list = root->entries();
- // application name <-> service map for detecting duplicate entries
- QHash existingServices;
+ KSortableList slist;
+ KSortableList glist;
+ QMap specialTitle;
+ QMap categoryIcon;
+ QMap shortenedMenuPath;
+
for( KServiceGroup::List::ConstIterator it = list.begin();
it != list.end(); ++it)
{
- QString icon;
- QString appName;
- QString genericName;
- QString relPath = _relPath;
- QString desktopEntry;
- bool isDir = false;
const KSycocaEntry::Ptr p = (*it);
if (p->isType(KST_KService))
{
const KService::Ptr service = KService::Ptr::staticCast(p);
+ slist.insert( service->name().toLocal8Bit(), p);
+ }
+ else if (p->isType(KST_KServiceGroup))
+ {
+ KServiceGroup::Ptr serviceGroup = KServiceGroup::Ptr::staticCast(p);
+ if ( serviceGroup->SuSEshortMenu() ){
+ KServiceGroup::List l = serviceGroup->entries(true, true /*excludeNoDisplay_*/, false );
+ if ( l.count() == 1 ) {
+ // the special case, we want to short the menu.
+ // TOFIX? : this works only for one level
+ KServiceGroup::List::ConstIterator _it=l.begin();
+ const KSycocaEntry::Ptr _e = (*_it);
+ if (_e->isType(KST_KService)) {
+ const KService::Ptr s = KService::Ptr::staticCast(_e);
+ QString key;
+ if ( serviceGroup->SuSEgeneralDescription() )
+ key = s->name();
+ else {
+ // we use the normal menu description
+ key = s->name();
+ if( !s->genericName().isEmpty() && serviceGroup->caption()!=s->genericName())
+ key = serviceGroup->caption() + " (" + s->name() + ")";
+ }
+ specialTitle.insert( _e->name(), key );
+ categoryIcon.insert( _e->name(), serviceGroup->icon() );
+ slist.insert( key.toLocal8Bit(), _e );
+ shortenedMenuPath.insert( _e->name(), serviceGroup->relPath() );
+ // and escape from here
+ continue;
+ }
+ }
+ }
+ glist.insert( serviceGroup->caption().toLocal8Bit(), p );
+ }
+ else
+ slist.insert( p->name().toLocal8Bit(), p);
+ }
+
+ list = root->SuSEsortEntries( slist, glist, true /*excludeNoDisplay_*/, false );
+
+ for( KServiceGroup::List::ConstIterator it = list.begin();
+ it != list.end(); ++it)
+ {
+ const KSycocaEntry::Ptr p = (*it);
+ if (p->isType(KST_KService))
+ {
+ const KService::Ptr service = KService::Ptr::staticCast(p);
+
if (service->noDisplay())
continue;
- icon = service->icon();
- appName = service->name();
- genericName = service->genericName();
- desktopEntry = service->entryPath();
+ QString menuPath;
+ if (shortenedMenuPath[service->name()].isEmpty())
+ menuPath=_relPath+service->menuId();
+ else
+ menuPath=shortenedMenuPath[service->name()]+service->menuId();
- // check for duplicates (eg. KDE 3 and KDE 4 versions of application
- // both present)
- if (duplicatePolicy == ApplicationModel::ShowLatestOnlyPolicy &&
- existingServices.contains(appName)
- ) {
- if (Kickoff::isLaterVersion(existingServices[appName],service)) {
- continue;
- } else {
- // find and remove the existing entry with the same name
- for (int i = 0 ; i < node->children.count() ; i++) {
- if ( node->children[i]->appName == appName ) {
- delete node->children.takeAt(i);
- }
- }
- }
+ QString icon = categoryIcon[service->name()];
+ if (icon.isEmpty())
+ icon = service->icon();
+
+ QString name = specialTitle[service->name()];
+ if (name.isEmpty())
+ name = service->name();
+
+ QString genericName = service->genericName();
+ if (genericName.isEmpty()) {
+ genericName = name;
+ name = QString::null;
}
- existingServices[appName] = service;
+
+ if (name==genericName)
+ name = QString::null;
+
+ addAppNode(icon, name, genericName, _relPath, menuPath, false, node);
}
else if (p->isType(KST_KServiceGroup))
{
- const KServiceGroup::Ptr serviceGroup = KServiceGroup::Ptr::staticCast(p);
+ KServiceGroup::Ptr serviceGroup = KServiceGroup::Ptr::staticCast(p);
+ if ( serviceGroup->SuSEshortMenu() ){
+ KServiceGroup::List l = serviceGroup->entries(true, true /*excludeNoDisplay_*/ );
+ if ( l.count() == 1 )
+ continue;
+ }
+ // standard sub menu
+
if (serviceGroup->noDisplay() || serviceGroup->childCount() == 0)
continue;
kDebug(250) << "Service group" << serviceGroup->entryPath() << serviceGroup->icon()
<< serviceGroup->relPath() << serviceGroup->directoryEntryPath();
- icon = serviceGroup->icon();
- if (iconNameMap().contains(icon)) {
+ QString icon = serviceGroup->icon();
+ if (iconNameMap().contains(icon))
icon = iconNameMap().value(icon);
- }
- genericName = serviceGroup->caption();
- relPath = serviceGroup->relPath();
- appName = serviceGroup->comment();
- isDir = true;
+ addAppNode(icon, serviceGroup->comment(), serviceGroup->caption(), serviceGroup->relPath(), QString::null, true, node);
}
else
{
@@ -200,21 +253,24 @@
continue;
}
- AppNode *newnode = new AppNode();
- newnode->icon = KIcon(icon);
- newnode->appName = appName;
- newnode->genericName = genericName;
- newnode->relPath = relPath;
- newnode->desktopEntry = desktopEntry;
- newnode->isDir = isDir;
- newnode->parent = node;
- node->children.append(newnode);
}
qStableSort(node->children.begin(), node->children.end(), AppNodeLessThan);
}
+void ApplicationModelPrivate::addAppNode(const QString &icon, const QString &appName, const QString &genericName,
+ const QString& relPath, const QString &desktopEntry, bool isDir, AppNode *parent )
+{
+ AppNode *newnode = new AppNode();
+ newnode->icon = KIcon(icon);
+ newnode->appName = appName;
+ newnode->genericName = genericName;
+ newnode->relPath = relPath;
+ newnode->desktopEntry = desktopEntry;
+ newnode->isDir = isDir;
+ newnode->parent = parent;
+ parent->children.append(newnode);
+}
-
ApplicationModel::ApplicationModel(QObject *parent)
: QAbstractItemModel(parent), d(new ApplicationModelPrivate(this))
{
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org