diff --git a/src/common/davcollection.h b/src/common/davcollection.h --- a/src/common/davcollection.h +++ b/src/common/davcollection.h @@ -23,10 +23,9 @@ #include "enums.h" -#include - -#include +#include #include +#include class QColor; @@ -146,7 +145,7 @@ Q_REQUIRED_RESULT Privileges privileges() const; private: - std::unique_ptr d; + QSharedDataPointer d; }; } diff --git a/src/common/davcollection.cpp b/src/common/davcollection.cpp --- a/src/common/davcollection.cpp +++ b/src/common/davcollection.cpp @@ -24,58 +24,34 @@ using namespace KDAV; -class DavCollectionPrivate +class DavCollectionPrivate : public QSharedData { public: - void fillFrom(const DavCollectionPrivate &other); - + DavCollection::ContentTypes mContentTypes; QString mCTag; DavUrl mUrl; QString mDisplayName; QColor mColor; - DavCollection::ContentTypes mContentTypes; Privileges mPrivileges; }; -void DavCollectionPrivate::fillFrom(const DavCollectionPrivate &other) -{ - mCTag = other.mCTag; - mUrl = other.mUrl; - mDisplayName = other.mDisplayName; - mColor = other.mColor; - mContentTypes = other.mContentTypes; - mPrivileges = other.mPrivileges; -} - DavCollection::DavCollection() - : d(std::unique_ptr(new DavCollectionPrivate)) + : d(new DavCollectionPrivate) { } DavCollection::DavCollection(const DavUrl &url, const QString &displayName, ContentTypes contentTypes) - : d(std::unique_ptr(new DavCollectionPrivate)) + : d(new DavCollectionPrivate) { d->mUrl = url; d->mDisplayName = displayName; d->mContentTypes = contentTypes; d->mPrivileges = KDAV::All; } -DavCollection::DavCollection(const DavCollection &other) - : d(std::unique_ptr(new DavCollectionPrivate)) -{ - d->fillFrom(*other.d.get()); -} - -DavCollection &DavCollection::operator=(const DavCollection &other) -{ - d->fillFrom(*other.d.get()); - return *this; -} - -DavCollection::~DavCollection() -{ -} +DavCollection::DavCollection(const DavCollection &other) = default; +DavCollection &DavCollection::operator=(const DavCollection &other) = default; +DavCollection::~DavCollection() = default; void DavCollection::setCTag(const QString &ctag) { diff --git a/src/common/davitem.h b/src/common/davitem.h --- a/src/common/davitem.h +++ b/src/common/davitem.h @@ -21,10 +21,9 @@ #include "kpimkdav_export.h" -#include - #include #include +#include #include #include @@ -113,7 +112,7 @@ Q_REQUIRED_RESULT QString etag() const; private: - std::unique_ptr d; + QSharedDataPointer d; }; KPIMKDAV_EXPORT QDataStream &operator<<(QDataStream &out, const DavItem &item); diff --git a/src/common/davitem.cpp b/src/common/davitem.cpp --- a/src/common/davitem.cpp +++ b/src/common/davitem.cpp @@ -22,54 +22,32 @@ using namespace KDAV; -class DavItemPrivate +class DavItemPrivate : public QSharedData { public: - void fillFrom(const DavItemPrivate &other); - DavUrl mUrl; QString mContentType; QByteArray mData; QString mEtag; }; -void DavItemPrivate::fillFrom(const DavItemPrivate &other) -{ - mUrl = other.mUrl; - mContentType = other.mContentType; - mData = other.mData; - mEtag = other.mEtag; -} - DavItem::DavItem() - : d(std::unique_ptr(new DavItemPrivate)) + : d(new DavItemPrivate) { } DavItem::DavItem(const DavUrl &url, const QString &contentType, const QByteArray &data, const QString &etag) - : d(std::unique_ptr(new DavItemPrivate)) + : d(new DavItemPrivate) { d->mUrl = url; d->mContentType = contentType; d->mData = data; d->mEtag = etag; } -DavItem::DavItem(const DavItem &other) - : d(std::unique_ptr(new DavItemPrivate)) -{ - d->fillFrom(*other.d.get()); -} - -DavItem &DavItem::operator=(const DavItem &other) -{ - d->fillFrom(*other.d.get()); - return *this; -} - -DavItem::~DavItem() -{ -} +DavItem::DavItem(const DavItem &other) = default; +DavItem &DavItem::operator=(const DavItem &other) = default; +DavItem::~DavItem() = default; void DavItem::setUrl(const DavUrl &url) {