summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--khotkeys/kcontrol/CMakeLists.txt2
-rw-r--r--khotkeys/kcontrol/Makefile.am2
-rw-r--r--khotkeys/kcontrol/action_list_widget.cpp29
-rw-r--r--khotkeys/kcontrol/action_list_widget.h16
-rw-r--r--khotkeys/kcontrol/ui/CMakeLists.txt2
-rw-r--r--khotkeys/kcontrol/ui/Makefile.am2
-rw-r--r--khotkeys/kcontrol/ui/waiting_widget_ui.ui72
-rw-r--r--khotkeys/kcontrol/waiting_widget.cpp56
-rw-r--r--khotkeys/kcontrol/waiting_widget.h36
-rw-r--r--khotkeys/shared/actions.cpp34
-rw-r--r--khotkeys/shared/actions.h29
-rw-r--r--khotkeys/shared/settings.cpp6
-rw-r--r--khotkeys/shared/triggers.cpp2
13 files changed, 277 insertions, 11 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
diff --git a/khotkeys/shared/actions.cpp b/khotkeys/shared/actions.cpp
index c8590789a..69c853fed 100644
--- a/khotkeys/shared/actions.cpp
+++ b/khotkeys/shared/actions.cpp
@@ -54,7 +54,9 @@ Action* Action::create_cfg_read( TDEConfig& cfg_P, Action_data* data_P )
return new Keyboard_input_action( cfg_P, data_P );
if( type == "ACTIVATE_WINDOW" )
return new Activate_window_action( cfg_P, data_P );
- kdWarning( 1217 ) << "Unknown Action type read from cfg file\n";
+ if( type == "WAITING" )
+ return new Waiting_action( cfg_P, data_P );
+ kdWarning( 1217 ) << "Unknown Action type read from cfg file: " << type << endl;
return NULL;
}
@@ -452,4 +454,34 @@ Action* Activate_window_action::copy( Action_data* data_P ) const
return new Activate_window_action( data_P, window()->copy());
}
+// Waiting_action
+
+Waiting_action::Waiting_action( TDEConfig& cfg_P, Action_data* data_P )
+ : Action( cfg_P, data_P )
+ {
+ _waiting_time = cfg_P.readNumEntry("Time");
+ }
+
+void Waiting_action::cfg_write( TDEConfig& cfg_P ) const
+ {
+ base::cfg_write( cfg_P );
+ cfg_P.writeEntry( "Type", "WAITING" ); // overwrites value set in base::cfg_write()
+ cfg_P.writeEntry( "Time", _waiting_time);
+ }
+
+void Waiting_action::execute()
+ {
+ usleep(_waiting_time * 1000);
+ }
+
+TQString Waiting_action::description() const
+ {
+ return i18n( "Waiting %1 ms" ).arg(_waiting_time);
+ }
+
+Action* Waiting_action::copy( Action_data* data_P ) const
+ {
+ return new Waiting_action( data_P, _waiting_time);
+ }
+
} // namespace KHotKeys
diff --git a/khotkeys/shared/actions.h b/khotkeys/shared/actions.h
index f381683e1..c7cabf0fc 100644
--- a/khotkeys/shared/actions.h
+++ b/khotkeys/shared/actions.h
@@ -50,7 +50,7 @@ class KDE_EXPORT Action_list
: public TQPtrList< Action >
{
public:
- Action_list( const TQString& comment_P ); // CHECKME nebo i data ?
+ Action_list( const TQString& comment_P );
Action_list( TDEConfig& cfg_P, Action_data* data_P );
void cfg_write( TDEConfig& cfg_P ) const;
typedef TQPtrListIterator< Action > Iterator;
@@ -111,7 +111,7 @@ class KDE_EXPORT Dcop_action
virtual TQString description() const;
virtual Action* copy( Action_data* data_P ) const;
private:
- TQString app; // CHECKME TQCString ?
+ TQString app;
TQString obj;
TQString call;
TQString args;
@@ -159,6 +159,21 @@ class KDE_EXPORT Activate_window_action
const Windowdef_list* _window;
};
+class KDE_EXPORT Waiting_action
+ : public Action
+ {
+ typedef Action base;
+ public:
+ Waiting_action( Action_data* data_P, const int waiting_time );
+ Waiting_action( TDEConfig& cfg_P, Action_data* data_P );
+ virtual void cfg_write( TDEConfig& cfg_P ) const;
+ virtual void execute();
+ virtual TQString description() const;
+ virtual Action* copy( Action_data* data_P ) const;
+
+ int _waiting_time;
+ };
+
//***************************************************************************
// Inline
//***************************************************************************
@@ -300,6 +315,14 @@ const Windowdef_list* Activate_window_action::window() const
return _window;
}
+// Waiting_action
+
+inline
+Waiting_action::Waiting_action( Action_data* data_P, const int waiting_time)
+ : Action( data_P ), _waiting_time(waiting_time)
+ {
+ }
+
} // namespace KHotKeys
-
+
#endif
diff --git a/khotkeys/shared/settings.cpp b/khotkeys/shared/settings.cpp
index 76adac6b9..becacd5d1 100644
--- a/khotkeys/shared/settings.cpp
+++ b/khotkeys/shared/settings.cpp
@@ -145,9 +145,11 @@ void Settings::write_settings()
gestures_exclude->cfg_write( cfg );
}
else
+ {
cfg.deleteGroup( "GesturesExclude" );
- cfg.setGroup( "Voice" );
- cfg.writeEntry("Shortcut" , voice_shortcut.toStringInternal() );
+ }
+ cfg.setGroup( "Voice" );
+ cfg.writeEntry("Shortcut" , voice_shortcut.toStringInternal() );
}
diff --git a/khotkeys/shared/triggers.cpp b/khotkeys/shared/triggers.cpp
index 115bc6687..5bd8dbe3e 100644
--- a/khotkeys/shared/triggers.cpp
+++ b/khotkeys/shared/triggers.cpp
@@ -277,6 +277,7 @@ void Window_trigger::window_changed( WId window_P, unsigned int dirty_P )
bool matches = windows()->match( Window_data( window_P ));
existing_windows[ window_P ] = matches;
if( active && matches && !was_match )
+ {
if( window_actions & WINDOW_APPEARS )
{
windows_handler->set_action_window( window_P );
@@ -287,6 +288,7 @@ void Window_trigger::window_changed( WId window_P, unsigned int dirty_P )
windows_handler->set_action_window( window_P );
data->execute();
}
+ }
kdDebug( 1217 ) << "Window_trigger::w_changed() : " << was_match << "|" << matches << endl;
}