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
|
/****************************************************************************
KHotKeys
Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>
Distributed under the terms of the GNU General Public License version 2.
****************************************************************************/
#define _WINDOW_TRIGGER_WIDGET_CPP_
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "window_trigger_widget.h"
#include <tqcheckbox.h>
#include <triggers.h>
#include <actions.h>
#include <action_data.h>
#include "windowdef_list_widget.h"
#include "kcmkhotkeys.h"
namespace KHotKeys
{
Window_trigger_widget::Window_trigger_widget( TQWidget* parent_P, const char* name_P )
: Window_trigger_widget_ui( parent_P, name_P )
{
clear_data();
// KHotKeys::Module::changed()
connect( window_appears_checkbox, TQT_SIGNAL( clicked()),
module, TQT_SLOT( changed()));
connect( window_disappears_checkbox, TQT_SIGNAL( clicked()),
module, TQT_SLOT( changed()));
connect( window_activates_checkbox, TQT_SIGNAL( clicked()),
module, TQT_SLOT( changed()));
connect( window_deactivates_checkbox, TQT_SIGNAL( clicked()),
module, TQT_SLOT( changed()));
}
void Window_trigger_widget::clear_data()
{
windowdef_list_widget->clear_data();
window_appears_checkbox->setChecked( false );
window_disappears_checkbox->setChecked( false );
window_activates_checkbox->setChecked( false );
window_deactivates_checkbox->setChecked( false );
}
void Window_trigger_widget::set_data( const Window_trigger* trigger_P )
{
if( trigger_P == NULL )
{
clear_data();
return;
}
windowdef_list_widget->set_data( trigger_P->windows());
window_appears_checkbox->setChecked(
trigger_P->triggers_on( Window_trigger::WINDOW_APPEARS ));
window_disappears_checkbox->setChecked(
trigger_P->triggers_on( Window_trigger::WINDOW_DISAPPEARS ));
window_activates_checkbox->setChecked(
trigger_P->triggers_on( Window_trigger::WINDOW_ACTIVATES ));
window_deactivates_checkbox->setChecked(
trigger_P->triggers_on( Window_trigger::WINDOW_DEACTIVATES ));
}
Window_trigger* Window_trigger_widget::get_data( Action_data* data_P ) const
{
return new Window_trigger( data_P, windowdef_list_widget->get_data(),
( window_appears_checkbox->isChecked() ? Window_trigger::WINDOW_APPEARS : 0 )
| ( window_disappears_checkbox->isChecked() ? Window_trigger::WINDOW_DISAPPEARS : 0 )
| ( window_activates_checkbox->isChecked() ? Window_trigger::WINDOW_ACTIVATES : 0 )
| ( window_deactivates_checkbox->isChecked() ? Window_trigger::WINDOW_DEACTIVATES : 0 ));
}
} // namespace KHotKeys
#include "window_trigger_widget.moc"
|