From 3966017ccd9aa6cfab1fb5df4befd67a130cfaf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Fri, 30 Jul 2004 13:35:55 +0000 Subject: [PATCH] Fill (or pre-fill) more values from the detect dialog for matching the window. svn path=/trunk/kdebase/kwin/; revision=334154 --- kcmkwin/kwinrules/detectwidget.cpp | 27 +++++++++++++++++++++++++++ kcmkwin/kwinrules/detectwidget.h | 7 +++++++ kcmkwin/kwinrules/ruleswidget.cpp | 22 ++++++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/kcmkwin/kwinrules/detectwidget.cpp b/kcmkwin/kwinrules/detectwidget.cpp index 2050012f47..390a5fd7c7 100644 --- a/kcmkwin/kwinrules/detectwidget.cpp +++ b/kcmkwin/kwinrules/detectwidget.cpp @@ -127,6 +127,33 @@ QCString DetectDialog::selectedRole() const return ""; } +QString DetectDialog::selectedTitle() const + { + return title; + } + +Rules::StringMatch DetectDialog::titleMatch() const + { +#if KDE_IS_VERSION( 3, 3, 90 ) +#warning Offer possibilities here +#endif + return Rules::UnimportantMatch; + } + +bool DetectDialog::selectedWholeApp() const + { + return widget->use_class->isChecked(); + } + +NET::WindowType DetectDialog::selectedType() const + { + return type; + } + +QCString DetectDialog::selectedMachine() const + { + return machine; + } void DetectDialog::selectWindow() { diff --git a/kcmkwin/kwinrules/detectwidget.h b/kcmkwin/kwinrules/detectwidget.h index 3841b34ecf..42de589e64 100644 --- a/kcmkwin/kwinrules/detectwidget.h +++ b/kcmkwin/kwinrules/detectwidget.h @@ -25,6 +25,8 @@ #include #include +#include "../../rules.h" + namespace KWinInternal { @@ -46,6 +48,11 @@ class DetectDialog QCString selectedClass() const; bool selectedWholeClass() const; QCString selectedRole() const; + bool selectedWholeApp() const; + NET::WindowType selectedType() const; + QString selectedTitle() const; + Rules::StringMatch titleMatch() const; + QCString selectedMachine() const; signals: void detectionDone( bool ); protected: diff --git a/kcmkwin/kwinrules/ruleswidget.cpp b/kcmkwin/kwinrules/ruleswidget.cpp index 434df22ee6..24accdf859 100644 --- a/kcmkwin/kwinrules/ruleswidget.cpp +++ b/kcmkwin/kwinrules/ruleswidget.cpp @@ -518,6 +518,28 @@ void RulesWidget::detected( bool ok ) role_match->setCurrentItem( detect_dlg->selectedRole().isEmpty() ? Rules::UnimportantMatch : Rules::ExactMatch ); roleMatchChanged(); + if( detect_dlg->selectedWholeApp()) + { + for( unsigned int i = 0; + i < types->count(); + ++i ) + types->setSelected( i, true ); + } + else + { + NET::WindowType type = detect_dlg->selectedType(); + for( unsigned int i = 0; + i < types->count(); + ++i ) + types->setSelected( i, false ); + types->setSelected( typeToCombo( type ), true ); + } + title->setText( detect_dlg->selectedTitle()); + title_match->setCurrentItem( detect_dlg->titleMatch()); + titleMatchChanged(); + machine->setText( detect_dlg->selectedMachine()); + machine_match->setCurrentItem( Rules::UnimportantMatch ); + machineMatchChanged(); } delete detect_dlg; detect_dlg = NULL;