KContacts

resourcelocatorurl.h
1 /*
2  This file is part of the KContacts framework.
3  SPDX-FileCopyrightText: 2015-2019 Laurent Montel <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef RESOURCELOCATORURL_H
9 #define RESOURCELOCATORURL_H
10 
11 #include "kcontacts_export.h"
12 
13 #include <QMap>
14 #include <QMetaType>
15 #include <QSharedDataPointer>
16 #include <QString>
17 #include <QUrl>
18 
19 namespace KContacts {
20 
24 class KCONTACTS_EXPORT ResourceLocatorUrl
25 {
26  friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const ResourceLocatorUrl &);
27  friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, ResourceLocatorUrl &);
28 
29  Q_GADGET
30  Q_PROPERTY(QUrl url READ url WRITE setUrl)
31  Q_PROPERTY(bool isValid READ isValid)
32  Q_PROPERTY(Type type READ type WRITE setType)
33  Q_PROPERTY(bool isPreferred READ isPreferred WRITE setPreferred)
34 
35 public:
36 
39 
41 
43 
48  enum TypeFlag {
49  Unknown = 0,
50  Home = 1,
51  Work = 2,
52  Profile = 4,
53  Other = 8
54  };
55 
59  Q_DECLARE_FLAGS(Type, TypeFlag)
60  Q_FLAG(Type)
61 
62  Q_REQUIRED_RESULT bool isValid() const;
63 
64  void setUrl(const QUrl &url);
65  Q_REQUIRED_RESULT QUrl url() const;
66 
71  Type type() const;
76  void setType(Type type);
77 
82  bool isPreferred() const;
87  void setPreferred(bool preferred);
88 
89  void setParameters(const QMap<QString, QStringList> &params);
90  Q_REQUIRED_RESULT QMap<QString, QStringList> parameters() const;
91 
92  Q_REQUIRED_RESULT bool operator==(const ResourceLocatorUrl &other) const;
93  Q_REQUIRED_RESULT bool operator!=(const ResourceLocatorUrl &other) const;
94 
95  ResourceLocatorUrl &operator=(const ResourceLocatorUrl &other);
96 
97  Q_REQUIRED_RESULT QString toString() const;
98 private:
99  class Private;
100  QSharedDataPointer<Private> d;
101 };
102 
103 Q_DECLARE_OPERATORS_FOR_FLAGS(ResourceLocatorUrl::Type)
104 
105 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const ResourceLocatorUrl &object);
106 
107 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, ResourceLocatorUrl &object);
108 }
109 Q_DECLARE_METATYPE(KContacts::ResourceLocatorUrl)
110 Q_DECLARE_TYPEINFO(KContacts::ResourceLocatorUrl, Q_MOVABLE_TYPE);
111 
112 #endif // RESOURCELOCATORURL_H
Class that holds a Resource Locator.
QDataStream & operator>>(QDataStream &in, KDateTime::Spec &spec)
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Jul 4 2020 22:55:11 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.