2
Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
Boston, MA 02110-1301, USA.
19
#ifndef KHOTKEYSMODEL_H
20
#define KHOTKEYSMODEL_H
22
#include "libkhotkeysfwd.h"
25
#include <QtCore/QAbstractItemModel>
30
class KHotkeysModel : public QAbstractItemModel
37
Other //!< Some unknown action type
38
,ActionDataGroup //!< A shortcut group
53
KHotkeysModel( QObject *parent = 0 );
58
virtual ~KHotkeysModel();
61
* \group Qt Model/View Framework methods
64
QModelIndex index( int, int, const QModelIndex &parent = QModelIndex() ) const;
65
QModelIndex parent( const QModelIndex &index ) const;
66
int rowCount( const QModelIndex &index ) const;
67
int columnCount( const QModelIndex &index ) const;
68
QVariant headerData( int section, Qt::Orientation, int role = Qt::DisplayRole ) const;
69
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
70
bool setData( const QModelIndex &index, const QVariant &value, int role );
71
Qt::ItemFlags flags( const QModelIndex &index ) const;
75
* \group Drag and Drop Support
80
,Qt::DropAction action
83
,const QModelIndex &parent);
84
QMimeData *mimeData(const QModelIndexList &indexes) const;
85
QStringList mimeTypes() const;
89
* Add a group as child of @a parent.
91
* @return the index for the new group
93
QModelIndex addGroup( const QModelIndex &parent );
96
* Export the input actions into @a config.
98
void exportInputActions(
99
const QModelIndex &index,
102
const KHotKeys::ActionState state,
106
*Import the input actions from @a config.
108
void importInputActions(const QModelIndex &index, KConfigBase const &config);
111
* Get the KHotKeys::ActionDataBase behind the index.
113
KHotKeys::ActionDataBase *indexToActionDataBase( const QModelIndex &index ) const;
116
* Get the KHotKeys::ActionDataBase behind the index or 0.
118
* Getting 0 doesn't mean the index is invalid. It means you provided a
121
KHotKeys::ActionDataGroup *indexToActionDataGroup( const QModelIndex &index ) const;
124
* Insert @a data as a child of @a parent.
126
QModelIndex insertActionData( KHotKeys::ActionDataBase *data, const QModelIndex &parent );
129
* Load the settings from the file
134
* Move @p element to @p newGroup at @position.
136
* @param element move this element
137
* @param newGroup to this group
138
* @param position and put it at this position. default is last
140
* @return @c true if moved, @c false if not.
143
KHotKeys::ActionDataBase *element
144
,KHotKeys::ActionDataGroup *newGroup
148
* Remove @a count rows starting with @a row under @a parent.
150
bool removeRows( int row, int count, const QModelIndex &parent );
153
* Save the settings to the file
158
* Return the settings we handle
160
KHotKeys::Settings *settings();
162
void emitChanged( KHotKeys::ActionDataBase *item );
166
KHotKeys::Settings _settings;
167
KHotKeys::ActionDataGroup *_actions;
171
#endif /* #ifndef KHOTKEYSMODEL_HPP */