diff options
Diffstat (limited to 'khotkeys/kcontrol')
85 files changed, 10850 insertions, 0 deletions
diff --git a/khotkeys/kcontrol/CMakeLists.txt b/khotkeys/kcontrol/CMakeLists.txt new file mode 100644 index 000000000..73f295447 --- /dev/null +++ b/khotkeys/kcontrol/CMakeLists.txt @@ -0,0 +1,58 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( ui ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/ui + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/khotkeys/shared + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +tde_install_icons( khotkeys ) +install( FILES khotkeys.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) + + +##### kcm_khotkeys (module) ##################### + +tde_add_kpart( kcm_khotkeys AUTOMOC + SOURCES + menuedit.cpp window_trigger_widget.cpp tab_widget.cpp main_buttons_widget.cpp + actions_listview_widget.cpp menuentry_widget.cpp general_tab.cpp + action_group_tab.cpp kcmkhotkeys.cpp command_url_widget.cpp windowdef_list_widget.cpp + windowdef_simple_widget.cpp triggers_tab.cpp dcop_widget.cpp info_tab.cpp + action_list_widget.cpp keyboard_input_widget.cpp condition_list_widget.cpp + gesturedrawer.cpp gesturerecorder.cpp gesturerecordpage.cpp gesture_triggers_tab.cpp + windowselector.cpp gestures_settings_tab.cpp general_settings_tab.cpp + voicerecorder.cpp voicerecordpage.cpp voice_settings_tab.cpp + LINK ui-static + DESTINATION ${PLUGIN_INSTALL_DIR} +) + + +##### kcm_khotkeys_init (module) ################ + +tde_add_kpart( kcm_khotkeys_init AUTOMOC + SOURCES init.cpp + LINK tdecore-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/khotkeys/kcontrol/Makefile.am b/khotkeys/kcontrol/Makefile.am new file mode 100644 index 000000000..7eb3f2f6d --- /dev/null +++ b/khotkeys/kcontrol/Makefile.am @@ -0,0 +1,40 @@ +SUBDIRS = ui + +kde_module_LTLIBRARIES = kcm_khotkeys.la kcm_khotkeys_init.la + +kcm_khotkeys_la_SOURCES = \ + menuedit.cpp window_trigger_widget.cpp tab_widget.cpp main_buttons_widget.cpp \ + actions_listview_widget.cpp menuentry_widget.cpp general_tab.cpp \ + action_group_tab.cpp kcmkhotkeys.cpp command_url_widget.cpp windowdef_list_widget.cpp \ + windowdef_simple_widget.cpp triggers_tab.cpp dcop_widget.cpp info_tab.cpp \ + action_list_widget.cpp keyboard_input_widget.cpp condition_list_widget.cpp \ + gesturedrawer.cpp gesturerecorder.cpp gesturerecordpage.cpp gesture_triggers_tab.cpp \ + windowselector.cpp gestures_settings_tab.cpp general_settings_tab.cpp \ + voicerecorder.cpp voicerecordpage.cpp voice_settings_tab.cpp + +kcm_khotkeys_la_LIBADD = ui/libui.la $(LIB_TDEUI) $(LIB_ARTS) +kcm_khotkeys_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined + +kcm_khotkeys_init_la_SOURCES = init.cpp + +kcm_khotkeys_init_la_LIBADD = $(LIB_TDECORE) +kcm_khotkeys_init_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined + +noinst_HEADERS = menuedit.h window_trigger_widget.h \ + tab_widget.h main_buttons_widget.h actions_listview_widget.h menuentry_widget.h \ + general_tab.h action_group_tab.h kcmkhotkeys.h windowdef_list_widget.h \ + command_url_widget.h windowdef_simple_widget.h triggers_tab.h dcop_widget.h info_tab.h \ + action_list_widget.h keyboard_input_widget.h condition_list_widget.h \ + activate_window_widget.h \ + gesturedrawer.h gesturerecorder.h gesturerecordpage.h gesture_triggers_tab.h \ + windowselector.h gestures_settings_tab.h general_settings_tab.h \ + voicerecorder.h voicerecordpage.h voice_settings_tab.h + + +INCLUDES= -I$(top_srcdir)/khotkeys/shared -I$(srcdir)/ui -I./ui $(all_includes) + +METASOURCES = AUTO + +xdg_apps_DATA = khotkeys.desktop + +KDE_ICON = khotkeys diff --git a/khotkeys/kcontrol/action_group_tab.cpp b/khotkeys/kcontrol/action_group_tab.cpp new file mode 100644 index 000000000..1bdeffd75 --- /dev/null +++ b/khotkeys/kcontrol/action_group_tab.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _ACTION_GROUP_TAB_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "action_group_tab.h" + +#include <tqlineedit.h> +#include <tqcheckbox.h> + +#include <tdelocale.h> +#include <tdemessagebox.h> +#include <ktextedit.h> + +#include <actions.h> +#include <action_data.h> + +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +Action_group_tab::Action_group_tab( TQWidget* parent_P , const char* name_P ) + : Action_group_tab_ui( parent_P, name_P ) + { + clear_data(); + // KHotKeys::Module::changed() + connect( action_name_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + connect( disable_checkbox, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( comment_multilineedit, TQT_SIGNAL( textChanged()), + module, TQT_SLOT( changed())); + } + +void Action_group_tab::clear_data() + { + disconnect( action_name_lineedit, TQT_SIGNAL( textChanged( const TQString& )), this, + TQT_SLOT( action_group_name_changed( const TQString& ))); + action_name_lineedit->clear(); + action_name_lineedit->setReadOnly( false ); + disable_checkbox->setChecked( false ); + disable_checkbox->setText( i18n( "&Disable" )); + comment_multilineedit->clear(); + system_group = Action_data_group::SYSTEM_NONE; + } + +void Action_group_tab::set_data( const Action_data_group* data_P ) + { + if( data_P == NULL ) + { + clear_data(); + return; + } + action_name_lineedit->setText( data_P->name()); + action_name_lineedit->setReadOnly( data_P->is_system_group()); + disable_checkbox->setChecked( !data_P->enabled( true )); + if( !data_P->parent()->enabled( false )) + disable_checkbox->setText( i18n( "&Disable (group is disabled)" )); + else + disable_checkbox->setText( i18n( "&Disable" )); + comment_multilineedit->setText( data_P->comment()); + connect( action_name_lineedit, TQT_SIGNAL( textChanged( const TQString& )), this, + TQT_SLOT( action_group_name_changed( const TQString& ))); + system_group = data_P->system_group(); + } + +Action_data_group* Action_group_tab::get_data( Action_data_group* parent_P, + Condition_list* conditions_P ) const + { + TQString name = action_name_lineedit->text(); + return new Action_data_group( parent_P, name, comment_multilineedit->text(), conditions_P, + system_group, !disable_checkbox->isChecked()); + } + +void Action_group_tab::action_group_name_changed( const TQString& name_P ) + { + module->action_name_changed( name_P ); + } + +} // namespace KHotKeys + +#include "action_group_tab.moc" diff --git a/khotkeys/kcontrol/action_group_tab.h b/khotkeys/kcontrol/action_group_tab.h new file mode 100644 index 000000000..970f16379 --- /dev/null +++ b/khotkeys/kcontrol/action_group_tab.h @@ -0,0 +1,46 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _ACTION_GROUP_TAB_H_ +#define _ACTION_GROUP_TAB_H_ + +#include <action_group_tab_ui.h> +#include <action_data.h> + +namespace KHotKeys +{ + +class Action_data_group; +class Windowdef_list; + +class Action_group_tab + : public Action_group_tab_ui + { + Q_OBJECT + public: + Action_group_tab( TQWidget* parent_P = NULL, const char* name_P = NULL ); + void set_data( const Action_data_group* data_P ); + Action_data_group* get_data( Action_data_group* parent_P, + Condition_list* conditions_P ) const; + public slots: + void clear_data(); + protected slots: + virtual void action_group_name_changed( const TQString& name_P ); + protected: + Action_data_group::system_group_t system_group; + }; + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/action_list_widget.cpp b/khotkeys/kcontrol/action_list_widget.cpp new file mode 100644 index 000000000..79744a09e --- /dev/null +++ b/khotkeys/kcontrol/action_list_widget.cpp @@ -0,0 +1,354 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _ACTION_LIST_WIDGET_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "action_list_widget.h" + +#include <assert.h> +#include <tqpopupmenu.h> +#include <tqpushbutton.h> +#include <tqheader.h> +#include <tqlineedit.h> + +#include <tdelocale.h> +#include <kdebug.h> + +#include <khlistview.h> + +#include "command_url_widget.h" +#include "menuentry_widget.h" +#include "dcop_widget.h" +#include "keyboard_input_widget.h" +#include "activate_window_widget.h" +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +// Action_list_widget + +Action_list_widget::Action_list_widget( TQWidget* parent_P, const char* name_P ) + : Action_list_widget_ui( parent_P, name_P ), selected_item( NULL ) + { + TQPopupMenu* popup = new TQPopupMenu; // CHECKME looks like setting parent doesn't work + popup->insertItem( i18n( "Command/URL..." ), TYPE_COMMAND_URL_ACTION ); + popup->insertItem( i18n( "TDE Menu Entry..." ), TYPE_MENUENTRY_ACTION ); + popup->insertItem( i18n( "DCOP Call..." ), TYPE_DCOP_ACTION ); + popup->insertItem( i18n( "Keyboard Input..." ), TYPE_KEYBOARD_INPUT_ACTION ); + popup->insertItem( i18n( "Activate Window..." ), TYPE_ACTIVATE_WINDOW_ACTION ); + connect( popup, TQT_SIGNAL( activated( int )), TQT_SLOT( new_selected( int ))); + new_button->setPopup( popup ); + actions_listview->header()->hide(); + actions_listview->addColumn( "" ); + actions_listview->setSorting( -1 ); + actions_listview->setForceSelect( true ); + copy_button->setEnabled( false ); + modify_button->setEnabled( false ); + delete_button->setEnabled( false ); + clear_data(); + connect( actions_listview, TQT_SIGNAL( doubleClicked ( TQListViewItem *, const TQPoint &, int ) ), + this, TQT_SLOT( modify_pressed() ) ); + + // KHotKeys::Module::changed() + connect( new_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( copy_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( modify_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( delete_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( comment_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + } + +Action_list_widget::~Action_list_widget() + { + delete new_button->popup(); + } + +void Action_list_widget::clear_data() + { + comment_lineedit->clear(); + actions_listview->clear(); + } + +void Action_list_widget::set_data( const Action_list* data_P ) + { + if( data_P == NULL ) + { + clear_data(); + return; + } + comment_lineedit->setText( data_P->comment()); + Action_list_item* after = NULL; + actions_listview->clear(); + for( Action_list::Iterator it( *data_P ); + *it; + ++it ) + after = create_listview_item( *it, actions_listview, NULL, after, true ); + } + +Action_list* Action_list_widget::get_data( Action_data* data_P ) const + { +// CHECKME TODO hmm, tady to bude chtit asi i children :( + Action_list* list = new Action_list( comment_lineedit->text()); + for( TQListViewItem* pos = actions_listview->firstChild(); + pos != NULL; + pos = pos->nextSibling()) + list->append( static_cast< Action_list_item* >( pos )->action()->copy( data_P )); + return list; + } + +void Action_list_widget::new_selected( int type_P ) + { + Action_dialog* dlg = NULL; + switch( type_P ) + { + case TYPE_COMMAND_URL_ACTION: // Command_url_action_dialog + dlg = new Command_url_action_dialog( NULL ); + break; + case TYPE_MENUENTRY_ACTION: // Menuentry_action_dialog + dlg = new Menuentry_action_dialog( NULL ); + break; + case TYPE_DCOP_ACTION: // Dcop_action_dialog + dlg = new Dcop_action_dialog( NULL ); + break; + case TYPE_KEYBOARD_INPUT_ACTION: // Keyboard_input_action_dialog + dlg = new Keyboard_input_action_dialog( NULL ); + break; + case TYPE_ACTIVATE_WINDOW_ACTION: // Activate_window_action_dialog + dlg = new Activate_window_action_dialog( NULL ); + break; + default: + assert( false ); + } + if( dlg != NULL ) + { + Action* action = dlg->edit_action(); + if( action != NULL ) + actions_listview->setSelected( create_listview_item( action, actions_listview, + NULL, selected_item, false ), true ); + // CHECKME tady pak jeste spravne vnoreni, kdyz bude skupina + delete dlg; + } + } + +void Action_list_widget::copy_pressed() + { + if ( !selected_item ) + return; + actions_listview->setSelected( create_listview_item( selected_item->action(), + selected_item->parent() ? NULL : actions_listview, selected_item->parent(), + selected_item, true ), true ); + } + +void Action_list_widget::delete_pressed() + { + delete selected_item; // CHECKME snad vyvola signaly pro enable() + selected_item = NULL; + } + +void Action_list_widget::modify_pressed() + { + if ( !selected_item ) + return; + edit_listview_item( selected_item ); + } + +void Action_list_widget::current_changed( TQListViewItem* item_P ) + { +// if( item_P == selected_item ) +// return; + selected_item = static_cast< Action_list_item* >( item_P ); +// actions_listview->setSelected( item_P, true ); + copy_button->setEnabled( item_P != NULL ); + modify_button->setEnabled( item_P != NULL ); + delete_button->setEnabled( item_P != NULL ); + } + +Action_list_item* Action_list_widget::create_listview_item( Action* action_P, + TQListView* parent1_P, TQListViewItem* parent2_P, TQListViewItem* after_P, bool copy_P ) + { + Action* new_win = copy_P ? action_P->copy( NULL ) : action_P; +// CHECKME uz by nemelo byt treba +/* if( after_P == NULL ) + { + if( parent1_P == NULL ) + return new Action_list_item( parent2_P, new_win ); + else + return new Action_list_item( parent1_P, new_win ); + } + else*/ + { + if( parent1_P == NULL ) + return new Action_list_item( parent2_P, after_P, new_win ); + else + return new Action_list_item( parent1_P, after_P, new_win ); + } + } + +void Action_list_widget::edit_listview_item( Action_list_item* item_P ) + { + Action_dialog* dlg = NULL; + if( Command_url_action* action = dynamic_cast< Command_url_action* >( item_P->action())) + dlg = new Command_url_action_dialog( action ); + else if( Menuentry_action* action = dynamic_cast< Menuentry_action* >( item_P->action())) + dlg = new Menuentry_action_dialog( action ); + else if( Dcop_action* action = dynamic_cast< Dcop_action* >( item_P->action())) + dlg = new Dcop_action_dialog( action ); + else if( Keyboard_input_action* action + = dynamic_cast< Keyboard_input_action* >( item_P->action())) + dlg = new Keyboard_input_action_dialog( action ); + else if( Activate_window_action* action + = dynamic_cast< Activate_window_action* >( item_P->action())) + dlg = new Activate_window_action_dialog( action ); + else // CHECKME TODO pridat dalsi + assert( false ); + Action* new_action = dlg->edit_action(); + if( new_action != NULL ) + { + item_P->set_action( new_action ); + item_P->widthChanged( 0 ); + actions_listview->repaintItem( item_P ); + } + delete dlg; + } + +// Action_list_item + +TQString Action_list_item::text( int column_P ) const + { + return column_P == 0 ? action()->description() : TQString::null; + } + +Action_list_item::~Action_list_item() + { + delete _action; + } + +// Command_url_action_dialog + +Command_url_action_dialog::Command_url_action_dialog( Command_url_action* action_P ) + : KDialogBase( NULL, NULL, true, "", Ok | Cancel ), action( NULL ) // CHECKME caption + { + widget = new Command_url_widget( this ); + widget->set_data( action_P ); + setMainWidget( widget ); + } + +Action* Command_url_action_dialog::edit_action() + { + exec(); + return action; + } + +void Command_url_action_dialog::accept() + { + KDialogBase::accept(); + action = widget->get_data( NULL ); // CHECKME NULL ? + } + +// Menuentry_action_dialog + +Menuentry_action_dialog::Menuentry_action_dialog( Menuentry_action* action_P ) + : KDialogBase( NULL, NULL, true, "", Ok | Cancel ), action( NULL ) // CHECKME caption + { + widget = new Menuentry_widget( this ); + widget->set_data( action_P ); + setMainWidget( widget ); + } + +Action* Menuentry_action_dialog::edit_action() + { + exec(); + return action; + } + +void Menuentry_action_dialog::accept() + { + KDialogBase::accept(); + action = widget->get_data( NULL ); // CHECKME NULL ? + } + +// Dcop_action_dialog + +Dcop_action_dialog::Dcop_action_dialog( Dcop_action* action_P ) + : KDialogBase( NULL, NULL, true, "", Ok | Cancel ), action( NULL ) // CHECKME caption + { + widget = new Dcop_widget( this ); + widget->set_data( action_P ); + setMainWidget( widget ); + } + +Action* Dcop_action_dialog::edit_action() + { + exec(); + return action; + } + +void Dcop_action_dialog::accept() + { + KDialogBase::accept(); + action = widget->get_data( NULL ); // CHECKME NULL ? + } + +// Keyboard_input_action_dialog + +Keyboard_input_action_dialog::Keyboard_input_action_dialog( Keyboard_input_action* action_P ) + : KDialogBase( NULL, NULL, true, "", Ok | Cancel ), action( NULL ) // CHECKME caption + { + widget = new Keyboard_input_widget( this ); + widget->set_data( action_P ); + setMainWidget( widget ); + } + +Action* Keyboard_input_action_dialog::edit_action() + { + exec(); + return action; + } + +void Keyboard_input_action_dialog::accept() + { + KDialogBase::accept(); + action = widget->get_data( NULL ); // CHECKME NULL ? + } + +// Activate_window_action_dialog + +Activate_window_action_dialog::Activate_window_action_dialog( Activate_window_action* action_P ) + : KDialogBase( NULL, NULL, true, "", Ok | Cancel ), action( NULL ) // CHECKME caption + { + widget = new Activate_window_widget( this ); + widget->set_data( action_P ? action_P->window() : NULL ); + setMainWidget( widget ); + } + +Action* Activate_window_action_dialog::edit_action() + { + exec(); + return action; + } + +void Activate_window_action_dialog::accept() + { + KDialogBase::accept(); + action = new Activate_window_action( NULL, widget->get_data()); // CHECKME NULL ? + } + +} // namespace KHotKeys + +#include "action_list_widget.moc" diff --git a/khotkeys/kcontrol/action_list_widget.h b/khotkeys/kcontrol/action_list_widget.h new file mode 100644 index 000000000..c2f32477e --- /dev/null +++ b/khotkeys/kcontrol/action_list_widget.h @@ -0,0 +1,205 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _ACTION_LIST_WIDGET_H_ +#define _ACTION_LIST_WIDGET_H_ + +#include <tqlistview.h> + +#include <actions.h> +#include <kdialogbase.h> + +#include <action_list_widget_ui.h> + +#include "activate_window_widget.h" + +namespace KHotKeys +{ + +class Action_data; +class Command_url_widget; +class Menuentry_widget; +class Dcop_widget; +class Keyboard_input_widget; + +class Action_list_item; + +class Action_list_widget + : public Action_list_widget_ui + { + Q_OBJECT + public: + Action_list_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); + virtual ~Action_list_widget(); + void set_data( const Action_list* data_P ); + Action_list* get_data( Action_data* data_P ) const; + public slots: + void clear_data(); + protected: + Action_list_item* create_listview_item( Action* action_P, TQListView* parent1_P, + TQListViewItem* parent2_P, TQListViewItem* after_P, bool copy_P ); + void edit_listview_item( Action_list_item* item_P ); + enum type_t { TYPE_COMMAND_URL_ACTION, TYPE_MENUENTRY_ACTION, TYPE_DCOP_ACTION, + TYPE_KEYBOARD_INPUT_ACTION, TYPE_ACTIVATE_WINDOW_ACTION }; + protected slots: + void new_selected( int type_P ); + virtual void copy_pressed(); + virtual void delete_pressed(); + virtual void modify_pressed(); + virtual void current_changed( TQListViewItem* item_P ); + protected: + Action_list_item* selected_item; + }; + +typedef Action_list_widget Action_list_tab; + +class Action_list_item + : public TQListViewItem + { + public: + Action_list_item( TQListView* parent_P, Action* action_P ); + Action_list_item( TQListViewItem* parent_P, Action* action_P ); + Action_list_item( TQListView* parent_P, TQListViewItem* after_P, Action* action_P ); + Action_list_item( TQListViewItem* parent_P, TQListViewItem* after_P, Action* action_P ); + virtual ~Action_list_item(); + virtual TQString text( int column_P ) const; + Action* action() const; + void set_action( Action* action_P ); + protected: + Action* _action; // owns it + }; + +class Action_dialog + { + public: + virtual Action* edit_action() = 0; + virtual ~Action_dialog(); + }; + +class Command_url_action_dialog + : public KDialogBase, public Action_dialog + { + Q_OBJECT + public: + Command_url_action_dialog( Command_url_action* action_P ); + virtual Action* edit_action(); + protected: + virtual void accept(); + Command_url_widget* widget; + Command_url_action* action; + }; + +class Menuentry_action_dialog + : public KDialogBase, public Action_dialog + { + Q_OBJECT + public: + Menuentry_action_dialog( Menuentry_action* action_P ); + virtual Action* edit_action(); + protected: + virtual void accept(); + Menuentry_widget* widget; + Menuentry_action* action; + }; + +class Dcop_action_dialog + : public KDialogBase, public Action_dialog + { + Q_OBJECT + public: + Dcop_action_dialog( Dcop_action* action_P ); + virtual Action* edit_action(); + protected: + virtual void accept(); + Dcop_widget* widget; + Dcop_action* action; + }; + +class Keyboard_input_action_dialog + : public KDialogBase, public Action_dialog + { + Q_OBJECT + public: + Keyboard_input_action_dialog( Keyboard_input_action* action_P ); + virtual Action* edit_action(); + protected: + virtual void accept(); + Keyboard_input_widget* widget; + Keyboard_input_action* action; + }; + +class Activate_window_action_dialog + : public KDialogBase, public Action_dialog + { + Q_OBJECT + public: + Activate_window_action_dialog( Activate_window_action* action_P ); + virtual Action* edit_action(); + protected: + virtual void accept(); + Activate_window_widget* widget; + Activate_window_action* action; + }; + +//*************************************************************************** +// Inline +//*************************************************************************** + +// Action_list_item + +inline +Action_list_item::Action_list_item( TQListView* parent_P, Action* action_P ) + : TQListViewItem( parent_P ), _action( action_P ) + { + } + +inline +Action_list_item::Action_list_item( TQListViewItem* parent_P, Action* action_P ) + : TQListViewItem( parent_P ), _action( action_P ) + { + } + +inline +Action_list_item::Action_list_item( TQListView* parent_P, TQListViewItem* after_P, + Action* action_P ) + : TQListViewItem( parent_P, after_P ), _action( action_P ) + { + } + +inline +Action_list_item::Action_list_item( TQListViewItem* parent_P, TQListViewItem* after_P, + Action* action_P ) + : TQListViewItem( parent_P, after_P ), _action( action_P ) + { + } + +inline +Action* Action_list_item::action() const + { + return _action; + } + +inline +void Action_list_item::set_action( Action* action_P ) + { + delete _action; + _action = action_P; + } + +// Action_dialog + +inline +Action_dialog::~Action_dialog() + { + } + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/actions_listview_widget.cpp b/khotkeys/kcontrol/actions_listview_widget.cpp new file mode 100644 index 000000000..e528005ed --- /dev/null +++ b/khotkeys/kcontrol/actions_listview_widget.cpp @@ -0,0 +1,189 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _ACTIONS_LISTVIEW_WIDGET_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "actions_listview_widget.h" + +#include <tqheader.h> + +#include <tdelocale.h> +#include <kdebug.h> +#include <tqdragobject.h> + +#include <khlistview.h> +#include <actions.h> +#include <triggers.h> + +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +Actions_listview_widget::Actions_listview_widget( TQWidget* parent_P, const char* name_P ) + : Actions_listview_widget_ui( parent_P, name_P ), recent_item( NULL ), + saved_current_item( NULL ) + { +// actions_listview->setSorting( 0 ); + actions_listview->header()->hide(); + actions_listview->addColumn( "" ); + actions_listview->setRootIsDecorated( true ); // CHECKME + connect( actions_listview, TQT_SIGNAL( current_changed( TQListViewItem* )), + TQT_SLOT( current_changed( TQListViewItem* ))); + connect( actions_listview, TQT_SIGNAL( moved( TQListViewItem*, TQListViewItem*, TQListViewItem* )), + TQT_SLOT( item_moved( TQListViewItem*, TQListViewItem*, TQListViewItem* ))); + // KHotKeys::Module::changed() + } + +void Actions_listview_widget::action_name_changed( const TQString& ) + { + current_action()->widthChanged( 0 ); + actions_listview->repaintItem( current_action()); + } + +void Actions_listview_widget::set_action_data( Action_data_base* data_P, bool recent_action_P ) + { + if( recent_action_P ) + { + assert( recent_item != NULL ); + recent_item->set_data( data_P ); + } + else + saved_current_item->set_data( data_P ); + } + +void Actions_listview_widget::current_changed( TQListViewItem* item_P ) + { + kdDebug( 1217 ) << "current_changed:" << item_P << endl; + set_current_action( static_cast< Action_listview_item* >( item_P )); + } + +void Actions_listview_widget::set_current_action( Action_listview_item* item_P ) + { + if( item_P == saved_current_item ) + return; + recent_item = saved_current_item; + saved_current_item = item_P; + if( actions_listview->currentItem() != item_P ) + { + if( item_P == NULL ) + actions_listview->clearSelection(); + actions_listview->setCurrentItem( item_P ); + } + emit current_action_changed(); + } + +void Actions_listview_widget::new_action( Action_data_base* data_P ) + { + TQListViewItem* parent = NULL; + if( current_action() != NULL ) + { + if( dynamic_cast< Action_data_group* >( current_action()->data()) != NULL ) + parent = current_action(); + else + parent = current_action()->parent(); + } + if( parent ) + parent->setOpen( true ); + Action_listview_item* tmp = create_item( parent, NULL, data_P ); + recent_item = saved_current_item; + saved_current_item = tmp; + actions_listview->setSelected( tmp, true ); + } + +void Actions_listview_widget::delete_action() + { +// while( TQListViewItem* child = current_action()->firstChild()) +// delete child; +// TQListViewItem* nw = current_action()->itemAbove(); +// if( nw == NULL ) +// nw = current_action()->itemBelow(); + delete saved_current_item; + saved_current_item = NULL; + recent_item = NULL; +// if( nw != NULL ) +// { +// saved_current_item = static_cast< Action_listview_item* >( nw ); +// actions_listview->setSelected( nw, true ); +// } +// else +// saved_current_item = NULL; + } + +void Actions_listview_widget::item_moved( TQListViewItem* item_P, TQListViewItem*, TQListViewItem* ) + { + Action_listview_item* item = static_cast< Action_listview_item* >( item_P ); + Action_listview_item* parent = static_cast< Action_listview_item* >( item->parent()); + if( parent == NULL ) + item->data()->reparent( module->actions_root()); + else if( Action_data_group* group = dynamic_cast< Action_data_group* >( parent->data())) + item->data()->reparent( group ); + else + item->data()->reparent( module->actions_root()); + module->changed(); + } + +void Actions_listview_widget::build_up() + { + build_up_recursively( module->actions_root(), NULL ); + } + +void Actions_listview_widget::build_up_recursively( Action_data_group* parent_P, + Action_listview_item* item_parent_P ) + { + Action_listview_item* prev = NULL; + for( Action_data_group::Iterator it = parent_P->first_child(); + it; + ++it ) + { + prev = create_item( item_parent_P, prev, ( *it )); + Action_data_group* grp = dynamic_cast< Action_data_group* >( *it ); + if( grp != NULL ) + build_up_recursively( grp, prev ); + } + } + +Action_listview_item* Actions_listview_widget::create_item( TQListViewItem* parent_P, + TQListViewItem* after_P, Action_data_base* data_P ) + { + if( parent_P != NULL ) + return new Action_listview_item( parent_P, after_P, data_P ); + else + return new Action_listview_item( actions_listview, after_P, data_P ); + } + +// Actions_listview + +Actions_listview::Actions_listview( TQWidget* parent_P, const char* name_P ) + : KHListView( parent_P, name_P ), _widget( static_cast< Actions_listview_widget* >( parent_P->parent())) + { + // this relies on the way designer creates the .cpp file from .ui (yes, I'm lazy) + assert( dynamic_cast< Actions_listview_widget_ui* >( parent_P->parent())); + setDragEnabled( true ); + setDropVisualizer( true ); + setAcceptDrops( true ); + } + +// Action_listview_item + +TQString Action_listview_item::text( int column_P ) const + { + return column_P == 0 ? data()->name() : TQString::null; + } + +// CHECKME poradne tohle zkontrolovat po tom prekopani + +} // namespace KHotKeys + +#include "actions_listview_widget.moc" diff --git a/khotkeys/kcontrol/actions_listview_widget.h b/khotkeys/kcontrol/actions_listview_widget.h new file mode 100644 index 000000000..0f3a632f4 --- /dev/null +++ b/khotkeys/kcontrol/actions_listview_widget.h @@ -0,0 +1,151 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _ACTIONS_LISTVIEW_WIDGET_H_ +#define _ACTIONS_LISTVIEW_WIDGET_H_ + +#include <khlistview.h> + +#include <action_data.h> + +#include <actions_listview_widget_ui.h> + +class TQDragObject; + +namespace KHotKeys +{ + +class Action_listview_item; +class Action_data_base; + +class Actions_listview_widget + : public Actions_listview_widget_ui + { + Q_OBJECT + public: + Actions_listview_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); + Action_listview_item* current_action() const; + void set_current_action( Action_listview_item* item ); + Action_data_base* current_action_data() const; + void set_action_data( Action_data_base* data_P, bool recent_action_P = false ); + void action_name_changed( const TQString& name_P ); + void clear(); + void build_up(); + void new_action( Action_data_base* data_P ); + void delete_action(); + private: + Action_listview_item* create_item( TQListViewItem* parent_P, TQListViewItem* after_P, Action_data_base* data_P ); + void build_up_recursively( Action_data_group* parent_P, + Action_listview_item* item_parent_P ); + Action_listview_item* recent_item; + Action_listview_item* saved_current_item; + private slots: + void item_moved( TQListViewItem* item_P, TQListViewItem* was_after_P, TQListViewItem* after_P ); + void current_changed( TQListViewItem* item_P ); + signals: + void current_action_changed(); + }; + +class Actions_listview + : public KHListView + { + Q_OBJECT + public: + Actions_listview( TQWidget* parent_P = NULL, const char* name_P = NULL ); + Actions_listview_widget* widget(); + private: + Actions_listview_widget* _widget; + }; + +// CHECKME a jak to bude s parent itemu, kdyz Action_data uz maji vlastni parent ? +class Action_listview_item + : public TQListViewItem + { + public: + virtual TQString text( int column_P ) const; + Action_data_base* data() const; + void set_data( Action_data_base* data_P ); + Action_listview_item( TQListView* parent_P, TQListViewItem* after_P, + Action_data_base* data_P ); + Action_listview_item( TQListViewItem* parent_P, TQListViewItem* after_P, + Action_data_base* data_P ); + protected: + Action_data_base* _data; // CHECKME doesn't own !!! + }; + +//*************************************************************************** +// Inline +//*************************************************************************** + +// Actions_listview_widget + +inline +Action_listview_item* Actions_listview_widget::current_action() const + { + return saved_current_item; + } + +inline +Action_data_base* Actions_listview_widget::current_action_data() const + { + return current_action() != NULL ? current_action()->data() : NULL; + } + +inline +void Actions_listview_widget::clear() + { + actions_listview->clear(); + recent_item = 0; + saved_current_item = 0; + } + +// Actions_listview + +inline +Actions_listview_widget* Actions_listview::widget() + { + return _widget; + } + +// Action_listview_item + +inline +Action_listview_item::Action_listview_item( TQListView* parent_P, TQListViewItem* after_P, + Action_data_base* data_P ) + : TQListViewItem( parent_P, after_P ), _data( data_P ) + { + if( dynamic_cast< Action_data_group* >( data_P )) + setExpandable( true ); + } + +inline +Action_listview_item::Action_listview_item( TQListViewItem* parent_P, TQListViewItem* after_P, + Action_data_base* data_P ) + : TQListViewItem( parent_P, after_P ), _data( data_P ) + { + if( dynamic_cast< Action_data_group* >( data_P )) + setExpandable( true ); + } + +inline +Action_data_base* Action_listview_item::data() const + { + return _data; + } + +inline +void Action_listview_item::set_data( Action_data_base* data_P ) + { + _data = data_P; + } + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/activate_window_widget.h b/khotkeys/kcontrol/activate_window_widget.h new file mode 100644 index 000000000..64291e7f4 --- /dev/null +++ b/khotkeys/kcontrol/activate_window_widget.h @@ -0,0 +1,28 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _ACTIVATE_WINDOW_WIDGET_H_ +#define _ACTIVATE_WINDOW_WIDGET_H_ + +#include "windowdef_list_widget.h" + +namespace KHotKeys +{ + +typedef Windowdef_list_widget Activate_window_widget; +typedef Activate_window_widget Activate_window_tab; + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/command_url_widget.cpp b/khotkeys/kcontrol/command_url_widget.cpp new file mode 100644 index 000000000..133913360 --- /dev/null +++ b/khotkeys/kcontrol/command_url_widget.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _COMMAND_URL_WIDGET_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "command_url_widget.h" + +#include <tqpushbutton.h> +#include <tqlineedit.h> +#include <klineedit.h> +#include <tqcheckbox.h> +#include <tqgroupbox.h> +#include <kurlrequester.h> + +#include <actions.h> +#include <action_data.h> +#include <windowdef_list_widget.h> + +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +Command_url_widget::Command_url_widget( TQWidget* parent_P, const char* name_P ) + : Command_url_widget_ui( parent_P, name_P ) + { + clear_data(); + // KHotKeys::Module::changed() + connect( command_url_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + } + +void Command_url_widget::clear_data() + { + command_url_lineedit->lineEdit()->clear(); + } + +void Command_url_widget::set_data( const Command_url_action* data_P ) + { + if( data_P == NULL ) + { + clear_data(); + return; + } + command_url_lineedit->lineEdit()->setText( data_P->command_url()); + } + +Command_url_action* Command_url_widget::get_data( Action_data* data_P ) const + { + return new Command_url_action( data_P, command_url_lineedit->lineEdit()->text()); + } + +void Command_url_widget::browse_pressed() + { // CHECKME TODO + } + +} // namespace KHotKeys + +#include "command_url_widget.moc" diff --git a/khotkeys/kcontrol/command_url_widget.h b/khotkeys/kcontrol/command_url_widget.h new file mode 100644 index 000000000..af9a9dc2a --- /dev/null +++ b/khotkeys/kcontrol/command_url_widget.h @@ -0,0 +1,44 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _COMMAND_URL_WIDGET_H_ +#define _COMMAND_URL_WIDGET_H_ + +#include <command_url_widget_ui.h> + +namespace KHotKeys +{ + +class Command_url_action; +class Action_data; + +class Command_url_widget + : public Command_url_widget_ui + { + Q_OBJECT + public: + Command_url_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); + void set_data( const Command_url_action* data_P ); + Command_url_action* get_data( Action_data* data_P ) const; + public slots: + void clear_data(); + protected slots: + virtual void browse_pressed(); + }; + +typedef Command_url_widget Command_url_tab; + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/condition_list_widget.cpp b/khotkeys/kcontrol/condition_list_widget.cpp new file mode 100644 index 000000000..ba3be5e71 --- /dev/null +++ b/khotkeys/kcontrol/condition_list_widget.cpp @@ -0,0 +1,395 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _CONDITIONS_LIST_WIDGET_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "condition_list_widget.h" + +#include <assert.h> +#include <tqpushbutton.h> +#include <tqheader.h> +#include <tqlineedit.h> +#include <tqpopupmenu.h> + +#include <kdebug.h> +#include <tdelocale.h> +#include <tdemessagebox.h> + +#include <khlistview.h> + +#include <conditions.h> + +#include "windowdef_list_widget.h" + +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +// Condition_list_widget + +Condition_list_widget::Condition_list_widget( TQWidget* parent_P, const char* name_P ) + : Condition_list_widget_ui( parent_P, name_P ), selected_item( NULL ) + { + conditions.setAutoDelete( true ); + TQPopupMenu* popup = new TQPopupMenu; // CHECKME looks like setting parent doesn't work + popup->insertItem( i18n( "Active Window..." ), TYPE_ACTIVE_WINDOW ); + popup->insertItem( i18n( "Existing Window..." ), TYPE_EXISTING_WINDOW ); + popup->insertItem( i18n( "Not_condition", "Not" ), TYPE_NOT ); + popup->insertItem( i18n( "And_condition", "And" ), TYPE_AND ); + popup->insertItem( i18n( "Or_condition", "Or" ), TYPE_OR ); + connect( conditions_listview, TQT_SIGNAL( doubleClicked ( TQListViewItem *, const TQPoint &, int ) ), + this, TQT_SLOT( modify_pressed() ) ); + + connect( popup, TQT_SIGNAL( activated( int )), TQT_SLOT( new_selected( int ))); + new_button->setPopup( popup ); + conditions_listview->header()->hide(); + conditions_listview->addColumn( "" ); + conditions_listview->setSorting( -1 ); + conditions_listview->setRootIsDecorated( true ); // CHECKME + conditions_listview->setForceSelect( true ); + copy_button->setEnabled( false ); + modify_button->setEnabled( false ); + delete_button->setEnabled( false ); + clear_data(); + // KHotKeys::Module::changed() + connect( new_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( copy_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( modify_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( delete_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( comment_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + } + +Condition_list_widget::~Condition_list_widget() + { + delete new_button->popup(); + } + +void Condition_list_widget::clear_data() + { + comment_lineedit->clear(); + conditions.clear(); + conditions_listview->clear(); + } + +void Condition_list_widget::set_data( const Condition_list* data_P ) + { + if( data_P == NULL ) + { + clear_data(); + return; + } + comment_lineedit->setText( data_P->comment()); + conditions.clear(); + conditions_listview->clear(); + insert_listview_items( data_P, conditions_listview, NULL ); +#ifdef KHOTKEYS_DEBUG + kdDebug( 1217 ) << "Condition_list_widget::set_data():" << endl; + Condition::debug_list( conditions ); +#endif + } + +void Condition_list_widget::insert_listview_items( const Condition_list_base* parent_P, + TQListView* parent1_P, Condition_list_item* parent2_P ) + { + Condition_list_item* prev = NULL; + for( Condition_list_base::Iterator it( *parent_P ); + *it; + ++it ) + { + prev = create_listview_item( *it, parent1_P, parent2_P, prev, true ); + if( Condition_list_base* group = dynamic_cast< Condition_list_base* >( *it )) + insert_listview_items( group, NULL, prev ); + } + } + +Condition_list* Condition_list_widget::get_data( Action_data_base* data_P ) const + { +#ifdef KHOTKEYS_DEBUG + kdDebug( 1217 ) << "Condition_list_widget::get_data():" << endl; + Condition::debug_list( conditions ); +#endif +// CHECKME TODO hmm, tady to bude chtit asi i children :( + Condition_list* list = new Condition_list( comment_lineedit->text(), data_P ); + get_listview_items( list, conditions_listview->firstChild()); + return list; + } + +void Condition_list_widget::get_listview_items( Condition_list_base* list_P, + TQListViewItem* first_item_P ) const + { + list_P->clear(); + for( TQListViewItem* pos = first_item_P; + pos != NULL; + pos = pos->nextSibling()) + { + Condition* cond = static_cast< Condition_list_item* >( pos )->condition()->copy( list_P ); + if( Condition_list_base* group = dynamic_cast< Condition_list_base* >( cond )) + get_listview_items( group, pos->firstChild()); + } + } + +void Condition_list_widget::new_selected( int type_P ) + { + Condition_list_item* parent = NULL; + Condition_list_item* after = NULL; + if( selected_item && selected_item->condition()) + { + Condition_list_base* tmp = dynamic_cast< Condition_list_base* > + ( selected_item->condition()); + if( tmp && tmp->accepts_children()) + { + int ret = KMessageBox::questionYesNoCancel( NULL, + i18n( "A group is selected.\nAdd the new condition in this selected group?" ), TQString::null, i18n("Add in Group"), i18n("Ignore Group")); + if( ret == KMessageBox::Cancel ) + return; + else if( ret == KMessageBox::Yes ) + parent = selected_item; + else + parent = NULL; + } + } + if( parent == NULL && selected_item != NULL && selected_item->parent() != NULL ) + { + parent = static_cast< Condition_list_item* >( selected_item->parent()); + after = selected_item; + } + Condition_list_base* parent_cond = parent + ? static_cast< Condition_list_base* >( parent->condition()) : NULL; + assert( !parent || dynamic_cast< Condition_list_base* >( parent->condition())); + Condition_dialog* dlg = NULL; + Condition* condition = NULL; + switch( type_P ) + { + case TYPE_ACTIVE_WINDOW: // Active_window_condition + dlg = new Active_window_condition_dialog( + new Active_window_condition( new Windowdef_list( "" ), parent_cond )); // CHECKME NULL + break; + case TYPE_EXISTING_WINDOW: // Existing_window_condition + dlg = new Existing_window_condition_dialog( + new Existing_window_condition( new Windowdef_list( "" ), parent_cond )); // CHECKME NULL + break; + case TYPE_NOT: // Not_condition + condition = new Not_condition( parent_cond ); + break; + case TYPE_AND: // And_condition + condition = new And_condition( parent_cond ); + break; + case TYPE_OR: // Or_condition + condition = new Or_condition( parent_cond ); + break; + } + if( dlg != NULL ) + { + condition = dlg->edit_condition(); + delete dlg; + } + if( condition != NULL ) + { + if( parent != NULL ) + conditions_listview->setSelected( create_listview_item( condition, + NULL, parent, after, false ), true ); + else + conditions_listview->setSelected( create_listview_item( condition, + conditions_listview, NULL, selected_item, false ), true ); + } + } + +void Condition_list_widget::copy_pressed() + { + if ( !selected_item ) + return; + conditions_listview->setSelected( create_listview_item( + selected_item->condition()->copy( selected_item->condition()->parent()), + selected_item->parent() ? NULL : conditions_listview, + static_cast< Condition_list_item* >( selected_item->parent()), + selected_item, true ), true ); + } + +void Condition_list_widget::delete_pressed() +{ + if ( selected_item ) + { + conditions.remove( selected_item->condition()); // we own it + delete selected_item; // CHECKME snad vyvola signaly pro enable() + selected_item = NULL; + } +} + +void Condition_list_widget::modify_pressed() + { + if ( !selected_item ) + return; + edit_listview_item( selected_item ); + } + +void Condition_list_widget::current_changed( TQListViewItem* item_P ) + { +// if( item_P == selected_item ) +// return; + selected_item = static_cast< Condition_list_item* >( item_P ); +// conditions_listview->setSelected( selected_item, true ); + copy_button->setEnabled( selected_item != NULL ); + delete_button->setEnabled( selected_item != NULL ); + if( selected_item != NULL ) + { // not,and,or can't be modified + if( dynamic_cast< Not_condition* >( selected_item->condition()) == NULL + && dynamic_cast< And_condition* >( selected_item->condition()) == NULL + && dynamic_cast< Or_condition* >( selected_item->condition()) == NULL ) + { + modify_button->setEnabled( true ); + } + else + modify_button->setEnabled( false ); + } + else + modify_button->setEnabled( false ); + } + +Condition_list_item* Condition_list_widget::create_listview_item( Condition* condition_P, + TQListView* parent1_P, Condition_list_item* parent2_P, TQListViewItem* after_P, bool copy_P ) + { +#ifdef KHOTKEYS_DEBUG + kdDebug( 1217 ) << "Condition_list_widget::create_listview_item():" << endl; + Condition::debug_list( conditions ); + kdDebug( 1217 ) << kdBacktrace() << endl; +#endif + Condition* new_cond = copy_P ? condition_P->copy( parent2_P + ? static_cast< Condition_list_base* >( parent2_P->condition()) : NULL ) : condition_P; + assert( !copy_P || !parent2_P || dynamic_cast< Condition_list_base* >( parent2_P->condition())); +// CHECKME uz by nemelo byt treba +/* if( after_P == NULL ) + { + if( parent1_P == NULL ) + return new Condition_list_item( parent2_P, new_win ); + else + return new Condition_list_item( parent1_P, new_win ); + } + else*/ + { + if( parent1_P == NULL ) + { + parent2_P->setOpen( true ); + if( new_cond->parent() == NULL ) // own only toplevels, they own the rest + conditions.append( new_cond ); // we own it, not the listview + return new Condition_list_item( parent2_P, after_P, new_cond ); + } + else + { + if( new_cond->parent() == NULL ) + conditions.append( new_cond ); // we own it, not the listview + return new Condition_list_item( parent1_P, after_P, new_cond ); + } + } + } + +void Condition_list_widget::edit_listview_item( Condition_list_item* item_P ) + { + Condition_dialog* dlg = NULL; + if( Active_window_condition* condition + = dynamic_cast< Active_window_condition* >( item_P->condition())) + dlg = new Active_window_condition_dialog( condition ); + else if( Existing_window_condition* condition + = dynamic_cast< Existing_window_condition* >( item_P->condition())) + dlg = new Existing_window_condition_dialog( condition ); + else if( dynamic_cast< Not_condition* >( item_P->condition()) != NULL ) + return; + else if( dynamic_cast< And_condition* >( item_P->condition()) != NULL ) + return; + else if( dynamic_cast< Or_condition* >( item_P->condition()) != NULL ) + return; + else // CHECKME TODO pridat dalsi + assert( false ); + Condition* new_condition = dlg->edit_condition(); + if( new_condition != NULL ) + { + Condition* old_cond = item_P->condition(); + item_P->set_condition( new_condition ); + int pos = conditions.find( old_cond ); + if( pos >= 0 ) + { + conditions.remove( pos ); // we own it + conditions.insert( pos, new_condition ); + } + item_P->widthChanged( 0 ); + conditions_listview->repaintItem( item_P ); + } +#ifdef KHOTKEYS_DEBUG + kdDebug( 1217 ) << "Condition_list_widget::edit_listview_item():" << endl; + Condition::debug_list( conditions ); +#endif + delete dlg; + } + +// Condition_list_item + +TQString Condition_list_item::text( int column_P ) const + { + return column_P == 0 ? condition()->description() : TQString::null; + } + +// Active_window_condition_dialog + +Active_window_condition_dialog::Active_window_condition_dialog( + Active_window_condition* condition_P ) + : KDialogBase( NULL, NULL, true, i18n( "Window Details" ), Ok | Cancel ), condition( NULL ) + { + widget = new Windowdef_list_widget( this ); + widget->set_data( condition_P->window()); + setMainWidget( widget ); + } + +Condition* Active_window_condition_dialog::edit_condition() + { + exec(); + return condition; + } + +void Active_window_condition_dialog::accept() + { + KDialogBase::accept(); + condition = new Active_window_condition( widget->get_data(), NULL ); // CHECKME NULL ? + } + +// Existing_window_condition_dialog + +Existing_window_condition_dialog::Existing_window_condition_dialog( + Existing_window_condition* condition_P ) + : KDialogBase( NULL, NULL, true, i18n( "Window Details" ), Ok | Cancel ), condition( NULL ) + { + widget = new Windowdef_list_widget( this ); + widget->set_data( condition_P->window()); + setMainWidget( widget ); + } + +Condition* Existing_window_condition_dialog::edit_condition() + { + exec(); + return condition; + } + +void Existing_window_condition_dialog::accept() + { + KDialogBase::accept(); + condition = new Existing_window_condition( widget->get_data(), NULL ); // CHECKME NULL ? + } + +} // namespace KHotKeys + +#include "condition_list_widget.moc" diff --git a/khotkeys/kcontrol/condition_list_widget.h b/khotkeys/kcontrol/condition_list_widget.h new file mode 100644 index 000000000..0c99fd46c --- /dev/null +++ b/khotkeys/kcontrol/condition_list_widget.h @@ -0,0 +1,165 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _CONDITIONS_LIST_WIDGET_H_ +#define _CONDITIONS_LIST_WIDGET_H_ + +#include <tqlistview.h> +#include <tqptrlist.h> + +#include <kdialogbase.h> + +#include <conditions.h> +#include <condition_list_widget_ui.h> + +namespace KHotKeys +{ + +class Action_data; +class Windowdef_list_widget; + +class Condition_list_item; + +class Condition_list_widget + : public Condition_list_widget_ui + { + Q_OBJECT + public: + Condition_list_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); + virtual ~Condition_list_widget(); + void set_data( const Condition_list* data_P ); + Condition_list* get_data( Action_data_base* data_P ) const; + public slots: + void clear_data(); + protected: + Condition_list_item* create_listview_item( Condition* condition_P, TQListView* parent1_P, + Condition_list_item* parent2_P, TQListViewItem* after_P, bool copy_P ); + void edit_listview_item( Condition_list_item* item_P ); + enum type_t { TYPE_ACTIVE_WINDOW, TYPE_EXISTING_WINDOW, TYPE_NOT, TYPE_AND, TYPE_OR }; + protected slots: + void new_selected( int type_P ); + virtual void copy_pressed(); + virtual void delete_pressed(); + virtual void modify_pressed(); + virtual void current_changed( TQListViewItem* item_P ); + private: + void insert_listview_items( const Condition_list_base* parent_P, + TQListView* parent1_P, Condition_list_item* parent2_P ); + void get_listview_items( Condition_list_base* list_P, TQListViewItem* first_item_P ) const; + Condition_list_item* selected_item; + TQPtrList< Condition > conditions; + }; + +typedef Condition_list_widget Condition_list_tab; + +class Condition_list_item + : public TQListViewItem + { + public: + Condition_list_item( TQListView* parent_P, Condition* condition_P ); + Condition_list_item( TQListViewItem* parent_P, Condition* condition_P ); + Condition_list_item( TQListView* parent_P, TQListViewItem* after_P, Condition* condition_P ); + Condition_list_item( TQListViewItem* parent_P, TQListViewItem* after_P, + Condition* condition_P ); + virtual TQString text( int column_P ) const; + Condition* condition() const; + void set_condition( Condition* condition_P ); + protected: + Condition* _condition; // owns it + }; + +class Condition_dialog + { + public: + virtual Condition* edit_condition() = 0; + virtual ~Condition_dialog(); + }; + +class Active_window_condition_dialog + : public KDialogBase, public Condition_dialog + { + Q_OBJECT + public: + Active_window_condition_dialog( Active_window_condition* condition_P ); + virtual Condition* edit_condition(); + protected: + virtual void accept(); + Windowdef_list_widget* widget; + Active_window_condition* condition; + }; + +class Existing_window_condition_dialog + : public KDialogBase, public Condition_dialog + { + Q_OBJECT + public: + Existing_window_condition_dialog( Existing_window_condition* condition_P ); + virtual Condition* edit_condition(); + protected: + virtual void accept(); + Windowdef_list_widget* widget; + Existing_window_condition* condition; + }; + + +//*************************************************************************** +// Inline +//*************************************************************************** + +// Condition_list_item + +inline +Condition_list_item::Condition_list_item( TQListView* parent_P, Condition* condition_P ) + : TQListViewItem( parent_P ), _condition( condition_P ) + { + } + +inline +Condition_list_item::Condition_list_item( TQListViewItem* parent_P, Condition* condition_P ) + : TQListViewItem( parent_P ), _condition( condition_P ) + { + } + +inline +Condition_list_item::Condition_list_item( TQListView* parent_P, TQListViewItem* after_P, + Condition* condition_P ) + : TQListViewItem( parent_P, after_P ), _condition( condition_P ) + { + } + +inline +Condition_list_item::Condition_list_item( TQListViewItem* parent_P, TQListViewItem* after_P, + Condition* condition_P ) + : TQListViewItem( parent_P, after_P ), _condition( condition_P ) + { + } + +inline +Condition* Condition_list_item::condition() const + { + return _condition; + } + +inline +void Condition_list_item::set_condition( Condition* condition_P ) + { + _condition = condition_P; + } + +// Condition_dialog + +inline +Condition_dialog::~Condition_dialog() + { + } + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/dcop_widget.cpp b/khotkeys/kcontrol/dcop_widget.cpp new file mode 100644 index 000000000..bee149860 --- /dev/null +++ b/khotkeys/kcontrol/dcop_widget.cpp @@ -0,0 +1,95 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _DCOP_WIDGET_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "dcop_widget.h" + +#include <tqlineedit.h> +#include <tqpushbutton.h> + +#include <krun.h> +#include <tdemessagebox.h> +#include <tdelocale.h> + +#include <actions.h> + +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +Dcop_widget::Dcop_widget( TQWidget* parent_P, const char* name_P ) + : Dcop_widget_ui( parent_P, name_P ) + { + clear_data(); + try_button->setText( i18n( "to try", "&Try" )); // Qt designer can't do this + // KHotKeys::Module::changed() + connect( remote_app_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + connect( remote_object_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + connect( called_function_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + connect( arguments_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + } + +void Dcop_widget::clear_data() + { + remote_app_lineedit->clear(); + remote_object_lineedit->clear(); + called_function_lineedit->clear(); + arguments_lineedit->clear(); + // CHECKME nebo spis multilineedit ? + } + +void Dcop_widget::set_data( const Dcop_action* data_P ) + { + if( data_P == NULL ) + { + clear_data(); + return; + } + remote_app_lineedit->setText( data_P->remote_application()); + remote_object_lineedit->setText( data_P->remote_object()); + called_function_lineedit->setText( data_P->called_function()); + arguments_lineedit->setText( data_P->arguments()); + // CHECKME nebo spis multilineedit ? + } + +Dcop_action* Dcop_widget::get_data( Action_data* data_P ) const + { + return new Dcop_action( data_P, remote_app_lineedit->text().stripWhiteSpace(), + remote_object_lineedit->text().stripWhiteSpace(), + called_function_lineedit->text().stripWhiteSpace(), arguments_lineedit->text()); + } + +// CHECKME later "steal" whole interfaces browsing from kdcop +void Dcop_widget::run_kdcop_pressed() + { + if( KRun::runCommand( "kdcop" ) == 0 ) + KMessageBox::sorry( NULL, i18n( "Failed to run KDCOP" )); + } + +void Dcop_widget::try_pressed() + { + Dcop_action* tmp = get_data( NULL ); // CHECKME + tmp->execute(); + delete tmp; + } + +} // namespace KHotKeys + +#include "dcop_widget.moc" diff --git a/khotkeys/kcontrol/dcop_widget.h b/khotkeys/kcontrol/dcop_widget.h new file mode 100644 index 000000000..43523f00d --- /dev/null +++ b/khotkeys/kcontrol/dcop_widget.h @@ -0,0 +1,45 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _DCOP_WIDGET_H_ +#define _DCOP_WIDGET_H_ + +#include <dcop_widget_ui.h> + +namespace KHotKeys +{ + +class Dcop_action; +class Action_data; + +class Dcop_widget + : public Dcop_widget_ui + { + Q_OBJECT + public: + Dcop_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); + void set_data( const Dcop_action* data_P ); + Dcop_action* get_data( Action_data* data_P ) const; + public slots: + void clear_data(); + protected slots: + virtual void run_kdcop_pressed(); + virtual void try_pressed(); + }; + +typedef Dcop_widget Dcop_tab; + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/general_settings_tab.cpp b/khotkeys/kcontrol/general_settings_tab.cpp new file mode 100644 index 000000000..cf2337446 --- /dev/null +++ b/khotkeys/kcontrol/general_settings_tab.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _GENERAL_SETTINGS_TAB_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "general_settings_tab.h" + +#include <tqcheckbox.h> + +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +General_settings_tab::General_settings_tab( TQWidget* parent_P, const char* name_P ) + : General_settings_tab_ui( parent_P, name_P ) + { + // KHotKeys::Module::changed() + connect( disable_daemon_checkbox, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + } + +void General_settings_tab::import_clicked() + { + module->import(); + } + +void General_settings_tab::write_data() const + { + module->set_daemon_disabled( disable_daemon_checkbox->isChecked()); + } + +void General_settings_tab::read_data() + { + disable_daemon_checkbox->setChecked( module->daemon_disabled()); + } + +void General_settings_tab::clear_data() + { + // "global" tab, not action specific, do nothing + } + +} // namespace KHotKeys + +#include "general_settings_tab.moc" diff --git a/khotkeys/kcontrol/general_settings_tab.h b/khotkeys/kcontrol/general_settings_tab.h new file mode 100644 index 000000000..8bcd5cd21 --- /dev/null +++ b/khotkeys/kcontrol/general_settings_tab.h @@ -0,0 +1,39 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _GENERAL_SETTINGS_TAB_H_ +#define _GENERAL_SETTINGS_TAB_H_ + +#include <general_settings_tab_ui.h> + +namespace KHotKeys +{ + +class General_settings_tab + : public General_settings_tab_ui + { + Q_OBJECT + public: + General_settings_tab( TQWidget* parent = NULL, const char* name = NULL ); + void read_data(); + void write_data() const; + public slots: + void clear_data(); + protected slots: + virtual void import_clicked(); + }; + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/general_tab.cpp b/khotkeys/kcontrol/general_tab.cpp new file mode 100644 index 000000000..1cd98d461 --- /dev/null +++ b/khotkeys/kcontrol/general_tab.cpp @@ -0,0 +1,136 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _GENERAL_TAB_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "general_tab.h" + +#include <tqlineedit.h> +#include <tqcheckbox.h> +#include <tqcombobox.h> + +#include <tdelocale.h> +#include <kdebug.h> +#include <ktextedit.h> + +#include <actions.h> +#include <action_data.h> + +#include "tab_widget.h" +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +General_tab::General_tab( TQWidget* parent_P, const char* name_P ) + : General_tab_ui( parent_P, name_P ) + { + for( Tab_widget::action_type_t i = Tab_widget::TYPE_FIRST; + i < Tab_widget::TYPE_END; + ++i ) + switch( i ) + { + case Tab_widget::TYPE_GENERIC: + action_type_combo->insertItem( i18n( "Generic" ), i ); + break; + case Tab_widget::TYPE_COMMAND_URL_SHORTCUT: + action_type_combo->insertItem( + i18n( "Keyboard Shortcut -> Command/URL (simple)" ), i ); + break; + case Tab_widget::TYPE_MENUENTRY_SHORTCUT: + action_type_combo->insertItem( + i18n( "TDE Menu Entry (simple)" ), i ); + break; + case Tab_widget::TYPE_DCOP_SHORTCUT: + action_type_combo->insertItem( + i18n( "Keyboard Shortcut -> DCOP Call (simple)" ), i ); + break; + case Tab_widget::TYPE_KEYBOARD_INPUT_SHORTCUT: + action_type_combo->insertItem( + i18n( "Keyboard Shortcut -> Keyboard Input (simple)" ), i ); + break; + case Tab_widget::TYPE_KEYBOARD_INPUT_GESTURE: + action_type_combo->insertItem( + i18n( "Gesture -> Keyboard Input (simple)" ), i ); + break; + case Tab_widget::TYPE_ACTIVATE_WINDOW_SHORTCUT: + action_type_combo->insertItem( + i18n( "Keyboard Shortcut -> Activate Window (simple)" ), i ); + break; + case Tab_widget::TYPE_END: + assert( false ); + } + clear_data(); + // KHotKeys::Module::changed() + connect( action_name_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + connect( disable_checkbox, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( comment_multilineedit, TQT_SIGNAL( textChanged()), + module, TQT_SLOT( changed())); + connect( action_type_combo, TQT_SIGNAL( activated( int )), + module, TQT_SLOT( changed())); + } + +void General_tab::clear_data() + { + disconnect( action_name_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + this, TQT_SLOT( action_name_changed( const TQString& ))); + disconnect( action_type_combo, TQT_SIGNAL( activated( int )), + this, TQT_SIGNAL( action_type_changed( int ))); // CHECKME neodpoji to sloty od nej ? + action_name_lineedit->clear(); + disable_checkbox->setChecked( false ); + disable_checkbox->setText( i18n( "&Disable" )); + comment_multilineedit->clear(); + action_type_combo->setCurrentItem( Tab_widget::TYPE_GENERIC ); +// module->set_action_type( data_P->type()); CHECKME tohle asi tady ne + } + +void General_tab::set_data( const Action_data* data_P ) + { + if( data_P == NULL ) + { + clear_data(); + return; + } + action_name_lineedit->setText( data_P->name()); + disable_checkbox->setChecked( !data_P->enabled( true )); + if( !data_P->parent()->enabled( false )) + disable_checkbox->setText( i18n( "&Disable (group is disabled)" )); + else + disable_checkbox->setText( i18n( "&Disable" )); + comment_multilineedit->setText( data_P->comment()); + action_type_combo->setCurrentItem( Tab_widget::type( data_P )); +// module->set_action_type( data_P->type()); + connect( action_name_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + TQT_SLOT( action_name_changed( const TQString& ))); + connect( action_type_combo, TQT_SIGNAL( activated( int )), + TQT_SIGNAL( action_type_changed( int ))); + } + +void General_tab::get_data( TQString& name_O, TQString& comment_O, bool& enabled_O ) + { + name_O = action_name_lineedit->text(); + comment_O = comment_multilineedit->text(); + enabled_O = !disable_checkbox->isChecked(); + } + +void General_tab::action_name_changed( const TQString& name_P ) + { + module->action_name_changed( name_P ); + } + +} // namespace KHotKeys + +#include "general_tab.moc" diff --git a/khotkeys/kcontrol/general_tab.h b/khotkeys/kcontrol/general_tab.h new file mode 100644 index 000000000..58f670a68 --- /dev/null +++ b/khotkeys/kcontrol/general_tab.h @@ -0,0 +1,47 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _GENERAL_TAB_H_ +#define _GENERAL_TAB_H_ + +#include <general_tab_ui.h> + +namespace KHotKeys +{ + +class Action_data; +class Trigger_list; +class Action_data_group; +class Windowdef_list; +class Action_list; + +class General_tab + : public General_tab_ui + { + Q_OBJECT + public: + General_tab( TQWidget* parent_P = NULL, const char* name_P = NULL ); + void set_data( const Action_data* data_P ); + void get_data( TQString& name_O, TQString& comment_O, bool& enabled_O ); + public slots: + void clear_data(); + signals: + void action_type_changed( int type_P ); + protected slots: + void action_name_changed( const TQString& name_P ); + }; + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/gesture_triggers_tab.cpp b/khotkeys/kcontrol/gesture_triggers_tab.cpp new file mode 100644 index 000000000..b00f60963 --- /dev/null +++ b/khotkeys/kcontrol/gesture_triggers_tab.cpp @@ -0,0 +1,161 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2002 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _GESTURE_TRIGGERS_TAB_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "gesture_triggers_tab.h" + +#include <tqpushbutton.h> +#include <tqlineedit.h> + +#include <triggers.h> +#include <actions.h> +#include <action_data.h> + +#include "kcmkhotkeys.h" +#include "gesturedrawer.h" +#include "gesturerecordpage.h" + +namespace KHotKeys +{ + +Gesture_triggers_tab::Gesture_triggers_tab( TQWidget* parent_P, const char* name_P ) + : Gesture_triggers_tab_ui( parent_P, name_P ) + { + clear_data(); + // KHotKeys::Module::changed() + connect( gesture_edit_button1, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( gesture_edit_button2, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( gesture_edit_button3, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + } + +void Gesture_triggers_tab::clear_data() + { + gesture1 = gesture2 = gesture3 = TQString::null; + gesture_lineedit1->clear(); + gesture_lineedit2->clear(); + gesture_lineedit3->clear(); + gesture_drawer1->setData( TQString::null ); + gesture_drawer2->setData( TQString::null ); + gesture_drawer3->setData( TQString::null ); + } + +void Gesture_triggers_tab::set_data( const Trigger_list* triggers_P ) + { + if( triggers_P == NULL ) + { + clear_data(); + return; + } + Gesture_trigger* trig = NULL; + Trigger_list::Iterator it( *triggers_P ); + if( it ) + { + assert( dynamic_cast< Gesture_trigger* >( *it )); + trig = static_cast< Gesture_trigger* >( *it ); + } + else + trig = NULL; + gesture1 = trig ? trig->gesturecode() : TQString::null; + gesture_lineedit1->setText( gesture1 ); + gesture_drawer1->setData( gesture1 ); + ++it; + if( it ) + { + assert( dynamic_cast< Gesture_trigger* >( *it )); + trig = static_cast< Gesture_trigger* >( *it ); + } + else + trig = NULL; + gesture2 = trig ? trig->gesturecode() : TQString::null; + gesture_lineedit2->setText( gesture2 ); + gesture_drawer2->setData( gesture2 ); + ++it; + if( it ) + { + assert( dynamic_cast< Gesture_trigger* >( *it )); + trig = static_cast< Gesture_trigger* >( *it ); + } + else + trig = NULL; + gesture3 = trig ? trig->gesturecode() : TQString::null; + gesture_lineedit3->setText( gesture3 ); + gesture_drawer3->setData( gesture3 ); + } + +Trigger_list* Gesture_triggers_tab::get_data( Action_data* data_P ) const + { + Trigger_list* ret = new Trigger_list( "Gesture_triggers" ); + if( !gesture1.isEmpty()) + ret->append( new Gesture_trigger( data_P, gesture1 )); + if( !gesture2.isEmpty()) + ret->append( new Gesture_trigger( data_P, gesture2 )); + if( !gesture3.isEmpty()) + ret->append( new Gesture_trigger( data_P, gesture3 )); + return ret; + } + +void Gesture_triggers_tab::edit_gesture_pressed1() + { + Gesture_edit_dialog dlg( gesture1 ); + gesture1 = dlg.edit_gesture(); + gesture_lineedit1->setText( gesture1 ); + gesture_drawer1->setData( gesture1 ); + } + +void Gesture_triggers_tab::edit_gesture_pressed2() + { + Gesture_edit_dialog dlg( gesture2 ); + gesture2 = dlg.edit_gesture(); + gesture_lineedit2->setText( gesture2 ); + gesture_drawer2->setData( gesture2 ); + } + +void Gesture_triggers_tab::edit_gesture_pressed3() + { + Gesture_edit_dialog dlg( gesture3 ); + gesture3 = dlg.edit_gesture(); + gesture_lineedit3->setText( gesture3 ); + gesture_drawer3->setData( gesture3 ); + } + +// Gesture_edit_dialog + +Gesture_edit_dialog::Gesture_edit_dialog( const TQString& gesture_P ) + : KDialogBase( NULL, NULL, true, "", Ok | Cancel ), // CHECKME caption + _gesture( gesture_P ), _page( NULL ) + { + _page = new GestureRecordPage( _gesture, + this, "GestureRecordPage"); + +// connect(_page, TQT_SIGNAL(gestureRecorded(bool)), // allow clearing the gesture +// this, TQT_SLOT(enableButtonOK(bool))); + + setMainWidget( _page ); + } + +TQString Gesture_edit_dialog::edit_gesture() + { + if( exec()) + return _page->getGesture(); + else + return _gesture; + } + +} // namespace KHotKeys + +#include "gesture_triggers_tab.moc" diff --git a/khotkeys/kcontrol/gesture_triggers_tab.h b/khotkeys/kcontrol/gesture_triggers_tab.h new file mode 100644 index 000000000..c11787d03 --- /dev/null +++ b/khotkeys/kcontrol/gesture_triggers_tab.h @@ -0,0 +1,66 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2002 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _GESTURE_TRIGGERS_TAB_H_ +#define _GESTURE_TRIGGERS_TAB_H_ + +#include <gesture_triggers_tab_ui.h> + +#include <tqstring.h> + +#include <kdialogbase.h> + +namespace KHotKeys +{ + +class Trigger_list; +class Action_data; + +class Gesture_triggers_tab + : public Gesture_triggers_tab_ui + { + Q_OBJECT + public: + Gesture_triggers_tab( TQWidget* parent_P = NULL, const char* name_P = NULL ); + void set_data( const Trigger_list* triggers_P ); + Trigger_list* get_data( Action_data* data_P ) const; + protected: + virtual void edit_gesture_pressed1(); + virtual void edit_gesture_pressed2(); + virtual void edit_gesture_pressed3(); + public slots: + void clear_data(); + private: + TQString gesture1, gesture2, gesture3; + }; + +class GestureRecordPage; + +class Gesture_edit_dialog + : public KDialogBase + { + Q_OBJECT + public: + Gesture_edit_dialog( const TQString& gesture_P ); + TQString edit_gesture(); + private: + // CHECKME accept() ? + TQString _gesture; + GestureRecordPage *_page; + }; + + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/gesturedrawer.cpp b/khotkeys/kcontrol/gesturedrawer.cpp new file mode 100644 index 000000000..2364e6e51 --- /dev/null +++ b/khotkeys/kcontrol/gesturedrawer.cpp @@ -0,0 +1,161 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2003 Mike Pilone <mpilone@slac.com> + Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#include <tqcolor.h> +#include <tqpainter.h> + +#include "gesturedrawer.h" + +namespace KHotKeys +{ + +GestureDrawer::GestureDrawer(TQWidget *parent, const char *name) + : TQFrame(parent, name), _data(TQString::null) + { + setBackgroundColor( colorGroup().base()); + setFrameStyle(TQFrame::Panel | TQFrame::Sunken); + setMinimumSize(30, 30); + } + +GestureDrawer::~GestureDrawer() + { + } + +void GestureDrawer::setData(const TQString &data) + { + _data = data; + + repaint(); + } + +void GestureDrawer::paintEvent(TQPaintEvent *ev) + { + // Iterate through the data points and draw a line to each of them + TQ_UINT32 startCell = 0; + TQ_UINT32 endCell = 0; + TQPoint startPoint; + TQPoint endPoint; + + TQPainter p(this); + + if (_data.length() > 0) + { + startCell = TQString(_data[0]).toUInt(); + } + + for (TQ_UINT32 index = 1; index < _data.length(); ++index) + { + endCell = TQString(_data[index]).toUInt(); + + startPoint = lookupCellCoords(startCell); + endPoint = lookupCellCoords(endCell); + + if (index == 1) + { + // Draw something to show the starting point + p.drawRect(startPoint.x()-2, startPoint.y()-2, 4, 4); + p.fillRect(startPoint.x()-2, startPoint.y()-2, 4, 4, + TQBrush(black)); + } + + p.drawLine(startPoint, endPoint); + drawArrowHead(startPoint, endPoint, p); + + startCell = endCell; + } + + p.end(); + + TQFrame::paintEvent(ev); + } + +TQPoint GestureDrawer::lookupCellCoords(TQ_UINT32 cell) + { + // First divide the widget into thirds, horizontally and vertically + TQ_UINT32 w = width(); + TQ_UINT32 h = height(); + + TQ_UINT32 wThird = w / 3; + TQ_UINT32 hThird = h / 3; + + switch(cell) + { + case 1: + return TQPoint(wThird/2, 2*hThird+hThird/2); + + case 2: + return TQPoint(wThird+wThird/2, 2*hThird+hThird/2); + + case 3: + return TQPoint(2*wThird+wThird/2, 2*hThird+hThird/2); + + case 4: + return TQPoint(wThird/2, hThird+hThird/2); + + case 5: + return TQPoint(wThird+wThird/2, hThird+hThird/2); + + case 6: + return TQPoint(2*wThird+wThird/2, hThird+hThird/2); + + case 7: + return TQPoint(wThird/2, hThird/2); + + case 8: + return TQPoint(wThird+wThird/2, hThird/2); + + case 9: + return TQPoint(2*wThird+wThird/2, hThird/2); + } + + return TQPoint(0, 0); + } + +void GestureDrawer::drawArrowHead(TQPoint &start, TQPoint &end, + TQPainter &p) + { + int deltaX = end.x() - start.x(); + int deltaY = end.y() - start.y(); + + if (deltaY == 0) + { + // horizontal line + int offset = 0; + if (deltaX > 0) + offset = -3; + else + offset = 3; + + p.drawLine(TQPoint(end.x()+offset, end.y()+2), end); + p.drawLine(TQPoint(end.x()+offset, end.y()-2), end); + } + else if (deltaX == 0) + { + // vertical line + int offset = 0; + if (deltaY > 0) + offset = -3; + else + offset = +3; + + p.drawLine(TQPoint(end.x()+2, end.y()+offset), end); + p.drawLine(TQPoint(end.x()-2, end.y()+offset), end); + } + else + { + // diagnal - The math would be pretty complex, so don't do anything + } + + } + +} // namespace KHotKeys + +#include "gesturedrawer.moc" diff --git a/khotkeys/kcontrol/gesturedrawer.h b/khotkeys/kcontrol/gesturedrawer.h new file mode 100644 index 000000000..ee3af6809 --- /dev/null +++ b/khotkeys/kcontrol/gesturedrawer.h @@ -0,0 +1,50 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2003 Mike Pilone <mpilone@slac.com> + Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef GESTURE_DRAWER_H +#define GESTURE_DRAWER_H + +#include <tqframe.h> +#include <tqstring.h> +#include <tqevent.h> +#include <tqpoint.h> +#include <tqwidget.h> +#include <tqsize.h> + +namespace KHotKeys +{ + +class GestureDrawer : public TQFrame + { + Q_OBJECT + public: + GestureDrawer(TQWidget *parent, const char *name); + ~GestureDrawer(); + + void setData(const TQString &data); + + virtual TQSize sizeHint() const { return TQSize(30, 30); } + + protected: + void paintEvent(TQPaintEvent *ev); + + private: + TQPoint lookupCellCoords(TQ_UINT32 cell); + void drawArrowHead(TQPoint &start, TQPoint &end, + TQPainter &p); + + + TQString _data; + }; + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/gesturerecorder.cpp b/khotkeys/kcontrol/gesturerecorder.cpp new file mode 100644 index 000000000..6e4395a5b --- /dev/null +++ b/khotkeys/kcontrol/gesturerecorder.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2003 Mike Pilone <mpilone@slac.com> + Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#include <tqcolor.h> +#include <tqevent.h> + +#include "gesturerecorder.h" + +namespace KHotKeys +{ + +GestureRecorder::GestureRecorder(TQWidget *parent, const char *name) + : TQFrame(parent, name), _mouseButtonDown(false) + { + setBackgroundColor( colorGroup().base()); + setFrameStyle(TQFrame::Sunken | TQFrame::Panel); + setLineWidth(2); + setMidLineWidth(0); + } + +GestureRecorder::~GestureRecorder() + { + } + +void GestureRecorder::mousePressEvent(TQMouseEvent *ev) + { + if (ev->button() == Qt::LeftButton) + { + _mouseButtonDown = true; + stroke.reset(); + TQPoint pos = ev->pos(); + stroke.record(pos.x(), pos.y()); + } + } + +void GestureRecorder::mouseReleaseEvent(TQMouseEvent *ev) + { + if ((ev->button() == Qt::LeftButton) && (_mouseButtonDown)) + { + TQPoint pos = ev->pos(); + stroke.record(pos.x(), pos.y()); + TQString data( stroke.translate()); + if( !data.isEmpty()) + emit recorded(data); + } + } + +void GestureRecorder::mouseMoveEvent(TQMouseEvent *ev) + { + if (_mouseButtonDown) + { + TQPoint pos = ev->pos(); + stroke.record(pos.x(), pos.y()); + } + } + +} // namespace KHotKeys + +#include "gesturerecorder.moc" diff --git a/khotkeys/kcontrol/gesturerecorder.h b/khotkeys/kcontrol/gesturerecorder.h new file mode 100644 index 000000000..e42de2c0e --- /dev/null +++ b/khotkeys/kcontrol/gesturerecorder.h @@ -0,0 +1,48 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2003 Mike Pilone <mpilone@slac.com> + Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef GESTURE_RECORDER_H +#define GESTURE_RECORDER_H + +#include <tqframe.h> +#include <tqstring.h> + +#include <gestures.h> + +class TQMouseEvent; + +namespace KHotKeys +{ + +class GestureRecorder : public TQFrame + { + Q_OBJECT + + public: + GestureRecorder(TQWidget *parent, const char *name); + ~GestureRecorder(); + + protected: + void mousePressEvent(TQMouseEvent *); + void mouseReleaseEvent(TQMouseEvent *); + void mouseMoveEvent(TQMouseEvent *); + + signals: + void recorded(const TQString &data); + + private: + bool _mouseButtonDown; + Stroke stroke; + }; + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/gesturerecordpage.cpp b/khotkeys/kcontrol/gesturerecordpage.cpp new file mode 100644 index 000000000..e9e768bb0 --- /dev/null +++ b/khotkeys/kcontrol/gesturerecordpage.cpp @@ -0,0 +1,147 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2003 Mike Pilone <mpilone@slac.com> + Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#include <tqwidget.h> +#include <tqlabel.h> +#include <tqpushbutton.h> + +#include <tdelocale.h> +#include <tdemessagebox.h> + +#include "gesturerecordpage.h" +#include "gesturerecorder.h" +#include "gesturedrawer.h" + +namespace KHotKeys +{ + +GestureRecordPage::GestureRecordPage(const TQString &gesture, + TQWidget *parent, const char *name) + : TQVBox(parent, name), + _recorder(NULL), _resetButton(NULL), + _tryOne(NULL), _tryTwo(NULL), _tryThree(NULL), _gest(TQString::null), + _tryCount(1) + { + TQString message; + + message = i18n("Draw the gesture you would like to record below. Press " + "and hold the left mouse button while drawing, and release " + "when you have finished.\n\n" + "You will be required to draw the gesture 3 times. After " + "each drawing, if they match, the indicators below will " + "change to represent which step you are on.\n\n" + "If at any point they do not match, you will be required to " + "restart. If you want to force a restart, use the reset " + "button below.\n\nDraw here:"); + + TQLabel *label = new TQLabel(message, this, "label"); + label->setAlignment(TQLabel::AlignLeft | TQLabel::WordBreak | + TQLabel::AlignVCenter); + + _recorder = new GestureRecorder(this, "recorder"); + _recorder->setMinimumHeight(150); + setStretchFactor(_recorder, 1); + connect(_recorder, TQT_SIGNAL(recorded(const TQString &)), + this, TQT_SLOT(slotRecorded(const TQString &))); + + TQHBox *hBox = new TQHBox(this, "hbox"); + + _tryOne = new GestureDrawer(hBox, "tryOne"); + _tryTwo = new GestureDrawer(hBox, "tryTwo"); + _tryThree = new GestureDrawer(hBox, "tryThree"); + + TQWidget *spacer = new TQWidget(hBox, "spacer"); + hBox->setStretchFactor(spacer, 1); + + _resetButton = new TQPushButton(i18n("&Reset"), hBox, "resetButton"); + connect(_resetButton, TQT_SIGNAL(clicked()), + this, TQT_SLOT(slotResetClicked())); + + + + // initialize + if (!gesture.isNull()) + { + slotRecorded(gesture); + slotRecorded(gesture); + slotRecorded(gesture); + } + else + emit gestureRecorded(false); + } + +GestureRecordPage::~GestureRecordPage() + { + } + +void GestureRecordPage::slotRecorded(const TQString &data) + { + switch (_tryCount) + { + case 1: + { + _gest = data; + _tryOne->setData(_gest); + _tryCount++; + } + break; + + case 2: + { + if (_gest == data) + { + _tryTwo->setData(data); + _tryCount++; + } + else + { + KMessageBox::sorry(this, i18n("Your gestures did not match.")); + slotResetClicked(); + } + break; + } + + case 3: + { + if (_gest == data) + { + _tryThree->setData(data); + _tryCount++; + emit gestureRecorded(true); + } + else + { + KMessageBox::sorry(this, i18n("Your gestures did not match.")); + slotResetClicked(); + } + break; + } + default: + KMessageBox::information(this, i18n("You have already completed the three required drawings. Either press 'Ok' to save or 'Reset' to try again.")); + } + } + +void GestureRecordPage::slotResetClicked() + { + _gest = TQString::null; + + _tryOne->setData(TQString::null); + _tryTwo->setData(TQString::null); + _tryThree->setData(TQString::null); + + _tryCount = 1; + + emit gestureRecorded(false); + } + +} // namespace KHotKeys + +#include "gesturerecordpage.moc" diff --git a/khotkeys/kcontrol/gesturerecordpage.h b/khotkeys/kcontrol/gesturerecordpage.h new file mode 100644 index 000000000..306710c0e --- /dev/null +++ b/khotkeys/kcontrol/gesturerecordpage.h @@ -0,0 +1,61 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2003 Mike Pilone <mpilone@slac.com> + Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef GESTURE_RECORD_PAGE_H +#define GESTURE_RECORD_PAGE_H + +#include <tqvbox.h> + +#include "gesturedrawer.h" + +class TQWidget; +class TQPushButton; +class TQLabel; + +namespace KHotKeys +{ + +class Gesture; +class GestureRecorder; + +class GestureRecordPage : public TQVBox + { + Q_OBJECT + + public: + GestureRecordPage(const TQString &gesture, + TQWidget *parent, const char *name); + ~GestureRecordPage(); + + const TQString &getGesture() const { return _gest; } + + protected slots: + void slotRecorded(const TQString &data); + void slotResetClicked(); + + signals: + void gestureRecorded(bool); + + private: + GestureRecorder *_recorder; + TQPushButton *_resetButton; + GestureDrawer *_tryOne; + GestureDrawer *_tryTwo; + GestureDrawer *_tryThree; + + TQString _gest; + + TQ_UINT32 _tryCount; + }; + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/gestures_settings_tab.cpp b/khotkeys/kcontrol/gestures_settings_tab.cpp new file mode 100644 index 000000000..8585fedbc --- /dev/null +++ b/khotkeys/kcontrol/gestures_settings_tab.cpp @@ -0,0 +1,76 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _GESTURES_SETTINGS_TAB_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "gestures_settings_tab.h" + +#include <tdelocale.h> +#include <tqcombobox.h> +#include <knuminput.h> +#include <tqcheckbox.h> + +#include "kcmkhotkeys.h" +#include "windowdef_list_widget.h" + +namespace KHotKeys +{ + +Gestures_settings_tab::Gestures_settings_tab( TQWidget* parent_P, const char* name_P ) + : Gestures_settings_tab_ui( parent_P, name_P ) + { + mouse_button_combo->insertItem( i18n( "Button 2 (middle)" ), 0 ); + mouse_button_combo->insertItem( i18n( "Button 3 (secondary)" ), 1 ); + mouse_button_combo->insertItem( i18n( "Button 4 (often wheel up)" ), 2 ); + mouse_button_combo->insertItem( i18n( "Button 5 (often wheel down)" ), 3 ); + mouse_button_combo->insertItem( i18n( "Button 6 (if available)" ), 4 ); + mouse_button_combo->insertItem( i18n( "Button 7 (if available)" ), 5 ); + mouse_button_combo->insertItem( i18n( "Button 8 (if available)" ), 6 ); + mouse_button_combo->insertItem( i18n( "Button 9 (if available)" ), 7 ); + // KHotKeys::Module::changed() + connect( mouse_gestures_globally, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( mouse_button_combo, TQT_SIGNAL( activated( int )), + module, TQT_SLOT( changed())); + connect( timeout_input, TQT_SIGNAL( valueChanged( int )), + module, TQT_SLOT( changed())); + } + +void Gestures_settings_tab::read_data() + { + mouse_gestures_globally->setChecked( module->gestures_disabled()); + mouse_button_combo->setCurrentItem( module->gesture_button() - 2 ); + timeout_input->setValue( module->gesture_timeout()); + if( module->gestures_exclude() != NULL ) + windowdef_list_widget->set_data( module->gestures_exclude()); + else + windowdef_list_widget->clear_data(); + } + +void Gestures_settings_tab::write_data() const + { + module->set_gestures_disabled( mouse_gestures_globally->isChecked()); + module->set_gesture_button( mouse_button_combo->currentItem() + 2 ); + module->set_gesture_timeout( timeout_input->value()); + module->set_gestures_exclude( windowdef_list_widget->get_data()); + } + +void Gestures_settings_tab::clear_data() + { + // "global" tab, not action specific, do nothing + } + +} // namespace KHotKeys + +#include "gestures_settings_tab.moc" diff --git a/khotkeys/kcontrol/gestures_settings_tab.h b/khotkeys/kcontrol/gestures_settings_tab.h new file mode 100644 index 000000000..813209439 --- /dev/null +++ b/khotkeys/kcontrol/gestures_settings_tab.h @@ -0,0 +1,37 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _GESTURES_SETTINGS_TAB_H_ +#define _GESTURES_SETTINGS_TAB_H_ + +#include <gestures_settings_tab_ui.h> + +namespace KHotKeys +{ + +class Gestures_settings_tab + : public Gestures_settings_tab_ui + { + Q_OBJECT + public: + Gestures_settings_tab( TQWidget* parent = NULL, const char* name = NULL ); + void read_data(); + void write_data() const; + public slots: + void clear_data(); + }; + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/hi16-app-khotkeys.png b/khotkeys/kcontrol/hi16-app-khotkeys.png Binary files differnew file mode 100644 index 000000000..1e919e897 --- /dev/null +++ b/khotkeys/kcontrol/hi16-app-khotkeys.png diff --git a/khotkeys/kcontrol/hi32-app-khotkeys.png b/khotkeys/kcontrol/hi32-app-khotkeys.png Binary files differnew file mode 100644 index 000000000..b1b86f875 --- /dev/null +++ b/khotkeys/kcontrol/hi32-app-khotkeys.png diff --git a/khotkeys/kcontrol/info_tab.cpp b/khotkeys/kcontrol/info_tab.cpp new file mode 100644 index 000000000..feba07dd1 --- /dev/null +++ b/khotkeys/kcontrol/info_tab.cpp @@ -0,0 +1,40 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _INFO_TAB_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "info_tab.h" + +#include <tqpushbutton.h> +#include <tqlabel.h> + +#include <tdelocale.h> + +namespace KHotKeys +{ + +Info_tab::Info_tab( TQWidget* parent_P, const char* name_P ) + : Info_tab_ui( parent_P, name_P ) + { + clear_data(); + } + +void Info_tab::clear_data() + { + // "global" tab, not action specific, do nothing + } + +} // namespace KHotKeys + +#include "info_tab.moc" diff --git a/khotkeys/kcontrol/info_tab.h b/khotkeys/kcontrol/info_tab.h new file mode 100644 index 000000000..32212ae98 --- /dev/null +++ b/khotkeys/kcontrol/info_tab.h @@ -0,0 +1,35 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _INFO_TAB_H_ +#define _INFO_TAB_H_ + +#include <info_tab_ui.h> + +namespace KHotKeys +{ + +class Info_tab + : public Info_tab_ui + { + Q_OBJECT + public: + Info_tab( TQWidget* parent_P = NULL, const char* name_P = NULL ); + public slots: + void clear_data(); + }; + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/init.cpp b/khotkeys/kcontrol/init.cpp new file mode 100644 index 000000000..9b34b2686 --- /dev/null +++ b/khotkeys/kcontrol/init.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _INIT_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <dcopref.h> +#include <tdeapplication.h> +#include <tdeconfig.h> +#include <kdebug.h> +#include <stdlib.h> + +extern "C" +{ + KDE_EXPORT void init_khotkeys() + { + TDEConfig cfg( "khotkeysrc", true ); + cfg.setGroup( "Main" ); + if( !cfg.readBoolEntry( "Autostart", false )) + return; + // Non-xinerama multhead support in KDE is just a hack + // involving forking apps per-screen. Don't bother with + // kded modules in such case. + TQCString multiHead = getenv("TDE_MULTIHEAD"); + if (multiHead.lower() == "true") + kapp->tdeinitExec( "khotkeys" ); + else + { + DCOPRef ref( "kded", "kded" ); + if( !ref.call( "loadModule", TQCString( "khotkeys" ))) + { + kdWarning( 1217 ) << "Loading of khotkeys module failed." << endl; + kapp->tdeinitExec( "khotkeys" ); + } + } + } +} diff --git a/khotkeys/kcontrol/kcmkhotkeys.cpp b/khotkeys/kcontrol/kcmkhotkeys.cpp new file mode 100644 index 000000000..85dbaaaa8 --- /dev/null +++ b/khotkeys/kcontrol/kcmkhotkeys.cpp @@ -0,0 +1,318 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _KCMKHOTKEYS_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "kcmkhotkeys.h" + +#include <unistd.h> +#include <stdlib.h> + +#include <tqlayout.h> +#include <tqsplitter.h> + +#include <tdecmodule.h> +#include <tdeaboutdata.h> +#include <tdelocale.h> +#include <tdeapplication.h> +#include <tdeconfig.h> +#include <tdeapplication.h> +#include <dcopclient.h> +#include <kdebug.h> +#include <tdemessagebox.h> +#include <tdeglobal.h> +#include <ksimpleconfig.h> +#include <tdefiledialog.h> +#include <dcopref.h> +#include <klibloader.h> + +#include <input.h> +#include <triggers.h> +#include <action_data.h> + +#include "tab_widget.h" +#include "actions_listview_widget.h" +#include "main_buttons_widget.h" +#include "voicerecorder.h" + +extern "C" +{ + KDE_EXPORT TDECModule* create_khotkeys( TQWidget* parent_P, const char* name_P ) + { +// sleep( 20 ); // CHECKME DEBUG + TDEGlobal::locale()->insertCatalogue("khotkeys"); + KHotKeys::Module* ret = new KHotKeys::Module( parent_P, name_P ); + ret->load(); // CHECKME + return ret; + } +} + +namespace KHotKeys +{ + +Module::Module( TQWidget* parent_P, const char* ) + : TDECModule( parent_P, "khotkeys" ), _actions_root( NULL ), _current_action_data( NULL ), + listview_is_changed( false ), deleting_action( false ) + { + setButtons( Help | Cancel | Apply | Ok ); + module = this; + init_global_data( false, TQT_TQOBJECT(this) ); // don't grab keys + init_arts(); + TQVBoxLayout* vbox = new TQVBoxLayout( this ); + vbox->setSpacing( 6 ); + vbox->setMargin( 11 ); + TQSplitter* splt = new TQSplitter( this ); + actions_listview_widget = new Actions_listview_widget( splt ); + tab_widget = new Tab_widget( splt ); + vbox->addWidget( splt ); + buttons_widget = new Main_buttons_widget( this ); + vbox->addWidget( buttons_widget ); + connect( actions_listview_widget, TQT_SIGNAL( current_action_changed()), + TQT_SLOT( listview_current_action_changed())); + connect( buttons_widget, TQT_SIGNAL( new_action_pressed()), TQT_SLOT( new_action())); + connect( buttons_widget, TQT_SIGNAL( new_action_group_pressed()), TQT_SLOT( new_action_group())); + connect( buttons_widget, TQT_SIGNAL( delete_action_pressed()), TQT_SLOT( delete_action())); + connect( buttons_widget, TQT_SIGNAL( global_settings_pressed()), TQT_SLOT( global_settings())); +// listview_current_action_changed(); // init + + TDEAboutData* about = new TDEAboutData("kcmkhotkeys", I18N_NOOP("KHotKeys"), KHOTKEYS_VERSION, + 0, + TDEAboutData::License_GPL, + I18N_NOOP("(c) 1999-2005 Lubos Lunak"), 0, 0); + about->addAuthor("Lubos Lunak", I18N_NOOP("Maintainer"), "l.lunak@kde.org"); + setAboutData( about ); + + } + +Module::~Module() + { + _current_action_data = NULL; + tab_widget->load_current_action(); // clear tab_widget + delete _actions_root; + module = NULL; + } + +void Module::load() + { + actions_listview_widget->clear(); + delete _actions_root; + settings.actions = NULL; + _current_action_data = NULL; + settings.read_settings( true ); + _actions_root = settings.actions; + kdDebug( 1217 ) << "actions_root:" << _actions_root << endl; + actions_listview_widget->build_up(); + tab_widget->load_current_action(); + emit TDECModule::changed( false ); // HACK otherwise the module would be changed from the very beginning + } + +void Module::save() + { + tab_widget->save_current_action_changes(); + settings.actions = _actions_root; + settings.write_settings(); + if( daemon_disabled()) + { + TQByteArray data; + kapp->dcopClient()->send( "khotkeys*", "khotkeys", "quit()", data ); + kdDebug( 1217 ) << "disabling khotkeys daemon" << endl; + } + else + { + if( !kapp->dcopClient()->isApplicationRegistered( "khotkeys" )) + { + kdDebug( 1217 ) << "launching new khotkeys daemon" << endl; + TDEApplication::tdeinitExec( "khotkeys" ); + } + else + { + TQByteArray data; + kapp->dcopClient()->send( "khotkeys*", "khotkeys", "reread_configuration()", data ); + kdDebug( 1217 ) << "telling khotkeys daemon to reread configuration" << endl; + } + } + emit TDECModule::changed( false ); + } + + +TQString Module::quickHelp() const + { + return ""; // TODO CHECKME + } + +void Module::action_name_changed( const TQString& name_P ) + { + current_action_data()->set_name( name_P ); + actions_listview_widget->action_name_changed( name_P ); + } + +void Module::listview_current_action_changed() + { + // CHECKME tohle je trosku hack, aby se pri save zmenenych hodnot ve stare vybrane polozce + // zmenila data v te stare polozce a ne nove aktivni + listview_is_changed = true; + set_new_current_action( !deleting_action ); + listview_is_changed = false; + } + +void Module::set_new_current_action( bool save_old_P ) + { + if( save_old_P ) + tab_widget->save_current_action_changes(); + _current_action_data = actions_listview_widget->current_action_data(); + kdDebug( 1217 ) << "set_new_current_action : " << _current_action_data << endl; + tab_widget->load_current_action(); + buttons_widget->enable_delete( current_action_data() != NULL ); + } + +// CHECKME volano jen z Tab_widget pro nastaveni zmenenych dat ( novy Action_data_base ) +void Module::set_current_action_data( Action_data_base* data_P ) + { + delete _current_action_data; + _current_action_data = data_P; + actions_listview_widget->set_action_data( data_P, listview_is_changed ); +// tab_widget->load_current_action(); CHECKME asi neni treba + } + +#if 0 + +} +#include <iostream> +#include <iomanip> +namespace KHotKeys { + +void check_tree( Action_data_group* b, int lev_P = 0 ) + { + using namespace std; + cerr << setw( lev_P ) << "" << b << ":Group:" << b->name().latin1() << ":" << b->parent() << endl; + for( Action_data_group::Iterator it = b->first_child(); + it; + ++it ) + if( Action_data_group* g = dynamic_cast< Action_data_group* >( *it )) + check_tree( g, lev_P + 1 ); + else + cerr << setw( lev_P + 1 ) << "" << (*it) << ":Action:" << (*it)->name().latin1() << ":" << (*it)->parent() << endl; + } + +#endif + +void Module::new_action() + { + tab_widget->save_current_action_changes(); +// check_tree( actions_root()); + Action_data_group* parent = current_action_data() != NULL + ? dynamic_cast< Action_data_group* >( current_action_data()) : NULL; + if( parent == NULL ) + { + if( current_action_data() != NULL ) + parent = current_action_data()->parent(); + else + parent = module->actions_root(); + } + Action_data_base* item = new Generic_action_data( parent, i18n( "New Action" ), "", + new Trigger_list( "" ), new Condition_list( "", NULL ), new Action_list( "" ), true ); + actions_listview_widget->new_action( item ); +// check_tree( actions_root()); + set_new_current_action( false ); + } + +// CHECKME spojit tyhle dve do jedne +void Module::new_action_group() + { + tab_widget->save_current_action_changes(); +// check_tree( actions_root()); + Action_data_group* parent = current_action_data() != NULL + ? dynamic_cast< Action_data_group* >( current_action_data()) : NULL; + if( parent == NULL ) + { + if( current_action_data() != NULL ) + parent = current_action_data()->parent(); + else + parent = module->actions_root(); + } + Action_data_base* item = new Action_data_group( parent, i18n( "New Action Group" ), "", + new Condition_list( "", NULL ), Action_data_group::SYSTEM_NONE, true ); + actions_listview_widget->new_action( item ); +// check_tree( actions_root()); + set_new_current_action( false ); + } + +void Module::delete_action() + { + delete _current_action_data; + _current_action_data = NULL; + deleting_action = true; // CHECKME zase tak trosku hack, jinak by se snazilo provest save + actions_listview_widget->delete_action(); // prave mazane polozky + deleting_action = false; + set_new_current_action( false ); + } + +void Module::global_settings() + { + actions_listview_widget->set_current_action( NULL ); + set_new_current_action( true ); + } + +void Module::set_gestures_exclude( Windowdef_list* windows ) + { + delete settings.gestures_exclude; + settings.gestures_exclude = windows; + } + +void Module::import() + { + TQString file = KFileDialog::getOpenFileName( TQString::null, "*.khotkeys", topLevelWidget(), + i18n( "Select File with Actions to Be Imported" )); + if( file.isEmpty()) + return; + KSimpleConfig cfg( file, true ); + if( !settings.import( cfg, true )) + { + KMessageBox::error( topLevelWidget(), + i18n( "Import of the specified file failed. Most probably the file is not a valid " + "file with actions." )); + return; + } + actions_listview_widget->clear(); + actions_listview_widget->build_up(); + tab_widget->load_current_action(); + emit TDECModule::changed( true ); + } + +void Module::changed() + { + emit TDECModule::changed( true ); + } + +void Module::init_arts() + { +#ifdef HAVE_ARTS + if( haveArts()) + { + KLibrary* arts = KLibLoader::self()->library( "khotkeys_arts" ); + if( arts == NULL ) + kdDebug( 1217 ) << "Couldn't load khotkeys_arts:" << KLibLoader::self()->lastErrorMessage() << endl; + if( arts != NULL && VoiceRecorder::init( arts )) + ; // ok + else + disableArts(); + } +#endif + } + +Module* module; // CHECKME + +} // namespace KHotKeys + +#include "kcmkhotkeys.moc" diff --git a/khotkeys/kcontrol/kcmkhotkeys.h b/khotkeys/kcontrol/kcmkhotkeys.h new file mode 100644 index 000000000..2fffc2b16 --- /dev/null +++ b/khotkeys/kcontrol/kcmkhotkeys.h @@ -0,0 +1,170 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _KCMKHOTKEYS_H_ +#define _KCMKHOTKEYS_H_ + +#include <tdecmodule.h> +#include <tdeshortcut.h> + +#include <actions.h> +#include <settings.h> + + + +namespace KHotKeys +{ + +class Actions_listview_widget; +class Tab_widget; +class Action_data_base; +class Main_buttons_widget; + +class Module + : public TDECModule + { + Q_OBJECT + public: + Module( TQWidget *parent_P, const char *name_P ); + virtual ~Module(); + virtual void load(); + virtual void save(); +// virtual void defaults(); not used + TQString quickHelp() const; + int buttons(); + void set_current_action_data( Action_data_base* data_P ); + Action_data_base* current_action_data(); + void action_name_changed( const TQString& name_P ); + Action_data_group* actions_root() const; + void set_gestures_disabled( bool set ); + bool gestures_disabled() const; + void set_gesture_button( int button ); + int gesture_button() const; + void set_gesture_timeout( int time ); + int gesture_timeout() const; + void set_gestures_exclude( Windowdef_list* windows ); + const Windowdef_list* gestures_exclude() const; + void set_daemon_disabled( bool disable ); + bool daemon_disabled() const; + void import(); + TDEShortcut voice_shortcut() const; + void set_voice_shortcut( const TDEShortcut&) ; + public slots: + void changed(); + protected: + void set_new_current_action( bool save_old_P ); + void init_arts(); + Actions_listview_widget* actions_listview_widget; + Tab_widget* tab_widget; + Main_buttons_widget* buttons_widget; + Action_data_group* _actions_root; // vlastni vsechny Action_data + Action_data_base* _current_action_data; + bool listview_is_changed; + bool deleting_action; + Settings settings; + protected slots: + void listview_current_action_changed(); + void new_action(); + void new_action_group(); + void delete_action(); + void global_settings(); + }; + +extern Module* module; + +//*************************************************************************** +// Inline +//*************************************************************************** + +// Module + +inline +Action_data_group* Module::actions_root() const + { + return _actions_root; + } + +inline +Action_data_base* Module::current_action_data() + { + return _current_action_data; + } + +inline +void Module::set_gestures_disabled( bool set ) + { + settings.gestures_disabled_globally = set; + } + +inline +bool Module::gestures_disabled() const + { + return settings.gestures_disabled_globally; + } + +inline +void Module::set_gesture_button( int button ) + { + settings.gesture_mouse_button = button; + } + +inline +int Module::gesture_button() const + { + return settings.gesture_mouse_button; + } + +inline +void Module::set_gesture_timeout( int time ) + { + settings.gesture_timeout = time; + } + +inline +int Module::gesture_timeout() const + { + return settings.gesture_timeout; + } + +inline +const Windowdef_list* Module::gestures_exclude() const + { + return settings.gestures_exclude; + } + +inline +void Module::set_daemon_disabled( bool disabled_P ) + { + settings.daemon_disabled = disabled_P; + } + +inline +bool Module::daemon_disabled() const + { + return settings.daemon_disabled; + } + + +inline +void Module::set_voice_shortcut( const TDEShortcut& cut) + { + settings.voice_shortcut=cut; + } + +inline +TDEShortcut Module::voice_shortcut() const + { + return settings.voice_shortcut; + } + + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/keyboard_input_widget.cpp b/khotkeys/kcontrol/keyboard_input_widget.cpp new file mode 100644 index 000000000..4d5727482 --- /dev/null +++ b/khotkeys/kcontrol/keyboard_input_widget.cpp @@ -0,0 +1,101 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _KEYBOARD_INPUT_WIDGET_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "keyboard_input_widget.h" + +#include <tqgroupbox.h> +#include <tqpushbutton.h> +#include <tqradiobutton.h> + +#include <ktextedit.h> + +#include <actions.h> +#include <action_data.h> + +#include "windowdef_list_widget.h" +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +Keyboard_input_widget::Keyboard_input_widget( TQWidget* parent_P, const char* name_P ) + : Keyboard_input_widget_ui( parent_P, name_P ) + { + clear_data(); + // KHotKeys::Module::changed() + connect( action_window_radio, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( active_window_radio, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( specific_window_radio, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( keyboard_input_multilineedit, TQT_SIGNAL( textChanged()), + module, TQT_SLOT( changed())); + connect( modify_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + } + +void Keyboard_input_widget::clear_data() + { + keyboard_input_multilineedit->clear(); + action_window_radio->setChecked( true ); + active_window_radio->setChecked( false ); + specific_window_radio->setChecked( false ); + window_groupbox->setEnabled( false ); + windowdef_list_widget->clear_data(); + } + +void Keyboard_input_widget::set_data( const Keyboard_input_action* data_P ) + { + if( data_P == NULL ) + { + clear_data(); + return; + } + keyboard_input_multilineedit->setText( data_P->input()); + const Windowdef_list* dest_window = data_P->dest_window(); + specific_window_radio->setChecked( dest_window != NULL ); + window_groupbox->setEnabled( dest_window != NULL ); + if( dest_window != NULL ) + windowdef_list_widget->set_data( dest_window ); + else + { + windowdef_list_widget->clear_data(); + if( data_P->activeWindow()) + active_window_radio->setChecked( true ); + else + action_window_radio->setChecked( true ); + } + } + +Keyboard_input_action* Keyboard_input_widget::get_data( Action_data* data_P ) const + { + const Windowdef_list* windows = NULL; + if( specific_window_radio->isChecked()) + windows = windowdef_list_widget->get_data(); + return new Keyboard_input_action( data_P, keyboard_input_multilineedit->text(), + windows, active_window_radio->isChecked()); + } + +void Keyboard_input_widget::modify_pressed() + { // CHECKME TODO + + // CHECKME klavesy nesmi byt i18n() !! + } + +} // namespace KHotKeys + +#include "keyboard_input_widget.moc" diff --git a/khotkeys/kcontrol/keyboard_input_widget.h b/khotkeys/kcontrol/keyboard_input_widget.h new file mode 100644 index 000000000..32690f44e --- /dev/null +++ b/khotkeys/kcontrol/keyboard_input_widget.h @@ -0,0 +1,44 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _KEYBOARD_INPUT_WIDGET_H_ +#define _KEYBOARD_INPUT_WIDGET_H_ + +#include <keyboard_input_widget_ui.h> + +namespace KHotKeys +{ + +class Keyboard_input_action; +class Action_data; + +class Keyboard_input_widget + : public Keyboard_input_widget_ui + { + Q_OBJECT + public: + Keyboard_input_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); + void set_data( const Keyboard_input_action* data_P ); + Keyboard_input_action* get_data( Action_data* data_P ) const; + public slots: + void clear_data(); + protected slots: + virtual void modify_pressed(); + }; + +typedef Keyboard_input_widget Keyboard_input_tab; + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/khotkeys.desktop b/khotkeys/kcontrol/khotkeys.desktop new file mode 100644 index 000000000..7dbd41899 --- /dev/null +++ b/khotkeys/kcontrol/khotkeys.desktop @@ -0,0 +1,207 @@ +[Desktop Entry] +Exec=tdecmshell khotkeys +Icon=khotkeys +Type=Application +DocPath=kcontrol/khotkeys/index.html +X-TDE-ModuleType=Library +X-TDE-Library=khotkeys +X-TDE-Init-Library=khotkeys_init +X-TDE-Init=khotkeys +Categories=Qt;TDE;X-TDE-settings-accessibility; + +Name=Input Actions +Name[af]=Inset Aksies +Name[ar]=نشاطات الإدخال +Name[be]=Дзеянні +Name[bg]=Действия +Name[br]=Oberoù enkas +Name[bs]=Akcije unosa +Name[ca]=Accions d'entrada +Name[cs]=Vstupní činnosti +Name[csb]=Klawiszowé dzéjania +Name[da]=Indgiv handlinger +Name[de]=Tastenkombinationen +Name[el]=Ενέργειες εισόδου +Name[eo]=Enir-agadoj +Name[es]=Introducir acciones +Name[et]=Sisestustoimingud +Name[eu]=Sarrerako ekintzak +Name[fa]=کنشهای ورودی +Name[fi]=Syöttötoiminnot +Name[fr]=Actions d'entrées +Name[fy]=Ynfieraksjes +Name[ga]=Gníomhartha Ionchurtha +Name[gl]=Accións de Entrada +Name[he]=פעולות קלט +Name[hr]=Aktivnosti unosa +Name[hu]=Beviteli műveletek +Name[is]=Inntaksaðgerðir +Name[it]=Azioni di immissione +Name[ja]=入力アクション +Name[ka]=შეტანის ქმედებები +Name[kk]=Енгізу әрекеттері +Name[km]=អំពើបញ្ចូល +Name[ko]=입력 동작 +Name[lt]=Įvesties veiksmai +Name[mk]=Влезни дејства +Name[ms]=Tindakan Input +Name[nb]=Input-handlinger +Name[nds]=Ingaavakschonen +Name[ne]=आगत कार्य +Name[nl]=Invoeracties +Name[nn]=Innhandlingar +Name[pa]=ਇੰਪੁੱਟ ਕਾਰਵਾਈਆਂ +Name[pl]=Akcje klawiszowe +Name[pt]=Acções de Entrada +Name[pt_BR]=Ações de Entrada +Name[ro]=Acțiuni de intrare +Name[ru]=Действия +Name[rw]=Kwinjiza Ibikorwa +Name[sk]=Vstupné akcie +Name[sl]=Vhodna dejanja +Name[sr]=Акције улаза +Name[sr@Latn]=Akcije ulaza +Name[sv]=Inmatningsåtgärder +Name[ta]=உள்ளீட்டு செயல்கள் +Name[te]=ములాంశ చర్యలు +Name[tg]=Амалҳо +Name[th]=การกระทำเพื่อใส่ข้อมูล +Name[tr]=Girdi Eylemleri +Name[tt]=Kertü Ğämälläre +Name[uk]=Ввід +Name[uz]=Kiritish amallari +Name[uz@cyrillic]=Киритиш амаллари +Name[vi]=Gõ Phím nóng +Name[wa]=Accions en intrêye +Name[zh_CN]=输入动作 +Name[zh_TW]=輸入動作 + +Comment=Configure Hotkey settings +Comment[af]=Stel kortpad sleutels op +Comment[be]=Настаўленні клавішных скаротаў +Comment[bg]=Настройване на жестове с мишката +Comment[bn]=হট-কী সেটিংস কনফিগার করুন +Comment[br]=Kefluniañ dibarzhoù Hotkey +Comment[bs]=Podesite opcije kratica tastature +Comment[ca]=Configura l'arranjament de les tecles ràpides +Comment[cs]=Nastavení horkých kláves +Comment[csb]=Kònfigùracëjô klawiszowëch skrodzënów +Comment[cy]=Ffurfweddu gosodiadau BysyllBrys +Comment[da]=Opsætning af genvejstast +Comment[de]=Tastenkombinationen festlegen +Comment[el]=Ρυθμίσεις HotKeys +Comment[eo]=Agordo de klavkomando +Comment[es]=Configuración de las preferencias de Hotkey +Comment[et]=Kiirklahvide seadistused +Comment[eu]=Konfiguratu Hotkey-ren ezarpenak +Comment[fa]=پیکربندی تنظیمات کلید میانبر +Comment[fi]=Muokkaa pikanäppäinten asetuksia +Comment[fr]=Configurer les réglages des raccourcis clavier +Comment[fy]=Fluchtoetsen ynstelle +Comment[gl]=Configurar opcións de HotKeys +Comment[he]=שינוי הגדרות מקשי הקיצור +Comment[hi]=हॉट-की विन्यास कॉन्फ़िगर करें +Comment[hr]=Konfiguriranje postavki prečaca +Comment[hu]=A használható parancsok beállítása +Comment[is]=Stillingar flýtilykla +Comment[it]=Configura impostazioni di Hotkey +Comment[ja]=ホットキーの設定 +Comment[ka]=კლავიშთა კომბინაციის კონფიგურირება +Comment[kk]=Пернелер тіркесімдерді баптау +Comment[km]=កំណត់រចនាសម្ព័ន្ធការកំណត់គ្រាប់ចុចបន្ទាន់ +Comment[ko]=단축키 설정 +Comment[lt]=Konfigūruoti klavišų kombinacijų nustatymus +Comment[lv]=Konfigurē karsto taustiņu parametrus +Comment[mk]=Конфигурирајте ги поставувањата за брзите копчиња +Comment[ms]=Konfigur seting Kekunci Panas +Comment[mt]=Konfigurazzjoni tal-hotkeys +Comment[nb]=Sett opp hurtigtaster +Comment[nds]=Akschonen för besünner Ingaven instellen +Comment[ne]=हटकुञ्जी सेटिङ कन्फिगर गर्नुहोस् +Comment[nl]=Sneltoetsen instellen +Comment[nn]=Set opp snøggtastar +Comment[pa]=ਹਾਟਕੀ ਸੈਟਿੰਗ ਸੰਰਚਨਾ +Comment[pl]=Konfiguracja skrótów klawiszowych +Comment[pt]=Configurar as opções de teclas +Comment[pt_BR]=Configura definições de teclas de atalho +Comment[ro]=Configurează setările Hotkey +Comment[ru]=Настройка действий по комбинациям клавиш и росчеркам мышью +Comment[rw]=Kuboneza amagenamiterere Butozihuta +Comment[se]=Heivet jođánisboaluid +Comment[sk]=Nastavenia klávesových skratiek +Comment[sl]=Nastavitve vročih tipk +Comment[sr]=Подешавање поставки пречица +Comment[sr@Latn]=Podešavanje postavki prečica +Comment[sv]=Anpassa Hotkey-inställningar +Comment[ta]=ÍÕìÌÅ¢¨º «¨ÁôÒ¸¨Ç ¯ûǨÁ +Comment[th]=ตั้งค่าปุ่มลัด +Comment[tr]=Kısayol ayarlarını yapılandır +Comment[tt]=Qaynar töymälärne caylaw +Comment[uk]=Налаштування швидких клавіш +Comment[vi]=Cấu hình các thiết lập về phím nóng +Comment[wa]=Apontiaedjes des tchuzes Hotkeys +Comment[zh_CN]=配置热键设置 +Comment[zh_TW]=設定熱鍵設定值 + +Keywords=Keys,Global key bindings,Key bindings,Gestures,Mouse gestures +Keywords[af]=Keys,Globale sleutel bindings,sleutel scheme,sleutel bindings,kortpaaie,application kortpaaie +Keywords[ar]=مفايتح، مفاتيح الاختصارات العامّة، خريطة المفاتيح، مفاتيح الاختصارات، اختصارات، اختصارات تطبيقات ، حركات الفأرة +Keywords[be]=Клавішы,Глабальныя скароты,Скароты,Рухі,Рухі мышы,Keys,Global key bindings,Key bindings,Gestures,Mouse gestures +Keywords[bg]=бърз, клавиш, бързи, достъп, клавишна, комбинация, жестове, мишка, жест, операция, Keys, Global key bindings, Key bindings, Gestures, Mouse gestures +Keywords[bs]=Keys,Global key bindings,Key bindings,Gestures,Mouse gestures,tipke,kratice tastature,globalne kratice tastature,geste,geste miša +Keywords[ca]=Tecles,lligams de tecles globals,Lligams de tecles,gestos,gestos de ratolí +Keywords[cs]=Klávesy,Globální klávesové zkratky,Schéma kláves,Klávesové zkratky,Zkratky,Gesta +Keywords[csb]=klawisze,globalné klawiszowé skrodzënë,schemë skrodzënów,gestë,mësz +Keywords[cy]=Bysyll,Bysellau,Rhwymiadau bysell eang,Ystumiau,Ystumiau llygoden +Keywords[da]=Taster,Globale tastebindinger,Tastebindinger,Gester,Muse-gester +Keywords[de]=Tasten,Tastenzuordnung,Tastenkürzel,Kurzbefehle,Tastenschema,Tastaturlayout,Gesten,Mausgesten +Keywords[el]=Πλήκτρα,Καθολικοί συνδυασμοί πλήκτρων,Συνδυασμοί πλήκτρων,Gestures,Mouse gestures +Keywords[eo]=klavoj,malloka,signifoj,asocioj,kombinoj,klavkombinoj,muzo +Keywords[es]=Teclas,Asociaciones de teclas globales,Asociaciones de teclas,Gestos,Gestos del ratón +Keywords[et]=Klahvid,Globaalsed kiirklahvid,Klahviskeem,Kiirklahvid,Klahvide seosed,Žestid,Hiirežestid +Keywords[eu]=Teklak,Tekla elkarketa orokorrak,Tekla elkarketak,Keinuak,Saguaren keinuak +Keywords[fa]=کلیدها، مقیدسازیهای کلید سراسری، مقیدسازیهای کلید، حرکات، حرکات موشی +Keywords[fi]=Näppäimet,Yleiset näppäinsidokset,Näppäinteema,Näppäinsidokset,pikavalinnat,sovellusten pikavalinnat,hiirieleet +Keywords[fr]=touches,raccourcis clavier globaux,raccourcis clavier,gestes,gestes de la souris +Keywords[fy]=keys,toetsen,toetsenbindingen,key bindings,toetsbiningen,sneltoetsen,fluchtoetsen,globale toetsenbindingen,algemiene toetsbiningen,mouse gestures,muisgebaren,mûsstjoeringen,stjoeringen,gestures,gebaren +Keywords[ga]=Eochracha,Ceangail chomhchoiteanna eochracha,Ceangail chomhchoiteanna,Gothaí,Gothaí luiche +Keywords[gl]=Teclas,Atallos de teclado globais,Atallos de teclado,Xestos,Xestos co rato +Keywords[he]=מקשים,תפקידי מקשים גלובליים,תצורת מקשים,תפקידי מקשים,קיצורים,קיצורים של יישומים, Keys,Global key bindings,Key bindings,Gestures,Mouse gestures +Keywords[hi]=कुंजियाँ,ग्लोबल की-बाइंडिंग्स,की-बाइंडिंग्स,गेस्चर्स,माउस गेस्चर्स +Keywords[hr]=Keys,Global key bindings,Key bindings,Gestures,Mouse gestures,Tipke,Opći prečaci tipkovnice,Prečaci tipkovnice,Gestikulacije,Gestikulacije mišem +Keywords[hu]=billentyűk,globális billentyűparancs,billentyűparancs,műveletek,mozdulatsorok +Keywords[is]=Lyklar,Hnappar,Flýtihnappar,Flýtilyklar,Lyklabindingar +Keywords[it]=tasti,associazioni globali di tasti,schema di tasti,associazioni di tasti,scorciatoie,gesti,gesti mouse,mouse gesti +Keywords[ja]=キー,グローバルキー,キーバインド,ジェスチャー,マウスジェスチャー +Keywords[km]=គ្រាប់ចុច,ការចងគ្រាប់ចុចសកល,ការចងគ្រាប់ចុច,កាយវិការ,កាយវិការកណ្ដុរ +Keywords[lt]=Keys,Global key bindings,Key bindings,Gestures,Mouse gestures,klavišai,klavišų sietis,klavišų schema,klavišų išdėstymas,spartieji klavišai,programų spartieji klavišai,pelės veiksmai +Keywords[lv]=Taustiņi,Globālās taustiņu sasaistes,Taustiņu shēma,Taustiņu sasaistes,mouse gestures +Keywords[mk]=Keys,Global key bindings,Key bindings,Gestures,Mouse gestures, Копчиња,Глобални врски на копчиња,врски на копчиња,гестови,гестови со глушец +Keywords[nb]=Taster,generelle hurtigtaster,hurtigtaster,bevegelser,musebevegelser +Keywords[nds]=Tasten,Globale Tastkombinatschonen,Tastschema,Tastkombinatschonen,Ingaavtekens,Muusteken +Keywords[ne]=कुञ्जीहरू, विश्वव्यापी कुञ्जी बाइन्डिङ, कुञ्जी बाइन्डिङ, सङ्केत, माउस सङ्केत +Keywords[nl]=keys,toetsen,toetsenbindingen,key bindings,sneltoetsen,globale toetsenbindingen,mouse gestures,muisgebaren,gestures,gebaren +Keywords[nn]=tastar,globale snøggtastar,tasteoppsett,snøggtastar,snarvegar,programsnarvegar,rørsler,muserørsler +Keywords[pa]=Keys,Global key bindings,Key bindings,Gestures,ਮਾਊਸ gestures, ਸਵਿੱਚਾਂ +Keywords[pl]=klawisze,globalne skróty klawiszowe,schematy skrótów,gesty,mysz +Keywords[pt]=teclas,teclas globais,esquema de teclas,atribuições de teclas,gestos,gestos com rato +Keywords[pt_BR]=Teclas,Teclas de atalho globais,esquema de teclado,gestos, gestos do mouse +Keywords[ro]=taste,asocieri globale de taste,schemă taste,asocieri taste,acceleratori,acceleratori aplicații,scurtături,gesturi +Keywords[ru]=Keys,Global key bindings,Key bindings,Gestures,Mouse gestures,мышь,росчерк,клавиши,комбинации клавиш,действия +Keywords[rw]=Buto,Ibyafataranyijwe urufunguzo rusange,Ibyafatanyijwe by'urufunguzo,Ibimenyetso,Ibimenyetso by'imbeba +Keywords[se]=boalut,oppalaš jođánisboalut,boalločoahkádusat,boalločatnasat,njuolgobálgát,prográmmanjuolgabálgát,lihkádusat,sáhpánlihkádusat +Keywords[sk]=Klávesy,Globálne klávesové skratky,schéma kláves,klávesové skratky,gestá,gestá myšou +Keywords[sl]=tipke,globalne vezi tipk,vezi tipk,tipkovne vezi,gibi,miškini gibi +Keywords[sr]=Keys,Global key bindings,Key scheme,Key bindings,shortcuts,application shortcuts,тастери,глобални тастери,пречица,шема тастера,пречице,програмске пречице +Keywords[sr@Latn]=Keys,Global key bindings,Key scheme,Key bindings,shortcuts,application shortcuts,tasteri,globalni tasteri,prečica,šema tastera,prečice,programske prečice +Keywords[sv]=tangenter,globala tangentbindningar,tangentbindningar,gester,musgester +Keywords[ta]=விசைகள்,உலகலாவிய விசை பிணைப்புகள்,விசை திட்டம்,விசை பிணைப்புகள்,குறுக்குவழிகள்,பயன்பாட்டுக் குறுக்குவழிகள் +Keywords[th]=ปุ่มพิมพ์,ปุ่มพิมพ์ส่วนกลาง,ชุดปุ่มพิมพ์,การจับคู่ปุ่มพิมพ์,ปุ่มพิมพ์ลัด,แป้นพิมพ์ลัด,ปุ่มพิมพ์ลัดแอพพลิเคชัน,การลากเมาส์ +Keywords[tr]=Tuşlar,Küresel tuş bağlantıları,Tuş bağlantıları,Kısayollar,Uygulama kısayolları,Fare hareketleri +Keywords[uk]=клавіші,глобальні прив'язки клавіш,схема клавіш,прив'язка клавіш, жести, жести мишки +Keywords[uz]=Gestures,Mouse gestures,Tugmalar,Umumiy tugmalar birikmasi,Tugmalar birikmasi +Keywords[uz@cyrillic]=Gestures,Mouse gestures,Тугмалар,Умумий тугмалар бирикмаси,Тугмалар бирикмаси +Keywords[vi]=Phím,tổ hợp phím toàn cục,tổ hợp phím,gõ phím,di chuyển chuột +Keywords[wa]=Tapes,globås rascourtis,rascourtis,djesses,manire di bodjî,manire di bodjî li sori +Keywords[zh_CN]=Keys,Global key bindings,Key bindings,Gestures,Mouse gestures,键,全局键绑定,手势,鼠标手势 +Keywords[zh_TW]=Keys,Global key bindings,Key bindings,Gestures,Mouse gestures,按鍵,全域按建連結,按鍵連結,手勢,滑鼠手勢 diff --git a/khotkeys/kcontrol/main_buttons_widget.cpp b/khotkeys/kcontrol/main_buttons_widget.cpp new file mode 100644 index 000000000..3532cc13f --- /dev/null +++ b/khotkeys/kcontrol/main_buttons_widget.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define MAIN_BUTTONS_WIDGET_CPP + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "main_buttons_widget.h" + +#include <tqpushbutton.h> + +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +Main_buttons_widget::Main_buttons_widget( TQWidget* parent_P, const char* name_P ) + : Main_buttons_widget_ui( parent_P, name_P ) + { + connect( new_action_button, TQT_SIGNAL( clicked()), TQT_SIGNAL( new_action_pressed())); + connect( new_action_group_button, TQT_SIGNAL( clicked()), TQT_SIGNAL( new_action_group_pressed())); + connect( delete_action_button, TQT_SIGNAL( clicked()), TQT_SIGNAL( delete_action_pressed())); + connect( global_settings_button, TQT_SIGNAL( clicked()), TQT_SIGNAL( global_settings_pressed())); + enable_delete( false ); + // KHotKeys::Module::changed() + connect( new_action_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( new_action_group_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( delete_action_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + setMaximumHeight( sizeHint().height()); // it gets too high and I have no idea why + } + +void Main_buttons_widget::enable_delete( bool enable_P ) + { + delete_action_button->setEnabled( enable_P ); + } + +} // namespace KHotKeys + +#include "main_buttons_widget.moc" diff --git a/khotkeys/kcontrol/main_buttons_widget.h b/khotkeys/kcontrol/main_buttons_widget.h new file mode 100644 index 000000000..e4410d9d0 --- /dev/null +++ b/khotkeys/kcontrol/main_buttons_widget.h @@ -0,0 +1,39 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef MAIN_BUTTONS_WIDGET_H +#define MAIN_BUTTONS_WIDGET_H + +#include <main_buttons_widget_ui.h> + +namespace KHotKeys +{ + +class Main_buttons_widget + : public Main_buttons_widget_ui + { + Q_OBJECT + public: + Main_buttons_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); + void enable_delete( bool enable_P ); + signals: + void new_action_pressed(); + void new_action_group_pressed(); + void delete_action_pressed(); + void global_settings_pressed(); + }; + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/menuedit.cpp b/khotkeys/kcontrol/menuedit.cpp new file mode 100644 index 000000000..08b8a3c22 --- /dev/null +++ b/khotkeys/kcontrol/menuedit.cpp @@ -0,0 +1,359 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +// BEWARE ! unbelievably messy code + +#define _MENUEDIT_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "menuedit.h" + +#include <tdeglobal.h> +#include <tdelocale.h> +#include <tdeaccel.h> +#include <tdeapplication.h> +#include <dcopclient.h> +#include <tqlabel.h> +#include <tqlineedit.h> +#include <tqlayout.h> +#include <kkeydialog.h> + +#include <settings.h> +#include <action_data.h> + +namespace KHotKeys +{ + +static TQObject* owner = NULL; + +void khotkeys_init() + { + // I hope this works + TDEGlobal::locale()->insertCatalogue("khotkeys"); + // CHECKME hack + assert( owner == NULL ); + owner = new TQObject; + init_global_data( false, owner ); + } + +void khotkeys_cleanup() + { + delete owner; + owner = NULL; + } + +Menuentry_shortcut_action_data* khotkeys_get_menu_entry_internal2( + const Action_data_group* data_P, const TQString& entry_P ) + { + if( !data_P->enabled( false )) + return NULL; + for( Action_data_group::Iterator it = data_P->first_child(); + it; + ++it ) + { + if( !(*it)->enabled( true )) + continue; + if( Menuentry_shortcut_action_data* entry + = dynamic_cast< Menuentry_shortcut_action_data* >( *it )) + { + KService::Ptr service = entry->action() ? entry->action()->service() : KService::Ptr(0); + if ( service && (service->storageId() == entry_P) ) + return entry; + } + if( Action_data_group* group = dynamic_cast< Action_data_group* >( *it )) + { + Menuentry_shortcut_action_data* data + = khotkeys_get_menu_entry_internal2( group, entry_P ); + if( data != NULL ) + return data; + } + } + return NULL; + } + +Action_data_group* khotkeys_get_menu_root( Action_data_group* data_P ) + { + for( Action_data_group::Iterator it = data_P->first_child(); + it; + ++it ) + if( Action_data_group* group = dynamic_cast< Action_data_group* >( *it )) + { + if( group->system_group() == Action_data_group::SYSTEM_MENUENTRIES ) + return group; + } + return new Action_data_group( data_P, i18n( MENU_EDITOR_ENTRIES_GROUP_NAME ), + i18n( "These entries were created using Menu Editor." ), new Condition_list( "", NULL ), // CHECKME tenhle condition list + Action_data_group::SYSTEM_MENUENTRIES, true ); + } + +Menuentry_shortcut_action_data* khotkeys_get_menu_entry_internal( Action_data_group* data_P, + const TQString& entry_P ) + { + return khotkeys_get_menu_entry_internal2( khotkeys_get_menu_root( data_P ), entry_P ); + } + +TQString khotkeys_get_menu_shortcut( Menuentry_shortcut_action_data* data_P ) + { + if( data_P->trigger() != NULL ) + return data_P->trigger()->shortcut().toString(); + return ""; + } + +void khotkeys_get_all_shortcuts_internal(const Action_data_group* data_P, TQStringList &result) + { + if( !data_P->enabled( false )) + return; + for( Action_data_group::Iterator it = data_P->first_child(); + it; + ++it ) + { + if( !(*it)->enabled( true )) + continue; + if( Menuentry_shortcut_action_data* entry + = dynamic_cast< Menuentry_shortcut_action_data* >( *it )) + { + if (entry->trigger() && !entry->trigger()->shortcut().isNull()) + result.append(entry->trigger()->shortcut().toString()); + } + if( Action_data_group* group = dynamic_cast< Action_data_group* >( *it )) + { + khotkeys_get_all_shortcuts_internal( group, result ); + } + } + } + + +TQStringList khotkeys_get_all_shortcuts( ) + { + TQStringList result; + Settings settings; + settings.read_settings( true ); + + khotkeys_get_all_shortcuts_internal(settings.actions, result); + + return result; + } + + +KService::Ptr khotkeys_find_menu_entry_internal(const Action_data_group* data_P, const TQString &shortcut_P) + { + if( !data_P->enabled( false )) + return 0; + for( Action_data_group::Iterator it = data_P->first_child(); + it; + ++it ) + { + if( !(*it)->enabled( true )) + continue; + if( Menuentry_shortcut_action_data* entry + = dynamic_cast< Menuentry_shortcut_action_data* >( *it )) + { + if (entry->trigger() && + entry->trigger()->shortcut().toString() == shortcut_P) + { + if (entry->action()) + return entry->action()->service(); + return 0; + } + } + if( Action_data_group* group = dynamic_cast< Action_data_group* >( *it )) + { + KService::Ptr result = khotkeys_find_menu_entry_internal( group, shortcut_P ); + if (result) + return result; + } + } + return 0; + } + + +KService::Ptr khotkeys_find_menu_entry( const TQString& shortcut_P ) + { + Settings settings; + settings.read_settings( true ); + + return khotkeys_find_menu_entry_internal(settings.actions, shortcut_P); + } + + +void khotkeys_send_reread_config() + { + TQByteArray data; + if( !kapp->dcopClient()->isAttached()) + kapp->dcopClient()->attach(); + if( !kapp->dcopClient()->isApplicationRegistered( "khotkeys" )) + { + kdDebug( 1217 ) << "launching new khotkeys daemon" << endl; + TDEApplication::tdeinitExec( "khotkeys" ); + } + else + { + TQByteArray data; + kapp->dcopClient()->send( "khotkeys*", "khotkeys", "reread_configuration()", data ); + kdDebug( 1217 ) << "telling khotkeys daemon to reread configuration" << endl; + } + } + +TQString khotkeys_get_menu_entry_shortcut( const TQString& entry_P ) + { + Settings settings; + settings.read_settings( true ); + Menuentry_shortcut_action_data* entry + = khotkeys_get_menu_entry_internal( settings.actions, entry_P ); + if( entry == NULL ) + { + delete settings.actions; + return ""; + } + TQString shortcut = khotkeys_get_menu_shortcut( entry ); + delete settings.actions; + return shortcut; + } + +bool khotkeys_menu_entry_moved( const TQString& new_P, const TQString& old_P ) + { + Settings settings; + settings.read_settings( true ); + Menuentry_shortcut_action_data* entry + = khotkeys_get_menu_entry_internal( settings.actions, old_P ); + if( entry == NULL ) + { + delete settings.actions; + return false; + } + Action_data_group* parent = entry->parent(); + TQString new_name = new_P; + if( entry->name().startsWith( i18n( "TDE Menu - " ))) + new_name = i18n( "TDE Menu - " ) + new_P; + Menuentry_shortcut_action_data* new_entry = new Menuentry_shortcut_action_data( parent, + new_name, entry->comment(), entry->enabled( true )); + new_entry->set_trigger( entry->trigger()->copy( new_entry )); + new_entry->set_action( new Menuentry_action( new_entry, new_P )); + delete entry; + settings.write_settings(); + delete settings.actions; + khotkeys_send_reread_config(); + return true; + } + +void khotkeys_menu_entry_deleted( const TQString& entry_P ) + { + Settings settings; + settings.read_settings( true ); + Menuentry_shortcut_action_data* entry + = khotkeys_get_menu_entry_internal( settings.actions, entry_P ); + if( entry == NULL ) + { + delete settings.actions; + return; + } + delete entry; + settings.write_settings(); + delete settings.actions; + khotkeys_send_reread_config(); + } + +TQString khotkeys_change_menu_entry_shortcut( const TQString& entry_P, + const TQString& shortcut_P ) + { + Settings settings; + settings.read_settings( true ); + Menuentry_shortcut_action_data* entry + = khotkeys_get_menu_entry_internal( settings.actions, entry_P ); + bool new_entry = ( entry == NULL ); + if( new_entry ) + { + entry = new Menuentry_shortcut_action_data( NULL, i18n( "TDE Menu - " ) + entry_P, + "" ); + entry->set_action( new Menuentry_action( entry, entry_P )); + } + else + { + // erase the trigger, i.e. replace with a copy with no trigger and no parent yet + Menuentry_shortcut_action_data* entry_tmp = new Menuentry_shortcut_action_data( NULL, + entry->name(), entry->comment(), entry->enabled( false )); + entry_tmp->set_action( new Menuentry_action( entry_tmp, entry_P )); + delete entry; + entry = entry_tmp; + } + TQString shortcut = ""; + // make sure the shortcut is valid + shortcut = (TDEShortcut( shortcut_P )).toStringInternal(); + if( !shortcut.isEmpty()) + entry->set_trigger( new Shortcut_trigger( entry, TDEShortcut( shortcut ))); + if( shortcut.isEmpty()) + { + delete entry; + if( !new_entry ) // remove from config file + { + settings.write_settings(); + khotkeys_send_reread_config(); + } + delete settings.actions; + return ""; + } + entry->reparent( khotkeys_get_menu_root( settings.actions )); + settings.daemon_disabled = false; // #91782 + settings.write_settings(); + khotkeys_send_reread_config(); + return shortcut; + } + +// CHECKME nejaka forma kontroly, ze tahle kl. kombinace neni pouzita pro jiny menuentry ? + +} // namespace KHotKeys + +// +// exported functions +// + +void khotkeys_init() + { + KHotKeys::khotkeys_init(); + } + +void khotkeys_cleanup() + { + KHotKeys::khotkeys_cleanup(); + } + +TQString khotkeys_get_menu_entry_shortcut( const TQString& entry_P ) + { + return KHotKeys::khotkeys_get_menu_entry_shortcut( entry_P ); + } + +bool khotkeys_menu_entry_moved( const TQString& new_P, const TQString& old_P ) + { + return KHotKeys::khotkeys_menu_entry_moved( new_P, old_P ); + } + +void khotkeys_menu_entry_deleted( const TQString& entry_P ) + { + KHotKeys::khotkeys_menu_entry_deleted( entry_P ); + } + +TQString khotkeys_change_menu_entry_shortcut( const TQString& entry_P, + const TQString& shortcut_P ) + { + return KHotKeys::khotkeys_change_menu_entry_shortcut( entry_P, shortcut_P ); + } + +TQStringList khotkeys_get_all_shortcuts( ) + { + return KHotKeys::khotkeys_get_all_shortcuts(); + } + +KService::Ptr khotkeys_find_menu_entry( const TQString& shortcut_P ) + { + return KHotKeys::khotkeys_find_menu_entry( shortcut_P ); + } diff --git a/khotkeys/kcontrol/menuedit.h b/khotkeys/kcontrol/menuedit.h new file mode 100644 index 000000000..f7aa43436 --- /dev/null +++ b/khotkeys/kcontrol/menuedit.h @@ -0,0 +1,44 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _MENUEDIT_H_ +#define _MENUEDIT_H_ + +#include <tqstring.h> +#include <kdialogbase.h> +#include <tdeaccel.h> +#include <kservice.h> + +// see also tdebase/kmenuedit/khotkeys.h +extern "C" + { +// initializes khotkeys DSO - loads i18n catalogue +// handled automatically by KHotKeys wrapper class in kmenuedit +KDE_EXPORT void khotkeys_init( void ); +// clean up khotkeys DSO +// handled automatically by KHotKeys wrapper class in kmenuedit +KDE_EXPORT void khotkeys_cleanup( void ); +// return keyboard shortcut ( e.g. "ALT+T" ) for given menu entry ( e.g. +// "System/Konsole.desktop" +KDE_EXPORT TQString khotkeys_get_menu_entry_shortcut( const TQString& entry_P ); +// changes assigned shortcut to menu entry a updates config file +KDE_EXPORT TQString khotkeys_change_menu_entry_shortcut( const TQString& entry_P, + const TQString& shortcut_P ); +// menu entry was moved in TDE Menu +KDE_EXPORT bool khotkeys_menu_entry_moved( const TQString& new_P, const TQString& old_P ); +// menu entry was removed +KDE_EXPORT void khotkeys_menu_entry_deleted( const TQString& entry_P ); +// List of all hotkeys in use +KDE_EXPORT TQStringList khotkeys_get_all_shortcuts( ); +// Find menu entry that uses shortcut +KDE_EXPORT KService::Ptr khotkeys_find_menu_entry( const TQString& shortcut_P ); + } // extern "C" + +#endif diff --git a/khotkeys/kcontrol/menuentry_widget.cpp b/khotkeys/kcontrol/menuentry_widget.cpp new file mode 100644 index 000000000..9b313d20d --- /dev/null +++ b/khotkeys/kcontrol/menuentry_widget.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _MENUENTRY_WIDGET_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "menuentry_widget.h" + +#include <tqpushbutton.h> +#include <tqlineedit.h> +#include <tqcheckbox.h> +#include <tqgroupbox.h> + +#include <kdebug.h> + +#include <actions.h> +#include <action_data.h> + +#include "windowdef_list_widget.h" +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +Menuentry_widget::Menuentry_widget( TQWidget* parent_P, const char* name_P ) + : Menuentry_widget_ui( parent_P, name_P ) + { + clear_data(); + // KHotKeys::Module::changed() + connect( menuentry_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + } + +void Menuentry_widget::clear_data() + { + menuentry_lineedit->clear(); + } + +void Menuentry_widget::set_data( const Menuentry_action* data_P ) + { + if( data_P == NULL ) + { + clear_data(); + return; + } + menuentry_lineedit->setText( data_P->command_url()); + } + +Menuentry_action* Menuentry_widget::get_data( Action_data* data_P ) const + { + return new Menuentry_action( data_P, menuentry_lineedit->text()); + } + +void Menuentry_widget::browse_pressed() + { // CHECKME TODO + } + +} // namespace KHotKeys + +#include "menuentry_widget.moc" diff --git a/khotkeys/kcontrol/menuentry_widget.h b/khotkeys/kcontrol/menuentry_widget.h new file mode 100644 index 000000000..f4b61677d --- /dev/null +++ b/khotkeys/kcontrol/menuentry_widget.h @@ -0,0 +1,44 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _MENUENTRY_WIDGET_H_ +#define _MENUENTRY_WIDGET_H_ + +#include <menuentry_widget_ui.h> + +namespace KHotKeys +{ + +class Menuentry_action; +class Action_data; + +class Menuentry_widget + : public Menuentry_widget_ui + { + Q_OBJECT + public: + Menuentry_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); + void set_data( const Menuentry_action* data_P ); + Menuentry_action* get_data( Action_data* data_P ) const; + public slots: + void clear_data(); + protected slots: + virtual void browse_pressed(); + }; + +typedef Menuentry_widget Menuentry_tab; + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/tab_widget.cpp b/khotkeys/kcontrol/tab_widget.cpp new file mode 100644 index 000000000..d3ca4afbe --- /dev/null +++ b/khotkeys/kcontrol/tab_widget.cpp @@ -0,0 +1,484 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _TAB_WIDGET_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "tab_widget.h" + +#include <typeinfo> + +#include <tdelocale.h> +#include <kdebug.h> + +#include <actions.h> +#include <action_data.h> + +#include "general_tab.h" +#include "action_group_tab.h" +#include "windowdef_list_widget.h" +#include "menuentry_widget.h" +#include "command_url_widget.h" +#include "dcop_widget.h" +#include "triggers_tab.h" +#include "info_tab.h" +#include "action_list_widget.h" +#include "keyboard_input_widget.h" +#include "kcmkhotkeys.h" +#include "condition_list_widget.h" +#include "gesture_triggers_tab.h" +#include "gestures_settings_tab.h" +#include "general_settings_tab.h" +#include "voice_settings_tab.h" + +// CHECKME +//nejak lip ty typeid +//asi spis udelat funkci, ktera vrati enum a pak tam mit switche, tak se zajisti, ze se nikde +//nezapomene + +// CHECKME mozna nejak lepe to poradi tabu, takhle je to podle jejich poradi v enum + +namespace KHotKeys +{ + +Tab_widget::Tab_widget( TQWidget* parent_P, const char* name_P ) + : TQTabWidget( parent_P, name_P ) + { + pages[ TAB_INFO ] = new Info_tab; + pages[ TAB_GENERAL_SETTINGS ] = new General_settings_tab; + pages[ TAB_GESTURES_SETTINGS ] = new Gestures_settings_tab; + General_tab* general_tab; + pages[ TAB_GENERAL ] = general_tab = new General_tab; + connect( general_tab, TQT_SIGNAL( action_type_changed( int )), + TQT_SLOT( set_action_type_slot( int ))); + pages[ TAB_GROUP_GENERAL ] = new Action_group_tab; + pages[ TAB_CONDITIONS ] = new Condition_list_tab; + pages[ TAB_ACTIONS ] = new Action_list_tab; + pages[ TAB_TRIGGERS ] = new Triggers_tab; + pages[ TAB_SHORTCUT_TRIGGER ] = new Shortcut_trigger_tab; + pages[ TAB_GESTURE_TRIGGER ] = new Gesture_triggers_tab; + pages[ TAB_COMMAND_URL ] = new Command_url_tab; + pages[ TAB_MENUENTRY ] = new Menuentry_tab; + pages[ TAB_DCOP ] = new Dcop_tab; + pages[ TAB_KEYBOARD_INPUT ] = new Keyboard_input_tab; + pages[ TAB_WINDOW ] = new Windowdef_list_tab; + pages[ TAB_VOICE_SETTINGS ] = new Voice_settings_tab; + for( tab_pos_t i = TAB_FIRST; + i < TAB_END; + ++i ) + connect( this, TQT_SIGNAL( clear_pages_signal()), pages[ i ], TQT_SLOT( clear_data())); +#ifdef HAVE_ARTS + if( haveArts()) + show_pages(( TAB_INFO, TAB_GENERAL_SETTINGS, TAB_GESTURES_SETTINGS, TAB_VOICE_SETTINGS )); + else +#endif + show_pages(( TAB_INFO, TAB_GENERAL_SETTINGS, TAB_GESTURES_SETTINGS )); + current_type = NONE; + current_data_type = TYPE_GENERIC; + } + +Tab_widget::~Tab_widget() + { + for( tab_pos_t i = TAB_FIRST; + i < TAB_END; + ++i ) + { + removePage( pages[ i ] ); + delete pages[ i ]; + } + } + +void Tab_widget::save_current_action_changes() + { + if( current_type == NONE ) // info, global settings + { + static_cast< Gestures_settings_tab* >( pages[ TAB_GESTURES_SETTINGS ] )->write_data(); // saves + static_cast< General_settings_tab* >( pages[ TAB_GENERAL_SETTINGS ] )->write_data(); // saves + static_cast< Voice_settings_tab* >( pages[ TAB_VOICE_SETTINGS ] )->write_data(); // saves + } + else if( current_type == GROUP ) + { + Action_data_group* old = + static_cast< Action_data_group* >( module->current_action_data()); + Action_data_group* item = + static_cast< Action_group_tab* >( pages[ TAB_GROUP_GENERAL ] )->get_data( + module->current_action_data()->parent(), NULL ); + item->set_conditions( static_cast< Condition_list_tab* >( pages[ TAB_CONDITIONS ] ) + ->get_data( item )); + for( Action_data_group::Iterator it = old->first_child(); + it; + ) + { + Action_data_base* tmp = ( *it ); + ++it; // the items will be removed from the list, so better be carefull + tmp->reparent( item ); + } + module->set_current_action_data( item ); + } + else if( current_type == DATA ) + { + TQString name, comment; + bool enabled; + static_cast< General_tab* >( pages[ TAB_GENERAL ] )->get_data( name, comment, enabled ); + switch( current_data_type ) + { + case TYPE_GENERIC: + { + Generic_action_data* tmp = new Generic_action_data( + module->current_action_data()->parent(), name, comment, NULL, NULL, NULL, + enabled ); + tmp->set_triggers( + static_cast< Triggers_tab* >( pages[ TAB_TRIGGERS ] )->get_data( tmp )); + tmp->set_conditions( static_cast< Condition_list_tab* > + ( pages[ TAB_CONDITIONS ] )->get_data( tmp )); + tmp->set_actions( + static_cast< Action_list_tab* >( pages[ TAB_ACTIONS ] )->get_data( tmp )); + module->set_current_action_data( tmp ); + break; + } + case TYPE_COMMAND_URL_SHORTCUT: + { + Command_url_shortcut_action_data* tmp = new Command_url_shortcut_action_data( + module->current_action_data()->parent(), name, comment, enabled ); + tmp->set_trigger( + static_cast< Shortcut_trigger_tab* >( pages[ TAB_SHORTCUT_TRIGGER ] ) + ->get_data( tmp )); + tmp->set_action( + static_cast< Command_url_tab* >( pages[ TAB_COMMAND_URL ] )->get_data( tmp )); + module->set_current_action_data( tmp ); + break; + } + case TYPE_MENUENTRY_SHORTCUT: + { + Menuentry_shortcut_action_data* tmp = new Menuentry_shortcut_action_data( + module->current_action_data()->parent(), name, comment, enabled ); + tmp->set_trigger( + static_cast< Shortcut_trigger_tab* >( pages[ TAB_SHORTCUT_TRIGGER ] ) + ->get_data( tmp )); + tmp->set_action( + static_cast< Menuentry_tab* >( pages[ TAB_MENUENTRY ] )->get_data( tmp )); + module->set_current_action_data( tmp ); + break; + } + case TYPE_DCOP_SHORTCUT: + { + Dcop_shortcut_action_data* tmp = new Dcop_shortcut_action_data( + module->current_action_data()->parent(), name, comment, enabled ); + tmp->set_trigger( + static_cast< Shortcut_trigger_tab* >( pages[ TAB_SHORTCUT_TRIGGER ] ) + ->get_data( tmp )); + tmp->set_action( + static_cast< Dcop_tab* >( pages[ TAB_DCOP ] )->get_data( tmp )); + module->set_current_action_data( tmp ); + break; + } + case TYPE_KEYBOARD_INPUT_SHORTCUT: + { + Keyboard_input_shortcut_action_data* tmp + = new Keyboard_input_shortcut_action_data( + module->current_action_data()->parent(), name, comment, enabled ); + tmp->set_trigger( + static_cast< Shortcut_trigger_tab* >( pages[ TAB_SHORTCUT_TRIGGER ] ) + ->get_data( tmp )); + tmp->set_action( static_cast< Keyboard_input_tab* > + ( pages[ TAB_KEYBOARD_INPUT ] )->get_data( tmp )); + module->set_current_action_data( tmp ); + break; + } + case TYPE_KEYBOARD_INPUT_GESTURE: + { + Keyboard_input_gesture_action_data* tmp + = new Keyboard_input_gesture_action_data( + module->current_action_data()->parent(), name, comment, enabled ); + tmp->set_triggers( + static_cast< Gesture_triggers_tab* >( pages[ TAB_GESTURE_TRIGGER ] ) + ->get_data( tmp )); + tmp->set_action( static_cast< Keyboard_input_tab* > + ( pages[ TAB_KEYBOARD_INPUT ] )->get_data( tmp )); + module->set_current_action_data( tmp ); + break; + } + case TYPE_ACTIVATE_WINDOW_SHORTCUT: + { + Activate_window_shortcut_action_data* tmp + = new Activate_window_shortcut_action_data( + module->current_action_data()->parent(), name, comment, enabled ); + tmp->set_trigger( + static_cast< Shortcut_trigger_tab* >( pages[ TAB_SHORTCUT_TRIGGER ] ) + ->get_data( tmp )); + tmp->set_action( new Activate_window_action( tmp, + static_cast< Windowdef_list_tab* > + ( pages[ TAB_WINDOW ] )->get_data())); + module->set_current_action_data( tmp ); + break; + } + case TYPE_END: + assert( false ); + } + } + } + +void Tab_widget::load_current_action() + { + check_action_type(); + if( current_type == NONE ) // info, global settings + { + static_cast< Gestures_settings_tab* >( pages[ TAB_GESTURES_SETTINGS ] )->read_data(); // loads + static_cast< Voice_settings_tab* >( pages[ TAB_VOICE_SETTINGS ] )->read_data(); // loads + static_cast< General_settings_tab* >( pages[ TAB_GENERAL_SETTINGS ] )->read_data(); // loads + } + else if( current_type == GROUP ) + { + static_cast< Action_group_tab* >( pages[ TAB_GROUP_GENERAL ] )->set_data( + static_cast< Action_data_group* >( module->current_action_data())); + static_cast< Condition_list_tab* >( pages[ TAB_CONDITIONS ] ) + ->set_data( module->current_action_data()->conditions()); + } + else if( current_type == DATA ) + { + Action_data* tmp = static_cast< Action_data* >( module->current_action_data()); + switch( current_data_type ) + { + case TYPE_GENERIC: + kdDebug( 1217 ) << "loading unknown" << endl; + static_cast< General_tab* >( pages[ TAB_GENERAL ] )->set_data( tmp ); + static_cast< Condition_list_tab* >( pages[ TAB_CONDITIONS ] ) + ->set_data( tmp->conditions()); + static_cast< Triggers_tab* >( pages[ TAB_TRIGGERS ] )->set_data( tmp->triggers()); + static_cast< Action_list_tab* >( pages[ TAB_ACTIONS ] )->set_data( + tmp->actions()); + break; + case TYPE_COMMAND_URL_SHORTCUT: + { + kdDebug( 1217 ) << "loading command_url_shortcut" << endl; + Command_url_shortcut_action_data* item + = static_cast< Command_url_shortcut_action_data* >( tmp ); + static_cast< General_tab* >( pages[ TAB_GENERAL ] )->set_data( item ); + static_cast< Shortcut_trigger_tab* >( pages[ TAB_SHORTCUT_TRIGGER ] ) + ->set_data( item->trigger()); + static_cast< Command_url_tab* >( pages[ TAB_COMMAND_URL ] )->set_data( + item->action()); + break; + } + case TYPE_MENUENTRY_SHORTCUT: + { + kdDebug( 1217 ) << "loading menuentry_shortcut" << endl; + Menuentry_shortcut_action_data* item + = static_cast< Menuentry_shortcut_action_data* >( tmp ); + static_cast< General_tab* >( pages[ TAB_GENERAL ] )->set_data( item ); + static_cast< Shortcut_trigger_tab* >( pages[ TAB_SHORTCUT_TRIGGER ] ) + ->set_data( item->trigger()); + static_cast< Menuentry_tab* >( pages[ TAB_MENUENTRY ] )->set_data( + item->action()); + break; + } + case TYPE_DCOP_SHORTCUT: + { + kdDebug( 1217 ) << "loading dcop_shortcut" << endl; + Dcop_shortcut_action_data* item + = static_cast< Dcop_shortcut_action_data* >( tmp ); + static_cast< General_tab* >( pages[ TAB_GENERAL ] )->set_data( item ); + static_cast< Shortcut_trigger_tab* >( pages[ TAB_SHORTCUT_TRIGGER ] ) + ->set_data( item->trigger()); + static_cast< Dcop_tab* >( pages[ TAB_DCOP ] )->set_data( + item->action()); + break; + } + case TYPE_KEYBOARD_INPUT_SHORTCUT: + { + kdDebug( 1217 ) << "loading keyboard_input_shortcut" << endl; + Keyboard_input_shortcut_action_data* item + = static_cast< Keyboard_input_shortcut_action_data* >( tmp ); + static_cast< General_tab* >( pages[ TAB_GENERAL ] )->set_data( item ); + static_cast< Shortcut_trigger_tab* >( pages[ TAB_SHORTCUT_TRIGGER ] ) + ->set_data( item->trigger()); + static_cast< Keyboard_input_tab* >( pages[ TAB_KEYBOARD_INPUT ] )->set_data( + item->action()); + break; + } + case TYPE_KEYBOARD_INPUT_GESTURE: + { + kdDebug( 1217 ) << "loading keyboard_input_gesture" << endl; + Keyboard_input_gesture_action_data* item + = static_cast< Keyboard_input_gesture_action_data* >( tmp ); + static_cast< General_tab* >( pages[ TAB_GENERAL ] )->set_data( item ); + static_cast< Gesture_triggers_tab* >( pages[ TAB_GESTURE_TRIGGER ] ) + ->set_data( item->triggers()); + static_cast< Keyboard_input_tab* >( pages[ TAB_KEYBOARD_INPUT ] )->set_data( + item->action()); + break; + } + case TYPE_ACTIVATE_WINDOW_SHORTCUT: + { + kdDebug( 1217 ) << "loading activate_window_shortcut" << endl; + Activate_window_shortcut_action_data* item + = static_cast< Activate_window_shortcut_action_data* >( tmp ); + static_cast< General_tab* >( pages[ TAB_GENERAL ] )->set_data( item ); + static_cast< Shortcut_trigger_tab* >( pages[ TAB_SHORTCUT_TRIGGER ] ) + ->set_data( item->trigger()); + static_cast< Windowdef_list_tab* >( pages[ TAB_WINDOW ] )->set_data( + item->action()->window()); + break; + } + case TYPE_END: + assert( false ); + } + } + } + +void Tab_widget::check_action_type() + { + if( module->current_action_data() == NULL ) + { + kdDebug( 1217 ) << "setting none" << endl; + if( current_type == NONE ) + return; +#ifdef HAVE_ARTS + if( haveArts()) + show_pages(( TAB_INFO, TAB_GENERAL_SETTINGS, TAB_GESTURES_SETTINGS, TAB_VOICE_SETTINGS )); + else +#endif + show_pages(( TAB_INFO, TAB_GENERAL_SETTINGS, TAB_GESTURES_SETTINGS )); + current_type = NONE; + return; + } + if( dynamic_cast< Action_data_group* >( module->current_action_data()) != NULL ) + { // Action_data_group + kdDebug( 1217 ) << "setting group" << endl; + if( current_type == GROUP ) + return; + show_pages(( TAB_GROUP_GENERAL, TAB_CONDITIONS )); + current_type = GROUP; + return; + } + else // standard action + { + action_type_t is_type = + type( static_cast< Action_data* >( module->current_action_data())); + kdDebug( 1217 ) << "setting data " << is_type << endl; + if( current_type == DATA && is_type == current_data_type ) + return; + current_type = DATA; + set_action_type( is_type, true ); + return; + } + } + +void Tab_widget::set_action_type( action_type_t type_P, bool force_P ) + { + assert( current_type == DATA ); + if( current_data_type == type_P && !force_P ) + return; + current_data_type = type_P; + switch( type_P ) + { + case TYPE_GENERIC: + show_pages(( TAB_GENERAL, TAB_TRIGGERS, TAB_ACTIONS, TAB_CONDITIONS )); + break; + case TYPE_COMMAND_URL_SHORTCUT: + show_pages(( TAB_GENERAL, TAB_SHORTCUT_TRIGGER, TAB_COMMAND_URL )); + break; + case TYPE_MENUENTRY_SHORTCUT: + show_pages(( TAB_GENERAL, TAB_SHORTCUT_TRIGGER, TAB_MENUENTRY )); + break; + case TYPE_DCOP_SHORTCUT: + show_pages(( TAB_GENERAL, TAB_SHORTCUT_TRIGGER, TAB_DCOP )); + break; + case TYPE_KEYBOARD_INPUT_SHORTCUT: + show_pages(( TAB_GENERAL, TAB_SHORTCUT_TRIGGER, TAB_KEYBOARD_INPUT )); + break; + case TYPE_KEYBOARD_INPUT_GESTURE: + show_pages(( TAB_GENERAL, TAB_GESTURE_TRIGGER, TAB_KEYBOARD_INPUT )); + break; + case TYPE_ACTIVATE_WINDOW_SHORTCUT: + show_pages(( TAB_GENERAL, TAB_SHORTCUT_TRIGGER, TAB_WINDOW )); + break; + case TYPE_END: + assert( false ); + } + } + +void Tab_widget::set_action_type_slot( int type_P ) + { + set_action_type( static_cast< action_type_t >( type_P )); + } + +const char* const Tab_widget::tab_labels[ Tab_widget::TAB_END ] = { + I18N_NOOP( "Info" ), // TAB_INFO + I18N_NOOP( "General Settings" ), // TAB_GENERAL_SETTINGS + I18N_NOOP( "Gestures Settings" ), // TAB_GESTURES_SETTINGS + I18N_NOOP( "General" ), // TAB_GENERAL + I18N_NOOP( "General" ), // TAB_GROUP_GENERAL + I18N_NOOP( "Triggers" ), // TAB_TRIGGERS + I18N_NOOP( "Keyboard Shortcut" ), // TAB_SHORTCUT_TRIGGER + I18N_NOOP( "Gestures" ), // TAB_GESTURE_TRIGGER + I18N_NOOP( "Actions" ), // TAB_ACTIONS + I18N_NOOP( "Command/URL Settings" ), // TAB_COMMAND_URL + I18N_NOOP( "Menu Entry Settings" ), // TAB_MENUENTRY + I18N_NOOP( "DCOP Call Settings" ), // TAB_DCOP + I18N_NOOP( "Keyboard Input Settings" ), // TAB_KEYBOARD_INPUT + I18N_NOOP( "Window" ), // TAB_WINDOW + I18N_NOOP( "Conditions" ), // TAB_CONDITIONS + I18N_NOOP( "Voices Settings" ) // TAB_VOICE_SETTINGS + }; + +void Tab_widget::show_pages( const Pages_set& pages_P ) + { + hide(); // this seems to be necessary, otherwise it's not repainter properly + for( tab_pos_t i = TAB_FIRST; + i < TAB_END; + ++i ) + { + removePage( pages[ i ] ); + if( pages_P.is_set( i )) // don't clear page contents if it stays visible + disconnect( this, TQT_SIGNAL( clear_pages_signal()), pages[ i ], TQT_SLOT( clear_data())); + } + clear_pages(); + // reconnect all pages to this signal + disconnect( this, TQT_SIGNAL( clear_pages_signal()), NULL, NULL ); + for( tab_pos_t i = TAB_FIRST; + i < TAB_END; + ++i ) + { + if( pages_P.is_set( i )) + addTab( pages[ i ], i18n( tab_labels[ i ] )); + connect( this, TQT_SIGNAL( clear_pages_signal()), pages[ i ], TQT_SLOT( clear_data())); + } + show(); + } + +Tab_widget::action_type_t Tab_widget::type( const Action_data* data_P ) + { + Tab_widget::action_type_t ret = Tab_widget::TYPE_GENERIC; + if( typeid( *data_P ) == typeid( Generic_action_data )) + ret = Tab_widget::TYPE_GENERIC; + else if( typeid( *data_P ) == typeid( Command_url_shortcut_action_data )) + ret = Tab_widget::TYPE_COMMAND_URL_SHORTCUT; + else if( typeid( *data_P ) == typeid( Menuentry_shortcut_action_data )) + ret = Tab_widget::TYPE_MENUENTRY_SHORTCUT; + else if( typeid( *data_P ) == typeid( Dcop_shortcut_action_data )) + ret = Tab_widget::TYPE_DCOP_SHORTCUT; + else if( typeid( *data_P ) == typeid( Keyboard_input_shortcut_action_data )) + ret = Tab_widget::TYPE_KEYBOARD_INPUT_SHORTCUT; + else if( typeid( *data_P ) == typeid( Keyboard_input_gesture_action_data )) + ret = Tab_widget::TYPE_KEYBOARD_INPUT_GESTURE; + else if( typeid( *data_P ) == typeid( Activate_window_shortcut_action_data )) + ret = Tab_widget::TYPE_ACTIVATE_WINDOW_SHORTCUT; + else + assert( false ); + return ret; + } + +} // namespace KHotKeys + +#include "tab_widget.moc" diff --git a/khotkeys/kcontrol/tab_widget.h b/khotkeys/kcontrol/tab_widget.h new file mode 100644 index 000000000..81fb9e4ad --- /dev/null +++ b/khotkeys/kcontrol/tab_widget.h @@ -0,0 +1,136 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _TAB_WIDGET_H_ +#define _TAB_WIDGET_H_ + +#include <tqtabwidget.h> + +#include <actions.h> + +namespace KHotKeys +{ + +class Tab_widget + : public TQTabWidget + { + Q_OBJECT + public: + enum action_type_t + { + TYPE_FIRST, + TYPE_GENERIC = TYPE_FIRST, + TYPE_COMMAND_URL_SHORTCUT, + TYPE_MENUENTRY_SHORTCUT, + TYPE_DCOP_SHORTCUT, + TYPE_KEYBOARD_INPUT_SHORTCUT, + TYPE_KEYBOARD_INPUT_GESTURE, + TYPE_ACTIVATE_WINDOW_SHORTCUT, + TYPE_END + }; + Tab_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); + virtual ~Tab_widget(); + void set_action_type( action_type_t type_P, bool force_P = false ); + void save_current_action_changes(); + void load_current_action(); + void clear_pages(); + static action_type_t type( const Action_data* data_P ); + signals: // internal + void clear_pages_signal(); + protected slots: + void set_action_type_slot( int type_P ); + protected: + void check_action_type(); + class Pages_set; + void show_pages( const Pages_set& pages_P ); + enum tab_pos_t { TAB_FIRST, TAB_INFO = TAB_FIRST, TAB_GENERAL_SETTINGS, TAB_GESTURES_SETTINGS, + TAB_GENERAL, TAB_GROUP_GENERAL, + TAB_TRIGGERS, TAB_SHORTCUT_TRIGGER, TAB_GESTURE_TRIGGER, TAB_ACTIONS, TAB_COMMAND_URL, + TAB_MENUENTRY, TAB_DCOP, TAB_KEYBOARD_INPUT, TAB_WINDOW, TAB_CONDITIONS, TAB_VOICE_SETTINGS, TAB_END }; + TQWidget* pages[ TAB_END ]; + enum tab_show_type_t { NONE, DATA, GROUP }; + tab_show_type_t current_type; + action_type_t current_data_type; + static const char* const tab_labels[]; + class Pages_set // that main reason for existence of this class is the fact that + { // I was very curious if overloading operator, ( = comma ) really + public: // works ( it does, but not exactly as I expected :( ) + Pages_set( tab_pos_t page_P ); + Pages_set& operator,( tab_pos_t page_P ); + bool is_set( tab_pos_t page_P ) const; + protected: + bool set[ TAB_END ]; + }; + friend Pages_set operator,( tab_pos_t page1_P, tab_pos_t page2_P ); // CHECKME + friend tab_pos_t& operator++( tab_pos_t& val_P ); // CHECKME + }; + +//*************************************************************************** +// Inline +//*************************************************************************** + +// Tab_widget + +// grrrr +inline +Tab_widget::tab_pos_t& operator++( Tab_widget::tab_pos_t& val_P ) + { + val_P = static_cast< Tab_widget::tab_pos_t >( val_P + 1 ); + return val_P; + } + +inline +void Tab_widget::clear_pages() + { + emit clear_pages_signal(); + } + +// Tab_widget::Pages_set + +inline +Tab_widget::Pages_set::Pages_set( tab_pos_t page_P ) + { + for( tab_pos_t i = TAB_FIRST; + i < TAB_END; + ++i ) + set[ i ] = false; + set[ page_P ] = true; + } + +inline +bool Tab_widget::Pages_set::is_set( tab_pos_t page_P ) const + { + return set[ page_P ]; + } + +inline +Tab_widget::Pages_set& Tab_widget::Pages_set::operator,( tab_pos_t page_P ) + { + set[ page_P ] = true; + return *this; + } + +inline +Tab_widget::Pages_set operator,( Tab_widget::tab_pos_t page1_P, Tab_widget::tab_pos_t page2_P ) + { + return Tab_widget::Pages_set( page1_P ), page2_P; + } + +// grrrr +inline +Tab_widget::action_type_t& operator++( Tab_widget::action_type_t& val_P ) + { + val_P = static_cast< Tab_widget::action_type_t >( val_P + 1 ); + return val_P; + } + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/triggers_tab.cpp b/khotkeys/kcontrol/triggers_tab.cpp new file mode 100644 index 000000000..d4f7ff9d3 --- /dev/null +++ b/khotkeys/kcontrol/triggers_tab.cpp @@ -0,0 +1,366 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _TRIGGERS_TAB_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "triggers_tab.h" + +#include <assert.h> +#include <tqpushbutton.h> +#include <tqlineedit.h> +#include <tqpopupmenu.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqheader.h> + +#include <kdebug.h> +#include <tdelocale.h> +#include <tdeapplication.h> +#include <tdeshortcut.h> +#include <tdeconfig.h> +#include <tdeshortcutlist.h> +#include <kkeybutton.h> +#include <kkeydialog.h> + +#include "kcmkhotkeys.h" +#include "windowdef_list_widget.h" +#include "window_trigger_widget.h" +#include "gesturerecordpage.h" +#include "voicerecordpage.h" + +namespace KHotKeys +{ + +// Triggers_tab + +Triggers_tab::Triggers_tab( TQWidget* parent_P, const char* name_P ) + : Triggers_tab_ui( parent_P, name_P ), selected_item( NULL ) + { + TQPopupMenu* popup = new TQPopupMenu; // CHECKME looks like setting parent doesn't work + popup->insertItem( i18n( "Shortcut Trigger..." ), TYPE_SHORTCUT_TRIGGER ); + popup->insertItem( i18n( "Gesture Trigger..." ), TYPE_GESTURE_TRIGGER ); + popup->insertItem( i18n( "Window Trigger..." ), TYPE_WINDOW_TRIGGER ); +#ifdef HAVE_ARTS + if( haveArts()) + popup->insertItem( i18n( "Voice Trigger..." ), TYPE_VOICE_TRIGGER ); +#endif + connect( popup, TQT_SIGNAL( activated( int )), TQT_SLOT( new_selected( int ))); + connect( triggers_listview, TQT_SIGNAL( doubleClicked ( TQListViewItem *, const TQPoint &, int ) ), + this, TQT_SLOT( modify_pressed() ) ); + + new_button->setPopup( popup ); + copy_button->setEnabled( false ); + modify_button->setEnabled( false ); + delete_button->setEnabled( false ); + triggers_listview->header()->hide(); + triggers_listview->addColumn( "" ); + triggers_listview->setSorting( -1 ); + triggers_listview->setForceSelect( true ); + clear_data(); + // KHotKeys::Module::changed() + connect( new_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( copy_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( modify_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( delete_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( comment_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + } + +Triggers_tab::~Triggers_tab() + { + delete new_button->popup(); // CHECKME + } + +void Triggers_tab::clear_data() + { + comment_lineedit->clear(); + triggers_listview->clear(); + } + +void Triggers_tab::set_data( const Trigger_list* data_P ) + { + if( data_P == NULL ) + { + clear_data(); + return; + } + comment_lineedit->setText( data_P->comment()); + Trigger_list_item* after = NULL; + triggers_listview->clear(); + for( Trigger_list::Iterator it( *data_P ); + *it; + ++it ) + after = create_listview_item( *it, triggers_listview, after, true ); + } + +Trigger_list* Triggers_tab::get_data( Action_data* data_P ) const + { + Trigger_list* list = new Trigger_list( comment_lineedit->text()); + for( TQListViewItem* pos = triggers_listview->firstChild(); + pos != NULL; + pos = pos->nextSibling()) + list->append( static_cast< Trigger_list_item* >( pos )->trigger()->copy( data_P )); + return list; + } + +void Triggers_tab::new_selected( int type_P ) + { + Trigger_dialog* dlg = NULL; + switch( type_P ) + { + case TYPE_SHORTCUT_TRIGGER: // Shortcut_trigger + dlg = new Shortcut_trigger_dialog( + new Shortcut_trigger( NULL, TDEShortcut())); // CHECKME NULL ? + break; + case TYPE_GESTURE_TRIGGER: // Gesture trigger + dlg = new Gesture_trigger_dialog( + new Gesture_trigger( NULL, TQString::null )); // CHECKME NULL ? + break; + case TYPE_WINDOW_TRIGGER: // Window trigger + dlg = new Window_trigger_dialog( new Window_trigger( NULL, new Windowdef_list( "" ), + 0 )); // CHECKME NULL ? + break; + case TYPE_VOICE_TRIGGER: // Voice trigger + dlg = new Voice_trigger_dialog( new Voice_trigger(NULL,TQString::null,VoiceSignature(),VoiceSignature())); // CHECKME NULL ? + break; + } + if( dlg != NULL ) + { + Trigger* trg = dlg->edit_trigger(); + if( trg != NULL ) + triggers_listview->setSelected( create_listview_item( trg, triggers_listview, + selected_item, false ), true ); + delete dlg; + } + } + +void Triggers_tab::copy_pressed() + { + if ( selected_item ) + { + triggers_listview->setSelected( create_listview_item( selected_item->trigger(),triggers_listview, selected_item, true ), true ); + } + } + +void Triggers_tab::delete_pressed() + { + delete selected_item; // CHECKME snad vyvola signaly pro enable() + selected_item = NULL; + } + +void Triggers_tab::modify_pressed() +{ + if ( selected_item ) + edit_listview_item( selected_item ); +} + +void Triggers_tab::current_changed( TQListViewItem* item_P ) + { +// if( item_P == selected_item ) +// return; + selected_item = static_cast< Trigger_list_item* >( item_P ); +// triggers_listview->setSelected( item_P, true ); + copy_button->setEnabled( item_P != NULL ); + modify_button->setEnabled( item_P != NULL ); + delete_button->setEnabled( item_P != NULL ); + } + +Trigger_list_item* Triggers_tab::create_listview_item( Trigger* trigger_P, + TQListView* parent_P, TQListViewItem* after_P, bool copy_P ) + { + Trigger* new_trg = copy_P ? trigger_P->copy( NULL ) : trigger_P; // CHECKME NULL ? +// CHECKME uz by nemelo byt treba if( after_P == NULL ) +// return new Trigger_list_item( parent_P, new_trg ); +// else + return new Trigger_list_item( parent_P, after_P, new_trg ); + } + +void Triggers_tab::edit_listview_item( Trigger_list_item* item_P ) + { + Trigger_dialog* dlg = NULL; + if( Shortcut_trigger* trg = dynamic_cast< Shortcut_trigger* >( item_P->trigger())) + dlg = new Shortcut_trigger_dialog( trg ); + else if( Gesture_trigger* trg = dynamic_cast< Gesture_trigger* >( item_P->trigger())) + dlg = new Gesture_trigger_dialog( trg ); + else if( Window_trigger* trg = dynamic_cast< Window_trigger* >( item_P->trigger())) + dlg = new Window_trigger_dialog( trg ); + else if( Voice_trigger* trg = dynamic_cast< Voice_trigger* >( item_P->trigger())) + dlg = new Voice_trigger_dialog( trg ); +// CHECKME TODO dalsi + else + assert( false ); + Trigger* new_trigger = dlg->edit_trigger(); + if( new_trigger != NULL ) + item_P->set_trigger( new_trigger ); + delete dlg; + } + +// Trigger_list_item + +TQString Trigger_list_item::text( int column_P ) const + { + return column_P == 0 ? trigger()->description() : TQString::null; + } + +// Shortcut_trigger_widget + +Shortcut_trigger_widget::Shortcut_trigger_widget( TQWidget* parent_P, const char* ) + : TQWidget( parent_P ) + { + TQVBoxLayout* lay = new TQVBoxLayout( this, 11, 6 ); + TQLabel* lbl = new TQLabel( i18n( "Select keyboard shortcut:" ), this ); + lay->addWidget( lbl ); + lay->addSpacing( 10 ); + bt = new KKeyButton( this ); + lay->addWidget( bt, 0 , Qt::AlignHCenter ); + lay->addStretch(); + clear_data(); + connect( bt, TQT_SIGNAL( capturedShortcut( const TDEShortcut& )), + this, TQT_SLOT( capturedShortcut( const TDEShortcut& ))); + } + +void Shortcut_trigger_widget::clear_data() + { + bt->setShortcut( TDEShortcut(), false ); + } + +void Shortcut_trigger_widget::capturedShortcut( const TDEShortcut& s_P ) + { + if( KKeyChooser::checkGlobalShortcutsConflict( s_P, true, topLevelWidget()) + || KKeyChooser::checkStandardShortcutsConflict( s_P, true, topLevelWidget())) + return; + // KHotKeys::Module::changed() + module->changed(); + bt->setShortcut( s_P, false ); + } + +void Shortcut_trigger_widget::set_data( const Shortcut_trigger* data_P ) + { + if( data_P == NULL ) + { + clear_data(); + return; + } + bt->setShortcut( data_P->shortcut(), false ); + } + +Shortcut_trigger* Shortcut_trigger_widget::get_data( Action_data* data_P ) const + { + return !bt->shortcut().isNull() + ? new Shortcut_trigger( data_P, bt->shortcut()) : NULL; + } + +// Shortcut_trigger_dialog + +Shortcut_trigger_dialog::Shortcut_trigger_dialog( Shortcut_trigger* trigger_P ) + : KDialogBase( NULL, NULL, true, "", Ok | Cancel ), // CHECKME caption + trigger( NULL ) + { + widget = new Shortcut_trigger_widget( this ); + widget->set_data( trigger_P ); + setMainWidget( widget ); + } + +Trigger* Shortcut_trigger_dialog::edit_trigger() + { + exec(); + return trigger; + } + +void Shortcut_trigger_dialog::accept() + { + KDialogBase::accept(); + trigger = widget->get_data( NULL ); // CHECKME NULL ? + } + +// Window_trigger_dialog + +Window_trigger_dialog::Window_trigger_dialog( Window_trigger* trigger_P ) + : KDialogBase( NULL, NULL, true, "", Ok | Cancel ), // CHECKME caption + trigger( NULL ) + { + widget = new Window_trigger_widget( this ); + widget->set_data( trigger_P ); + setMainWidget( widget ); + } + +Trigger* Window_trigger_dialog::edit_trigger() + { + exec(); + return trigger; + } + +void Window_trigger_dialog::accept() + { + KDialogBase::accept(); + trigger = widget->get_data( NULL ); // CHECKME NULL ? + } + +// Gesture_trigger_dialog + +Gesture_trigger_dialog::Gesture_trigger_dialog( Gesture_trigger* trigger_P ) + : KDialogBase( NULL, NULL, true, "", Ok | Cancel ), // CHECKME caption + _trigger( trigger_P ), _page( NULL ) + { + _page = new GestureRecordPage( _trigger->gesturecode(), + this, "GestureRecordPage"); + + connect(_page, TQT_SIGNAL(gestureRecorded(bool)), + this, TQT_SLOT(enableButtonOK(bool))); + + setMainWidget( _page ); + } + +Trigger* Gesture_trigger_dialog::edit_trigger() + { + if( exec()) + return new Gesture_trigger( NULL, _page->getGesture()); // CHECKME NULL? + else + return NULL; + } + + +// Voice_trigger_dialog + +Voice_trigger_dialog::Voice_trigger_dialog( Voice_trigger* trigger_P ) +: KDialogBase( NULL, NULL, true, "", Ok | Cancel ), // CHECKME caption +_trigger( trigger_P ), _page( NULL ) +{ + _page = new VoiceRecordPage( _trigger ? _trigger->voicecode() : TQString::null , this, "VoiceRecordPage"); + + connect(_page, TQT_SIGNAL(voiceRecorded(bool)), this, TQT_SLOT(enableButtonOK(bool))); + + setMainWidget( _page ); +} + +Trigger* Voice_trigger_dialog::edit_trigger() +{ + if( exec()) + return new Voice_trigger(NULL, _page->getVoiceId(), + (_page->isModifiedSignature(1) || !_trigger) ? _page->getVoiceSignature(1) : _trigger->voicesignature(1) , + (_page->isModifiedSignature(2) || !_trigger) ? _page->getVoiceSignature(2) : _trigger->voicesignature(2) ); + else + return NULL; +} + + + + +} // namespace KHotKeys + +#include "triggers_tab.moc" diff --git a/khotkeys/kcontrol/triggers_tab.h b/khotkeys/kcontrol/triggers_tab.h new file mode 100644 index 000000000..c4d6160fe --- /dev/null +++ b/khotkeys/kcontrol/triggers_tab.h @@ -0,0 +1,206 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _TRIGGERS_TAB_H_ +#define _TRIGGERS_TAB_H_ + +#include <kdialogbase.h> + +#include <khlistview.h> + +#include <triggers.h> +#include <triggers_tab_ui.h> +#include <window_trigger_widget.h> + +class KKeyButton; +class TDEShortcut; + +namespace KHotKeys +{ + +class Windowdef_list; +class Action_data; +class Trigger_list_item; +class KHotKeysShortcutList; + +// A listbox here would do too, but unlike TQListView, TQListBox now even cannot be subclassed +// to behave sanely WRT selecting and the current item +class Triggers_tab + : public Triggers_tab_ui + { + Q_OBJECT + public: + Triggers_tab( TQWidget* parent_P = NULL, const char* name_P = NULL ); + virtual ~Triggers_tab(); + void set_data( const Trigger_list* data_P ); + Trigger_list* get_data( Action_data* data_P ) const; + public slots: + void clear_data(); + protected: + Trigger_list_item* create_listview_item( Trigger* trigger_P, TQListView* parent_P, + TQListViewItem* after_P, bool copy_P ); + void edit_listview_item( Trigger_list_item* item_P ); + Trigger_list_item* selected_item; + enum type_t { TYPE_SHORTCUT_TRIGGER, TYPE_GESTURE_TRIGGER, TYPE_WINDOW_TRIGGER, TYPE_VOICE_TRIGGER }; + protected slots: + void new_selected( int type_P ); + virtual void copy_pressed(); + virtual void delete_pressed(); + virtual void modify_pressed(); + virtual void current_changed( TQListViewItem* item_P ); + }; + +class Trigger_list_item + : public TQListViewItem + { + public: + Trigger_list_item( TQListView* parent_P, Trigger* trigger_P ); + Trigger_list_item( TQListView* parent_P, TQListViewItem* after_P, Trigger* trigger_P ); + virtual ~Trigger_list_item(); + virtual TQString text( int column_P ) const; + Trigger* trigger() const; + void set_trigger( Trigger* trigger_P ); + protected: + Trigger* _trigger; // owns + }; + +class Trigger_dialog + { + public: + virtual Trigger* edit_trigger() = 0; + virtual ~Trigger_dialog(); + }; + +// TODO no need for such extra class? +class Shortcut_trigger_widget + : public TQWidget + { + Q_OBJECT + public: + Shortcut_trigger_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); + void set_data( const Shortcut_trigger* trigger_P ); + Shortcut_trigger* get_data( Action_data* data_P ) const; + public slots: + void clear_data(); + private slots: + void capturedShortcut( const TDEShortcut& ); + private: + KKeyButton* bt; + }; + +typedef Shortcut_trigger_widget Shortcut_trigger_tab; + +class Shortcut_trigger_dialog + : public KDialogBase, public Trigger_dialog + { + Q_OBJECT + public: + Shortcut_trigger_dialog( Shortcut_trigger* trigger_P ); + virtual Trigger* edit_trigger(); + protected: + virtual void accept(); + Shortcut_trigger_widget* widget; + Shortcut_trigger* trigger; + }; + +class Window_trigger_dialog + : public KDialogBase, public Trigger_dialog + { + Q_OBJECT + public: + Window_trigger_dialog( Window_trigger* trigger_P ); + virtual Trigger* edit_trigger(); + protected: + virtual void accept(); + Window_trigger_widget* widget; + Window_trigger* trigger; + }; + +class GestureRecordPage; + +class Gesture_trigger_dialog + : public KDialogBase, public Trigger_dialog + { + Q_OBJECT + public: + Gesture_trigger_dialog( Gesture_trigger* trigger_P ); + virtual Trigger* edit_trigger(); + private: + // CHECKME accept() ? + Gesture_trigger* _trigger; + GestureRecordPage *_page; + }; + + +class VoiceRecordPage; + +class Voice_trigger_dialog + : public KDialogBase, public Trigger_dialog +{ + Q_OBJECT + public: + Voice_trigger_dialog( Voice_trigger* trigger_P ); + virtual Trigger* edit_trigger(); + private: + // CHECKME accept() ? + Voice_trigger* _trigger; + VoiceRecordPage *_page; +}; + + + +//*************************************************************************** +// Inline +//*************************************************************************** + +// Trigger_list_item + +inline +Trigger_list_item::Trigger_list_item( TQListView* parent_P, Trigger* trigger_P ) + : TQListViewItem( parent_P ), _trigger( trigger_P ) + { + } + +inline +Trigger_list_item::Trigger_list_item( TQListView* parent_P, TQListViewItem* after_P, + Trigger* trigger_P ) + : TQListViewItem( parent_P, after_P ), _trigger( trigger_P ) + { + } + +inline +Trigger_list_item::~Trigger_list_item() + { // CHECKME if the listview will ever be used hiearchically, + delete _trigger; // this will be wrong, the triggers tree will have to be kept + } // and deleted separately + +inline +Trigger* Trigger_list_item::trigger() const + { + return _trigger; + } + +inline +void Trigger_list_item::set_trigger( Trigger* trigger_P ) + { + delete _trigger; + _trigger = trigger_P; + } + +// Trigger_dialog + +inline +Trigger_dialog::~Trigger_dialog() + { + } + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/ui/CMakeLists.txt b/khotkeys/kcontrol/ui/CMakeLists.txt new file mode 100644 index 000000000..85212affb --- /dev/null +++ b/khotkeys/kcontrol/ui/CMakeLists.txt @@ -0,0 +1,40 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/khotkeys/shared + ${CMAKE_SOURCE_DIR}/khotkeys/kcontrol + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### ui (static) ############################### + +tde_add_library( ui STATIC_PIC AUTOMOC + SOURCES + windowdef_simple_widget_ui.ui windowdef_list_widget_ui.ui + command_url_widget_ui.ui menuentry_widget_ui.ui + triggers_tab_ui.ui general_tab_ui.ui action_group_tab_ui.ui + dcop_widget_ui.ui main_buttons_widget_ui.ui voice_settings_tab_ui.ui + info_tab_ui.ui window_trigger_widget_ui.ui action_list_widget_ui.ui + keyboard_input_widget_ui.ui condition_list_widget_ui.ui + gesture_triggers_tab_ui.ui gestures_settings_tab_ui.ui + general_settings_tab_ui.ui voice_input_widget_ui.ui + actions_listview_widget_ui.ui + LINK khotkeys_shared-shared +) diff --git a/khotkeys/kcontrol/ui/Makefile.am b/khotkeys/kcontrol/ui/Makefile.am new file mode 100644 index 000000000..14ea5c44d --- /dev/null +++ b/khotkeys/kcontrol/ui/Makefile.am @@ -0,0 +1,21 @@ +noinst_LTLIBRARIES = libui.la +libui_la_SOURCES = dummy.cpp windowdef_simple_widget_ui.ui windowdef_list_widget_ui.ui \ + command_url_widget_ui.ui menuentry_widget_ui.ui triggers_tab_ui.ui general_tab_ui.ui \ + action_group_tab_ui.ui dcop_widget_ui.ui main_buttons_widget_ui.ui \ + actions_listview_widget_ui.ui info_tab_ui.ui window_trigger_widget_ui.ui \ + action_list_widget_ui.ui keyboard_input_widget_ui.ui condition_list_widget_ui.ui \ + gesture_triggers_tab_ui.ui gestures_settings_tab_ui.ui general_settings_tab_ui.ui \ + voice_input_widget_ui.ui voice_settings_tab_ui.ui + +libui_la_LIBADD = ../../shared/libkhotkeys_shared.la $(LIB_TDEUI) +libui_la_LDFLAGS = $(all_libraries) + +INCLUDES= -I$(srcdir)/.. -I$(top_srcdir)/khotkeys/shared $(all_includes) + +dummy.cpp: + echo > dummy.cpp + +DISTCLEANFILES = dummy.cpp + +METASOURCES = AUTO + diff --git a/khotkeys/kcontrol/ui/action_group_tab_ui.ui b/khotkeys/kcontrol/ui/action_group_tab_ui.ui new file mode 100644 index 000000000..ce982399e --- /dev/null +++ b/khotkeys/kcontrol/ui/action_group_tab_ui.ui @@ -0,0 +1,108 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>KHotKeys::Action_group_tab_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Action_group_tab_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>596</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>action_group_name_label</cstring> + </property> + <property name="text"> + <string>Action group &name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>action_name_lineedit</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>action_name_lineedit</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>disable_checkbox</cstring> + </property> + <property name="text"> + <string>&Disable</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLabel"> + <property name="name"> + <cstring>comment_label</cstring> + </property> + <property name="text"> + <string>&Comment:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>comment_multilineedit</cstring> + </property> + </widget> + <widget class="KTextEdit"> + <property name="name"> + <cstring>comment_multilineedit</cstring> + </property> + </widget> + </vbox> +</widget> +<Q_SLOTS> + <slot access="protected" specifier="pure virtual">action_group_name_changed( const TQString& )</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>ktextedit.h</includehint> +</includehints> +</UI> diff --git a/khotkeys/kcontrol/ui/action_list_widget_ui.ui b/khotkeys/kcontrol/ui/action_list_widget_ui.ui new file mode 100644 index 000000000..d78c6b5f1 --- /dev/null +++ b/khotkeys/kcontrol/ui/action_list_widget_ui.ui @@ -0,0 +1,171 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>KHotKeys::Action_list_widget_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Action_list_widget_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>560</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>comment_label</cstring> + </property> + <property name="text"> + <string>Comment:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>comment_lineedit</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>comment_lineedit</cstring> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KHotKeys::KHListView"> + <property name="name"> + <cstring>actions_listview</cstring> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQPushButton"> + <property name="name"> + <cstring>new_button</cstring> + </property> + <property name="text"> + <string>&New</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>modify_button</cstring> + </property> + <property name="text"> + <string>&Modify...</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>copy_button</cstring> + </property> + <property name="text"> + <string>&Copy</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>delete_button</cstring> + </property> + <property name="text"> + <string>Delete</string> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>KHotKeys::KHListView</class> + <header location="global">khlistview.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + <signal>currentChanged(TQListViewItem*)</signal> + <signal>current_changed(TQListViewItem*)</signal> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="XPM.GZ" length="4462">789c9d97c76e24490e86effd1442f3d65870d2451a0ce6206f5adeb4cc620f8c34f2553225b5a4c1befb46927fe6a1d4c0ccac4287fa8a0c26834193f5dbb785b3fd9d856fbf7d799ec9ecba5ea8afe469e15bf3727ffffeeffffcf1e797af49b2d0ffc7d142f2f55f5fbe1ecc16ea85dde9a4ed81290045faa77ca49cf4ab67ba1e3953969173651ab9d4fdf1c8a27c3872ad7c3c72d3b32c2a67c3f3444636fbef23eb7e590267e68fcc4656395d8dacf6d938ef97eaef289781cddebdb2846fccff44b989ba58e3411f3dc75158e6df1d3889539517ca49bf54fe43398d1dec4f46567f685fd9c539f43fc025f80c1c3ce8d93f28e77185f8bf0c6cfae4c0b5f9c3c6e5c0542a4b5876fe13708df39d2bd7716372aa8c93c4e4723bb2f977aadc26ceec4bdb7310e6b0bfab9c2445ecd49f1370694cebca65d260ffa6711a41aef14d24e94cee6be3348e0ae5e9c8765f07ca3e8db17f0f9c825794eb3489351fe9bb7217e4969f29388bd51ee9fda5715a19730696b852fea95c6471647ca95cf64bcf43e0cef4657b647bfe6acf213d6bb32f9a9f5992b5a64f9a8f990b6cf9ecc15d6cf9acf6b2da55a8a75cb973dee4b2d1b38b5c05de02434e87e01aacfb351df5bebddea74b5c67f9c795711ea15e357e2ecde358fb87efc0a867df8cac728a074e62e527706afb59f3cf6583be5c28bb3c35f693812d1fbdc6dbe57966fec932d899ffa4f7e38adca17e34beaeca4b9c271a18f1d5fc739257b0d70d9c68be7bed7fcee7827ab91cd8e4740cf6b19d4ffb87ab07b9bf516e72d4a3ac821b9cef6e60d84f47367ded2fae1d9f7704f6163f79000ffde27660f387ed3c5dbf54dfeebb0bf6acbe6b706bfa5ef32f8f8b18f5bf0f463f20edb77956a4e68fbc80b3c4facd163847be6bfde72ec86dbeac82715fbc0286be683cf3bc081d44f7df80d344fb0b6b7de64581fb916765297263d6fccd9b7ee97e566e8b06cfdb1f59cf2bda2f8bbc2c11df0c5c41aefdb328ca22b1feb0012eedbce24736f91b18fb796d64eb87cb60817dcdafb07d906bfd14d22f659d8785ef97b2f6d7b2df6ef1d6fb2babaac6f92e8c25b27ecc1f239b7f3a5fca5a8678ea7c2d9bc0e6ef1238b3fca2c7814d5f4cbf9334b5f833384bed3c7a5f5514f4adbe2ec07962e7590457f06f6f649b977afe2a16f42f5e070bfc591e18f7a5f1a812a9e0df39d827da4fbd8c6ccfd7785569bf945f953371a9d5a3de67950bfa2d75c63eb2fb15bdcfaaf011e6c7263846bf8f4636f91618f3c7d3c0f047fb69550efab2074e12bd6fd27957553ec33c5b043bcc7f9d0795f818fdb501a3df8ae673e507ff69021eea37063bc45ffb73550736ff36c0a84f3e0317a86f8b5f139e6ffe1f821de6d9127898ff3be00a7c3ab2cd03e3d697560ff40016e47b3bb2e96bbd559d8f32bbff4b7065f193042c98873acf240af6adbf3c83c5f2954bb0c7bcd77c107d81d2fdebc63e33ff640aaecc9e1c8151df5c803dfaadc64b52dfa03ed64636ffb4ff4b2867f453ede7227586fcd3f9264ded91fffafe236d5da37fe83c91ceb7b9e5b7f6731ff92ed7f747d6fbf7e185cf58347e3e6932e47b3430fa893edf87d795c2fc3f003b67f5f902cec17abfde0dfa3c053b3c5ffb832fc2eb8fddcf233887fc195c801f46b6f3cdc02558fba72f7d2d1a7f7e321ee58fe0cad86bbff24dd3e2fe74fef836b0c6eb60d62fa6bf5e07b3419f853dd7dc70fb8bd5f1255fd90ed30f9f3c5ff30ddff21ddff384a7fcc08ffcc4cf61cdf8855ff9e79c7e1db4dff89d3f7891977899577895d7789d377893b7f83b6fcfe937bc13b477798ff7f9800ff928ac633ee11f7cca6761d7f99c7e1b3cb908da11c7413be1943376e153cc39175c72f549ff9e17c31744429e6a6aa8a58e2ee98aaee9866e7f617fc24b7417a4f734a1293dd0233dd133cd8285177aa5f9f3b63ca5377aa78f607b919668995682e62aadd17ab0b1419b9ff41f682b48bed336edd02eed05ed7d5ea3033a0cdf1ed1f127fd273ae123fa41a774a6b685cee982228a837e42e927fd47caf8985c38651eb40b2ac38e4a5842658a97fab33fd248cb87d2c9a55cc9b5dcc82d1fc99ddccb44a6f230af2f8ff224cf417f262ff22a3fe54ddee543166549966545567f617f4dd66523dc6b2c9bb225df655b7682f692ecca9eeccfe97772c09b722847722c27c1f3eb70f66bf9116c9fca999ccbc59cfe25bf4a143a5ef8992561324a78bd92522acf9ebc78efe7cf7b153276db37bef59dbff457fedadff85b7f27abfede4ffcd4cf9ff76faeff4fffefeff8c7f5fedfdfbffc0fa355c495</data> + </image> +</images> +<connections> + <connection> + <sender>copy_button</sender> + <signal>clicked()</signal> + <receiver>Action_list_widget_ui</receiver> + <slot>copy_pressed()</slot> + </connection> + <connection> + <sender>modify_button</sender> + <signal>clicked()</signal> + <receiver>Action_list_widget_ui</receiver> + <slot>modify_pressed()</slot> + </connection> + <connection> + <sender>delete_button</sender> + <signal>clicked()</signal> + <receiver>Action_list_widget_ui</receiver> + <slot>delete_pressed()</slot> + </connection> + <connection> + <sender>actions_listview</sender> + <signal>current_changed(TQListViewItem*)</signal> + <receiver>Action_list_widget_ui</receiver> + <slot>current_changed(TQListViewItem*)</slot> + </connection> +</connections> +<forwards> + <forward>class TQListViewItem;</forward> +</forwards> +<Q_SLOTS> + <slot access="protected" specifier="pure virtual">copy_pressed()</slot> + <slot access="protected" specifier="pure virtual">current_changed(TQListViewItem*)</slot> + <slot access="protected" specifier="pure virtual">delete_pressed()</slot> + <slot access="protected" specifier="pure virtual">modify_pressed()</slot> +</Q_SLOTS> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/khotkeys/kcontrol/ui/actions_listview_widget_ui.ui b/khotkeys/kcontrol/ui/actions_listview_widget_ui.ui new file mode 100644 index 000000000..a2589fc48 --- /dev/null +++ b/khotkeys/kcontrol/ui/actions_listview_widget_ui.ui @@ -0,0 +1,83 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>KHotKeys::Actions_listview_widget_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Actions_listview_widget_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>592</width> + <height>495</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQGroupBox"> + <property name="name"> + <cstring>actions_listview_groupbox</cstring> + </property> + <property name="title"> + <string>Actions</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="KHotKeys::Actions_listview"> + <property name="name"> + <cstring>actions_listview</cstring> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>KHotKeys::Actions_listview</class> + <header location="global">actions_listview_widget.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="XPM.GZ" length="4462">789c9d97c76e24490e86effd1442f3d65870d2451a0ce6206f5adeb4cc620f8c34f2553225b5a4c1befb46927fe6a1d4c0ccac4287fa8a0c26834193f5dbb785b3fd9d856fbf7d799ec9ecba5ea8afe469e15bf3727ffffeeffffcf1e797af49b2d0ffc7d142f2f55f5fbe1ecc16ea85dde9a4ed81290045faa77ca49cf4ab67ba1e3953969173651ab9d4fdf1c8a27c3872ad7c3c72d3b32c2a67c3f3444636fbef23eb7e590267e68fcc4656395d8dacf6d938ef97eaef289781cddebdb2846fccff44b989ba58e3411f3dc75158e6df1d3889539517ca49bf54fe43398d1dec4f46567f685fd9c539f43fc025f80c1c3ce8d93f28e77185f8bf0c6cfae4c0b5f9c3c6e5c0542a4b5876fe13708df39d2bd7716372aa8c93c4e4723bb2f977aadc26ceec4bdb7310e6b0bfab9c2445ecd49f1370694cebca65d260ffa6711a41aef14d24e94cee6be3348e0ae5e9c8765f07ca3e8db17f0f9c825794eb3489351fe9bb7217e4969f29388bd51ee9fda5715a19730696b852fea95c6471647ca95cf64bcf43e0cef4657b647bfe6acf213d6bb32f9a9f5992b5a64f9a8f990b6cf9ecc15d6cf9acf6b2da55a8a75cb973dee4b2d1b38b5c05de02434e87e01aacfb351df5bebddea74b5c67f9c795711ea15e357e2ecde358fb87efc0a867df8cac728a074e62e527706afb59f3cf6583be5c28bb3c35f693812d1fbdc6dbe57966fec932d899ffa4f7e38adca17e34beaeca4b9c271a18f1d5fc739257b0d70d9c68be7bed7fcee7827ab91cd8e4740cf6b19d4ffb87ab07b9bf516e72d4a3ac821b9cef6e60d84f47367ded2fae1d9f7704f6163f79000ffde27660f387ed3c5dbf54dfeebb0bf6acbe6b706bfa5ef32f8f8b18f5bf0f463f20edb77956a4e68fbc80b3c4facd163847be6bfde72ec86dbeac82715fbc0286be683cf3bc081d44f7df80d344fb0b6b7de64581fb916765297263d6fccd9b7ee97e566e8b06cfdb1f59cf2bda2f8bbc2c11df0c5c41aefdb328ca22b1feb0012eedbce24736f91b18fb796d64eb87cb60817dcdafb07d906bfd14d22f659d8785ef97b2f6d7b2df6ef1d6fb2babaac6f92e8c25b27ecc1f239b7f3a5fca5a8678ea7c2d9bc0e6ef1238b3fca2c7814d5f4cbf9334b5f833384bed3c7a5f5514f4adbe2ec07962e7590457f06f6f649b977afe2a16f42f5e070bfc591e18f7a5f1a812a9e0df39d827da4fbd8c6ccfd7785569bf945f953371a9d5a3de67950bfa2d75c63eb2fb15bdcfaaf011e6c7263846bf8f4636f91618f3c7d3c0f047fb69550efab2074e12bd6fd27957553ec33c5b043bcc7f9d0795f818fdb501a3df8ae673e507ff69021eea37063bc45ffb73550736ff36c0a84f3e0317a86f8b5f139e6ffe1f821de6d9127898ff3be00a7c3ab2cd03e3d697560ff40016e47b3bb2e96bbd559d8f32bbff4b7065f193042c98873acf240af6adbf3c83c5f2954bb0c7bcd77c107d81d2fdebc63e33ff640aaecc9e1c8151df5c803dfaadc64b52dfa03ed64636ffb4ff4b2867f453ede7227586fcd3f9264ded91fffafe236d5da37fe83c91ceb7b9e5b7f6731ff92ed7f747d6fbf7e185cf58347e3e6932e47b3430fa893edf87d795c2fc3f003b67f5f902cec17abfde0dfa3c053b3c5ffb832fc2eb8fddcf233887fc195c801f46b6f3cdc02558fba72f7d2d1a7f7e321ee58fe0cad86bbff24dd3e2fe74fef836b0c6eb60d62fa6bf5e07b3419f853dd7dc70fb8bd5f1255fd90ed30f9f3c5ff30ddff21ddff384a7fcc08ffcc4cf61cdf8855ff9e79c7e1db4dff89d3f7891977899577895d7789d377893b7f83b6fcfe937bc13b477798ff7f9800ff928ac633ee11f7cca6761d7f99c7e1b3cb908da11c7413be1943376e153cc39175c72f549ff9e17c31744429e6a6aa8a58e2ee98aaee9866e7f617fc24b7417a4f734a1293dd0233dd133cd8285177aa5f9f3b63ca5377aa78f607b919668995682e62aadd17ab0b1419b9ff41f682b48bed336edd02eed05ed7d5ea3033a0cdf1ed1f127fd273ae123fa41a774a6b685cee982228a837e42e927fd47caf8985c38651eb40b2ac38e4a5842658a97fab33fd248cb87d2c9a55cc9b5dcc82d1fc99ddccb44a6f230af2f8ff224cf417f262ff22a3fe54ddee543166549966545567f617f4dd66523dc6b2c9bb225df655b7682f692ecca9eeccfe97772c09b722847722c27c1f3eb70f66bf9116c9fca999ccbc59cfe25bf4a143a5ef8992561324a78bd92522acf9ebc78efe7cf7b153276db37bef59dbff457fedadff85b7f27abfede4ffcd4cf9ff76faeff4fffefeff8c7f5fedfdfbffc0fa355c495</data> + </image> +</images> +<forwards> + <forward>class TQListViewItem;</forward> +</forwards> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> + <include location="global" impldecl="in implementation">config.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/khotkeys/kcontrol/ui/command_url_widget_ui.ui b/khotkeys/kcontrol/ui/command_url_widget_ui.ui new file mode 100644 index 000000000..ec18138de --- /dev/null +++ b/khotkeys/kcontrol/ui/command_url_widget_ui.ui @@ -0,0 +1,66 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>KHotKeys::Command_url_widget_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Command_url_widget_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>649</width> + <height>361</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>command_url_label</cstring> + </property> + <property name="text"> + <string>Command/URL to execute:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>command_url_lineedit</cstring> + </property> + </widget> + <widget class="KURLRequester"> + <property name="name"> + <cstring>command_url_lineedit</cstring> + </property> + </widget> + </vbox> + </widget> + </vbox> +</widget> +<Q_SLOTS> + <slot access="protected" specifier="pure virtual">browse_pressed()</slot> +</Q_SLOTS> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<includehints> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/khotkeys/kcontrol/ui/condition_list_widget_ui.ui b/khotkeys/kcontrol/ui/condition_list_widget_ui.ui new file mode 100644 index 000000000..9b3727ffd --- /dev/null +++ b/khotkeys/kcontrol/ui/condition_list_widget_ui.ui @@ -0,0 +1,170 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>KHotKeys::Condition_list_widget_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Condition_list_widget_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>568</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>comment_label</cstring> + </property> + <property name="text"> + <string>Comment:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>comment_lineedit</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>comment_lineedit</cstring> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KHotKeys::KHListView"> + <property name="name"> + <cstring>conditions_listview</cstring> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQPushButton"> + <property name="name"> + <cstring>new_button</cstring> + </property> + <property name="text"> + <string>&New</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>modify_button</cstring> + </property> + <property name="text"> + <string>&Modify...</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>copy_button</cstring> + </property> + <property name="text"> + <string>&Copy</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>delete_button</cstring> + </property> + <property name="text"> + <string>Delete</string> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>KHotKeys::KHListView</class> + <header location="global">khlistview.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + <signal>current_changed(TQListViewItem*)</signal> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="XPM.GZ" length="4462">789c9d97c76e24490e86effd1442f3d65870d2451a0ce6206f5adeb4cc620f8c34f2553225b5a4c1befb46927fe6a1d4c0ccac4287fa8a0c26834193f5dbb785b3fd9d856fbf7d799ec9ecba5ea8afe469e15bf3727ffffeeffffcf1e797af49b2d0ffc7d142f2f55f5fbe1ecc16ea85dde9a4ed81290045faa77ca49cf4ab67ba1e3953969173651ab9d4fdf1c8a27c3872ad7c3c72d3b32c2a67c3f3444636fbef23eb7e590267e68fcc4656395d8dacf6d938ef97eaef289781cddebdb2846fccff44b989ba58e3411f3dc75158e6df1d3889539517ca49bf54fe43398d1dec4f46567f685fd9c539f43fc025f80c1c3ce8d93f28e77185f8bf0c6cfae4c0b5f9c3c6e5c0542a4b5876fe13708df39d2bd7716372aa8c93c4e4723bb2f977aadc26ceec4bdb7310e6b0bfab9c2445ecd49f1370694cebca65d260ffa6711a41aef14d24e94cee6be3348e0ae5e9c8765f07ca3e8db17f0f9c825794eb3489351fe9bb7217e4969f29388bd51ee9fda5715a19730696b852fea95c6471647ca95cf64bcf43e0cef4657b647bfe6acf213d6bb32f9a9f5992b5a64f9a8f990b6cf9ecc15d6cf9acf6b2da55a8a75cb973dee4b2d1b38b5c05de02434e87e01aacfb351df5bebddea74b5c67f9c795711ea15e357e2ecde358fb87efc0a867df8cac728a074e62e527706afb59f3cf6583be5c28bb3c35f693812d1fbdc6dbe57966fec932d899ffa4f7e38adca17e34beaeca4b9c271a18f1d5fc739257b0d70d9c68be7bed7fcee7827ab91cd8e4740cf6b19d4ffb87ab07b9bf516e72d4a3ac821b9cef6e60d84f47367ded2fae1d9f7704f6163f79000ffde27660f387ed3c5dbf54dfeebb0bf6acbe6b706bfa5ef32f8f8b18f5bf0f463f20edb77956a4e68fbc80b3c4facd163847be6bfde72ec86dbeac82715fbc0286be683cf3bc081d44f7df80d344fb0b6b7de64581fb916765297263d6fccd9b7ee97e566e8b06cfdb1f59cf2bda2f8bbc2c11df0c5c41aefdb328ca22b1feb0012eedbce24736f91b18fb796d64eb87cb60817dcdafb07d906bfd14d22f659d8785ef97b2f6d7b2df6ef1d6fb2babaac6f92e8c25b27ecc1f239b7f3a5fca5a8678ea7c2d9bc0e6ef1238b3fca2c7814d5f4cbf9334b5f833384bed3c7a5f5514f4adbe2ec07962e7590457f06f6f649b977afe2a16f42f5e070bfc591e18f7a5f1a812a9e0df39d827da4fbd8c6ccfd7785569bf945f953371a9d5a3de67950bfa2d75c63eb2fb15bdcfaaf011e6c7263846bf8f4636f91618f3c7d3c0f047fb69550efab2074e12bd6fd27957553ec33c5b043bcc7f9d0795f818fdb501a3df8ae673e507ff69021eea37063bc45ffb73550736ff36c0a84f3e0317a86f8b5f139e6ffe1f821de6d9127898ff3be00a7c3ab2cd03e3d697560ff40016e47b3bb2e96bbd559d8f32bbff4b7065f193042c98873acf240af6adbf3c83c5f2954bb0c7bcd77c107d81d2fdebc63e33ff640aaecc9e1c8151df5c803dfaadc64b52dfa03ed64636ffb4ff4b2867f453ede7227586fcd3f9264ded91fffafe236d5da37fe83c91ceb7b9e5b7f6731ff92ed7f747d6fbf7e185cf58347e3e6932e47b3430fa893edf87d795c2fc3f003b67f5f902cec17abfde0dfa3c053b3c5ffb832fc2eb8fddcf233887fc195c801f46b6f3cdc02558fba72f7d2d1a7f7e321ee58fe0cad86bbff24dd3e2fe74fef836b0c6eb60d62fa6bf5e07b3419f853dd7dc70fb8bd5f1255fd90ed30f9f3c5ff30ddff21ddff384a7fcc08ffcc4cf61cdf8855ff9e79c7e1db4dff89d3f7891977899577895d7789d377893b7f83b6fcfe937bc13b477798ff7f9800ff928ac633ee11f7cca6761d7f99c7e1b3cb908da11c7413be1943376e153cc39175c72f549ff9e17c31744429e6a6aa8a58e2ee98aaee9866e7f617fc24b7417a4f734a1293dd0233dd133cd8285177aa5f9f3b63ca5377aa78f607b919668995682e62aadd17ab0b1419b9ff41f682b48bed336edd02eed05ed7d5ea3033a0cdf1ed1f127fd273ae123fa41a774a6b685cee982228a837e42e927fd47caf8985c38651eb40b2ac38e4a5842658a97fab33fd248cb87d2c9a55cc9b5dcc82d1fc99ddccb44a6f230af2f8ff224cf417f262ff22a3fe54ddee543166549966545567f617f4dd66523dc6b2c9bb225df655b7682f692ecca9eeccfe97772c09b722847722c27c1f3eb70f66bf9116c9fca999ccbc59cfe25bf4a143a5ef8992561324a78bd92522acf9ebc78efe7cf7b153276db37bef59dbff457fedadff85b7f27abfede4ffcd4cf9ff76faeff4fffefeff8c7f5fedfdfbffc0fa355c495</data> + </image> +</images> +<connections> + <connection> + <sender>copy_button</sender> + <signal>clicked()</signal> + <receiver>Condition_list_widget_ui</receiver> + <slot>copy_pressed()</slot> + </connection> + <connection> + <sender>modify_button</sender> + <signal>clicked()</signal> + <receiver>Condition_list_widget_ui</receiver> + <slot>modify_pressed()</slot> + </connection> + <connection> + <sender>delete_button</sender> + <signal>clicked()</signal> + <receiver>Condition_list_widget_ui</receiver> + <slot>delete_pressed()</slot> + </connection> + <connection> + <sender>conditions_listview</sender> + <signal>current_changed(TQListViewItem*)</signal> + <receiver>Condition_list_widget_ui</receiver> + <slot>current_changed(TQListViewItem*)</slot> + </connection> +</connections> +<forwards> + <forward>class TQListViewItem;</forward> +</forwards> +<Q_SLOTS> + <slot access="protected" specifier="pure virtual">copy_pressed()</slot> + <slot access="protected" specifier="pure virtual">current_changed(TQListViewItem*)</slot> + <slot access="protected" specifier="pure virtual">delete_pressed()</slot> + <slot access="protected" specifier="pure virtual">modify_pressed()</slot> +</Q_SLOTS> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/khotkeys/kcontrol/ui/dcop_widget_ui.ui b/khotkeys/kcontrol/ui/dcop_widget_ui.ui new file mode 100644 index 000000000..feeae535d --- /dev/null +++ b/khotkeys/kcontrol/ui/dcop_widget_ui.ui @@ -0,0 +1,273 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>KHotKeys::Dcop_widget_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Dcop_widget_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>576</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>remote_app_label</cstring> + </property> + <property name="text"> + <string>Remote &application:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>remote_app_lineedit</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>remote_app_lineedit</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLabel"> + <property name="name"> + <cstring>remote_object_label</cstring> + </property> + <property name="text"> + <string>Remote &object:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>remote_object_lineedit</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>remote_object_lineedit</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLabel"> + <property name="name"> + <cstring>called_function_label</cstring> + </property> + <property name="text"> + <string>Called &function:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>called_function_lineedit</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>called_function_lineedit</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLabel"> + <property name="name"> + <cstring>arguments_label</cstring> + </property> + <property name="text"> + <string>Arguments:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>arguments_lineedit</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>arguments_lineedit</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Spacer1_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>try_button</cstring> + </property> + <property name="text"> + <string>&Try</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButton1</cstring> + </property> + <property name="text"> + <string>Run &KDCOP</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>try_button</sender> + <signal>clicked()</signal> + <receiver>Dcop_widget_ui</receiver> + <slot>try_pressed()</slot> + </connection> + <connection> + <sender>PushButton1</sender> + <signal>clicked()</signal> + <receiver>Dcop_widget_ui</receiver> + <slot>run_kdcop_pressed()</slot> + </connection> +</connections> +<tabstops> + <tabstop>remote_app_lineedit</tabstop> + <tabstop>remote_object_lineedit</tabstop> + <tabstop>called_function_lineedit</tabstop> + <tabstop>arguments_lineedit</tabstop> + <tabstop>try_button</tabstop> + <tabstop>PushButton1</tabstop> +</tabstops> +<Q_SLOTS> + <slot access="protected" specifier="pure virtual">run_kdcop_pressed()</slot> + <slot access="protected" specifier="pure virtual">try_pressed()</slot> +</Q_SLOTS> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/khotkeys/kcontrol/ui/general_settings_tab_ui.ui b/khotkeys/kcontrol/ui/general_settings_tab_ui.ui new file mode 100644 index 000000000..95c175a98 --- /dev/null +++ b/khotkeys/kcontrol/ui/general_settings_tab_ui.ui @@ -0,0 +1,117 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>General_settings_tab_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>General_settings_tab_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>485</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>disable_daemon_checkbox</cstring> + </property> + <property name="text"> + <string>Disable KHotKeys daemon</string> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>import_button</cstring> + </property> + <property name="text"> + <string>Import New Actions...</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<connections> + <connection> + <sender>import_button</sender> + <signal>clicked()</signal> + <receiver>General_settings_tab_ui</receiver> + <slot>import_clicked()</slot> + </connection> +</connections> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<Q_SLOTS> + <slot access="protected" specifier="pure virtual">import_clicked()</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<includehints> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/khotkeys/kcontrol/ui/general_tab_ui.ui b/khotkeys/kcontrol/ui/general_tab_ui.ui new file mode 100644 index 000000000..4817d8662 --- /dev/null +++ b/khotkeys/kcontrol/ui/general_tab_ui.ui @@ -0,0 +1,148 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>KHotKeys::General_tab_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>General_tab_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>596</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>action_name_label</cstring> + </property> + <property name="text"> + <string>Action &name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>action_name_lineedit</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>action_name_lineedit</cstring> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>action_type_label</cstring> + </property> + <property name="text"> + <string>Action &type:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>action_type_combo</cstring> + </property> + </widget> + <widget class="TQComboBox"> + <property name="name"> + <cstring>action_type_combo</cstring> + </property> + </widget> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>disable_checkbox</cstring> + </property> + <property name="text"> + <string>&Disable</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLabel"> + <property name="name"> + <cstring>comment_label</cstring> + </property> + <property name="text"> + <string>&Comment:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>comment_multilineedit</cstring> + </property> + </widget> + <widget class="KTextEdit"> + <property name="name"> + <cstring>comment_multilineedit</cstring> + </property> + <property name="textFormat"> + <enum>PlainText</enum> + </property> + </widget> + </vbox> +</widget> +<Q_SLOTS> + <slot access="protected" specifier="pure virtual">action_name_changed( const TQString& )</slot> + <slot access="protected" specifier="pure virtual">action_type_changed(int)</slot> +</Q_SLOTS> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<includehints> + <includehint>ktextedit.h</includehint> +</includehints> +</UI> diff --git a/khotkeys/kcontrol/ui/gesture_triggers_tab_ui.ui b/khotkeys/kcontrol/ui/gesture_triggers_tab_ui.ui new file mode 100644 index 000000000..068806a02 --- /dev/null +++ b/khotkeys/kcontrol/ui/gesture_triggers_tab_ui.ui @@ -0,0 +1,519 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>KHotKeys::Gesture_triggers_tab_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Gesture_triggers_tab_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <property name="text"> + <string>Gestures:</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer29</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>30</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout5</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Spacer17</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>gesture_lineedit1</cstring> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer18</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="KHotKeys::GestureDrawer"> + <property name="name"> + <cstring>gesture_drawer1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>100</height> + </size> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer19</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>gesture_edit_button1</cstring> + </property> + <property name="text"> + <string>Edit...</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer20</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer30</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>30</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Spacer21</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>gesture_lineedit2</cstring> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer22</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="KHotKeys::GestureDrawer"> + <property name="name"> + <cstring>gesture_drawer2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>100</height> + </size> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer23</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>gesture_edit_button2</cstring> + </property> + <property name="text"> + <string>Edit...</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer24</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer31</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>30</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Spacer25</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>gesture_lineedit3</cstring> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer26</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="KHotKeys::GestureDrawer"> + <property name="name"> + <cstring>gesture_drawer3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>100</height> + </size> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer27</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>gesture_edit_button3</cstring> + </property> + <property name="text"> + <string>Edit...</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer28</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer32</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>30</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>KHotKeys::GestureDrawer</class> + <header location="global">gesturedrawer.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="XPM.GZ" length="4350">789c6dd7594f23471007f0f7fd14d6d6db2aaaf58c3db647511eb831b7317794879ac30760cc61c010e5bba7dcf5af5688167664fdb66bbaababbb67cccf1f8dab93c3c68f9fdf5e16b298968d7222cf8d1fd5eb6cf6f1e75f7ffcfded7b9a3656ff9aad46fafdb76fdf078b46d9389a3fd42bf04841699e964933b830b79a7019dd0b96955b895b5a703bcd572e08eea576ff6570ae0eedd477b792103f854b8b2fc6d1163f77237e646e37113f89b6f8307e3bf1785a8b0eedbc696eb7ad9db7e01ee6476ee4ffe0c6fd158c7c69182cde4eec6e87fea50dfbf8176e6ba7d07f96669999cfa325ccaf862bcc97a36dbccf60f178cee11cde706761f16917ae30fe6b7488a7851bf14d7327417f676eb4f756eea41e2f57e6d83e83919f6cba117f04235fd9765b3b0fa36dfc398cf973edc67a6fb951ffe768ab6765ee26b8dff213ef5f4630e2b9e7463ea7ee8ee5ff60ee2618af8eb6fe3238437eb91bf1299cdbfacad3cadd5617f5a11738c7fe4adcb8ffd68d7aeec15e8fc3683b9f62ee2518ef33dafa3f75e3bc957086f86eb4d56f3db8e8e6dd56f01a5cc1bbe65e629673d8ebd18d0efdc9058cf9f2c08df9e630ce037db8719ec37c7a9a7fb708f10267b65e7cef46fb3e9ca3fd23dad6ef0cf67abe99f304f95ec3a8871cbb71be52d8d777e8b6fee412f6f958be3adf5ea817b561afe7d86ded7c67ce13c46fc37ede2766c17a17059cd9f38e466e8c3f8eb6fd700f0b9ef7095c37cd3d37de178f2be76dcf876fa343bd790267f012f67a77cc319f69b4ed872e2ca8e732daeabfe3c6fa9cc235f21f9b8bd4f2a5cd687bfedbfd659ee7ede017b842becf6eb44fa3cbd0df8559b0ffe808ceb0ff37e01afba3652e52cc87a26dbe276ecca7097790ff73b4cdef0616ac4fdf6df1c2d1d67ee8c6f80318eb4bd1180ff529513f0ecf7b694b62f5a002ceccb2662e523c2fb7605f9f0fd8fbbf75e3bc2dcd3e9ebcb9f17ce8c05e8f83685bcf701e44eb2db65e4fd1b65eebe62245be53b8c6f3ffdd8dfd3933fbf884761f5f0edcd88f951bf118bf44bde926dae24fe01ae7af76e3f9169e2f45bb143c0f5fdcf6fea23b18f773eac6f3e63ddac6db75e37df5e8c6fbae65aebcde6d37beaf84f528aa52f03c9dc3359ea79939c627d136deab1befaf75b883ef23e76e3ccfaea36d7dc2f795322b05ebfb0ad738af7db7ad371f99fd7e59b8b13f276e9cdf1318f5e54337e6d78cb67cf761ec170efba1acaa1afd9db92d3f3a36d729ea77efc6f33cbccf2beddfe6478fe6d85e45dbfd851bf1577007f5d877e3bc86f5a9ea3a2d6cffdfc1debe116df5db73a39e37b0e777191dda257c7fa83b6e8a2eaae00eeceb13d6b7d69f325b79b058fd32b170c1a55ebffaac2ccae2b9e6118f79c253bd6ef9ee3fd7587fef79c60f7acf3cc617fcc84ffcac6d8ffcc20b7ee5377ee7257ff027aff1bac66ff0269716cf5b1ab7cd3bbcabb17ddee37d3ee0433ee2633ee1019ff290cff89c2ff89229c48b66f1ac3d5df135df7093134eb9c56dcef4b3c35dee71ce393111dbfa8c784a4205955451cd1d1ad1982634a55bbad3f80eddd38c1ef882e66cf52ab5ff2b8d7ea4277aa6175ad06bb866f446efb4d4df0ffad4fed762ffb7b44e1b9cd2266dd142c75e5ddb3cd0bb3e347a477bd9d5f83ee245e3f7689f0ee830f67d44c77412ee186946033aa5e197fecfe85c7bf7be2fe892aee89a6ea84989f6bfa434f4eff9df52c509b5d0779b32ea684d13ea528f728d1e882ebfce37f6cf077422b4ea5b440ad14af1a15452ab473aee52c65ff39789b64fe955f44eb9937b5d858c5b32d377c0c32a7fee7ecd5fe61aff284ff22c2fb290577993775db1443fb53ef2219f5ff2bf93356d5b970dd9d41eb77820dbb223bbab155ed55ffab2f725ffb1eccb81aed6931cca116ab490633909d10339fd5ffdef795d869ae7923bc27226e772415d5986b51d683663b9d4fcfbb1ff190fe54aaec35aeaa577ee20f24673e94b531249a585fc2b69ebfe3ed7dae91f75ba964b5c03e9d344ba1add93bce0826c3f87f3b2a9fb6f18aeba10ba2f563f25eb1b563771a5d17531e2513c5fba538b3111cd690dd73c7ef6a95f4c8aa99de12fe77da4951de9ffffea730be7fd9fdfbffd0b690edc6c</data> + </image> +</images> +<connections> + <connection> + <sender>gesture_edit_button1</sender> + <signal>clicked()</signal> + <receiver>Gesture_triggers_tab_ui</receiver> + <slot>edit_gesture_pressed1()</slot> + </connection> + <connection> + <sender>gesture_edit_button2</sender> + <signal>clicked()</signal> + <receiver>Gesture_triggers_tab_ui</receiver> + <slot>edit_gesture_pressed2()</slot> + </connection> + <connection> + <sender>gesture_edit_button3</sender> + <signal>clicked()</signal> + <receiver>Gesture_triggers_tab_ui</receiver> + <slot>edit_gesture_pressed3()</slot> + </connection> +</connections> +<Q_SLOTS> + <slot access="protected" specifier="pure virtual">edit_gesture_pressed1()</slot> + <slot access="protected" specifier="pure virtual">edit_gesture_pressed2()</slot> + <slot access="protected" specifier="pure virtual">edit_gesture_pressed3()</slot> +</Q_SLOTS> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/khotkeys/kcontrol/ui/gestures_settings_tab_ui.ui b/khotkeys/kcontrol/ui/gestures_settings_tab_ui.ui new file mode 100644 index 000000000..17b881de9 --- /dev/null +++ b/khotkeys/kcontrol/ui/gestures_settings_tab_ui.ui @@ -0,0 +1,160 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>Gestures_settings_tab_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Gestures_settings_tab_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>492</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>mouse_gestures_globally</cstring> + </property> + <property name="text"> + <string>Disable mouse gestures globally</string> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>mouse_button_label</cstring> + </property> + <property name="text"> + <string>Mouse button:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mouse_button_combo</cstring> + </property> + </widget> + <widget class="TQComboBox"> + <property name="name"> + <cstring>mouse_button_combo</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>timeout_label</cstring> + </property> + <property name="text"> + <string>Gesture timeout (ms):</string> + </property> + <property name="buddy" stdset="0"> + <cstring>timeout_input</cstring> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>timeout_input</cstring> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="maxValue"> + <number>100000</number> + </property> + </widget> + </hbox> + </widget> + <widget class="TQGroupBox"> + <property name="name"> + <cstring>window_groupbox</cstring> + </property> + <property name="title"> + <string>Windows to Exclude</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="KHotKeys::Windowdef_list_widget"> + <property name="name"> + <cstring>windowdef_list_widget</cstring> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>50</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>KHotKeys::Windowdef_list_widget</class> + <header location="local">windowdef_list_widget.h</header> + <sizehint> + <width>200</width> + <height>100</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + <signal>autodetect_pressed()</signal> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="PNG" length="1114">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000042149444154789c8d95c18b1c4514c67fbb29e5b54ea05b26da1d36b08d096e8b11261871837bc8e282ac7ac82187e049a317e32d37110992bf42123c694eea414c0e0bf1b0ec6c402139485a54e8810c54c10e741146fa110bd643f74c12bd642e4d75f77cf5d5ef7dafdfc2ce7087d9eff32fdfdff74e5114104011e489d6e952cce5cfbe5998692dec0c77b87aedd3fddd9f2b3efce02291082209aa3504685022e4ffd7a000a82a765c515615ce95acae659c3f7765c100ec6e575cf8f822e991025f3b6a6f890c484f181ccfc1583428f5d4e2fe84da039aa04121b40eb32483a0ec6e5bce9f8385d36fa7fb9b1b17c8f31cbfe7a95c45be94520c72b2141a1caa160d1666e24ea94aa11ee7685054159d2ada34d41387c40dc63b8844f0b5c73a4bb19cb3f9de001f2aac1fa23aa209168c004224902e29d22ff1e38abbdb275055c4800610233867311a1491847a62c98f66ac6f14d8e99072f22daa15b68a8108424d6422e24c88e3966fbce4c9d786945b27f0be0103ed13c16004d59a2c4d58df28a87548e9aee2274ab95d60c7193c9a0281fc959ae2a4450364a9e2572c7a2b43438374ef2dd2154012d050514dbec7396578a3130d9d6850066f0ad9d186f2d78cdbbb799b0a202f2c48d3aebbb418310240b112637588574bf54b8efaa4fd9b691dacbf5b305813542bae63a9eee4c4694d967b5494eca8c7ef0933bdc5d90e6a2caa0e3f013b7adce9fa5b03d637561113a30106a71d18c5fd9677058338ad01e91c0b8b743b880182ce19cd9c0e5e2b583fbdda565d3d04cfedad180942133af201b2bc3588e111c680068f489780ce69b192b279768088524f2b3458ea694d3de99a4323bc976ed34eb86b98c51993f6be10f77240c99685cd731991f1582df15aa15a213d583f5313a7806988fb8a0640e336359d9e9933568bf44062214ba19e2a7652a13d8b068ff596b807182189234e9da9f1ceb78c81b28c3ac6fe21e306c58e41d5118952acd6a0c2f56b9e6a5c72f346cdcd6b19a3bf8010010d714f89533b674c90c7189b598eab12a45fb5c75b8253672b863fbcccf5af93b6904119fe9851bf5153ac3a746ae7b9d5698c1dc58f313e70e4707ce9d84bafa2f79fc23fb8c7c1438ef04031a2642fee21060ec69ee47020796ecaa12313ccd333d1b67935047acf2be3bb11aa010dbe656cc755dbe3b772084a7ebc6d5711253b593dfcc0cc8fcd3cafda455512c7f200ec56cbfac0f1d7d34b7fdf0f98fd88a92a7e9cb0e70cc933c0b38a2c823ea0bd76c70c016adb67f47bc2a117a6d40abeea33fa23c2fb867edfb413e4a34fded94ffb3991c46dc7754cd3634ad2af490b857f5a5137126a97e02a8120a485235b6a28ef80bd077ee2b9f2d54fed04595dcbd8ddb6c4bd87334c10cadb2064e856177e7864e669fbe1df154a0142839f7ad2e5b6880bff1da66eece78e315d959f609da670f98befe6c3f45fb42672c9acff7f660000000049454e44ae426082</data> + </image> +</images> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<includehints> + <includehint>knuminput.h</includehint> +</includehints> +</UI> diff --git a/khotkeys/kcontrol/ui/info_tab_ui.ui b/khotkeys/kcontrol/ui/info_tab_ui.ui new file mode 100644 index 000000000..2aeaee5c6 --- /dev/null +++ b/khotkeys/kcontrol/ui/info_tab_ui.ui @@ -0,0 +1,64 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KHotKeys::Info_tab_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Info_tab_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>388</width> + <height>317</height> + </rect> + </property> + <property name="caption"> + <string>Info_tab_ui</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>warning_label</cstring> + </property> + <property name="text"> + <string><p>This module allows configuring input actions, like mouse gestures, keyboard shortcuts for performing commands, launching applications or DCOP calls, and similar.</p> +<p><b>NOTE: </b>If you are not an experienced user, you should be careful with modifying the actions, and should limit your changes mainly to enabling/disabling actions, and changing triggers.</p></string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer7</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/khotkeys/kcontrol/ui/keyboard_input_widget_ui.ui b/khotkeys/kcontrol/ui/keyboard_input_widget_ui.ui new file mode 100644 index 000000000..81baf6679 --- /dev/null +++ b/khotkeys/kcontrol/ui/keyboard_input_widget_ui.ui @@ -0,0 +1,193 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KHotKeys::Keyboard_input_widget_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Keyboard_input_widget_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>548</width> + <height>544</height> + </rect> + </property> + <property name="caption"> + <string>Keyboard_input_widget_ui</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>keyboard_input_label</cstring> + </property> + <property name="text"> + <string>Keyboard input:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>keyboard_input_multilineedit</cstring> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="KTextEdit"> + <property name="name"> + <cstring>keyboard_input_multilineedit</cstring> + </property> + <property name="textFormat"> + <enum>PlainText</enum> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>modify_button</cstring> + </property> + <property name="text"> + <string>Modify...</string> + </property> + </widget> + </hbox> + </widget> + <widget class="TQButtonGroup"> + <property name="name"> + <cstring>buttonGroup1</cstring> + </property> + <property name="title"> + <string>Send Input To</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Specify the window where the keyboard input should be sent to:<ul> +<li><em>Action window:</em> The window where the triggering action happened; this is usually the currently active window, except for mouse gesture triggers - where it is the window under mouse - and window triggers -where it is the window triggering the action.</li> +<li><em>Active window:</em> The currently active window.</li> +<li><em>Specific window:</em> Any window matching the given criteria.</li> +</ul></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>action_window_radio</cstring> + </property> + <property name="text"> + <string>Action window</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>active_window_radio</cstring> + </property> + <property name="text"> + <string>Active window</string> + </property> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>specific_window_radio</cstring> + </property> + <property name="text"> + <string>Specific window</string> + </property> + </widget> + </vbox> + </widget> + <widget class="TQGroupBox"> + <property name="name"> + <cstring>window_groupbox</cstring> + </property> + <property name="title"> + <string>Window</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="KHotKeys::Windowdef_list_widget"> + <property name="name"> + <cstring>windowdef_list_widget</cstring> + </property> + </widget> + </vbox> + </widget> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>KHotKeys::Windowdef_list_widget</class> + <header location="local">windowdef_list_widget.h</header> + <sizehint> + <width>200</width> + <height>100</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + <signal>autodetect_pressed()</signal> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="PNG" length="1114">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000042149444154789c8d95c18b1c4514c67fbb29e5b54ea05b26da1d36b08d096e8b11261871837bc8e282ac7ac82187e049a317e32d37110992bf42123c694eea414c0e0bf1b0ec6c402139485a54e8810c54c10e741146fa110bd643f74c12bd642e4d75f77cf5d5ef7dafdfc2ce7087d9eff32fdfdff74e5114104011e489d6e952cce5cfbe5998692dec0c77b87aedd3fddd9f2b3efce02291082209aa3504685022e4ffd7a000a82a765c515615ce95acae659c3f7765c100ec6e575cf8f822e991025f3b6a6f890c484f181ccfc1583428f5d4e2fe84da039aa04121b40eb32483a0ec6e5bce9f8385d36fa7fb9b1b17c8f31cbfe7a95c45be94520c72b2141a1caa160d1666e24ea94aa11ee7685054159d2ada34d41387c40dc63b8844f0b5c73a4bb19cb3f9de001f2aac1fa23aa209168c004224902e29d22ff1e38abbdb275055c4800610233867311a1491847a62c98f66ac6f14d8e99072f22daa15b68a8108424d6422e24c88e3966fbce4c9d786945b27f0be0103ed13c16004d59a2c4d58df28a87548e9aee2274ab95d60c7193c9a0281fc959ae2a4450364a9e2572c7a2b43438374ef2dd2154012d050514dbec7396578a3130d9d6850066f0ad9d186f2d78cdbbb799b0a202f2c48d3aebbb418310240b112637588574bf54b8efaa4fd9b691dacbf5b305813542bae63a9eee4c4694d967b5494eca8c7ef0933bdc5d90e6a2caa0e3f013b7adce9fa5b03d637561113a30106a71d18c5fd9677058338ad01e91c0b8b743b880182ce19cd9c0e5e2b583fbdda565d3d04cfedad180942133af201b2bc3588e111c680068f489780ce69b192b279768088524f2b3458ea694d3de99a4323bc976ed34eb86b98c51993f6be10f77240c99685cd731991f1582df15aa15a213d583f5313a7806988fb8a0640e336359d9e9933568bf44062214ba19e2a7652a13d8b068ff596b807182189234e9da9f1ceb78c81b28c3ac6fe21e306c58e41d5118952acd6a0c2f56b9e6a5c72f346cdcd6b19a3bf8010010d714f89533b674c90c7189b598eab12a45fb5c75b8253672b863fbcccf5af93b6904119fe9851bf5153ac3a746ae7b9d5698c1dc58f313e70e4707ce9d84bafa2f79fc23fb8c7c1438ef04031a2642fee21060ec69ee47020796ecaa12313ccd333d1b67935047acf2be3bb11aa010dbe656cc755dbe3b772084a7ebc6d5711253b593dfcc0cc8fcd3cafda455512c7f200ec56cbfac0f1d7d34b7fdf0f98fd88a92a7e9cb0e70cc933c0b38a2c823ea0bd76c70c016adb67f47bc2a117a6d40abeea33fa23c2fb867edfb413e4a34fded94ffb3991c46dc7754cd3634ad2af490b857f5a5137126a97e02a8120a485235b6a28ef80bd077ee2b9f2d54fed04595dcbd8ddb6c4bd87334c10cadb2064e856177e7864e669fbe1df154a0142839f7ad2e5b6880bff1da66eece78e315d959f609da670f98befe6c3f45fb42672c9acff7f660000000049454e44ae426082</data> + </image> +</images> +<connections> + <connection> + <sender>modify_button</sender> + <signal>clicked()</signal> + <receiver>Keyboard_input_widget_ui</receiver> + <slot>modify_pressed()</slot> + </connection> + <connection> + <sender>specific_window_radio</sender> + <signal>toggled(bool)</signal> + <receiver>window_groupbox</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<Q_SLOTS> + <slot access="protected" specifier="pure virtual">modify_pressed()</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<includehints> + <includehint>ktextedit.h</includehint> +</includehints> +</UI> diff --git a/khotkeys/kcontrol/ui/main_buttons_widget_ui.ui b/khotkeys/kcontrol/ui/main_buttons_widget_ui.ui new file mode 100644 index 000000000..f559dd7bc --- /dev/null +++ b/khotkeys/kcontrol/ui/main_buttons_widget_ui.ui @@ -0,0 +1,86 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>KHotKeys::Main_buttons_widget_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Main_buttons_widget_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>828</width> + <height>66</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQPushButton"> + <property name="name"> + <cstring>new_action_button</cstring> + </property> + <property name="text"> + <string>&New Action</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>new_action_group_button</cstring> + </property> + <property name="text"> + <string>New &Group</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>delete_action_button</cstring> + </property> + <property name="text"> + <string>Delete Action</string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>Line3</cstring> + </property> + <property name="frameShape"> + <enum>VLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>global_settings_button</cstring> + </property> + <property name="text"> + <string>Global &Settings</string> + </property> + </widget> + </hbox> +</widget> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/khotkeys/kcontrol/ui/menuentry_widget_ui.ui b/khotkeys/kcontrol/ui/menuentry_widget_ui.ui new file mode 100644 index 000000000..6af0aefc6 --- /dev/null +++ b/khotkeys/kcontrol/ui/menuentry_widget_ui.ui @@ -0,0 +1,100 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>KHotKeys::Menuentry_widget_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Menuentry_widget_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>580</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>menuentry_label</cstring> + </property> + <property name="text"> + <string>Menu entry to execute:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>command_url_lineedit</cstring> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>menuentry_lineedit</cstring> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>browse_button</cstring> + </property> + <property name="text"> + <string>&Browse...</string> + </property> + </widget> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer16</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<connections> + <connection> + <sender>browse_button</sender> + <signal>clicked()</signal> + <receiver>Menuentry_widget_ui</receiver> + <slot>browse_pressed()</slot> + </connection> +</connections> +<Q_SLOTS> + <slot access="protected" specifier="pure virtual">browse_pressed()</slot> +</Q_SLOTS> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/khotkeys/kcontrol/ui/triggers_tab_ui.ui b/khotkeys/kcontrol/ui/triggers_tab_ui.ui new file mode 100644 index 000000000..557be7dd4 --- /dev/null +++ b/khotkeys/kcontrol/ui/triggers_tab_ui.ui @@ -0,0 +1,171 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>KHotKeys::Triggers_tab_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Triggers_tab_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>564</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>comment_label</cstring> + </property> + <property name="text"> + <string>Comment:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>comment_lineedit</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>comment_lineedit</cstring> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KHotKeys::KHListView"> + <property name="name"> + <cstring>triggers_listview</cstring> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQPushButton"> + <property name="name"> + <cstring>new_button</cstring> + </property> + <property name="text"> + <string>&New</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>modify_button</cstring> + </property> + <property name="text"> + <string>&Modify...</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>copy_button</cstring> + </property> + <property name="text"> + <string>&Copy</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>delete_button</cstring> + </property> + <property name="text"> + <string>Delete</string> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>KHotKeys::KHListView</class> + <header location="global">khlistview.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + <signal>currentChanged(TQListViewItem*)</signal> + <signal>current_changed(TQListViewItem*)</signal> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="XPM.GZ" length="4462">789c9d97c76e24490e86effd1442f3d65870d2451a0ce6206f5adeb4cc620f8c34f2553225b5a4c1befb46927fe6a1d4c0ccac4287fa8a0c26834193f5dbb785b3fd9d856fbf7d799ec9ecba5ea8afe469e15bf3727ffffeeffffcf1e797af49b2d0ffc7d142f2f55f5fbe1ecc16ea85dde9a4ed81290045faa77ca49cf4ab67ba1e3953969173651ab9d4fdf1c8a27c3872ad7c3c72d3b32c2a67c3f3444636fbef23eb7e590267e68fcc4656395d8dacf6d938ef97eaef289781cddebdb2846fccff44b989ba58e3411f3dc75158e6df1d3889539517ca49bf54fe43398d1dec4f46567f685fd9c539f43fc025f80c1c3ce8d93f28e77185f8bf0c6cfae4c0b5f9c3c6e5c0542a4b5876fe13708df39d2bd7716372aa8c93c4e4723bb2f977aadc26ceec4bdb7310e6b0bfab9c2445ecd49f1370694cebca65d260ffa6711a41aef14d24e94cee6be3348e0ae5e9c8765f07ca3e8db17f0f9c825794eb3489351fe9bb7217e4969f29388bd51ee9fda5715a19730696b852fea95c6471647ca95cf64bcf43e0cef4657b647bfe6acf213d6bb32f9a9f5992b5a64f9a8f990b6cf9ecc15d6cf9acf6b2da55a8a75cb973dee4b2d1b38b5c05de02434e87e01aacfb351df5bebddea74b5c67f9c795711ea15e357e2ecde358fb87efc0a867df8cac728a074e62e527706afb59f3cf6583be5c28bb3c35f693812d1fbdc6dbe57966fec932d899ffa4f7e38adca17e34beaeca4b9c271a18f1d5fc739257b0d70d9c68be7bed7fcee7827ab91cd8e4740cf6b19d4ffb87ab07b9bf516e72d4a3ac821b9cef6e60d84f47367ded2fae1d9f7704f6163f79000ffde27660f387ed3c5dbf54dfeebb0bf6acbe6b706bfa5ef32f8f8b18f5bf0f463f20edb77956a4e68fbc80b3c4facd163847be6bfde72ec86dbeac82715fbc0286be683cf3bc081d44f7df80d344fb0b6b7de64581fb916765297263d6fccd9b7ee97e566e8b06cfdb1f59cf2bda2f8bbc2c11df0c5c41aefdb328ca22b1feb0012eedbce24736f91b18fb796d64eb87cb60817dcdafb07d906bfd14d22f659d8785ef97b2f6d7b2df6ef1d6fb2babaac6f92e8c25b27ecc1f239b7f3a5fca5a8678ea7c2d9bc0e6ef1238b3fca2c7814d5f4cbf9334b5f833384bed3c7a5f5514f4adbe2ec07962e7590457f06f6f649b977afe2a16f42f5e070bfc591e18f7a5f1a812a9e0df39d827da4fbd8c6ccfd7785569bf945f953371a9d5a3de67950bfa2d75c63eb2fb15bdcfaaf011e6c7263846bf8f4636f91618f3c7d3c0f047fb69550efab2074e12bd6fd27957553ec33c5b043bcc7f9d0795f818fdb501a3df8ae673e507ff69021eea37063bc45ffb73550736ff36c0a84f3e0317a86f8b5f139e6ffe1f821de6d9127898ff3be00a7c3ab2cd03e3d697560ff40016e47b3bb2e96bbd559d8f32bbff4b7065f193042c98873acf240af6adbf3c83c5f2954bb0c7bcd77c107d81d2fdebc63e33ff640aaecc9e1c8151df5c803dfaadc64b52dfa03ed64636ffb4ff4b2867f453ede7227586fcd3f9264ded91fffafe236d5da37fe83c91ceb7b9e5b7f6731ff92ed7f747d6fbf7e185cf58347e3e6932e47b3430fa893edf87d795c2fc3f003b67f5f902cec17abfde0dfa3c053b3c5ffb832fc2eb8fddcf233887fc195c801f46b6f3cdc02558fba72f7d2d1a7f7e321ee58fe0cad86bbff24dd3e2fe74fef836b0c6eb60d62fa6bf5e07b3419f853dd7dc70fb8bd5f1255fd90ed30f9f3c5ff30ddff21ddff384a7fcc08ffcc4cf61cdf8855ff9e79c7e1db4dff89d3f7891977899577895d7789d377893b7f83b6fcfe937bc13b477798ff7f9800ff928ac633ee11f7cca6761d7f99c7e1b3cb908da11c7413be1943376e153cc39175c72f549ff9e17c31744429e6a6aa8a58e2ee98aaee9866e7f617fc24b7417a4f734a1293dd0233dd133cd8285177aa5f9f3b63ca5377aa78f607b919668995682e62aadd17ab0b1419b9ff41f682b48bed336edd02eed05ed7d5ea3033a0cdf1ed1f127fd273ae123fa41a774a6b685cee982228a837e42e927fd47caf8985c38651eb40b2ac38e4a5842658a97fab33fd248cb87d2c9a55cc9b5dcc82d1fc99ddccb44a6f230af2f8ff224cf417f262ff22a3fe54ddee543166549966545567f617f4dd66523dc6b2c9bb225df655b7682f692ecca9eeccfe97772c09b722847722c27c1f3eb70f66bf9116c9fca999ccbc59cfe25bf4a143a5ef8992561324a78bd92522acf9ebc78efe7cf7b153276db37bef59dbff457fedadff85b7f27abfede4ffcd4cf9ff76faeff4fffefeff8c7f5fedfdfbffc0fa355c495</data> + </image> +</images> +<connections> + <connection> + <sender>modify_button</sender> + <signal>clicked()</signal> + <receiver>Triggers_tab_ui</receiver> + <slot>modify_pressed()</slot> + </connection> + <connection> + <sender>delete_button</sender> + <signal>clicked()</signal> + <receiver>Triggers_tab_ui</receiver> + <slot>delete_pressed()</slot> + </connection> + <connection> + <sender>copy_button</sender> + <signal>clicked()</signal> + <receiver>Triggers_tab_ui</receiver> + <slot>copy_pressed()</slot> + </connection> + <connection> + <sender>triggers_listview</sender> + <signal>current_changed(TQListViewItem*)</signal> + <receiver>Triggers_tab_ui</receiver> + <slot>current_changed(TQListViewItem*)</slot> + </connection> +</connections> +<forwards> + <forward>class TQListViewItem;</forward> +</forwards> +<Q_SLOTS> + <slot access="protected" specifier="pure virtual">copy_pressed()</slot> + <slot access="protected" specifier="pure virtual">current_changed(TQListViewItem*)</slot> + <slot access="protected" specifier="pure virtual">delete_pressed()</slot> + <slot access="protected" specifier="pure virtual">modify_pressed()</slot> +</Q_SLOTS> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/khotkeys/kcontrol/ui/voice_input_widget_ui.ui b/khotkeys/kcontrol/ui/voice_input_widget_ui.ui new file mode 100644 index 000000000..c30ff6293 --- /dev/null +++ b/khotkeys/kcontrol/ui/voice_input_widget_ui.ui @@ -0,0 +1,104 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>Voice_input_widget_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>486</width> + <height>51</height> + </rect> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>label</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>buttonPlay</cstring> + </property> + <property name="text"> + <string>&Play</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>buttonRecord</cstring> + </property> + <property name="text"> + <string>&Record</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>buttonStop</cstring> + </property> + <property name="text"> + <string>&Stop</string> + </property> + </widget> + </hbox> +</widget> +<connections> + <connection> + <sender>buttonRecord</sender> + <signal>pressed()</signal> + <receiver>Form1</receiver> + <slot>slotRecordPressed()</slot> + </connection> + <connection> + <sender>buttonStop</sender> + <signal>pressed()</signal> + <receiver>Form1</receiver> + <slot>slotStopPressed()</slot> + </connection> + <connection> + <sender>buttonStop</sender> + <signal><No Signal></signal> + <receiver>buttonStop</receiver> + <slot><No)</slot> + </connection> + <connection> + <sender>buttonPlay</sender> + <signal>pressed()</signal> + <receiver>Form1</receiver> + <slot>slotPlayPressed()</slot> + </connection> +</connections> +<Q_SLOTS> + <slot access="protected" specifier="pure virtual">slotRecordPressed()</slot> + <slot access="protected" specifier="pure virtual">slotPlayPressed()</slot> + <slot access="protected" specifier="pure virtual">slotStopPressed()</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/khotkeys/kcontrol/ui/voice_settings_tab_ui.ui b/khotkeys/kcontrol/ui/voice_settings_tab_ui.ui new file mode 100644 index 000000000..f80ebae1b --- /dev/null +++ b/khotkeys/kcontrol/ui/voice_settings_tab_ui.ui @@ -0,0 +1,107 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>Voice_settings_tab_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Voice_settings_tab_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>473</width> + <height>380</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>In order to trigger a spoken action, you have to press the key (or combination of keys) configured below, speak the command and then press the same key again once you have finished speaking.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Shortcut:</string> + </property> + </widget> + <widget class="KKeyButton"> + <property name="name"> + <cstring>keyButton</cstring> + </property> + <property name="text"> + <string>None</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>241</width> + <height>21</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>90</height> + </size> + </property> + </spacer> + <widget class="TQLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string><b>Note:</b> To get voice recognition working correctly and in full duplex mode: +make sure <i>Full duplex</i> is checked in your <i>Sound System</i> options.</string> + </property> + </widget> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kkeybutton.h</includehint> +</includehints> +</UI> diff --git a/khotkeys/kcontrol/ui/window_trigger_widget_ui.ui b/khotkeys/kcontrol/ui/window_trigger_widget_ui.ui new file mode 100644 index 000000000..c6a8ae73e --- /dev/null +++ b/khotkeys/kcontrol/ui/window_trigger_widget_ui.ui @@ -0,0 +1,131 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>KHotKeys::Window_trigger_widget_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Window_trigger_widget_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>592</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQGroupBox"> + <property name="name"> + <cstring>GroupBox4</cstring> + </property> + <property name="title"> + <string>Trigger When</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>window_appears_checkbox</cstring> + </property> + <property name="text"> + <string>Window appears</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>window_disappears_checkbox</cstring> + </property> + <property name="text"> + <string>Window disappears</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>window_activates_checkbox</cstring> + </property> + <property name="text"> + <string>Window activates</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>window_deactivates_checkbox</cstring> + </property> + <property name="text"> + <string>Window deactivates</string> + </property> + </widget> + </vbox> + </widget> + <widget class="TQGroupBox"> + <property name="name"> + <cstring>window_groupbox</cstring> + </property> + <property name="title"> + <string>Window</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="KHotKeys::Windowdef_list_widget"> + <property name="name"> + <cstring>windowdef_list_widget</cstring> + </property> + </widget> + </vbox> + </widget> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>Windowdef_list_widget</class> + <header location="local">windowdef_list_widget.h</header> + <sizehint> + <width>200</width> + <height>100</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + <signal>autodetect_pressed()</signal> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> + </image> +</images> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/khotkeys/kcontrol/ui/windowdef_list_widget_ui.ui b/khotkeys/kcontrol/ui/windowdef_list_widget_ui.ui new file mode 100644 index 000000000..aaa52e891 --- /dev/null +++ b/khotkeys/kcontrol/ui/windowdef_list_widget_ui.ui @@ -0,0 +1,170 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>KHotKeys::Windowdef_list_widget_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Windowdef_list_widget_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>572</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>comment_label</cstring> + </property> + <property name="text"> + <string>Comment:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>comment_lineedit</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>comment_lineedit</cstring> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KHotKeys::KHListView"> + <property name="name"> + <cstring>windows_listview</cstring> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQPushButton"> + <property name="name"> + <cstring>new_button</cstring> + </property> + <property name="text"> + <string>&New</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>modify_button</cstring> + </property> + <property name="text"> + <string>&Modify...</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>copy_button</cstring> + </property> + <property name="text"> + <string>&Copy</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>delete_button</cstring> + </property> + <property name="text"> + <string>Delete</string> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>KHotKeys::KHListView</class> + <header location="global">khlistview.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + <signal>current_changed(TQListViewItem*)</signal> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="XPM.GZ" length="4462">789c9d97c76e24490e86effd1442f3d65870d2451a0ce6206f5adeb4cc620f8c34f2553225b5a4c1befb46927fe6a1d4c0ccac4287fa8a0c26834193f5dbb785b3fd9d856fbf7d799ec9ecba5ea8afe469e15bf3727ffffeeffffcf1e797af49b2d0ffc7d142f2f55f5fbe1ecc16ea85dde9a4ed81290045faa77ca49cf4ab67ba1e3953969173651ab9d4fdf1c8a27c3872ad7c3c72d3b32c2a67c3f3444636fbef23eb7e590267e68fcc4656395d8dacf6d938ef97eaef289781cddebdb2846fccff44b989ba58e3411f3dc75158e6df1d3889539517ca49bf54fe43398d1dec4f46567f685fd9c539f43fc025f80c1c3ce8d93f28e77185f8bf0c6cfae4c0b5f9c3c6e5c0542a4b5876fe13708df39d2bd7716372aa8c93c4e4723bb2f977aadc26ceec4bdb7310e6b0bfab9c2445ecd49f1370694cebca65d260ffa6711a41aef14d24e94cee6be3348e0ae5e9c8765f07ca3e8db17f0f9c825794eb3489351fe9bb7217e4969f29388bd51ee9fda5715a19730696b852fea95c6471647ca95cf64bcf43e0cef4657b647bfe6acf213d6bb32f9a9f5992b5a64f9a8f990b6cf9ecc15d6cf9acf6b2da55a8a75cb973dee4b2d1b38b5c05de02434e87e01aacfb351df5bebddea74b5c67f9c795711ea15e357e2ecde358fb87efc0a867df8cac728a074e62e527706afb59f3cf6583be5c28bb3c35f693812d1fbdc6dbe57966fec932d899ffa4f7e38adca17e34beaeca4b9c271a18f1d5fc739257b0d70d9c68be7bed7fcee7827ab91cd8e4740cf6b19d4ffb87ab07b9bf516e72d4a3ac821b9cef6e60d84f47367ded2fae1d9f7704f6163f79000ffde27660f387ed3c5dbf54dfeebb0bf6acbe6b706bfa5ef32f8f8b18f5bf0f463f20edb77956a4e68fbc80b3c4facd163847be6bfde72ec86dbeac82715fbc0286be683cf3bc081d44f7df80d344fb0b6b7de64581fb916765297263d6fccd9b7ee97e566e8b06cfdb1f59cf2bda2f8bbc2c11df0c5c41aefdb328ca22b1feb0012eedbce24736f91b18fb796d64eb87cb60817dcdafb07d906bfd14d22f659d8785ef97b2f6d7b2df6ef1d6fb2babaac6f92e8c25b27ecc1f239b7f3a5fca5a8678ea7c2d9bc0e6ef1238b3fca2c7814d5f4cbf9334b5f833384bed3c7a5f5514f4adbe2ec07962e7590457f06f6f649b977afe2a16f42f5e070bfc591e18f7a5f1a812a9e0df39d827da4fbd8c6ccfd7785569bf945f953371a9d5a3de67950bfa2d75c63eb2fb15bdcfaaf011e6c7263846bf8f4636f91618f3c7d3c0f047fb69550efab2074e12bd6fd27957553ec33c5b043bcc7f9d0795f818fdb501a3df8ae673e507ff69021eea37063bc45ffb73550736ff36c0a84f3e0317a86f8b5f139e6ffe1f821de6d9127898ff3be00a7c3ab2cd03e3d697560ff40016e47b3bb2e96bbd559d8f32bbff4b7065f193042c98873acf240af6adbf3c83c5f2954bb0c7bcd77c107d81d2fdebc63e33ff640aaecc9e1c8151df5c803dfaadc64b52dfa03ed64636ffb4ff4b2867f453ede7227586fcd3f9264ded91fffafe236d5da37fe83c91ceb7b9e5b7f6731ff92ed7f747d6fbf7e185cf58347e3e6932e47b3430fa893edf87d795c2fc3f003b67f5f902cec17abfde0dfa3c053b3c5ffb832fc2eb8fddcf233887fc195c801f46b6f3cdc02558fba72f7d2d1a7f7e321ee58fe0cad86bbff24dd3e2fe74fef836b0c6eb60d62fa6bf5e07b3419f853dd7dc70fb8bd5f1255fd90ed30f9f3c5ff30ddff21ddff384a7fcc08ffcc4cf61cdf8855ff9e79c7e1db4dff89d3f7891977899577895d7789d377893b7f83b6fcfe937bc13b477798ff7f9800ff928ac633ee11f7cca6761d7f99c7e1b3cb908da11c7413be1943376e153cc39175c72f549ff9e17c31744429e6a6aa8a58e2ee98aaee9866e7f617fc24b7417a4f734a1293dd0233dd133cd8285177aa5f9f3b63ca5377aa78f607b919668995682e62aadd17ab0b1419b9ff41f682b48bed336edd02eed05ed7d5ea3033a0cdf1ed1f127fd273ae123fa41a774a6b685cee982228a837e42e927fd47caf8985c38651eb40b2ac38e4a5842658a97fab33fd248cb87d2c9a55cc9b5dcc82d1fc99ddccb44a6f230af2f8ff224cf417f262ff22a3fe54ddee543166549966545567f617f4dd66523dc6b2c9bb225df655b7682f692ecca9eeccfe97772c09b722847722c27c1f3eb70f66bf9116c9fca999ccbc59cfe25bf4a143a5ef8992561324a78bd92522acf9ebc78efe7cf7b153276db37bef59dbff457fedadff85b7f27abfede4ffcd4cf9ff76faeff4fffefeff8c7f5fedfdfbffc0fa355c495</data> + </image> +</images> +<connections> + <connection> + <sender>copy_button</sender> + <signal>clicked()</signal> + <receiver>Windowdef_list_widget_ui</receiver> + <slot>copy_pressed()</slot> + </connection> + <connection> + <sender>modify_button</sender> + <signal>clicked()</signal> + <receiver>Windowdef_list_widget_ui</receiver> + <slot>modify_pressed()</slot> + </connection> + <connection> + <sender>delete_button</sender> + <signal>clicked()</signal> + <receiver>Windowdef_list_widget_ui</receiver> + <slot>delete_pressed()</slot> + </connection> + <connection> + <sender>windows_listview</sender> + <signal>current_changed(TQListViewItem*)</signal> + <receiver>Windowdef_list_widget_ui</receiver> + <slot>current_changed(TQListViewItem*)</slot> + </connection> +</connections> +<forwards> + <forward>class TQListViewItem;</forward> +</forwards> +<Q_SLOTS> + <slot access="protected" specifier="pure virtual">copy_pressed()</slot> + <slot access="protected" specifier="pure virtual">current_changed(TQListViewItem*)</slot> + <slot access="protected" specifier="pure virtual">delete_pressed()</slot> + <slot access="protected" specifier="pure virtual">modify_pressed()</slot> +</Q_SLOTS> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/khotkeys/kcontrol/ui/windowdef_simple_widget_ui.ui b/khotkeys/kcontrol/ui/windowdef_simple_widget_ui.ui new file mode 100644 index 000000000..d15dab5df --- /dev/null +++ b/khotkeys/kcontrol/ui/windowdef_simple_widget_ui.ui @@ -0,0 +1,493 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>KHotKeys::Windowdef_simple_widget_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Windowdef_simple_widget_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>588</width> + <height>497</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>comment_label</cstring> + </property> + <property name="text"> + <string>&Comment:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>comment_lineedit</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>comment_lineedit</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>window_title_label</cstring> + </property> + <property name="text"> + <string>Window &title:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>window_title_lineedit</cstring> + </property> + </widget> + <widget class="TQComboBox"> + <item> + <property name="text"> + <string>Is Not Important</string> + </property> + </item> + <item> + <property name="text"> + <string>Contains</string> + </property> + </item> + <item> + <property name="text"> + <string>Is</string> + </property> + </item> + <item> + <property name="text"> + <string>Matches Regular Expression</string> + </property> + </item> + <item> + <property name="text"> + <string>Does Not Contain</string> + </property> + </item> + <item> + <property name="text"> + <string>Is Not</string> + </property> + </item> + <item> + <property name="text"> + <string>Does Not Match Regular Expression</string> + </property> + </item> + <property name="name"> + <cstring>window_title_combo</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>window_title_lineedit</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>window_class_label</cstring> + </property> + <property name="text"> + <string>Window c&lass:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>window_class_lineedit</cstring> + </property> + </widget> + <widget class="TQComboBox"> + <item> + <property name="text"> + <string>Is Not Important</string> + </property> + </item> + <item> + <property name="text"> + <string>Contains</string> + </property> + </item> + <item> + <property name="text"> + <string>Is</string> + </property> + </item> + <item> + <property name="text"> + <string>Matches Regular Expression</string> + </property> + </item> + <item> + <property name="text"> + <string>Does Not Contain</string> + </property> + </item> + <item> + <property name="text"> + <string>Is Not</string> + </property> + </item> + <item> + <property name="text"> + <string>Does Not Match Regular Expression</string> + </property> + </item> + <property name="name"> + <cstring>window_class_combo</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>window_class_lineedit</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer7</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>window_role_label</cstring> + </property> + <property name="text"> + <string>Window &role:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>window_role_lineedit</cstring> + </property> + </widget> + <widget class="TQComboBox"> + <item> + <property name="text"> + <string>Is Not Important</string> + </property> + </item> + <item> + <property name="text"> + <string>Contains</string> + </property> + </item> + <item> + <property name="text"> + <string>Is</string> + </property> + </item> + <item> + <property name="text"> + <string>Matches Regular Expression</string> + </property> + </item> + <item> + <property name="text"> + <string>Does Not Contain</string> + </property> + </item> + <item> + <property name="text"> + <string>Is Not</string> + </property> + </item> + <item> + <property name="text"> + <string>Does Not Match Regular Expression</string> + </property> + </item> + <property name="name"> + <cstring>window_role_combo</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>window_role_lineedit</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer15</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Spacer13</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>autodetect_button</cstring> + </property> + <property name="text"> + <string>&Autodetect</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer14</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer7_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQGroupBox"> + <property name="name"> + <cstring>window_types_groupbox</cstring> + </property> + <property name="title"> + <string>Window Types</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQCheckBox" row="0" column="0"> + <property name="name"> + <cstring>type_normal_checkbox</cstring> + </property> + <property name="text"> + <string>Normal</string> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="0"> + <property name="name"> + <cstring>type_dialog_checkbox</cstring> + </property> + <property name="text"> + <string>Dialog</string> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="1"> + <property name="name"> + <cstring>type_desktop_checkbox</cstring> + </property> + <property name="text"> + <string>Desktop</string> + </property> + </widget> + <widget class="TQCheckBox" row="0" column="1"> + <property name="name"> + <cstring>type_dock_checkbox</cstring> + </property> + <property name="text"> + <string>Dock</string> + </property> + </widget> + </grid> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>window_class_combo</sender> + <signal>activated(int)</signal> + <receiver>Windowdef_simple_widget_ui</receiver> + <slot>window_class_combo_changed(int)</slot> + </connection> + <connection> + <sender>window_role_combo</sender> + <signal>activated(int)</signal> + <receiver>Windowdef_simple_widget_ui</receiver> + <slot>window_role_combo_changed(int)</slot> + </connection> + <connection> + <sender>window_title_combo</sender> + <signal>activated(int)</signal> + <receiver>Windowdef_simple_widget_ui</receiver> + <slot>window_title_combo_changed(int)</slot> + </connection> +</connections> +<tabstops> + <tabstop>comment_lineedit</tabstop> + <tabstop>window_title_combo</tabstop> + <tabstop>window_title_lineedit</tabstop> + <tabstop>window_class_combo</tabstop> + <tabstop>window_class_lineedit</tabstop> + <tabstop>window_role_combo</tabstop> + <tabstop>window_role_lineedit</tabstop> + <tabstop>autodetect_button</tabstop> +</tabstops> +<Q_SLOTS> + <slot access="protected" specifier="pure virtual">window_class_combo_changed(int)</slot> + <slot access="protected" specifier="pure virtual">window_role_combo_changed(int)</slot> + <slot access="protected" specifier="pure virtual">window_title_combo_changed(int)</slot> +</Q_SLOTS> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/khotkeys/kcontrol/voice_settings_tab.cpp b/khotkeys/kcontrol/voice_settings_tab.cpp new file mode 100644 index 000000000..1d97d69ab --- /dev/null +++ b/khotkeys/kcontrol/voice_settings_tab.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2005 Olivier Goffart <ogoffart @ kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#include "voice_settings_tab.h" + +#include <tdelocale.h> +#include <tqcombobox.h> +#include <knuminput.h> +#include <tqcheckbox.h> +#include <kkeybutton.h> +#include <kkeydialog.h> + +#include "kcmkhotkeys.h" +#include "windowdef_list_widget.h" + +namespace KHotKeys +{ + +Voice_settings_tab::Voice_settings_tab( TQWidget* parent_P, const char* name_P ) + : Voice_settings_tab_ui( parent_P, name_P ) + { + connect( keyButton , TQT_SIGNAL(capturedShortcut (const TDEShortcut &)) , this, TQT_SLOT(slotCapturedKey( const TDEShortcut& ))); + } + +void Voice_settings_tab::read_data() + { + keyButton->setShortcut( module->voice_shortcut() ); + } + +void Voice_settings_tab::write_data() const + { + module->set_voice_shortcut( keyButton->shortcut() ); + } + +void Voice_settings_tab::clear_data() + { + // "global" tab, not action specific, do nothing + } + +void Voice_settings_tab::slotCapturedKey( const TDEShortcut& cut) + { + /*for(uint seq=0; seq<TDEShortcut::MAX_SEQUENCES; seq++) + { + KKeySequance key=cut.seq(seq); + if(key.isNull()) + continue; + if(key.count() > 1) + return; + }*/ + + if(KKeyChooser::checkGlobalShortcutsConflict(cut,true,this)) + return; + if(KKeyChooser::checkStandardShortcutsConflict(cut,true,this)) + return; + + keyButton->setShortcut(cut); + module->changed(); + } +} // namespace KHotKeys + +#include "voice_settings_tab.moc" diff --git a/khotkeys/kcontrol/voice_settings_tab.h b/khotkeys/kcontrol/voice_settings_tab.h new file mode 100644 index 000000000..c59a911a2 --- /dev/null +++ b/khotkeys/kcontrol/voice_settings_tab.h @@ -0,0 +1,41 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2005 Olivier Goffart <ogoffart @ kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef VOICE_SETTINGS_TAB_H_ +#define VOICE_SETTINGS_TAB_H_ + +#include <voice_settings_tab_ui.h> + +class TDEShortcut; + +namespace KHotKeys +{ + +class Voice_settings_tab + : public Voice_settings_tab_ui + { + Q_OBJECT + public: + Voice_settings_tab( TQWidget* parent = NULL, const char* name = NULL ); + void read_data(); + void write_data() const; + public slots: + void clear_data(); + private slots: + void slotCapturedKey( const TDEShortcut& ); + }; + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/voicerecorder.cpp b/khotkeys/kcontrol/voicerecorder.cpp new file mode 100644 index 000000000..fc231a82c --- /dev/null +++ b/khotkeys/kcontrol/voicerecorder.cpp @@ -0,0 +1,203 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2005 Olivier Goffgart <ogoffart @ kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#include <tqcolor.h> +#include <tqevent.h> + +#include "voicerecorder.h" +#include "soundrecorder.h" +#include "voicesignature.h" +#include "voices.h" +#include "khotkeysglobal.h" +#include <kpushbutton.h> +#include <klineedit.h> +#include <tdelocale.h> +#include <tdetempfile.h> +#include <tqlabel.h> +#include <tqpainter.h> +#include <tdemessagebox.h> +#include <klibloader.h> +#include <kstandarddirs.h> + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +namespace KHotKeys +{ + +VoiceRecorder::arts_play_fun VoiceRecorder::arts_play = NULL; + +bool VoiceRecorder::init( KLibrary* lib ) +{ +#ifdef HAVE_ARTS + if( arts_play == NULL && lib != NULL ) + arts_play = (arts_play_fun) lib->symbol( "khotkeys_voicerecorder_arts_play" ); +#endif +// kdDebug( 1217 ) << "voicerecorder:" << arts_play << ":" << lib << endl; + return arts_play != NULL; +} + +VoiceRecorder::VoiceRecorder(const Sound& sound_P, const TQString &voiceId, TQWidget *parent, const char *name) + : Voice_input_widget_ui(parent, name) , _recorder( SoundRecorder::create(TQT_TQOBJECT(this))) , _state(sNotModified), _tempFile(0L) , _voiceId(voiceId) +{ + _sound=sound_P; + buttonPlay->setEnabled(sound_P.size() > 50); + buttonStop->setEnabled(false); + + connect (_recorder , TQT_SIGNAL(recorded(const Sound& )) , this , TQT_SLOT(slotSoundRecorded(const Sound& ) )); + + //if(voiceid_P.isEmpty()) + emit recorded(false); + + drawSound(); +} + +VoiceRecorder::~VoiceRecorder() +{ + delete _tempFile; +} + +void VoiceRecorder::slotRecordPressed() +{ + buttonRecord->setEnabled(false); + buttonPlay->setEnabled(false); + buttonStop->setEnabled(true); + _recorder->start(); + label->setText(i18n("Recording...")); +} + +void VoiceRecorder::slotStopPressed() +{ + buttonRecord->setEnabled(true); + buttonPlay->setEnabled(false); + buttonStop->setEnabled(false); + _recorder->stop(); +} + +void VoiceRecorder::slotPlayPressed() +{ +#ifdef HAVE_ARTS + if( !haveArts() || arts_play == NULL ) + return; + /*if(!_modified) + { + TQString fileName = locateLocal( "appdata", _original_voiuceid + ".wav" ); + arts_play( fileName ); + } + else + {*/ + if(!_tempFile) + { + _tempFile=new KTempFile(TQString::null,".wav"); + _tempFile->setAutoDelete(true); + } + _sound.save(_tempFile->name()); + arts_play( _tempFile->name()); +#endif +} + +Sound VoiceRecorder::sound() const +{ + return _sound; +} + + +void VoiceRecorder::slotSoundRecorded(const Sound &sound) +{ + buttonPlay->setEnabled(true); + _sound=sound; + + bool correct=drawSound() && sound.size()>50; + if(correct) + { + TQString vm=voice_handler->isNewSoundFarEnough( VoiceSignature(sound), _voiceId); + if(!vm.isNull()) + { + KMessageBox::sorry (this, i18n("The word you recorded is too close to the existing reference '%1'. Please record another word.").arg(vm) ); + //TODO: messagebox saying there are too much noise + correct=false; + } + } + else + { + KMessageBox::sorry (this, i18n("Unable to extract voice information from noise.\nIf this error occurs repeatedly, it suggests that there is either too much background noise, or the quality of your microphone is too poor.") ); + } + + _state=correct ? sModified : sIncorrect; + emit recorded(correct); +} + + +/*VoiceSignature VoiceRecorder::voiceSig() const +{ + if(voiceId().isEmpty()) + return VoiceSignature(); + TQString fileName = locateLocal( "appdata", voiceId() + ".wav" ); + _sound.save( fileName ); + return VoiceSignature(_sound); +}*/ + +bool VoiceRecorder::drawSound() +{ + label->setText(TQString::null); + uint length=_sound.size(); + + if(length < 2) + return false; + + int width=label->width(); + int height=label->height(); + TQPixmap pix(width,height); + pix.fill(TQColor(255,255,255)); + TQPainter p; + p.begin(&pix); + + p.setPen(TQPen(TQColor("green"),1)); + p.drawLine(0,height/2,width,height/2); + + p.setPen(TQPen(TQColor("red"),1)); + + uint lx=0; + uint ly=height/2; + + /*** DRAW THE TQT_SIGNAL ******/ + for(uint f=1; f<length; f++) + { + uint nx=f*width/length; + uint ny=(uint)(height/2* (1.0 - _sound.at(f))); + p.drawLine(lx,ly,nx,ny); + lx=nx; ly=ny; + } + + unsigned int start=0 , stop=0; + bool res=KHotKeys::VoiceSignature::window(_sound,&start,&stop); + p.setPen(TQPen(TQColor("blue"),1)); + if(res) + { + p.drawLine(start*width/length ,0,start*width/length ,height); + p.drawLine(stop*width/length ,0,stop*width/length ,height); + } + else + { + p.drawLine(0 ,0, width ,height); + p.drawLine(width ,0, 0 ,height); + } + + p.end(); + + label->setPixmap(pix); + return res; +} + + +} // namespace KHotKeys + +#include "voicerecorder.moc" diff --git a/khotkeys/kcontrol/voicerecorder.h b/khotkeys/kcontrol/voicerecorder.h new file mode 100644 index 000000000..30d03acdc --- /dev/null +++ b/khotkeys/kcontrol/voicerecorder.h @@ -0,0 +1,73 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2005 Olivier Goffgart <ogoffart @ kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef VOICE_RECORDER_H +#define VOICE_RECORDER_H + +#include <tqframe.h> +#include "ui/voice_input_widget_ui.h" +#include <tqmemarray.h> + +#include "sound.h" +class TQMouseEvent; +class KAudioRecordStream ; +class KArtsServer; +class KTempFile; +class KLibrary; + +namespace KHotKeys +{ + + class SoundRecorder; + class Voice_trigger; + +class VoiceRecorder : public Voice_input_widget_ui + { + Q_OBJECT + + public: + VoiceRecorder(const Sound& sound_P, const TQString &voiceId, TQWidget *parent, const char *name); + ~VoiceRecorder(); + + Sound sound() const; + + enum State { sNotModified , sIncorrect, sModified }; + + inline State state() const + { + return _state; + } + + static bool init( KLibrary* lib ); + typedef void (*arts_play_fun)( const TQString& file ); + + protected slots: + void slotStopPressed(); + void slotRecordPressed(); + void slotPlayPressed(); + + signals: + void recorded(bool); + private slots: + void slotSoundRecorded(const Sound& sound); + bool drawSound(); + + private: + SoundRecorder *_recorder; + Sound _sound; + State _state; + KTempFile *_tempFile; + TQString _voiceId; + static arts_play_fun arts_play; + }; + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/voicerecordpage.cpp b/khotkeys/kcontrol/voicerecordpage.cpp new file mode 100644 index 000000000..1c7f8c938 --- /dev/null +++ b/khotkeys/kcontrol/voicerecordpage.cpp @@ -0,0 +1,124 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2005 Olivier Goffart < ogoffart @ kde.org > + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#include <tqwidget.h> +#include <tqlabel.h> +#include <tqpushbutton.h> +#include <klineedit.h> +#include <kstandarddirs.h> + +#include <tdelocale.h> +#include <tdemessagebox.h> + +#include "voicerecordpage.h" +#include "voicerecorder.h" +#include "voicesignature.h" +#include "voices.h" + +namespace KHotKeys +{ + +VoiceRecordPage::VoiceRecordPage( const TQString &voiceid_P, TQWidget *parent, const char *name) + : TQVBox(parent, name) , _original_voiceId(voiceid_P) + { + _message = i18n("Enter a code for the sound (e.g. the word you are saying) and record the same word twice."); + + _label = new TQLabel(_message, this, "label"); + _label->setAlignment(TQLabel::AlignLeft | TQLabel::WordBreak | + TQLabel::AlignVCenter); + + _lineEdit = new KLineEdit( this ); + _lineEdit->setText(voiceid_P); + + + Sound s; + if(voiceid_P!=TQString::null) + { + TQString fileName = locateLocal( "data", "khotkeys/" + voiceid_P + "1.wav" ); + s.load(fileName); + } + _recorder1 = new VoiceRecorder(s, voiceid_P, this, "recorder"); + if(voiceid_P!=TQString::null) + { + TQString fileName = locateLocal( "data", "khotkeys/" + voiceid_P + "2.wav" ); + s.load(fileName); + } + _recorder2 = new VoiceRecorder(s, voiceid_P, this, "recorder"); + + //_recorder->setMinimumHeight(150); + //setStretchFactor(_recorder, 1); + + TQWidget *spacer = new TQWidget(this, "spacer"); + setStretchFactor(spacer, 1); + + + connect(_recorder1, TQT_SIGNAL(recorded(bool)) , this, TQT_SLOT(slotChanged())); + connect(_recorder2, TQT_SIGNAL(recorded(bool)) , this, TQT_SLOT(slotChanged())); + connect(_lineEdit , TQT_SIGNAL( textChanged (const TQString&)) , this , TQT_SLOT(slotChanged())); + + + } + +VoiceRecordPage::~VoiceRecordPage() + { + } + +void VoiceRecordPage::slotChanged() + { + bool voiceCodeOK=!_lineEdit->text().isEmpty(); + if( voiceCodeOK && _lineEdit->text() != _original_voiceId) + { + voiceCodeOK=!voice_handler->doesVoiceCodeExists(_lineEdit->text()); + if(!voiceCodeOK) + { + _label->setText(i18n("<qt>%1<br><font color='red'>The sound code already exists</font></qt>").arg(_message)); + } + } + if( voiceCodeOK ) + { + voiceCodeOK=_recorder1->state()!=VoiceRecorder::sIncorrect && _recorder2->state()!=VoiceRecorder::sIncorrect; + if(!voiceCodeOK) + { + _label->setText(i18n("<qt>%1<br><font color='red'>One of the sound references is not correct</font></qt>").arg(_message)); + } + } + if( voiceCodeOK ) + _label->setText(_message); + + emit voiceRecorded( voiceCodeOK && + ( ( (_recorder1->state()==VoiceRecorder::sModified || _recorder2->state()==VoiceRecorder::sModified || _lineEdit->text() != _original_voiceId) + && !_original_voiceId.isEmpty()) + || (_recorder1->state()==VoiceRecorder::sModified && _recorder2->state()==VoiceRecorder::sModified ) ) ); + } + +TQString VoiceRecordPage::getVoiceId() const + { + return _lineEdit->text(); + } + +VoiceSignature VoiceRecordPage::getVoiceSignature(int ech) const + { + VoiceRecorder *recorder= (ech==1) ? _recorder1 : _recorder2 ; + TQString fileName = locateLocal( "data", "khotkeys/" + getVoiceId() + TQString::number(ech) + ".wav" ); + Sound s=recorder->sound(); + s.save(fileName); + return VoiceSignature(s); + } + +bool VoiceRecordPage::isModifiedSignature(int ech) const + { + VoiceRecorder *recorder= (ech==1) ? _recorder1 : _recorder2 ; + return recorder->state()==VoiceRecorder::sModified; + } + + +} // namespace KHotKeys + +#include "voicerecordpage.moc" diff --git a/khotkeys/kcontrol/voicerecordpage.h b/khotkeys/kcontrol/voicerecordpage.h new file mode 100644 index 000000000..9cb934b61 --- /dev/null +++ b/khotkeys/kcontrol/voicerecordpage.h @@ -0,0 +1,64 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2005 Olivier Goffart < ogoffart @ kde.org > + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef VOICE_RECORD_PAGE_H +#define VOICE_RECORD_PAGE_H + +#include <tqvbox.h> + + + +class TQWidget; +class TQPushButton; +class TQLabel; +class KLineEdit; + + + +namespace KHotKeys +{ + +class Voice; +class VoiceRecorder; +class VoiceSignature; + +class VoiceRecordPage : public TQVBox + { + Q_OBJECT + + public: + VoiceRecordPage(const TQString &voiceip_P, TQWidget *parent, const char *name); + ~VoiceRecordPage(); + + TQString getVoiceId() const ; + VoiceSignature getVoiceSignature(int) const; + bool isModifiedSignature(int) const; + + protected slots: + void slotChanged(); + + signals: + void voiceRecorded(bool); + + private: + VoiceRecorder *_recorder1; + VoiceRecorder *_recorder2; + KLineEdit *_lineEdit; + TQLabel *_label; + TQString _message; + + TQString _original_voiceId; + + + }; + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/window_trigger_widget.cpp b/khotkeys/kcontrol/window_trigger_widget.cpp new file mode 100644 index 000000000..c897cf14a --- /dev/null +++ b/khotkeys/kcontrol/window_trigger_widget.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _WINDOW_TRIGGER_WIDGET_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "window_trigger_widget.h" + +#include <tqcheckbox.h> + +#include <triggers.h> +#include <actions.h> +#include <action_data.h> + +#include "windowdef_list_widget.h" +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +Window_trigger_widget::Window_trigger_widget( TQWidget* parent_P, const char* name_P ) + : Window_trigger_widget_ui( parent_P, name_P ) + { + clear_data(); + // KHotKeys::Module::changed() + connect( window_appears_checkbox, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( window_disappears_checkbox, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( window_activates_checkbox, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( window_deactivates_checkbox, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + } + +void Window_trigger_widget::clear_data() + { + windowdef_list_widget->clear_data(); + window_appears_checkbox->setChecked( false ); + window_disappears_checkbox->setChecked( false ); + window_activates_checkbox->setChecked( false ); + window_deactivates_checkbox->setChecked( false ); + } + +void Window_trigger_widget::set_data( const Window_trigger* trigger_P ) + { + if( trigger_P == NULL ) + { + clear_data(); + return; + } + windowdef_list_widget->set_data( trigger_P->windows()); + window_appears_checkbox->setChecked( + trigger_P->triggers_on( Window_trigger::WINDOW_APPEARS )); + window_disappears_checkbox->setChecked( + trigger_P->triggers_on( Window_trigger::WINDOW_DISAPPEARS )); + window_activates_checkbox->setChecked( + trigger_P->triggers_on( Window_trigger::WINDOW_ACTIVATES )); + window_deactivates_checkbox->setChecked( + trigger_P->triggers_on( Window_trigger::WINDOW_DEACTIVATES )); + } + +Window_trigger* Window_trigger_widget::get_data( Action_data* data_P ) const + { + return new Window_trigger( data_P, windowdef_list_widget->get_data(), + ( window_appears_checkbox->isChecked() ? Window_trigger::WINDOW_APPEARS : 0 ) + | ( window_disappears_checkbox->isChecked() ? Window_trigger::WINDOW_DISAPPEARS : 0 ) + | ( window_activates_checkbox->isChecked() ? Window_trigger::WINDOW_ACTIVATES : 0 ) + | ( window_deactivates_checkbox->isChecked() ? Window_trigger::WINDOW_DEACTIVATES : 0 )); + } + +} // namespace KHotKeys + +#include "window_trigger_widget.moc" diff --git a/khotkeys/kcontrol/window_trigger_widget.h b/khotkeys/kcontrol/window_trigger_widget.h new file mode 100644 index 000000000..c012a0bca --- /dev/null +++ b/khotkeys/kcontrol/window_trigger_widget.h @@ -0,0 +1,41 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _WINDOW_TRIGGER_WIDGET_H_ +#define _WINDOW_TRIGGER_WIDGET_H_ + +#include <window_trigger_widget_ui.h> + +namespace KHotKeys +{ + +class Window_trigger; +class Action_data; + +class Window_trigger_widget + : public Window_trigger_widget_ui + { + Q_OBJECT + public: + Window_trigger_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); + void set_data( const Window_trigger* trigger_P ); + Window_trigger* get_data( Action_data* data_P ) const; + public slots: + void clear_data(); + }; + + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/windowdef_list_widget.cpp b/khotkeys/kcontrol/windowdef_list_widget.cpp new file mode 100644 index 000000000..dc16d780f --- /dev/null +++ b/khotkeys/kcontrol/windowdef_list_widget.cpp @@ -0,0 +1,239 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _WINDOWDEF_LIST_WIDGET_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "windowdef_list_widget.h" + +#include <assert.h> +#include <tqpushbutton.h> +#include <tqheader.h> +#include <tqlineedit.h> +#include <tqpopupmenu.h> + +#include <kdebug.h> +#include <tdelocale.h> + +#include <khlistview.h> + +#include <windows.h> + +#include "windowdef_simple_widget.h" +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +// Windowdef_list_widget + +Windowdef_list_widget::Windowdef_list_widget( TQWidget* parent_P, const char* name_P ) + : Windowdef_list_widget_ui( parent_P, name_P ), autodetect_object( NULL ), + autodetect_slot( NULL ), selected_item( NULL ) + { + TQPopupMenu* popup = new TQPopupMenu; // CHECKME looks like setting parent doesn't work + popup->insertItem( i18n( "Simple Window..." ), TYPE_WINDOWDEF_SIMPLE ); + connect( popup, TQT_SIGNAL( activated( int )), TQT_SLOT( new_selected( int ))); + + connect( windows_listview, TQT_SIGNAL( doubleClicked ( TQListViewItem *, const TQPoint &, int ) ), + this, TQT_SLOT( modify_pressed() ) ); + new_button->setPopup( popup ); + windows_listview->header()->hide(); + windows_listview->addColumn( "" ); + windows_listview->setSorting( -1 ); + windows_listview->setForceSelect( true ); + copy_button->setEnabled( false ); + modify_button->setEnabled( false ); + delete_button->setEnabled( false ); + clear_data(); + // KHotKeys::Module::changed() + connect( new_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( copy_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( modify_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( delete_button, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( comment_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + } + +Windowdef_list_widget::~Windowdef_list_widget() + { + delete new_button->popup(); + } + +void Windowdef_list_widget::clear_data() + { + comment_lineedit->clear(); + windows_listview->clear(); + } + +void Windowdef_list_widget::set_data( const Windowdef_list* data_P ) + { + if( data_P == NULL ) + { + clear_data(); + return; + } + comment_lineedit->setText( data_P->comment()); + Windowdef_list_item* after = NULL; + windows_listview->clear(); + for( Windowdef_list::Iterator it( *data_P ); + *it; + ++it ) + after = create_listview_item( *it, windows_listview, NULL, after, true ); + } + +Windowdef_list* Windowdef_list_widget::get_data() const + { +// CHECKME TODO hmm, tady to bude chtit asi i children :( + Windowdef_list* list = new Windowdef_list( comment_lineedit->text()); + for( TQListViewItem* pos = windows_listview->firstChild(); + pos != NULL; + pos = pos->nextSibling()) + list->append( static_cast< Windowdef_list_item* >( pos )->window()->copy()); + return list; + } + +void Windowdef_list_widget::new_selected( int type_P ) + { + Windowdef_dialog* dlg = NULL; + switch( type_P ) + { + case TYPE_WINDOWDEF_SIMPLE: // Windowdef_simple + dlg = new Windowdef_simple_dialog( + new Windowdef_simple( "", "", Windowdef_simple::NOT_IMPORTANT, "", + Windowdef_simple::NOT_IMPORTANT, "", Windowdef_simple::NOT_IMPORTANT, + Windowdef_simple::WINDOW_TYPE_NORMAL | Windowdef_simple::WINDOW_TYPE_DIALOG ), + NULL, NULL ); // CHECKME tady pak autodetect + break; + } + if( dlg != NULL ) + { + Windowdef* window = dlg->edit_windowdef(); + if( window != NULL ) + windows_listview->setSelected( create_listview_item( window, windows_listview, + NULL, selected_item, false ), true ); + // CHECKME tady pak jeste spravne vnoreni, kdyz bude skupina + delete dlg; + } + } + +void Windowdef_list_widget::copy_pressed() + { + windows_listview->setSelected( create_listview_item( selected_item->window(), + selected_item->parent() ? NULL : windows_listview, selected_item->parent(), + selected_item, true ), true ); + } + +void Windowdef_list_widget::delete_pressed() + { + delete selected_item; // CHECKME snad vyvola signaly pro enable() + } + +void Windowdef_list_widget::modify_pressed() + { + edit_listview_item( selected_item ); + } + +void Windowdef_list_widget::current_changed( TQListViewItem* item_P ) + { +// if( item_P == selected_item ) +// return; + selected_item = static_cast< Windowdef_list_item* >( item_P ); +// windows_listview->setSelected( item_P, true ); + copy_button->setEnabled( item_P != NULL ); + modify_button->setEnabled( item_P != NULL ); + delete_button->setEnabled( item_P != NULL ); + } + +Windowdef_list_item* Windowdef_list_widget::create_listview_item( Windowdef* window_P, + TQListView* parent1_P, TQListViewItem* parent2_P, TQListViewItem* after_P, bool copy_P ) + { + Windowdef* new_win = copy_P ? window_P->copy() : window_P; +// CHECKME uz by nemelo byt treba +/* if( after_P == NULL ) + { + if( parent1_P == NULL ) + return new Windowdef_list_item( parent2_P, new_win ); + else + return new Windowdef_list_item( parent1_P, new_win ); + } + else*/ + { + if( parent1_P == NULL ) + return new Windowdef_list_item( parent2_P, after_P, new_win ); + else + return new Windowdef_list_item( parent1_P, after_P, new_win ); + } + } + +void Windowdef_list_widget::edit_listview_item( Windowdef_list_item* item_P ) + { + Windowdef_dialog* dlg = NULL; + if( Windowdef_simple* window = dynamic_cast< Windowdef_simple* >( item_P->window())) + dlg = new Windowdef_simple_dialog( window, autodetect_object, autodetect_slot ); + else // CHECKME TODO pridat dalsi + assert( false ); + Windowdef* new_window = dlg->edit_windowdef(); + if( new_window != NULL ) + { + item_P->set_window( new_window ); + item_P->widthChanged( 0 ); // SELI tohle i u dalsich listview? + windows_listview->repaintItem( item_P ); + } + delete dlg; + } + +// Windowdef_list_item + +TQString Windowdef_list_item::text( int column_P ) const + { + return column_P == 0 ? window()->description() : TQString::null; + } + +Windowdef_list_item::~Windowdef_list_item() + { // CHECKME if the listview will ever be used hiearchically, + delete _window; // this will be wrong, the windows tree will have to be kept + } // and deleted separately + +// Windowdef_simple_dialog + +Windowdef_simple_dialog::Windowdef_simple_dialog( Windowdef_simple* window_P, TQObject* obj_P, + const char* slot_P ) + : KDialogBase( NULL, NULL, true, i18n( "Window Details" ), Ok | Cancel ), window( NULL ) + { + widget = new Windowdef_simple_widget( this ); + widget->set_autodetect( obj_P, slot_P ); + widget->set_data( window_P ); + setMainWidget( widget ); + } + +Windowdef* Windowdef_simple_dialog::edit_windowdef() + { + exec(); + return window; + } + +void Windowdef_simple_dialog::accept() + { + KDialogBase::accept(); + window = widget->get_data(); // CHECKME NULL ? + } + + +} // namespace KHotKeys + +#include "windowdef_list_widget.moc" diff --git a/khotkeys/kcontrol/windowdef_list_widget.h b/khotkeys/kcontrol/windowdef_list_widget.h new file mode 100644 index 000000000..6e923c902 --- /dev/null +++ b/khotkeys/kcontrol/windowdef_list_widget.h @@ -0,0 +1,160 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _WINDOWDEF_LIST_WIDGET_H_ +#define _WINDOWDEF_LIST_WIDGET_H_ + +#include <tqlistview.h> + +#include <kdialogbase.h> + +#include <windows.h> +#include <windowdef_list_widget_ui.h> + +namespace KHotKeys +{ + +class Action_data; +class Action_data_base; +class Windowdef_simple_widget; + +class Windowdef_list_item; + +class Windowdef_list_widget + : public Windowdef_list_widget_ui + { + Q_OBJECT + public: + Windowdef_list_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); + virtual ~Windowdef_list_widget(); + void set_data( const Windowdef_list* data_P ); + Windowdef_list* get_data() const; + void set_autodetect( TQObject* obj_P, const char* slot_P ); + public slots: + void clear_data(); + protected: + Windowdef_list_item* create_listview_item( Windowdef* window_P, TQListView* parent1_P, + TQListViewItem* parent2_P, TQListViewItem* after_P, bool copy_P ); + void edit_listview_item( Windowdef_list_item* item_P ); + enum type_t { TYPE_WINDOWDEF_SIMPLE }; + protected slots: + void new_selected( int type_P ); + virtual void copy_pressed(); + virtual void delete_pressed(); + virtual void modify_pressed(); + virtual void current_changed( TQListViewItem* item_P ); + protected: + TQObject* autodetect_object; + const char* autodetect_slot; + Windowdef_list_item* selected_item; + }; + +typedef Windowdef_list_widget Windowdef_list_tab; + +class Windowdef_list_item + : public TQListViewItem + { + public: + Windowdef_list_item( TQListView* parent_P, Windowdef* window_P ); + Windowdef_list_item( TQListViewItem* parent_P, Windowdef* window_P ); + Windowdef_list_item( TQListView* parent_P, TQListViewItem* after_P, Windowdef* window_P ); + Windowdef_list_item( TQListViewItem* parent_P, TQListViewItem* after_P, Windowdef* window_P ); + virtual ~Windowdef_list_item(); + virtual TQString text( int column_P ) const; + Windowdef* window() const; + void set_window( Windowdef* window_P ); + protected: + Windowdef* _window; // owns it + }; + +class Windowdef_dialog + { + public: + virtual Windowdef* edit_windowdef() = 0; + virtual ~Windowdef_dialog(); + }; + +class Windowdef_simple_dialog + : public KDialogBase, public Windowdef_dialog + { + Q_OBJECT + public: + Windowdef_simple_dialog( Windowdef_simple* window_P, TQObject* obj_P, const char* slot_P ); + virtual Windowdef* edit_windowdef(); + protected: + virtual void accept(); + Windowdef_simple_widget* widget; + Windowdef_simple* window; + }; + +//*************************************************************************** +// Inline +//*************************************************************************** + +// Windowdef_list_widget + +inline +void Windowdef_list_widget::set_autodetect( TQObject* obj_P, const char* slot_P ) + { + autodetect_object = obj_P; + autodetect_slot = slot_P; + } + +// Windowdef_list_item + +inline +Windowdef_list_item::Windowdef_list_item( TQListView* parent_P, Windowdef* window_P ) + : TQListViewItem( parent_P ), _window( window_P ) + { + } + +inline +Windowdef_list_item::Windowdef_list_item( TQListViewItem* parent_P, Windowdef* window_P ) + : TQListViewItem( parent_P ), _window( window_P ) + { + } + +inline +Windowdef_list_item::Windowdef_list_item( TQListView* parent_P, TQListViewItem* after_P, + Windowdef* window_P ) + : TQListViewItem( parent_P, after_P ), _window( window_P ) + { + } + +inline +Windowdef_list_item::Windowdef_list_item( TQListViewItem* parent_P, TQListViewItem* after_P, + Windowdef* window_P ) + : TQListViewItem( parent_P, after_P ), _window( window_P ) + { + } + +inline +Windowdef* Windowdef_list_item::window() const + { + return _window; + } + +inline +void Windowdef_list_item::set_window( Windowdef* window_P ) + { + delete _window; + _window = window_P; + } + +// Windowdef_dialog + +inline +Windowdef_dialog::~Windowdef_dialog() + { + } + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/windowdef_simple_widget.cpp b/khotkeys/kcontrol/windowdef_simple_widget.cpp new file mode 100644 index 000000000..e0a6671e7 --- /dev/null +++ b/khotkeys/kcontrol/windowdef_simple_widget.cpp @@ -0,0 +1,183 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _WINDOWDEF_SIMPLE_WIDGET_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "windowdef_simple_widget.h" + +#include <tqlineedit.h> +#include <tqcombobox.h> +#include <tqcheckbox.h> +#include <tqpushbutton.h> +#include <kdebug.h> + +#include <windows.h> + +#include "windowdef_list_widget.h" +#include "kcmkhotkeys.h" +#include "windowselector.h" + +namespace KHotKeys +{ + +Windowdef_simple_widget::Windowdef_simple_widget( TQWidget* parent_P, const char* name_P ) + : Windowdef_simple_widget_ui( parent_P, name_P ) + { + window_title_lineedit->setEnabled( false ); + window_class_lineedit->setEnabled( false ); + window_role_lineedit->setEnabled( false ); + connect( autodetect_button, TQT_SIGNAL( clicked()), TQT_SLOT( autodetect_clicked())); + clear_data(); + // KHotKeys::Module::changed() + connect( window_title_combo, TQT_SIGNAL( activated( int )), + module, TQT_SLOT( changed())); + connect( window_title_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + connect( window_class_combo, TQT_SIGNAL( activated( int )), + module, TQT_SLOT( changed())); + connect( window_class_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + connect( window_role_combo, TQT_SIGNAL( activated( int )), + module, TQT_SLOT( changed())); + connect( window_role_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + connect( type_normal_checkbox, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( type_dialog_checkbox, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( type_dock_checkbox, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( type_desktop_checkbox, TQT_SIGNAL( clicked()), + module, TQT_SLOT( changed())); + connect( comment_lineedit, TQT_SIGNAL( textChanged( const TQString& )), + module, TQT_SLOT( changed())); + } + +void Windowdef_simple_widget::clear_data() + { + comment_lineedit->clear(); + window_title_combo->setCurrentItem( 0 ); + window_title_lineedit->clear(); + window_title_lineedit->setEnabled( false ); + window_class_combo->setCurrentItem( 0 ); + window_class_lineedit->clear(); + window_class_lineedit->setEnabled( false ); + window_role_combo->setCurrentItem( 0 ); + window_role_lineedit->clear(); + window_role_lineedit->setEnabled( false ); + type_normal_checkbox->setChecked( true ); + type_dialog_checkbox->setChecked( true ); + type_dock_checkbox->setChecked( false ); +// type_tool_checkbox->setChecked( false ); +// type_menu_checkbox->setChecked( false ); + type_desktop_checkbox->setChecked( false ); + } + +void Windowdef_simple_widget::set_data( const Windowdef_simple* data_P ) + { + if( data_P == NULL ) + { + clear_data(); + return; + } + comment_lineedit->setText( data_P->comment()); + window_title_combo->setCurrentItem( data_P->title_match_type()); + window_title_lineedit->setText( data_P->title()); + window_title_lineedit->setEnabled( window_title_combo->currentItem() != 0 ); + window_class_combo->setCurrentItem( data_P->wclass_match_type()); + window_class_lineedit->setText( data_P->wclass()); + window_class_lineedit->setEnabled( window_class_combo->currentItem() != 0 ); + window_role_combo->setCurrentItem( data_P->role_match_type()); + window_role_lineedit->setText( data_P->role()); + window_role_lineedit->setEnabled( window_role_combo->currentItem() != 0 ); + type_normal_checkbox->setChecked( data_P->type_match( Windowdef_simple::WINDOW_TYPE_NORMAL )); + type_dialog_checkbox->setChecked( data_P->type_match( Windowdef_simple::WINDOW_TYPE_DIALOG )); + type_dock_checkbox->setChecked( data_P->type_match( Windowdef_simple::WINDOW_TYPE_DOCK )); +// type_tool_checkbox->setChecked( data_P->type_match( Windowdef_simple::WINDOW_TYPE_TOOL )); +// type_menu_checkbox->setChecked( data_P->type_match( Windowdef_simple::WINDOW_TYPE_MENU )); + type_desktop_checkbox->setChecked( + data_P->type_match( Windowdef_simple::WINDOW_TYPE_DESKTOP )); + } + +Windowdef_simple* Windowdef_simple_widget::get_data() const + { + return new Windowdef_simple( comment_lineedit->text(), window_title_lineedit->text(), + static_cast< Windowdef_simple::substr_type_t >( window_title_combo->currentItem()), + window_class_lineedit->text(), + static_cast< Windowdef_simple::substr_type_t >( window_class_combo->currentItem()), + window_role_lineedit->text(), + static_cast< Windowdef_simple::substr_type_t >( window_role_combo->currentItem()), + ( type_normal_checkbox->isChecked() ? Windowdef_simple::WINDOW_TYPE_NORMAL : 0 ) + | ( type_dialog_checkbox->isChecked() ? Windowdef_simple::WINDOW_TYPE_DIALOG : 0 ) + | ( type_dock_checkbox->isChecked() ? Windowdef_simple::WINDOW_TYPE_DOCK : 0 ) +// | ( type_tool_checkbox->isChecked() ? Windowdef_simple::WINDOW_TYPE_TOOL : 0 ) +// | ( type_menu_checkbox->isChecked() ? Windowdef_simple::WINDOW_TYPE_MENU : 0 ) + | ( type_desktop_checkbox->isChecked() ? Windowdef_simple::WINDOW_TYPE_DESKTOP : 0 ) + ); + } + +void Windowdef_simple_widget::window_role_combo_changed( int item_P ) + { // CHECKME nebo je connect() na highlighted() ? + window_role_lineedit->setEnabled( item_P != 0 ); + } + +void Windowdef_simple_widget::window_class_combo_changed( int item_P ) + { + window_class_lineedit->setEnabled( item_P != 0 ); + } + +void Windowdef_simple_widget::window_title_combo_changed( int item_P ) + { + window_title_lineedit->setEnabled( item_P != 0 ); + } + +void Windowdef_simple_widget::set_autodetect( TQObject* obj_P, const char* slot_P ) + { + disconnect( TQT_SIGNAL( autodetect_signal())); + if( obj_P != NULL ) + connect( this, TQT_SIGNAL( autodetect_signal()), obj_P, slot_P ); + } + +void Windowdef_simple_widget::autodetect_clicked() + { + emit autodetect_signal(); + autodetect(); + } + +void Windowdef_simple_widget::autodetect() + { + WindowSelector* sel = new WindowSelector( TQT_TQOBJECT(this), TQT_SLOT( autodetect_window_selected( WId ))); + sel->select(); + } + +void Windowdef_simple_widget::autodetect_window_selected( WId window ) + { + if( window ) + { + Window_data data( window ); + window_title_lineedit->setText( data.title ); + window_role_lineedit->setText( data.role ); + window_class_lineedit->setText( data.wclass ); + type_normal_checkbox->setChecked( data.type == NET::Normal ); + type_dialog_checkbox->setChecked( data.type == NET::Dialog ); + type_dock_checkbox->setChecked( data.type == NET::Dock ); +// type_tool_checkbox->setChecked( data_P->type_match( Windowdef_simple::WINDOW_TYPE_TOOL )); +// type_menu_checkbox->setChecked( data_P->type_match( Windowdef_simple::WINDOW_TYPE_MENU )); + type_desktop_checkbox->setChecked( data.type == NET::Desktop ); + } + } + +} // namespace KHotKeys + +#include "windowdef_simple_widget.moc" diff --git a/khotkeys/kcontrol/windowdef_simple_widget.h b/khotkeys/kcontrol/windowdef_simple_widget.h new file mode 100644 index 000000000..26db6fd87 --- /dev/null +++ b/khotkeys/kcontrol/windowdef_simple_widget.h @@ -0,0 +1,51 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _WINDOWDEF_SIMPLE_WIDGET_H_ +#define _WINDOWDEF_SIMPLE_WIDGET_H_ + +#include <windowdef_simple_widget_ui.h> + +namespace KHotKeys +{ + +class Windowdef_simple; +class Windowdef_list_item; + +class Windowdef_simple_widget + : public Windowdef_simple_widget_ui + { + Q_OBJECT + public: + Windowdef_simple_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); + void set_data( const Windowdef_simple* data_P ); + Windowdef_simple* get_data() const; + void set_autodetect( TQObject* obj_P, const char* slot_P ); + public slots: + void clear_data(); + protected: + void autodetect(); + protected slots: + virtual void autodetect_clicked(); + virtual void window_role_combo_changed( int item_P ); + virtual void window_class_combo_changed( int item_P ); + virtual void window_title_combo_changed( int item_P ); + void autodetect_window_selected( WId window ); + signals: + void autodetect_signal(); + }; + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif diff --git a/khotkeys/kcontrol/windowselector.cpp b/khotkeys/kcontrol/windowselector.cpp new file mode 100644 index 000000000..d1cbe8f5f --- /dev/null +++ b/khotkeys/kcontrol/windowselector.cpp @@ -0,0 +1,92 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _WINDOWSELECTOR_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "windowselector.h" + +#include "voices.h" + +#include <tqcursor.h> +#include <kdebug.h> +#include <tdeapplication.h> +#include <X11/Xlib.h> +#include <fixx11h.h> + +namespace KHotKeys +{ + +WindowSelector::WindowSelector( TQObject* receiver_P, const char* slot_P ) + { + connect( this, TQT_SIGNAL( selected_signal( WId )), receiver_P, slot_P ); + } + +void WindowSelector::select() + { + kapp->desktop()->grabMouse( TQCursor( tqcrossCursor )); + kapp->installX11EventFilter( TQT_TQWIDGET(this) ); + } + +bool WindowSelector::x11Event( XEvent* e ) + { + if( e->type != ButtonPress ) + return false; + kapp->desktop()->releaseMouse(); + if( e->xbutton.button == Button1 ) + { + WId window = findRealWindow( e->xbutton.subwindow ); + if( window ) + selected_signal( window ); + } + delete this; + return true; + } + +WId WindowSelector::findRealWindow( WId w, int depth ) + { + if( depth > 5 ) + return None; + static Atom wm_state = XInternAtom( tqt_xdisplay(), "WM_STATE", False ); + Atom type; + int format; + unsigned long nitems, after; + unsigned char* prop; + if( XGetWindowProperty( tqt_xdisplay(), w, wm_state, 0, 0, False, AnyPropertyType, + &type, &format, &nitems, &after, &prop ) == Success ) + { + if( prop != NULL ) + XFree( prop ); + if( type != None ) + return w; + } + Window root, parent; + Window* children; + unsigned int nchildren; + Window ret = None; + if( XQueryTree( tqt_xdisplay(), w, &root, &parent, &children, &nchildren ) != 0 ) + { + for( unsigned int i = 0; + i < nchildren && ret == None; + ++i ) + ret = findRealWindow( children[ i ], depth + 1 ); + if( children != NULL ) + XFree( children ); + } + return ret; +} + + +} // namespace KHotKeys + +#include "windowselector.moc" diff --git a/khotkeys/kcontrol/windowselector.h b/khotkeys/kcontrol/windowselector.h new file mode 100644 index 000000000..4f52312ea --- /dev/null +++ b/khotkeys/kcontrol/windowselector.h @@ -0,0 +1,40 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _WINDOWSELECTOR_H_ +#define _WINDOWSELECTOR_H_ + +#include <tqwidget.h> + +namespace KHotKeys +{ + +class WindowSelector + : public QWidget + { + Q_OBJECT + public: + WindowSelector( TQObject* receiver, const char* slot ); + void select(); + protected: + virtual bool x11Event( XEvent* e ); + signals: + void selected_signal( WId w ); + private: + WId findRealWindow( WId w, int depth = 0 ); + }; + +//*************************************************************************** +// Inline +//*************************************************************************** + +} // namespace KHotKeys + +#endif |