From d233891da718cac0095edb1bcac38112f8538475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Wed, 6 Apr 2011 19:52:23 +0200 Subject: [PATCH] make kwinrules kcm more user friendly --- kcmkwin/kwinrules/CMakeLists.txt | 8 +- kcmkwin/kwinrules/detectwidget.cpp | 9 +- kcmkwin/kwinrules/detectwidget.h | 5 +- kcmkwin/kwinrules/detectwidget.ui | 191 +- kcmkwin/kwinrules/ruleslist.cpp | 67 + kcmkwin/kwinrules/ruleslist.h | 2 + kcmkwin/kwinrules/ruleslist.ui | 211 +- kcmkwin/kwinrules/ruleswidget.cpp | 30 +- kcmkwin/kwinrules/ruleswidgetbase.ui | 2921 ++++++++++++++------------ kcmkwin/kwinrules/yesnobox.h | 57 + 10 files changed, 1935 insertions(+), 1566 deletions(-) create mode 100644 kcmkwin/kwinrules/yesnobox.h diff --git a/kcmkwin/kwinrules/CMakeLists.txt b/kcmkwin/kwinrules/CMakeLists.txt index 835caf2b48..4e257b2f89 100644 --- a/kcmkwin/kwinrules/CMakeLists.txt +++ b/kcmkwin/kwinrules/CMakeLists.txt @@ -1,7 +1,9 @@ ADD_DEFINITIONS(-DKCMRULES) ########### next target ############### -set(kwinrules_SRCS ruleswidget.cpp ruleslist.cpp kwinsrc.cpp detectwidget.cpp) +set (kwinrules_MOC_HDRS yesnobox.h) +qt4_wrap_cpp(kwinrules_MOC_SRCS ${kwinrules_MOC_HDRS}) +set(kwinrules_SRCS ruleswidget.cpp ruleslist.cpp kwinsrc.cpp detectwidget.cpp ${kwinrules_MOC_SRCS}) kde4_add_ui_files(kwinrules_SRCS ruleslist.ui detectwidget.ui editshortcut.ui ruleswidgetbase.ui) @@ -10,7 +12,7 @@ set(kwin_rules_dialog_KDEINIT_SRCS main.cpp ${kwinrules_SRCS}) kde4_add_kdeinit_executable( kwin_rules_dialog ${kwin_rules_dialog_KDEINIT_SRCS}) -target_link_libraries(kdeinit_kwin_rules_dialog ${KDE4_KDEUI_LIBS} ${X11_LIBRARIES}) +target_link_libraries(kdeinit_kwin_rules_dialog ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${X11_LIBRARIES}) install(TARGETS kdeinit_kwin_rules_dialog ${INSTALL_TARGETS_DEFAULT_ARGS} ) install(TARGETS kwin_rules_dialog DESTINATION ${LIBEXEC_INSTALL_DIR} ) @@ -22,7 +24,7 @@ set(kcm_kwinrules_PART_SRCS kcm.cpp ${kwinrules_SRCS}) kde4_add_plugin(kcm_kwinrules ${kcm_kwinrules_PART_SRCS}) -target_link_libraries(kcm_kwinrules ${KDE4_KDEUI_LIBS} ${X11_LIBRARIES}) +target_link_libraries(kcm_kwinrules ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${X11_LIBRARIES}) install(TARGETS kcm_kwinrules DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kcmkwin/kwinrules/detectwidget.cpp b/kcmkwin/kwinrules/detectwidget.cpp index 9ba3f05504..dd3b6a3e1f 100644 --- a/kcmkwin/kwinrules/detectwidget.cpp +++ b/kcmkwin/kwinrules/detectwidget.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -58,10 +59,10 @@ DetectDialog::DetectDialog(QWidget* parent, const char* name) setMainWidget(widget); } -void DetectDialog::detect(WId window) +void DetectDialog::detect(WId window, int secs) { if (window == 0) - selectWindow(); + QTimer::singleShot(secs*1000, this, SLOT(selectWindow())); else readWindow(window); } @@ -117,6 +118,10 @@ void DetectDialog::executeDialog() widget->title_label->setText(title); widget->extrarole_label->setText(extrarole); widget->machine_label->setText(machine); + widget->adjustSize(); + adjustSize(); + if (width() < 4*height()/3) + resize(4*height()/3, height()); emit detectionDone(exec() == KDialog::Accepted); } diff --git a/kcmkwin/kwinrules/detectwidget.h b/kcmkwin/kwinrules/detectwidget.h index 62a96ef1ca..8ba95ec84c 100644 --- a/kcmkwin/kwinrules/detectwidget.h +++ b/kcmkwin/kwinrules/detectwidget.h @@ -47,7 +47,7 @@ class DetectDialog Q_OBJECT public: explicit DetectDialog(QWidget* parent = NULL, const char* name = NULL); - void detect(WId window); + void detect(WId window, int secs = 0); QByteArray selectedClass() const; bool selectedWholeClass() const; QByteArray selectedRole() const; @@ -61,8 +61,9 @@ signals: void detectionDone(bool); protected: virtual bool eventFilter(QObject* o, QEvent* e); -private: +private slots: void selectWindow(); +private: void readWindow(WId window); void executeDialog(); WId findWindow(); diff --git a/kcmkwin/kwinrules/detectwidget.ui b/kcmkwin/kwinrules/detectwidget.ui index 827ddcd928..8647a86a64 100644 --- a/kcmkwin/kwinrules/detectwidget.ui +++ b/kcmkwin/kwinrules/detectwidget.ui @@ -1,194 +1,219 @@ - + + KWin::DetectWidget - - + + 0 0 - 417 - 362 + 428 + 318 - - - - + + + + Information About Selected Window - + false - - - + + + QFrame::HLine - + QFrame::Sunken - - - + + + Class: - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + false - - - + + + - + false - - - + + + Role: - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + false - - - + + + - + false - - - + + + Type: - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + false - - - + + + - + false - - - + + + Title: - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + false - - - + + + - + false - - - + + + Extra role: - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + false - - - + + + - + false - - - + + + Machine: - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + false - - - + + + - + false - - - + + + + Match Strategy + + + true + + - - + + For selecting all windows belonging to a specific application, selecting only window class should usually work. - + Use window &class (whole application) - + true - - + + For selecting a specific window in an application, both window class and window role should be selected. Window class will determine the application, and window role the specific window in the application; many applications do not provide useful window roles though. - + Use window class and window &role (specific window) - - + + With some (non-KDE) applications whole window class can be sufficient for selecting a specific window in an application, as they set whole window class to contain both application and window role. - + Use &whole window class (specific window) - - + + Match also window &title @@ -196,24 +221,24 @@ - + - + Qt::Vertical - + QSizePolicy::Expanding - + 20 - 161 + 0 - + diff --git a/kcmkwin/kwinrules/ruleslist.cpp b/kcmkwin/kwinrules/ruleslist.cpp index c0f3b1b620..8265c51e10 100644 --- a/kcmkwin/kwinrules/ruleslist.cpp +++ b/kcmkwin/kwinrules/ruleslist.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "ruleswidget.h" @@ -48,6 +49,10 @@ KCMRulesList::KCMRulesList(QWidget* parent) SLOT(moveupClicked())); connect(movedown_button, SIGNAL(clicked()), SLOT(movedownClicked())); + connect(export_button, SIGNAL(clicked()), + SLOT(exportClicked())); + connect(import_button, SIGNAL(clicked()), + SLOT(importClicked())); connect(rules_listbox, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(modifyClicked())); load(); @@ -71,6 +76,7 @@ void KCMRulesList::activeChanged() rules_listbox->setCurrentItem(item, QItemSelectionModel::ClearAndSelect); modify_button->setEnabled(item != NULL); delete_button->setEnabled(item != NULL); + export_button->setEnabled(item != NULL); moveup_button->setEnabled(item != NULL && itemRow > 0); movedown_button->setEnabled(item != NULL && itemRow < (rules_listbox->count() - 1)); } @@ -142,6 +148,67 @@ void KCMRulesList::movedownClicked() emit changed(true); } +void KCMRulesList::exportClicked() +{ + int pos = rules_listbox->currentRow(); + assert(pos != -1); + QString path = KFileDialog::getSaveFileName(KUrl(), "*.kwinrule", this, i18n("Export Rule"), 0); + if (path.isEmpty()) + return; + KConfig config(path, KConfig::SimpleConfig); + KConfigGroup group(&config, rules[pos]->description); + group.deleteGroup(); + rules[pos]->write(group); +} + +void KCMRulesList::importClicked() +{ + QString path = KFileDialog::getOpenFileName(KUrl(), "*.kwinrule", this, i18n("Import Rules")); + if (path.isEmpty()) + return; + KConfig config(path, KConfig::SimpleConfig); + QStringList groups = config.groupList(); + if (groups.isEmpty()) + return; + + int pos = qMax(0, rules_listbox->currentRow()); + foreach (QString group, groups) { + KConfigGroup grp(&config, group); + const bool remove = grp.readEntry("DeleteRule", false); + Rules* new_rule = new Rules(grp); + + // try to replace existing rule first + for (int i = 0; i < rules.count(); ++i) { + if (rules[i]->description == new_rule->description) { + delete rules[i]; + if (remove) { + rules.remove(i); + delete rules_listbox->takeItem(i); + delete new_rule; + pos = qMax(0, rules_listbox->currentRow()); // might have changed! + } + else + rules[i] = new_rule; + new_rule = 0; + break; + } + } + + // don't add "to be deleted" if not present + if (remove) { + delete new_rule; + new_rule = 0; + } + + // plain insertion + if (new_rule) { + rules.insert(pos, new_rule); + rules_listbox->insertItem(pos++, new_rule->description); + } + } + emit changed(true); +} + void KCMRulesList::load() { rules_listbox->clear(); diff --git a/kcmkwin/kwinrules/ruleslist.h b/kcmkwin/kwinrules/ruleslist.h index 4eb0752bcd..b49f2594d0 100644 --- a/kcmkwin/kwinrules/ruleslist.h +++ b/kcmkwin/kwinrules/ruleslist.h @@ -45,6 +45,8 @@ private slots: void deleteClicked(); void moveupClicked(); void movedownClicked(); + void exportClicked(); + void importClicked(); void activeChanged(); private: QVector< Rules* > rules; diff --git a/kcmkwin/kwinrules/ruleslist.ui b/kcmkwin/kwinrules/ruleslist.ui index c1fc88d379..e268fa4e63 100644 --- a/kcmkwin/kwinrules/ruleslist.ui +++ b/kcmkwin/kwinrules/ruleslist.ui @@ -1,85 +1,128 @@ - - KWin::KCMRulesList - - - - 0 - 0 - 600 - 480 - - - - - 0 - - - - - - - - &New... - - - - - - - &Modify... - - - - - - - Delete - - - - - - - - - - Move &Up - - - - - - - Move &Down - - - - - - - - 20 - 294 - - - - Expanding - - - Vertical - - - - - - - - KListWidget - QListWidget -
klistwidget.h
-
-
- - kdialog.h - + + + KWin::KCMRulesList + + + + 0 + 0 + 600 + 480 + + + + + 0 + + + + + + + + &New... + + + + + + + &Modify... + + + + + + + Delete + + + + + + + + + + Move &Up + + + + + + + Move &Down + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 294 + + + + + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + + + + &Import + + + + + + + &Export + + + + + + + Qt::Horizontal + + + + + + + + KListWidget + QListWidget +
klistwidget.h
+
+ + KPushButton + QPushButton +
kpushbutton.h
+
+
+ + kdialog.h + + +
diff --git a/kcmkwin/kwinrules/ruleswidget.cpp b/kcmkwin/kwinrules/ruleswidget.cpp index b9fe8497e5..300191e0f9 100644 --- a/kcmkwin/kwinrules/ruleswidget.cpp +++ b/kcmkwin/kwinrules/ruleswidget.cpp @@ -331,7 +331,12 @@ static Options::MoveResizeMode comboToMoveResize(int val) static int typeToCombo(NET::WindowType type) { - if (type < NET::Normal || type > NET::Splash) + if (type < NET::Normal || type > NET::Splash || + type == NET::Override) // The user must NOT set a window to be unmanaged. + // This case is not handled in KWin and will lead to segfaults. + // Even iff it was supported, it would mean to allow the user to shoot himself + // since an unmanaged window has to manage itself, what is probably not the case when the hint is not set. + // Rule opportunity might be a relict from the Motif Hint window times of KDE1 return 0; // Normal static const int conv[] = { 0, // Normal @@ -340,7 +345,7 @@ static int typeToCombo(NET::WindowType type) 4, // Toolbar 5, // Menu 1, // Dialog - 8, // Override + 8, // Override - ignored. 9, // TopMenu 2, // Utility 6 // Splash @@ -359,7 +364,6 @@ static NET::WindowType comboToType(int val) NET::Menu, NET::Splash, NET::Desktop, - NET::Override, NET::TopMenu }; return conv[ val ]; @@ -387,6 +391,7 @@ static NET::WindowType comboToType(int val) #define CHECKBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, setChecked, setChecked( false )) #define LINEEDIT_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, setText, setText( "" )) #define COMBOBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, setCurrentIndex, setCurrentIndex( 0 )) +#define SPINBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, setValue, setValue(0)) void RulesWidget::setRules(Rules* rules) { @@ -440,8 +445,8 @@ void RulesWidget::setRules(Rules* rules) CHECKBOX_FORCE_RULE(autogroup,); CHECKBOX_FORCE_RULE(autogroupfg,); LINEEDIT_FORCE_RULE(autogroupid,); - LINEEDIT_FORCE_RULE(opacityactive, intToStr); - LINEEDIT_FORCE_RULE(opacityinactive, intToStr); + SPINBOX_FORCE_RULE(opacityactive,); + SPINBOX_FORCE_RULE(opacityinactive,); COMBOBOX_FORCE_RULE(tilingoption, tilingToCombo); LINEEDIT_SET_RULE(shortcut,); COMBOBOX_FORCE_RULE(fsplevel,); @@ -462,6 +467,7 @@ void RulesWidget::setRules(Rules* rules) #undef CHECKBOX_FORCE_RULE #undef LINEEDIT_FORCE_RULE #undef COMBOBOX_FORCE_RULE +#undef SPINBOX_FORCE_RULE #define GENERIC_RULE( var, func, Type, type, uimethod ) \ if ( enable_##var->isChecked() && rule_##var->currentIndex() >= 0) \ @@ -478,6 +484,7 @@ void RulesWidget::setRules(Rules* rules) #define CHECKBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, isChecked ) #define LINEEDIT_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, text ) #define COMBOBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, currentIndex ) +#define SPINBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, value) Rules* RulesWidget::rules() const { @@ -535,8 +542,8 @@ Rules* RulesWidget::rules() const CHECKBOX_FORCE_RULE(autogroup,); CHECKBOX_FORCE_RULE(autogroupfg,); LINEEDIT_FORCE_RULE(autogroupid,); - LINEEDIT_FORCE_RULE(opacityactive, strToInt); - LINEEDIT_FORCE_RULE(opacityinactive, strToInt); + SPINBOX_FORCE_RULE(opacityactive,); + SPINBOX_FORCE_RULE(opacityinactive,); COMBOBOX_FORCE_RULE(tilingoption, comboToTiling); LINEEDIT_SET_RULE(shortcut,); COMBOBOX_FORCE_RULE(fsplevel,); @@ -558,6 +565,7 @@ Rules* RulesWidget::rules() const #undef CHECKBOX_FORCE_RULE #undef LINEEDIT_FORCE_RULE #undef COMBOBOX_FORCE_RULE +#undef SPINBOX_FORCE_RULE #define STRING_MATCH_COMBO( type ) \ void RulesWidget::type##MatchChanged() \ @@ -579,7 +587,7 @@ void RulesWidget::detectClicked() assert(detect_dlg == NULL); detect_dlg = new DetectDialog; connect(detect_dlg, SIGNAL(detectionDone(bool)), this, SLOT(detected(bool))); - detect_dlg->detect(0); + detect_dlg->detect(0, Ui::RulesWidgetBase::detection_delay->value()); } void RulesWidget::detected(bool ok) @@ -630,6 +638,7 @@ void RulesWidget::detected(bool ok) #define CHECKBOX_PREFILL( var, func, info ) GENERIC_PREFILL( var, func, info, setChecked ) #define LINEEDIT_PREFILL( var, func, info ) GENERIC_PREFILL( var, func, info, setText ) #define COMBOBOX_PREFILL( var, func, info ) GENERIC_PREFILL( var, func, info, setCurrentIndex ) +#define SPINBOX_PREFILL( var, func, info ) GENERIC_PREFILL( var, func, info, setValue ) void RulesWidget::prefillUnusedValues(const KWindowInfo& info) { @@ -654,8 +663,8 @@ void RulesWidget::prefillUnusedValues(const KWindowInfo& info) //CHECKBOX_PREFILL( autogroup, ); //CHECKBOX_PREFILL( autogroupfg, ); //LINEEDIT_PREFILL( autogroupid, ); - LINEEDIT_PREFILL(opacityactive, intToStr, 100 /*get the actual opacity somehow*/); - LINEEDIT_PREFILL(opacityinactive, intToStr, 100 /*get the actual opacity somehow*/); + SPINBOX_PREFILL(opacityactive, , 100 /*get the actual opacity somehow*/); + SPINBOX_PREFILL(opacityinactive, , 100 /*get the actual opacity somehow*/); COMBOBOX_PREFILL(tilingoption, tilingToCombo, 0); //LINEEDIT_PREFILL( shortcut, ); //COMBOBOX_PREFILL( fsplevel, ); @@ -673,6 +682,7 @@ void RulesWidget::prefillUnusedValues(const KWindowInfo& info) #undef CHECKBOX_PREFILL #undef LINEEDIT_PREFILL #undef COMBOBOX_PREFILL +#undef SPINBOX_PREFILL bool RulesWidget::finalCheck() { diff --git a/kcmkwin/kwinrules/ruleswidgetbase.ui b/kcmkwin/kwinrules/ruleswidgetbase.ui index 84e05c08dc..e13a9ad0c1 100644 --- a/kcmkwin/kwinrules/ruleswidgetbase.ui +++ b/kcmkwin/kwinrules/ruleswidgetbase.ui @@ -6,29 +6,29 @@ 0 0 - 685 - 462 + 547 + 517 - - - 0 - - + + 0 - &Window + &Window matching - - + + De&scription: + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + false @@ -37,13 +37,16 @@ - + - + - Window &class (application type): + Window &class (application): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter false @@ -53,17 +56,7 @@ - - - - - - - Match w&hole window class - - - - + @@ -87,7 +80,10 @@ - + + + + false @@ -100,11 +96,21 @@ - + + + + Match w&hole window class + + + + Window &role: + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + false @@ -113,10 +119,7 @@ - - - - + @@ -140,7 +143,10 @@ - + + + + false @@ -150,7 +156,204 @@ - + + + + Window &types: + + + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing + + + false + + + types + + + + + + + Window t&itle: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + title + + + + + + + + Unimportant + + + + + Exact Match + + + + + Substring Match + + + + + Regular Expression + + + + + + + + false + + + Edit + + + + + + + + + + Extra role: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + extra + + + + + + + + Unimportant + + + + + Exact Match + + + + + Substring Match + + + + + Regular Expression + + + + + + + + false + + + Edit + + + + + + + + + + &Machine (hostname): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + machine + + + + + + + + Unimportant + + + + + Exact Match + + + + + Substring Match + + + + + Regular Expression + + + + + + + + false + + + Edit + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + @@ -172,6 +375,16 @@ + + + + s delay + + + 30 + + + @@ -187,14 +400,11 @@ - - + + Qt::Vertical - - QSizePolicy::Expanding - 20 @@ -203,64 +413,72 @@ - - + + - Qt::Horizontal + Qt::Vertical - 40 - 20 + 20 + 40 - - - - Qt::Horizontal + + + + + 0 + 0 + - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - - - - - Window &Extra - - - - - - Window &types: - - + false - - types + + Qt::ScrollBarAsNeeded + + + Qt::ScrollBarAsNeeded + + + true + + + false + + + QAbstractItemView::NoDragDrop + + + false - - - - QAbstractItemView::ExtendedSelection + + QListView::Static + + + QListView::TopToBottom + + + true + + + QListView::Adjust + + + 0 + + + QListView::ListMode + + + true + Normal Window @@ -303,7 +521,7 @@ - Override Type + Unmanaged Window @@ -313,279 +531,21 @@ - - - - Window t&itle: - - - false - - - title - - - - - - - - - - - Unimportant - - - - - Exact Match - - - - - Substring Match - - - - - Regular Expression - - - - - - - - false - - - Edit - - - - - - - - - - Extra role: - - - false - - - extra - - - - - - - - - - - Unimportant - - - - - Exact Match - - - - - Substring Match - - - - - Regular Expression - - - - - - - - false - - - Edit - - - - - - - - - - &Machine (hostname): - - - false - - - machine - - - - - - - - - - - Unimportant - - - - - Exact Match - - - - - Substring Match - - - - - Regular Expression - - - - - - - - false - - - Edit - - - - - - - - + + Qt::Horizontal - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Vertical - - - - 20 - 0 - - - + - &Geometry + &Size && Position - - - - - false - - - - Do Not Affect - - - - - Apply Initially - - - - - Remember - - - - - Force - - - - - Apply Now - - - - - Force Temporarily - - - - - - - - false - - - 0123456789-+,xX: - - - - - - - &Size - - - - + + &Position @@ -593,16 +553,6 @@ - - - false - - - 0123456789-+,xX: - - - - false @@ -639,18 +589,28 @@ - - + + false - - + + x,y + + + 0123456789-+,xX: - - + + + + &Size + + + + + false @@ -686,78 +646,48 @@ - - + + false - - + + width,height + + + 0123456789-+,xX: - + + + + Qt::Horizontal + + + + Maximized &horizontally - - + + false + + + + - + Maximized &vertically - - - - false - - - - Do Not Affect - - - - - Apply Initially - - - - - Remember - - - - - Force - - - - - Apply Now - - - - - Force Temporarily - - - - - - - - &Fullscreen - - - - + false @@ -794,14 +724,42 @@ - - - - Maximized &vertically + + + + false - + + + + Qt::Horizontal + + + + + + + &Fullscreen + + + + + + + false + + + + + + + &Desktop + + + + false @@ -838,39 +796,43 @@ - + false - - - - &Desktop + + + + Qt::Horizontal - + + + + M&inimized + + + + + + + false + + + + Sh&aded - - - - false - - - - - - - - + + false @@ -906,24 +868,31 @@ - - + + false - + + + + + + Qt::Horizontal + + + + + + - - - - - M&inimized + Initial p&lacement - + false @@ -945,7 +914,7 @@ - + false @@ -1002,14 +971,105 @@ - - + + + + Windows can ask to appear in a certain position. +By default this overrides the placement strategy +what might be nasty if the client abuses the feature +to unconditionally popup in the middle of your screen. + - P&lacement + Ignore requested &geometry - + + + + false + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + + + + + false + + + + + + + Qt::Horizontal + + + + + + + M&aximum size + + + + + + + false + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + + + + + false + + + width,height + + + 0123456789-+,xX: + + + + + + + false + + + + Qt::Vertical @@ -1025,8 +1085,8 @@ - - + + false @@ -1062,471 +1122,205 @@ + + + + false + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + + + + + false + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + + + + + false + + + width,height + + + 0123456789-+,xX: + + + + + + + false + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + + + + + M&inimum size + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Eg. terminals or video players can ask to keep a certain aspect ratio +or only grow by values larger than one +(eg. by the dimensions of one character). +This may be pointless and the restriction prevents arbitrary dimensions +like your complete screen area. + + + Qt::LeftToRight + + + Obey geometry restrictions + + + + + + + + + + false + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + - &Preferences + &Arrangement && Access - - + + Keep &above - - - - Keep &below - - - - - - - Skip &taskbar - - - - - - - &No border - - - - - - - Accept &focus - - - - - - - &Closeable - - - - - - - Autogroup with &identical - - - - - - - Autog&roup in foreground - - - - - - - Autogroup by I&D - - - - - - - A&ctive opacity in % - - - - - - - false - - - - Do Not Affect - - - - - Force - - - - - Force Temporarily - - - - - - - - false - - - 0123456789 - - - - - - - false - - - - - - - - - - false - - - - - - - - - - false - - - - - - - - - - false - - - - - - - - - - false - - - - - - - - - - false - - - - - - - - - - false - - - - - - - - - - false - - - - - - - - - - false - - - - - - - - - - false - - - - - - - false - - - - Do Not Affect - - - - - Force - - - - - Force Temporarily - - - - - - - - false - - - - Do Not Affect - - - - - Force - - - - - Force Temporarily - - - - - - - - false - - - - Do Not Affect - - - - - Force - - - - - Force Temporarily - - - - - - - - false - - - - Do Not Affect - - - - - Force - - - - - Force Temporarily - - - - - - - - false - - - - Do Not Affect - - - - - Force - - - - - Force Temporarily - - - - - - - - false - - - - Do Not Affect - - - - - Apply Initially - - - - - Remember - - - - - Force - - - - - Apply Now - - - - - Force Temporarily - - - - - - - - false - - - - Do Not Affect - - - - - Apply Initially - - - - - Remember - - - - - Force - - - - - Apply Now - - - - - Force Temporarily - - - - - - - - false - - - - Do Not Affect - - - - - Apply Initially - - - - - Remember - - - - - Force - - - - - Apply Now - - - - - Force Temporarily - - - - - - - - false - - - - Do Not Affect - - - - - Apply Initially - - - - - Remember - - - - - Force - - - - - Apply Now - - - - - Force Temporarily - - - - - + false @@ -1563,73 +1357,22 @@ - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 80 - - - - - - + + false - - - Do Not Affect - - - - - Force - - - - - Force Temporarily - - - - - - false - - - 0123456789 - - - - - + + - I&nactive opacity in % + Keep &below - - - - Shortcut - - - - - - - - + + false @@ -1665,28 +1408,140 @@ - - - - Edit... - - - - - + + false - + + + + Qt::Horizontal + + + + + + + Autogroup with &identical + + + + + + + Autog&roup in foreground + + + + + + + false + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + + + + + false + + + + + + + Autogroup by I&D + + + + + + + false + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + + + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + T&iling - + false @@ -1708,7 +1563,7 @@ - + false @@ -1725,21 +1580,138 @@ - + + + + + 0 + 0 + + + + Qt::Horizontal + + + + + + + false + + + + + + + Window shall (not) appear in the taskbar. + + + Skip &taskbar + + + + + + + false + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + + + + Window shall (not) appear in the manager for virtual desktops + Skip pa&ger - + + + + false + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + + + + + false + + + + + + Window shall (not) appear in the Alt+Tab list + Skip &switcher - + false @@ -1776,32 +1748,138 @@ - - + + false + + + + + + Qt::Horizontal + + + + + + Shortcut + + - - - - - W&orkarounds - - - - - - &Focus stealing prevention + + + + false + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + + + + + false - - + + + + false + + + Edit... + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 8 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 8 + + + + + + + + false + + + + + false @@ -1822,47 +1900,211 @@ - - + + + + + Appearance && &Fixes + + + + + + &No titlebar and frame + + + + + false - None + Do Not Affect - Low + Apply Initially - Normal + Remember - High + Force - Extreme + Apply Now + + + + + Force Temporarily - + + + + Qt::Horizontal + + + + + + + A&ctive opacity + + + + + + + false + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + + + + + false + + + % + + + 100 + + + 100 + + + + + + + I&nactive opacity + + + + + + + false + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + + + + + false + + + % + + + 100 + + + 100 + + + + + + + Qt::Horizontal + + + + &Moving/resizing - - + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 8 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Windows may prevent to get the focus (activate) when being clicked. +On the other hand you might wish to prevent a window +from getting focussed on a mouseclick. + + + Accept &focus + + + + + false @@ -1883,31 +2125,84 @@ - - + + + + false + + + + + + + When used, a window will receive +all keyboard inputs while it is active, including Alt+Tab etc. +This is especially interesting for emulators or virtual machines. + +Be warned: +you won't be able to Alt+Tab out of the window +nor use any other global shortcut (such as Alt+F2 to show KRunner) +while it's active! + + + Ignore global shortcuts + + + + + + + + false - Opaque + Do Not Affect - Transparent + Force + + + + + Force Temporarily - + + + + Qt::Horizontal + + + + + + + false + + + + + + + &Closeable + + + + Window &type - + false @@ -1929,7 +2224,7 @@ - + false @@ -1974,11 +2269,6 @@ Desktop - - - Override Type - - Standalone Menubar @@ -1986,215 +2276,152 @@ - - - - Ignore requested &geometry + + + + Qt::Horizontal - - - - false - - - - Do Not Affect - - - - - Force - - - - - Force Temporarily - - - - - - - - false - - - - - - - - - - M&inimum size - - - - - - - false - - - - Do Not Affect - - - - - Force - - - - - Force Temporarily - - - - - - - - false - - - 0123456789-+,xX: - - - - - - - M&aximum size - - - - - - - false - - - - Do Not Affect - - - - - Force - - - - - Force Temporarily - - - - - - - - false - - - 0123456789-+,xX: - - - - - - - Strictly obey geometry - - - - - - - - - - false - - - - Do Not Affect - - - - - Force - - - - - Force Temporarily - - - - - - - - false - - - - - - - - - - Block global shortcuts - - - - - - - - - - false - - - - Do Not Affect - - - - - Force - - - - - Force Temporarily - - - - - - - - false - - - - - - - + Block compositing - + + + + false + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 8 + + + + + + + + false + + + + Opaque + + + + + Transparent + + + + + + + + false + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + + + + + false + + + + + + + false + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + + false @@ -2216,28 +2443,73 @@ - - - - + + + + false + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + - - - - Qt::Vertical + + + + false - - QSizePolicy::Expanding + + + None + + + + + Low + + + + + Normal + + + + + High + + + + + Extreme + + + + + + + + KWin tries to prevent windows from taking the focus +("activate") while you're working in another window, +but this may sometimes fail or superact. +"None" will unconditionally allow this window to get the focus while +"Extreme" will completely prevent it from taking the focus. - - - 20 - 160 - + + &Focus stealing prevention - + @@ -2266,27 +2538,31 @@ KLineEdit
krestrictedline.h
+ + YesNoBox + QWidget +
yesnobox.h
+ 1 +
- tabs - description - wmclass - whole_wmclass - wmclass_match - edit_reg_wmclass - role - role_match - edit_reg_role detect + wmclass_match + wmclass + edit_reg_wmclass + whole_wmclass + role_match + role + edit_reg_role types - title title_match + title edit_reg_title - extra extra_match + extra edit_reg_extra - machine machine_match + machine edit_reg_machine enable_position rule_position @@ -2295,96 +2571,41 @@ rule_size size enable_maximizehoriz - rule_maximizehoriz - maximizehoriz enable_maximizevert rule_maximizevert - maximizevert enable_fullscreen - rule_fullscreen - fullscreen enable_desktop rule_desktop desktop enable_minimize - rule_minimize - minimize enable_shade rule_shade - shade enable_placement rule_placement placement + enable_ignoreposition + rule_ignoreposition + enable_maxsize + rule_maxsize + maxsize enable_above rule_above - above enable_below rule_below - below + enable_autogroup + enable_autogroupfg + rule_autogroupfg + enable_autogroupid + rule_autogroupid + enable_tilingoption enable_noborder rule_noborder - noborder - enable_skiptaskbar - rule_skiptaskbar - skiptaskbar - enable_skippager - rule_skippager - skippager - enable_skipswitcher - rule_skipswitcher - skipswitcher - enable_closeable - rule_closeable - closeable - enable_autogroup - rule_autogroup - autogroup enable_opacityactive - rule_opacityactive opacityactive enable_opacityinactive rule_opacityinactive opacityinactive - enable_tilingoption - rule_tilingoption - tilingoption - enable_shortcut - rule_shortcut - shortcut - shortcut_edit - enable_fsplevel - rule_fsplevel - fsplevel - enable_moveresizemode - rule_moveresizemode - moveresizemode - enable_type - rule_type - type - enable_ignoreposition - rule_ignoreposition - ignoreposition - enable_minsize - rule_minsize - minsize - enable_maxsize - rule_maxsize - maxsize - enable_strictgeometry - rule_strictgeometry - strictgeometry - enable_disableglobalshortcuts - rule_disableglobalshortcuts - disableglobalshortcuts - enable_autogroupfg - enable_autogroupid - autogroupfg - autogroupid - rule_autogroupid - rule_autogroupfg - enable_acceptfocus - rule_acceptfocus - acceptfocus + description @@ -2395,8 +2616,8 @@ detectClicked() - 20 - 20 + 247 + 89 20 @@ -2411,8 +2632,8 @@ wmclassMatchChanged() - 20 - 20 + 164 + 134 20 @@ -2427,72 +2648,8 @@ roleMatchChanged() - 20 - 20 - - - 20 - 20 - - - - - title_match - activated(int) - KWin::RulesWidgetBase - titleMatchChanged() - - - 20 - 20 - - - 20 - 20 - - - - - extra_match - activated(int) - KWin::RulesWidgetBase - extraMatchChanged() - - - 20 - 20 - - - 20 - 20 - - - - - machine_match - activated(int) - KWin::RulesWidgetBase - machineMatchChanged() - - - 20 - 20 - - - 20 - 20 - - - - - shortcut_edit - clicked() - KWin::RulesWidgetBase - shortcutEditClicked() - - - 20 - 20 + 164 + 188 20 diff --git a/kcmkwin/kwinrules/yesnobox.h b/kcmkwin/kwinrules/yesnobox.h new file mode 100644 index 0000000000..cc226e3fa0 --- /dev/null +++ b/kcmkwin/kwinrules/yesnobox.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2011 Thomas Lübking + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +#ifndef YESNOBOX_H +#define YESNOBOX_H + +#include +#include + +#include + +class YesNoBox : public QWidget { + Q_OBJECT +public: + YesNoBox( QWidget *parent ) : QWidget(parent) + { + QHBoxLayout *l = new QHBoxLayout(this); + l->setContentsMargins(0, 0, 0, 0); + l->addWidget(yes = new QRadioButton(i18n("Yes"), this)); + l->addWidget(no = new QRadioButton(i18n("No"), this)); + l->addStretch(100); + no->setChecked(true); + connect(yes, SIGNAL(clicked(bool)), this, SIGNAL(clicked(bool))); + connect(yes, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool))); + connect(no, SIGNAL(clicked(bool)), this, SLOT(noClicked(bool))); + } + bool isChecked() { return yes->isChecked(); } +public slots: + void setChecked(bool b) { yes->setChecked(b); } + void toggle() { yes->toggle(); } + +signals: + void clicked(bool checked = false); + void toggled(bool checked); +private slots: + void noClicked(bool checked) { emit clicked(!checked); } +private: + QRadioButton *yes, *no; +}; + +#endif // YESNOBOX_H