Author: kkofler
Update of /cvs/pkgs/rpms/kdebase-workspace/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv14613/devel
Modified Files:
kdebase-workspace.spec
Added Files:
kdebase-workspace-4.0.2-kde#155362.patch
Removed Files:
kdebase-workspace-4.0.1-kde#155362.patch
Log Message:
- update kde#155362 patch
kdebase-workspace-4.0.2-kde#155362.patch:
--- NEW FILE kdebase-workspace-4.0.2-kde#155362.patch ---
diff -ur kdebase-workspace-4.0.2/plasma/applets/kickoff/simpleapplet/menuview.cpp
kdebase-workspace-4.0.2-kde#155362/plasma/applets/kickoff/simpleapplet/menuview.cpp
--- kdebase-workspace-4.0.2/plasma/applets/kickoff/simpleapplet/menuview.cpp 2008-02-27
12:57:53.000000000 +0100
+++
kdebase-workspace-4.0.2-kde#155362/plasma/applets/kickoff/simpleapplet/menuview.cpp 2008-02-29
22:55:37.000000000 +0100
@@ -34,7 +34,7 @@
class MenuView::Private
{
public:
- Private(MenuView *parent) : q(parent) , model(0) , column(0), launcher(new
UrlItemLauncher(parent)) {}
+ Private(MenuView *parent) : q(parent) , model(0) , column(0), launcher(new
UrlItemLauncher(parent)), formattype(MenuView::DescriptionName) {}
QAction *createActionForIndex(const QModelIndex& index,QWidget *parent)
{
@@ -68,6 +68,7 @@
QAbstractItemModel *model;
int column;
UrlItemLauncher *launcher;
+ MenuView::FormatType formattype;
};
MenuView::MenuView(QWidget *parent)
@@ -85,11 +86,48 @@
}
void MenuView::updateAction(QAction *action,const QModelIndex& index)
{
- QString text = index.data(Qt::DisplayRole).value<QString>();
- const QString name = index.data(Kickoff::SubTitleRole).value<QString>();
- if (action->menu()==0 && name.contains(text,Qt::CaseInsensitive))
- text = name;
- action->setText(text.replace("&","&&"));
+ QString text = index.data(Qt::DisplayRole).value<QString>(); // describing
text, e.g. "Spreadsheet" or "Rekall" (right, sometimes the text is
also used for the generic app-name)
+ QString name = index.data(Kickoff::SubTitleRole).value<QString>(); // the
generic name, e.g. "kspread" or "OpenOffice.org Spreadsheet" or just
"" (right, it's a mess too)
+ if( action->menu()!=0 ) { // if its an item with sub-menuitems, we probably like
to thread them another way...
+ action->setText(text.replace("&","&&"));
+ }
+ else {
+ switch( d->formattype ) {
+ case Name: {
+ if( name.isEmpty() ) {
+
action->setText(text.replace("&","&&"));
+ }
+ else {
+
action->setText(name.replace("&","&&"));
+ }
+ } break;
+ case Description: {
+ if( name.contains(text,Qt::CaseInsensitive) ) {
+ text = name;
+ }
+
action->setText(text.replace("&","&&"));
+ } break;
+ case NameDescription: // fall through
+ case DescriptionName: {
+ if( ! name.isEmpty() ) { // seems we have a program, but some of them
dont define a name at all
+ if( name.contains(text,Qt::CaseInsensitive) ) {
+
action->setText(name.replace("&","&&"));
+ }
+ else {
+ if( d->formattype == NameDescription ) {
+ action->setText(QString("%1
%2").arg(name).arg(text).replace("&","&&"));
+ }
+ else {
+ action->setText(QString("%1
(%2)").arg(text).arg(name).replace("&","&&"));
+ }
+ }
+ }
+ else { // if there is no name, let's just use the describing text
+
action->setText(text.replace("&","&&"));
+ }
+ } break;
+ }
+ }
action->setIcon(index.data(Qt::DecorationRole).value<QIcon>());
}
@@ -260,6 +298,14 @@
{
return d->column;
}
+MenuView::FormatType MenuView::formatType() const
+{
+ return d->formattype;
+}
+void MenuView::setFormatType(MenuView::FormatType formattype)
+{
+ d->formattype = formattype;
+}
void MenuView::actionTriggered(QAction *action)
{
QModelIndex index = indexForAction(action);
diff -ur kdebase-workspace-4.0.2/plasma/applets/kickoff/simpleapplet/menuview.h
kdebase-workspace-4.0.2-kde#155362/plasma/applets/kickoff/simpleapplet/menuview.h
--- kdebase-workspace-4.0.2/plasma/applets/kickoff/simpleapplet/menuview.h 2008-01-05
00:55:49.000000000 +0100
+++
kdebase-workspace-4.0.2-kde#155362/plasma/applets/kickoff/simpleapplet/menuview.h 2008-02-29
22:55:37.000000000 +0100
@@ -80,6 +80,18 @@
/** See setColumn() */
int column() const;
+ /** The format type enumeration. */
+ enum FormatType {
+ Name = 0, ///< Name only
+ Description, ///< Description only
+ NameDescription, ///< Name (Description)
+ DescriptionName ///< Description (Name)
+ };
+ /** \return the format type. */
+ FormatType formatType() const;
+ /** Set the format type. */
+ void setFormatType(FormatType formattype);
+
protected:
/**
* Creates a new action to represent a leaf index in the tree. A leaf index
diff -ur kdebase-workspace-4.0.2/plasma/applets/kickoff/simpleapplet/simpleapplet.cpp
kdebase-workspace-4.0.2-kde#155362/plasma/applets/kickoff/simpleapplet/simpleapplet.cpp
---
kdebase-workspace-4.0.2/plasma/applets/kickoff/simpleapplet/simpleapplet.cpp 2008-02-27
12:57:53.000000000 +0100
+++
kdebase-workspace-4.0.2-kde#155362/plasma/applets/kickoff/simpleapplet/simpleapplet.cpp 2008-02-29
23:03:14.000000000 +0100
@@ -22,8 +22,9 @@
#include "simpleapplet/menuview.h"
// Qt
-#include <QCheckBox>
-#include <QVBoxLayout>
+#include <QLabel>
+#include <QComboBox>
+#include <QGridLayout>
#include <QGraphicsView>
#include <QMetaObject>
#include <QMetaEnum>
@@ -32,6 +33,7 @@
// KDE
#include <KIcon>
#include <KDialog>
+#include <KMenu>
// Plasma
#include <plasma/layouts/boxlayout.h>
@@ -43,29 +45,67 @@
#include "core/models.h"
#include "core/applicationmodel.h"
#include "core/favoritesmodel.h"
+#include "core/systemmodel.h"
+#include "core/recentlyusedmodel.h"
#include "core/leavemodel.h"
+#include "core/urlitemlauncher.h"
class MenuLauncherApplet::Private
{
public:
- QMenu *menuview;
+ KMenu *menuview;
Plasma::Icon *icon;
- Kickoff::MenuView *appview;
- Kickoff::MenuView* favview;
+ QPointer<Kickoff::UrlItemLauncher> launcher;
- bool showFavorites;
- bool showLeaveSwitchUser;
- bool showLeaveLock;
- bool showLeaveLogout;
+ MenuLauncherApplet::ViewType viewtype;
+ MenuLauncherApplet::FormatType formattype;
KDialog *dialog;
- QCheckBox *showFavCheckBox;
- QCheckBox *showSwitchUserCheckBox;
- QCheckBox *showLockCheckBox;
- QCheckBox *showLogoutCheckBox;
+ QComboBox *viewComboBox, *formatComboBox;
- Private() : menuview(0), appview(0), favview(0), dialog(0) {}
- ~Private() { delete dialog; delete menuview; delete appview; delete favview; }
+ Private() : menuview(0), launcher(0), dialog(0) {}
+ ~Private() { delete dialog; delete menuview; }
+
+ void addItem(QComboBox* combo, const QString& caption, int index) {
+ combo->addItem(caption, index);
+ }
+
+ void setCurrentItem(QComboBox* combo, int currentIndex) {
+ for(int i = combo->count() - 1; i >= 0; --i) {
+ if( combo->itemData(i).toInt() == currentIndex ) {
+ combo->setCurrentIndex(i);
+ return;
+ }
+ }
+ if( combo->count() > 0 )
+ combo->setCurrentIndex(0);
+ }
+
+ Kickoff::MenuView *createMenuView(QAbstractItemModel *model = 0) {
+ Kickoff::MenuView *view = new Kickoff::MenuView(menuview);
+ view->setFormatType( (Kickoff::MenuView::FormatType) formattype );
+ if( model ) {
+ model->setParent(view); //re-parent
+ view->setModel(model);
+ }
+ return view;
+ }
+
+ void addMenu(Kickoff::MenuView *view, bool mergeFirstLevel) {
+ QList<QAction*> actions = view->actions();
+ foreach(QAction *action, actions) {
+ if( action->menu() && mergeFirstLevel ) {
+ QMetaObject::invokeMethod(action->menu(),"aboutToShow");
//fetch the children
+ if( actions.count() > 1 )
+ menuview->addTitle(action->text());
+ foreach(QAction *a, action->menu()->actions())
+ menuview->addAction(a);
+ }
+ else {
+ menuview->addAction(action);
+ }
+ }
+ }
};
MenuLauncherApplet::MenuLauncherApplet(QObject *parent, const QVariantList &args)
@@ -78,10 +118,8 @@
d->icon->setFlag(ItemIsMovable, false);
connect(d->icon, SIGNAL(pressed(bool)), this, SLOT(toggleMenu(bool)));
- d->showFavorites = true;
- d->showLeaveSwitchUser = true;
- d->showLeaveLock = true;
- d->showLeaveLogout = true;
+ d->viewtype = Combined;
+ d->formattype = NameDescription;
}
MenuLauncherApplet::~MenuLauncherApplet()
@@ -96,10 +134,16 @@
d->icon->setIcon(KIcon(cg.readEntry("icon","start-here-kde")));
//setMinimumContentSize(d->icon->iconSize());
//setSize(d->icon->iconSize())
- d->showFavorites = cg.readEntry("showFavorites",d->showFavorites);
- d->showLeaveSwitchUser =
cg.readEntry("showLeaveSwitchUser",d->showLeaveSwitchUser);
- d->showLeaveLock = cg.readEntry("showLeaveLock",d->showLeaveLock);
- d->showLeaveLogout =
cg.readEntry("showLeaveLogout",d->showLeaveLogout);
+ {
+ QMetaEnum e =
metaObject()->enumerator(metaObject()->indexOfEnumerator("ViewType"));
+ QByteArray ba = cg.readEntry("view",
QByteArray(e.valueToKey(d->viewtype)));
+ d->viewtype = (MenuLauncherApplet::ViewType) e.keyToValue(ba);
+ }
+ {
+ QMetaEnum e =
metaObject()->enumerator(metaObject()->indexOfEnumerator("FormatType"));
+ QByteArray ba = cg.readEntry("format",
QByteArray(e.valueToKey(d->formattype)));
+ d->formattype = (MenuLauncherApplet::FormatType) e.keyToValue(ba);
+ }
Kickoff::UrlItemLauncher::addGlobalHandler(Kickoff::UrlItemLauncher::ExtensionHandler,"desktop",new
Kickoff::ServiceItemHandler);
Kickoff::UrlItemLauncher::addGlobalHandler(Kickoff::UrlItemLauncher::ProtocolHandler,
"leave", new Kickoff::LeaveItemHandler);
@@ -141,44 +185,64 @@
connect(d->dialog, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(d->dialog, SIGNAL(okClicked()), this, SLOT(configAccepted()));
- QVBoxLayout *layout = new QVBoxLayout(d->dialog->mainWidget());
- d->dialog->mainWidget()->setLayout(layout);
-
- d->showFavCheckBox = new QCheckBox(i18n("Favorites"),
d->dialog->mainWidget());
- layout->addWidget(d->showFavCheckBox);
-
- d->showSwitchUserCheckBox = new QCheckBox(i18n("Switch user"),
d->dialog->mainWidget());
- layout->addWidget(d->showSwitchUserCheckBox);
+ QWidget *p = d->dialog->mainWidget();
+ QGridLayout *l = new QGridLayout(p);
+ p->setLayout(l);
+
+ l->addWidget(new QLabel(i18n("View:"), p), 0, 0);
+ d->viewComboBox = new QComboBox(p);
+ d->addItem(d->viewComboBox, i18n("Combined"),
MenuLauncherApplet::Combined);
+ d->addItem(d->viewComboBox, i18n("Favorites"),
MenuLauncherApplet::Favorites);
+ d->addItem(d->viewComboBox, i18n("Applications"),
MenuLauncherApplet::Applications);
+ d->addItem(d->viewComboBox, i18n("Computer"),
MenuLauncherApplet::Computer);
+ d->addItem(d->viewComboBox, i18n("Recently Used"),
MenuLauncherApplet::RecentlyUsed);
+ d->addItem(d->viewComboBox, i18n("Leave"),
MenuLauncherApplet::Leave);
+ l->addWidget(d->viewComboBox, 0, 1);
+
+ l->addWidget(new QLabel(i18n("Format:"), p), 1, 0);
+ d->formatComboBox = new QComboBox(p);
+ d->addItem(d->formatComboBox, i18n("Name only"),
MenuLauncherApplet::Name);
+ d->addItem(d->formatComboBox, i18n("Description only"),
MenuLauncherApplet::Description);
+ d->addItem(d->formatComboBox, i18n("Name Description"),
MenuLauncherApplet::NameDescription);
+ d->addItem(d->formatComboBox, i18n("Description (Name)"),
MenuLauncherApplet::DescriptionName);
+ l->addWidget(d->formatComboBox, 1, 1);
- d->showLockCheckBox = new QCheckBox(i18n("Lock"),
d->dialog->mainWidget());
- layout->addWidget(d->showLockCheckBox);
-
- d->showLogoutCheckBox = new QCheckBox(i18n("Logout"),
d->dialog->mainWidget());
- layout->addWidget(d->showLogoutCheckBox);
+ l->setColumnStretch(1,1);
}
- d->showFavCheckBox->setChecked(d->showFavorites);
- d->showSwitchUserCheckBox->setChecked(d->showLeaveSwitchUser);
- d->showLockCheckBox->setChecked(d->showLeaveLock);
- d->showLogoutCheckBox->setChecked(d->showLeaveLogout);
+ d->setCurrentItem(d->viewComboBox, d->viewtype);
+ d->setCurrentItem(d->formatComboBox, d->formattype);
d->dialog->show();
}
void MenuLauncherApplet::configAccepted()
{
- d->showFavorites = d->showFavCheckBox->isChecked();
- d->showLeaveSwitchUser = d->showSwitchUserCheckBox->isChecked();
- d->showLeaveLock = d->showLockCheckBox->isChecked();
- d->showLeaveLogout = d->showLogoutCheckBox->isChecked();
+ bool needssaving = false;
KConfigGroup cg = config();
- cg.writeEntry("showFavorites", d->showFavorites);
- cg.writeEntry("showLeaveSwitchUser", d->showLeaveSwitchUser);
- cg.writeEntry("showLeaveLock", d->showLeaveLock);
- cg.writeEntry("showLeaveLogout", d->showLeaveLogout);
- emit configNeedsSaving();
+ int vt =
d->viewComboBox->itemData(d->viewComboBox->currentIndex()).toInt();
+ if( vt != d->viewtype ) {
+ d->viewtype = (MenuLauncherApplet::ViewType) vt;
+ needssaving = true;
+
+ QMetaEnum e =
metaObject()->enumerator(metaObject()->indexOfEnumerator("ViewType"));
+ cg.writeEntry("view", QByteArray(e.valueToKey(d->viewtype)));
+ }
+
+ int ft =
d->formatComboBox->itemData(d->formatComboBox->currentIndex()).toInt();
+ if( ft != d->formattype ) {
+ d->formattype = (MenuLauncherApplet::FormatType) ft;
+ needssaving = true;
- delete d->menuview;
- d->menuview = 0;
+ QMetaEnum e =
metaObject()->enumerator(metaObject()->indexOfEnumerator("FormatType"));
+ cg.writeEntry("format", QByteArray(e.valueToKey(d->formattype)));
+ }
+
+ if( needssaving ) {
+ emit configNeedsSaving();
+
+ delete d->menuview;
+ d->menuview = 0;
+ }
}
void MenuLauncherApplet::toggleMenu(bool pressed)
@@ -188,44 +252,51 @@
}
if (!d->menuview) {
- d->menuview = new QMenu();
+ d->menuview = new KMenu();
connect(d->menuview,SIGNAL(triggered(QAction*)),this,SLOT(actionTriggered(QAction*)));
connect(d->menuview,SIGNAL(aboutToHide()),d->icon,SLOT(setUnpressed()));
- if(!d->appview) {
- d->appview = new Kickoff::MenuView();
- ApplicationModel *appModel = new ApplicationModel(d->appview);
- appModel->setDuplicatePolicy(ApplicationModel::ShowLatestOnlyPolicy);
- d->appview->setModel(appModel);
- }
- foreach (QAction *action, d->appview->actions())
- d->menuview->addAction(action);
-
- if (d->showFavorites) {
- if (!d->favview) {
- d->favview = new Kickoff::MenuView();
- Kickoff::FavoritesModel* favmodel = new
Kickoff::FavoritesModel(d->favview);
- d->favview->setModel(favmodel);
- }
- d->menuview->addSeparator();
- foreach (QAction *action, d->favview->actions())
- d->menuview->addAction(action);
- }
-
- if (d->showLeaveSwitchUser || d->showLeaveLock || d->showLeaveLogout) {
- d->menuview->addSeparator();
- if (d->showLeaveSwitchUser) {
- QAction *lockaction =
d->menuview->addAction(KIcon("system-switch-user"),i18n("Switch
User"));
- lockaction->setData(QUrl("leave:/switch"));
- }
- if (d->showLeaveLock) {
+ switch( d->viewtype ) {
+ case Combined: {
+ ApplicationModel *appModel = new ApplicationModel();
+ appModel->setDuplicatePolicy(ApplicationModel::ShowLatestOnlyPolicy);
+ Kickoff::MenuView *appview = d->createMenuView(appModel);
+ d->addMenu(appview, false);
+
+ d->menuview->addSeparator();
+ Kickoff::MenuView *favview = d->createMenuView(new
Kickoff::FavoritesModel(d->menuview));
+ d->addMenu(favview, false);
+
+ d->menuview->addSeparator();
+ QAction *switchaction =
d->menuview->addAction(KIcon("system-switch-user"),i18n("Switch
User"));
+ switchaction->setData(QUrl("leave:/switch"));
QAction *lockaction =
d->menuview->addAction(KIcon("system-lock-screen"),i18n("Lock"));
lockaction->setData(QUrl("leave:/lock"));
- }
- if (d->showLeaveLogout) {
QAction *logoutaction =
d->menuview->addAction(KIcon("system-log-out"),i18n("Logout"));
logoutaction->setData(QUrl("leave:/logout"));
- }
+ } break;
+ case Favorites: {
+ Kickoff::MenuView *favview = d->createMenuView(new
Kickoff::FavoritesModel(d->menuview));
+ d->addMenu(favview, true);
+ } break;
+ case Applications: {
+ ApplicationModel *appModel = new ApplicationModel();
+ appModel->setDuplicatePolicy(ApplicationModel::ShowLatestOnlyPolicy);
+ Kickoff::MenuView *appview = d->createMenuView(appModel);
+ d->addMenu(appview, false);
+ } break;
+ case Computer: {
+ Kickoff::MenuView *systemview = d->createMenuView(new
Kickoff::SystemModel());
+ d->addMenu(systemview, true);
+ } break;
+ case RecentlyUsed: {
+ Kickoff::MenuView *recentlyview = d->createMenuView(new
Kickoff::RecentlyUsedModel());
+ d->addMenu(recentlyview, true);
+ } break;
+ case Leave: {
+ Kickoff::MenuView *leaveview = d->createMenuView(new
Kickoff::LeaveModel(d->menuview));
+ d->addMenu(leaveview, true);
+ } break;
}
}
@@ -252,9 +323,10 @@
if (action->data().type() == QVariant::Url) {
QUrl url = action->data().toUrl();
if (url.scheme() == "leave") {
- Kickoff::UrlItemLauncher *launcher = d->appview ?
d->appview->launcher() : 0;
- if (launcher)
- launcher->openUrl(url.toString());
+ if ( ! d->launcher ) {
+ d->launcher = new Kickoff::UrlItemLauncher(d->menuview);
+ }
+ d->launcher->openUrl(url.toString());
}
}
else {
diff -ur kdebase-workspace-4.0.2/plasma/applets/kickoff/simpleapplet/simpleapplet.h
kdebase-workspace-4.0.2-kde#155362/plasma/applets/kickoff/simpleapplet/simpleapplet.h
--- kdebase-workspace-4.0.2/plasma/applets/kickoff/simpleapplet/simpleapplet.h 2008-01-05
00:55:49.000000000 +0100
+++
kdebase-workspace-4.0.2-kde#155362/plasma/applets/kickoff/simpleapplet/simpleapplet.h 2008-02-29
22:55:37.000000000 +0100
@@ -29,7 +29,25 @@
{
Q_OBJECT
+Q_ENUMS(ViewType)
+Q_ENUMS(FormatType)
public:
+
+ enum ViewType {
+ Combined = 0,
+ Favorites,
+ Applications,
+ Computer,
+ RecentlyUsed,
+ Leave
+ };
+
+ enum FormatType {
+ Name = 0,
+ Description,
+ NameDescription,
+ DescriptionName
+ };
MenuLauncherApplet(QObject *parent, const QVariantList &args);
virtual ~MenuLauncherApplet();
Index: kdebase-workspace.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kdebase-workspace/devel/kdebase-workspace.spec,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- kdebase-workspace.spec 29 Feb 2008 21:38:42 -0000 1.40
+++ kdebase-workspace.spec 29 Feb 2008 22:05:31 -0000 1.41
@@ -17,7 +17,7 @@
Patch2: kdebase-workspace-4.0.0-consolekit-kdm.patch
#
http://bugs.kde.org/155362 (show Name in addition to GenericName in simple menu)
# backported from trunk (KDE 4.1):
http://websvn.kde.org/?view=rev&revision=762886
-Patch3: kdebase-workspace-4.0.1-kde#155362.patch
+Patch3: kdebase-workspace-4.0.2-kde#155362.patch
# upgrade path for former kde-redhat'ers
Obsoletes: kdebase-kdm < 6:%{version}-%{release}
@@ -220,6 +220,7 @@
%changelog
* Fri Feb 29 2008 Kevin Kofler <Kevin(a)tigcc.ticalc.org> 4.0.2-2
- drop upstreamed kde#155974 patch
+- update kde#155362 patch
* Thu Feb 28 2008 Than Ngo <than(a)redhat.com> 4.0.2-1
- 4.0.2
--- kdebase-workspace-4.0.1-kde#155362.patch DELETED ---