1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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"
|