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
96
97
98
99
100
101
|
/****************************************************************************
KHotKeys
Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>
Distributed under the terms of the GNU General Public License version 2.
****************************************************************************/
#define _KEYBOARD_INPUT_WIDGET_CPP_
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "keyboard_input_widget.h"
#include <tqgroupbox.h>
#include <tqpushbutton.h>
#include <tqradiobutton.h>
#include <ktextedit.h>
#include <actions.h>
#include <action_data.h>
#include "windowdef_list_widget.h"
#include "kcmkhotkeys.h"
namespace KHotKeys
{
Keyboard_input_widget::Keyboard_input_widget( TQWidget* parent_P, const char* name_P )
: Keyboard_input_widget_ui( parent_P, name_P )
{
clear_data();
// KHotKeys::Module::changed()
connect( action_window_radio, TQ_SIGNAL( clicked()),
module, TQ_SLOT( changed()));
connect( active_window_radio, TQ_SIGNAL( clicked()),
module, TQ_SLOT( changed()));
connect( specific_window_radio, TQ_SIGNAL( clicked()),
module, TQ_SLOT( changed()));
connect( keyboard_input_multilineedit, TQ_SIGNAL( textChanged()),
module, TQ_SLOT( changed()));
connect( modify_button, TQ_SIGNAL( clicked()),
module, TQ_SLOT( changed()));
}
void Keyboard_input_widget::clear_data()
{
keyboard_input_multilineedit->clear();
action_window_radio->setChecked( true );
active_window_radio->setChecked( false );
specific_window_radio->setChecked( false );
window_groupbox->setEnabled( false );
windowdef_list_widget->clear_data();
}
void Keyboard_input_widget::set_data( const Keyboard_input_action* data_P )
{
if( data_P == NULL )
{
clear_data();
return;
}
keyboard_input_multilineedit->setText( data_P->input());
const Windowdef_list* dest_window = data_P->dest_window();
specific_window_radio->setChecked( dest_window != NULL );
window_groupbox->setEnabled( dest_window != NULL );
if( dest_window != NULL )
windowdef_list_widget->set_data( dest_window );
else
{
windowdef_list_widget->clear_data();
if( data_P->activeWindow())
active_window_radio->setChecked( true );
else
action_window_radio->setChecked( true );
}
}
Keyboard_input_action* Keyboard_input_widget::get_data( Action_data* data_P ) const
{
const Windowdef_list* windows = NULL;
if( specific_window_radio->isChecked())
windows = windowdef_list_widget->get_data();
return new Keyboard_input_action( data_P, keyboard_input_multilineedit->text(),
windows, active_window_radio->isChecked());
}
void Keyboard_input_widget::modify_pressed()
{ // CHECKME TODO
// CHECKME klavesy nesmi byt i18n() !!
}
} // namespace KHotKeys
#include "keyboard_input_widget.moc"
|