diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 4aed2c8219774f5d797760606b8489a92ddc5163 (patch) | |
tree | 3f8c130f7d269626bf6a9447407ef6c35954426a /khotkeys/kcontrol/dcop_widget.cpp | |
download | tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'khotkeys/kcontrol/dcop_widget.cpp')
-rw-r--r-- | khotkeys/kcontrol/dcop_widget.cpp | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/khotkeys/kcontrol/dcop_widget.cpp b/khotkeys/kcontrol/dcop_widget.cpp new file mode 100644 index 000000000..6cc8773a1 --- /dev/null +++ b/khotkeys/kcontrol/dcop_widget.cpp @@ -0,0 +1,95 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#define _DCOP_WIDGET_CPP_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "dcop_widget.h" + +#include <qlineedit.h> +#include <qpushbutton.h> + +#include <krun.h> +#include <kmessagebox.h> +#include <klocale.h> + +#include <actions.h> + +#include "kcmkhotkeys.h" + +namespace KHotKeys +{ + +Dcop_widget::Dcop_widget( QWidget* parent_P, const char* name_P ) + : Dcop_widget_ui( parent_P, name_P ) + { + clear_data(); + try_button->setText( i18n( "to try", "&Try" )); // Qt designer can't do this + // KHotKeys::Module::changed() + connect( remote_app_lineedit, SIGNAL( textChanged( const QString& )), + module, SLOT( changed())); + connect( remote_object_lineedit, SIGNAL( textChanged( const QString& )), + module, SLOT( changed())); + connect( called_function_lineedit, SIGNAL( textChanged( const QString& )), + module, SLOT( changed())); + connect( arguments_lineedit, SIGNAL( textChanged( const QString& )), + module, SLOT( changed())); + } + +void Dcop_widget::clear_data() + { + remote_app_lineedit->clear(); + remote_object_lineedit->clear(); + called_function_lineedit->clear(); + arguments_lineedit->clear(); + // CHECKME nebo spis multilineedit ? + } + +void Dcop_widget::set_data( const Dcop_action* data_P ) + { + if( data_P == NULL ) + { + clear_data(); + return; + } + remote_app_lineedit->setText( data_P->remote_application()); + remote_object_lineedit->setText( data_P->remote_object()); + called_function_lineedit->setText( data_P->called_function()); + arguments_lineedit->setText( data_P->arguments()); + // CHECKME nebo spis multilineedit ? + } + +Dcop_action* Dcop_widget::get_data( Action_data* data_P ) const + { + return new Dcop_action( data_P, remote_app_lineedit->text().stripWhiteSpace(), + remote_object_lineedit->text().stripWhiteSpace(), + called_function_lineedit->text().stripWhiteSpace(), arguments_lineedit->text()); + } + +// CHECKME later "steal" whole interfaces browsing from kdcop +void Dcop_widget::run_kdcop_pressed() + { + if( KRun::runCommand( "kdcop" ) == 0 ) + KMessageBox::sorry( NULL, i18n( "Failed to run KDCOP" )); + } + +void Dcop_widget::try_pressed() + { + Dcop_action* tmp = get_data( NULL ); // CHECKME + tmp->execute(); + delete tmp; + } + +} // namespace KHotKeys + +#include "dcop_widget.moc" |