diff --git a/kcmkwin/kwinrules/CMakeLists.txt b/kcmkwin/kwinrules/CMakeLists.txt
index ea02a2fcb..982a98762 100644
--- a/kcmkwin/kwinrules/CMakeLists.txt
+++ b/kcmkwin/kwinrules/CMakeLists.txt
@@ -1,104 +1,86 @@
# KI18N Translation Domain for this library
add_definitions(-DTRANSLATION_DOMAIN=\"kcmkwinrules\")
add_definitions(-DKCMRULES)
########### next target ###############
include_directories(../../)
-set(kwinrules_MOC_HDRS yesnobox.h ../../cursor.h ../../plugins/platforms/x11/standalone/x11cursor.h)
+set(kwinrules_MOC_HDRS ../../cursor.h ../../plugins/platforms/x11/standalone/x11cursor.h)
qt5_wrap_cpp(kwinrules_MOC_SRCS ${kwinrules_MOC_HDRS})
set(kwinrules_SRCS
../../rulebooksettings.cpp
- ruleswidget.cpp
optionsmodel.cpp
ruleitem.cpp
rulesmodel.cpp
rulesdialog.cpp
- ruleslist.cpp
main.cpp
kwinsrc.cpp
- detectwidget.cpp
${kwinrules_MOC_SRCS}
)
-ki18n_wrap_ui(kwinrules_SRCS ruleslist.ui detectwidget.ui editshortcut.ui ruleswidgetbase.ui)
-
kconfig_add_kcfg_files(kwinrules_SRCS ../../rulesettings.kcfgc)
kconfig_add_kcfg_files(kwinrules_SRCS ../../rulebooksettingsbase.kcfgc)
add_executable(kwin_rules_dialog ${kwinrules_SRCS})
set(kwin_kcm_rules_XCB_LIBS
XCB::CURSOR
XCB::XCB
XCB::XFIXES
)
set(kcm_libs
Qt5::Concurrent
Qt5::X11Extras
Qt5::QuickWidgets
KF5::Completion
KF5::ConfigWidgets
KF5::I18n
KF5::Service
KF5::WindowSystem
KF5::XmlGui
)
if (KWIN_BUILD_ACTIVITIES)
set(kcm_libs ${kcm_libs} KF5::Activities)
endif()
target_link_libraries(kwin_rules_dialog ${kcm_libs} ${kwin_kcm_rules_XCB_LIBS})
install(TARGETS kwin_rules_dialog DESTINATION ${LIBEXEC_INSTALL_DIR})
########### next target ###############
-set(kcm_kwinrules_PART_SRCS
- kcm.cpp
- ${kwinrules_SRCS}
-)
-
-add_library(kcm_kwinrules MODULE ${kcm_kwinrules_PART_SRCS})
-
-target_link_libraries(kcm_kwinrules ${kcm_libs} ${kwin_kcm_rules_XCB_LIBS})
-
-install(TARGETS kcm_kwinrules DESTINATION ${PLUGIN_INSTALL_DIR})
-
-########### next target ###############
-
set(kcmkwinrules_qml_SRCS
kcmrules.cpp
${kwinrules_SRCS}
)
add_library(kcm_kwinrules_qml MODULE ${kcmkwinrules_qml_SRCS})
target_link_libraries(kcm_kwinrules_qml
Qt5::Quick
KF5::I18n
KF5::ConfigWidgets
KF5::CoreAddons
KF5::QuickAddons
KF5::WindowSystem
${kcm_libs}
${kwin_kcm_rules_XCB_LIBS}
)
kcoreaddons_desktop_to_json(kcm_kwinrules_qml "kcm_kwinrules_qml.desktop" SERVICE_TYPES kcmodule.desktop)
# This desktop file is installed only for retrocompatibility with sycoca
install(TARGETS kcm_kwinrules_qml DESTINATION ${KDE_INSTALL_PLUGINDIR}/kcms)
install(FILES kcm_kwinrules_qml.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
kpackage_install_package(package kcm_kwinrules_qml kcms)
########### install files ###############
install(FILES kwinrules.desktop DESTINATION ${SERVICES_INSTALL_DIR})
diff --git a/kcmkwin/kwinrules/detectwidget.cpp b/kcmkwin/kwinrules/detectwidget.cpp
deleted file mode 100644
index db00184e7..000000000
--- a/kcmkwin/kwinrules/detectwidget.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (c) 2004 Lubos Lunak
- *
- * 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.
- */
-
-#include "detectwidget.h"
-#include "../../plugins/platforms/x11/standalone/x11cursor.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-Q_DECLARE_METATYPE(NET::WindowType)
-
-namespace KWin
-{
-
-DetectWidget::DetectWidget(QWidget* parent)
- : QWidget(parent)
-{
- setupUi(this);
-}
-
-DetectDialog::DetectDialog(QWidget* parent, const char* name)
- : QDialog(parent)
-{
- setObjectName(name);
- setModal(true);
- setLayout(new QVBoxLayout);
-
- widget = new DetectWidget(this);
- layout()->addWidget(widget);
-
- QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, this);
- layout()->addWidget(buttons);
-
- connect(buttons, SIGNAL(accepted()), SLOT(accept()));
- connect(buttons, SIGNAL(rejected()), SLOT(reject()));
-}
-
-void DetectDialog::detect(int secs)
-{
- QTimer::singleShot(secs*1000, this, SLOT(selectWindow()));
-}
-
-void DetectDialog::executeDialog()
-{
- static const char* const types[] = {
- I18N_NOOP("Normal Window"),
- I18N_NOOP("Desktop"),
- I18N_NOOP("Dock (panel)"),
- I18N_NOOP("Toolbar"),
- I18N_NOOP("Torn-Off Menu"),
- I18N_NOOP("Dialog Window"),
- I18N_NOOP("Override Type"),
- I18N_NOOP("Standalone Menubar"),
- I18N_NOOP("Utility Window"),
- I18N_NOOP("Splash Screen")
- };
- widget->class_label->setText(wmclass_class + QLatin1String(" (") + wmclass_name + ' ' + wmclass_class + ')');
- widget->role_label->setText(role);
- widget->match_role->setEnabled(!role.isEmpty());
- if (type == NET::Unknown)
- widget->type_label->setText(i18n("Unknown - will be treated as Normal Window"));
- else
- widget->type_label->setText(i18n(types[ type ]));
- widget->title_label->setText(title);
- widget->machine_label->setText(machine);
- widget->adjustSize();
- adjustSize();
- if (width() < 4*height()/3)
- resize(4*height()/3, height());
- emit detectionDone(exec() == QDialog::Accepted);
-}
-
-QByteArray DetectDialog::selectedClass() const
-{
- if (widget->match_whole_class->isChecked())
- return wmclass_name + ' ' + wmclass_class;
- return wmclass_class;
-}
-
-bool DetectDialog::selectedWholeClass() const
-{
- return widget->match_whole_class->isChecked();
-}
-
-QByteArray DetectDialog::selectedRole() const
-{
- if (widget->match_role->isChecked())
- return role;
- return "";
-}
-
-QString DetectDialog::selectedTitle() const
-{
- return title;
-}
-
-Rules::StringMatch DetectDialog::titleMatch() const
-{
- return widget->match_title->isChecked() ? Rules::ExactMatch : Rules::UnimportantMatch;
-}
-
-bool DetectDialog::selectedWholeApp() const
-{
- return !widget->match_type->isChecked();
-}
-
-NET::WindowType DetectDialog::selectedType() const
-{
- return type;
-}
-
-QByteArray DetectDialog::selectedMachine() const
-{
- return machine;
-}
-
-void DetectDialog::selectWindow()
-{
- QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.KWin"),
- QStringLiteral("/KWin"),
- QStringLiteral("org.kde.KWin"),
- QStringLiteral("queryWindowInfo"));
- QDBusPendingReply async = QDBusConnection::sessionBus().asyncCall(message);
-
- QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(async, this);
- connect(callWatcher, &QDBusPendingCallWatcher::finished, this,
- [this](QDBusPendingCallWatcher *self) {
- QDBusPendingReply reply = *self;
- self->deleteLater();
- if (!reply.isValid()) {
- emit detectionDone(false);
- return;
- }
- m_windowInfo = reply.value();
- wmclass_class = m_windowInfo.value("resourceClass").toByteArray();
- wmclass_name = m_windowInfo.value("resourceName").toByteArray();
- role = m_windowInfo.value("role").toByteArray();
- type = m_windowInfo.value("type").value();
- title = m_windowInfo.value("caption").toString();
- machine = m_windowInfo.value("clientMachine").toByteArray();
- executeDialog();
- }
- );
-}
-
-} // namespace
-
diff --git a/kcmkwin/kwinrules/detectwidget.h b/kcmkwin/kwinrules/detectwidget.h
deleted file mode 100644
index c0a208f60..000000000
--- a/kcmkwin/kwinrules/detectwidget.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2004 Lubos Lunak
- *
- * 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 __DETECTWIDGET_H__
-#define __DETECTWIDGET_H__
-
-#include
-#include
-
-#include "../../rules.h"
-//Added by qt3to4:
-#include
-#include
-
-#include "ui_detectwidget.h"
-
-namespace KWin
-{
-
-class DetectWidget
- : public QWidget, public Ui_DetectWidget
-{
- Q_OBJECT
-public:
- explicit DetectWidget(QWidget* parent = nullptr);
-};
-
-class DetectDialog
- : public QDialog
-{
- Q_OBJECT
-public:
- explicit DetectDialog(QWidget* parent = nullptr, const char* name = nullptr);
- void detect(int secs = 0);
- QByteArray selectedClass() const;
- bool selectedWholeClass() const;
- QByteArray selectedRole() const;
- bool selectedWholeApp() const;
- NET::WindowType selectedType() const;
- QString selectedTitle() const;
- Rules::StringMatch titleMatch() const;
- QByteArray selectedMachine() const;
-
- const QVariantMap &windowInfo() const {
- return m_windowInfo;
- }
-
-Q_SIGNALS:
- void detectionDone(bool);
-private Q_SLOTS:
- void selectWindow();
-private:
- void executeDialog();
- QByteArray wmclass_class;
- QByteArray wmclass_name;
- QByteArray role;
- NET::WindowType type;
- QString title;
- QByteArray extrarole;
- QByteArray machine;
- DetectWidget* widget;
- QVariantMap m_windowInfo;
-};
-
-} // namespace
-
-#endif
diff --git a/kcmkwin/kwinrules/detectwidget.ui b/kcmkwin/kwinrules/detectwidget.ui
deleted file mode 100644
index 9fd3aa723..000000000
--- a/kcmkwin/kwinrules/detectwidget.ui
+++ /dev/null
@@ -1,229 +0,0 @@
-
-
- KWin::DetectWidget
-
-
-
- 0
- 0
- 450
- 300
-
-
-
- -
-
-
- Information About Selected Window
-
-
- true
-
-
-
- 0
-
-
-
-
-
- Class:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- false
-
-
-
- -
-
-
-
- true
-
-
-
-
-
-
- false
-
-
-
- -
-
-
- Role:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- false
-
-
-
- -
-
-
-
- true
-
-
-
-
-
-
- false
-
-
-
- -
-
-
- Type:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- false
-
-
-
- -
-
-
-
- true
-
-
-
-
-
-
- false
-
-
-
- -
-
-
- Title:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- false
-
-
-
- -
-
-
-
- true
-
-
-
-
-
-
- false
-
-
-
- -
-
-
- Machine:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- false
-
-
-
- -
-
-
-
- true
-
-
-
-
-
-
- false
-
-
-
-
-
-
- -
-
-
- Match by primary class name and
-
-
- true
-
-
-
-
-
-
- Secondary class name (resulting in term in brackets)
-
-
-
- -
-
-
- Window role (can be used to select windows by function)
-
-
-
- -
-
-
- Window type (eg. all dialogs, but not the main windows)
-
-
-
- -
-
-
- Window title (very specific, can fail due to content changes or translation)
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Expanding
-
-
-
- 20
- 0
-
-
-
-
-
-
-
-
-
diff --git a/kcmkwin/kwinrules/editshortcut.ui b/kcmkwin/kwinrules/editshortcut.ui
deleted file mode 100644
index bfc1f9335..000000000
--- a/kcmkwin/kwinrules/editshortcut.ui
+++ /dev/null
@@ -1,161 +0,0 @@
-
- EditShortcut
-
-
-
- 0
- 0
- 1194
- 447
-
-
-
- -
-
-
- A single shortcut can be easily assigned or cleared using the two buttons. Only shortcuts with modifiers can be used.<p>
-It is possible to have several possible shortcuts, and the first available shortcut will be used. The shortcuts are specified using shortcut sets separated by " - ". One set is specified as <i>base</i>+(<i>list</i>), where base are modifiers and list is a list of keys.<br>
-For example "<b>Shift+Alt+(123) Shift+Ctrl+(ABC)</b>" will first try <b>Shift+Alt+1</b>, then others with <b>Shift+Ctrl+C</b> as the last one.
-
-
- Qt::RichText
-
-
- true
-
-
-
- -
-
-
- QFrame::HLine
-
-
- QFrame::Sunken
-
-
-
- -
-
-
- -
-
-
-
-
-
- Qt::Vertical
-
-
- QSizePolicy::Expanding
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- &Single Shortcut
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Expanding
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- C&lear
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Expanding
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- QFrame::HLine
-
-
- QFrame::Sunken
-
-
-
-
-
-
-
- KLineEdit
- QWidget
-
-
-
-
-
-
- pushButton1
- clicked()
- EditShortcut
- editShortcut()
-
-
- 20
- 20
-
-
- 20
- 20
-
-
-
-
- pushButton2
- clicked()
- EditShortcut
- clearShortcut()
-
-
- 20
- 20
-
-
- 20
- 20
-
-
-
-
-
diff --git a/kcmkwin/kwinrules/kcm.cpp b/kcmkwin/kwinrules/kcm.cpp
deleted file mode 100644
index d8f24df9b..000000000
--- a/kcmkwin/kwinrules/kcm.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2004 Lubos Lunak
- *
- * 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.
- */
-
-#include "kcm.h"
-
-#include
-//Added by qt3to4:
-#include
-#include
-#include
-#include
-#include
-
-#include "ruleslist.h"
-#include
-#include
-
-K_PLUGIN_FACTORY(KCMRulesFactory,
- registerPlugin();
- )
-
-namespace KWin
-{
-
-KCMRules::KCMRules(QWidget *parent, const QVariantList &)
- : KCModule(parent)
-{
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->setContentsMargins(0, 0, 0, 0);
-
- widget = new KCMRulesList(this);
- layout->addWidget(widget);
- connect(widget, SIGNAL(changed(bool)), SLOT(moduleChanged(bool)));
- KAboutData *about = new KAboutData(QStringLiteral("kcmkwinrules"),
- i18n("Window-Specific Settings Configuration Module"),
- QString(), QString(), KAboutLicense::GPL, i18n("(c) 2004 KWin and KControl Authors"));
- about->addAuthor(i18n("Lubos Lunak"), QString(), "l.lunak@kde.org");
- setAboutData(about);
- setButtons(KCModule::Help | KCModule::Apply);
-}
-
-void KCMRules::load()
-{
- widget->load();
- emit KCModule::changed(false);
-}
-
-void KCMRules::save()
-{
- widget->save();
- emit KCModule::changed(false);
- // Send signal to all kwin instances
- QDBusMessage message =
- QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
- QDBusConnection::sessionBus().send(message);
-
-}
-
-QString KCMRules::quickHelp() const
-{
- return i18n("Window-specific Settings
Here you can customize window settings specifically only"
- " for some windows.
"
- " Please note that this configuration will not take effect if you do not use"
- " KWin as your window manager. If you do use a different window manager, please refer to its documentation"
- " for how to customize window behavior.
");
-}
-
-void KCMRules::moduleChanged(bool state)
-{
- emit KCModule::changed(state);
-}
-
-}
-
-// i18n freeze :-/
-#if 0
-I18N_NOOP("Remember settings separately for every window")
-I18N_NOOP("Show internal settings for remembering")
-I18N_NOOP("Internal setting for remembering")
-#endif
-
-
-#include "kcm.moc"
diff --git a/kcmkwin/kwinrules/kcm.h b/kcmkwin/kwinrules/kcm.h
deleted file mode 100644
index b096b2e6b..000000000
--- a/kcmkwin/kwinrules/kcm.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2004 Lubos Lunak
- *
- * 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 __KCM_H__
-#define __KCM_H__
-
-#include
-#include
-
-class KConfig;
-
-namespace KWin
-{
-
-class KCMRulesList;
-
-class KCMRules
- : public KCModule
-{
- Q_OBJECT
-public:
- KCMRules(QWidget *parent, const QVariantList &args);
- void load() override;
- void save() override;
- QString quickHelp() const override;
-protected Q_SLOTS:
- void moduleChanged(bool state);
-private:
- KCMRulesList* widget;
-};
-
-} // namespace
-
-#endif
diff --git a/kcmkwin/kwinrules/kcmrules.cpp b/kcmkwin/kwinrules/kcmrules.cpp
index c49ec16c3..44eb30047 100644
--- a/kcmkwin/kwinrules/kcmrules.cpp
+++ b/kcmkwin/kwinrules/kcmrules.cpp
@@ -1,305 +1,306 @@
/*
* Copyright (c) 2004 Lubos Lunak
* Copyright (c) 2020 Ismael Asensio
*
* 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) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* 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, see .
*/
#include "kcmrules.h"
#include
#include
#include
+#include
#include
#include
namespace
{
const QString s_configFile { QLatin1String("kwinrulesrc") };
}
namespace KWin
{
KCMKWinRules::KCMKWinRules(QObject *parent, const QVariantList &arguments)
: KQuickAddons::ConfigModule(parent, arguments)
, m_ruleBook(new RuleBookSettings(this))
, m_rulesModel(new RulesModel(this))
{
auto about = new KAboutData(QStringLiteral("kcm_kwinrules_qml"),
i18n("Window Rules"),
QStringLiteral("1.0"),
QString(),
KAboutLicense::GPL);
about->addAuthor(i18n("Ismael Asensio"),
i18n("Author"),
QStringLiteral("isma.af@gmail.com"));
setAboutData(about);
setQuickHelp(i18n("Window-specific Settings
Here you can customize window settings specifically only"
" for some windows."
" Please note that this configuration will not take effect if you do not use"
" KWin as your window manager. If you do use a different window manager, please refer to its documentation"
" for how to customize window behavior.
"));
connect(m_rulesModel, &RulesModel::descriptionChanged, this, [this]{
if (m_editingIndex >=0 && m_editingIndex < m_ruleBook->count()) {
m_ruleList.at(m_editingIndex)->description = m_rulesModel->description();
emit ruleBookModelChanged();
}
} );
connect(m_rulesModel, &RulesModel::dataChanged, this, &KCMKWinRules::updateNeedsSave);
}
KCMKWinRules::~KCMKWinRules() {
delete m_ruleBook;
}
QStringList KCMKWinRules::ruleBookModel() const
{
QStringList ruleDescriptionList;
for (const Rules *rule : qAsConst(m_ruleList)) {
ruleDescriptionList.append(rule->description);
}
return ruleDescriptionList;
}
void KCMKWinRules::load()
{
m_ruleBook->load();
const auto rules = m_ruleBook->rules();
m_ruleList = QList::fromVector(rules);
setNeedsSave(false);
emit ruleBookModelChanged();
// Check if current index is no longer valid
if (m_editingIndex >= m_ruleList.count()) {
m_editingIndex = -1;
pop();
emit editingIndexChanged();
}
// Reset current index for rule editor
if (m_editingIndex > 0) {
m_rulesModel->importFromRules(m_ruleList.at(m_editingIndex));
}
}
void KCMKWinRules::save()
{
saveCurrentRule();
m_ruleBook->setRules(m_ruleList.toVector());
m_ruleBook->save();
QDBusMessage message = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
void KCMKWinRules::updateState()
{
m_ruleBook->setCount(m_ruleList.count());
emit editingIndexChanged();
emit ruleBookModelChanged();
updateNeedsSave();
}
void KCMKWinRules::updateNeedsSave()
{
setNeedsSave(true);
emit needsSaveChanged();
}
void KCMKWinRules::saveCurrentRule()
{
if (m_editingIndex < 0) {
return;
}
if (needsSave()) {
delete(m_ruleList[m_editingIndex]);
m_ruleList[m_editingIndex] = m_rulesModel->exportToRules();
}
}
int KCMKWinRules::editingIndex() const
{
return m_editingIndex;
}
void KCMKWinRules::editRule(int index)
{
if (index < 0 || index >= m_ruleList.count()) {
return;
}
saveCurrentRule();
m_editingIndex = index;
m_rulesModel->importFromRules(m_ruleList.at(m_editingIndex));
emit editingIndexChanged();
// Show and move to Rules Editor page
if (depth() < 2) {
push(QStringLiteral("RulesEditor.qml"));
}
setCurrentIndex(1);
}
void KCMKWinRules::newRule()
{
m_ruleList.append(new Rules());
updateState();
const int newIndex = m_ruleList.count() - 1;
editRule(newIndex);
saveCurrentRule();
}
void KCMKWinRules::removeRule(int index)
{
const int lastIndex = m_ruleList.count() - 1;
if (index < 0 || index > lastIndex) {
return;
}
if (m_editingIndex == index) {
m_editingIndex = -1;
pop();
}
m_ruleList.removeAt(index);
updateState();
}
void KCMKWinRules::moveRule(int sourceIndex, int destIndex)
{
const int lastIndex = m_ruleList.count() - 1;
if (sourceIndex == destIndex
|| (sourceIndex < 0 || sourceIndex > lastIndex)
|| (destIndex < 0 || destIndex > lastIndex)) {
return;
}
m_ruleList.move(sourceIndex, destIndex);
if (m_editingIndex == sourceIndex) {
m_editingIndex = destIndex;
emit editingIndexChanged();
} else if (m_editingIndex > sourceIndex && m_editingIndex <= destIndex) {
m_editingIndex -= 1;
emit editingIndexChanged();
} else if (m_editingIndex < sourceIndex && m_editingIndex >= destIndex) {
m_editingIndex += 1;
emit editingIndexChanged();
}
emit ruleBookModelChanged();
}
void KCMKWinRules::exportRule(int index)
{
Q_ASSERT(index >= 0 && index < m_ruleList.count());
saveCurrentRule();
const QString description = m_ruleList.at(index)->description;
const QString defaultPath = QDir(QDir::home()).filePath(description + QStringLiteral(".kwinrule"));
const QString path = QFileDialog::getSaveFileName(nullptr, i18n("Export Rules"), defaultPath,
i18n("KWin Rules (*.kwinrule)"));
if (path.isEmpty())
return;
const auto config = KSharedConfig::openConfig(path, KConfig::SimpleConfig);
RuleSettings settings(config, m_ruleList.at(index)->description);
settings.setDefaults();
m_ruleList.at(index)->write(&settings);
settings.save();
}
void KCMKWinRules::importRules()
{
QString path = QFileDialog::getOpenFileName(nullptr,
i18n("Import Rules"),
QDir::home().absolutePath(),
i18n("KWin Rules (*.kwinrule)"));
if (path.isEmpty()) {
return;
}
const auto config = KSharedConfig::openConfig(path, KConfig::SimpleConfig);
const QStringList groups = config->groupList();
if (groups.isEmpty()) {
return;
}
for (const QString &groupName : groups) {
RuleSettings settings(config, groupName);
const bool remove = settings.deleteRule();
const QString importDescription = settings.description();
if (importDescription.isEmpty()) {
continue;
}
// Try to find a rule with the same description to replace
int newIndex = -2;
for (int index = 0; index < m_ruleList.count(); index++) {
if (m_ruleList.at(index)->description == importDescription) {
newIndex = index;
break;
}
}
if (remove) {
removeRule(newIndex);
continue;
}
Rules *newRule = new Rules(&settings);
if (newIndex < 0) {
m_ruleList.append(newRule);
} else {
delete m_ruleList[newIndex];
m_ruleList[newIndex] = newRule;
}
// Reset rule editor if the current rule changed when importing
if (m_editingIndex == newIndex) {
m_rulesModel->importFromRules(m_ruleList.at(m_editingIndex));
}
}
updateState();
}
K_PLUGIN_CLASS_WITH_JSON(KCMKWinRules, "kcm_kwinrules_qml.json");
} // namespace
#include "kcmrules.moc"
diff --git a/kcmkwin/kwinrules/kcmrules.h b/kcmkwin/kwinrules/kcmrules.h
index 3aefe15c2..50df22cf3 100644
--- a/kcmkwin/kwinrules/kcmrules.h
+++ b/kcmkwin/kwinrules/kcmrules.h
@@ -1,83 +1,82 @@
/*
* Copyright (c) 2020 Ismael Asensio
*
* 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) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* 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, see .
*/
#pragma once
#include
-#include "rulesmodel.h"
#include "rulebooksettings.h"
+#include "rulesmodel.h"
#include
-#include
#include
namespace KWin
{
class KCMKWinRules : public KQuickAddons::ConfigModule
{
Q_OBJECT
Q_PROPERTY(QStringList ruleBookModel READ ruleBookModel NOTIFY ruleBookModelChanged)
Q_PROPERTY(int editingIndex READ editingIndex NOTIFY editingIndexChanged)
Q_PROPERTY(RulesModel *rulesModel MEMBER m_rulesModel CONSTANT)
public:
explicit KCMKWinRules(QObject *parent, const QVariantList &arguments);
~KCMKWinRules();
public slots:
void load() override;
void save() override;
QStringList ruleBookModel() const;
int editingIndex() const;
void editRule(int index);
void newRule();
void removeRule(int index);
void moveRule(int sourceIndex, int destIndex);
void exportRule(int index);
void importRules();
signals:
void ruleBookModelChanged();
void editingIndexChanged();
private slots:
void updateNeedsSave();
void updateState();
private:
void saveCurrentRule();
private:
RuleBookSettings *m_ruleBook;
QList m_ruleList;
RulesModel* m_rulesModel;
int m_editingIndex = -1;
};
} // namespace
diff --git a/kcmkwin/kwinrules/main.cpp b/kcmkwin/kwinrules/main.cpp
index da4fe8379..69b9b0031 100644
--- a/kcmkwin/kwinrules/main.cpp
+++ b/kcmkwin/kwinrules/main.cpp
@@ -1,251 +1,250 @@
/*
* Copyright (c) 2004 Lubos Lunak
*
* 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.
*/
#include
#include
#include
#include
#include
-#include "ruleswidget.h"
#include "rulebooksettings.h"
#include "rulesdialog.h"
#include "../../rules.h"
#include
#include
#include
#include
#include
#include
Q_DECLARE_METATYPE(NET::WindowType)
namespace KWin
{
static Rules *findRule(const QVector &rules, const QVariantMap &data, bool whole_app)
{
QByteArray wmclass_class = data.value("resourceClass").toByteArray().toLower();
QByteArray wmclass_name = data.value("resourceName").toByteArray().toLower();
QByteArray role = data.value("role").toByteArray().toLower();
NET::WindowType type = data.value("type").value();
QString title = data.value("caption").toString();
QByteArray machine = data.value("clientMachine").toByteArray();
Rules* best_match = nullptr;
int match_quality = 0;
for (const auto rule : rules) {
// try to find an exact match, i.e. not a generic rule
int quality = 0;
bool generic = true;
if (rule->wmclassmatch != Rules::ExactMatch)
continue; // too generic
if (!rule->matchWMClass(wmclass_class, wmclass_name))
continue;
// from now on, it matches the app - now try to match for a specific window
if (rule->wmclasscomplete) {
quality += 1;
generic = false; // this can be considered specific enough (old X apps)
}
if (!whole_app) {
if (rule->windowrolematch != Rules::UnimportantMatch) {
quality += rule->windowrolematch == Rules::ExactMatch ? 5 : 1;
generic = false;
}
if (rule->titlematch != Rules::UnimportantMatch) {
quality += rule->titlematch == Rules::ExactMatch ? 3 : 1;
generic = false;
}
if (rule->types != NET::AllTypesMask) {
int bits = 0;
for (unsigned int bit = 1;
bit < 1U << 31;
bit <<= 1)
if (rule->types & bit)
++bits;
if (bits == 1)
quality += 2;
}
if (generic) // ignore generic rules, use only the ones that are for this window
continue;
} else {
if (rule->types == NET::AllTypesMask)
quality += 2;
}
if (!rule->matchType(type)
|| !rule->matchRole(role)
|| !rule->matchTitle(title)
|| !rule->matchClientMachine(machine, data.value("localhost").toBool()))
continue;
if (quality > match_quality) {
best_match = rule;
match_quality = quality;
}
}
if (best_match != nullptr)
return best_match;
Rules* ret = new Rules;
if (whole_app) {
ret->description = i18n("Application settings for %1", QString::fromLatin1(wmclass_class));
// TODO maybe exclude some types? If yes, then also exclude them above
// when searching.
ret->types = NET::AllTypesMask;
ret->titlematch = Rules::UnimportantMatch;
ret->clientmachine = machine; // set, but make unimportant
ret->clientmachinematch = Rules::UnimportantMatch;
ret->windowrolematch = Rules::UnimportantMatch;
if (wmclass_name == wmclass_class) {
ret->wmclasscomplete = false;
ret->wmclass = wmclass_class;
ret->wmclassmatch = Rules::ExactMatch;
} else {
// WM_CLASS components differ - perhaps the app got -name argument
ret->wmclasscomplete = true;
ret->wmclass = wmclass_name + ' ' + wmclass_class;
ret->wmclassmatch = Rules::ExactMatch;
}
return ret;
}
ret->description = i18n("Window settings for %1", QString::fromLatin1(wmclass_class));
if (type == NET::Unknown)
ret->types = NET::NormalMask;
else
ret->types = NET::WindowTypeMask( 1 << type); // convert type to its mask
ret->title = title; // set, but make unimportant
ret->titlematch = Rules::UnimportantMatch;
ret->clientmachine = machine; // set, but make unimportant
ret->clientmachinematch = Rules::UnimportantMatch;
if (!role.isEmpty()
&& role != "unknown" && role != "unnamed") { // Qt sets this if not specified
ret->windowrole = role;
ret->windowrolematch = Rules::ExactMatch;
if (wmclass_name == wmclass_class) {
ret->wmclasscomplete = false;
ret->wmclass = wmclass_class;
ret->wmclassmatch = Rules::ExactMatch;
} else {
// WM_CLASS components differ - perhaps the app got -name argument
ret->wmclasscomplete = true;
ret->wmclass = wmclass_name + ' ' + wmclass_class;
ret->wmclassmatch = Rules::ExactMatch;
}
} else { // no role set
if (wmclass_name != wmclass_class) {
ret->wmclasscomplete = true;
ret->wmclass = wmclass_name + ' ' + wmclass_class;
ret->wmclassmatch = Rules::ExactMatch;
} else {
// This is a window that has no role set, and both components of WM_CLASS
// match (possibly only differing in case), which most likely means either
// the application doesn't give a damn about distinguishing its various
// windows, or it's an app that uses role for that, but this window
// lacks it for some reason. Use non-complete WM_CLASS matching, also
// include window title in the matching, and pray it causes many more positive
// matches than negative matches.
ret->titlematch = Rules::ExactMatch;
ret->wmclasscomplete = false;
ret->wmclass = wmclass_class;
ret->wmclassmatch = Rules::ExactMatch;
}
}
return ret;
}
static void edit(const QVariantMap &data, bool whole_app)
{
RuleBookSettings settings(KConfig::NoGlobals);
QVector rules = settings.rules();
Rules *orig_rule = findRule(rules, data, whole_app);
RulesDialog dlg;
if (whole_app)
dlg.setWindowTitle(i18nc("Window caption for the application wide rules dialog", "Edit Application-Specific Settings"));
// dlg.edit() creates new Rules instance if edited
Rules* edited_rule = dlg.edit(orig_rule, data, true);
if (edited_rule == nullptr || edited_rule->isEmpty()) {
rules.removeAll(orig_rule);
delete orig_rule;
if (orig_rule != edited_rule)
delete edited_rule;
} else if (edited_rule != orig_rule) {
int pos = rules.indexOf(orig_rule);
if (pos != -1)
rules[ pos ] = edited_rule;
else
rules.prepend(edited_rule);
delete orig_rule;
}
settings.setRules(rules);
settings.save();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
qApp->quit();
}
} // namespace
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
app.setApplicationDisplayName(i18n("KWin"));
app.setApplicationName("kwin_rules_dialog");
app.setApplicationVersion("1.0");
bool whole_app = false;
QUuid uuid;
{
QCommandLineParser parser;
parser.setApplicationDescription(i18n("KWin helper utility"));
parser.addOption(QCommandLineOption("uuid", i18n("KWin id of the window for special window settings."), "uuid"));
parser.addOption(QCommandLineOption("whole-app", i18n("Whether the settings should affect all windows of the application.")));
parser.process(app);
uuid = QUuid::fromString(parser.value("uuid"));
whole_app = parser.isSet("whole-app");
}
if (uuid.isNull()) {
printf("%s\n", qPrintable(i18n("This helper utility is not supposed to be called directly.")));
return 1;
}
QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.KWin"),
QStringLiteral("/KWin"),
QStringLiteral("org.kde.KWin"),
QStringLiteral("getWindowInfo"));
message.setArguments({uuid.toString()});
QDBusPendingReply async = QDBusConnection::sessionBus().asyncCall(message);
QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(async, &app);
QObject::connect(callWatcher, &QDBusPendingCallWatcher::finished, &app,
[&whole_app] (QDBusPendingCallWatcher *self) {
QDBusPendingReply reply = *self;
self->deleteLater();
if (!reply.isValid() || reply.value().isEmpty()) {
qApp->quit();
return;
}
KWin::edit(reply.value(), whole_app);
}
);
return app.exec();
}
diff --git a/kcmkwin/kwinrules/rulesdialog.cpp b/kcmkwin/kwinrules/rulesdialog.cpp
index 74d45b0c2..375cc7a14 100644
--- a/kcmkwin/kwinrules/rulesdialog.cpp
+++ b/kcmkwin/kwinrules/rulesdialog.cpp
@@ -1,139 +1,86 @@
/*
* Copyright (c) 2004 Lubos Lunak
* Copyright (c) 2010 Ismael Asensio
*
* 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.
*/
#include "rulesdialog.h"
-#include "../../rules.h"
+#include
#include
#include
+#include
#include
-#include
-#include
-#include
+#include
namespace KWin
{
RulesDialog::RulesDialog(QWidget* parent, const char* name)
: QDialog(parent)
, m_rulesModel(new RulesModel(this))
{
setObjectName(name);
setModal(true);
setWindowTitle(i18n("Edit Window-Specific Settings"));
setWindowIcon(QIcon::fromTheme("preferences-system-windows-actions"));
setLayout(new QVBoxLayout);
// Init RuleEditor QML QuickView
QQuickView *quickView = new QQuickView();
quickView->setSource(QUrl::fromLocalFile(QStandardPaths::locate(
QStandardPaths::GenericDataLocation,
QStringLiteral("kpackage/kcms/kcm_kwinrules_qml/contents/ui/RulesEditor.qml"))));
quickView->setResizeMode(QQuickView::SizeRootObjectToView);
quickView->rootObject()->setProperty("rulesModel", QVariant::fromValue(m_rulesModel));
- quickWidget = QWidget::createWindowContainer(quickView, this);
- quickWidget->setMinimumSize(QSize(680, 700));
- quickWidget->setVisible(isQuickUIShown);
- layout()->addWidget(quickWidget);
-
- // Classic widget initialization
- widget = new RulesWidget(this);
- widget->setVisible(!isQuickUIShown);
- layout()->addWidget(widget);
+ m_quickWidget = QWidget::createWindowContainer(quickView, this);
+ m_quickWidget->setMinimumSize(QSize(680, 700));
+ layout()->addWidget(m_quickWidget);
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
connect(buttons, SIGNAL(accepted()), SLOT(accept()));
connect(buttons, SIGNAL(rejected()), SLOT(reject()));
-
- // Toggle QML and classic UI for debugging
- QPushButton* toggleButton = buttons->addButton(QStringLiteral("Toggle classic/new UI"), QDialogButtonBox::ActionRole);
- toggleButton->setCheckable(true);
- toggleButton->setChecked(isQuickUIShown);
- connect(toggleButton, &QPushButton::toggled, this, &RulesDialog::toggleUI);
layout()->addWidget(buttons);
}
-void RulesDialog::toggleUI(bool showQuickUI)
-{
- if (isQuickUIShown == showQuickUI) {
- return;
- }
- isQuickUIShown = showQuickUI;
-
- if (showQuickUI) {
- m_rulesModel->importFromRules(widget->rules());
- widget->hide();
- quickWidget->show();
- } else {
- widget->setRules(m_rulesModel->exportToRules());
- quickWidget->hide();
- widget->show();
- }
-}
-
// window is set only for Alt+F3/Window-specific settings, because the dialog
// is then related to one specific window
Rules* RulesDialog::edit(Rules* r, const QVariantMap& info, bool show_hints)
{
- rules = r;
- widget->setRules(rules);
+ Q_UNUSED(show_hints);
- m_rulesModel->importFromRules(rules);
+ m_rules = r;
- if (!info.isEmpty())
- {
- widget->prepareWindowSpecific(info);
+ m_rulesModel->importFromRules(m_rules);
+ if (!info.isEmpty()) {
+ m_rulesModel->prefillProperties(info);
}
- if (show_hints)
- QTimer::singleShot(0, this, SLOT(displayHints()));
exec();
- return rules;
-}
-
-void RulesDialog::displayHints()
-{
- QString str = "";
- str += i18n("This configuration dialog allows altering settings only for the selected window"
- " or application. Find the setting you want to affect, enable the setting using the checkbox,"
- " select in what way the setting should be affected and to which value.");
-#if 0 // maybe later
- str += "
" + i18n("Consult the documentation for more details.");
-#endif
- str += "
";
- KMessageBox::information(this, str, QString(), "displayhints");
+ return m_rules;
}
void RulesDialog::accept()
{
- if (isQuickUIShown) {
- rules = m_rulesModel->exportToRules();
- } else {
- if (!widget->finalCheck())
- return;
- rules = widget->rules();
- }
+ m_rules = m_rulesModel->exportToRules();
QDialog::accept();
}
}
diff --git a/kcmkwin/kwinrules/rulesdialog.h b/kcmkwin/kwinrules/rulesdialog.h
index 6ab2c9198..bac79542d 100644
--- a/kcmkwin/kwinrules/rulesdialog.h
+++ b/kcmkwin/kwinrules/rulesdialog.h
@@ -1,58 +1,53 @@
/*
* Copyright (c) 2004 Lubos Lunak
* Copyright (c) 2010 Ismael Asensio
*
* 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 KWIN_RULESDIALOG_H
#define KWIN_RULESDIALOG_H
#include "rulesmodel.h"
-#include "ruleswidget.h"
+#include "../../rules.h"
#include
namespace KWin
{
class Rules;
-class RulesDialog
- : public QDialog
+class RulesDialog : public QDialog
{
Q_OBJECT
public:
explicit RulesDialog(QWidget* parent = nullptr, const char* name = nullptr);
Rules* edit(Rules* r, const QVariantMap& info, bool show_hints);
protected:
void accept() override;
-private Q_SLOTS:
- void displayHints();
- void toggleUI(bool showQuickUI);
+
private:
- bool isQuickUIShown = true;
RulesModel* m_rulesModel;
- QWidget *quickWidget;
- RulesWidget* widget;
- Rules* rules;
+ QWidget *m_quickWidget;
+ Rules* m_rules;
};
} // namespace
#endif // KWIN_RULESDIALOG_H
diff --git a/kcmkwin/kwinrules/ruleslist.cpp b/kcmkwin/kwinrules/ruleslist.cpp
deleted file mode 100644
index b46df3210..000000000
--- a/kcmkwin/kwinrules/ruleslist.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (c) 2004 Lubos Lunak
- *
- * 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.
- */
-
-#include "ruleslist.h"
-
-#include
-#include
-#include
-
-#include "../../rules.h"
-#include "rulesettings.h"
-#include "rulesdialog.h"
-
-namespace KWin
-{
-
-KCMRulesList::KCMRulesList(QWidget* parent)
- : QWidget(parent)
-{
- setupUi(this);
- // connect both current/selected, so that current==selected (stupid QListBox :( )
- connect(rules_listbox, SIGNAL(itemChanged(QListWidgetItem*)),
- SLOT(activeChanged()));
- connect(rules_listbox, SIGNAL(itemSelectionChanged()),
- SLOT(activeChanged()));
- connect(new_button, SIGNAL(clicked()),
- SLOT(newClicked()));
- connect(modify_button, SIGNAL(clicked()),
- SLOT(modifyClicked()));
- connect(delete_button, SIGNAL(clicked()),
- SLOT(deleteClicked()));
- connect(moveup_button, SIGNAL(clicked()),
- 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();
-}
-
-KCMRulesList::~KCMRulesList()
-{
- qDeleteAll(m_rules);
- m_rules.clear();
-}
-
-void KCMRulesList::activeChanged()
-{
- QListWidgetItem *item = rules_listbox->currentItem();
- int itemRow = rules_listbox->row(item);
-
- if (item != nullptr) // make current==selected
- rules_listbox->setCurrentItem(item, QItemSelectionModel::ClearAndSelect);
- modify_button->setEnabled(item != nullptr);
- delete_button->setEnabled(item != nullptr);
- export_button->setEnabled(item != nullptr);
- moveup_button->setEnabled(item != nullptr && itemRow > 0);
- movedown_button->setEnabled(item != nullptr && itemRow < (rules_listbox->count() - 1));
-}
-
-void KCMRulesList::newClicked()
-{
- RulesDialog dlg(this);
- Rules* rule = dlg.edit(nullptr, {}, false);
- if (rule == nullptr)
- return;
- int pos = rules_listbox->currentRow() + 1;
- rules_listbox->insertItem(pos , rule->description);
- rules_listbox->setCurrentRow(pos, QItemSelectionModel::ClearAndSelect);
- m_rules.insert(m_rules.begin() + pos, rule);
- emit changed(true);
-}
-
-void KCMRulesList::modifyClicked()
-{
- int pos = rules_listbox->currentRow();
- if (pos == -1)
- return;
- RulesDialog dlg(this);
- Rules *rule = dlg.edit(m_rules[pos], {}, false);
- if (rule == m_rules[pos])
- return;
- delete m_rules[pos];
- m_rules[pos] = rule;
- rules_listbox->item(pos)->setText(rule->description);
- emit changed(true);
-}
-
-void KCMRulesList::deleteClicked()
-{
- int pos = rules_listbox->currentRow();
- Q_ASSERT(pos != -1);
- delete rules_listbox->takeItem(pos);
- m_rules.erase(m_rules.begin() + pos);
- emit changed(true);
-}
-
-void KCMRulesList::moveupClicked()
-{
- int pos = rules_listbox->currentRow();
- Q_ASSERT(pos != -1);
- if (pos > 0) {
- QListWidgetItem * item = rules_listbox->takeItem(pos);
- rules_listbox->insertItem(pos - 1 , item);
- rules_listbox->setCurrentItem(item, QItemSelectionModel::ClearAndSelect);
- Rules *rule = m_rules[pos];
- m_rules[pos] = m_rules[pos - 1];
- m_rules[pos - 1] = rule;
- }
- emit changed(true);
-}
-
-void KCMRulesList::movedownClicked()
-{
- int pos = rules_listbox->currentRow();
- Q_ASSERT(pos != -1);
- if (pos < int(rules_listbox->count()) - 1) {
- QListWidgetItem * item = rules_listbox->takeItem(pos);
- rules_listbox->insertItem(pos + 1 , item);
- rules_listbox->setCurrentItem(item, QItemSelectionModel::ClearAndSelect);
- Rules *rule = m_rules[pos];
- m_rules[pos] = m_rules[pos + 1];
- m_rules[pos + 1] = rule;
- }
- emit changed(true);
-}
-
-void KCMRulesList::exportClicked()
-{
- int pos = rules_listbox->currentRow();
- Q_ASSERT(pos != -1);
- QString path = QFileDialog::getSaveFileName(this, i18n("Export Rules"), QDir::home().absolutePath(),
- i18n("KWin Rules (*.kwinrule)"));
- if (path.isEmpty())
- return;
- const auto cfg = KSharedConfig::openConfig(path, KConfig::SimpleConfig);
- RuleSettings settings(cfg, m_rules[pos]->description);
- settings.setDefaults();
- m_rules[pos]->write(&settings);
- settings.save();
-}
-
-void KCMRulesList::importClicked()
-{
- QString path = QFileDialog::getOpenFileName(this, i18n("Import Rules"), QDir::home().absolutePath(),
- i18n("KWin Rules (*.kwinrule)"));
- if (path.isEmpty())
- return;
- const auto config = KSharedConfig::openConfig(path, KConfig::SimpleConfig);
- QStringList groups = config->groupList();
- if (groups.isEmpty())
- return;
-
- int pos = qMax(0, rules_listbox->currentRow());
- for (const QString &group : groups) {
- RuleSettings settings(config, group);
- const bool remove = settings.deleteRule();
- Rules *new_rule = new Rules(&settings);
-
- // try to replace existing rule first
- for (int i = 0; i < m_rules.count(); ++i) {
- if (m_rules[i]->description == new_rule->description) {
- delete m_rules[i];
- if (remove) {
- m_rules.remove(i);
- delete rules_listbox->takeItem(i);
- delete new_rule;
- pos = qMax(0, rules_listbox->currentRow()); // might have changed!
- } else
- m_rules[i] = new_rule;
- new_rule = nullptr;
- break;
- }
- }
-
- // don't add "to be deleted" if not present
- if (remove) {
- delete new_rule;
- new_rule = nullptr;
- }
-
- // plain insertion
- if (new_rule) {
- m_rules.insert(pos, new_rule);
- rules_listbox->insertItem(pos++, new_rule->description);
- }
- }
- emit changed(true);
-}
-
-void KCMRulesList::load()
-{
- rules_listbox->clear();
- m_settings.load();
- m_rules = m_settings.rules();
- for (const auto rule : qAsConst(m_rules)) {
- rules_listbox->addItem(rule->description);
- }
-
- if (m_rules.count() > 0)
- rules_listbox->setCurrentItem(rules_listbox->item(0));
- else
- rules_listbox->setCurrentItem(nullptr);
- activeChanged();
-}
-
-void KCMRulesList::save()
-{
- m_settings.setRules(m_rules);
- m_settings.save();
-}
-
-} // namespace
-
diff --git a/kcmkwin/kwinrules/ruleslist.h b/kcmkwin/kwinrules/ruleslist.h
deleted file mode 100644
index a8b21ffd4..000000000
--- a/kcmkwin/kwinrules/ruleslist.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2004 Lubos Lunak
- *
- * 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 __RULESLIST_H__
-#define __RULESLIST_H__
-
-#include "ui_ruleslist.h"
-#include "rulebooksettings.h"
-
-namespace KWin
-{
-class Rules;
-
-class KCMRulesList
- : public QWidget, Ui_KCMRulesList
-{
- Q_OBJECT
-public:
- explicit KCMRulesList(QWidget* parent = nullptr);
- ~KCMRulesList() override;
- void load();
- void save();
-Q_SIGNALS:
- void changed(bool);
-private Q_SLOTS:
- void newClicked();
- void modifyClicked();
- void deleteClicked();
- void moveupClicked();
- void movedownClicked();
- void exportClicked();
- void importClicked();
- void activeChanged();
-private:
- QVector m_rules;
- RuleBookSettings m_settings;
-};
-
-} // namespace
-
-#endif
diff --git a/kcmkwin/kwinrules/ruleslist.ui b/kcmkwin/kwinrules/ruleslist.ui
deleted file mode 100644
index a0f45c14d..000000000
--- a/kcmkwin/kwinrules/ruleslist.ui
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
- KWin::KCMRulesList
-
-
-
- 0
- 0
- 600
- 480
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
- -
-
-
- &New...
-
-
-
- -
-
-
- &Modify...
-
-
-
- -
-
-
- Delete
-
-
-
-
-
-
- -
-
-
- Move &Up
-
-
-
- -
-
-
- Move &Down
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Expanding
-
-
-
- 20
- 294
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- &Import
-
-
-
- -
-
-
- &Export
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
-
-
-
-
-
diff --git a/kcmkwin/kwinrules/ruleswidget.cpp b/kcmkwin/kwinrules/ruleswidget.cpp
deleted file mode 100644
index ccee26e17..000000000
--- a/kcmkwin/kwinrules/ruleswidget.cpp
+++ /dev/null
@@ -1,914 +0,0 @@
-/*
- * Copyright (c) 2004 Lubos Lunak
- *
- * 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.
- */
-
-#include "ruleswidget.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#ifdef KWIN_BUILD_ACTIVITIES
-#include
-#endif
-
-#include
-#include
-
-#include "../../rules.h"
-
-#include "detectwidget.h"
-
-Q_DECLARE_METATYPE(NET::WindowType)
-
-namespace KWin
-{
-
-#define SETUP( var, type ) \
- connect( enable_##var, SIGNAL(toggled(bool)), rule_##var, SLOT(setEnabled(bool))); \
- connect( enable_##var, SIGNAL(toggled(bool)), this, SLOT(updateEnable##var())); \
- connect( rule_##var, SIGNAL(activated(int)), this, SLOT(updateEnable##var())); \
- enable_##var->setWhatsThis( enableDesc ); \
- rule_##var->setWhatsThis( type##RuleDesc );
-
-RulesWidget::RulesWidget(QWidget* parent)
- : detect_dlg(nullptr)
-{
- Q_UNUSED(parent);
- setupUi(this);
- QRegularExpressionValidator* validator = new QRegularExpressionValidator(QRegularExpression("[0-9\\-+,xX:]*"), this);
- maxsize->setValidator(validator);
- minsize->setValidator(validator);
- position->setValidator(validator);
- Ui::RulesWidgetBase::size->setValidator(validator);
-
- QString enableDesc =
- i18n("Enable this checkbox to alter this window property for the specified window(s).");
- QString setRuleDesc =
- i18n("Specify how the window property should be affected:"
- "- Do Not Affect: The window property will not be affected and therefore"
- " the default handling for it will be used. Specifying this will block more generic"
- " window settings from taking effect.
"
- "- Apply Initially: The window property will be only set to the given value"
- " after the window is created. No further changes will be affected.
"
- "- Remember: The value of the window property will be remembered and every"
- " time the window is created, the last remembered value will be applied.
"
- "- Force: The window property will be always forced to the given value.
"
- "- Apply Now: The window property will be set to the given value immediately"
- " and will not be affected later (this action will be deleted afterwards).
"
- "- Force temporarily: The window property will be forced to the given value"
- " until it is hidden (this action will be deleted after the window is hidden).
"
- "
");
- QString forceRuleDesc =
- i18n("Specify how the window property should be affected:"
- "- Do Not Affect: The window property will not be affected and therefore"
- " the default handling for it will be used. Specifying this will block more generic"
- " window settings from taking effect.
"
- "- Force: The window property will be always forced to the given value.
"
- "- Force temporarily: The window property will be forced to the given value"
- " until it is hidden (this action will be deleted after the window is hidden).
"
- "
");
- // window tabs have enable signals done in designer
- // geometry tab
- SETUP(position, set);
- 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);
- SETUP(shade, set);
- SETUP(fullscreen, set);
- SETUP(placement, force);
- // preferences tab
- SETUP(above, set);
- SETUP(below, set);
- SETUP(noborder, set);
- SETUP(decocolor, force);
- SETUP(skiptaskbar, set);
- SETUP(skippager, set);
- SETUP(skipswitcher, set);
- SETUP(acceptfocus, force);
- SETUP(closeable, force);
- SETUP(autogroup, force);
- SETUP(autogroupfg, force);
- SETUP(autogroupid, force);
- SETUP(opacityactive, force);
- SETUP(opacityinactive, force);
- SETUP(shortcut, force);
- // workarounds tab
- SETUP(fsplevel, force);
- SETUP(fpplevel, force);
- SETUP(type, force);
- SETUP(desktopfile, set);
- SETUP(ignoregeometry, set);
- SETUP(minsize, force);
- SETUP(maxsize, force);
- SETUP(strictgeometry, force);
- SETUP(disableglobalshortcuts, force);
- SETUP(blockcompositing, force);
-
- connect (shortcut_edit, SIGNAL(clicked()), SLOT(shortcutEditClicked()));
-
- edit_reg_wmclass->hide();
- edit_reg_role->hide();
- 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();
- ++i)
- desktop->addItem(QString::number(i).rightJustified(2) + ':' + KWindowSystem::desktopName(i));
- desktop->addItem(i18n("All Desktops"));
-
-#ifdef KWIN_BUILD_ACTIVITIES
- m_activities = new KActivities::Consumer(this);
- connect(m_activities, &KActivities::Consumer::activitiesChanged,
- this, [this] { updateActivitiesList(); });
- connect(m_activities, &KActivities::Consumer::serviceStatusChanged,
- this, [this] { updateActivitiesList(); });
- updateActivitiesList();
-#endif
-
- KColorSchemeManager *schemes = new KColorSchemeManager(this);
- decocolor->setModel(schemes->model());
-
- // hide autogrouping as it's currently not supported
- // BUG 370301
- line_11->hide();
- enable_autogroup->hide();
- autogroup->hide();
- rule_autogroup->hide();
- enable_autogroupid->hide();
- autogroupid->hide();
- rule_autogroupid->hide();
- enable_autogroupfg->hide();
- autogroupfg->hide();
- rule_autogroupfg->hide();
-}
-
-#undef SETUP
-
-#define UPDATE_ENABLE_SLOT(var) \
- void RulesWidget::updateEnable##var() \
- { \
- /* leave the label readable label_##var->setEnabled( enable_##var->isChecked() && rule_##var->currentIndex() != 0 );*/ \
- Ui::RulesWidgetBase::var->setEnabled( enable_##var->isChecked() && rule_##var->currentIndex() != 0 ); \
- }
-
-// geometry tab
-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)
-UPDATE_ENABLE_SLOT(shade)
-UPDATE_ENABLE_SLOT(fullscreen)
-UPDATE_ENABLE_SLOT(placement)
-// preferences tab
-UPDATE_ENABLE_SLOT(above)
-UPDATE_ENABLE_SLOT(below)
-UPDATE_ENABLE_SLOT(noborder)
-UPDATE_ENABLE_SLOT(decocolor)
-UPDATE_ENABLE_SLOT(skiptaskbar)
-UPDATE_ENABLE_SLOT(skippager)
-UPDATE_ENABLE_SLOT(skipswitcher)
-UPDATE_ENABLE_SLOT(acceptfocus)
-UPDATE_ENABLE_SLOT(closeable)
-UPDATE_ENABLE_SLOT(autogroup)
-UPDATE_ENABLE_SLOT(autogroupfg)
-UPDATE_ENABLE_SLOT(autogroupid)
-UPDATE_ENABLE_SLOT(opacityactive)
-UPDATE_ENABLE_SLOT(opacityinactive)
-void RulesWidget::updateEnableshortcut()
-{
- shortcut->setEnabled(enable_shortcut->isChecked() && rule_shortcut->currentIndex() != 0);
- shortcut_edit->setEnabled(enable_shortcut->isChecked() && rule_shortcut->currentIndex() != 0);
-}
-// workarounds tab
-UPDATE_ENABLE_SLOT(fsplevel)
-UPDATE_ENABLE_SLOT(fpplevel)
-UPDATE_ENABLE_SLOT(type)
-UPDATE_ENABLE_SLOT(ignoregeometry)
-UPDATE_ENABLE_SLOT(minsize)
-UPDATE_ENABLE_SLOT(maxsize)
-UPDATE_ENABLE_SLOT(strictgeometry)
-UPDATE_ENABLE_SLOT(disableglobalshortcuts)
-UPDATE_ENABLE_SLOT(blockcompositing)
-UPDATE_ENABLE_SLOT(desktopfile)
-
-#undef UPDATE_ENABLE_SLOT
-
-static const int set_rule_to_combo[] = {
- 0, // Unused
- 0, // Don't Affect
- 3, // Force
- 1, // Apply
- 2, // Remember
- 4, // ApplyNow
- 5 // ForceTemporarily
-};
-
-static const Rules::SetRule combo_to_set_rule[] = {
- (Rules::SetRule)Rules::DontAffect,
- (Rules::SetRule)Rules::Apply,
- (Rules::SetRule)Rules::Remember,
- (Rules::SetRule)Rules::Force,
- (Rules::SetRule)Rules::ApplyNow,
- (Rules::SetRule)Rules::ForceTemporarily
-};
-
-static const int force_rule_to_combo[] = {
- 0, // Unused
- 0, // Don't Affect
- 1, // Force
- 0, // Apply
- 0, // Remember
- 0, // ApplyNow
- 2 // ForceTemporarily
-};
-
-static const Rules::ForceRule combo_to_force_rule[] = {
- (Rules::ForceRule)Rules::DontAffect,
- (Rules::ForceRule)Rules::Force,
- (Rules::ForceRule)Rules::ForceTemporarily
-};
-
-static QString positionToStr(const QPoint& p)
-{
- if (p == invalidPoint)
- return QString();
- return QString::number(p.x()) + ',' + QString::number(p.y());
-}
-
-static QPoint strToPosition(const QString& str)
-{
- // two numbers, with + or -, separated by any of , x X :
- QRegExp reg("\\s*([+-]?[0-9]*)\\s*[,xX:]\\s*([+-]?[0-9]*)\\s*");
- if (!reg.exactMatch(str))
- return invalidPoint;
- return QPoint(reg.cap(1).toInt(), reg.cap(2).toInt());
-}
-
-static QString sizeToStr(const QSize& s)
-{
- if (!s.isValid())
- return QString();
- return QString::number(s.width()) + ',' + QString::number(s.height());
-}
-
-static QSize strToSize(const QString& str)
-{
- // two numbers, with + or -, separated by any of , x X :
- QRegExp reg("\\s*([+-]?[0-9]*)\\s*[,xX:]\\s*([+-]?[0-9]*)\\s*");
- if (!reg.exactMatch(str))
- return QSize();
- return QSize(reg.cap(1).toInt(), reg.cap(2).toInt());
-}
-
-int RulesWidget::desktopToCombo(int d) const
-{
- if (d >= 1 && d < desktop->count())
- return d - 1;
- return desktop->count() - 1; // on all desktops
-}
-
-int RulesWidget::comboToDesktop(int val) const
-{
- if (val == desktop->count() - 1)
- return NET::OnAllDesktops;
- return val + 1;
-}
-
-#ifdef KWIN_BUILD_ACTIVITIES
-int RulesWidget::activityToCombo(const QString &d) const
-{
- // TODO: ivan - do a multiselection list
- for (int i = 0; i < activity->count(); i++) {
- if (activity->itemData(i).toString() == d) {
- return i;
- }
- }
-
- return activity->count() - 1; // on all activities
-}
-
-QString RulesWidget::comboToActivity(int val) const
-{
- // TODO: ivan - do a multiselection list
- if (val < 0 || val >= activity->count())
- return QString();
-
- return activity->itemData(val).toString();
-}
-
-void RulesWidget::updateActivitiesList()
-{
- activity->clear();
-
- // cloned from kactivities/src/lib/core/consumer.cpp
- #define NULL_UUID "00000000-0000-0000-0000-000000000000"
- activity->addItem(i18n("All Activities"), QString::fromLatin1(NULL_UUID));
- #undef NULL_UUID
-
- if (m_activities->serviceStatus() == KActivities::Consumer::Running) {
- foreach (const QString & activityId, m_activities->activities(KActivities::Info::Running)) {
- const KActivities::Info info(activityId);
- activity->addItem(info.name(), activityId);
- }
- }
-
- auto rules = this->rules();
- if (rules->activityrule == Rules::UnusedSetRule) {
- enable_activity->setChecked(false);
- Ui::RulesWidgetBase::activity->setCurrentIndex(0);
- } else {
- enable_activity->setChecked(true);
- Ui::RulesWidgetBase::activity->setCurrentIndex(activityToCombo(m_selectedActivityId));
- }
- updateEnableactivity();
-}
-#endif
-
-static int placementToCombo(Placement::Policy placement)
-{
- static const int conv[] = {
- 1, // NoPlacement
- 0, // Default
- 0, // Unknown
- 6, // Random
- 2, // Smart
- 4, // Cascade
- 5, // Centered
- 7, // ZeroCornered
- 8, // UnderMouse
- 9, // OnMainWindow
- 3 // Maximizing
- };
- return conv[ placement ];
-}
-
-static Placement::Policy comboToPlacement(int val)
-{
- static const Placement::Policy conv[] = {
- Placement::Default,
- Placement::NoPlacement,
- Placement::Smart,
- Placement::Maximizing,
- Placement::Cascade,
- Placement::Centered,
- Placement::Random,
- Placement::ZeroCornered,
- Placement::UnderMouse,
- Placement::OnMainWindow
- // no Placement::Unknown
- };
- return conv[ val ];
-}
-
-static int typeToCombo(NET::WindowType type)
-{
- 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
- 7, // Desktop
- 3, // Dock
- 4, // Toolbar
- 5, // Menu
- 1, // Dialog
- 8, // Override - ignored.
- 9, // TopMenu
- 2, // Utility
- 6 // Splash
- };
- return conv[ type ];
-}
-
-static NET::WindowType comboToType(int val)
-{
- static const NET::WindowType conv[] = {
- NET::Normal,
- NET::Dialog,
- NET::Utility,
- NET::Dock,
- NET::Toolbar,
- NET::Menu,
- NET::Splash,
- NET::Desktop,
- NET::TopMenu
- };
- return conv[ val ];
-}
-
-#define GENERIC_RULE( var, func, Type, type, uimethod, uimethod0 ) \
- if ( rules->var##rule == Rules::Unused##Type##Rule ) \
- { \
- enable_##var->setChecked( false ); \
- rule_##var->setCurrentIndex( 0 ); \
- Ui::RulesWidgetBase::var->uimethod0; \
- updateEnable##var(); \
- } \
- else \
- { \
- enable_##var->setChecked( true ); \
- rule_##var->setCurrentIndex( type##_rule_to_combo[ rules->var##rule ] ); \
- Ui::RulesWidgetBase::var->uimethod( func( rules->var )); \
- updateEnable##var(); \
- }
-
-#define CHECKBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, setChecked, setChecked( false ))
-#define LINEEDIT_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, setText, setText( QString() ))
-#define COMBOBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, setCurrentIndex, setCurrentIndex( 0 ))
-#define SPINBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, setValue, setValue(0))
-#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( QString() ))
-#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)
-{
- Rules tmp;
- if (rules == nullptr)
- rules = &tmp; // empty
- description->setText(rules->description);
- wmclass->setText(rules->wmclass);
- whole_wmclass->setChecked(rules->wmclasscomplete);
- wmclass_match->setCurrentIndex(rules->wmclassmatch);
- wmclassMatchChanged();
- role->setText(rules->windowrole);
- role_match->setCurrentIndex(rules->windowrolematch);
- roleMatchChanged();
- types->item(0)->setSelected(rules->types & NET::NormalMask);
- types->item(1)->setSelected(rules->types & NET::DialogMask);
- types->item(2)->setSelected(rules->types & NET::UtilityMask);
- types->item(3)->setSelected(rules->types & NET::DockMask);
- types->item(4)->setSelected(rules->types & NET::ToolbarMask);
- types->item(5)->setSelected(rules->types & NET::MenuMask);
- types->item(6)->setSelected(rules->types & NET::SplashMask);
- types->item(7)->setSelected(rules->types & NET::DesktopMask);
- types->item(8)->setSelected(rules->types & NET::OverrideMask);
- types->item(9)->setSelected(rules->types & NET::TopMenuMask);
- title->setText(rules->title);
- title_match->setCurrentIndex(rules->titlematch);
- titleMatchChanged();
- machine->setText(rules->clientmachine);
- machine_match->setCurrentIndex(rules->clientmachinematch);
- machineMatchChanged();
- LINEEDIT_SET_RULE(position, positionToStr);
- LINEEDIT_SET_RULE(size, sizeToStr);
- COMBOBOX_SET_RULE(desktop, desktopToCombo);
- SPINBOX_SET_RULE(screen, inc);
-#ifdef KWIN_BUILD_ACTIVITIES
- m_selectedActivityId = rules->activity;
- COMBOBOX_SET_RULE(activity, activityToCombo);
-#endif
- CHECKBOX_SET_RULE(maximizehoriz,);
- CHECKBOX_SET_RULE(maximizevert,);
- CHECKBOX_SET_RULE(minimize,);
- CHECKBOX_SET_RULE(shade,);
- CHECKBOX_SET_RULE(fullscreen,);
- COMBOBOX_FORCE_RULE(placement, placementToCombo);
- CHECKBOX_SET_RULE(above,);
- CHECKBOX_SET_RULE(below,);
- CHECKBOX_SET_RULE(noborder,);
- auto decoColorToCombo = [this](const QString &value) {
- for (int i = 0; i < decocolor->count(); ++i) {
- if (decocolor->itemData(i).toString() == value) {
- return i;
- }
- }
- // search for Breeze
- for (int i = 0; i < decocolor->count(); ++i) {
- if (QFileInfo(decocolor->itemData(i).toString()).baseName() == QStringLiteral("Breeze")) {
- return i;
- }
- }
- return 0;
- };
- COMBOBOX_FORCE_RULE(decocolor, decoColorToCombo);
- CHECKBOX_SET_RULE(skiptaskbar,);
- CHECKBOX_SET_RULE(skippager,);
- CHECKBOX_SET_RULE(skipswitcher,);
- CHECKBOX_FORCE_RULE(acceptfocus,);
- CHECKBOX_FORCE_RULE(closeable,);
- CHECKBOX_FORCE_RULE(autogroup,);
- CHECKBOX_FORCE_RULE(autogroupfg,);
- LINEEDIT_FORCE_RULE(autogroupid,);
- SPINBOX_FORCE_RULE(opacityactive,);
- SPINBOX_FORCE_RULE(opacityinactive,);
- LINEEDIT_SET_RULE(shortcut,);
- COMBOBOX_FORCE_RULE(fsplevel,);
- COMBOBOX_FORCE_RULE(fpplevel,);
- COMBOBOX_FORCE_RULE(type, typeToCombo);
- CHECKBOX_SET_RULE(ignoregeometry,);
- LINEEDIT_FORCE_RULE(minsize, sizeToStr);
- LINEEDIT_FORCE_RULE(maxsize, sizeToStr);
- CHECKBOX_FORCE_RULE(strictgeometry,);
- CHECKBOX_FORCE_RULE(disableglobalshortcuts,);
- CHECKBOX_FORCE_RULE(blockcompositing,);
- LINEEDIT_SET_RULE(desktopfile,)
-}
-
-#undef GENERIC_RULE
-#undef CHECKBOX_SET_RULE
-#undef LINEEDIT_SET_RULE
-#undef COMBOBOX_SET_RULE
-#undef SPINBOX_SET_RULE
-#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) \
- { \
- rules->var##rule = combo_to_##type##_rule[ rule_##var->currentIndex() ]; \
- rules->var = func( Ui::RulesWidgetBase::var->uimethod()); \
- } \
- else \
- rules->var##rule = Rules::Unused##Type##Rule;
-
-#define CHECKBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, isChecked )
-#define LINEEDIT_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, text )
-#define COMBOBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, currentIndex )
-#define SPINBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, value)
-#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
-{
- Rules* rules = new Rules();
- rules->description = description->text();
- rules->wmclass = wmclass->text().toUtf8();
- rules->wmclasscomplete = whole_wmclass->isChecked();
- rules->wmclassmatch = static_cast< Rules::StringMatch >(wmclass_match->currentIndex());
- rules->windowrole = role->text().toUtf8();
- rules->windowrolematch = static_cast< Rules::StringMatch >(role_match->currentIndex());
- rules->types = {};
- bool all_types = true;
- for (int i = 0;
- i < types->count();
- ++i)
- if (!types->item(i)->isSelected())
- all_types = false;
- if (all_types) // if all types are selected, use AllTypesMask (for future expansion)
- rules->types = NET::AllTypesMask;
- else {
- rules->types |= types->item(0)->isSelected() ? NET::NormalMask : NET::WindowTypeMask(0);
- rules->types |= types->item(1)->isSelected() ? NET::DialogMask : NET::WindowTypeMask(0);
- rules->types |= types->item(2)->isSelected() ? NET::UtilityMask : NET::WindowTypeMask(0);
- rules->types |= types->item(3)->isSelected() ? NET::DockMask : NET::WindowTypeMask(0);
- rules->types |= types->item(4)->isSelected() ? NET::ToolbarMask : NET::WindowTypeMask(0);
- rules->types |= types->item(5)->isSelected() ? NET::MenuMask : NET::WindowTypeMask(0);
- rules->types |= types->item(6)->isSelected() ? NET::SplashMask : NET::WindowTypeMask(0);
- rules->types |= types->item(7)->isSelected() ? NET::DesktopMask : NET::WindowTypeMask(0);
- rules->types |= types->item(8)->isSelected() ? NET::OverrideMask : NET::WindowTypeMask(0);
- rules->types |= types->item(9)->isSelected() ? NET::TopMenuMask : NET::WindowTypeMask(0);
- }
- rules->title = title->text();
- rules->titlematch = static_cast< Rules::StringMatch >(title_match->currentIndex());
- rules->clientmachine = machine->text().toUtf8();
- rules->clientmachinematch = static_cast< Rules::StringMatch >(machine_match->currentIndex());
- LINEEDIT_SET_RULE(position, strToPosition);
- 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,);
- CHECKBOX_SET_RULE(shade,);
- CHECKBOX_SET_RULE(fullscreen,);
- COMBOBOX_FORCE_RULE(placement, comboToPlacement);
- CHECKBOX_SET_RULE(above,);
- CHECKBOX_SET_RULE(below,);
- CHECKBOX_SET_RULE(noborder,);
- auto comboToDecocolor = [this](int index) -> QString {
- return decocolor->itemData(index).toString();
- };
- COMBOBOX_FORCE_RULE(decocolor, comboToDecocolor);
- CHECKBOX_SET_RULE(skiptaskbar,);
- CHECKBOX_SET_RULE(skippager,);
- CHECKBOX_SET_RULE(skipswitcher,);
- CHECKBOX_FORCE_RULE(acceptfocus,);
- CHECKBOX_FORCE_RULE(closeable,);
- CHECKBOX_FORCE_RULE(autogroup,);
- CHECKBOX_FORCE_RULE(autogroupfg,);
- LINEEDIT_FORCE_RULE(autogroupid,);
- SPINBOX_FORCE_RULE(opacityactive,);
- SPINBOX_FORCE_RULE(opacityinactive,);
- LINEEDIT_SET_RULE(shortcut,);
- COMBOBOX_FORCE_RULE(fsplevel,);
- COMBOBOX_FORCE_RULE(fpplevel,);
- COMBOBOX_FORCE_RULE(type, comboToType);
- CHECKBOX_SET_RULE(ignoregeometry,);
- LINEEDIT_FORCE_RULE(minsize, strToSize);
- LINEEDIT_FORCE_RULE(maxsize, strToSize);
- CHECKBOX_FORCE_RULE(strictgeometry,);
- CHECKBOX_FORCE_RULE(disableglobalshortcuts,);
- CHECKBOX_FORCE_RULE(blockcompositing,);
- LINEEDIT_SET_RULE(desktopfile,);
- return rules;
-}
-
-#undef GENERIC_RULE
-#undef CHECKBOX_SET_RULE
-#undef LINEEDIT_SET_RULE
-#undef COMBOBOX_SET_RULE
-#undef SPINBOX_SET_RULE
-#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() \
- { \
- edit_reg_##type->setEnabled( type##_match->currentIndex() == Rules::RegExpMatch ); \
- type->setEnabled( type##_match->currentIndex() != Rules::UnimportantMatch ); \
- }
-
-STRING_MATCH_COMBO(wmclass)
-STRING_MATCH_COMBO(role)
-STRING_MATCH_COMBO(title)
-STRING_MATCH_COMBO(machine)
-
-#undef STRING_MATCH_COMBO
-
-void RulesWidget::detectClicked()
-{
- Q_ASSERT(detect_dlg == nullptr);
- detect_dlg = new DetectDialog;
- connect(detect_dlg, SIGNAL(detectionDone(bool)), this, SLOT(detected(bool)));
- detect_dlg->detect(Ui::RulesWidgetBase::detection_delay->value());
- Ui::RulesWidgetBase::detect->setEnabled(false);
-}
-
-void RulesWidget::detected(bool ok)
-{
- if (ok) {
- wmclass->setText(detect_dlg->selectedClass());
- wmclass_match->setCurrentIndex(Rules::ExactMatch);
- wmclassMatchChanged(); // grrr
- whole_wmclass->setChecked(detect_dlg->selectedWholeClass());
- role->setText(detect_dlg->selectedRole());
- role_match->setCurrentIndex(detect_dlg->selectedRole().isEmpty()
- ? Rules::UnimportantMatch : Rules::ExactMatch);
- roleMatchChanged();
- if (detect_dlg->selectedWholeApp()) {
- for (int i = 0;
- i < types->count();
- ++i)
- types->item(i)->setSelected(true);
- } else {
- NET::WindowType type = detect_dlg->selectedType();
- for (int i = 0;
- i < types->count();
- ++i)
- types->item(i)->setSelected(false);
- types->item(typeToCombo(type))->setSelected(true);
- }
- title->setText(detect_dlg->selectedTitle());
- title_match->setCurrentIndex(detect_dlg->titleMatch());
- titleMatchChanged();
- machine->setText(detect_dlg->selectedMachine());
- machine_match->setCurrentIndex(Rules::UnimportantMatch);
- machineMatchChanged();
- // prefill values from to window to settings which already set
- prefillUnusedValues(detect_dlg->windowInfo());
- }
- delete detect_dlg;
- detect_dlg = nullptr;
- detect_dlg_ok = ok;
- Ui::RulesWidgetBase::detect->setEnabled(true);
-}
-
-#define GENERIC_PREFILL( var, func, info, uimethod ) \
- if ( !enable_##var->isChecked()) \
- { \
- Ui::RulesWidgetBase::var->uimethod( func( info )); \
- }
-
-#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 QVariantMap& info)
-{
- const QSize windowSize{info.value("width").toInt(), info.value("height").toInt()};
- LINEEDIT_PREFILL(position, positionToStr, QPoint(info.value("x").toInt(), info.value("y").toInt()));
- LINEEDIT_PREFILL(size, sizeToStr, windowSize);
- COMBOBOX_PREFILL(desktop, desktopToCombo, info.value("x11DesktopNumber").toInt());
- // COMBOBOX_PREFILL(activity, activityToCombo, info.activity()); // TODO: ivan
- CHECKBOX_PREFILL(maximizehoriz, , info.value("maximizeHorizontal").toBool());
- CHECKBOX_PREFILL(maximizevert, , info.value("maximizeVertical").toBool());
- CHECKBOX_PREFILL(minimize, , info.value("minimized").toBool());
- CHECKBOX_PREFILL(shade, , info.value("shaded").toBool());
- CHECKBOX_PREFILL(fullscreen, , info.value("fullscreen").toBool());
- //COMBOBOX_PREFILL( placement, placementToCombo );
- CHECKBOX_PREFILL(above, , info.value("keepAbove").toBool());
- CHECKBOX_PREFILL(below, , info.value("keepBelow").toBool());
- CHECKBOX_PREFILL(noborder, , info.value("noBorder").toBool());
- CHECKBOX_PREFILL(skiptaskbar, , info.value("skipTaskbar").toBool());
- CHECKBOX_PREFILL(skippager, , info.value("skipPager").toBool());
- CHECKBOX_PREFILL(skipswitcher, , info.value("skipSwitcher").toBool());
- //CHECKBOX_PREFILL( acceptfocus, );
- //CHECKBOX_PREFILL( closeable, );
- //CHECKBOX_PREFILL( autogroup, );
- //CHECKBOX_PREFILL( autogroupfg, );
- //LINEEDIT_PREFILL( autogroupid, );
- SPINBOX_PREFILL(opacityactive, , 100 /*get the actual opacity somehow*/);
- SPINBOX_PREFILL(opacityinactive, , 100 /*get the actual opacity somehow*/);
- //LINEEDIT_PREFILL( shortcut, );
- //COMBOBOX_PREFILL( fsplevel, );
- //COMBOBOX_PREFILL( fpplevel, );
- COMBOBOX_PREFILL(type, typeToCombo, info.value("type").value());
- //CHECKBOX_PREFILL( ignoregeometry, );
- LINEEDIT_PREFILL(minsize, sizeToStr, windowSize);
- LINEEDIT_PREFILL(maxsize, sizeToStr, windowSize);
- //CHECKBOX_PREFILL( strictgeometry, );
- //CHECKBOX_PREFILL( disableglobalshortcuts, );
- //CHECKBOX_PREFILL( blockcompositing, );
- LINEEDIT_PREFILL(desktopfile, , info.value("desktopFile").toString());
-}
-
-#undef GENERIC_PREFILL
-#undef CHECKBOX_PREFILL
-#undef LINEEDIT_PREFILL
-#undef COMBOBOX_PREFILL
-#undef SPINBOX_PREFILL
-
-bool RulesWidget::finalCheck()
-{
- if (description->text().isEmpty()) {
- if (!wmclass->text().isEmpty())
- description->setText(i18n("Settings for %1", wmclass->text()));
- else
- description->setText(i18n("Unnamed entry"));
- }
- bool all_types = true;
- for (int i = 0;
- i < types->count();
- ++i)
- if (!types->item(i)->isSelected())
- all_types = false;
- if (wmclass_match->currentIndex() == Rules::UnimportantMatch && all_types) {
- if (KMessageBox::warningContinueCancel(window(),
- i18n("You have specified the window class as unimportant.\n"
- "This means the settings will possibly apply to windows from all applications. "
- "If you really want to create a generic setting, it is recommended you at least "
- "limit the window types to avoid special window types.")) != KMessageBox::Continue)
- return false;
- }
- return true;
-}
-
-void RulesWidget::prepareWindowSpecific(const QVariantMap &info)
-{
- tabs->setCurrentIndex(1); // geometry tab, skip tab for window identification
- prefillUnusedValues(info);
-}
-
-void RulesWidget::shortcutEditClicked()
-{
- QPointer dlg = new EditShortcutDialog(window());
- dlg->setShortcut(shortcut->text());
- if (dlg->exec() == QDialog::Accepted)
- shortcut->setText(dlg->shortcut());
- delete dlg;
-}
-
-EditShortcut::EditShortcut(QWidget* parent)
- : QWidget(parent)
-{
- setupUi(this);
-}
-
-void EditShortcut::editShortcut()
-{
- QPointer< ShortcutDialog > dlg = new ShortcutDialog(QKeySequence(shortcut->text()), window());
- if (dlg->exec() == QDialog::Accepted)
- shortcut->setText(dlg->shortcut().toString());
- delete dlg;
-}
-
-void EditShortcut::clearShortcut()
-{
- shortcut->clear();
-}
-
-EditShortcutDialog::EditShortcutDialog(QWidget* parent, const char* name)
- : QDialog(parent)
- , widget(new EditShortcut(this))
-{
- setObjectName(name);
- setModal(true);
- setWindowTitle(i18n("Edit Shortcut"));
-
- setLayout(new QVBoxLayout);
-
- QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
- connect(buttons, SIGNAL(accepted()), SLOT(accept()));
- connect(buttons, SIGNAL(rejected()), SLOT(reject()));
-
- layout()->addWidget(widget);
- layout()->addWidget(buttons);
-}
-
-void EditShortcutDialog::setShortcut(const QString& cut)
-{
- widget->shortcut->setText(cut);
-}
-
-QString EditShortcutDialog::shortcut() const
-{
- return widget->shortcut->text();
-}
-
-ShortcutDialog::ShortcutDialog(const QKeySequence& cut, QWidget* parent)
- : QDialog(parent)
- , widget(new KKeySequenceWidget(this))
-{
- widget->setKeySequence(cut);
- // It's a global shortcut so don't allow multikey shortcuts
- widget->setMultiKeyShortcutsAllowed(false);
-
- QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
- connect(buttons, SIGNAL(accepted()), SLOT(accept()));
- connect(buttons, SIGNAL(rejected()), SLOT(reject()));
-
- setLayout(new QVBoxLayout);
- layout()->addWidget(widget);
- layout()->addWidget(buttons);
-}
-
-void ShortcutDialog::accept()
-{
- QKeySequence seq = shortcut();
- if (!seq.isEmpty()) {
- if (seq[0] == Qt::Key_Escape) {
- reject();
- return;
- }
- if (seq[0] == Qt::Key_Space
- || (seq[0] & Qt::KeyboardModifierMask) == 0) {
- // clear
- widget->clearKeySequence();
- QDialog::accept();
- return;
- }
- }
- QDialog::accept();
-}
-
-QKeySequence ShortcutDialog::shortcut() const
-{
- return widget->keySequence();
-}
-
-} // namespace
-
diff --git a/kcmkwin/kwinrules/ruleswidget.h b/kcmkwin/kwinrules/ruleswidget.h
deleted file mode 100644
index 942b0ba68..000000000
--- a/kcmkwin/kwinrules/ruleswidget.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2004 Lubos Lunak
- *
- * 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 __RULESWIDGET_H__
-#define __RULESWIDGET_H__
-
-#include
-
-#include
-#include "detectwidget.h"
-
-#include "ui_ruleswidgetbase.h"
-#include "ui_editshortcut.h"
-
-#ifdef KWIN_BUILD_ACTIVITIES
-namespace KActivities {
- class Consumer;
-} // namespace KActivities
-#endif
-
-namespace KWin
-{
-
-class RulesWidget
- : public QWidget, public Ui::RulesWidgetBase
-{
- Q_OBJECT
-public:
- explicit RulesWidget(QWidget* parent = nullptr);
- void setRules(Rules* r);
- Rules* rules() const;
- bool finalCheck();
- void prepareWindowSpecific(const QVariantMap &info);
-Q_SIGNALS:
- void changed(bool state);
-protected Q_SLOTS:
- void detectClicked();
- void wmclassMatchChanged();
- void roleMatchChanged();
- void titleMatchChanged();
- void machineMatchChanged();
- void shortcutEditClicked();
-private Q_SLOTS:
- // geometry tab
- void updateEnableposition();
- void updateEnablesize();
- void updateEnabledesktop();
- void updateEnablescreen();
-#ifdef KWIN_BUILD_ACTIVITIES
- void updateEnableactivity();
-#endif
- void updateEnablemaximizehoriz();
- void updateEnablemaximizevert();
- void updateEnableminimize();
- void updateEnableshade();
- void updateEnablefullscreen();
- void updateEnableplacement();
- // preferences tab
- void updateEnableabove();
- void updateEnablebelow();
- void updateEnablenoborder();
- void updateEnabledecocolor();
- void updateEnableskiptaskbar();
- void updateEnableskippager();
- void updateEnableskipswitcher();
- void updateEnableacceptfocus();
- void updateEnablecloseable();
- void updateEnableautogroup();
- void updateEnableautogroupfg();
- void updateEnableautogroupid();
- void updateEnableopacityactive();
- void updateEnableopacityinactive();
- // workarounds tab
- void updateEnablefsplevel();
- void updateEnablefpplevel();
- void updateEnabletype();
- void updateEnableignoregeometry();
- void updateEnableminsize();
- void updateEnablemaxsize();
- void updateEnablestrictgeometry();
- void updateEnableshortcut();
- void updateEnabledisableglobalshortcuts();
- void updateEnableblockcompositing();
- void updateEnabledesktopfile();
- // internal
- void detected(bool);
-private:
- int desktopToCombo(int d) const;
- int comboToDesktop(int val) const;
-#ifdef KWIN_BUILD_ACTIVITIES
- int activityToCombo(const QString &d) const;
- QString comboToActivity(int val) const;
- void updateActivitiesList();
- KActivities::Consumer *m_activities;
- QString m_selectedActivityId; // we need this for async activity loading
-#endif
- int comboToTiling(int val) const;
- int inc(int i) const { return i+1; }
- int dec(int i) const { return i-1; }
- void prefillUnusedValues(const QVariantMap& info);
- DetectDialog* detect_dlg;
- bool detect_dlg_ok;
-};
-
-class EditShortcut
- : public QWidget, public Ui_EditShortcut
-{
- Q_OBJECT
-public:
- explicit EditShortcut(QWidget* parent = nullptr);
-protected Q_SLOTS:
- void editShortcut();
- void clearShortcut();
-};
-
-class EditShortcutDialog
- : public QDialog
-{
- Q_OBJECT
-public:
- explicit EditShortcutDialog(QWidget* parent = nullptr, const char* name = nullptr);
- void setShortcut(const QString& cut);
- QString shortcut() const;
-private:
- EditShortcut* widget;
-};
-
-// slightly duped from utils.cpp
-class ShortcutDialog
- : public QDialog
-{
- Q_OBJECT
-public:
- explicit ShortcutDialog(const QKeySequence& cut, QWidget* parent = nullptr);
- void accept() override;
- QKeySequence shortcut() const;
-private:
- KKeySequenceWidget* widget;
-};
-
-} // namespace
-
-#endif
diff --git a/kcmkwin/kwinrules/ruleswidgetbase.ui b/kcmkwin/kwinrules/ruleswidgetbase.ui
deleted file mode 100644
index e7670a925..000000000
--- a/kcmkwin/kwinrules/ruleswidgetbase.ui
+++ /dev/null
@@ -1,2834 +0,0 @@
-
-
- KWin::RulesWidgetBase
-
-
-
- 0
- 0
- 592
- 588
-
-
-
- -
-
-
- 0
-
-
-
- &Window matching
-
-
-
-
-
-
- &Description:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- false
-
-
- description
-
-
-
- -
-
-
- -
-
-
- Window &class (application):
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- false
-
-
- wmclass
-
-
-
- -
-
-
-
-
- Unimportant
-
-
- -
-
- Exact Match
-
-
- -
-
- Substring Match
-
-
- -
-
- Regular Expression
-
-
-
-
- -
-
-
- -
-
-
- false
-
-
- Edit
-
-
-
-
-
-
- -
-
-
- Match w&hole window class
-
-
-
- -
-
-
- Window ro&le:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- false
-
-
- role
-
-
-
- -
-
-
-
-
- Unimportant
-
-
- -
-
- Exact Match
-
-
- -
-
- Substring Match
-
-
- -
-
- Regular Expression
-
-
-
-
- -
-
-
- -
-
-
- false
-
-
- Edit
-
-
-
- -
-
-
- 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
-
-
-
-
-
-
- -
-
-
- &Machine (hostname):
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- false
-
-
- machine
-
-
-
- -
-
-
-
-
- Unimportant
-
-
- -
-
- Exact Match
-
-
- -
-
- Substring Match
-
-
- -
-
- Regular Expression
-
-
-
-
- -
-
-
- false
-
-
- Edit
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- &Detect Window Properties
-
-
-
- -
-
-
- s delay
-
-
- 30
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- false
-
-
- Qt::ScrollBarAsNeeded
-
-
- Qt::ScrollBarAsNeeded
-
-
- true
-
-
- false
-
-
- QAbstractItemView::NoDragDrop
-
-
- false
-
-
- QAbstractItemView::ExtendedSelection
-
-
- QListView::Static
-
-
- QListView::TopToBottom
-
-
- true
-
-
- QListView::Adjust
-
-
- 0
-
-
- QListView::ListMode
-
-
- true
-
-
-
-
- Normal Window
-
-
- -
-
- Dialog Window
-
-
- -
-
- Utility Window
-
-
- -
-
- Dock (panel)
-
-
- -
-
- Toolbar
-
-
- -
-
- Torn-Off Menu
-
-
- -
-
- Splash Screen
-
-
- -
-
- Desktop
-
-
- -
-
- Unmanaged Window
-
-
- -
-
- Standalone Menubar
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
-
-
-
-
- &Size && Position
-
-
- -
-
-
- &Position
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
- x,y
-
-
- 0123456789-+,xX:
-
-
-
- -
-
-
- &Size
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
- width,height
-
-
- 0123456789-+,xX:
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Maximized &horizontally
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Maximized &vertically
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- &Desktop
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Activit&y
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- false
-
-
- 1
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- &Fullscreen
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- M&inimized
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Sh&aded
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
-
- Default
-
-
- -
-
- No Placement
-
-
- -
-
- Minimal Overlapping
-
-
- -
-
- Maximized
-
-
- -
-
- Cascaded
-
-
- -
-
- Centered
-
-
- -
-
- Random
-
-
- -
-
- In Top-Left Corner
-
-
- -
-
- Under Mouse
-
-
- -
-
- On Main Window
-
-
-
-
- -
-
-
-
-
-
- Initial p&lacement
-
-
-
- -
-
-
- 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.
-
-
- Ignore requested &geometry
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- M&inimum size
-
-
-
- -
-
-
- false
-
-
- width,height
-
-
- 0123456789-+,xX:
-
-
-
- -
-
-
- M&aximum size
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
- width,height
-
-
- 0123456789-+,xX:
-
-
-
- -
-
-
- 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
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Expanding
-
-
-
- 20
- 16
-
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- Screen
-
-
-
-
-
-
-
- &Arrangement && Access
-
-
- -
-
-
- 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
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Window shall (not) appear in the taskbar.
-
-
- Skip &taskbar
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Window shall (not) appear in the Alt+Tab list
-
-
- Skip &switcher
-
-
-
- -
-
-
- false
-
-
- Edit...
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Fixed
-
-
-
- 20
- 8
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Shortcut
-
-
-
-
-
-
- -
-
-
- 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
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Keep &above
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Autog&roup in foreground
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Keep &below
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Autogroup by I&D
-
-
-
- -
-
-
- Autogroup with &identical
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
-
-
-
-
- Appearance && &Fixes
-
-
- -
-
-
- &No titlebar and frame
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Titlebar color &scheme
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- A&ctive opacity
-
-
-
- -
-
-
- false
-
-
- %
-
-
- 100
-
-
- 100
-
-
-
- -
-
-
- I&nactive opacity
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
- %
-
-
- 100
-
-
- 100
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Fixed
-
-
-
- 20
- 8
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Fixed
-
-
-
- 20
- 8
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- 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.
-
-
- &Focus stealing prevention
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
-
- None
-
-
- -
-
- Low
-
-
- -
-
- Normal
-
-
- -
-
- High
-
-
- -
-
- Extreme
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- This controls the focus protection of the currently active window.
-None will always give the focus away,
-Extreme will keep it.
-Otherwise it's interleaved with the stealing prevention
-assigned to the window that wants the focus.
-
-
- Focus protection
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
-
- None
-
-
- -
-
- Low
-
-
- -
-
- Normal
-
-
- -
-
- High
-
-
- -
-
- Extreme
-
-
-
-
- -
-
-
- Windows may prevent to get the focus (activate) when being clicked.
-On the other hand you might wish to prevent a window
-from getting focused on a mouse click.
-
-
- Accept &focus
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- 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
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- &Closeable
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Window &type
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
-
- Normal Window
-
-
- -
-
- Dialog Window
-
-
- -
-
- Utility Window
-
-
- -
-
- Dock (panel)
-
-
- -
-
- Toolbar
-
-
- -
-
- Torn-Off Menu
-
-
- -
-
- Splash Screen
-
-
- -
-
- Desktop
-
-
- -
-
- Standalone Menubar
-
-
-
-
- -
-
-
- Desktop file name
-
-
-
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Apply Initially
-
-
- -
-
- Remember
-
-
- -
-
- Force
-
-
- -
-
- Apply Now
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
- org.kde.kwin
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Block compositing
-
-
-
- -
-
-
- false
-
-
-
-
- Do Not Affect
-
-
- -
-
- Force
-
-
- -
-
- Force Temporarily
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
-
-
-
-
-
- KLineEdit
- QLineEdit
-
-
-
- KComboBox
- QComboBox
-
-
-
- YesNoBox
- QWidget
-
- 1
-
-
-
- description
- detect
- detection_delay
- wmclass_match
- wmclass
- edit_reg_wmclass
- whole_wmclass
- role_match
- role
- edit_reg_role
- types
- title_match
- title
- edit_reg_title
- machine_match
- machine
- edit_reg_machine
- enable_position
- rule_position
- position
- enable_size
- rule_size
- size
- enable_maximizehoriz
- rule_maximizehoriz
- enable_maximizevert
- rule_maximizevert
- enable_desktop
- rule_desktop
- desktop
- enable_activity
- rule_activity
- activity
- enable_screen
- rule_screen
- screen
- enable_fullscreen
- rule_fullscreen
- enable_minimize
- rule_minimize
- enable_shade
- rule_shade
- enable_placement
- rule_placement
- placement
- enable_ignoregeometry
- rule_ignoregeometry
- enable_minsize
- rule_minsize
- minsize
- enable_maxsize
- rule_maxsize
- maxsize
- enable_strictgeometry
- rule_strictgeometry
- enable_above
- rule_above
- enable_below
- rule_below
- enable_autogroup
- rule_autogroup
- enable_autogroupfg
- rule_autogroupfg
- enable_autogroupid
- rule_autogroupid
- autogroupid
- enable_skiptaskbar
- rule_skiptaskbar
- enable_skippager
- rule_skippager
- enable_skipswitcher
- rule_skipswitcher
- enable_shortcut
- rule_shortcut
- shortcut
- shortcut_edit
- enable_noborder
- rule_noborder
- enable_decocolor
- rule_decocolor
- decocolor
- enable_opacityactive
- rule_opacityactive
- opacityactive
- enable_opacityinactive
- rule_opacityinactive
- opacityinactive
- enable_fsplevel
- rule_fsplevel
- fsplevel
- enable_fpplevel
- rule_fpplevel
- fpplevel
- enable_acceptfocus
- rule_acceptfocus
- enable_disableglobalshortcuts
- rule_disableglobalshortcuts
- enable_closeable
- rule_closeable
- enable_type
- rule_type
- type
- enable_desktopfile
- rule_desktopfile
- desktopfile
- enable_blockcompositing
- rule_blockcompositing
- tabs
-
-
-
-
- detect
- clicked()
- KWin::RulesWidgetBase
- detectClicked()
-
-
- 285
- 124
-
-
- 20
- 20
-
-
-
-
- wmclass_match
- activated(int)
- KWin::RulesWidgetBase
- wmclassMatchChanged()
-
-
- 297
- 196
-
-
- 20
- 20
-
-
-
-
- role_match
- activated(int)
- KWin::RulesWidgetBase
- roleMatchChanged()
-
-
- 297
- 254
-
-
- 20
- 20
-
-
-
-
- title_match
- activated(int)
- KWin::RulesWidgetBase
- titleMatchChanged()
-
-
- 231
- 482
-
-
- 242
- 293
-
-
-
-
- machine_match
- activated(int)
- KWin::RulesWidgetBase
- machineMatchChanged()
-
-
- 194
- 509
-
-
- 242
- 293
-
-
-
-
-
diff --git a/kcmkwin/kwinrules/yesnobox.h b/kcmkwin/kwinrules/yesnobox.h
deleted file mode 100644
index 222ff6e3d..000000000
--- a/kcmkwin/kwinrules/yesnobox.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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:
- explicit 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 Q_SLOTS:
- void setChecked(bool b) { yes->setChecked(b); }
- void toggle() { yes->toggle(); }
-
-Q_SIGNALS:
- void clicked(bool checked = false);
- void toggled(bool checked);
-private Q_SLOTS:
- void noClicked(bool checked) { emit clicked(!checked); }
-private:
- QRadioButton *yes, *no;
-};
-
-#endif // YESNOBOX_H