diff options
Diffstat (limited to 'khotkeys/shared/actions.cpp')
-rw-r--r-- | khotkeys/shared/actions.cpp | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/khotkeys/shared/actions.cpp b/khotkeys/shared/actions.cpp index c8590789a..b5e7baa8e 100644 --- a/khotkeys/shared/actions.cpp +++ b/khotkeys/shared/actions.cpp @@ -21,14 +21,14 @@ #include <kdebug.h> #include <kurifilter.h> #include <tdeglobal.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdeapplication.h> #include <dcopclient.h> -#include <kdesktopfile.h> +#include <tdedesktopfile.h> #include <tdelocale.h> #include <tdeaccel.h> #include <kservice.h> -#include <kprocess.h> +#include <tdeprocess.h> #include <tdemessagebox.h> #include "windows.h" @@ -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; } @@ -122,7 +124,7 @@ void Command_url_action::execute() static bool sm_ready = false; if( !sm_ready ) { - kapp->propagateSessionManager(); + tdeApp->propagateSessionManager(); sm_ready = true; } // int space_pos = command_url().find( ' ' ); @@ -147,7 +149,7 @@ void Command_url_action::execute() } case KURIFilterData::EXECUTABLE: { - if (!kapp->authorize("shell_access")) + if (!tdeApp->authorize("shell_access")) return; if( !uri.hasArgsAndOptions()) { @@ -165,7 +167,7 @@ void Command_url_action::execute() } case KURIFilterData::SHELL: { - if (!kapp->authorize("shell_access")) + if (!tdeApp->authorize("shell_access")) return; if( !KRun::runCommand( cmd + ( uri.hasArgsAndOptions() ? uri.argsAndOptions() : "" ), @@ -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 |