diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-08-24 20:55:24 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-08-25 20:38:45 +0900 |
commit | a2cb178bed086ae98097b5bded1817cc7704d2b4 (patch) | |
tree | 83bcb15c64826e0d153e6efe981d943242dae9d9 /khotkeys/kcontrol | |
parent | 12007bb689082f356835ae6ad4412ee414230e83 (diff) | |
download | tdebase-a2cb178bed086ae98097b5bded1817cc7704d2b4.tar.gz tdebase-a2cb178bed086ae98097b5bded1817cc7704d2b4.zip |
khotkeys: added 'waiting' action to the list of available choices.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 7fed9587e9673983fe4128557baa33b23b71076f)
Diffstat (limited to 'khotkeys/kcontrol')
-rw-r--r-- | khotkeys/kcontrol/CMakeLists.txt | 2 | ||||
-rw-r--r-- | khotkeys/kcontrol/Makefile.am | 2 | ||||
-rw-r--r-- | khotkeys/kcontrol/action_list_widget.cpp | 29 | ||||
-rw-r--r-- | khotkeys/kcontrol/action_list_widget.h | 16 | ||||
-rw-r--r-- | khotkeys/kcontrol/ui/CMakeLists.txt | 2 | ||||
-rw-r--r-- | khotkeys/kcontrol/ui/Makefile.am | 2 | ||||
-rw-r--r-- | khotkeys/kcontrol/ui/waiting_widget_ui.ui | 72 | ||||
-rw-r--r-- | khotkeys/kcontrol/waiting_widget.cpp | 56 | ||||
-rw-r--r-- | khotkeys/kcontrol/waiting_widget.h | 36 |
9 files changed, 212 insertions, 5 deletions
diff --git a/khotkeys/kcontrol/CMakeLists.txt b/khotkeys/kcontrol/CMakeLists.txt index 5028763ce..902c5a0e6 100644 --- a/khotkeys/kcontrol/CMakeLists.txt +++ b/khotkeys/kcontrol/CMakeLists.txt @@ -37,7 +37,7 @@ tde_create_translated_desktop( khotkeys.desktop ) 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 + actions_listview_widget.cpp menuentry_widget.cpp general_tab.cpp waiting_widget.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 diff --git a/khotkeys/kcontrol/Makefile.am b/khotkeys/kcontrol/Makefile.am index 7eb3f2f6d..03a728ae3 100644 --- a/khotkeys/kcontrol/Makefile.am +++ b/khotkeys/kcontrol/Makefile.am @@ -4,7 +4,7 @@ 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 \ + actions_listview_widget.cpp menuentry_widget.cpp general_tab.cpp waiting_widget.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 \ diff --git a/khotkeys/kcontrol/action_list_widget.cpp b/khotkeys/kcontrol/action_list_widget.cpp index e94e561e2..d007ab5f5 100644 --- a/khotkeys/kcontrol/action_list_widget.cpp +++ b/khotkeys/kcontrol/action_list_widget.cpp @@ -32,6 +32,7 @@ #include "dcop_widget.h" #include "keyboard_input_widget.h" #include "activate_window_widget.h" +#include "waiting_widget.h" #include "kcmkhotkeys.h" namespace KHotKeys @@ -48,6 +49,7 @@ Action_list_widget::Action_list_widget( TQWidget* parent_P, const char* name_P ) 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 ); + popup->insertItem( i18n( "Waiting..." ), TYPE_WAITING_ACTION ); connect( popup, TQT_SIGNAL( activated( int )), TQT_SLOT( new_selected( int ))); new_button->setPopup( popup ); actions_listview->header()->hide(); @@ -129,6 +131,9 @@ void Action_list_widget::new_selected( int type_P ) case TYPE_ACTIVATE_WINDOW_ACTION: // Activate_window_action_dialog dlg = new Activate_window_action_dialog( NULL ); break; + case TYPE_WAITING_ACTION: // Waiting_action_dialog + dlg = new Waiting_action_dialog( NULL ); + break; default: assert( false ); } @@ -271,6 +276,8 @@ void Action_list_widget::edit_listview_item( Action_list_item* item_P ) else if( Activate_window_action* action = dynamic_cast< Activate_window_action* >( item_P->action())) dlg = new Activate_window_action_dialog( action ); + else if( Waiting_action* action = dynamic_cast< Waiting_action* >( item_P->action())) + dlg = new Waiting_action_dialog( action ); else // CHECKME TODO pridat dalsi assert( false ); Action* new_action = dlg->edit_action(); @@ -405,6 +412,28 @@ void Activate_window_action_dialog::accept() action = new Activate_window_action( NULL, widget->get_data()); // CHECKME NULL ? } +// Waiting_action_dialog + +Waiting_action_dialog::Waiting_action_dialog( Waiting_action* action_P ) + : KDialogBase( NULL, NULL, true, "", Ok | Cancel ), action( NULL ) + { + widget = new Waiting_widget( this ); + widget->set_data( action_P ); + setMainWidget( widget ); + } + +Action* Waiting_action_dialog::edit_action() + { + exec(); + return action; + } + +void Waiting_action_dialog::accept() + { + KDialogBase::accept(); + action = widget->get_data( NULL ); + } + } // namespace KHotKeys #include "action_list_widget.moc" diff --git a/khotkeys/kcontrol/action_list_widget.h b/khotkeys/kcontrol/action_list_widget.h index 38676b886..91bee9417 100644 --- a/khotkeys/kcontrol/action_list_widget.h +++ b/khotkeys/kcontrol/action_list_widget.h @@ -28,6 +28,7 @@ class Command_url_widget; class Menuentry_widget; class Dcop_widget; class Keyboard_input_widget; +class Waiting_widget; class Action_list_item; @@ -47,7 +48,7 @@ class Action_list_widget 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 }; + TYPE_KEYBOARD_INPUT_ACTION, TYPE_ACTIVATE_WINDOW_ACTION, TYPE_WAITING_ACTION }; protected slots: void new_selected( int type_P ); virtual void copy_pressed(); @@ -150,6 +151,19 @@ class Activate_window_action_dialog Activate_window_action* action; }; +class Waiting_action_dialog + : public KDialogBase, public Action_dialog + { + Q_OBJECT + public: + Waiting_action_dialog( Waiting_action* action_P ); + virtual Action* edit_action(); + protected: + virtual void accept(); + Waiting_widget* widget; + Waiting_action* action; + }; + //*************************************************************************** // Inline //*************************************************************************** diff --git a/khotkeys/kcontrol/ui/CMakeLists.txt b/khotkeys/kcontrol/ui/CMakeLists.txt index 85212affb..ab8db9e78 100644 --- a/khotkeys/kcontrol/ui/CMakeLists.txt +++ b/khotkeys/kcontrol/ui/CMakeLists.txt @@ -28,7 +28,7 @@ link_directories( 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 + command_url_widget_ui.ui menuentry_widget_ui.ui waiting_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 diff --git a/khotkeys/kcontrol/ui/Makefile.am b/khotkeys/kcontrol/ui/Makefile.am index 14ea5c44d..ee63c6871 100644 --- a/khotkeys/kcontrol/ui/Makefile.am +++ b/khotkeys/kcontrol/ui/Makefile.am @@ -1,6 +1,6 @@ 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 \ + command_url_widget_ui.ui menuentry_widget_ui.ui triggers_tab_ui.ui general_tab_ui.ui waiting_widget_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 \ diff --git a/khotkeys/kcontrol/ui/waiting_widget_ui.ui b/khotkeys/kcontrol/ui/waiting_widget_ui.ui new file mode 100644 index 000000000..5942a34ba --- /dev/null +++ b/khotkeys/kcontrol/ui/waiting_widget_ui.ui @@ -0,0 +1,72 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>KHotKeys::Waiting_widget_ui</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Waiting_widget_ui</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>580</width> + <height>480</height> + </rect> + </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="TQLabel"> + <property name="name"> + <cstring>waiting_label</cstring> + </property> + <property name="text"> + <string>Waiting time (ms): </string> + </property> + <property name="buddy" stdset="0"> + <cstring>waiting_spinbox</cstring> + </property> + </widget> + <widget class="KIntSpinBox"> + <property name="name"> + <cstring>waiting_spinbox</cstring> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="maxValue"> + <number>20000</number> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer16</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> +</widget> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> + <include location="global" impldecl="in implementation">knuminput.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/khotkeys/kcontrol/waiting_widget.cpp b/khotkeys/kcontrol/waiting_widget.cpp new file mode 100644 index 000000000..6f1c0c657 --- /dev/null +++ b/khotkeys/kcontrol/waiting_widget.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _WAITING_WIDGET_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "waiting_widget.h" + +#include <knuminput.h> + +#include <kdebug.h> + +#include <actions.h> +#include <action_data.h> + +#include "windowdef_list_widget.h" +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +Waiting_widget::Waiting_widget( TQWidget* parent_P, const char* name_P ) + : Waiting_widget_ui( parent_P, name_P ) + { + // KHotKeys::Module::changed() + connect(waiting_spinbox, TQT_SIGNAL(valueChanged(int)), + module, TQT_SLOT(changed())); + } + +void Waiting_widget::set_data( const Waiting_action* data_P ) + { + if( data_P == NULL ) + { + return; + } + waiting_spinbox->setValue(data_P->_waiting_time); + } + +Waiting_action* Waiting_widget::get_data( Action_data* data_P ) const + { + return new Waiting_action( data_P, waiting_spinbox->value()); + } + +} // namespace KHotKeys + +#include "waiting_widget.moc" diff --git a/khotkeys/kcontrol/waiting_widget.h b/khotkeys/kcontrol/waiting_widget.h new file mode 100644 index 000000000..520e7742e --- /dev/null +++ b/khotkeys/kcontrol/waiting_widget.h @@ -0,0 +1,36 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#ifndef _WAITING_WIDGET_H_ +#define _WAITING_WIDGET_H_ + +#include <waiting_widget_ui.h> + +namespace KHotKeys +{ + +class Waiting_action; +class Action_data; + +class Waiting_widget + : public Waiting_widget_ui + { + Q_OBJECT + public: + Waiting_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); + void set_data( const Waiting_action* data_P ); + Waiting_action* get_data( Action_data* data_P ) const; + }; + +typedef Waiting_widget Waiting_tab; + +} // namespace KHotKeys + +#endif |