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
Base calls for all items in the EMimeTypeModel.
Definition: emimemodelitem.h:27
Replacement of QAbstractItemModel to provide convenience signals for message handling.
Definition: eabstractitemmodel.h:36
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: emimetypemodel.cpp:142
void addMimeType(EMimeType *mimeType)
Definition: emimetypemodel.cpp:46
QModelIndex parent(const QModelIndex &index) const
Definition: emimetypemodel.cpp:108
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: emimetypemodel.cpp:175
bool loadModel()
Definition: emimetypemodel.cpp:269
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: emimetypemodel.cpp:157
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Definition: emimetypemodel.cpp:236
EMimeTypeModel(QObject *parent=0)
Definition: emimetypemodel.cpp:33
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: emimetypemodel.cpp:78
EMimeModelItem * elementFromIndex(const QModelIndex &index) const
Definition: emimetypemodel.cpp:259
The representation of an MimeType, related applications and settings.
Definition: emimetype.h:35
QList< EMimeType * > mimeTypes
Definition: emimetypemodel.h:62
bool saveModel()
Definition: emimetypemodel.cpp:354
bool hasChildren(const QModelIndex &parent=QModelIndex()) const
Definition: emimetypemodel.cpp:213
EMimeType * getMimeType(QString mimeType)
Definition: emimetypemodel.cpp:53
~EMimeTypeModel()
Definition: emimetypemodel.cpp:39
A model to represent MimeTypes, related applications and available settings.
Definition: emimetypemodel.h:35