From 0b6057404f65218182ab27a9483a21065ef61fca Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 7 Nov 2011 21:50:33 -0600 Subject: Rename kwin to twin (Part 2 of 2) --- twin/kcmtwin/twinrules/CMakeLists.txt | 56 + twin/kcmtwin/twinrules/Makefile.am | 29 + twin/kcmtwin/twinrules/detectwidget.cpp | 223 +++ twin/kcmtwin/twinrules/detectwidget.h | 86 + twin/kcmtwin/twinrules/detectwidgetbase.ui | 218 +++ twin/kcmtwin/twinrules/editshortcutbase.ui | 164 ++ twin/kcmtwin/twinrules/kcm.cpp | 103 ++ twin/kcmtwin/twinrules/kcm.h | 53 + twin/kcmtwin/twinrules/main.cpp | 294 ++++ twin/kcmtwin/twinrules/ruleslist.cpp | 200 +++ twin/kcmtwin/twinrules/ruleslist.h | 59 + twin/kcmtwin/twinrules/ruleslistbase.ui | 91 + twin/kcmtwin/twinrules/ruleswidget.cpp | 803 +++++++++ twin/kcmtwin/twinrules/ruleswidget.h | 148 ++ twin/kcmtwin/twinrules/ruleswidgetbase.ui | 2597 ++++++++++++++++++++++++++++ twin/kcmtwin/twinrules/twinrules.desktop | 209 +++ twin/kcmtwin/twinrules/twinsrc.cpp | 8 + 17 files changed, 5341 insertions(+) create mode 100644 twin/kcmtwin/twinrules/CMakeLists.txt create mode 100644 twin/kcmtwin/twinrules/Makefile.am create mode 100644 twin/kcmtwin/twinrules/detectwidget.cpp create mode 100644 twin/kcmtwin/twinrules/detectwidget.h create mode 100644 twin/kcmtwin/twinrules/detectwidgetbase.ui create mode 100644 twin/kcmtwin/twinrules/editshortcutbase.ui create mode 100644 twin/kcmtwin/twinrules/kcm.cpp create mode 100644 twin/kcmtwin/twinrules/kcm.h create mode 100644 twin/kcmtwin/twinrules/main.cpp create mode 100644 twin/kcmtwin/twinrules/ruleslist.cpp create mode 100644 twin/kcmtwin/twinrules/ruleslist.h create mode 100644 twin/kcmtwin/twinrules/ruleslistbase.ui create mode 100644 twin/kcmtwin/twinrules/ruleswidget.cpp create mode 100644 twin/kcmtwin/twinrules/ruleswidget.h create mode 100644 twin/kcmtwin/twinrules/ruleswidgetbase.ui create mode 100644 twin/kcmtwin/twinrules/twinrules.desktop create mode 100644 twin/kcmtwin/twinrules/twinsrc.cpp (limited to 'twin/kcmtwin/twinrules') diff --git a/twin/kcmtwin/twinrules/CMakeLists.txt b/twin/kcmtwin/twinrules/CMakeLists.txt new file mode 100644 index 000000000..29aa24e4e --- /dev/null +++ b/twin/kcmtwin/twinrules/CMakeLists.txt @@ -0,0 +1,56 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_definitions( -DKCMRULES ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/twin/lib + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + +##### other data ################################ + +install( FILES twinrules.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) + + +##### kcm_twinrules (module) #################### + +tde_add_kpart( kcm_twinrules AUTOMOC + SOURCES kcm.cpp + LINK twinrules-static + DESTINATION ${PLUGIN_INSTALL_DIR} ) + + +##### twin_rules_dialog (tdeinit) ############### + +tde_add_tdeinit_executable( twin_rules_dialog + SOURCES main.cpp + LINK ${TQT_LIBRARIES} twinrules-static ) + + +##### twinrules (static) ######################## + +set( target twinrules ) + +set( ${target}_SRCS + ruleswidget.cpp ruleslist.cpp twinsrc.cpp detectwidget.cpp + ruleswidgetbase.ui ruleslistbase.ui detectwidgetbase.ui + editshortcutbase.ui ) + +tde_add_library( ${target} STATIC_PIC AUTOMOC + SOURCES ${${target}_SRCS} + LINK tdeui-shared ) diff --git a/twin/kcmtwin/twinrules/Makefile.am b/twin/kcmtwin/twinrules/Makefile.am new file mode 100644 index 000000000..c9e7c7beb --- /dev/null +++ b/twin/kcmtwin/twinrules/Makefile.am @@ -0,0 +1,29 @@ +METASOURCES = AUTO +AM_CPPFLAGS = $(all_includes) -DKCMRULES +INCLUDES = -I$(top_srcdir)/twin/lib + +bin_PROGRAMS = +lib_LTLIBRARIES = +tdeinit_LTLIBRARIES = twin_rules_dialog.la +kde_module_LTLIBRARIES = kcm_twinrules.la +noinst_LTLIBRARIES = libtwinrules.la + +libtwinrules_la_SOURCES = ruleswidget.cpp ruleslist.cpp twinsrc.cpp detectwidget.cpp \ + ruleswidgetbase.ui ruleslistbase.ui detectwidgetbase.ui editshortcutbase.ui +libtwinrules_la_LDFLAGS = $(all_libraries) -no-undefined +libtwinrules_la_LIBADD = $(LIB_TDEUI) + +kcm_twinrules_la_SOURCES = kcm.cpp +kcm_twinrules_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined +kcm_twinrules_la_LIBADD = libtwinrules.la +kcm_twinrules_la_COMPILE_FIRST = ruleslistbase.h ruleswidgetbase.h editshortcutbase.h + +twin_rules_dialog_la_SOURCES = main.cpp +twin_rules_dialog_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined +twin_rules_dialog_la_LIBADD = libtwinrules.la +twin_rules_dialog_la_COMPILE_FIRST = ruleslistbase.h ruleswidgetbase.h editshortcutbase.h + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kcmtwinrules.pot + +xdg_apps_DATA = twinrules.desktop diff --git a/twin/kcmtwin/twinrules/detectwidget.cpp b/twin/kcmtwin/twinrules/detectwidget.cpp new file mode 100644 index 000000000..d82836868 --- /dev/null +++ b/twin/kcmtwin/twinrules/detectwidget.cpp @@ -0,0 +1,223 @@ +/* + * 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 +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace KWinInternal +{ + +DetectWidget::DetectWidget( TQWidget* parent, const char* name ) +: DetectWidgetBase( parent, name ) + { + } + +DetectDialog::DetectDialog( TQWidget* parent, const char* name ) +: KDialogBase( parent, name, true, "", Ok | Cancel ) +, grabber( NULL ) + { + widget = new DetectWidget( this ); + setMainWidget( widget ); + } + +void DetectDialog::detect( WId window ) + { + if( window == 0 ) + selectWindow(); + else + readWindow( window ); + } + +void DetectDialog::readWindow( WId w ) + { + if( w == 0 ) + { + emit detectionDone( false ); + return; + } + info = KWin::windowInfo( w, -1U, -1U ); // read everything + if( !info.valid()) + { + emit detectionDone( false ); + return; + } + wmclass_class = info.windowClassClass(); + wmclass_name = info.windowClassName(); + role = info.windowRole(); + type = info.windowType( NET::NormalMask | NET::DesktopMask | NET::DockMask + | NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask | NET::TopMenuMask + | NET::UtilityMask | NET::SplashMask ); + title = info.name(); + extrarole = ""; // TODO + machine = info.clientMachine(); + executeDialog(); + } + +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 + " (" + wmclass_name + ' ' + wmclass_class + ")" ); + widget->role_label->setText( role ); + widget->use_role->setEnabled( !role.isEmpty()); + if( widget->use_role->isEnabled()) + widget->use_role->setChecked( true ); + else + widget->use_whole_class->setChecked( true ); + 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->extrarole_label->setText( extrarole ); + widget->machine_label->setText( machine ); + emit detectionDone( exec() == TQDialog::Accepted ); + } + +TQCString DetectDialog::selectedClass() const + { + if( widget->use_class->isChecked() || widget->use_role->isChecked()) + return wmclass_class; + return wmclass_name + ' ' + wmclass_class; + } + +bool DetectDialog::selectedWholeClass() const + { + return widget->use_whole_class->isChecked(); + } + +TQCString DetectDialog::selectedRole() const + { + if( widget->use_role->isChecked()) + return role; + return ""; + } + +TQString 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->use_class->isChecked(); + } + +NET::WindowType DetectDialog::selectedType() const + { + return type; + } + +TQCString DetectDialog::selectedMachine() const + { + return machine; + } + +void DetectDialog::selectWindow() + { + // use a dialog, so that all user input is blocked + // use WX11BypassWM and moving away so that it's not actually visible + // grab only mouse, so that keyboard can be used e.g. for switching windows + grabber = new TQDialog( NULL, NULL, true, (WFlags)WX11BypassWM ); + grabber->move( -1000, -1000 ); + grabber->show(); + grabber->grabMouse( tqcrossCursor ); + grabber->installEventFilter( this ); + } + +bool DetectDialog::eventFilter( TQObject* o, TQEvent* e ) + { + if( TQT_BASE_OBJECT(o) != TQT_BASE_OBJECT(grabber) ) + return false; + if( e->type() != TQEvent::MouseButtonRelease ) + return false; + delete grabber; + grabber = NULL; + if( TQT_TQMOUSEEVENT( e )->button() != Qt::LeftButton ) + { + emit detectionDone( false ); + return true; + } + readWindow( findWindow()); + return true; + } + +WId DetectDialog::findWindow() + { + Window root; + Window child; + uint mask; + int rootX, rootY, x, y; + Window parent = qt_xrootwin(); + Atom wm_state = XInternAtom( qt_xdisplay(), "WM_STATE", False ); + for( int i = 0; + i < 10; + ++i ) + { + XQueryPointer( qt_xdisplay(), parent, &root, &child, + &rootX, &rootY, &x, &y, &mask ); + if( child == None ) + return 0; + Atom type; + int format; + unsigned long nitems, after; + unsigned char* prop; + if( XGetWindowProperty( qt_xdisplay(), child, wm_state, 0, 0, False, AnyPropertyType, + &type, &format, &nitems, &after, &prop ) == Success ) + { + if( prop != NULL ) + XFree( prop ); + if( type != None ) + return child; + } + parent = child; + } + return 0; + } + +} // namespace + +#include "detectwidget.moc" diff --git a/twin/kcmtwin/twinrules/detectwidget.h b/twin/kcmtwin/twinrules/detectwidget.h new file mode 100644 index 000000000..75e725f5f --- /dev/null +++ b/twin/kcmtwin/twinrules/detectwidget.h @@ -0,0 +1,86 @@ +/* + * 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 "detectwidgetbase.h" + +#include +#include + +#include "../../rules.h" + +namespace KWinInternal +{ + +class DetectWidget + : public DetectWidgetBase + { + Q_OBJECT + public: + DetectWidget( TQWidget* parent = NULL, const char* name = NULL ); + }; + +class DetectDialog + : public KDialogBase + { + Q_OBJECT + public: + DetectDialog( TQWidget* parent = NULL, const char* name = NULL ); + void detect( WId window ); + TQCString selectedClass() const; + bool selectedWholeClass() const; + TQCString selectedRole() const; + bool selectedWholeApp() const; + NET::WindowType selectedType() const; + TQString selectedTitle() const; + Rules::StringMatch titleMatch() const; + TQCString selectedMachine() const; + const KWin::WindowInfo& windowInfo() const; + signals: + void detectionDone( bool ); + protected: + virtual bool eventFilter( TQObject* o, TQEvent* e ); + private: + void selectWindow(); + void readWindow( WId window ); + void executeDialog(); + WId findWindow(); + TQCString wmclass_class; + TQCString wmclass_name; + TQCString role; + NET::WindowType type; + TQString title; + TQCString extrarole; + TQCString machine; + DetectWidget* widget; + TQDialog* grabber; + KWin::WindowInfo info; + }; + +inline +const KWin::WindowInfo& DetectDialog::windowInfo() const + { + return info; + } + +} // namespace + +#endif diff --git a/twin/kcmtwin/twinrules/detectwidgetbase.ui b/twin/kcmtwin/twinrules/detectwidgetbase.ui new file mode 100644 index 000000000..af4ca9670 --- /dev/null +++ b/twin/kcmtwin/twinrules/detectwidgetbase.ui @@ -0,0 +1,218 @@ + +KWinInternal::DetectWidgetBase + + + Form3 + + + + 0 + 0 + 523 + 325 + + + + + unnamed + + + 0 + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 40 + + + + + + textLabel11 + + + Extra role: + + + + + textLabel1 + + + Class: + + + + + textLabel3 + + + Role: + + + + + type_label + + + + + + + + textLabel8 + + + Title: + + + + + class_label + + + + + + + + role_label + + + + + + + + title_label + + + + + + + + machine_label + + + + + + + + textLabel4 + + + Type: + + + + + extrarole_label + + + + + + + + textLabel13 + + + Machine: + + + + + line1 + + + HLine + + + Sunken + + + Horizontal + + + + + textLabel9 + + + Information About Selected Window + + + + + buttonGroup1 + + + + + + + unnamed + + + + use_class + + + Use window &class (whole application) + + + true + + + For selecting all windows belonging to a specific application, selecting only window class should usually work. + + + + + use_role + + + Use window class and window &role (specific window) + + + For selecting a specific window in an application, both window class and window role should be selected. Window class will determine the application, and window role the specific window in the application; many applications do not provide useful window roles though. + + + + + use_whole_class + + + Use &whole window class (specific window) + + + With some (non-KDE) applications whole window class can be sufficient for selecting a specific window in an application, as they set whole window class to contain both application and window role. + + + + + match_title + + + Match also window &title + + + + + + + + + diff --git a/twin/kcmtwin/twinrules/editshortcutbase.ui b/twin/kcmtwin/twinrules/editshortcutbase.ui new file mode 100644 index 000000000..af704c0a2 --- /dev/null +++ b/twin/kcmtwin/twinrules/editshortcutbase.ui @@ -0,0 +1,164 @@ + +EditShortcutBase + + + EditShortcutBase + + + + 0 + 0 + 587 + 402 + + + + + unnamed + + + + textLabel2 + + + 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 space-separated shortcut sets. 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. + + + RichText + + + + + line1 + + + HLine + + + Sunken + + + Horizontal + + + + + shortcut + + + + + layout2 + + + + unnamed + + + + spacer1 + + + Horizontal + + + Expanding + + + + 40 + 20 + + + + + + pushButton1 + + + &Single Shortcut + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 40 + 20 + + + + + + pushButton2 + + + C&lear + + + + + spacer3 + + + Horizontal + + + Expanding + + + + 40 + 20 + + + + + + + + line2 + + + HLine + + + Sunken + + + Horizontal + + + + + + + pushButton1 + clicked() + EditShortcutBase + editShortcut() + + + pushButton2 + clicked() + EditShortcutBase + clearShortcut() + + + + editShortcut() + clearShortcut() + + + + diff --git a/twin/kcmtwin/twinrules/kcm.cpp b/twin/kcmtwin/twinrules/kcm.cpp new file mode 100644 index 000000000..c7cdc7587 --- /dev/null +++ b/twin/kcmtwin/twinrules/kcm.cpp @@ -0,0 +1,103 @@ +/* + * 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 +#include +#include +#include +#include +#include + +#include "ruleslist.h" + +extern "C" + KDE_EXPORT KCModule *create_twinrules( TQWidget *parent, const char *name ) + { + //CT there's need for decision: kwm or twin? + KGlobal::locale()->insertCatalogue( "kcmtwinrules" ); + return new KWinInternal::KCMRules( parent, name ); + } + +namespace KWinInternal +{ + +KCMRules::KCMRules( TQWidget *parent, const char *name ) +: KCModule( parent, name ) +, config( "twinrulesrc" ) + { + TQVBoxLayout *layout = new TQVBoxLayout( this ); + widget = new KCMRulesList( this ); + layout->addWidget( TQT_TQWIDGET(widget) ); + connect( widget, TQT_SIGNAL( changed( bool )), TQT_SLOT( moduleChanged( bool ))); + KAboutData *about = new KAboutData(I18N_NOOP( "kcmtwinrules" ), + I18N_NOOP( "Window-Specific Settings Configuration Module" ), + 0, 0, KAboutData::License_GPL, I18N_NOOP( "(c) 2004 KWin and KControl Authors" )); + about->addAuthor("Lubos Lunak",0,"l.lunak@kde.org"); + setAboutData(about); + } + +void KCMRules::load() + { + config.reparseConfiguration(); + widget->load(); + emit KCModule::changed( false ); + } + +void KCMRules::save() + { + widget->save(); + emit KCModule::changed( false ); + // Send signal to twin + config.sync(); + if( !kapp->dcopClient()->isAttached()) + kapp->dcopClient()->attach(); + kapp->dcopClient()->send("twin*", "", "reconfigure()", TQString("")); + } + +void KCMRules::defaults() + { + widget->defaults(); + } + +TQString 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/twin/kcmtwin/twinrules/kcm.h b/twin/kcmtwin/twinrules/kcm.h new file mode 100644 index 000000000..9fb307458 --- /dev/null +++ b/twin/kcmtwin/twinrules/kcm.h @@ -0,0 +1,53 @@ +/* + * 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; +class KAboutData; + +namespace KWinInternal +{ + +class KCMRulesList; + +class KCMRules + : public KCModule + { + Q_OBJECT + public: + KCMRules( TQWidget *parent, const char *name ); + virtual void load(); + virtual void save(); + virtual void defaults(); + virtual TQString quickHelp() const; + protected slots: + void moduleChanged( bool state ); + private: + KCMRulesList* widget; + KConfig config; + }; + +} // namespace + +#endif diff --git a/twin/kcmtwin/twinrules/main.cpp b/twin/kcmtwin/twinrules/main.cpp new file mode 100644 index 000000000..db3a9fc48 --- /dev/null +++ b/twin/kcmtwin/twinrules/main.cpp @@ -0,0 +1,294 @@ +/* + * 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 + +#include +#include + +#include "ruleswidget.h" +#include "../../rules.h" + +namespace KWinInternal +{ + +static void loadRules( TQValueList< Rules* >& rules ) + { + KConfig cfg( "twinrulesrc", true ); + cfg.setGroup( "General" ); + int count = cfg.readNumEntry( "count" ); + for( int i = 1; + i <= count; + ++i ) + { + cfg.setGroup( TQString::number( i )); + Rules* rule = new Rules( cfg ); + rules.append( rule ); + } + } + +static void saveRules( const TQValueList< Rules* >& rules ) + { + KConfig cfg( "twinrulesrc" ); + TQStringList groups = cfg.groupList(); + for( TQStringList::ConstIterator it = groups.begin(); + it != groups.end(); + ++it ) + cfg.deleteGroup( *it ); + cfg.setGroup( "General" ); + cfg.writeEntry( "count", rules.count()); + int i = 1; + for( TQValueList< Rules* >::ConstIterator it = rules.begin(); + it != rules.end(); + ++it ) + { + cfg.setGroup( TQString::number( i )); + (*it)->write( cfg ); + ++i; + } + } + +static Rules* findRule( const TQValueList< Rules* >& rules, Window wid, bool whole_app ) + { + KWin::WindowInfo info = KWin::windowInfo( wid, + NET::WMName | NET::WMWindowType, + NET::WM2WindowClass | NET::WM2WindowRole | NET::WM2ClientMachine ); + if( !info.valid()) // shouldn't really happen + return NULL; + TQCString wmclass_class = info.windowClassClass().lower(); + TQCString wmclass_name = info.windowClassName().lower(); + TQCString role = info.windowRole().lower(); + NET::WindowType type = info.windowType( NET::NormalMask | NET::DesktopMask | NET::DockMask + | NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask | NET::TopMenuMask + | NET::UtilityMask | NET::SplashMask ); + TQString title = info.name(); +// TQCString extrarole = ""; // TODO + TQCString machine = info.clientMachine().lower(); + Rules* best_match = NULL; + int match_quality = 0; + for( TQValueList< Rules* >::ConstIterator it = rules.begin(); + it != rules.end(); + ++it ) + { + // try to find an exact match, i.e. not a generic rule + Rules* rule = *it; + 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 )) + continue; + if( quality > match_quality ) + { + best_match = rule; + match_quality = quality; + } + } + if( best_match != NULL ) + return best_match; + Rules* ret = new Rules; + if( whole_app ) + { + ret->description = i18n( "Application settings for %1" ).tqarg( static_cast(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->extrarolematch = 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" ).tqarg( static_cast(wmclass_class) ); + if( type == NET::Unknown ) + ret->types = NET::NormalMask; + else + ret->types = 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; +// ret->extrarole = extra; TODO + ret->extrarolematch = 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 int edit( Window wid, bool whole_app ) + { + TQValueList< Rules* > rules; + loadRules( rules ); + Rules* orig_rule = findRule( rules, wid, whole_app ); + RulesDialog dlg; + // dlg.edit() creates new Rules instance if edited + Rules* edited_rule = dlg.edit( orig_rule, wid, true ); + if( edited_rule == NULL || edited_rule->isEmpty()) + { + rules.remove( orig_rule ); + delete orig_rule; + if( orig_rule != edited_rule ) + delete edited_rule; + } + else if( edited_rule != orig_rule ) + { + TQValueList< Rules* >::Iterator pos = rules.find( orig_rule ); + if( pos != rules.end()) + *pos = edited_rule; + else + rules.prepend( edited_rule ); + delete orig_rule; + } + saveRules( rules ); + if( !kapp->dcopClient()->isAttached()) + kapp->dcopClient()->attach(); + kapp->dcopClient()->send("twin*", "", "reconfigure()", TQString("")); + return 0; + } + +} // namespace + +static const KCmdLineOptions options[] = + { + // no need for I18N_NOOP(), this is not supposed to be used directly + { "wid ", "WId of the window for special window settings.", 0 }, + { "whole-app", "Whether the settings should affect all windows of the application.", 0 }, + KCmdLineLastOption + }; + +extern "C" +KDE_EXPORT int kdemain( int argc, char* argv[] ) + { + KLocale::setMainCatalogue( "kcmtwinrules" ); + KCmdLineArgs::init( argc, argv, "twin_rules_dialog", I18N_NOOP( "KWin" ), + I18N_NOOP( "KWin helper utility" ), "1.0" ); + KCmdLineArgs::addCmdLineOptions( options ); + KApplication app; + KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); + bool id_ok = false; + Window id = args->getOption( "wid" ).toULong( &id_ok ); + bool whole_app = args->isSet( "whole-app" ); + args->clear(); + if( !id_ok || id == None ) + { + KCmdLineArgs::usage( i18n( "This helper utility is not supposed to be called directly." )); + return 1; + } + return KWinInternal::edit( id, whole_app ); + } diff --git a/twin/kcmtwin/twinrules/ruleslist.cpp b/twin/kcmtwin/twinrules/ruleslist.cpp new file mode 100644 index 000000000..29e02549d --- /dev/null +++ b/twin/kcmtwin/twinrules/ruleslist.cpp @@ -0,0 +1,200 @@ +/* + * 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 +#include + +#include "ruleswidget.h" + +namespace KWinInternal +{ + +KCMRulesList::KCMRulesList( TQWidget* parent, const char* name ) +: KCMRulesListBase( parent, name ) + { + // connect both current/selected, so that current==selected (stupid TQListBox :( ) + connect( rules_listbox, TQT_SIGNAL( currentChanged( TQListBoxItem* )), + TQT_SLOT( activeChanged( TQListBoxItem*))); + connect( rules_listbox, TQT_SIGNAL( selectionChanged( TQListBoxItem* )), + TQT_SLOT( activeChanged( TQListBoxItem*))); + connect( new_button, TQT_SIGNAL( clicked()), + TQT_SLOT( newClicked())); + connect( modify_button, TQT_SIGNAL( clicked()), + TQT_SLOT( modifyClicked())); + connect( delete_button, TQT_SIGNAL( clicked()), + TQT_SLOT( deleteClicked())); + connect( moveup_button, TQT_SIGNAL( clicked()), + TQT_SLOT( moveupClicked())); + connect( movedown_button, TQT_SIGNAL( clicked()), + TQT_SLOT( movedownClicked())); + connect( rules_listbox, TQT_SIGNAL( doubleClicked ( TQListBoxItem * ) ), + TQT_SLOT( modifyClicked())); + load(); + } + +KCMRulesList::~KCMRulesList() + { + for( TQValueVector< Rules* >::Iterator it = rules.begin(); + it != rules.end(); + ++it ) + delete *it; + rules.clear(); + } + +void KCMRulesList::activeChanged( TQListBoxItem* item ) + { + if( item != NULL ) + rules_listbox->setSelected( item, true ); // make current==selected + modify_button->setEnabled( item != NULL ); + delete_button->setEnabled( item != NULL ); + moveup_button->setEnabled( item != NULL && item->prev() != NULL ); + movedown_button->setEnabled( item != NULL && item->next() != NULL ); + } + +void KCMRulesList::newClicked() + { + RulesDialog dlg; + Rules* rule = dlg.edit( NULL, 0, false ); + if( rule == NULL ) + return; + int pos = rules_listbox->currentItem() + 1; + rules_listbox->insertItem( rule->description, pos ); + rules_listbox->setSelected( pos, true ); + rules.insert( rules.begin() + pos, rule ); + emit changed( true ); + } + +void KCMRulesList::modifyClicked() + { + int pos = rules_listbox->currentItem(); + if ( pos == -1 ) + return; + RulesDialog dlg; + Rules* rule = dlg.edit( rules[ pos ], 0, false ); + if( rule == rules[ pos ] ) + return; + delete rules[ pos ]; + rules[ pos ] = rule; + rules_listbox->changeItem( rule->description, pos ); + emit changed( true ); + } + +void KCMRulesList::deleteClicked() + { + int pos = rules_listbox->currentItem(); + assert( pos != -1 ); + rules_listbox->removeItem( pos ); + rules.erase( rules.begin() + pos ); + emit changed( true ); + } + +void KCMRulesList::moveupClicked() + { + int pos = rules_listbox->currentItem(); + assert( pos != -1 ); + if( pos > 0 ) + { + TQString txt = rules_listbox->text( pos ); + rules_listbox->removeItem( pos ); + rules_listbox->insertItem( txt, pos - 1 ); + rules_listbox->setSelected( pos - 1, true ); + Rules* rule = rules[ pos ]; + rules[ pos ] = rules[ pos - 1 ]; + rules[ pos - 1 ] = rule; + } + emit changed( true ); + } + +void KCMRulesList::movedownClicked() + { + int pos = rules_listbox->currentItem(); + assert( pos != -1 ); + if( pos < int( rules_listbox->count()) - 1 ) + { + TQString txt = rules_listbox->text( pos ); + rules_listbox->removeItem( pos ); + rules_listbox->insertItem( txt, pos + 1 ); + rules_listbox->setSelected( pos + 1, true ); + Rules* rule = rules[ pos ]; + rules[ pos ] = rules[ pos + 1 ]; + rules[ pos + 1 ] = rule; + } + emit changed( true ); + } + +void KCMRulesList::load() + { + rules_listbox->clear(); + for( TQValueVector< Rules* >::Iterator it = rules.begin(); + it != rules.end(); + ++it ) + delete *it; + rules.clear(); + KConfig cfg( "twinrulesrc", true ); + cfg.setGroup( "General" ); + int count = cfg.readNumEntry( "count" ); + rules.reserve( count ); + for( int i = 1; + i <= count; + ++i ) + { + cfg.setGroup( TQString::number( i )); + Rules* rule = new Rules( cfg ); + rules.append( rule ); + rules_listbox->insertItem( rule->description ); + } + if( rules.count() > 0 ) + rules_listbox->setSelected( 0, true ); + else + activeChanged( NULL ); + } + +void KCMRulesList::save() + { + KConfig cfg( "twinrulesrc" ); + TQStringList groups = cfg.groupList(); + for( TQStringList::ConstIterator it = groups.begin(); + it != groups.end(); + ++it ) + cfg.deleteGroup( *it ); + cfg.setGroup( "General" ); + cfg.writeEntry( "count", rules.count()); + int i = 1; + for( TQValueVector< Rules* >::ConstIterator it = rules.begin(); + it != rules.end(); + ++it ) + { + cfg.setGroup( TQString::number( i )); + (*it)->write( cfg ); + ++i; + } + } + +void KCMRulesList::defaults() + { + load(); + } + +} // namespace + +#include "ruleslist.moc" diff --git a/twin/kcmtwin/twinrules/ruleslist.h b/twin/kcmtwin/twinrules/ruleslist.h new file mode 100644 index 000000000..f7e7fb541 --- /dev/null +++ b/twin/kcmtwin/twinrules/ruleslist.h @@ -0,0 +1,59 @@ +/* + * 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 "ruleslistbase.h" + +#include + +#include "../../rules.h" + +class TQListBoxItem; + +namespace KWinInternal +{ + +class KCMRulesList + : public KCMRulesListBase + { + Q_OBJECT + public: + KCMRulesList( TQWidget* parent = NULL, const char* name = NULL ); + virtual ~KCMRulesList(); + void load(); + void save(); + void defaults(); + signals: + void changed( bool ); + private slots: + void newClicked(); + void modifyClicked(); + void deleteClicked(); + void moveupClicked(); + void movedownClicked(); + void activeChanged( TQListBoxItem* ); + private: + TQValueVector< Rules* > rules; + }; + +} // namespace + +#endif diff --git a/twin/kcmtwin/twinrules/ruleslistbase.ui b/twin/kcmtwin/twinrules/ruleslistbase.ui new file mode 100644 index 000000000..5fc5fd6ed --- /dev/null +++ b/twin/kcmtwin/twinrules/ruleslistbase.ui @@ -0,0 +1,91 @@ + +KWinInternal::KCMRulesListBase + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + unnamed + + + 0 + + + + rules_listbox + + + + + new_button + + + &New... + + + + + modify_button + + + &Modify... + + + + + delete_button + + + Delete + + + + + + + + moveup_button + + + Move &Up + + + + + movedown_button + + + Move &Down + + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 294 + + + + + + + + diff --git a/twin/kcmtwin/twinrules/ruleswidget.cpp b/twin/kcmtwin/twinrules/ruleswidget.cpp new file mode 100644 index 000000000..cfe96458e --- /dev/null +++ b/twin/kcmtwin/twinrules/ruleswidget.cpp @@ -0,0 +1,803 @@ +/* + * 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 +#include +#include +#include +#include +#include +#include + +#include "../../rules.h" + +#include "detectwidget.h" + +namespace KWinInternal +{ + +#define SETUP( var, type ) \ + connect( enable_##var, TQT_SIGNAL( toggled( bool )), rule_##var, TQT_SLOT( setEnabled( bool ))); \ + connect( enable_##var, TQT_SIGNAL( toggled( bool )), this, TQT_SLOT( updateEnable##var())); \ + connect( rule_##var, TQT_SIGNAL( activated( int )), this, TQT_SLOT( updateEnable##var())); \ + TQWhatsThis::add( enable_##var, enableDesc ); \ + TQWhatsThis::add( rule_##var, type##RuleDesc ); + +RulesWidget::RulesWidget( TQWidget* parent, const char* name ) +: RulesWidgetBase( parent, name ) +, detect_dlg( NULL ) + { + TQString enableDesc = + i18n( "Enable this checkbox to alter this window property for the specified window(s)." ); + TQString 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" + " 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).
  • " + "
" ); + TQString 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( 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( skiptaskbar, set ); + SETUP( skippager, set ); + SETUP( acceptfocus, force ); + SETUP( closeable, force ); + SETUP( opacityactive, force ); + SETUP( opacityinactive, force ); + SETUP( shortcut, force ); + // workarounds tab + SETUP( fsplevel, force ); + SETUP( moveresizemode, force ); + SETUP( type, force ); + SETUP( ignoreposition, force ); + SETUP( minsize, force ); + SETUP( maxsize, force ); + SETUP( strictgeometry, force ); + SETUP( disableglobalshortcuts, force ); + KWinModule module; + int i; + for( i = 1; + i <= module.numberOfDesktops(); + ++i ) + desktop->insertItem( TQString::number( i ).rightJustify( 2 ) + ":" + module.desktopName( i )); + desktop->insertItem( i18n( "All Desktops" )); + } + +#undef SETUP + +#define UPDATE_ENABLE_SLOT( var ) \ +void RulesWidget::updateEnable##var() \ + { \ + /* leave the label readable label_##var->setEnabled( enable_##var->isChecked() && rule_##var->currentItem() != 0 );*/ \ + var->setEnabled( enable_##var->isChecked() && rule_##var->currentItem() != 0 ); \ + } + +// geometry tab +UPDATE_ENABLE_SLOT( position ) +UPDATE_ENABLE_SLOT( size ) +UPDATE_ENABLE_SLOT( desktop ) +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( skiptaskbar ) +UPDATE_ENABLE_SLOT( skippager ) +UPDATE_ENABLE_SLOT( acceptfocus ) +UPDATE_ENABLE_SLOT( closeable ) +UPDATE_ENABLE_SLOT( opacityactive ) +UPDATE_ENABLE_SLOT( opacityinactive ) +void RulesWidget::updateEnableshortcut() + { + shortcut->setEnabled( enable_shortcut->isChecked() && rule_shortcut->currentItem() != 0 ); + shortcut_edit->setEnabled( enable_shortcut->isChecked() && rule_shortcut->currentItem() != 0 ); + } +// workarounds tab +UPDATE_ENABLE_SLOT( fsplevel ) +UPDATE_ENABLE_SLOT( moveresizemode ) +UPDATE_ENABLE_SLOT( type ) +UPDATE_ENABLE_SLOT( ignoreposition ) +UPDATE_ENABLE_SLOT( minsize ) +UPDATE_ENABLE_SLOT( maxsize ) +UPDATE_ENABLE_SLOT( strictgeometry ) +UPDATE_ENABLE_SLOT( disableglobalshortcuts ) + +#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 TQString positionToStr( const TQPoint& p ) + { + if( p == invalidPoint ) + return TQString::null; + return TQString::number( p.x()) + "," + TQString::number( p.y()); + } + +static TQPoint strToPosition( const TQString& str ) + { // two numbers, with + or -, separated by any of , x X : + TQRegExp reg( "\\s*([+-]?[0-9]*)\\s*[,xX:]\\s*([+-]?[0-9]*)\\s*" ); + if( !reg.exactMatch( str )) + return invalidPoint; + return TQPoint( reg.cap( 1 ).toInt(), reg.cap( 2 ).toInt()); + } + +static TQString sizeToStr( const TQSize& s ) + { + if( !s.isValid()) + return TQString::null; + return TQString::number( s.width()) + "," + TQString::number( s.height()); + } + +static TQSize strToSize( const TQString& str ) + { // two numbers, with + or -, separated by any of , x X : + TQRegExp reg( "\\s*([+-]?[0-9]*)\\s*[,xX:]\\s*([+-]?[0-9]*)\\s*" ); + if( !reg.exactMatch( str )) + return TQSize(); + return TQSize( reg.cap( 1 ).toInt(), reg.cap( 2 ).toInt()); + } + +//used for opacity settings +static TQString intToStr( const int& s ) + { + if( s < 1 || s > 100 ) + return TQString::null; + return TQString::number(s); + } + +static int strToInt( const TQString& str ) + { + int tmp = str.toInt(); + if( tmp < 1 || tmp > 100 ) + return 100; + return tmp; + } + +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; + } + +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 moveresizeToCombo( Options::MoveResizeMode mode ) + { + return mode == Options::Opaque ? 0 : 1; + } + +static Options::MoveResizeMode comboToMoveResize( int val ) + { + return val == 0 ? Options::Opaque : Options::Transparent; + } + +static int typeToCombo( NET::WindowType type ) + { + if( type < NET::Normal || type > NET::Splash ) + return 0; // Normal + static const int conv[] = + { + 0, // Normal + 7, // Desktop + 3, // Dock + 4, // Toolbar + 5, // Menu + 1, // Dialog + 8, // Override + 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::Override, + 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->setCurrentItem( 0 ); \ + var->uimethod0; \ + updateEnable##var(); \ + } \ + else \ + { \ + enable_##var->setChecked( true ); \ + rule_##var->setCurrentItem( type##_rule_to_combo[ rules->var##rule ] ); \ + 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( "" )) +#define COMBOBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, setCurrentItem, setCurrentItem( 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( "" )) +#define COMBOBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, setCurrentItem, setCurrentItem( 0 )) + +void RulesWidget::setRules( Rules* rules ) + { + Rules tmp; + if( rules == NULL ) + rules = &tmp; // empty + description->setText( rules->description ); + wmclass->setText( rules->wmclass ); + whole_wmclass->setChecked( rules->wmclasscomplete ); + wmclass_match->setCurrentItem( rules->wmclassmatch ); + wmclassMatchChanged(); + role->setText( rules->windowrole ); + role_match->setCurrentItem( rules->windowrolematch ); + roleMatchChanged(); + types->setSelected( 0, rules->types & NET::NormalMask ); + types->setSelected( 1, rules->types & NET::DialogMask ); + types->setSelected( 2, rules->types & NET::UtilityMask ); + types->setSelected( 3, rules->types & NET::DockMask ); + types->setSelected( 4, rules->types & NET::ToolbarMask ); + types->setSelected( 5, rules->types & NET::MenuMask ); + types->setSelected( 6, rules->types & NET::SplashMask ); + types->setSelected( 7, rules->types & NET::DesktopMask ); + types->setSelected( 8, rules->types & NET::OverrideMask ); + types->setSelected( 9, rules->types & NET::TopMenuMask ); + title->setText( rules->title ); + title_match->setCurrentItem( rules->titlematch ); + titleMatchChanged(); + extra->setText( rules->extrarole ); + extra_match->setCurrentItem( rules->extrarolematch ); + extraMatchChanged(); + machine->setText( rules->clientmachine ); + machine_match->setCurrentItem( rules->clientmachinematch ); + machineMatchChanged(); + LINEEDIT_SET_RULE( position, positionToStr ); + LINEEDIT_SET_RULE( size, sizeToStr ); + COMBOBOX_SET_RULE( desktop, desktopToCombo ); + 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, ); + CHECKBOX_SET_RULE( skiptaskbar, ); + CHECKBOX_SET_RULE( skippager, ); + CHECKBOX_FORCE_RULE( acceptfocus, ); + CHECKBOX_FORCE_RULE( closeable, ); + LINEEDIT_FORCE_RULE( opacityactive, intToStr ); + LINEEDIT_FORCE_RULE( opacityinactive, intToStr ); + LINEEDIT_SET_RULE( shortcut, ); + COMBOBOX_FORCE_RULE( fsplevel, ); + COMBOBOX_FORCE_RULE( moveresizemode, moveresizeToCombo ); + COMBOBOX_FORCE_RULE( type, typeToCombo ); + CHECKBOX_FORCE_RULE( ignoreposition, ); + LINEEDIT_FORCE_RULE( minsize, sizeToStr ); + LINEEDIT_FORCE_RULE( maxsize, sizeToStr ); + CHECKBOX_FORCE_RULE( strictgeometry, ); + CHECKBOX_FORCE_RULE( disableglobalshortcuts, ); + } + +#undef GENERIC_RULE +#undef CHECKBOX_SET_RULE +#undef LINEEDIT_SET_RULE +#undef COMBOBOX_SET_RULE +#undef CHECKBOX_FORCE_RULE +#undef LINEEDIT_FORCE_RULE +#undef COMBOBOX_FORCE_RULE + +#define GENERIC_RULE( var, func, Type, type, uimethod ) \ + if( enable_##var->isChecked()) \ + { \ + rules->var##rule = combo_to_##type##_rule[ rule_##var->currentItem() ]; \ + rules->var = func( 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, currentItem ) +#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, currentItem ) + +Rules* RulesWidget::rules() const + { + Rules* rules = new Rules(); + rules->description = description->text(); + rules->wmclass = wmclass->text().utf8(); + rules->wmclasscomplete = whole_wmclass->isChecked(); + rules->wmclassmatch = static_cast< Rules::StringMatch >( wmclass_match->currentItem()); + rules->windowrole = role->text().utf8(); + rules->windowrolematch = static_cast< Rules::StringMatch >( role_match->currentItem()); + rules->types = 0; + bool all_types = true; + for( unsigned int i = 0; + i < types->count(); + ++i ) + if( !types->isSelected( i )) + all_types = false; + if( all_types ) // if all types are selected, use AllTypesMask (for future expansion) + rules->types = NET::AllTypesMask; + else + { + rules->types |= types->isSelected( 0 ) ? NET::NormalMask : 0; + rules->types |= types->isSelected( 1 ) ? NET::DialogMask : 0; + rules->types |= types->isSelected( 2 ) ? NET::UtilityMask : 0; + rules->types |= types->isSelected( 3 ) ? NET::DockMask : 0; + rules->types |= types->isSelected( 4 ) ? NET::ToolbarMask : 0; + rules->types |= types->isSelected( 5 ) ? NET::MenuMask : 0; + rules->types |= types->isSelected( 6 ) ? NET::SplashMask : 0; + rules->types |= types->isSelected( 7 ) ? NET::DesktopMask : 0; + rules->types |= types->isSelected( 8 ) ? NET::OverrideMask : 0; + rules->types |= types->isSelected( 9 ) ? NET::TopMenuMask : 0; + } + rules->title = title->text(); + rules->titlematch = static_cast< Rules::StringMatch >( title_match->currentItem()); + rules->extrarole = extra->text().utf8(); + rules->extrarolematch = static_cast< Rules::StringMatch >( extra_match->currentItem()); + rules->clientmachine = machine->text().utf8(); + rules->clientmachinematch = static_cast< Rules::StringMatch >( machine_match->currentItem()); + LINEEDIT_SET_RULE( position, strToPosition ); + LINEEDIT_SET_RULE( size, strToSize ); + COMBOBOX_SET_RULE( desktop, comboToDesktop ); + 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, ); + CHECKBOX_SET_RULE( skiptaskbar, ); + CHECKBOX_SET_RULE( skippager, ); + CHECKBOX_FORCE_RULE( acceptfocus, ); + CHECKBOX_FORCE_RULE( closeable, ); + LINEEDIT_FORCE_RULE( opacityactive, strToInt ); + LINEEDIT_FORCE_RULE( opacityinactive, strToInt ); + LINEEDIT_SET_RULE( shortcut, ); + COMBOBOX_FORCE_RULE( fsplevel, ); + COMBOBOX_FORCE_RULE( moveresizemode, comboToMoveResize ); + COMBOBOX_FORCE_RULE( type, comboToType ); + CHECKBOX_FORCE_RULE( ignoreposition, ); + LINEEDIT_FORCE_RULE( minsize, strToSize ); + LINEEDIT_FORCE_RULE( maxsize, strToSize ); + CHECKBOX_FORCE_RULE( strictgeometry, ); + CHECKBOX_FORCE_RULE( disableglobalshortcuts, ); + return rules; + } + +#undef GENERIC_RULE +#undef CHECKBOX_SET_RULE +#undef LINEEDIT_SET_RULE +#undef COMBOBOX_SET_RULE +#undef CHECKBOX_FORCE_RULE +#undef LINEEDIT_FORCE_RULE +#undef COMBOBOX_FORCE_RULE + +#define STRING_MATCH_COMBO( type ) \ +void RulesWidget::type##MatchChanged() \ + { \ + edit_reg_##type->setEnabled( type##_match->currentItem() == Rules::RegExpMatch ); \ + type->setEnabled( type##_match->currentItem() != Rules::UnimportantMatch ); \ + } + +STRING_MATCH_COMBO( wmclass ) +STRING_MATCH_COMBO( role ) +STRING_MATCH_COMBO( title ) +STRING_MATCH_COMBO( extra ) +STRING_MATCH_COMBO( machine ) + +#undef STRING_MATCH_COMBO + +void RulesWidget::detectClicked() + { + assert( detect_dlg == NULL ); + detect_dlg = new DetectDialog; + connect( detect_dlg, TQT_SIGNAL( detectionDone( bool )), this, TQT_SLOT( detected( bool ))); + detect_dlg->detect( 0 ); + } + +void RulesWidget::detected( bool ok ) + { + if( ok ) + { + wmclass->setText( detect_dlg->selectedClass()); + wmclass_match->setCurrentItem( Rules::ExactMatch ); + wmclassMatchChanged(); // grrr + whole_wmclass->setChecked( detect_dlg->selectedWholeClass()); + role->setText( detect_dlg->selectedRole()); + 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(); + // prefill values from to window to settings which already set + const KWin::WindowInfo& info = detect_dlg->windowInfo(); + prefillUnusedValues( info ); + } + delete detect_dlg; + detect_dlg = NULL; + detect_dlg_ok = ok; + } + +#define GENERIC_PREFILL( var, func, info, uimethod ) \ + if( !enable_##var->isChecked()) \ + { \ + 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, setCurrentItem ) + +void RulesWidget::prefillUnusedValues( const KWin::WindowInfo& info ) + { + LINEEDIT_PREFILL( position, positionToStr, info.frameGeometry().topLeft() ); + LINEEDIT_PREFILL( size, sizeToStr, info.frameGeometry().size() ); + COMBOBOX_PREFILL( desktop, desktopToCombo, info.desktop() ); + CHECKBOX_PREFILL( maximizehoriz,, info.state() & NET::MaxHoriz ); + CHECKBOX_PREFILL( maximizevert,, info.state() & NET::MaxVert ); + CHECKBOX_PREFILL( minimize,, info.isMinimized() ); + CHECKBOX_PREFILL( shade,, info.state() & NET::Shaded ); + CHECKBOX_PREFILL( fullscreen,, info.state() & NET::FullScreen ); + //COMBOBOX_PREFILL( placement, placementToCombo ); + CHECKBOX_PREFILL( above,, info.state() & NET::KeepAbove ); + CHECKBOX_PREFILL( below,, info.state() & NET::KeepBelow ); + // noborder is only internal KWin information, so let's guess + CHECKBOX_PREFILL( noborder,, info.frameGeometry() == info.geometry() ); + CHECKBOX_PREFILL( skiptaskbar,, info.state() & NET::SkipTaskbar ); + CHECKBOX_PREFILL( skippager,, info.state() & NET::SkipPager ); + //CHECKBOX_PREFILL( acceptfocus, ); + //CHECKBOX_PREFILL( closeable, ); + LINEEDIT_PREFILL( opacityactive, intToStr, 100 /*get the actual opacity somehow*/); + LINEEDIT_PREFILL( opacityinactive, intToStr, 100 /*get the actual opacity somehow*/); + //LINEEDIT_PREFILL( shortcut, ); + //COMBOBOX_PREFILL( fsplevel, ); + //COMBOBOX_PREFILL( moveresizemode, moveresizeToCombo ); + COMBOBOX_PREFILL( type, typeToCombo, info.windowType( SUPPORTED_WINDOW_TYPES_MASK ) ); + //CHECKBOX_PREFILL( ignoreposition, ); + LINEEDIT_PREFILL( minsize, sizeToStr, info.frameGeometry().size() ); + LINEEDIT_PREFILL( maxsize, sizeToStr, info.frameGeometry().size() ); + //CHECKBOX_PREFILL( strictgeometry, ); + //CHECKBOX_PREFILL( disableglobalshortcuts, ); + } + +#undef GENERIC_PREFILL +#undef CHECKBOX_PREFILL +#undef LINEEDIT_PREFILL +#undef COMBOBOX_PREFILL + +bool RulesWidget::finalCheck() + { + if( description->text().isEmpty()) + { + if( !wmclass->text().isEmpty()) + description->setText( i18n( "Settings for %1" ).arg( wmclass->text())); + else + description->setText( i18n( "Unnamed entry" )); + } + bool all_types = true; + for( unsigned int i = 0; + i < types->count(); + ++i ) + if( !types->isSelected( i )) + all_types = false; + if( wmclass_match->currentItem() == Rules::UnimportantMatch && all_types ) + { + if( KMessageBox::warningContinueCancel( tqtopLevelWidget(), + 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( WId window ) + { + tabs->setCurrentPage( 2 ); // geometry tab, skip tabs for window identification + KWin::WindowInfo info( window, -1U, -1U ); // read everything + prefillUnusedValues( info ); + } + +void RulesWidget::shortcutEditClicked() + { + EditShortcutDialog dlg( tqtopLevelWidget()); + dlg.setShortcut( shortcut->text()); + if( dlg.exec() == TQDialog::Accepted ) + shortcut->setText( dlg.shortcut()); + } + +RulesDialog::RulesDialog( TQWidget* parent, const char* name ) +: KDialogBase( parent, name, true, i18n( "Edit Window-Specific Settings" ), Ok | Cancel ) + { + widget = new RulesWidget( this ); + setMainWidget( widget ); + } + +// 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, WId window, bool show_hints ) + { + rules = r; + widget->setRules( rules ); + if( window != 0 ) + widget->prepareWindowSpecific( window ); + if( show_hints ) + TQTimer::singleShot( 0, this, TQT_SLOT( displayHints())); + exec(); + return rules; + } + +void RulesDialog::displayHints() + { + TQString 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, TQString::null, "displayhints" ); + } + +void RulesDialog::accept() + { + if( !widget->finalCheck()) + return; + rules = widget->rules(); + KDialogBase::accept(); + } + +EditShortcut::EditShortcut( TQWidget* parent, const char* name ) +: EditShortcutBase( parent, name ) + { + } + +void EditShortcut::editShortcut() + { + ShortcutDialog dlg( KShortcut( shortcut->text()), tqtopLevelWidget()); + if( dlg.exec() == TQDialog::Accepted ) + shortcut->setText( dlg.shortcut().toString()); + } + +void EditShortcut::clearShortcut() + { + shortcut->setText( "" ); + } + +EditShortcutDialog::EditShortcutDialog( TQWidget* parent, const char* name ) +: KDialogBase( parent, name, true, i18n( "Edit Shortcut" ), Ok | Cancel ) + { + widget = new EditShortcut( this ); + setMainWidget( widget ); + } + +void EditShortcutDialog::setShortcut( const TQString& cut ) + { + widget->shortcut->setText( cut ); + } + +TQString EditShortcutDialog::shortcut() const + { + return widget->shortcut->text(); + } + +ShortcutDialog::ShortcutDialog( const KShortcut& cut, TQWidget* parent, const char* name ) + : KShortcutDialog( cut, false /*TODO???*/, parent, name ) + { + } + +void ShortcutDialog::accept() + { + for( int i = 0; + ; + ++i ) + { + KKeySequence seq = shortcut().seq( i ); + if( seq.isNull()) + break; + if( seq.key( 0 ) == Key_Escape ) + { + reject(); + return; + } + if( seq.key( 0 ) == Key_Space ) + { // clear + setShortcut( KShortcut()); + KShortcutDialog::accept(); + return; + } + if( seq.key( 0 ).modFlags() == 0 ) + { // no shortcuts without modifiers + KShortcut cut = shortcut(); + cut.setSeq( i, KKeySequence()); + setShortcut( cut ); + return; + } + } + KShortcutDialog::accept(); + } + +} // namespace + +#include "ruleswidget.moc" diff --git a/twin/kcmtwin/twinrules/ruleswidget.h b/twin/kcmtwin/twinrules/ruleswidget.h new file mode 100644 index 000000000..2a9b0d036 --- /dev/null +++ b/twin/kcmtwin/twinrules/ruleswidget.h @@ -0,0 +1,148 @@ +/* + * 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 + +#include "ruleswidgetbase.h" +#include "editshortcutbase.h" + +namespace KWinInternal +{ + +class Rules; +class DetectDialog; + +class RulesWidget + : public RulesWidgetBase + { + Q_OBJECT + public: + RulesWidget( TQWidget* parent = NULL, const char* name = NULL ); + void setRules( Rules* r ); + Rules* rules() const; + bool finalCheck(); + void prepareWindowSpecific( WId window ); + signals: + void changed( bool state ); + protected slots: + virtual void detectClicked(); + virtual void wmclassMatchChanged(); + virtual void roleMatchChanged(); + virtual void titleMatchChanged(); + virtual void extraMatchChanged(); + virtual void machineMatchChanged(); + virtual void shortcutEditClicked(); + private slots: + // geometry tab + void updateEnableposition(); + void updateEnablesize(); + void updateEnabledesktop(); + void updateEnablemaximizehoriz(); + void updateEnablemaximizevert(); + void updateEnableminimize(); + void updateEnableshade(); + void updateEnablefullscreen(); + void updateEnableplacement(); + // preferences tab + void updateEnableabove(); + void updateEnablebelow(); + void updateEnablenoborder(); + void updateEnableskiptaskbar(); + void updateEnableskippager(); + void updateEnableacceptfocus(); + void updateEnablecloseable(); + void updateEnableopacityactive(); + void updateEnableopacityinactive(); + // workarounds tab + void updateEnablefsplevel(); + void updateEnablemoveresizemode(); + void updateEnabletype(); + void updateEnableignoreposition(); + void updateEnableminsize(); + void updateEnablemaxsize(); + void updateEnablestrictgeometry(); + void updateEnableshortcut(); + void updateEnabledisableglobalshortcuts(); + // internal + void detected( bool ); + private: + int desktopToCombo( int d ) const; + int comboToDesktop( int val ) const; + void prefillUnusedValues( const KWin::WindowInfo& info ); + DetectDialog* detect_dlg; + bool detect_dlg_ok; + }; + +class RulesDialog + : public KDialogBase + { + Q_OBJECT + public: + RulesDialog( TQWidget* parent = NULL, const char* name = NULL ); + Rules* edit( Rules* r, WId window, bool show_hints ); + protected: + virtual void accept(); + private slots: + void displayHints(); + private: + RulesWidget* widget; + Rules* rules; + }; + +class EditShortcut + : public EditShortcutBase + { + Q_OBJECT + public: + EditShortcut( TQWidget* parent = NULL, const char* name = NULL ); + protected: + void editShortcut(); + void clearShortcut(); + }; + +class EditShortcutDialog + : public KDialogBase + { + Q_OBJECT + public: + EditShortcutDialog( TQWidget* parent = NULL, const char* name = NULL ); + void setShortcut( const TQString& cut ); + TQString shortcut() const; + private: + EditShortcut* widget; + }; + +// slightly duped from utils.cpp +class ShortcutDialog + : public KShortcutDialog + { + Q_OBJECT + public: + ShortcutDialog( const KShortcut& cut, TQWidget* parent = NULL, const char* name = NULL ); + virtual void accept(); + }; + +} // namespace + +#endif diff --git a/twin/kcmtwin/twinrules/ruleswidgetbase.ui b/twin/kcmtwin/twinrules/ruleswidgetbase.ui new file mode 100644 index 000000000..5a5640ca2 --- /dev/null +++ b/twin/kcmtwin/twinrules/ruleswidgetbase.ui @@ -0,0 +1,2597 @@ + +KWinInternal::RulesWidgetBase + + + Form2 + + + + 0 + 0 + 630 + 503 + + + + + unnamed + + + 0 + + + + tabs + + + + tab + + + &Window + + + + unnamed + + + + textLabel1 + + + De&scription: + + + description + + + + + description + + + + + textLabel2 + + + Window &class (application type): + + + wmclass + + + + + textLabel3 + + + Window &role: + + + role + + + + + role + + + + + spacer29 + + + Vertical + + + Expanding + + + + 20 + 40 + + + + + + + Unimportant + + + + + Exact Match + + + + + Substring Match + + + + + Regular Expression + + + + role_match + + + + + spacer1 + + + Horizontal + + + Expanding + + + + 212 + 20 + + + + + + edit_reg_role + + + false + + + Edit + + + + + spacer4 + + + Horizontal + + + Expanding + + + + 211 + 20 + + + + + + + Unimportant + + + + + Exact Match + + + + + Substring Match + + + + + Regular Expression + + + + wmclass_match + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 212 + 20 + + + + + + edit_reg_wmclass + + + false + + + Edit + + + + + + + + spacer5 + + + Horizontal + + + Expanding + + + + 211 + 20 + + + + + + wmclass + + + + + whole_wmclass + + + Match w&hole window class + + + + + groupBox1 + + + Detect Window Properties + + + + unnamed + + + + spacer27 + + + Horizontal + + + Expanding + + + + 270 + 20 + + + + + + detect1 + + + &Detect + + + + + spacer28 + + + Horizontal + + + Expanding + + + + 269 + 20 + + + + + + + + + + tab + + + Window &Extra + + + + unnamed + + + + textLabel4 + + + Window &types: + + + types + + + + + + Normal Window + + + + + Dialog Window + + + + + Utility Window + + + + + Dock (panel) + + + + + Toolbar + + + + + Torn-Off Menu + + + + + Splash Screen + + + + + Desktop + + + + + Override Type + + + + + Standalone Menubar + + + + types + + + Multi + + + + + textLabel5 + + + Window t&itle: + + + title + + + + + title + + + + + textLabel6 + + + Extra role: + + + extra + + + + + extra + + + + + textLabel7 + + + &Machine (hostname): + + + machine + + + + + machine + + + + + + Unimportant + + + + + Exact Match + + + + + Substring Match + + + + + Regular Expression + + + + title_match + + + + + spacer2_2 + + + Horizontal + + + Expanding + + + + 199 + 20 + + + + + + edit_reg_title + + + false + + + Edit + + + + + + + + spacer5_2 + + + Horizontal + + + Expanding + + + + 199 + 20 + + + + + + + Unimportant + + + + + Exact Match + + + + + Substring Match + + + + + Regular Expression + + + + extra_match + + + + + spacer2_2_2 + + + Horizontal + + + Expanding + + + + 199 + 20 + + + + + + edit_reg_extra + + + false + + + Edit + + + + + + + + spacer5_2_2 + + + Horizontal + + + Expanding + + + + 199 + 20 + + + + + + + Unimportant + + + + + Exact Match + + + + + Substring Match + + + + + Regular Expression + + + + machine_match + + + + + spacer2_2_3 + + + Horizontal + + + Expanding + + + + 199 + 20 + + + + + + edit_reg_machine + + + false + + + Edit + + + + + + + + spacer5_2_3 + + + Horizontal + + + Expanding + + + + 199 + 20 + + + + + + + + TabPage + + + &Geometry + + + + unnamed + + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + rule_size + + + false + + + + + size + + + false + + + 0123456789-+,xX: + + + + + enable_size + + + &Size + + + + + enable_position + + + &Position + + + + + position + + + false + + + 0123456789-+,xX: + + + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + rule_position + + + false + + + + + maximizevert + + + false + + + + + + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + rule_maximizehoriz + + + false + + + + + fullscreen + + + false + + + + + + + + enable_maximizehoriz + + + Maximized &horizontally + + + + + maximizehoriz + + + false + + + + + + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + rule_fullscreen + + + false + + + + + enable_fullscreen + + + &Fullscreen + + + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + rule_maximizevert + + + false + + + + + enable_maximizevert + + + Maximized &vertically + + + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + rule_desktop + + + false + + + + + desktop + + + false + + + + + enable_desktop + + + &Desktop + + + + + enable_shade + + + Sh&aded + + + + + shade + + + false + + + + + + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + rule_minimize + + + false + + + + + minimize + + + false + + + + + + + + enable_minimize + + + M&inimized + + + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + rule_placement + + + false + + + + + + Default + + + + + No Placement + + + + + Smart + + + + + Maximizing + + + + + Cascade + + + + + Centered + + + + + Random + + + + + Top-Left Corner + + + + + Under Mouse + + + + + On Main Window + + + + placement + + + false + + + + + enable_placement + + + P&lacement + + + + + spacer31 + + + Vertical + + + Expanding + + + + 20 + 16 + + + + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + rule_shade + + + false + + + + + + + TabPage + + + &Preferences + + + + unnamed + + + + enable_above + + + Keep &above + + + + + enable_below + + + Keep &below + + + + + enable_skippager + + + Skip pa&ger + + + + + enable_skiptaskbar + + + Skip &taskbar + + + + + enable_noborder + + + &No border + + + + + enable_acceptfocus + + + Accept &focus + + + + + enable_closeable + + + &Closeable + + + + + enable_opacityactive + + + A&ctive opacity in % + + + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + rule_opacityactive + + + false + + + + + opacityactive + + + false + + + 0123456789 + + + + + spacer24 + + + Horizontal + + + Expanding + + + + 171 + 20 + + + + + + spacer36_7 + + + Horizontal + + + Expanding + + + + 290 + 20 + + + + + + spacer36_6 + + + Horizontal + + + Expanding + + + + 290 + 20 + + + + + + spacer36_5 + + + Horizontal + + + Expanding + + + + 290 + 20 + + + + + + spacer36_4 + + + Horizontal + + + Expanding + + + + 290 + 20 + + + + + + spacer36_3 + + + Horizontal + + + Expanding + + + + 290 + 20 + + + + + + spacer36_2 + + + Horizontal + + + Expanding + + + + 290 + 20 + + + + + + spacer36 + + + Horizontal + + + Expanding + + + + 290 + 20 + + + + + + above + + + false + + + + + + + + below + + + false + + + + + + + + noborder + + + false + + + + + + + + skiptaskbar + + + false + + + + + + + + skippager + + + false + + + + + + + + acceptfocus + + + false + + + + + + + + closeable + + + false + + + + + + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + rule_closeable + + + false + + + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + rule_acceptfocus + + + false + + + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + rule_skippager + + + false + + + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + rule_skiptaskbar + + + false + + + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + rule_noborder + + + false + + + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + rule_below + + + false + + + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + rule_above + + + false + + + + + spacer33 + + + Vertical + + + Expanding + + + + 20 + 80 + + + + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + rule_opacityinactive + + + false + + + + + opacityinactive + + + false + + + 0123456789 + + + + + spacer25 + + + Horizontal + + + Expanding + + + + 181 + 20 + + + + + + enable_opacityinactive + + + I&nactive opacity in % + + + + + enable_shortcut + + + Shortcut + + + + + + + + + Do Not Affect + + + + + Apply Initially + + + + + Remember + + + + + Force + + + + + Apply Now + + + + + Force Temporarily + + + + rule_shortcut + + + false + + + + + shortcut_edit + + + Edit... + + + + + shortcut + + + false + + + + + + + TabPage + + + W&orkarounds + + + + unnamed + + + + enable_fsplevel + + + &Focus stealing prevention + + + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + rule_type + + + false + + + + + + Normal Window + + + + + Dialog Window + + + + + Utility Window + + + + + Dock (panel) + + + + + Toolbar + + + + + Torn-Off Menu + + + + + Splash Screen + + + + + Desktop + + + + + Override Type + + + + + Standalone Menubar + + + + type + + + false + + + + + + Opaque + + + + + Transparent + + + + moveresizemode + + + false + + + + + enable_type + + + Window &type + + + + + enable_moveresizemode + + + &Moving/resizing + + + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + rule_fsplevel + + + false + + + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + rule_moveresizemode + + + false + + + + + + None + + + + + Low + + + + + Normal + + + + + High + + + + + Extreme + + + + fsplevel + + + false + + + + + maxsize + + + false + + + 0123456789-+,xX: + + + + + enable_minsize + + + M&inimum size + + + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + rule_minsize + + + false + + + + + enable_maxsize + + + M&aximum size + + + + + minsize + + + false + + + 0123456789-+,xX: + + + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + rule_maxsize + + + false + + + + + enable_ignoreposition + + + Ignore requested &geometry + + + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + rule_ignoreposition + + + false + + + + + ignoreposition + + + false + + + + + + + + spacer35 + + + Vertical + + + Expanding + + + + 20 + 160 + + + + + + enable_strictgeometry + + + Strictly obey geometry + + + + + + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + rule_strictgeometry + + + false + + + + + strictgeometry + + + false + + + + + + + + disableglobalshortcuts + + + false + + + + + + + + enable_disableglobalshortcuts + + + Block global shortcuts + + + + + + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + rule_disableglobalshortcuts + + + false + + + + + + + + + + + + detect1 + clicked() + Form2 + detectClicked() + + + wmclass_match + activated(int) + Form2 + wmclassMatchChanged() + + + role_match + activated(int) + Form2 + roleMatchChanged() + + + title_match + activated(int) + Form2 + titleMatchChanged() + + + extra_match + activated(int) + Form2 + extraMatchChanged() + + + machine_match + activated(int) + Form2 + machineMatchChanged() + + + shortcut_edit + clicked() + Form2 + shortcutEditClicked() + + + + tabs + description + wmclass + whole_wmclass + wmclass_match + edit_reg_wmclass + role + role_match + edit_reg_role + detect1 + types + title + title_match + edit_reg_title + extra + extra_match + edit_reg_extra + machine + machine_match + edit_reg_machine + enable_position + rule_position + position + enable_size + rule_size + size + enable_maximizehoriz + rule_maximizehoriz + maximizehoriz + enable_maximizevert + rule_maximizevert + maximizevert + enable_fullscreen + rule_fullscreen + fullscreen + enable_desktop + rule_desktop + desktop + enable_minimize + rule_minimize + minimize + enable_shade + rule_shade + shade + enable_placement + rule_placement + placement + enable_above + rule_above + above + enable_below + rule_below + below + enable_noborder + rule_noborder + noborder + enable_skiptaskbar + rule_skiptaskbar + skiptaskbar + enable_skippager + rule_skippager + skippager + enable_acceptfocus + rule_acceptfocus + acceptfocus + enable_closeable + rule_closeable + closeable + enable_opacityactive + rule_opacityactive + opacityactive + enable_opacityinactive + rule_opacityinactive + opacityinactive + enable_shortcut + rule_shortcut + shortcut + shortcut_edit + enable_fsplevel + rule_fsplevel + fsplevel + enable_moveresizemode + rule_moveresizemode + moveresizemode + enable_type + rule_type + type + enable_ignoreposition + rule_ignoreposition + ignoreposition + enable_minsize + rule_minsize + minsize + enable_maxsize + rule_maxsize + maxsize + enable_strictgeometry + rule_strictgeometry + strictgeometry + enable_disableglobalshortcuts + rule_disableglobalshortcuts + disableglobalshortcuts + + + detectClicked() + wmclassMatchChanged() + roleMatchChanged() + titleMatchChanged() + extraMatchChanged() + machineMatchChanged() + shortcutEditClicked() + + + + + kcombobox.h + kpushbutton.h + kcombobox.h + kpushbutton.h + kpushbutton.h + klistbox.h + kcombobox.h + kpushbutton.h + kcombobox.h + kpushbutton.h + kcombobox.h + kpushbutton.h + kcombobox.h + krestrictedline.h + krestrictedline.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + krestrictedline.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + krestrictedline.h + kcombobox.h + krestrictedline.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + krestrictedline.h + kcombobox.h + krestrictedline.h + kcombobox.h + kcombobox.h + kcombobox.h + kcombobox.h + + diff --git a/twin/kcmtwin/twinrules/twinrules.desktop b/twin/kcmtwin/twinrules/twinrules.desktop new file mode 100644 index 000000000..9d82ea38a --- /dev/null +++ b/twin/kcmtwin/twinrules/twinrules.desktop @@ -0,0 +1,209 @@ +[Desktop Entry] +Icon=kcmkwm +Type=Application +Exec=kcmshell twinrules +DocPath=kcontrol/windowmanagement/index.html + +X-KDE-ModuleType=Library +X-KDE-Library=twinrules +X-KDE-FactoryName=twinrules + +Name=Window-Specific Settings +Name[af]=Venser spesifike Instellings +Name[ar]=تعيينات خاصة بالنوافذ +Name[be]=Настаўленні для асобных вокнаў +Name[bg]=Специфични прозорци +Name[bn]=উইণ্ডো-প্রতি সেটিংস +Name[bs]=Postavke specifične za ovaj prozor +Name[ca]=Arranjament específic de finestra +Name[cs]=Specifická nastavení oken +Name[csb]=Nastôw specyficzny dlô òkna +Name[cy]=Gosodiadau sy'n Benodol i'r Ffenestr +Name[da]=Vinduesspecifik opsætning +Name[de]=Fensterspezifische Einstellungen +Name[el]=Ρυθμίσεις σχετικές με παράθυρα +Name[eo]=Apartafenestraj Agordoj +Name[es]=Preferencias específicas de la ventana +Name[et]=Akende seadistused +Name[eu]=Leihoen ezarpen espezifikoak +Name[fa]=تنظیمات مشخص پنجره +Name[fi]=Ikkunakohtaiset asetukset +Name[fr]=Paramètres spécifiques à la fenêtre +Name[fy]=Finsterspesifike ynstellings +Name[gl]=Opcións específicas da fiestra +Name[he]=הגדרות חלונות ספציפיות +Name[hi]=विशिष्ट-विंडो विन्यास +Name[hr]=Postavke za prozor +Name[hu]=Egyedi ablakbeállítások +Name[is]=Stillingar einstakra glugga +Name[it]=Impostazioni specifiche della finestra +Name[ja]=ウィンドウ固有の設定 +Name[ka]=ფანჯრის განსაკუთრებული პარამეტრები +Name[kk]=Терезенің ерекше параметрлері +Name[km]=ការ​កំណត់​សម្រាប់​បង្អួច +Name[ko]=창 지정 +Name[lt]=Nuo lango priklausantys nustatymai +Name[lv]=Specifiski logu parametri +Name[mk]=Поставувања по прозорец +Name[nb]=Innstillinger for vinduer +Name[nds]=Instellen för enkelte Finstern +Name[ne]=सञ्झ्याल निर्दिष्ट सेटिङ +Name[nl]=Vensterspecifieke instellingen +Name[nn]=Instillingar for vindauge +Name[pa]=ਝਰੋਖਾ-ਖਾਸ ਸਥਾਪਨ +Name[pl]=Ustawienia danego okna +Name[pt]=Opções Específicas da Janela +Name[pt_BR]=Configurações Específicas da Janela +Name[ro]=Setări specifice fereastră +Name[ru]=Особые параметры окна +Name[rw]=Amagenamiterere y'Idirishya-Ryihariye +Name[se]=Láseheivehusat +Name[sk]=Špecifické nastavenia okna +Name[sl]=Nastavitve glede na okno +Name[sr]=Посебне поставке за прозоре +Name[sr@Latn]=Posebne postavke za prozore +Name[sv]=Fönsterspecifika inställningar +Name[ta]=சாளர-குறிப்பிடும் அமைப்புகள் +Name[th]=ตั้งค่าเกี่ยวกับหน้าต่างโดยเฉพาะ +Name[tr]=Pencereye Özel Seçenekler +Name[tt]=Täräzägä-Bäyle Caylawlar +Name[uk]=Параметри для окремих вікон +Name[uz]=Oynaga oid moslamalar +Name[uz@cyrillic]=Ойнага оид мосламалар +Name[vi]=Thiết lập Danh riêng cho Cửa sổ +Name[wa]=Apontiaedjes specifikes a-z on purnea +Name[zh_CN]=特定窗口的设置 +Name[zh_TW]=特定視窗設定 + +Comment=Configure settings specifically for a window +Comment[af]=Stel spesifieke venster instellings op +Comment[ar]=إعداد التعيينات الخاصة بنافذة +Comment[be]=Настаўленні для кожнага вакна асабіста +Comment[bg]=Настройване на специфични особености за отделните прозорци +Comment[bn]=শুধুমাত্র এই বিশেষ উইণ্ডো-টির সেটিংস কনফিগার করুন +Comment[bs]=Podesite postavke specifične za ovaj prozor +Comment[ca]=Configura l'arranjament específicament per a una finestra +Comment[cs]=Nastavení specifická pro okno +Comment[csb]=Kònfigùracëjô nastôwów specyficznëch dlô wëbrónegò òkna +Comment[cy]=Ffurfweddu gosodiadau yn benodol ar gyfer ffenestr +Comment[da]=Indstil opsætning specifikt for et vindue +Comment[de]=Einstellungen für einzelne Fenster vornehmen +Comment[el]=Ρυθμίσεις σχετικές ειδικά με Ένα Παράθυρο +Comment[eo]=Agordi nur por tiu fenestro +Comment[es]=Configurar parámetros específicos de una ventana +Comment[et]=Spetsiaalselt akendega seotud seadistused +Comment[eu]=Konfiguratu leiho jakin baten ezarpenak +Comment[fa]=پیکربندی تنظیمات برای پنجره به طور ‌ویژه +Comment[fi]=Muokkaa ikkunakohtaisia asetuksia +Comment[fr]=Configuration de paramètres spécifiques à une fenêtre +Comment[fy]=Hjir kinne jo ynstellings kieze spesifyk foar ien finster +Comment[ga]=Cumraigh na socruithe le haghaidh fuinneoige ar leith +Comment[gl]=Configuración das opcións específicas para unha fiestra +Comment[he]=קבע הגדרות לחלון מסוים +Comment[hi]=किसी खास विंडो के लिए विन्यास कॉन्फ़िगर करें +Comment[hr]=Konfiguriranje određenih postavki za prozor +Comment[hu]=Egy adott ablak beállításai +Comment[is]=Stillingar sem varða tiltekinn glugga +Comment[it]=Configura le impostazioni specifiche di una finestra +Comment[ja]=特定のウィンドウに固有の設定を行います +Comment[ka]=ფანჯრის განსაკუთრებული პარამეტრების კონფიგურაცია +Comment[kk]=Терезенің ерекше параметрлерін баптау +Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​ការ​កំណត់​ពិសេស​សម្រាប់​បង្អួច​មួយ +Comment[ko]=창마다의 개별 설정 +Comment[lt]=Čia galite konfigūruoti konkretaus lango nustatymus +Comment[lv]=Konfigurē parametrus priekš speciāla loga +Comment[mk]=Конфигурирајте ги поставувањата за поодделни прозорци +Comment[mt]=Ikkonfigura setings li jistgħu itejbu l-veloċità ta' KDE +Comment[nb]=Innstillinger som er knyttet til et spesielt vindu +Comment[nds]=Instellen för enkelte Finstern +Comment[ne]=सञ्झ्यालका लागि निर्दिष्ट तरिकाले सेटिङ कन्फिगर गर्नुहोस् +Comment[nl]=Hier kunt u instellingen kiezen specifiek voor één venster +Comment[nn]=Innstillingar som er knytte til eitt særskilt vindauge +Comment[pa]=ਇੱਕ ਝਰੋਖੇ ਲਈ ਖਾਸ ਸਥਾਪਨ ਸੰਰਚਨਾ +Comment[pl]=Konfiguracja ustawień wybranego okna +Comment[pt]=Configura as opções especificamente para uma janela +Comment[pt_BR]=Configurações específicas para uma janela +Comment[ro]=Configurează setări specifice anumitor ferestre +Comment[ru]=Настройка особых параметров окна +Comment[rw]=Kuboneza Amagenamiterere mu buryo bwihariye bw'idirishya +Comment[se]=Heivehusat erenoamáš láse várás +Comment[sk]=Nastavenie pre jednotlivé okná +Comment[sl]=Nastavite možnosti glede na posamezno okno +Comment[sr]=Подешавање поставки посебно за прозор +Comment[sr@Latn]=Podešavanje postavki posebno za prozor +Comment[sv]=Anpassa inställningar specifikt för ett fönster +Comment[ta]=KDE செயல்திறனை அதிகப்படுத்தும் அமைப்புகளை அமை +Comment[th]=ปรับแต่งค่าต่างๆ ที่เกี่ยวกับหน้าต่างโดยเฉพาะ +Comment[tr]=Bir pencere için özel olan seçenekleri yapılandır +Comment[tt]=Täräzä öçen ayırım caylawlar +Comment[uk]=Налаштування параметрів для окремого типу вікон +Comment[uz]=Oynaga oid boʻlgan moslamalarni moslash +Comment[uz@cyrillic]=Ойнага оид бўлган мосламаларни мослаш +Comment[vi]=Thiết lập cài đặt dành riêng cho cửa sổ +Comment[wa]=Apontiaedjes specifikes po-z on purnea +Comment[zh_CN]=配置一个窗口的设置 +Comment[zh_TW]=設定特定視窗設定值 + +Keywords=size,position,state,window behavior,windows,specific,workarounds,remember,rules +Keywords[ar]=القياس,الموضع,الحالة,سلوك النافذة,نوافذ,خاص,تدكر,قواعد,معاملات +Keywords[be]=Памер,Пазіцыя,Стан,Паводзіны акна,Вокны,Акно,Спецыфічныя,Запомніць,Правілы,size,position,state,window behavior,windows,specific,workarounds,remember,rules +Keywords[bg]=размер, позиция, състояние, прозорец, поведение,правила, запомняне,size,position,state,window behavior,windows,specific,workarounds,remember,rules +Keywords[bs]=size,position,state,window behavior,windows,specific,workarounds,remember,rules,veličina,položaj,ponašanje prozora,prozori,specifično,pravila +Keywords[ca]=mida,posició,estat,comportament de finestra,finestres,específic,reparacions,recorda,regles +Keywords[cs]=velikost,pozice,umístění,stav,chování oken,pravidla +Keywords[csb]=miara,pòłożenié,stón,ùchòwanié òknół,òkna,spamiãtanié nastôwów,zapamiãtanié nastôwów,regle +Keywords[cy]=maint,lleoliad,cyflwr,ffenestr,ymddygiad,ffenestri,penodol,ffyrdd osgoi,cofio,rheolau +Keywords[da]=størrelse,position,tilstand,vinduesopførsel,vinduer,specifik, omgåelse,husk,regler +Keywords[de]=Größe,Position,Status,Fensterverhalten,Fenster,Regeln +Keywords[el]=μέγεθος,θέση,κατάσταση,συμπεριφορά παραθύρου,παράθυρα,ειδικές,λύσεις,αποθήκευση,κανόνων +Keywords[en_GB]=size,position,state,window behaviour,windows,specific,workarounds,remember,rules +Keywords[eo]=grandeco,pozicio,stato,fenestra konduto,fenestroj,reguloj +Keywords[es]=tamaño,posición,estado,comportamiento de la ventana,ventanas,específico,soluciones,recordar,reglas +Keywords[et]=suurus,asend,olek,akna käitumine,aknad,spetsiaalne,kohandamine,reeglid +Keywords[eu]=neurria,kokapena,egoera,leihoaren portaera,leihoak,espezifikoa,konponbideak,gogoratu,arauak +Keywords[fa]=اندازه، موقعیت، وضعیت، رفتار پنجره، پنجره‌ها، مشخص، workarounds، یادآوری، قواعد +Keywords[fi]=koko,sijainti,tila,ikkunan käyttäytyminen,ikkunat,ikkunakohtainen,säännöt +Keywords[fr]=taille,position,état,comportement de fenêtre,fenêtres,spécifique,astuces,souvenir,règles +Keywords[fy]=grootte,grutte,positie,posysje,venstergedrag,finstergedrach,vensters,finsters,specifiek,spesifyk,alternatieven,alternativen,onthouden,ûnthâlde,regels +Keywords[ga]=méid,ionad,staid,oibriú na bhfuinneog,fuinneoga,sainiúil,réitigh seiftithe,meabhraigh,rialacha +Keywords[gl]=tamaño,posición,estado,comportamento da fiestra,fiestras,específico,lembrar,reglas +Keywords[he]=גודל, מיקום, מצב, חלון, התנהגות, חלונות, אישית, זכור, חוקים, size,position,state,window behavior,windows,specific,workarounds,remember,rules +Keywords[hi]=आकार,स्थान,स्थिति,विंडो व्यवहार,विंडोज़,विशिष्ट,कार्य-विकल्प,याददाश्त,नियम +Keywords[hr]=size,position,state,window behavior,windows,specific,workarounds,remember,rules,veličina,položaj,smještaj,stanje,ponašanje prozora,prozori,rješenja,zapamti,upamti,pravila +Keywords[hu]=méret,pozíció,állapot,ablakműködés,ablakok,specifikus,megjegyzés,szabályok +Keywords[id]=ukuran,posisi,status,perilaku jendela,jendela, spesifik,solusi,remember,aturan +Keywords[it]=dimensione,posizione,stato,comportamento finestra,finestre,specifico,ricorda,regole +Keywords[ja]=サイズ,位置,状態,ウィンドウの挙動,windows,特定,ワークアラウンド,記憶,ルール +Keywords[km]=ទំហំ,ទីតាំង,សភាព,ឥរិយាបថ​បង្អួច បង្អួចs ជាក់លាក់c ចងចាំr ច្បាប់s +Keywords[lt]=size,position,state,window behavior,windows,specific,workarounds,remember,rules,dydis,pozicija,būsena,lango eelgesys,langai,atsiminti,taisyklės +Keywords[lv]=izmērs,novietojums,statuss,loga izturēšanās,logi,specifisks,apjājiens,atcerēties,noteikumi +Keywords[mk]=size,position,state,window behavior,windows,specific,workarounds,remember,rules,големина,позиција,состојба,однесување на прозорец,специфично,заобиколни +Keywords[mt]=size,position,state,window behavior,windows,specific,workarounds,remember,rules,daqs +Keywords[nb]=størrelse,posisjon,status,vindusoppførsel,vinduer,spesifikk,jukseløsninger,husk,regler +Keywords[nds]=Grött,Positschoon,Status,Finsterbedregen,Finstern,enkel,enkelte,Regeln,behollen,workaround +Keywords[ne]=साइज, स्थिति, अवस्था, सञ्झ्याल व्यवहार, सञ्झ्यालहरू, निर्दिष्ट, कार्यक्षेत्र, याद गर्नुहोस्, नियम +Keywords[nl]=grootte,positie,venstergedrag,vensters,specifiek,alternatieven,onthouden,regels +Keywords[nn]=storleik,plassering,tilstand,vindaugsåtferd,vindauge,spesifikk,jukseløysingar,hugs,reglar +Keywords[pa]=ਅਕਾਰ,ਸਥਿਤੀ,ਝਰੋਖਾ ਵਿਵਹਾਰ,ਝਰੋਖੇ,ਖਾਸ,ਯਾਦ ਰੱਖੋ,ਨਿਯਮ +Keywords[pl]=rozmiar,położenie,stan,zachowanie okien,okna,zapamiętywanie ustawień,reguły +Keywords[pt]=tamanho,posição,estado,comportamento da janela,janelas,específico,recordar,regras +Keywords[pt_BR]=tamanho,posição, estado, comportamento da janela, janelas, específica, elementos, lembrar, regras +Keywords[ro]=mărime,poziție,stare,comportament fereastră,ferestre,specific,reguli +Keywords[rw]=Ingano,Ibirindiro,leta, imyitwarire y'idirishya,amadirishya,byihariye, amakorahafi,kwibuka,amategeko +Keywords[se]=sturrodat,sajádat,dilli,láseláhtten,láset,erenoamáš,fillenčovdosat,muitte,njuolggadusat +Keywords[sk]=veľkosť,pozícia,stav,správanie okna,okná,špecifické,jedno okno,opravy,pravidlá +Keywords[sl]=velikost,položaj,stanje,obnašanje okna,okna,posebno,obvoz,zapomni,pravila +Keywords[sr]=величина,позиција,стање,понашање прозора,прозори,запамти,правила +Keywords[sr@Latn]=veličina,pozicija,stanje,ponašanje prozora,prozori,zapamti,pravila +Keywords[sv]=storlek,position,tillstånd,fönsterbeteende,fönster,specifik,komma runt,komma ihåg,regler +Keywords[ta]=அளவு,நிலை,மாநிலம்,சாளர நடத்தை,சாளரங்கள்,குறிப்பிட்ட,பணிவட்டாரங்கள்,விதிகள் +Keywords[th]=ขนาด,ตำแหน่ง,สถานะ,พฤติกรรมหน้าต่าง,หน้าต่าง,โดยเฉพาะ,หารอบๆ,จำ,กฎ +Keywords[tr]=boyut,yer,pozisyon,durum,pencere davranışı,pencereler,özel,çalışma alanı,hatırla,kurallar +Keywords[uk]=розмір,позиція,стан,поведінка вікна,вікна,окремі,підігнати,запам'ятати,правила +Keywords[uz]=oʻlcham,joy,holat,oynaning xususiyatlari,oynalar,maxsus,eslab qolish,qoidalar +Keywords[uz@cyrillic]=ўлчам,жой,ҳолат,ойнанинг хусусиятлари,ойналар,махсус,эслаб қолиш,қоидалар +Keywords[vi]=kích cỡ,vị trí,trạng thái,ứng xử cửa sổ,cửa sổ,dành riêng,cách chữa chạy,nhớ,quy tắc +Keywords[wa]=grandeu,plaece,estat,estance,dujhance des purneas,purneas,specifike,workarounds,remember,rîles,sovni,sovnance +Keywords[zh_CN]=size,position,state,window behavior,windows,specific,workarounds,remember,rules,大小,位置,状态,窗口行为,窗口,特定,工作区,记住,规则 +Keywords[zh_TW]=size,position,state,window behavior,windows,specific,workarounds,remember,rules,大小,位置,狀態,視窗行為,視窗,指定,記憶,規則 +Categories=Qt;KDE;X-KDE-settings-desktop; diff --git a/twin/kcmtwin/twinrules/twinsrc.cpp b/twin/kcmtwin/twinrules/twinsrc.cpp new file mode 100644 index 000000000..fb901efb6 --- /dev/null +++ b/twin/kcmtwin/twinrules/twinsrc.cpp @@ -0,0 +1,8 @@ +// Include some code from twin core in order to avoid +// double implementation. + +#include "ruleslist.h" +#include "../../rules.cpp" +#include "../../placement.cpp" +#include "../../options.cpp" +#include "../../utils.cpp" -- cgit v1.2.1