~arjunak234-deactivatedaccount/kde-workspace/fix125114

« back to all changes in this revision

Viewing changes to khotkeys/kcm_hotkeys/helper_widgets/gesture_widget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2009 Michael Jansen <kde@michael-jansen.biz>
 
2
 
 
3
   This library is free software; you can redistribute it and/or
 
4
   modify it under the terms of the GNU Library General Public
 
5
   License as published by the Free Software Foundation; either
 
6
   version 2 of the License, or (at your option) any later version.
 
7
 
 
8
   This library is distributed in the hope that it will be useful,
 
9
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
   Library General Public License for more details.
 
12
 
 
13
   You should have received a copy of the GNU Library General Public License
 
14
   along with this library; see the file COPYING.LIB.  If not, write to
 
15
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
16
   Boston, MA 02110-1301, USA.
 
17
*/
 
18
 
 
19
#include "gesture_widget.h"
 
20
#include "helper_widgets/edit_gesture_dialog.h"
 
21
 
 
22
 
 
23
GestureWidget::GestureWidget(QWidget *parent)
 
24
    :   QWidget(parent)
 
25
    {
 
26
    ui.setupUi(this);
 
27
 
 
28
    connect(ui.edit_button, SIGNAL(clicked(bool)),
 
29
            SLOT(edit()));
 
30
    }
 
31
 
 
32
 
 
33
GestureWidget::~GestureWidget()
 
34
    {
 
35
    }
 
36
 
 
37
 
 
38
void GestureWidget::edit()
 
39
    {
 
40
    EditGestureDialog dia(ui.gesture->pointData());
 
41
    switch (dia.exec())
 
42
        {
 
43
        case KDialog::Accepted:
 
44
            setPointData(dia.pointData(), true);
 
45
            break;
 
46
 
 
47
        case KDialog::Rejected:
 
48
            break;
 
49
 
 
50
        default:
 
51
            Q_ASSERT(false);
 
52
        }
 
53
    }
 
54
 
 
55
 
 
56
 
 
57
 
 
58
KHotKeys::StrokePoints GestureWidget::pointData() const
 
59
    {
 
60
    return ui.gesture->pointData();
 
61
    }
 
62
 
 
63
 
 
64
void GestureWidget::setPointData(const KHotKeys::StrokePoints &data , bool emitSignal)
 
65
    {
 
66
    ui.gesture->setPointData(data);
 
67
    if(emitSignal)
 
68
        emit changed();
 
69
    }
 
70
 
 
71
#include "moc_gesture_widget.cpp"