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 QtContacts 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 QDECLARATIVECONTACTRINGTONE_H
35#define QDECLARATIVECONTACTRINGTONE_H
36
37#include <QtContacts/qcontactringtone.h>
38
39#include "qdeclarativecontactdetail_p.h"
40
41QTCONTACTS_USE_NAMESPACE
42
43QT_BEGIN_NAMESPACE
44
45class QDeclarativeContactRingtone : public QDeclarativeContactDetail
46{
47 Q_OBJECT
48
49 Q_PROPERTY(QUrl audioRingtoneUrl READ audioRingtoneUrl WRITE setAudioRingtoneUrl NOTIFY valueChanged)
50 Q_PROPERTY(QUrl videoRingtoneUrl READ videoRingtoneUrl WRITE setVideoRingtoneUrl NOTIFY valueChanged)
51 Q_PROPERTY(QUrl vibrationRingtoneUrl READ vibrationRingtoneUrl WRITE setVibrationRingtoneUrl NOTIFY valueChanged)
52 Q_ENUMS(FieldType)
53 Q_CLASSINFO("DefaultProperty", "audioRingtoneUrl")
54public:
55 enum FieldType {
56 AudioRingtoneUrl = QContactRingtone::FieldAudioRingtoneUrl,
57 VideoRingtoneUrl = QContactRingtone::FieldVideoRingtoneUrl,
58 VibrationRingtoneUrl = QContactRingtone::FieldVibrationRingtoneUrl
59 };
60
61 QDeclarativeContactRingtone(QObject* parent = Q_NULLPTR)
62 :QDeclarativeContactDetail(parent)
63 {
64 setDetail(QContactRingtone());
65 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
66 }
67 DetailType detailType() const
68 {
69 return QDeclarativeContactDetail::Ringtone;
70 }
71
72 void setAudioRingtoneUrl(const QUrl& v)
73 {
74 if (!readOnly() && v != audioRingtoneUrl()) {
75 detail().setValue(field: QContactRingtone::FieldAudioRingtoneUrl, value: v);
76 emit valueChanged();
77 }
78 }
79 QUrl audioRingtoneUrl() const {return detail().value<QUrl>(field: QContactRingtone::FieldAudioRingtoneUrl);}
80
81 void setVideoRingtoneUrl(const QUrl& v)
82 {
83 if (!readOnly() && v != videoRingtoneUrl()) {
84 detail().setValue(field: QContactRingtone::FieldVideoRingtoneUrl, value: v);
85 emit valueChanged();
86 }
87 }
88 QUrl videoRingtoneUrl() const {return detail().value<QUrl>(field: QContactRingtone::FieldVideoRingtoneUrl);}
89
90 void setVibrationRingtoneUrl(const QUrl& v)
91 {
92 if (!readOnly() && v != vibrationRingtoneUrl()) {
93 detail().setValue(field: QContactRingtone::FieldVibrationRingtoneUrl, value: v);
94 emit valueChanged();
95 }
96 }
97 QUrl vibrationRingtoneUrl() const {return detail().value<QUrl>(field: QContactRingtone::FieldVibrationRingtoneUrl);}
98signals:
99 void valueChanged();
100
101};
102
103QT_END_NAMESPACE
104
105QML_DECLARE_TYPE(QDeclarativeContactRingtone)
106
107#endif // QDECLARATIVECONTACTRINGTONE_H
108

source code of qtpim/src/imports/contacts/details/qdeclarativecontactringtone_p.h