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

« back to all changes in this revision

Viewing changes to khotkeys/libkhotkeysprivate/settings_writer.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 SETTINGS_WRITER_H
 
2
#define SETTINGS_WRITER_H
 
3
/**
 
4
 * Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>
 
5
 * Copyright (C) 2009 Michael Jansen <kde@michael-jansen.biz>
 
6
 *
 
7
 * This library is free software; you can redistribute it and/or
 
8
 * modify it under the terms of the GNU Library General Public
 
9
 * License version 2 as published by the Free Software Foundation.
 
10
 *
 
11
 * This library is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
14
 * Library General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Library General Public License
 
17
 * along with this library; see the file COPYING.LIB. If not, write to
 
18
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
19
 * Boston, MA 02110-1301, USA.
 
20
 **/
 
21
 
 
22
#include "action_data/action_data_visitor.h"
 
23
 
 
24
#include <QtCore/QStack>
 
25
 
 
26
#include "settings.h"
 
27
 
 
28
class KConfigBase;
 
29
class KConfigGroup;
 
30
 
 
31
namespace KHotKeys {
 
32
 
 
33
 
 
34
/**
 
35
 * @author Michael Jansen <kde@michael-jansen.biz>
 
36
 */
 
37
class SettingsWriter : public ActionDataConstVisitor
 
38
    {
 
39
 
 
40
public:
 
41
 
 
42
    SettingsWriter(
 
43
            const Settings *settings,
 
44
            ActionState state,
 
45
            const QString &id = QString(),
 
46
            bool allowMerging = false);
 
47
 
 
48
    void exportTo(
 
49
            const ActionDataBase *element,
 
50
            KConfigBase &config);
 
51
 
 
52
    void writeTo(KConfigBase &cfg);
 
53
 
 
54
    virtual void visitActionDataBase(const ActionDataBase *base);
 
55
 
 
56
    virtual void visitActionData(const ActionData *group);
 
57
 
 
58
    virtual void visitActionDataGroup(const ActionDataGroup *group);
 
59
 
 
60
    virtual void visitGenericActionData(const Generic_action_data *data);
 
61
 
 
62
    virtual void visitMenuentryShortcutActionData(const MenuEntryShortcutActionData *data);
 
63
 
 
64
    virtual void visitSimpleActionData(const SimpleActionData *data);
 
65
 
 
66
private:
 
67
 
 
68
    const Settings *_settings;
 
69
 
 
70
    QStack<KConfigGroup*> _stack;
 
71
 
 
72
    ActionState _state;
 
73
 
 
74
    QString _importId;
 
75
 
 
76
    bool _allowMerging;
 
77
 
 
78
    bool _export;
 
79
 
 
80
    // Disable copying
 
81
    SettingsWriter(const SettingsWriter&);
 
82
    SettingsWriter& operator=(const SettingsWriter&);
 
83
 
 
84
    }; //SettingsWriter
 
85
 
 
86
} // namespace KHotKeys
 
87
 
 
88
 
 
89
#endif /* SETTINGS_WRITER_H */
 
90