LibEngsas
emimetypemodel.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
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  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17  MA 02110-1301 USA.
18 */
19 
20 #ifndef EMIMETYPEMODEL_H
21 #define EMIMETYPEMODEL_H
22 
23 #include "eabstractitemmodel.h"
24 
25 class EMimeModelItem;
26 class EMimeType;
27 
36 {
37  Q_OBJECT
38  public:
39  EMimeTypeModel ( QObject *parent = 0 );
41 
42  void addMimeType ( EMimeType *mimeType );
43  EMimeType *getMimeType ( QString mimeType );
44  EMimeType *getMimeType ( int row );
45 
46  QModelIndex index ( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
47  QModelIndex parent ( const QModelIndex &index ) const;
48  int rowCount ( const QModelIndex &parent = QModelIndex() ) const;
49  int columnCount ( const QModelIndex &parent = QModelIndex() ) const;
50  QVariant data ( const QModelIndex &index, int role = Qt::DisplayRole ) const;
51  bool hasChildren ( const QModelIndex &parent = QModelIndex() ) const;
52  QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
53 
54  bool loadModel();
55  bool saveModel();
56 
57  signals:
58 
59  public slots:
60 
61  private:
62  QList<EMimeType*> mimeTypes;
63 
64  EMimeModelItem* elementFromIndex ( const QModelIndex &index ) const;
65 };
66 
67 #endif // EMIMETYPEMODEL_H