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

« back to all changes in this revision

Viewing changes to khotkeys/libkhotkeysprivate/action_data/action_data_group.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
/****************************************************************************
 
2
 
 
3
 KHotKeys
 
4
 
 
5
 Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>
 
6
 
 
7
 Distributed under the terms of the GNU General Public License version 2.
 
8
 
 
9
****************************************************************************/
 
10
 
 
11
#ifndef ACTION_DATA_GROUP_H
 
12
#define ACTION_DATA_GROUP_H
 
13
 
 
14
#include "action_data_base.h"
 
15
#include "actions/actions.h"
 
16
#include "triggers/triggers.h"
 
17
 
 
18
#include "QtCore/QList"
 
19
 
 
20
#include "kdemacros.h"
 
21
 
 
22
 
 
23
class KHotkeysModel;
 
24
 
 
25
namespace KHotKeys {
 
26
 
 
27
 
 
28
/**
 
29
 * A group of \c ActionDataBase objects
 
30
 *
 
31
 * # The group can contain actions or action groups.
 
32
 * # The group has its own list of conditions. These conditions apply to all children.
 
33
 */
 
34
class KDE_EXPORT ActionDataGroup
 
35
    : public ActionDataBase
 
36
    {
 
37
    Q_OBJECT
 
38
 
 
39
    public:
 
40
 
 
41
        enum system_group_t {
 
42
            SYSTEM_NONE,             //!< TODO
 
43
            SYSTEM_MENUENTRIES,      //!< Shortcuts for menu entries.
 
44
            SYSTEM_ROOT,             //!< TODO
 
45
            /* last one*/ SYSTEM_MAX //!< End of enum marker
 
46
            }; // don't remove entries
 
47
 
 
48
        /**
 
49
         * Create a \c ActionDataGroup object.
 
50
         *
 
51
         * \param parent_P  A ActionDataGroup or 0. If provided this action is
 
52
         *        registered with the group.
 
53
         * \param name_P    Name for the object.
 
54
         * \param comment_P Comment for the object.
 
55
         * \param condition_P Conditions for the object or 0
 
56
         * \param system_group_t Group type
 
57
         * \param enabled_P Is the action enabled?
 
58
         */
 
59
        ActionDataGroup( 
 
60
            ActionDataGroup* parent_P,
 
61
            const QString& name_P = QString(),
 
62
            const QString& comment_P = QString(),
 
63
            Condition_list* conditions_P = NULL,
 
64
            system_group_t system_group_P = SYSTEM_NONE);
 
65
 
 
66
        virtual ~ActionDataGroup();
 
67
 
 
68
        /**
 
69
         * Visitor pattern
 
70
         */
 
71
        virtual void accept(ActionDataVisitor *visitor);
 
72
        virtual void accept(ActionDataConstVisitor *visitor) const;
 
73
 
 
74
        virtual void update_triggers();
 
75
 
 
76
        /**
 
77
         * What kind of actions are allowed for this group?
 
78
         */
 
79
        Action::ActionTypes allowedActionTypes() const;
 
80
 
 
81
        /**
 
82
         * What kind of trigger are allowed for this group?
 
83
         */
 
84
        Trigger::TriggerTypes allowedTriggerTypes() const;
 
85
 
 
86
        /**
 
87
         * Get a shallow copy of the list of children.
 
88
         */
 
89
        const QList<ActionDataBase*> children() const;
 
90
 
 
91
        /**
 
92
         * Number of childrens.
 
93
         */
 
94
        int size() const;
 
95
 
 
96
        /**
 
97
         * @reimp
 
98
         */
 
99
        void aboutToBeErased();
 
100
 
 
101
        /**
 
102
         * Is this a system group?
 
103
         *
 
104
         * @{
 
105
         */
 
106
        bool is_system_group() const;
 
107
        system_group_t system_group() const;
 
108
        void set_system_group(system_group_t group);
 
109
        //@}
 
110
 
 
111
        // CHECKME : Why this?
 
112
        using ActionDataBase::set_conditions; // make public
 
113
 
 
114
        //! Add a child to this collection
 
115
        void add_child( ActionDataBase* child_P, int position );
 
116
 
 
117
        //! Add a child to this collection
 
118
        void add_child( ActionDataBase* child_P );
 
119
 
 
120
        //! Remove a child from this collection
 
121
        void remove_child( ActionDataBase* child_P );
 
122
 
 
123
    Q_SIGNALS:
 
124
 
 
125
        void stateChanged(bool isEnabled);
 
126
 
 
127
    protected:
 
128
 
 
129
        //! The children
 
130
        QList< ActionDataBase* > _list;
 
131
 
 
132
        //! System group type
 
133
        system_group_t _system_group; // e.g. menuedit entries, can't be deleted or renamed
 
134
 
 
135
        virtual void doEnable();
 
136
 
 
137
        virtual void doDisable();
 
138
 
 
139
    };
 
140
 
 
141
 
 
142
 
 
143
} // namespace KHotKeys
 
144
 
 
145
#endif