summaryrefslogtreecommitdiffstats
path: root/khotkeys/shared
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2022-08-24 20:55:24 +0900
committerMichele Calgaro <[email protected]>2022-08-25 18:25:48 +0900
commit7fed9587e9673983fe4128557baa33b23b71076f (patch)
tree8604505e8b463b97522e5a5ac68bf4dda018bbdf /khotkeys/shared
parent5e4ca4df9bb34e10a897e32e7e0ca8645b97f293 (diff)
downloadtdebase-7fed9587e9673983fe4128557baa33b23b71076f.tar.gz
tdebase-7fed9587e9673983fe4128557baa33b23b71076f.zip
khotkeys: added 'waiting' action to the list of available choices.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'khotkeys/shared')
-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
4 files changed, 65 insertions, 6 deletions
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;
}