From c80e72da83978fa8d200e9ee34c4f4008062d2ba Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 21 Oct 2015 18:40:04 +0200 Subject: [PATCH] Sharing: change coding style of enum From all upper case to camel case This hopefully fix the Windows build which fails because DELETE seems to be a macro --- src/gui/ocssharejob.cpp | 2 +- src/gui/ocssharejob.h | 20 ++++++++++---------- src/gui/sharedialog.cpp | 10 +++++----- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/gui/ocssharejob.cpp b/src/gui/ocssharejob.cpp index dea9b530c..ea0529bd2 100644 --- a/src/gui/ocssharejob.cpp +++ b/src/gui/ocssharejob.cpp @@ -79,7 +79,7 @@ void OcsShareJob::setPublicUpload(int shareId, bool publicUpload) start(); } -void OcsShareJob::createShare(const QString &path, SHARETYPE shareType, const QString &password, const QDate &date) +void OcsShareJob::createShare(const QString &path, ShareType shareType, const QString &password, const QDate &date) { setVerb("POST"); diff --git a/src/gui/ocssharejob.h b/src/gui/ocssharejob.h index 1f16bf251..87043c08e 100644 --- a/src/gui/ocssharejob.h +++ b/src/gui/ocssharejob.h @@ -35,20 +35,20 @@ public: /** * Support sharetypes */ - enum class SHARETYPE : int { - LINK = 3 + enum class ShareType : int { + Link = 3 }; /** * Possible permissions */ - enum class PERMISSION : int { - READ = 1, - UPDATE = 2, - CREATE = 4, - DELETE = 8, - SHARE = 16, - ALL = 31 + enum class Permission : int { + Read = 1, + Update = 2, + Create = 4, + Delete = 8, + Share = 16, + All = 31 }; /** @@ -99,7 +99,7 @@ public: * @param password Optionally a password for the share * @param date Optionally an expire date for the share */ - void createShare(const QString& path, SHARETYPE shareType, const QString& password = "", const QDate& date = QDate()); + void createShare(const QString& path, ShareType shareType, const QString& password = "", const QDate& date = QDate()); }; } diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp index 8c8dd57f4..e59888e8e 100644 --- a/src/gui/sharedialog.cpp +++ b/src/gui/sharedialog.cpp @@ -248,7 +248,7 @@ void ShareDialog::setPassword(const QString &password) date = _ui->calendar->date(); } - job->createShare(_sharePath, OcsShareJob::SHARETYPE::LINK, password, date); + job->createShare(_sharePath, OcsShareJob::ShareType::Link, password, date); } _passwordJobRunning = true; } @@ -304,7 +304,7 @@ void ShareDialog::slotSharesFetched(const QVariantMap &reply) Q_FOREACH(auto share, ShareDialog::_shares) { QVariantMap data = share.toMap(); - if (data.value("share_type").toInt() == static_cast(OcsShareJob::SHARETYPE::LINK)) { + if (data.value("share_type").toInt() == static_cast(OcsShareJob::ShareType::Link)) { _public_share_id = data.value("id").toULongLong(); _ui->pushButton_copy->show(); @@ -340,8 +340,8 @@ void ShareDialog::slotSharesFetched(const QVariantMap &reply) * For public links the server sets CREATE and UPDATE permissions. */ if (!_isFile && - (permissions & static_cast(OcsShareJob::PERMISSION::UPDATE)) && - (permissions & static_cast(OcsShareJob::PERMISSION::CREATE))) { + (permissions & static_cast(OcsShareJob::Permission::Update)) && + (permissions & static_cast(OcsShareJob::Permission::Create))) { _ui->checkBox_editing->setChecked(true); } } @@ -468,7 +468,7 @@ void ShareDialog::slotCheckBoxShareLinkClicked() OcsShareJob *job = new OcsShareJob(_account, this); connect(job, SIGNAL(jobFinished(QVariantMap)), this, SLOT(slotCreateShareFetched(QVariantMap))); - job->createShare(_sharePath, OcsShareJob::SHARETYPE::LINK); + job->createShare(_sharePath, OcsShareJob::ShareType::Link); } else { _pi_link->startAnimation(); OcsShareJob *job = new OcsShareJob(_account, this); -- 2.30.2