| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
| 4 | ** Contact: http://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the QtOrganizer module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at http://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 2.1 or version 3 as published by the Free |
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and |
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the |
| 22 | ** following information to ensure the GNU Lesser General Public License |
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and |
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 25 | ** |
| 26 | ** As a special exception, The Qt Company gives you certain additional |
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception |
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
| 29 | ** |
| 30 | ** $QT_END_LICENSE$ |
| 31 | ** |
| 32 | ****************************************************************************/ |
| 33 | |
| 34 | #ifndef QDECLARATIVEORGANIZERCOLLECTION_H |
| 35 | #define QDECLARATIVEORGANIZERCOLLECTION_H |
| 36 | |
| 37 | #include <QtCore/qurl.h> |
| 38 | |
| 39 | #include <QtGui/qcolor.h> |
| 40 | |
| 41 | #include <QtQml/qqml.h> |
| 42 | |
| 43 | #include <QtOrganizer/qorganizercollection.h> |
| 44 | |
| 45 | QTORGANIZER_USE_NAMESPACE |
| 46 | |
| 47 | QT_BEGIN_NAMESPACE |
| 48 | |
| 49 | class QDeclarativeOrganizerCollection : public QObject |
| 50 | { |
| 51 | Q_OBJECT |
| 52 | |
| 53 | Q_ENUMS(MetaDataKey) |
| 54 | Q_PROPERTY(QString collectionId READ id WRITE setId NOTIFY valueChanged) |
| 55 | Q_PROPERTY(QString name READ name WRITE setName NOTIFY valueChanged) |
| 56 | Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY valueChanged) |
| 57 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY valueChanged) |
| 58 | Q_PROPERTY(QColor secondaryColor READ secondaryColor WRITE setSecondaryColor NOTIFY valueChanged) |
| 59 | Q_PROPERTY(QUrl image READ image WRITE setImage NOTIFY valueChanged) |
| 60 | |
| 61 | public: |
| 62 | enum MetaDataKey { |
| 63 | KeyName = QOrganizerCollection::KeyName, |
| 64 | KeyDescription = QOrganizerCollection::KeyDescription, |
| 65 | KeyColor = QOrganizerCollection::KeyColor, |
| 66 | KeySecondaryColor = QOrganizerCollection::KeySecondaryColor, |
| 67 | KeyImage = QOrganizerCollection::KeyImage, |
| 68 | KeyExtended = QOrganizerCollection::KeyExtended |
| 69 | }; |
| 70 | |
| 71 | QDeclarativeOrganizerCollection(QObject *parent = Q_NULLPTR); |
| 72 | |
| 73 | QString id() const; |
| 74 | void setId(const QString &id); |
| 75 | |
| 76 | QString name() const; |
| 77 | void setName(const QString &name); |
| 78 | |
| 79 | QString description() const; |
| 80 | void setDescription(const QString &description); |
| 81 | |
| 82 | QColor color() const; |
| 83 | void setColor(const QColor &color); |
| 84 | |
| 85 | QColor secondaryColor() const; |
| 86 | void setSecondaryColor(const QColor &secondaryColor); |
| 87 | |
| 88 | QUrl image() const; |
| 89 | void setImage(const QUrl &url); |
| 90 | |
| 91 | Q_INVOKABLE void setMetaData(QOrganizerCollection::MetaDataKey key, const QVariant &value); |
| 92 | Q_INVOKABLE QVariant metaData(QOrganizerCollection::MetaDataKey key) const; |
| 93 | |
| 94 | Q_INVOKABLE void setExtendedMetaData(const QString &key, const QVariant &value); |
| 95 | Q_INVOKABLE QVariant extendedMetaData(const QString &key) const; |
| 96 | |
| 97 | // used by model |
| 98 | QOrganizerCollection collection() const; |
| 99 | void setCollection(const QOrganizerCollection & collection); |
| 100 | |
| 101 | Q_SIGNALS: |
| 102 | void valueChanged(); |
| 103 | |
| 104 | private: |
| 105 | QOrganizerCollection d; |
| 106 | }; |
| 107 | |
| 108 | QT_END_NAMESPACE |
| 109 | |
| 110 | QML_DECLARE_TYPE(QDeclarativeOrganizerCollection) |
| 111 | |
| 112 | #endif // QDECLARATIVEORGANIZERCOLLECTION_H |
| 113 | |