Make activities really optional in KWin
KWin is already able to work without activities but there was some code left in the rules GUI. REVIEW: 109815
This commit is contained in:
parent
8fa3f8daa8
commit
8116322f93
2 changed files with 26 additions and 2 deletions
|
@ -27,7 +27,10 @@
|
|||
#include <kwindowsystem.h>
|
||||
#include <KDE/KLocalizedString>
|
||||
#include <QRegExp>
|
||||
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
#include <KActivities/Consumer>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <kmessagebox.h>
|
||||
|
@ -86,7 +89,9 @@ RulesWidget::RulesWidget(QWidget* parent)
|
|||
SETUP(size, set);
|
||||
SETUP(desktop, set);
|
||||
SETUP(screen, set);
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
SETUP(activity, set);
|
||||
#endif
|
||||
SETUP(maximizehoriz, set);
|
||||
SETUP(maximizevert, set);
|
||||
SETUP(minimize, set);
|
||||
|
@ -126,6 +131,11 @@ RulesWidget::RulesWidget(QWidget* parent)
|
|||
edit_reg_title->hide();
|
||||
edit_reg_machine->hide();
|
||||
|
||||
#ifndef KWIN_BUILD_ACTIVITIES
|
||||
rule_activity->hide();
|
||||
enable_activity->hide();
|
||||
activity->hide();
|
||||
#endif
|
||||
int i;
|
||||
for (i = 1;
|
||||
i <= KWindowSystem::numberOfDesktops();
|
||||
|
@ -133,6 +143,7 @@ RulesWidget::RulesWidget(QWidget* parent)
|
|||
desktop->addItem(QString::number(i).rightJustified(2) + ':' + KWindowSystem::desktopName(i));
|
||||
desktop->addItem(i18n("All Desktops"));
|
||||
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
static KActivities::Consumer activities;
|
||||
foreach (const QString & activityId, activities.listActivities()) {
|
||||
activity->addItem(KActivities::Info::name(activityId), activityId);
|
||||
|
@ -141,6 +152,7 @@ RulesWidget::RulesWidget(QWidget* parent)
|
|||
#define NULL_UUID "00000000-0000-0000-0000-000000000000"
|
||||
activity->addItem(i18n("All Activities"), QString::fromLatin1(NULL_UUID));
|
||||
#undef NULL_UUID
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef SETUP
|
||||
|
@ -157,7 +169,9 @@ UPDATE_ENABLE_SLOT(position)
|
|||
UPDATE_ENABLE_SLOT(size)
|
||||
UPDATE_ENABLE_SLOT(desktop)
|
||||
UPDATE_ENABLE_SLOT(screen)
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
UPDATE_ENABLE_SLOT(activity)
|
||||
#endif
|
||||
UPDATE_ENABLE_SLOT(maximizehoriz)
|
||||
UPDATE_ENABLE_SLOT(maximizevert)
|
||||
UPDATE_ENABLE_SLOT(minimize)
|
||||
|
@ -275,7 +289,7 @@ int RulesWidget::comboToDesktop(int val) const
|
|||
return NET::OnAllDesktops;
|
||||
return val + 1;
|
||||
}
|
||||
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
int RulesWidget::activityToCombo(QString d) const
|
||||
{
|
||||
// TODO: ivan - do a multiselection list
|
||||
|
@ -296,7 +310,7 @@ QString RulesWidget::comboToActivity(int val) const
|
|||
|
||||
return activity->itemData(val).toString();
|
||||
}
|
||||
|
||||
#endif
|
||||
static int placementToCombo(Placement::Policy placement)
|
||||
{
|
||||
static const int conv[] = {
|
||||
|
@ -431,7 +445,9 @@ void RulesWidget::setRules(Rules* rules)
|
|||
LINEEDIT_SET_RULE(size, sizeToStr);
|
||||
COMBOBOX_SET_RULE(desktop, desktopToCombo);
|
||||
SPINBOX_SET_RULE(screen, inc);
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
COMBOBOX_SET_RULE(activity, activityToCombo);
|
||||
#endif
|
||||
CHECKBOX_SET_RULE(maximizehoriz,);
|
||||
CHECKBOX_SET_RULE(maximizevert,);
|
||||
CHECKBOX_SET_RULE(minimize,);
|
||||
|
@ -528,7 +544,9 @@ Rules* RulesWidget::rules() const
|
|||
LINEEDIT_SET_RULE(size, strToSize);
|
||||
COMBOBOX_SET_RULE(desktop, comboToDesktop);
|
||||
SPINBOX_SET_RULE(screen, dec);
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
COMBOBOX_SET_RULE(activity, comboToActivity);
|
||||
#endif
|
||||
CHECKBOX_SET_RULE(maximizehoriz,);
|
||||
CHECKBOX_SET_RULE(maximizevert,);
|
||||
CHECKBOX_SET_RULE(minimize,);
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#ifndef __RULESWIDGET_H__
|
||||
#define __RULESWIDGET_H__
|
||||
|
||||
#include <config-kwin.h>
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <kwindowsystem.h>
|
||||
#include <kkeysequencewidget.h>
|
||||
|
@ -58,7 +60,9 @@ private slots:
|
|||
void updateEnablesize();
|
||||
void updateEnabledesktop();
|
||||
void updateEnablescreen();
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
void updateEnableactivity();
|
||||
#endif
|
||||
void updateEnablemaximizehoriz();
|
||||
void updateEnablemaximizevert();
|
||||
void updateEnableminimize();
|
||||
|
@ -94,8 +98,10 @@ private slots:
|
|||
private:
|
||||
int desktopToCombo(int d) const;
|
||||
int comboToDesktop(int val) const;
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
int activityToCombo(QString d) const;
|
||||
QString comboToActivity(int val) const;
|
||||
#endif
|
||||
int comboToTiling(int val) const;
|
||||
int inc(int i) const { return i+1; }
|
||||
int dec(int i) const { return i-1; }
|
||||
|
|
Loading…
Reference in a new issue