File indexing completed on 2024-04-21 14:54:35

0001 /*
0002     This file is part of the KContacts framework.
0003     SPDX-FileCopyrightText: 2016-2019 Laurent Montel <montel@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef NOTE_H
0009 #define NOTE_H
0010 
0011 #include "kcontacts_export.h"
0012 
0013 #include <QMap>
0014 #include <QSharedDataPointer>
0015 #include <QString>
0016 
0017 namespace KContacts
0018 {
0019 class ParameterMap;
0020 
0021 /** @short Class that holds a Note for a contact.
0022  *  @since 5.3
0023  */
0024 class KCONTACTS_EXPORT Note
0025 {
0026     friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Note &);
0027     friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Note &);
0028     friend class VCardTool;
0029 
0030 public:
0031     Note();
0032     Note(const Note &other);
0033     Note(const QString &note);
0034 
0035     ~Note();
0036 
0037     typedef QVector<Note> List;
0038 
0039     void setNote(const QString &note);
0040     Q_REQUIRED_RESULT QString note() const;
0041 
0042     Q_REQUIRED_RESULT bool isValid() const;
0043 
0044 #if KCONTACTS_ENABLE_DEPRECATED_SINCE(5, 88)
0045     /**
0046      * @deprecated Since 5.88 for lack of usage
0047      */
0048     KCONTACTS_DEPRECATED_VERSION(5, 88, "For lack of usage.")
0049     void setParameters(const QMap<QString, QStringList> &params);
0050 #endif
0051 
0052 #if KCONTACTS_ENABLE_DEPRECATED_SINCE(5, 88)
0053     /**
0054      * @deprecated Since 5.88 for lack of usage
0055      */
0056     Q_REQUIRED_RESULT
0057     KCONTACTS_DEPRECATED_VERSION(5, 88, "For lack of usage.")
0058     QMap<QString, QStringList> parameters() const;
0059 #endif
0060 
0061     Q_REQUIRED_RESULT bool operator==(const Note &other) const;
0062     Q_REQUIRED_RESULT bool operator!=(const Note &other) const;
0063 
0064     Note &operator=(const Note &other);
0065 
0066     Q_REQUIRED_RESULT QString toString() const;
0067 
0068 private:
0069     KCONTACTS_NO_EXPORT void setParams(const ParameterMap &params);
0070     Q_REQUIRED_RESULT KCONTACTS_NO_EXPORT ParameterMap params() const;
0071 
0072     class Private;
0073     QSharedDataPointer<Private> d;
0074 };
0075 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const Note &object);
0076 
0077 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, Note &object);
0078 }
0079 Q_DECLARE_TYPEINFO(KContacts::Note, Q_MOVABLE_TYPE);
0080 #endif // NOTE_H