diff options
Diffstat (limited to 'khotkeys/shared/actions.cpp')
-rw-r--r-- | khotkeys/shared/actions.cpp | 34 |
1 files changed, 33 insertions, 1 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 |