~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to khotkeys/kcm_hotkeys/helper_widgets/window_definition_list_widget.h

  • 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
#ifndef WINDOW_DEFINITION_LIST_WIDGET_H
 
2
#define WINDOW_DEFINITION_LIST_WIDGET_H
 
3
/* Copyright (C) 2009 Michael Jansen <kde@michael-jansen.biz>
 
4
 
 
5
   This library is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU Library General Public
 
7
   License as published by the Free Software Foundation; either
 
8
   version 2 of the License, or (at your option) any later version.
 
9
 
 
10
   This library is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
   Library General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU Library General Public License
 
16
   along with this library; see the file COPYING.LIB.  If not, write to
 
17
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
   Boston, MA 02110-1301, USA.
 
19
*/
 
20
 
 
21
 
 
22
#include "hotkeys_widget_iface.h"
 
23
 
 
24
#include "ui_window_definition_list_widget.h"
 
25
#include "windows_helper/window_selection_list.h"
 
26
 
 
27
 
 
28
 
 
29
/**
 
30
 * @author Michael Jansen <kde@michael-jansen.biz>
 
31
 */
 
32
class WindowDefinitionListWidget : public HotkeysWidgetIFace
 
33
    {
 
34
    Q_OBJECT
 
35
 
 
36
public:
 
37
 
 
38
    /**
 
39
     * Default constructor
 
40
     */
 
41
    WindowDefinitionListWidget(
 
42
            KHotKeys::Windowdef_list *windowdef_list,
 
43
            QWidget *parent = NULL);
 
44
 
 
45
    WindowDefinitionListWidget(QWidget *parent);
 
46
 
 
47
    /**
 
48
     * Destructor
 
49
     */
 
50
    virtual ~WindowDefinitionListWidget();
 
51
 
 
52
    void setWindowDefinitions(KHotKeys::Windowdef_list *windowdef_list);
 
53
 
 
54
    bool isChanged() const;
 
55
 
 
56
private:
 
57
 
 
58
    void emitChanged(bool);
 
59
 
 
60
private Q_SLOTS:
 
61
 
 
62
    void slotDelete(bool);
 
63
    void slotDuplicate(bool);
 
64
    void slotEdit(bool);
 
65
    void slotNew(bool);
 
66
 
 
67
protected:
 
68
 
 
69
    void doCopyFromObject();
 
70
    void doCopyToObject();
 
71
 
 
72
private:
 
73
 
 
74
    // The Windowdefinition list
 
75
    KHotKeys::Windowdef_list    *_windowdefs;
 
76
    KHotKeys::Windowdef_list    *_working;
 
77
 
 
78
    // The User Interface
 
79
    Ui::WindowDefinitionListWidget ui;
 
80
 
 
81
    // Unsaved changes?
 
82
    bool _changed;
 
83
};
 
84
 
 
85
 
 
86
class WindowDefinitionListDialog : public KDialog
 
87
    {
 
88
    Q_OBJECT
 
89
 
 
90
public:
 
91
 
 
92
    WindowDefinitionListDialog(
 
93
            KHotKeys::Windowdef_list *list,
 
94
            QWidget *parent=NULL)
 
95
        :   KDialog(parent)
 
96
            ,def(NULL)
 
97
        {
 
98
        def = new WindowDefinitionListWidget(list, this);
 
99
        setMainWidget(def);
 
100
        def->copyFromObject();
 
101
        }
 
102
 
 
103
 
 
104
    ~WindowDefinitionListDialog()
 
105
        {
 
106
        def = NULL;
 
107
        }
 
108
 
 
109
 
 
110
    virtual void accept()
 
111
        {
 
112
        def->copyToObject();
 
113
        KDialog::accept();
 
114
        }
 
115
 
 
116
private:
 
117
 
 
118
    WindowDefinitionListWidget *def;
 
119
    };
 
120
 
 
121
#endif /* #ifndef WINDOW_DEFINITION_LIST_WIDGET_H */