summaryrefslogtreecommitdiffstats
path: root/khotkeys/kcontrol/gestures_settings_tab.cpp
blob: 200fa6b97ef61c36943ee6b6396184e7df12580b (plain)
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
/****************************************************************************

 KHotKeys
 
 Copyright (C) 2003 Lubos Lunak <[email protected]>

 Distributed under the terms of the GNU General Public License version 2.
 
****************************************************************************/

#define _GESTURES_SETTINGS_TAB_CPP_

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "gestures_settings_tab.h"

#include <tdelocale.h>
#include <tqcombobox.h>
#include <knuminput.h>
#include <tqcheckbox.h>

#include "kcmkhotkeys.h"
#include "windowdef_list_widget.h"

namespace KHotKeys
{

Gestures_settings_tab::Gestures_settings_tab( TQWidget* parent_P, const char* name_P )
    : Gestures_settings_tab_ui( parent_P, name_P )
    {
    mouse_button_combo->insertItem( i18n( "Button 2 (middle)" ), 0 );
    mouse_button_combo->insertItem( i18n( "Button 3 (secondary)" ), 1 );
    mouse_button_combo->insertItem( i18n( "Button 4 (often wheel up)" ), 2 );
    mouse_button_combo->insertItem( i18n( "Button 5 (often wheel down)" ), 3 );
    mouse_button_combo->insertItem( i18n( "Button 6 (if available)" ), 4 );
    mouse_button_combo->insertItem( i18n( "Button 7 (if available)" ), 5 );
    mouse_button_combo->insertItem( i18n( "Button 8 (if available)" ), 6 );
    mouse_button_combo->insertItem( i18n( "Button 9 (if available)" ), 7 );
    // KHotKeys::Module::changed()
    connect( mouse_gestures_globally, TQ_SIGNAL( clicked()),
        module, TQ_SLOT( changed()));
    connect( mouse_button_combo, TQ_SIGNAL( activated( int )),
        module, TQ_SLOT( changed()));
    connect( timeout_input, TQ_SIGNAL( valueChanged( int )),
        module, TQ_SLOT( changed()));
    }

void Gestures_settings_tab::read_data()
    {
    mouse_gestures_globally->setChecked( module->gestures_disabled());
    mouse_button_combo->setCurrentItem( module->gesture_button() - 2 );
    timeout_input->setValue( module->gesture_timeout());
    if( module->gestures_exclude() != NULL )
        windowdef_list_widget->set_data( module->gestures_exclude());
    else
        windowdef_list_widget->clear_data();
    }

void Gestures_settings_tab::write_data() const
    {
    module->set_gestures_disabled( mouse_gestures_globally->isChecked());
    module->set_gesture_button( mouse_button_combo->currentItem() + 2 );
    module->set_gesture_timeout( timeout_input->value());
    module->set_gestures_exclude( windowdef_list_widget->get_data());
    }

void Gestures_settings_tab::clear_data()
    {
    // "global" tab, not action specific, do nothing
    }
    
} // namespace KHotKeys

#include "gestures_settings_tab.moc"