add [[nodiscard]] attribute via clang-tidy

ran
run-clang-tidy-14.py -header-filter='.*' -checks='-*,modernize-use-nodiscard' -fix
under linux with most part of our code covered

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Matthieu Gallien 2022-09-30 19:12:08 +02:00 committed by Matthieu Gallien
parent 5fc017575b
commit 565a5f0999
127 changed files with 682 additions and 682 deletions

View file

@ -30,25 +30,25 @@ class OWNCLOUDDOLPHINPLUGINHELPER_EXPORT OwncloudDolphinPluginHelper : public QO
public: public:
static OwncloudDolphinPluginHelper *instance(); static OwncloudDolphinPluginHelper *instance();
bool isConnected() const; [[nodiscard]] bool isConnected() const;
void sendCommand(const char *data); void sendCommand(const char *data);
QVector<QString> paths() const { return _paths; } [[nodiscard]] QVector<QString> paths() const { return _paths; }
QString contextMenuTitle() const [[nodiscard]] QString contextMenuTitle() const
{ {
return _strings.value("CONTEXT_MENU_TITLE", APPLICATION_NAME); return _strings.value("CONTEXT_MENU_TITLE", APPLICATION_NAME);
} }
QString shareActionTitle() const [[nodiscard]] QString shareActionTitle() const
{ {
return _strings.value("SHARE_MENU_TITLE", "Share …"); return _strings.value("SHARE_MENU_TITLE", "Share …");
} }
QString contextMenuIconName() const [[nodiscard]] QString contextMenuIconName() const
{ {
return _strings.value("CONTEXT_MENU_ICON", APPLICATION_ICON_NAME); return _strings.value("CONTEXT_MENU_ICON", APPLICATION_ICON_NAME);
} }
QString copyPrivateLinkTitle() const { return _strings["COPY_PRIVATE_LINK_MENU_TITLE"]; } [[nodiscard]] QString copyPrivateLinkTitle() const { return _strings["COPY_PRIVATE_LINK_MENU_TITLE"]; }
QString emailPrivateLinkTitle() const { return _strings["EMAIL_PRIVATE_LINK_MENU_TITLE"]; } [[nodiscard]] QString emailPrivateLinkTitle() const { return _strings["EMAIL_PRIVATE_LINK_MENU_TITLE"]; }
QByteArray version() { return _version; } QByteArray version() { return _version; }

View file

@ -48,27 +48,27 @@ public:
\return The number of milliseconds between animation steps. By default, the animation delay is set to 40 milliseconds. \return The number of milliseconds between animation steps. By default, the animation delay is set to 40 milliseconds.
\sa setAnimationDelay \sa setAnimationDelay
*/ */
int animationDelay() const { return m_delay; } [[nodiscard]] int animationDelay() const { return m_delay; }
/*! Returns a Boolean value indicating whether the component is currently animated. /*! Returns a Boolean value indicating whether the component is currently animated.
\return Animation state. \return Animation state.
\sa startAnimation stopAnimation \sa startAnimation stopAnimation
*/ */
bool isAnimated () const; [[nodiscard]] bool isAnimated () const;
/*! Returns a Boolean value indicating whether the receiver shows itself even when it is not animating. /*! Returns a Boolean value indicating whether the receiver shows itself even when it is not animating.
\return Return true if the progress indicator shows itself even when it is not animating. By default, it returns false. \return Return true if the progress indicator shows itself even when it is not animating. By default, it returns false.
\sa setDisplayedWhenStopped \sa setDisplayedWhenStopped
*/ */
bool isDisplayedWhenStopped() const; [[nodiscard]] bool isDisplayedWhenStopped() const;
/*! Returns the color of the component. /*! Returns the color of the component.
\sa setColor \sa setColor
*/ */
const QColor & color() const { return m_color; } [[nodiscard]] const QColor & color() const { return m_color; }
QSize sizeHint() const override; [[nodiscard]] QSize sizeHint() const override;
int heightForWidth(int w) const override; [[nodiscard]] int heightForWidth(int w) const override;
public slots: public slots:
/*! Starts the spin animation. /*! Starts the spin animation.
\sa stopAnimation isAnimated \sa stopAnimation isAnimated

View file

@ -111,13 +111,13 @@ public:
void initializeFromEvent(QWheelEvent *event); void initializeFromEvent(QWheelEvent *event);
qreal x() const; [[nodiscard]] qreal x() const;
qreal y() const; [[nodiscard]] qreal y() const;
QPointF angleDelta() const; [[nodiscard]] QPointF angleDelta() const;
QPointF pixelDelta() const; [[nodiscard]] QPointF pixelDelta() const;
int buttons() const; [[nodiscard]] int buttons() const;
int modifiers() const; [[nodiscard]] int modifiers() const;
bool inverted() const; [[nodiscard]] bool inverted() const;
bool isAccepted(); bool isAccepted();
void setAccepted(bool accepted); void setAccepted(bool accepted);
@ -192,7 +192,7 @@ public:
explicit WheelHandler(QObject *parent = nullptr); explicit WheelHandler(QObject *parent = nullptr);
~WheelHandler() override; ~WheelHandler() override;
QQuickItem *target() const; [[nodiscard]] QQuickItem *target() const;
void setTarget(QQuickItem *target); void setTarget(QQuickItem *target);
Q_SIGNALS: Q_SIGNALS:

View file

@ -61,7 +61,7 @@ public:
void slotTimeLineChanged(qreal); void slotTimeLineChanged(qreal);
void slotTimeLineFinished(); void slotTimeLineFinished();
int bestContentHeight() const; [[nodiscard]] int bestContentHeight() const;
}; };
void KMessageWidgetPrivate::init(KMessageWidget *q_ptr) void KMessageWidgetPrivate::init(KMessageWidget *q_ptr)

View file

@ -138,7 +138,7 @@ public:
* Get the text of this message widget. * Get the text of this message widget.
* @see setText() * @see setText()
*/ */
QString text() const; [[nodiscard]] QString text() const;
/** /**
* Check whether word wrap is enabled. * Check whether word wrap is enabled.
@ -149,14 +149,14 @@ public:
* *
* @see setWordWrap() * @see setWordWrap()
*/ */
bool wordWrap() const; [[nodiscard]] bool wordWrap() const;
/** /**
* Check whether the close button is visible. * Check whether the close button is visible.
* *
* @see setCloseButtonVisible() * @see setCloseButtonVisible()
*/ */
bool isCloseButtonVisible() const; [[nodiscard]] bool isCloseButtonVisible() const;
/** /**
* Get the type of this message. * Get the type of this message.
@ -164,7 +164,7 @@ public:
* *
* @see KMessageWidget::MessageType, setMessageType() * @see KMessageWidget::MessageType, setMessageType()
*/ */
MessageType messageType() const; [[nodiscard]] MessageType messageType() const;
/** /**
* Add @p action to the message widget. * Add @p action to the message widget.
@ -187,24 +187,24 @@ public:
/** /**
* Returns the preferred size of the message widget. * Returns the preferred size of the message widget.
*/ */
QSize sizeHint() const override; [[nodiscard]] QSize sizeHint() const override;
/** /**
* Returns the minimum size of the message widget. * Returns the minimum size of the message widget.
*/ */
QSize minimumSizeHint() const override; [[nodiscard]] QSize minimumSizeHint() const override;
/** /**
* Returns the required height for @p width. * Returns the required height for @p width.
* @param width the width in pixels * @param width the width in pixels
*/ */
int heightForWidth(int width) const override; [[nodiscard]] int heightForWidth(int width) const override;
/** /**
* The icon shown on the left of the text. By default, no icon is shown. * The icon shown on the left of the text. By default, no icon is shown.
* @since 4.11 * @since 4.11
*/ */
QIcon icon() const; [[nodiscard]] QIcon icon() const;
/** /**
* Check whether the hide animation started by calling animatedHide() * Check whether the hide animation started by calling animatedHide()
@ -214,7 +214,7 @@ public:
* @see animatedHide(), hideAnimationFinished() * @see animatedHide(), hideAnimationFinished()
* @since 5.0 * @since 5.0
*/ */
bool isHideAnimationRunning() const; [[nodiscard]] bool isHideAnimationRunning() const;
/** /**
* Check whether the show animation started by calling animatedShow() * Check whether the show animation started by calling animatedShow()
@ -224,7 +224,7 @@ public:
* @see animatedShow(), showAnimationFinished() * @see animatedShow(), showAnimationFinished()
* @since 5.0 * @since 5.0
*/ */
bool isShowAnimationRunning() const; [[nodiscard]] bool isShowAnimationRunning() const;
public Q_SLOTS: public Q_SLOTS:
/** /**

View file

@ -61,8 +61,8 @@ public:
bool lock(LockMode mode, bool block = true); bool lock(LockMode mode, bool block = true);
bool unlock(); bool unlock();
bool isLocked() const; [[nodiscard]] bool isLocked() const;
LockMode lockMode() const; [[nodiscard]] LockMode lockMode() const;
private: private:
#ifdef Q_OS_WIN #ifdef Q_OS_WIN

View file

@ -71,11 +71,11 @@ struct QTokenizerPrivate {
{ {
} }
bool isDelimiter(char_type c) const { [[nodiscard]] bool isDelimiter(char_type c) const {
return delimiters.contains(c); return delimiters.contains(c);
} }
bool isQuote(char_type c) const { [[nodiscard]] bool isQuote(char_type c) const {
return quotes.contains(c); return quotes.contains(c);
} }
@ -212,14 +212,14 @@ public:
Returns true if the current token is a delimiter, Returns true if the current token is a delimiter,
if one more more delimiting characters have been set. if one more more delimiting characters have been set.
*/ */
bool isDelimiter() const { return d->isDelim; } [[nodiscard]] bool isDelimiter() const { return d->isDelim; }
/*! /*!
Returns the current token. Returns the current token.
Use \c hasNext() to fetch the next token. Use \c hasNext() to fetch the next token.
*/ */
T next() const { [[nodiscard]] T next() const {
int len = std::distance(d->tokenBegin, d->tokenEnd); int len = std::distance(d->tokenBegin, d->tokenEnd);
const_iterator tmpStart = d->tokenBegin; const_iterator tmpStart = d->tokenBegin;
if (!d->returnQuotes && len > 1 && d->isQuote(*d->tokenBegin)) { if (!d->returnQuotes && len > 1 && d->isQuote(*d->tokenBegin)) {

View file

@ -43,7 +43,7 @@ public:
explicit QtLocalPeer(QObject *parent = nullptr, const QString &appId = QString()); explicit QtLocalPeer(QObject *parent = nullptr, const QString &appId = QString());
bool isClient(); bool isClient();
bool sendMessage(const QString &message, int timeout, bool block); bool sendMessage(const QString &message, int timeout, bool block);
QString applicationId() const [[nodiscard]] QString applicationId() const
{ return id; } { return id; }
static QString appSessionId(const QString &appId); static QString appSessionId(const QString &appId);

View file

@ -49,9 +49,9 @@ public:
bool isRunning(qint64 pid = -1); bool isRunning(qint64 pid = -1);
void setActivationWindow(QWidget* aw, bool activateOnMessage = true); void setActivationWindow(QWidget* aw, bool activateOnMessage = true);
QWidget* activationWindow() const; [[nodiscard]] QWidget* activationWindow() const;
QString applicationId() const; [[nodiscard]] QString applicationId() const;
void setBlock(bool value); void setBlock(bool value);
public Q_SLOTS: public Q_SLOTS:

View file

@ -42,7 +42,7 @@ public:
QtSingleCoreApplication(const QString &id, int &argc, char **argv); QtSingleCoreApplication(const QString &id, int &argc, char **argv);
bool isRunning(); bool isRunning();
QString id() const; [[nodiscard]] QString id() const;
void setBlock(bool value); void setBlock(bool value);
public Q_SLOTS: public Q_SLOTS:

View file

@ -169,8 +169,8 @@ public:
*/ */
void start(std::unique_ptr<QIODevice> device, const QByteArray &checksumHeader); void start(std::unique_ptr<QIODevice> device, const QByteArray &checksumHeader);
QByteArray calculatedChecksumType() const; [[nodiscard]] QByteArray calculatedChecksumType() const;
QByteArray calculatedChecksum() const; [[nodiscard]] QByteArray calculatedChecksum() const;
signals: signals:
void validated(const QByteArray &checksumType, const QByteArray &checksum); void validated(const QByteArray &checksumType, const QByteArray &checksum);

View file

@ -50,7 +50,7 @@ public:
bool transaction(); bool transaction();
bool commit(); bool commit();
void close(); void close();
QString error() const; [[nodiscard]] QString error() const;
sqlite3 *sqliteDb(); sqlite3 *sqliteDb();
private: private:
@ -111,8 +111,8 @@ public:
int prepare(const QByteArray &sql, bool allow_failure = false); int prepare(const QByteArray &sql, bool allow_failure = false);
~SqlQuery(); ~SqlQuery();
QString error() const; [[nodiscard]] QString error() const;
int errorId() const; [[nodiscard]] int errorId() const;
/// Checks whether the value at the given column index is NULL /// Checks whether the value at the given column index is NULL
bool nullValue(int index); bool nullValue(int index);
@ -152,7 +152,7 @@ public:
bindValueInternal(pos, value); bindValueInternal(pos, value);
} }
const QByteArray &lastQuery() const; [[nodiscard]] const QByteArray &lastQuery() const;
int numRowsAffected(); int numRowsAffected();
void reset_and_clear_bindings(); void reset_and_clear_bindings();

View file

@ -63,10 +63,10 @@ public:
RemotePermissions() = default; RemotePermissions() = default;
/// array with one character per permission, "" is null, " " is non-null but empty /// array with one character per permission, "" is null, " " is non-null but empty
QByteArray toDbValue() const; [[nodiscard]] QByteArray toDbValue() const;
/// output for display purposes, no defined format (same as toDbValue in practice) /// output for display purposes, no defined format (same as toDbValue in practice)
QString toString() const; [[nodiscard]] QString toString() const;
/// read value that was written with toDbValue() /// read value that was written with toDbValue()
static RemotePermissions fromDbValue(const QByteArray &); static RemotePermissions fromDbValue(const QByteArray &);
@ -74,7 +74,7 @@ public:
/// read a permissions string received from the server, never null /// read a permissions string received from the server, never null
static RemotePermissions fromServerString(const QString &); static RemotePermissions fromServerString(const QString &);
bool hasPermission(Permissions p) const [[nodiscard]] bool hasPermission(Permissions p) const
{ {
return _value & (1 << static_cast<int>(p)); return _value & (1 << static_cast<int>(p));
} }
@ -87,7 +87,7 @@ public:
_value &= ~(1 << static_cast<int>(p)); _value &= ~(1 << static_cast<int>(p));
} }
bool isNull() const { return !(_value & notNullMask); } [[nodiscard]] bool isNull() const { return !(_value & notNullMask); }
friend bool operator==(RemotePermissions a, RemotePermissions b) friend bool operator==(RemotePermissions a, RemotePermissions b)
{ {
return a._value == b._value; return a._value == b._value;

View file

@ -117,13 +117,13 @@ public:
return &_result; return &_result;
} }
const T &get() const [[nodiscard]] const T &get() const
{ {
ASSERT(!_isError) ASSERT(!_isError)
return _result; return _result;
} }
const Error &error() const & [[nodiscard]] const Error &error() const &
{ {
ASSERT(_isError); ASSERT(_isError);
return _error; return _error;
@ -134,7 +134,7 @@ public:
return std::move(_error); return std::move(_error);
} }
bool isValid() const { return !_isError; } [[nodiscard]] bool isValid() const { return !_isError; }
}; };
namespace detail { namespace detail {

View file

@ -43,12 +43,12 @@ public:
SyncFileStatus(SyncFileStatusTag); SyncFileStatus(SyncFileStatusTag);
void set(SyncFileStatusTag tag); void set(SyncFileStatusTag tag);
SyncFileStatusTag tag() const; [[nodiscard]] SyncFileStatusTag tag() const;
void setShared(bool isShared); void setShared(bool isShared);
bool shared() const; [[nodiscard]] bool shared() const;
QString toSocketAPIString() const; [[nodiscard]] QString toSocketAPIString() const;
private: private:
SyncFileStatusTag _tag = StatusNone; SyncFileStatusTag _tag = StatusNone;

View file

@ -93,7 +93,7 @@ public:
bool exists(); bool exists();
void walCheckpoint(); void walCheckpoint();
QString databaseFilePath() const; [[nodiscard]] QString databaseFilePath() const;
static qint64 getPHash(const QByteArray &); static qint64 getPHash(const QByteArray &);
@ -124,7 +124,7 @@ public:
* (As opposed to a small file transfer which is stored in the db so we can detect the case * (As opposed to a small file transfer which is stored in the db so we can detect the case
* when the upload succeeded, but the connection was dropped before we got the answer) * when the upload succeeded, but the connection was dropped before we got the answer)
*/ */
bool isChunked() const { return _transferid != 0; } [[nodiscard]] bool isChunked() const { return _transferid != 0; }
}; };
struct PollInfo struct PollInfo

View file

@ -48,7 +48,7 @@ struct SyncJournalFileLockInfo {
class OCSYNC_EXPORT SyncJournalFileRecord class OCSYNC_EXPORT SyncJournalFileRecord
{ {
public: public:
bool isValid() const [[nodiscard]] bool isValid() const
{ {
return !_path.isEmpty(); return !_path.isEmpty();
} }
@ -59,14 +59,14 @@ public:
* *
* It is used in the construction of private links. * It is used in the construction of private links.
*/ */
QByteArray numericFileId() const; [[nodiscard]] QByteArray numericFileId() const;
QDateTime modDateTime() const { return Utility::qDateTimeFromTime_t(_modtime); } [[nodiscard]] QDateTime modDateTime() const { return Utility::qDateTimeFromTime_t(_modtime); }
bool isDirectory() const { return _type == ItemTypeDirectory; } [[nodiscard]] bool isDirectory() const { return _type == ItemTypeDirectory; }
bool isFile() const { return _type == ItemTypeFile || _type == ItemTypeVirtualFileDehydration; } [[nodiscard]] bool isFile() const { return _type == ItemTypeFile || _type == ItemTypeVirtualFileDehydration; }
bool isVirtualFile() const { return _type == ItemTypeVirtualFile || _type == ItemTypeVirtualFileDownload; } [[nodiscard]] bool isVirtualFile() const { return _type == ItemTypeVirtualFile || _type == ItemTypeVirtualFileDownload; }
QString path() const { return QString::fromUtf8(_path); } [[nodiscard]] QString path() const { return QString::fromUtf8(_path); }
QString e2eMangledName() const { return QString::fromUtf8(_e2eMangledName); } [[nodiscard]] QString e2eMangledName() const { return QString::fromUtf8(_e2eMangledName); }
QByteArray _path; QByteArray _path;
quint64 _inode = 0; quint64 _inode = 0;
@ -120,7 +120,7 @@ public:
/// The last X-Request-ID of the request that failled /// The last X-Request-ID of the request that failled
QByteArray _requestId; QByteArray _requestId;
bool isValid() const; [[nodiscard]] bool isValid() const;
}; };
/** Represents a conflict in the conflicts table. /** Represents a conflict in the conflicts table.
@ -165,7 +165,7 @@ public:
QByteArray initialBasePath; QByteArray initialBasePath;
bool isValid() const { return !path.isEmpty(); } [[nodiscard]] bool isValid() const { return !path.isEmpty(); }
}; };
} }

View file

@ -321,7 +321,7 @@ namespace {
const char *name; const char *name;
quint64 msec; quint64 msec;
QString description(quint64 value) const [[nodiscard]] QString description(quint64 value) const
{ {
return QCoreApplication::translate("Utility", name, nullptr, value); return QCoreApplication::translate("Utility", name, nullptr, value);
} }

View file

@ -185,9 +185,9 @@ namespace Utility {
void reset(); void reset();
// out helpers, return the measured times. // out helpers, return the measured times.
QDateTime startTime() const; [[nodiscard]] QDateTime startTime() const;
QDateTime timeOfLap(const QString &lapName) const; [[nodiscard]] QDateTime timeOfLap(const QString &lapName) const;
quint64 durationOfLap(const QString &lapName) const; [[nodiscard]] quint64 durationOfLap(const QString &lapName) const;
}; };
/** /**

View file

@ -131,13 +131,13 @@ public:
explicit Vfs(QObject* parent = nullptr); explicit Vfs(QObject* parent = nullptr);
~Vfs() override; ~Vfs() override;
virtual Mode mode() const = 0; [[nodiscard]] virtual Mode mode() const = 0;
/// For WithSuffix modes: the suffix (including the dot) /// For WithSuffix modes: the suffix (including the dot)
virtual QString fileSuffix() const = 0; [[nodiscard]] virtual QString fileSuffix() const = 0;
/// Access to the parameters the instance was start()ed with. /// Access to the parameters the instance was start()ed with.
const VfsSetupParams &params() const { return _setupParams; } [[nodiscard]] const VfsSetupParams &params() const { return _setupParams; }
/** Initializes interaction with the VFS provider. /** Initializes interaction with the VFS provider.
@ -158,13 +158,13 @@ public:
* Some plugins might provide alternate shell integration, making the normal * Some plugins might provide alternate shell integration, making the normal
* context menu actions redundant. * context menu actions redundant.
*/ */
virtual bool socketApiPinStateActionsShown() const = 0; [[nodiscard]] virtual bool socketApiPinStateActionsShown() const = 0;
/** Return true when download of a file's data is currently ongoing. /** Return true when download of a file's data is currently ongoing.
* *
* See also the beginHydrating() and doneHydrating() signals. * See also the beginHydrating() and doneHydrating() signals.
*/ */
virtual bool isHydrating() const = 0; [[nodiscard]] virtual bool isHydrating() const = 0;
/** Update placeholder metadata during discovery. /** Update placeholder metadata during discovery.
* *
@ -296,15 +296,15 @@ public:
VfsOff(QObject* parent = nullptr); VfsOff(QObject* parent = nullptr);
~VfsOff() override; ~VfsOff() override;
Mode mode() const override { return Vfs::Off; } [[nodiscard]] Mode mode() const override { return Vfs::Off; }
QString fileSuffix() const override { return QString(); } [[nodiscard]] QString fileSuffix() const override { return QString(); }
void stop() override {} void stop() override {}
void unregisterFolder() override {} void unregisterFolder() override {}
bool socketApiPinStateActionsShown() const override { return false; } [[nodiscard]] bool socketApiPinStateActionsShown() const override { return false; }
bool isHydrating() const override { return false; } [[nodiscard]] bool isHydrating() const override { return false; }
Result<void, QString> updateMetadata(const QString &, time_t, qint64, const QByteArray &) override { return {}; } Result<void, QString> updateMetadata(const QString &, time_t, qint64, const QByteArray &) override { return {}; }
Result<void, QString> createPlaceholder(const SyncFileItem &) override { return {}; } Result<void, QString> createPlaceholder(const SyncFileItem &) override { return {}; }

View file

@ -94,7 +94,7 @@ public:
* @param filePath the absolute path to the file * @param filePath the absolute path to the file
* @param basePath folder path from which to apply exclude rules, ends with a / * @param basePath folder path from which to apply exclude rules, ends with a /
*/ */
bool isExcluded( [[nodiscard]] bool isExcluded(
const QString &filePath, const QString &filePath,
const QString &basePath, const QString &basePath,
bool excludeHidden) const; bool excludeHidden) const;
@ -168,7 +168,7 @@ private:
* *
* Would enable the "myexclude" pattern only for versions before 2.5.0. * Would enable the "myexclude" pattern only for versions before 2.5.0.
*/ */
bool versionDirectiveKeepNextLine(const QByteArray &directive) const; [[nodiscard]] bool versionDirectiveKeepNextLine(const QByteArray &directive) const;
/** /**
* @brief Match the exclude pattern against the full path. * @brief Match the exclude pattern against the full path.
@ -178,7 +178,7 @@ private:
* Note that this only matches patterns. It does not check whether the file * Note that this only matches patterns. It does not check whether the file
* or directory pointed to is hidden (or whether it even exists). * or directory pointed to is hidden (or whether it even exists).
*/ */
CSYNC_EXCLUDE_TYPE fullPatternMatch(const QString &path, ItemType filetype) const; [[nodiscard]] CSYNC_EXCLUDE_TYPE fullPatternMatch(const QString &path, ItemType filetype) const;
// Our BasePath need to end with '/' // Our BasePath need to end with '/'
class BasePathString : public QString class BasePathString : public QString

View file

@ -58,7 +58,7 @@ public:
* Return a list of all accounts. * Return a list of all accounts.
* (this is a list of QSharedPointer for internal reasons, one should normally not keep a copy of them) * (this is a list of QSharedPointer for internal reasons, one should normally not keep a copy of them)
*/ */
QList<AccountStatePtr> accounts() const; [[nodiscard]] QList<AccountStatePtr> accounts() const;
/** /**
* Return the account state pointer for an account identified by its display name * Return the account state pointer for an account identified by its display name
@ -89,8 +89,8 @@ private:
bool restoreFromLegacySettings(); bool restoreFromLegacySettings();
bool isAccountIdAvailable(const QString &id) const; [[nodiscard]] bool isAccountIdAvailable(const QString &id) const;
QString generateFreeAccountId() const; [[nodiscard]] QString generateFreeAccountId() const;
// Adds an account to the tracked list, emitting accountAdded() // Adds an account to the tracked list, emitting accountAdded()
void addAccountState(AccountState *accountState); void addAccountState(AccountState *accountState);

View file

@ -56,7 +56,7 @@ class AccountSettings : public QWidget
public: public:
explicit AccountSettings(AccountState *accountState, QWidget *parent = nullptr); explicit AccountSettings(AccountState *accountState, QWidget *parent = nullptr);
~AccountSettings() override; ~AccountSettings() override;
QSize sizeHint() const override { return ownCloudGui::settingsDialogSize(); } [[nodiscard]] QSize sizeHint() const override { return ownCloudGui::settingsDialogSize(); }
bool canEncryptOrDecrypt(const FolderStatusModel::SubFolderInfo* folderInfo); bool canEncryptOrDecrypt(const FolderStatusModel::SubFolderInfo* folderInfo);
signals: signals:
@ -120,7 +120,7 @@ private:
void customizeStyle(); void customizeStyle();
/// Returns the alias of the selected folder, empty string if none /// Returns the alias of the selected folder, empty string if none
QString selectedFolderAlias() const; [[nodiscard]] QString selectedFolderAlias() const;
Ui::AccountSettings *_ui; Ui::AccountSettings *_ui;

View file

@ -271,10 +271,10 @@ public:
const QString &id, const QUrl &iconUrl, const QString &id, const QUrl &iconUrl,
QObject* parent = nullptr); QObject* parent = nullptr);
QString name() const; [[nodiscard]] QString name() const;
QUrl url() const; [[nodiscard]] QUrl url() const;
QString id() const; [[nodiscard]] QString id() const;
QUrl iconUrl() const; [[nodiscard]] QUrl iconUrl() const;
private: private:
QString _name; QString _name;

View file

@ -64,13 +64,13 @@ public:
void showHelp(); void showHelp();
void showHint(std::string errorHint); void showHint(std::string errorHint);
bool debugMode(); bool debugMode();
bool backgroundMode() const; [[nodiscard]] bool backgroundMode() const;
bool versionOnly(); // only display the version? bool versionOnly(); // only display the version?
void showVersion(); void showVersion();
void showMainDialog(); void showMainDialog();
ownCloudGui *gui() const; [[nodiscard]] ownCloudGui *gui() const;
bool event(QEvent *event) override; bool event(QEvent *event) override;

View file

@ -31,8 +31,8 @@ class AuthenticationDialog : public QDialog
public: public:
AuthenticationDialog(const QString &realm, const QString &domain, QWidget *parent = nullptr); AuthenticationDialog(const QString &realm, const QString &domain, QWidget *parent = nullptr);
QString user() const; [[nodiscard]] QString user() const;
QString password() const; [[nodiscard]] QString password() const;
private: private:
QLineEdit *_user; QLineEdit *_user;

View file

@ -32,9 +32,9 @@ class CallStateChecker : public QObject
public: public:
explicit CallStateChecker(QObject *parent = nullptr); explicit CallStateChecker(QObject *parent = nullptr);
QString token() const; [[nodiscard]] QString token() const;
AccountState* accountState() const; [[nodiscard]] AccountState* accountState() const;
bool checking() const; [[nodiscard]] bool checking() const;
signals: signals:
void tokenChanged(); void tokenChanged();
@ -57,7 +57,7 @@ private slots:
private: private:
void setup(); void setup();
void startCallStateCheck(); void startCallStateCheck();
bool isAccountServerVersion22OrLater() const; [[nodiscard]] bool isAccountServerVersion22OrLater() const;
AccountState *_accountState = nullptr; AccountState *_accountState = nullptr;
QString _token; QString _token;

View file

@ -32,9 +32,9 @@ public:
explicit ConflictDialog(QWidget *parent = nullptr); explicit ConflictDialog(QWidget *parent = nullptr);
~ConflictDialog() override; ~ConflictDialog() override;
QString baseFilename() const; [[nodiscard]] QString baseFilename() const;
QString localVersionFilename() const; [[nodiscard]] QString localVersionFilename() const;
QString remoteVersionFilename() const; [[nodiscard]] QString remoteVersionFilename() const;
public slots: public slots:
void setBaseFilename(const QString &baseFilename); void setBaseFilename(const QString &baseFilename);

View file

@ -35,8 +35,8 @@ public:
explicit ConflictSolver(QWidget *parent = nullptr); explicit ConflictSolver(QWidget *parent = nullptr);
QString localVersionFilename() const; [[nodiscard]] QString localVersionFilename() const;
QString remoteVersionFilename() const; [[nodiscard]] QString remoteVersionFilename() const;
bool exec(Solution solution); bool exec(Solution solution);

View file

@ -51,7 +51,7 @@ public:
void start(); void start();
void openBrowser(); void openBrowser();
void copyLinkToClipboard(); void copyLinkToClipboard();
QUrl authorisationLink() const; [[nodiscard]] QUrl authorisationLink() const;
signals: signals:
/** /**

View file

@ -54,7 +54,7 @@ public:
* In case of oauth, return an URL to the link to open the browser. * In case of oauth, return an URL to the link to open the browser.
* An invalid URL otherwise * An invalid URL otherwise
*/ */
QUrl authorisationLink() const { return _asyncAuth ? _asyncAuth->authorisationLink() : QUrl(); } [[nodiscard]] QUrl authorisationLink() const { return _asyncAuth ? _asyncAuth->authorisationLink() : QUrl(); }
static QString requestAppPasswordText(const Account *account); static QString requestAppPasswordText(const Account *account);

View file

@ -55,7 +55,7 @@ public:
Q_ENUM(Result); Q_ENUM(Result);
void start(); void start();
bool openBrowser(); bool openBrowser();
QUrl authorisationLink() const; [[nodiscard]] QUrl authorisationLink() const;
signals: signals:
/** /**

View file

@ -43,12 +43,12 @@ public:
const QSslKey &key = QSslKey(), const QSslKey &key = QSslKey(),
const QList<QSslCertificate> &caCertificates = QList<QSslCertificate>()); const QList<QSslCertificate> &caCertificates = QList<QSslCertificate>());
QString authType() const override; [[nodiscard]] QString authType() const override;
QString user() const override; [[nodiscard]] QString user() const override;
QString password() const override; [[nodiscard]] QString password() const override;
QNetworkAccessManager *createQNAM() const override; [[nodiscard]] QNetworkAccessManager *createQNAM() const override;
bool ready() const override; [[nodiscard]] bool ready() const override;
void fetchFromKeychain() override; void fetchFromKeychain() override;
void askFromUser() override; void askFromUser() override;

View file

@ -28,7 +28,7 @@ public:
void setInfo(const QString &msg); void setInfo(const QString &msg);
void setError(const QString &error); void setError(const QString &error);
bool isUsingFlow2() const { [[nodiscard]] bool isUsingFlow2() const {
return _useFlow2; return _useFlow2;
} }

View file

@ -28,10 +28,10 @@ public:
explicit ElidedLabel(const QString &text, QWidget *parent = nullptr); explicit ElidedLabel(const QString &text, QWidget *parent = nullptr);
void setText(const QString &text); void setText(const QString &text);
const QString &text() const { return _text; } [[nodiscard]] const QString &text() const { return _text; }
void setElideMode(Qt::TextElideMode elideMode); void setElideMode(Qt::TextElideMode elideMode);
Qt::TextElideMode elideMode() const { return _elideMode; } [[nodiscard]] Qt::TextElideMode elideMode() const { return _elideMode; }
protected: protected:
void resizeEvent(QResizeEvent *event) override; void resizeEvent(QResizeEvent *event) override;

View file

@ -62,9 +62,9 @@ struct Emoji
class EmojiCategoriesModel : public QAbstractListModel class EmojiCategoriesModel : public QAbstractListModel
{ {
public: public:
QVariant data(const QModelIndex &index, int role) const override; [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override; [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QHash<int, QByteArray> roleNames() const override; [[nodiscard]] QHash<int, QByteArray> roleNames() const override;
private: private:
enum Roles { enum Roles {
@ -105,11 +105,11 @@ public:
{ {
} }
Q_INVOKABLE QVariantList history() const; Q_INVOKABLE [[nodiscard]] QVariantList history() const;
Q_INVOKABLE void setCategory(const QString &category); Q_INVOKABLE void setCategory(const QString &category);
Q_INVOKABLE void emojiUsed(const QVariant &modelData); Q_INVOKABLE void emojiUsed(const QVariant &modelData);
QVariantList model() const; [[nodiscard]] QVariantList model() const;
QAbstractListModel *emojiCategoriesModel(); QAbstractListModel *emojiCategoriesModel();
signals: signals:

View file

@ -92,7 +92,7 @@ public:
static QString prepareTargetPath(const QString &path); static QString prepareTargetPath(const QString &path);
/// journalPath relative to localPath. /// journalPath relative to localPath.
QString absoluteJournalPath() const; [[nodiscard]] QString absoluteJournalPath() const;
/// Returns the relative journal path that's appropriate for this folder and account. /// Returns the relative journal path that's appropriate for this folder and account.
QString defaultJournalPath(AccountPtr account); QString defaultJournalPath(AccountPtr account);

View file

@ -83,7 +83,7 @@ public:
*/ */
static void backwardMigrationSettingsKeys(QStringList *deleteKeys, QStringList *ignoreKeys); static void backwardMigrationSettingsKeys(QStringList *deleteKeys, QStringList *ignoreKeys);
const Folder::Map &map() const; [[nodiscard]] const Folder::Map &map() const;
/** Adds a folder for an account, ensures the journal is gone and saves it in the settings. /** Adds a folder for an account, ensures the journal is gone and saves it in the settings.
*/ */
@ -144,7 +144,7 @@ public:
* *
* @returns an empty string and PathValidityResult::Valid if it is allowed, or an error if it is not allowed * @returns an empty string and PathValidityResult::Valid if it is allowed, or an error if it is not allowed
*/ */
QPair<PathValidityResult, QString> checkPathValidityForNewFolder(const QString &path, const QUrl &serverUrl = QUrl()) const; [[nodiscard]] QPair<PathValidityResult, QString> checkPathValidityForNewFolder(const QString &path, const QUrl &serverUrl = QUrl()) const;
/** /**
* Attempts to find a non-existing, acceptable path for creating a new sync folder. * Attempts to find a non-existing, acceptable path for creating a new sync folder.
@ -155,7 +155,7 @@ public:
* subfolder of ~ would be a good candidate. When that happens \a basePath * subfolder of ~ would be a good candidate. When that happens \a basePath
* is returned. * is returned.
*/ */
QString findGoodPathForNewSyncFolder(const QString &basePath, const QUrl &serverUrl) const; [[nodiscard]] QString findGoodPathForNewSyncFolder(const QString &basePath, const QUrl &serverUrl) const;
/** /**
* While ignoring hidden files can theoretically be switched per folder, * While ignoring hidden files can theoretically be switched per folder,
@ -163,13 +163,13 @@ public:
* at once. * at once.
* These helper functions can be removed once it's properly per-folder. * These helper functions can be removed once it's properly per-folder.
*/ */
bool ignoreHiddenFiles() const; [[nodiscard]] bool ignoreHiddenFiles() const;
void setIgnoreHiddenFiles(bool ignore); void setIgnoreHiddenFiles(bool ignore);
/** /**
* Access to the current queue of scheduled folders. * Access to the current queue of scheduled folders.
*/ */
QQueue<Folder *> scheduleQueue() const; [[nodiscard]] QQueue<Folder *> scheduleQueue() const;
/** /**
* Access to the currently syncing folder. * Access to the currently syncing folder.
@ -179,7 +179,7 @@ public:
* *
* See also isAnySyncRunning() * See also isAnySyncRunning()
*/ */
Folder *currentSyncFolder() const; [[nodiscard]] Folder *currentSyncFolder() const;
/** /**
* Returns true if any folder is currently syncing. * Returns true if any folder is currently syncing.
@ -187,7 +187,7 @@ public:
* This might be a FolderMan-scheduled sync, or a externally * This might be a FolderMan-scheduled sync, or a externally
* managed sync like a placeholder hydration. * managed sync like a placeholder hydration.
*/ */
bool isAnySyncRunning() const; [[nodiscard]] bool isAnySyncRunning() const;
/** Removes all folders */ /** Removes all folders */
int unloadAndDeleteAllFolders(); int unloadAndDeleteAllFolders();
@ -324,7 +324,7 @@ private:
// finds all folder configuration files // finds all folder configuration files
// and create the folders // and create the folders
QString getBackupName(QString fullPathName) const; [[nodiscard]] QString getBackupName(QString fullPathName) const;
// makes the folder known to the socket api // makes the folder known to the socket api
void registerFolderWithSocketApi(Folder *folder); void registerFolderWithSocketApi(Folder *folder);
@ -339,7 +339,7 @@ private:
bool pushNotificationsFilesReady(Account *account); bool pushNotificationsFilesReady(Account *account);
bool isSwitchToVfsNeeded(const FolderDefinition &folderDefinition) const; [[nodiscard]] bool isSwitchToVfsNeeded(const FolderDefinition &folderDefinition) const;
QSet<Folder *> _disabledFolders; QSet<Folder *> _disabledFolders;
Folder::Map _folderMap; Folder::Map _folderMap;

View file

@ -52,7 +52,7 @@ public:
}; };
void paint(QPainter *, const QStyleOptionViewItem &, const QModelIndex &) const override; void paint(QPainter *, const QStyleOptionViewItem &, const QModelIndex &) const override;
QSize sizeHint(const QStyleOptionViewItem &, const QModelIndex &) const override; [[nodiscard]] QSize sizeHint(const QStyleOptionViewItem &, const QModelIndex &) const override;
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option,
const QModelIndex &index) override; const QModelIndex &index) override;

View file

@ -45,17 +45,17 @@ public:
~FolderStatusModel() override; ~FolderStatusModel() override;
void setAccountState(const AccountState *accountState); void setAccountState(const AccountState *accountState);
Qt::ItemFlags flags(const QModelIndex &) const override; [[nodiscard]] Qt::ItemFlags flags(const QModelIndex &) const override;
QVariant data(const QModelIndex &index, int role) const override; [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override; [[nodiscard]] int columnCount(const QModelIndex &parent = QModelIndex()) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override; [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override; [[nodiscard]] QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &child) const override; [[nodiscard]] QModelIndex parent(const QModelIndex &child) const override;
bool canFetchMore(const QModelIndex &parent) const override; [[nodiscard]] bool canFetchMore(const QModelIndex &parent) const override;
void fetchMore(const QModelIndex &parent) override; void fetchMore(const QModelIndex &parent) override;
void resetAndFetch(const QModelIndex &parent); void resetAndFetch(const QModelIndex &parent);
bool hasChildren(const QModelIndex &parent = QModelIndex()) const override; [[nodiscard]] bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
struct SubFolderInfo struct SubFolderInfo
{ {
@ -81,14 +81,14 @@ public:
Qt::CheckState _checked = Qt::Checked; Qt::CheckState _checked = Qt::Checked;
// Whether this has a FetchLabel subrow // Whether this has a FetchLabel subrow
bool hasLabel() const; [[nodiscard]] bool hasLabel() const;
// Reset all subfolders and fetch status // Reset all subfolders and fetch status
void resetSubs(FolderStatusModel *model, QModelIndex index); void resetSubs(FolderStatusModel *model, QModelIndex index);
struct Progress struct Progress
{ {
bool isNull() const [[nodiscard]] bool isNull() const
{ {
return _progressString.isEmpty() && _warningCount == 0 && _overallSyncString.isEmpty(); return _progressString.isEmpty() && _warningCount == 0 && _overallSyncString.isEmpty();
} }
@ -106,9 +106,9 @@ public:
SubFolder, SubFolder,
AddButton, AddButton,
FetchLabel }; FetchLabel };
ItemType classify(const QModelIndex &index) const; [[nodiscard]] ItemType classify(const QModelIndex &index) const;
SubFolderInfo *infoForIndex(const QModelIndex &index) const; [[nodiscard]] SubFolderInfo *infoForIndex(const QModelIndex &index) const;
bool isAnyAncestorEncrypted(const QModelIndex &index) const; [[nodiscard]] bool isAnyAncestorEncrypted(const QModelIndex &index) const;
// If the selective sync check boxes were changed // If the selective sync check boxes were changed
bool isDirty() { return _dirty; } bool isDirty() { return _dirty; }
@ -142,7 +142,7 @@ private slots:
void slotShowFetchProgress(); void slotShowFetchProgress();
private: private:
QStringList createBlackList(const OCC::FolderStatusModel::SubFolderInfo &root, [[nodiscard]] QStringList createBlackList(const OCC::FolderStatusModel::SubFolderInfo &root,
const QStringList &oldBlackList) const; const QStringList &oldBlackList) const;
const AccountState *_accountState = nullptr; const AccountState *_accountState = nullptr;
bool _dirty = false; // If the selective sync checkboxes were changed bool _dirty = false; // If the selective sync checkboxes were changed

View file

@ -30,8 +30,8 @@ class FolderStatusView : public QTreeView
public: public:
explicit FolderStatusView(QWidget *parent = nullptr); explicit FolderStatusView(QWidget *parent = nullptr);
QModelIndex indexAt(const QPoint &point) const override; [[nodiscard]] QModelIndex indexAt(const QPoint &point) const override;
QRect visualRect(const QModelIndex &index) const override; [[nodiscard]] QRect visualRect(const QModelIndex &index) const override;
}; };
} // namespace OCC } // namespace OCC

View file

@ -70,7 +70,7 @@ public:
* For example, this can happen on linux if the inotify user limit from * For example, this can happen on linux if the inotify user limit from
* /proc/sys/fs/inotify/max_user_watches is exceeded. * /proc/sys/fs/inotify/max_user_watches is exceeded.
*/ */
bool isReliable() const; [[nodiscard]] bool isReliable() const;
/** /**
* Triggers a change in the path and verifies a notification arrives. * Triggers a change in the path and verifies a notification arrives.
@ -81,7 +81,7 @@ public:
void startNotificatonTest(const QString &path); void startNotificatonTest(const QString &path);
/// For testing linux behavior only /// For testing linux behavior only
int testLinuxWatchCount() const; [[nodiscard]] int testLinuxWatchCount() const;
signals: signals:
/** Emitted when one of the watched directories or one /** Emitted when one of the watched directories or one

View file

@ -39,7 +39,7 @@ public:
FolderWatcherPrivate(FolderWatcher *p, const QString &path); FolderWatcherPrivate(FolderWatcher *p, const QString &path);
~FolderWatcherPrivate() override; ~FolderWatcherPrivate() override;
int testWatchCount() const { return _pathToWatch.size(); } [[nodiscard]] int testWatchCount() const { return _pathToWatch.size(); }
/// On linux the watcher is ready when the ctor finished. /// On linux the watcher is ready when the ctor finished.
bool _ready = true; bool _ready = true;

View file

@ -41,7 +41,7 @@ class FormatWarningsWizardPage : public QWizardPage
{ {
Q_OBJECT Q_OBJECT
protected: protected:
QString formatWarnings(const QStringList &warnings) const; [[nodiscard]] QString formatWarnings(const QStringList &warnings) const;
}; };
/** /**
@ -55,7 +55,7 @@ public:
explicit FolderWizardLocalPath(const AccountPtr &account); explicit FolderWizardLocalPath(const AccountPtr &account);
~FolderWizardLocalPath() override; ~FolderWizardLocalPath() override;
bool isComplete() const override; [[nodiscard]] bool isComplete() const override;
void initializePage() override; void initializePage() override;
void cleanupPage() override; void cleanupPage() override;
@ -88,7 +88,7 @@ public:
explicit FolderWizardRemotePath(const AccountPtr &account); explicit FolderWizardRemotePath(const AccountPtr &account);
~FolderWizardRemotePath() override; ~FolderWizardRemotePath() override;
bool isComplete() const override; [[nodiscard]] bool isComplete() const override;
void initializePage() override; void initializePage() override;
void cleanupPage() override; void cleanupPage() override;

View file

@ -39,7 +39,7 @@ class GeneralSettings : public QWidget
public: public:
explicit GeneralSettings(QWidget *parent = nullptr); explicit GeneralSettings(QWidget *parent = nullptr);
~GeneralSettings() override; ~GeneralSettings() override;
QSize sizeHint() const override; [[nodiscard]] QSize sizeHint() const override;
public slots: public slots:
void slotStyleChanged(); void slotStyleChanged();

View file

@ -29,7 +29,7 @@ class NavigationPaneHelper : public QObject
public: public:
NavigationPaneHelper(FolderMan *folderMan); NavigationPaneHelper(FolderMan *folderMan);
bool showInExplorerNavigationPane() const { return _showInExplorerNavigationPane; } [[nodiscard]] bool showInExplorerNavigationPane() const { return _showInExplorerNavigationPane; }
void setShowInExplorerNavigationPane(bool show); void setShowInExplorerNavigationPane(bool show);
void scheduleUpdateCloudStorageRegistry(); void scheduleUpdateCloudStorageRegistry();

View file

@ -35,7 +35,7 @@ class NetworkSettings : public QWidget
public: public:
explicit NetworkSettings(QWidget *parent = nullptr); explicit NetworkSettings(QWidget *parent = nullptr);
~NetworkSettings() override; ~NetworkSettings() override;
QSize sizeHint() const override; [[nodiscard]] QSize sizeHint() const override;
private slots: private slots:
void saveProxySettings(); void saveProxySettings();

View file

@ -30,7 +30,7 @@ public:
explicit PasswordInputDialog(const QString &description, const QString &error, QWidget *parent = nullptr); explicit PasswordInputDialog(const QString &description, const QString &error, QWidget *parent = nullptr);
~PasswordInputDialog() override; ~PasswordInputDialog() override;
QString password() const; [[nodiscard]] QString password() const;
private: private:
std::unique_ptr<Ui::PasswordInputDialog> _ui; std::unique_ptr<Ui::PasswordInputDialog> _ui;

View file

@ -38,8 +38,8 @@ public:
void setProxyAddress(const QString &address); void setProxyAddress(const QString &address);
QString username() const; [[nodiscard]] QString username() const;
QString password() const; [[nodiscard]] QString password() const;
/// Resets the dialog for new credential entry. /// Resets the dialog for new credential entry.
void reset(); void reset();

View file

@ -77,8 +77,8 @@ private:
int &counter, int &counter,
const QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents); const QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents);
QString keychainUsernameKey() const; [[nodiscard]] QString keychainUsernameKey() const;
QString keychainPasswordKey() const; [[nodiscard]] QString keychainPasswordKey() const;
/// The hostname:port of the current proxy, used for detecting switches /// The hostname:port of the current proxy, used for detecting switches
/// to a different proxy. /// to a different proxy.

View file

@ -43,7 +43,7 @@ public:
/** Returns the oldBlackList passed into setFolderInfo(), except that /** Returns the oldBlackList passed into setFolderInfo(), except that
* a "/" entry is expanded to all top-level folder names. * a "/" entry is expanded to all top-level folder names.
*/ */
QStringList oldBlackList() const; [[nodiscard]] QStringList oldBlackList() const;
// Estimates the total size of checked items (recursively) // Estimates the total size of checked items (recursively)
qint64 estimatedSize(QTreeWidgetItem *root = nullptr); qint64 estimatedSize(QTreeWidgetItem *root = nullptr);
@ -52,7 +52,7 @@ public:
void setFolderInfo(const QString &folderPath, const QString &rootName, void setFolderInfo(const QString &folderPath, const QString &rootName,
const QStringList &oldBlackList = QStringList()); const QStringList &oldBlackList = QStringList());
QSize sizeHint() const override; [[nodiscard]] QSize sizeHint() const override;
private slots: private slots:
void slotUpdateDirectories(QStringList); void slotUpdateDirectories(QStringList);
@ -102,8 +102,8 @@ public:
void accept() override; void accept() override;
QStringList createBlackList() const; [[nodiscard]] QStringList createBlackList() const;
QStringList oldBlackList() const; [[nodiscard]] QStringList oldBlackList() const;
// Estimate the size of the total of sync'ed files from the server // Estimate the size of the total of sync'ed files from the server
qint64 estimatedSize(); qint64 estimatedSize();

View file

@ -50,10 +50,10 @@ public:
const QString displayName, const QString displayName,
const Type type); const Type type);
QString format() const; [[nodiscard]] QString format() const;
QString shareWith() const; [[nodiscard]] QString shareWith() const;
QString displayName() const; [[nodiscard]] QString displayName() const;
Type type() const; [[nodiscard]] Type type() const;
private: private:
QString _shareWith; QString _shareWith;
@ -75,12 +75,12 @@ public:
using ShareeSet = QVector<QSharedPointer<Sharee>>; // FIXME: make it a QSet<Sharee> when Sharee can be compared using ShareeSet = QVector<QSharedPointer<Sharee>>; // FIXME: make it a QSet<Sharee> when Sharee can be compared
void fetch(const QString &search, const ShareeSet &blacklist, LookupMode lookupMode); void fetch(const QString &search, const ShareeSet &blacklist, LookupMode lookupMode);
int rowCount(const QModelIndex &parent = QModelIndex()) const override; [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override; [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
QSharedPointer<Sharee> getSharee(int at); QSharedPointer<Sharee> getSharee(int at);
QString currentSearch() const { return _search; } [[nodiscard]] QString currentSearch() const { return _search; }
signals: signals:
void shareesReady(); void shareesReady();

View file

@ -113,7 +113,7 @@ private:
void confirmAndDeleteShare(); void confirmAndDeleteShare();
/** Retrieve a share's name, accounting for _namesSupported */ /** Retrieve a share's name, accounting for _namesSupported */
QString shareName() const; [[nodiscard]] QString shareName() const;
void customizeStyle(); void customizeStyle();

View file

@ -70,39 +70,39 @@ public:
/** /**
* The account the share is defined on. * The account the share is defined on.
*/ */
AccountPtr account() const; [[nodiscard]] AccountPtr account() const;
QString path() const; [[nodiscard]] QString path() const;
/* /*
* Get the id * Get the id
*/ */
QString getId() const; [[nodiscard]] QString getId() const;
/* /*
* Get the uid_owner * Get the uid_owner
*/ */
QString getUidOwner() const; [[nodiscard]] QString getUidOwner() const;
/* /*
* Get the owner display name * Get the owner display name
*/ */
QString getOwnerDisplayName() const; [[nodiscard]] QString getOwnerDisplayName() const;
/* /*
* Get the shareType * Get the shareType
*/ */
ShareType getShareType() const; [[nodiscard]] ShareType getShareType() const;
/* /*
* Get the shareWith * Get the shareWith
*/ */
QSharedPointer<Sharee> getShareWith() const; [[nodiscard]] QSharedPointer<Sharee> getShareWith() const;
/* /*
* Get permissions * Get permissions
*/ */
Permissions getPermissions() const; [[nodiscard]] Permissions getPermissions() const;
/* /*
* Set the permissions of a share * Set the permissions of a share
@ -120,7 +120,7 @@ public:
*/ */
void setPassword(const QString &password); void setPassword(const QString &password);
bool isPasswordSet() const; [[nodiscard]] bool isPasswordSet() const;
/* /*
* Deletes a share * Deletes a share
@ -189,37 +189,37 @@ public:
/* /*
* Get the share link * Get the share link
*/ */
QUrl getLink() const; [[nodiscard]] QUrl getLink() const;
/* /*
* The share's link for direct downloading. * The share's link for direct downloading.
*/ */
QUrl getDirectDownloadLink() const; [[nodiscard]] QUrl getDirectDownloadLink() const;
/* /*
* Get the publicUpload status of this share * Get the publicUpload status of this share
*/ */
bool getPublicUpload() const; [[nodiscard]] bool getPublicUpload() const;
/* /*
* Whether directory listings are available (READ permission) * Whether directory listings are available (READ permission)
*/ */
bool getShowFileListing() const; [[nodiscard]] bool getShowFileListing() const;
/* /*
* Returns the name of the link share. Can be empty. * Returns the name of the link share. Can be empty.
*/ */
QString getName() const; [[nodiscard]] QString getName() const;
/* /*
* Returns the note of the link share. * Returns the note of the link share.
*/ */
QString getNote() const; [[nodiscard]] QString getNote() const;
/* /*
* Returns the label of the link share. * Returns the label of the link share.
*/ */
QString getLabel() const; [[nodiscard]] QString getLabel() const;
/* /*
* Set the name of the link share. * Set the name of the link share.
@ -236,12 +236,12 @@ public:
/* /*
* Returns the token of the link share. * Returns the token of the link share.
*/ */
QString getToken() const; [[nodiscard]] QString getToken() const;
/* /*
* Get the expiration date * Get the expiration date
*/ */
QDate getExpireDate() const; [[nodiscard]] QDate getExpireDate() const;
/* /*
* Set the expiration date * Set the expiration date
@ -302,13 +302,13 @@ public:
void setNote(const QString &note); void setNote(const QString &note);
QString getNote() const; [[nodiscard]] QString getNote() const;
void slotNoteSet(const QJsonDocument &, const QVariant &note); void slotNoteSet(const QJsonDocument &, const QVariant &note);
void setExpireDate(const QDate &date); void setExpireDate(const QDate &date);
QDate getExpireDate() const; [[nodiscard]] QDate getExpireDate() const;
void slotExpireDateSet(const QJsonDocument &reply, const QVariant &value); void slotExpireDateSet(const QJsonDocument &reply, const QVariant &value);

View file

@ -150,7 +150,7 @@ public:
QWidget *parent = nullptr); QWidget *parent = nullptr);
~ShareUserLine() override; ~ShareUserLine() override;
QSharedPointer<Share> share() const; [[nodiscard]] QSharedPointer<Share> share() const;
signals: signals:
void visualDeletionDone(); void visualDeletionDone();
@ -194,8 +194,8 @@ private:
void setDefaultAvatar(int avatarSize); void setDefaultAvatar(int avatarSize);
void customizeStyle(); void customizeStyle();
QPixmap pixmapForShareeType(Sharee::Type type, const QColor &backgroundColor = QColor()) const; [[nodiscard]] QPixmap pixmapForShareeType(Sharee::Type type, const QColor &backgroundColor = QColor()) const;
QColor backgroundColorForShareeType(Sharee::Type type) const; [[nodiscard]] QColor backgroundColorForShareeType(Sharee::Type type) const;
void showNoteOptions(bool show); void showNoteOptions(bool show);
void toggleNoteOptions(bool enable); void toggleNoteOptions(bool enable);
@ -211,8 +211,8 @@ private:
void enableProgessIndicatorAnimation(bool enable); void enableProgessIndicatorAnimation(bool enable);
void disableProgessIndicatorAnimation(); void disableProgessIndicatorAnimation();
QDate maxExpirationDateForShare(const Share::ShareType type, const QDate &fallbackDate) const; [[nodiscard]] QDate maxExpirationDateForShare(const Share::ShareType type, const QDate &fallbackDate) const;
bool enforceExpirationDateForShare(const Share::ShareType type) const; [[nodiscard]] bool enforceExpirationDateForShare(const Share::ShareType type) const;
Ui::ShareUserLine *_ui; Ui::ShareUserLine *_ui;
AccountPtr _account; AccountPtr _account;

View file

@ -29,7 +29,7 @@ class ShellExtensionsServer : public QObject
QSize size; QSize size;
QString folderAlias; QString folderAlias;
bool isValid() const { return !path.isEmpty() && !size.isEmpty() && !folderAlias.isEmpty(); } [[nodiscard]] bool isValid() const { return !path.isEmpty() && !size.isEmpty() && !folderAlias.isEmpty(); }
}; };
Q_OBJECT Q_OBJECT

View file

@ -83,12 +83,12 @@ private:
struct FileData struct FileData
{ {
static FileData get(const QString &localFile); static FileData get(const QString &localFile);
SyncFileStatus syncFileStatus() const; [[nodiscard]] SyncFileStatus syncFileStatus() const;
SyncJournalFileRecord journalRecord() const; [[nodiscard]] SyncJournalFileRecord journalRecord() const;
FileData parentFolder() const; [[nodiscard]] FileData parentFolder() const;
// Relative path of the file locally, without any vfs suffix // Relative path of the file locally, without any vfs suffix
QString folderRelativePathNoVfsSuffix() const; [[nodiscard]] QString folderRelativePathNoVfsSuffix() const;
Folder *folder; Folder *folder;
// Absolute path of the file locally. (May be a virtual file) // Absolute path of the file locally. (May be a virtual file)

View file

@ -47,7 +47,7 @@ public:
hashBits.setBit((hash & 0xFFFF) % NumBits); // NOLINT it's uint all the way and the modulo puts us back in the 0..1023 range hashBits.setBit((hash & 0xFFFF) % NumBits); // NOLINT it's uint all the way and the modulo puts us back in the 0..1023 range
hashBits.setBit((hash >> 16) % NumBits); // NOLINT hashBits.setBit((hash >> 16) % NumBits); // NOLINT
} }
bool isHashMaybeStored(uint hash) const [[nodiscard]] bool isHashMaybeStored(uint hash) const
{ {
return hashBits.testBit((hash & 0xFFFF) % NumBits) // NOLINT return hashBits.testBit((hash & 0xFFFF) % NumBits) // NOLINT
&& hashBits.testBit((hash >> 16) % NumBits); // NOLINT && hashBits.testBit((hash >> 16) % NumBits); // NOLINT
@ -147,8 +147,8 @@ public:
void success(const QJsonObject &response) const; void success(const QJsonObject &response) const;
void failure(const QString &error) const; void failure(const QString &error) const;
const QJsonObject &arguments() const { return _arguments; } [[nodiscard]] const QJsonObject &arguments() const { return _arguments; }
QByteArray command() const { return _command; } [[nodiscard]] QByteArray command() const { return _command; }
Q_SIGNALS: Q_SIGNALS:
void finished() const; void finished() const;

View file

@ -52,13 +52,13 @@ public:
~SslErrorDialog() override; ~SslErrorDialog() override;
bool checkFailingCertsKnown(const QList<QSslError> &errors); bool checkFailingCertsKnown(const QList<QSslError> &errors);
bool trustConnection(); bool trustConnection();
QList<QSslCertificate> unknownCerts() const { return _unknownCerts; } [[nodiscard]] QList<QSslCertificate> unknownCerts() const { return _unknownCerts; }
private: private:
QString styleSheet() const; [[nodiscard]] QString styleSheet() const;
bool _allTrusted; bool _allTrusted;
QString certDiv(QSslCertificate) const; [[nodiscard]] QString certDiv(QSslCertificate) const;
QList<QSslCertificate> _unknownCerts; QList<QSslCertificate> _unknownCerts;
QString _customConfigHandle; QString _customConfigHandle;

View file

@ -140,16 +140,16 @@ private:
void setupContextMenu(); void setupContextMenu();
QScreen *currentScreen() const; [[nodiscard]] QScreen *currentScreen() const;
QRect currentScreenRect() const; [[nodiscard]] QRect currentScreenRect() const;
QPoint computeWindowReferencePoint() const; [[nodiscard]] QPoint computeWindowReferencePoint() const;
QPoint computeNotificationReferencePoint(int spacing = 20, NotificationPosition position = NotificationPosition::Default) const; [[nodiscard]] QPoint computeNotificationReferencePoint(int spacing = 20, NotificationPosition position = NotificationPosition::Default) const;
QPoint calcTrayIconCenter() const; [[nodiscard]] QPoint calcTrayIconCenter() const;
TaskBarPosition taskbarOrientation() const; [[nodiscard]] TaskBarPosition taskbarOrientation() const;
QRect taskbarGeometry() const; [[nodiscard]] QRect taskbarGeometry() const;
QRect computeWindowRect(int spacing, const QPoint &topLeft, const QPoint &bottomRight) const; [[nodiscard]] QRect computeWindowRect(int spacing, const QPoint &topLeft, const QPoint &bottomRight) const;
QPoint computeWindowPosition(int width, int height) const; [[nodiscard]] QPoint computeWindowPosition(int width, int height) const;
QPoint computeNotificationPosition(int width, int height, int spacing = 20, NotificationPosition position = NotificationPosition::Default) const; [[nodiscard]] QPoint computeNotificationPosition(int width, int height, int spacing = 20, NotificationPosition position = NotificationPosition::Default) const;
bool _isOpen = false; bool _isOpen = false;
bool _syncIsPaused = true; bool _syncIsPaused = true;

View file

@ -158,7 +158,7 @@ public:
*/ */
Identifier ident() const; [[nodiscard]] Identifier ident() const;
}; };
bool operator==(const Activity &rhs, const Activity &lhs); bool operator==(const Activity &rhs, const Activity &lhs);

View file

@ -83,25 +83,25 @@ public:
explicit ActivityListModel(AccountState *accountState, explicit ActivityListModel(AccountState *accountState,
QObject *parent = nullptr); QObject *parent = nullptr);
QVariant data(const QModelIndex &index, int role) const override; [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override; [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
bool canFetchMore(const QModelIndex &) const override; [[nodiscard]] bool canFetchMore(const QModelIndex &) const override;
void fetchMore(const QModelIndex &) override; void fetchMore(const QModelIndex &) override;
ActivityList activityList() { return _finalList; } ActivityList activityList() { return _finalList; }
ActivityList errorsList() { return _notificationErrorsLists; } ActivityList errorsList() { return _notificationErrorsLists; }
AccountState *accountState() const; [[nodiscard]] AccountState *accountState() const;
int currentItem() const; [[nodiscard]] int currentItem() const;
static constexpr quint32 maxActionButtons() static constexpr quint32 maxActionButtons()
{ {
return MaxActionButtons; return MaxActionButtons;
} }
QString replyMessageSent(const Activity &activity) const; [[nodiscard]] QString replyMessageSent(const Activity &activity) const;
public slots: public slots:
void slotRefreshActivity(); void slotRefreshActivity();
@ -127,11 +127,11 @@ signals:
void sendNotificationRequest(const QString &accountName, const QString &link, const QByteArray &verb, int row); void sendNotificationRequest(const QString &accountName, const QString &link, const QByteArray &verb, int row);
protected: protected:
QHash<int, QByteArray> roleNames() const override; [[nodiscard]] QHash<int, QByteArray> roleNames() const override;
bool currentlyFetching() const; [[nodiscard]] bool currentlyFetching() const;
const ActivityList &finalList() const; // added for unit tests [[nodiscard]] const ActivityList &finalList() const; // added for unit tests
protected slots: protected slots:
void activitiesReceived(const QJsonDocument &json, int statusCode); void activitiesReceived(const QJsonDocument &json, int statusCode);
@ -151,7 +151,7 @@ private:
static QVariantList convertLinksToActionButtons(const Activity &activity); static QVariantList convertLinksToActionButtons(const Activity &activity);
static QVariant convertLinkToActionButton(const ActivityLink &activityLink); static QVariant convertLinkToActionButton(const ActivityLink &activityLink);
bool canFetchActivities() const; [[nodiscard]] bool canFetchActivities() const;
void ingestActivities(const QJsonArray &activities); void ingestActivities(const QJsonArray &activities);
void appendMoreActivitiesAvailableEntry(); void appendMoreActivitiesAvailableEntry();

View file

@ -22,7 +22,7 @@ class AsyncImageResponse : public QQuickImageResponse
public: public:
AsyncImageResponse(const QString &id, const QSize &requestedSize); AsyncImageResponse(const QString &id, const QSize &requestedSize);
void setImageAndEmitFinished(const QImage &image = {}); void setImageAndEmitFinished(const QImage &image = {});
QQuickTextureFactory *textureFactory() const override; [[nodiscard]] QQuickTextureFactory *textureFactory() const override;
private: private:
void processNextImage(); void processNextImage();

View file

@ -28,7 +28,7 @@ class SortedActivityListModel : public QSortFilterProxyModel
public: public:
explicit SortedActivityListModel(QObject *parent = nullptr); explicit SortedActivityListModel(QObject *parent = nullptr);
ActivityListModel *activityListModel() const; [[nodiscard]] ActivityListModel *activityListModel() const;
signals: signals:
void activityListModelChanged(); void activityListModelChanged();
@ -37,7 +37,7 @@ public slots:
void setActivityListModel(ActivityListModel *activityListModel); void setActivityListModel(ActivityListModel *activityListModel);
protected: protected:
bool lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const override; [[nodiscard]] bool lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const override;
private slots: private slots:
void sortModel(); void sortModel();

View file

@ -39,11 +39,11 @@ class SyncStatusSummary : public QObject
public: public:
explicit SyncStatusSummary(QObject *parent = nullptr); explicit SyncStatusSummary(QObject *parent = nullptr);
double syncProgress() const; [[nodiscard]] double syncProgress() const;
QUrl syncIcon() const; [[nodiscard]] QUrl syncIcon() const;
bool syncing() const; [[nodiscard]] bool syncing() const;
QString syncStatusString() const; [[nodiscard]] QString syncStatusString() const;
QString syncStatusDetailString() const; [[nodiscard]] QString syncStatusDetailString() const;
signals: signals:
void syncProgressChanged(); void syncProgressChanged();
@ -66,7 +66,7 @@ private:
void setSyncStateForFolder(const Folder *folder); void setSyncStateForFolder(const Folder *folder);
void markFolderAsError(const Folder *folder); void markFolderAsError(const Folder *folder);
void markFolderAsSuccess(const Folder *folder); void markFolderAsSuccess(const Folder *folder);
bool folderErrors() const; [[nodiscard]] bool folderErrors() const;
bool folderError(const Folder *folder) const; bool folderError(const Folder *folder) const;
void clearFolderErrors(); void clearFolderErrors();
void setSyncStateToConnectedState(); void setSyncStateToConnectedState();

View file

@ -70,20 +70,20 @@ public:
explicit UnifiedSearchResultsListModel(AccountState *accountState, QObject *parent = nullptr); explicit UnifiedSearchResultsListModel(AccountState *accountState, QObject *parent = nullptr);
QVariant data(const QModelIndex &index, int role) const override; [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override; [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
bool isSearchInProgress() const; [[nodiscard]] bool isSearchInProgress() const;
QString currentFetchMoreInProgressProviderId() const; [[nodiscard]] QString currentFetchMoreInProgressProviderId() const;
QString searchTerm() const; [[nodiscard]] QString searchTerm() const;
QString errorString() const; [[nodiscard]] QString errorString() const;
bool waitingForSearchTermEditEnd() const; [[nodiscard]] bool waitingForSearchTermEditEnd() const;
Q_INVOKABLE void resultClicked(const QString &providerId, const QUrl &resourceUrl) const; Q_INVOKABLE void resultClicked(const QString &providerId, const QUrl &resourceUrl) const;
Q_INVOKABLE void fetchMoreTriggerClicked(const QString &providerId); Q_INVOKABLE void fetchMoreTriggerClicked(const QString &providerId);
QHash<int, QByteArray> roleNames() const override; [[nodiscard]] QHash<int, QByteArray> roleNames() const override;
private: private:
void startSearch(); void startSearch();

View file

@ -41,37 +41,37 @@ class User : public QObject
public: public:
User(AccountStatePtr &account, const bool &isCurrent = false, QObject *parent = nullptr); User(AccountStatePtr &account, const bool &isCurrent = false, QObject *parent = nullptr);
AccountPtr account() const; [[nodiscard]] AccountPtr account() const;
AccountStatePtr accountState() const; [[nodiscard]] AccountStatePtr accountState() const;
bool isConnected() const; [[nodiscard]] bool isConnected() const;
bool isCurrentUser() const; [[nodiscard]] bool isCurrentUser() const;
void setCurrentUser(const bool &isCurrent); void setCurrentUser(const bool &isCurrent);
Folder *getFolder() const; [[nodiscard]] Folder *getFolder() const;
ActivityListModel *getActivityModel(); ActivityListModel *getActivityModel();
UnifiedSearchResultsListModel *getUnifiedSearchResultsListModel() const; [[nodiscard]] UnifiedSearchResultsListModel *getUnifiedSearchResultsListModel() const;
void openLocalFolder(); void openLocalFolder();
QString name() const; [[nodiscard]] QString name() const;
QString server(bool shortened = true) const; [[nodiscard]] QString server(bool shortened = true) const;
bool hasLocalFolder() const; [[nodiscard]] bool hasLocalFolder() const;
bool serverHasTalk() const; [[nodiscard]] bool serverHasTalk() const;
bool serverHasUserStatus() const; [[nodiscard]] bool serverHasUserStatus() const;
AccountApp *talkApp() const; [[nodiscard]] AccountApp *talkApp() const;
bool hasActivities() const; [[nodiscard]] bool hasActivities() const;
QColor accentColor() const; [[nodiscard]] QColor accentColor() const;
QColor headerColor() const; [[nodiscard]] QColor headerColor() const;
QColor headerTextColor() const; [[nodiscard]] QColor headerTextColor() const;
AccountAppList appList() const; [[nodiscard]] AccountAppList appList() const;
QImage avatar() const; [[nodiscard]] QImage avatar() const;
void login() const; void login() const;
void logout() const; void logout() const;
void removeAccount() const; void removeAccount() const;
QString avatarUrl() const; [[nodiscard]] QString avatarUrl() const;
bool isDesktopNotificationsAllowed() const; [[nodiscard]] bool isDesktopNotificationsAllowed() const;
UserStatus::OnlineStatus status() const; [[nodiscard]] UserStatus::OnlineStatus status() const;
QString statusMessage() const; [[nodiscard]] QString statusMessage() const;
QUrl statusIcon() const; [[nodiscard]] QUrl statusIcon() const;
QString statusEmoji() const; [[nodiscard]] QString statusEmoji() const;
void processCompletedSyncItem(const Folder *folder, const SyncFileItemPtr &item); void processCompletedSyncItem(const Folder *folder, const SyncFileItemPtr &item);
signals: signals:
@ -117,10 +117,10 @@ private:
void slotCheckExpiredActivities(); void slotCheckExpiredActivities();
void connectPushNotifications() const; void connectPushNotifications() const;
bool checkPushNotificationsAreReady() const; [[nodiscard]] bool checkPushNotificationsAreReady() const;
bool isActivityOfCurrentAccount(const Folder *folder) const; bool isActivityOfCurrentAccount(const Folder *folder) const;
bool isUnsolvableConflict(const SyncFileItemPtr &item) const; [[nodiscard]] bool isUnsolvableConflict(const SyncFileItemPtr &item) const;
void showDesktopNotification(const QString &title, const QString &message, const long notificationId); void showDesktopNotification(const QString &title, const QString &message, const long notificationId);
@ -156,18 +156,18 @@ public:
void addUser(AccountStatePtr &user, const bool &isCurrent = false); void addUser(AccountStatePtr &user, const bool &isCurrent = false);
int currentUserIndex(); int currentUserIndex();
int rowCount(const QModelIndex &parent = QModelIndex()) const override; [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QImage avatarById(const int id); QImage avatarById(const int id);
User *currentUser() const; [[nodiscard]] User *currentUser() const;
int findUserIdForAccount(AccountState *account) const; int findUserIdForAccount(AccountState *account) const;
Q_INVOKABLE int numUsers(); Q_INVOKABLE int numUsers();
Q_INVOKABLE QString currentUserServer(); Q_INVOKABLE QString currentUserServer();
int currentUserId() const; [[nodiscard]] int currentUserId() const;
Q_INVOKABLE bool isUserConnected(const int id); Q_INVOKABLE bool isUserConnected(const int id);
@ -189,7 +189,7 @@ public:
IdRole IdRole
}; };
AccountAppList appList() const; [[nodiscard]] AccountAppList appList() const;
signals: signals:
void addAccount(); void addAccount();
@ -206,7 +206,7 @@ public slots:
void removeAccount(const int id); void removeAccount(const int id);
protected: protected:
QHash<int, QByteArray> roleNames() const override; [[nodiscard]] QHash<int, QByteArray> roleNames() const override;
private: private:
static UserModel *_instance; static UserModel *_instance;
@ -232,9 +232,9 @@ public:
static UserAppsModel *instance(); static UserAppsModel *instance();
~UserAppsModel() override = default; ~UserAppsModel() override = default;
int rowCount(const QModelIndex &parent = QModelIndex()) const override; [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
enum UserAppsRoles { enum UserAppsRoles {
NameRole = Qt::UserRole + 1, NameRole = Qt::UserRole + 1,
@ -248,7 +248,7 @@ public slots:
void openAppUrl(const QUrl &url); void openAppUrl(const QUrl &url);
protected: protected:
QHash<int, QByteArray> roleNames() const override; [[nodiscard]] QHash<int, QByteArray> roleNames() const override;
private: private:
static UserAppsModel *_instance; static UserAppsModel *_instance;

View file

@ -110,8 +110,8 @@ public:
void checkForUpdate() override; void checkForUpdate() override;
QString statusString(UpdateStatusStringFormat format = PlainText) const; [[nodiscard]] QString statusString(UpdateStatusStringFormat format = PlainText) const;
int downloadState() const; [[nodiscard]] int downloadState() const;
void setDownloadState(DownloadState state); void setDownloadState(DownloadState state);
signals: signals:
@ -133,9 +133,9 @@ private slots:
protected: protected:
virtual void versionInfoArrived(const UpdateInfo &info) = 0; virtual void versionInfoArrived(const UpdateInfo &info) = 0;
bool updateSucceeded() const; [[nodiscard]] bool updateSucceeded() const;
QNetworkAccessManager *qnam() const { return _accessManager; } [[nodiscard]] QNetworkAccessManager *qnam() const { return _accessManager; }
UpdateInfo updateInfo() const { return _updateInfo; } [[nodiscard]] UpdateInfo updateInfo() const { return _updateInfo; }
private: private:
QUrl _updateUrl; QUrl _updateUrl;

View file

@ -12,13 +12,13 @@ class UpdateInfo
{ {
public: public:
void setVersion(const QString &v); void setVersion(const QString &v);
QString version() const; [[nodiscard]] QString version() const;
void setVersionString(const QString &v); void setVersionString(const QString &v);
QString versionString() const; [[nodiscard]] QString versionString() const;
void setWeb(const QString &v); void setWeb(const QString &v);
QString web() const; [[nodiscard]] QString web() const;
void setDownloadUrl(const QString &v); void setDownloadUrl(const QString &v);
QString downloadUrl() const; [[nodiscard]] QString downloadUrl() const;
/** /**
Parse XML object from DOM element. Parse XML object from DOM element.
*/ */

View file

@ -70,8 +70,8 @@ class UserInfo : public QObject
public: public:
explicit UserInfo(OCC::AccountState *accountState, bool allowDisconnectedAccountState, bool fetchAvatarImage, QObject *parent = nullptr); explicit UserInfo(OCC::AccountState *accountState, bool allowDisconnectedAccountState, bool fetchAvatarImage, QObject *parent = nullptr);
qint64 lastQuotaTotalBytes() const { return _lastQuotaTotalBytes; } [[nodiscard]] qint64 lastQuotaTotalBytes() const { return _lastQuotaTotalBytes; }
qint64 lastQuotaUsedBytes() const { return _lastQuotaUsedBytes; } [[nodiscard]] qint64 lastQuotaUsedBytes() const { return _lastQuotaUsedBytes; }
/** /**
* When the quotainfo is active, it requests the quota at regular interval. * When the quotainfo is active, it requests the quota at regular interval.
@ -94,7 +94,7 @@ Q_SIGNALS:
void fetchedLastInfo(UserInfo *userInfo); void fetchedLastInfo(UserInfo *userInfo);
private: private:
bool canGetInfo() const; [[nodiscard]] bool canGetInfo() const;
QPointer<AccountState> _accountState; QPointer<AccountState> _accountState;
bool _allowDisconnectedAccountState; bool _allowDisconnectedAccountState;

View file

@ -89,11 +89,11 @@ public:
Q_REQUIRED_RESULT QString userStatusEmoji() const; Q_REQUIRED_RESULT QString userStatusEmoji() const;
void setUserStatusEmoji(const QString &emoji); void setUserStatusEmoji(const QString &emoji);
QVector<UserStatus> predefinedStatuses() const; [[nodiscard]] QVector<UserStatus> predefinedStatuses() const;
Q_REQUIRED_RESULT QVariantList clearStageTypes() const; Q_REQUIRED_RESULT QVariantList clearStageTypes() const;
Q_REQUIRED_RESULT QString clearAtDisplayString() const; Q_REQUIRED_RESULT QString clearAtDisplayString() const;
Q_INVOKABLE QString clearAtReadable(const UserStatus &status) const; Q_INVOKABLE [[nodiscard]] QString clearAtReadable(const UserStatus &status) const;
Q_REQUIRED_RESULT QString errorMessage() const; Q_REQUIRED_RESULT QString errorMessage() const;

View file

@ -29,7 +29,7 @@ class AbstractCredentialsWizardPage : public QWizardPage
{ {
public: public:
void cleanupPage() override; void cleanupPage() override;
virtual AbstractCredentials *getCredentials() const = 0; [[nodiscard]] virtual AbstractCredentials *getCredentials() const = 0;
}; };
} // namespace OCC } // namespace OCC

View file

@ -38,13 +38,13 @@ class Flow2AuthCredsPage : public AbstractCredentialsWizardPage
public: public:
Flow2AuthCredsPage(); Flow2AuthCredsPage();
AbstractCredentials *getCredentials() const override; [[nodiscard]] AbstractCredentials *getCredentials() const override;
void initializePage() override; void initializePage() override;
void cleanupPage() override; void cleanupPage() override;
int nextId() const override; [[nodiscard]] int nextId() const override;
void setConnected(); void setConnected();
bool isComplete() const override; [[nodiscard]] bool isComplete() const override;
public Q_SLOTS: public Q_SLOTS:
void slotFlow2AuthResult(Flow2Auth::Result, const QString &errorString, const QString &user, const QString &appPassword); void slotFlow2AuthResult(Flow2Auth::Result, const QString &errorString, const QString &user, const QString &appPassword);

View file

@ -38,14 +38,14 @@ class OwncloudAdvancedSetupPage : public QWizardPage
public: public:
OwncloudAdvancedSetupPage(OwncloudWizard *wizard); OwncloudAdvancedSetupPage(OwncloudWizard *wizard);
bool isComplete() const override; [[nodiscard]] bool isComplete() const override;
void initializePage() override; void initializePage() override;
int nextId() const override; [[nodiscard]] int nextId() const override;
bool validatePage() override; bool validatePage() override;
QString localFolder() const; [[nodiscard]] QString localFolder() const;
QStringList selectiveSyncBlacklist() const; [[nodiscard]] QStringList selectiveSyncBlacklist() const;
bool useVirtualFileSync() const; [[nodiscard]] bool useVirtualFileSync() const;
bool isConfirmBigFolderChecked() const; [[nodiscard]] bool isConfirmBigFolderChecked() const;
void setRemoteFolder(const QString &remoteFolder); void setRemoteFolder(const QString &remoteFolder);
void setMultipleFoldersExist(bool exist); void setMultipleFoldersExist(bool exist);
void directoriesCreated(); void directoriesCreated();
@ -72,9 +72,9 @@ private:
bool dataChanged(); bool dataChanged();
void startSpinner(); void startSpinner();
void stopSpinner(); void stopSpinner();
QUrl serverUrl() const; [[nodiscard]] QUrl serverUrl() const;
qint64 availableLocalSpace() const; [[nodiscard]] qint64 availableLocalSpace() const;
QString checkLocalSpace(qint64 remoteSize) const; [[nodiscard]] QString checkLocalSpace(qint64 remoteSize) const;
void customizeStyle(); void customizeStyle();
void setServerAddressLabelUrl(const QUrl &url); void setServerAddressLabelUrl(const QUrl &url);
void styleSyncLogo(); void styleSyncLogo();

View file

@ -34,12 +34,12 @@ class OwncloudHttpCredsPage : public AbstractCredentialsWizardPage
public: public:
OwncloudHttpCredsPage(QWidget *parent); OwncloudHttpCredsPage(QWidget *parent);
AbstractCredentials *getCredentials() const override; [[nodiscard]] AbstractCredentials *getCredentials() const override;
void initializePage() override; void initializePage() override;
void cleanupPage() override; void cleanupPage() override;
bool validatePage() override; bool validatePage() override;
int nextId() const override; [[nodiscard]] int nextId() const override;
void setConnected(); void setConnected();
void setErrorString(const QString &err); void setErrorString(const QString &err);

View file

@ -36,13 +36,13 @@ class OwncloudOAuthCredsPage : public AbstractCredentialsWizardPage
public: public:
OwncloudOAuthCredsPage(); OwncloudOAuthCredsPage();
AbstractCredentials *getCredentials() const override; [[nodiscard]] AbstractCredentials *getCredentials() const override;
void initializePage() override; void initializePage() override;
void cleanupPage() override; void cleanupPage() override;
int nextId() const override; [[nodiscard]] int nextId() const override;
void setConnected(); void setConnected();
bool isComplete() const override; [[nodiscard]] bool isComplete() const override;
public Q_SLOTS: public Q_SLOTS:
void asyncAuthResult(OAuth::Result, const QString &user, const QString &token, void asyncAuthResult(OAuth::Result, const QString &user, const QString &token,

View file

@ -45,14 +45,14 @@ public:
OwncloudSetupPage(QWidget *parent = nullptr); OwncloudSetupPage(QWidget *parent = nullptr);
~OwncloudSetupPage() override; ~OwncloudSetupPage() override;
bool isComplete() const override; [[nodiscard]] bool isComplete() const override;
void initializePage() override; void initializePage() override;
int nextId() const override; [[nodiscard]] int nextId() const override;
void setServerUrl(const QString &); void setServerUrl(const QString &);
void setAllowPasswordStorage(bool); void setAllowPasswordStorage(bool);
bool validatePage() override; bool validatePage() override;
QString url() const; [[nodiscard]] QString url() const;
QString localFolder() const; [[nodiscard]] QString localFolder() const;
void setRemoteFolder(const QString &remoteFolder); void setRemoteFolder(const QString &remoteFolder);
void setMultipleFoldersExist(bool exist); void setMultipleFoldersExist(bool exist);
void setAuthType(DetermineAuthTypeJob::AuthType type); void setAuthType(DetermineAuthTypeJob::AuthType type);

View file

@ -56,20 +56,20 @@ public:
OwncloudWizard(QWidget *parent = nullptr); OwncloudWizard(QWidget *parent = nullptr);
void setAccount(AccountPtr account); void setAccount(AccountPtr account);
AccountPtr account() const; [[nodiscard]] AccountPtr account() const;
void setOCUrl(const QString &); void setOCUrl(const QString &);
bool registration(); bool registration();
void setRegistration(bool registration); void setRegistration(bool registration);
void setupCustomMedia(QVariant, QLabel *); void setupCustomMedia(QVariant, QLabel *);
QString ocUrl() const; [[nodiscard]] QString ocUrl() const;
QString localFolder() const; [[nodiscard]] QString localFolder() const;
QStringList selectiveSyncBlacklist() const; [[nodiscard]] QStringList selectiveSyncBlacklist() const;
bool useVirtualFileSync() const; [[nodiscard]] bool useVirtualFileSync() const;
bool isConfirmBigFolderChecked() const; [[nodiscard]] bool isConfirmBigFolderChecked() const;
void displayError(const QString &, bool retryHTTPonly); void displayError(const QString &, bool retryHTTPonly);
AbstractCredentials *getCredentials() const; [[nodiscard]] AbstractCredentials *getCredentials() const;
void bringToTop(); void bringToTop();
void centerWindow(); void centerWindow();
@ -115,8 +115,8 @@ protected:
private: private:
void customizeStyle(); void customizeStyle();
QSize calculateLargestSizeOfWizardPages(const QList<QSize> &pageSizes) const; [[nodiscard]] QSize calculateLargestSizeOfWizardPages(const QList<QSize> &pageSizes) const;
QList<QSize> calculateWizardPageSizes() const; [[nodiscard]] QList<QSize> calculateWizardPageSizes() const;
AccountPtr _account; AccountPtr _account;
WelcomePage *_welcomePage; WelcomePage *_welcomePage;

View file

@ -36,9 +36,9 @@ public:
/** @brief sets an optional postfix shown greyed out */ /** @brief sets an optional postfix shown greyed out */
void setPostfix(const QString &postfix); void setPostfix(const QString &postfix);
/** @brief retrives the postfix */ /** @brief retrives the postfix */
QString postfix() const; [[nodiscard]] QString postfix() const;
/** @brief retrieves combined text() and postfix() */ /** @brief retrieves combined text() and postfix() */
QString fullText() const; [[nodiscard]] QString fullText() const;
/** @brief sets text() from full text, discarding prefix() */ /** @brief sets text() from full text, discarding prefix() */
void setFullText(const QString &text); void setFullText(const QString &text);

View file

@ -37,15 +37,15 @@ public:
void addSlide(const QPixmap &pixmap, const QString &label); void addSlide(const QPixmap &pixmap, const QString &label);
bool isActive() const; [[nodiscard]] bool isActive() const;
int interval() const; [[nodiscard]] int interval() const;
void setInterval(int interval); void setInterval(int interval);
int currentSlide() const; [[nodiscard]] int currentSlide() const;
void setCurrentSlide(int index); void setCurrentSlide(int index);
QSize sizeHint() const override; [[nodiscard]] QSize sizeHint() const override;
public slots: public slots:
void startShow(int interval = 0); void startShow(int interval = 0);

View file

@ -18,10 +18,10 @@ public:
void initializePage() override; void initializePage() override;
void cleanupPage() override; void cleanupPage() override;
int nextId() const override; [[nodiscard]] int nextId() const override;
bool isComplete() const override; [[nodiscard]] bool isComplete() const override;
AbstractCredentials* getCredentials() const override; [[nodiscard]] AbstractCredentials* getCredentials() const override;
void setConnected(); void setConnected();
signals: signals:

View file

@ -33,7 +33,7 @@ class WelcomePage : public QWizardPage
public: public:
explicit WelcomePage(OwncloudWizard *ocWizard); explicit WelcomePage(OwncloudWizard *ocWizard);
~WelcomePage() override; ~WelcomePage() override;
int nextId() const override; [[nodiscard]] int nextId() const override;
void initializePage() override; void initializePage() override;
void setLoginButtonDefault(); void setLoginButtonDefault();

View file

@ -45,16 +45,16 @@ public:
virtual void start(); virtual void start();
AccountPtr account() const { return _account; } [[nodiscard]] AccountPtr account() const { return _account; }
void setPath(const QString &path); void setPath(const QString &path);
QString path() const { return _path; } [[nodiscard]] QString path() const { return _path; }
void setReply(QNetworkReply *reply); void setReply(QNetworkReply *reply);
QNetworkReply *reply() const { return _reply; } [[nodiscard]] QNetworkReply *reply() const { return _reply; }
void setIgnoreCredentialFailure(bool ignore); void setIgnoreCredentialFailure(bool ignore);
bool ignoreCredentialFailure() const { return _ignoreCredentialFailure; } [[nodiscard]] bool ignoreCredentialFailure() const { return _ignoreCredentialFailure; }
/** Whether to handle redirects transparently. /** Whether to handle redirects transparently.
* *
@ -67,17 +67,17 @@ public:
* requests where custom handling is necessary. * requests where custom handling is necessary.
*/ */
void setFollowRedirects(bool follow); void setFollowRedirects(bool follow);
bool followRedirects() const { return _followRedirects; } [[nodiscard]] bool followRedirects() const { return _followRedirects; }
QByteArray responseTimestamp(); QByteArray responseTimestamp();
/* Content of the X-Request-ID header. (Only set after the request is sent) */ /* Content of the X-Request-ID header. (Only set after the request is sent) */
QByteArray requestId(); QByteArray requestId();
qint64 timeoutMsec() const { return _timer.interval(); } [[nodiscard]] qint64 timeoutMsec() const { return _timer.interval(); }
bool timedOut() const { return _timedout; } [[nodiscard]] bool timedOut() const { return _timedout; }
/** Returns an error message, if any. */ /** Returns an error message, if any. */
virtual QString errorString() const; [[nodiscard]] virtual QString errorString() const;
/** Like errorString, but also checking the reply body for information. /** Like errorString, but also checking the reply body for information.
* *
@ -159,12 +159,12 @@ protected:
virtual void newReplyHook(QNetworkReply *) {} virtual void newReplyHook(QNetworkReply *) {}
/// Creates a url for the account from a relative path /// Creates a url for the account from a relative path
QUrl makeAccountUrl(const QString &relativePath) const; [[nodiscard]] QUrl makeAccountUrl(const QString &relativePath) const;
/// Like makeAccountUrl() but uses the account's dav base path /// Like makeAccountUrl() but uses the account's dav base path
QUrl makeDavUrl(const QString &relativePath) const; [[nodiscard]] QUrl makeDavUrl(const QString &relativePath) const;
int maxRedirects() const { return 10; } [[nodiscard]] int maxRedirects() const { return 10; }
/** Called at the end of QNetworkReply::finished processing. /** Called at the end of QNetworkReply::finished processing.
* *

View file

@ -34,8 +34,8 @@ public:
AbstractPropagateRemoteDeleteEncrypted(OwncloudPropagator *propagator, SyncFileItemPtr item, QObject *parent); AbstractPropagateRemoteDeleteEncrypted(OwncloudPropagator *propagator, SyncFileItemPtr item, QObject *parent);
~AbstractPropagateRemoteDeleteEncrypted() override = default; ~AbstractPropagateRemoteDeleteEncrypted() override = default;
QNetworkReply::NetworkError networkError() const; [[nodiscard]] QNetworkReply::NetworkError networkError() const;
QString errorString() const; [[nodiscard]] QString errorString() const;
virtual void start() = 0; virtual void start() = 0;

View file

@ -91,7 +91,7 @@ public:
AccountPtr sharedFromThis(); AccountPtr sharedFromThis();
AccountPtr sharedFromThis() const; [[nodiscard]] AccountPtr sharedFromThis() const;
/** /**
* The user that can be used in dav url. * The user that can be used in dav url.
@ -99,30 +99,30 @@ public:
* This can very well be different frome the login user that's * This can very well be different frome the login user that's
* stored in credentials()->user(). * stored in credentials()->user().
*/ */
QString davUser() const; [[nodiscard]] QString davUser() const;
void setDavUser(const QString &newDavUser); void setDavUser(const QString &newDavUser);
QString davDisplayName() const; [[nodiscard]] QString davDisplayName() const;
void setDavDisplayName(const QString &newDisplayName); void setDavDisplayName(const QString &newDisplayName);
#ifndef TOKEN_AUTH_ONLY #ifndef TOKEN_AUTH_ONLY
QImage avatar() const; [[nodiscard]] QImage avatar() const;
void setAvatar(const QImage &img); void setAvatar(const QImage &img);
#endif #endif
/// The name of the account as shown in the toolbar /// The name of the account as shown in the toolbar
QString displayName() const; [[nodiscard]] QString displayName() const;
QColor accentColor() const; [[nodiscard]] QColor accentColor() const;
QColor headerColor() const; [[nodiscard]] QColor headerColor() const;
QColor headerTextColor() const; [[nodiscard]] QColor headerTextColor() const;
/// The internal id of the account. /// The internal id of the account.
QString id() const; [[nodiscard]] QString id() const;
/** Server url of the account */ /** Server url of the account */
void setUrl(const QUrl &url); void setUrl(const QUrl &url);
QUrl url() const { return _url; } [[nodiscard]] QUrl url() const { return _url; }
/// Adjusts _userVisibleUrl once the host to use is discovered. /// Adjusts _userVisibleUrl once the host to use is discovered.
void setUserVisibleHost(const QString &host); void setUserVisibleHost(const QString &host);
@ -132,20 +132,20 @@ public:
* a trailing slash. * a trailing slash.
* @returns the (themeable) dav path for the account. * @returns the (themeable) dav path for the account.
*/ */
QString davPath() const; [[nodiscard]] QString davPath() const;
/** Returns webdav entry URL, based on url() */ /** Returns webdav entry URL, based on url() */
QUrl davUrl() const; [[nodiscard]] QUrl davUrl() const;
/** Returns the legacy permalink url for a file. /** Returns the legacy permalink url for a file.
* *
* This uses the old way of manually building the url. New code should * This uses the old way of manually building the url. New code should
* use the "privatelink" property accessible via PROPFIND. * use the "privatelink" property accessible via PROPFIND.
*/ */
QUrl deprecatedPrivateLinkUrl(const QByteArray &numericFileId) const; [[nodiscard]] QUrl deprecatedPrivateLinkUrl(const QByteArray &numericFileId) const;
/** Holds the accounts credentials */ /** Holds the accounts credentials */
AbstractCredentials *credentials() const; [[nodiscard]] AbstractCredentials *credentials() const;
void setCredentials(AbstractCredentials *cred); void setCredentials(AbstractCredentials *cred);
/** Create a network request on the account's QNAM. /** Create a network request on the account's QNAM.
@ -176,7 +176,7 @@ public:
/** The ssl configuration during the first connection */ /** The ssl configuration during the first connection */
QSslConfiguration getOrCreateSslConfig(); QSslConfiguration getOrCreateSslConfig();
QSslConfiguration sslConfiguration() const { return _sslConfiguration; } [[nodiscard]] QSslConfiguration sslConfiguration() const { return _sslConfiguration; }
void setSslConfiguration(const QSslConfiguration &config); void setSslConfiguration(const QSslConfiguration &config);
// Because of bugs in Qt, we use this to store info needed for the SSL Button // Because of bugs in Qt, we use this to store info needed for the SSL Button
QSslCipher _sessionCipher; QSslCipher _sessionCipher;
@ -185,7 +185,7 @@ public:
/** The certificates of the account */ /** The certificates of the account */
QList<QSslCertificate> approvedCerts() const { return _approvedCerts; } [[nodiscard]] QList<QSslCertificate> approvedCerts() const { return _approvedCerts; }
void setApprovedCerts(const QList<QSslCertificate> certs); void setApprovedCerts(const QList<QSslCertificate> certs);
void addApprovedCerts(const QList<QSslCertificate> certs); void addApprovedCerts(const QList<QSslCertificate> certs);
@ -198,14 +198,14 @@ public:
void setSslErrorHandler(AbstractSslErrorHandler *handler); void setSslErrorHandler(AbstractSslErrorHandler *handler);
// To be called by credentials only, for storing username and the like // To be called by credentials only, for storing username and the like
QVariant credentialSetting(const QString &key) const; [[nodiscard]] QVariant credentialSetting(const QString &key) const;
void setCredentialSetting(const QString &key, const QVariant &value); void setCredentialSetting(const QString &key, const QVariant &value);
/** Assign a client certificate */ /** Assign a client certificate */
void setCertificate(const QByteArray certficate = QByteArray(), const QString privateKey = QString()); void setCertificate(const QByteArray certficate = QByteArray(), const QString privateKey = QString());
/** Access the server capabilities */ /** Access the server capabilities */
const Capabilities &capabilities() const; [[nodiscard]] const Capabilities &capabilities() const;
void setCapabilities(const QVariantMap &caps); void setCapabilities(const QVariantMap &caps);
/** Access the server version /** Access the server version
@ -213,7 +213,7 @@ public:
* For servers >= 10.0.0, this can be the empty string until capabilities * For servers >= 10.0.0, this can be the empty string until capabilities
* have been received. * have been received.
*/ */
QString serverVersion() const; [[nodiscard]] QString serverVersion() const;
/** Server version for easy comparison. /** Server version for easy comparison.
* *
@ -221,7 +221,7 @@ public:
* *
* Will be 0 if the version is not available yet. * Will be 0 if the version is not available yet.
*/ */
int serverVersionInt() const; [[nodiscard]] int serverVersionInt() const;
static constexpr int makeServerVersion(const int majorVersion, const int minorVersion, const int patchVersion) { static constexpr int makeServerVersion(const int majorVersion, const int minorVersion, const int patchVersion) {
return (majorVersion << 16) + (minorVersion << 8) + patchVersion; return (majorVersion << 16) + (minorVersion << 8) + patchVersion;
@ -239,13 +239,13 @@ public:
* *
* This function returns true if the server is beyond the weak limit. * This function returns true if the server is beyond the weak limit.
*/ */
bool serverVersionUnsupported() const; [[nodiscard]] bool serverVersionUnsupported() const;
bool isUsernamePrefillSupported() const; [[nodiscard]] bool isUsernamePrefillSupported() const;
bool isChecksumRecalculateRequestSupported() const; [[nodiscard]] bool isChecksumRecalculateRequestSupported() const;
int checksumRecalculateServerVersionMinSupportedMajor() const; [[nodiscard]] int checksumRecalculateServerVersionMinSupportedMajor() const;
/** True when the server connection is using HTTP2 */ /** True when the server connection is using HTTP2 */
bool isHttp2Supported() { return _http2Supported; } bool isHttp2Supported() { return _http2Supported; }
@ -277,10 +277,10 @@ public:
void setupUserStatusConnector(); void setupUserStatusConnector();
void trySetupPushNotifications(); void trySetupPushNotifications();
PushNotifications *pushNotifications() const; [[nodiscard]] PushNotifications *pushNotifications() const;
void setPushNotificationsReconnectInterval(int interval); void setPushNotificationsReconnectInterval(int interval);
std::shared_ptr<UserStatusConnector> userStatusConnector() const; [[nodiscard]] std::shared_ptr<UserStatusConnector> userStatusConnector() const;
void setLockFileState(const QString &serverRelativePath, void setLockFileState(const QString &serverRelativePath,
SyncJournalDb * const journal, SyncJournalDb * const journal,

View file

@ -111,7 +111,7 @@ private:
const QString &errorString); const QString &errorString);
/** Bases headers that need to be sent on the PUT, or in the MOVE for chunking-ng */ /** Bases headers that need to be sent on the PUT, or in the MOVE for chunking-ng */
QMap<QByteArray, QByteArray> headers(SyncFileItemPtr item) const; [[nodiscard]] QMap<QByteArray, QByteArray> headers(SyncFileItemPtr item) const;
void abortWithError(SyncFileItemPtr item, void abortWithError(SyncFileItemPtr item,
SyncFileItem::Status status, SyncFileItem::Status status,

View file

@ -46,54 +46,54 @@ class OWNCLOUDSYNC_EXPORT Capabilities
public: public:
Capabilities(const QVariantMap &capabilities); Capabilities(const QVariantMap &capabilities);
bool shareAPI() const; [[nodiscard]] bool shareAPI() const;
bool shareEmailPasswordEnabled() const; [[nodiscard]] bool shareEmailPasswordEnabled() const;
bool shareEmailPasswordEnforced() const; [[nodiscard]] bool shareEmailPasswordEnforced() const;
bool sharePublicLink() const; [[nodiscard]] bool sharePublicLink() const;
bool sharePublicLinkAllowUpload() const; [[nodiscard]] bool sharePublicLinkAllowUpload() const;
bool sharePublicLinkSupportsUploadOnly() const; [[nodiscard]] bool sharePublicLinkSupportsUploadOnly() const;
bool sharePublicLinkAskOptionalPassword() const; [[nodiscard]] bool sharePublicLinkAskOptionalPassword() const;
bool sharePublicLinkEnforcePassword() const; [[nodiscard]] bool sharePublicLinkEnforcePassword() const;
bool sharePublicLinkEnforceExpireDate() const; [[nodiscard]] bool sharePublicLinkEnforceExpireDate() const;
int sharePublicLinkExpireDateDays() const; [[nodiscard]] int sharePublicLinkExpireDateDays() const;
bool shareInternalEnforceExpireDate() const; [[nodiscard]] bool shareInternalEnforceExpireDate() const;
int shareInternalExpireDateDays() const; [[nodiscard]] int shareInternalExpireDateDays() const;
bool shareRemoteEnforceExpireDate() const; [[nodiscard]] bool shareRemoteEnforceExpireDate() const;
int shareRemoteExpireDateDays() const; [[nodiscard]] int shareRemoteExpireDateDays() const;
bool sharePublicLinkMultiple() const; [[nodiscard]] bool sharePublicLinkMultiple() const;
bool shareResharing() const; [[nodiscard]] bool shareResharing() const;
int shareDefaultPermissions() const; [[nodiscard]] int shareDefaultPermissions() const;
bool chunkingNg() const; [[nodiscard]] bool chunkingNg() const;
bool bulkUpload() const; [[nodiscard]] bool bulkUpload() const;
bool filesLockAvailable() const; [[nodiscard]] bool filesLockAvailable() const;
bool userStatus() const; [[nodiscard]] bool userStatus() const;
bool userStatusSupportsEmoji() const; [[nodiscard]] bool userStatusSupportsEmoji() const;
QColor serverColor() const; [[nodiscard]] QColor serverColor() const;
QColor serverTextColor() const; [[nodiscard]] QColor serverTextColor() const;
/// Returns which kind of push notfications are available /// Returns which kind of push notfications are available
PushNotificationTypes availablePushNotifications() const; [[nodiscard]] PushNotificationTypes availablePushNotifications() const;
/// Websocket url for files push notifications if available /// Websocket url for files push notifications if available
QUrl pushNotificationsWebSocketUrl() const; [[nodiscard]] QUrl pushNotificationsWebSocketUrl() const;
/// disable parallel upload in chunking /// disable parallel upload in chunking
bool chunkingParallelUploadDisabled() const; [[nodiscard]] bool chunkingParallelUploadDisabled() const;
/// Whether the "privatelink" DAV property is available /// Whether the "privatelink" DAV property is available
bool privateLinkPropertyAvailable() const; [[nodiscard]] bool privateLinkPropertyAvailable() const;
/// returns true if the capabilities report notifications /// returns true if the capabilities report notifications
bool notificationsAvailable() const; [[nodiscard]] bool notificationsAvailable() const;
/// returns true if the server supports client side encryption /// returns true if the server supports client side encryption
bool clientSideEncryptionAvailable() const; [[nodiscard]] bool clientSideEncryptionAvailable() const;
/// returns true if the capabilities are loaded already. /// returns true if the capabilities are loaded already.
bool isValid() const; [[nodiscard]] bool isValid() const;
/// return true if the activity app is enabled /// return true if the activity app is enabled
bool hasActivities() const; [[nodiscard]] bool hasActivities() const;
/** /**
* Returns the checksum types the server understands. * Returns the checksum types the server understands.
@ -106,7 +106,7 @@ public:
* Default: [] * Default: []
* Possible entries: "Adler32", "MD5", "SHA1" * Possible entries: "Adler32", "MD5", "SHA1"
*/ */
QList<QByteArray> supportedChecksumTypes() const; [[nodiscard]] QList<QByteArray> supportedChecksumTypes() const;
/** /**
* The checksum algorithm that the server recommends for file uploads. * The checksum algorithm that the server recommends for file uploads.
@ -116,14 +116,14 @@ public:
* Default: empty, meaning "no preference" * Default: empty, meaning "no preference"
* Possible values: empty or any of the supportedTypes * Possible values: empty or any of the supportedTypes
*/ */
QByteArray preferredUploadChecksumType() const; [[nodiscard]] QByteArray preferredUploadChecksumType() const;
/** /**
* Helper that returns the preferredUploadChecksumType() if set, or one * Helper that returns the preferredUploadChecksumType() if set, or one
* of the supportedChecksumTypes() if it isn't. May return an empty * of the supportedChecksumTypes() if it isn't. May return an empty
* QByteArray if no checksum types are supported. * QByteArray if no checksum types are supported.
*/ */
QByteArray uploadChecksumType() const; [[nodiscard]] QByteArray uploadChecksumType() const;
/** /**
* List of HTTP error codes should be guaranteed to eventually reset * List of HTTP error codes should be guaranteed to eventually reset
@ -142,7 +142,7 @@ public:
* Default: [] * Default: []
* Example: [503, 500] * Example: [503, 500]
*/ */
QList<int> httpErrorCodesThatResetFailingChunkedUploads() const; [[nodiscard]] QList<int> httpErrorCodesThatResetFailingChunkedUploads() const;
/** /**
* Regex that, if contained in a filename, will result in it not being uploaded. * Regex that, if contained in a filename, will result in it not being uploaded.
@ -153,17 +153,17 @@ public:
* *
* Note that it just needs to be contained. The regex [ab] is contained in "car". * Note that it just needs to be contained. The regex [ab] is contained in "car".
*/ */
QString invalidFilenameRegex() const; [[nodiscard]] QString invalidFilenameRegex() const;
/** /**
* return the list of filename that should not be uploaded * return the list of filename that should not be uploaded
*/ */
QStringList blacklistedFiles() const; [[nodiscard]] QStringList blacklistedFiles() const;
/** /**
* Whether conflict files should remain local (default) or should be uploaded. * Whether conflict files should remain local (default) or should be uploaded.
*/ */
bool uploadConflictFiles() const; [[nodiscard]] bool uploadConflictFiles() const;
// Direct Editing // Direct Editing
void addDirectEditor(DirectEditor* directEditor); void addDirectEditor(DirectEditor* directEditor);
@ -171,7 +171,7 @@ public:
DirectEditor* getDirectEditorForOptionalMimetype(const QMimeType &mimeType); DirectEditor* getDirectEditorForOptionalMimetype(const QMimeType &mimeType);
private: private:
QMap<QString, QVariant> serverThemingMap() const; [[nodiscard]] QMap<QString, QVariant> serverThemingMap() const;
QVariantMap _capabilities; QVariantMap _capabilities;
@ -192,11 +192,11 @@ public:
bool hasMimetype(const QMimeType &mimeType); bool hasMimetype(const QMimeType &mimeType);
bool hasOptionalMimetype(const QMimeType &mimeType); bool hasOptionalMimetype(const QMimeType &mimeType);
QString id() const; [[nodiscard]] QString id() const;
QString name() const; [[nodiscard]] QString name() const;
QList<QByteArray> mimeTypes() const; [[nodiscard]] QList<QByteArray> mimeTypes() const;
QList<QByteArray> optionalMimeTypes() const; [[nodiscard]] QList<QByteArray> optionalMimeTypes() const;
private: private:
QString _id; QString _id;

View file

@ -99,8 +99,8 @@ public:
QByteArray chunkDecryption(const char *input, quint64 chunkSize); QByteArray chunkDecryption(const char *input, quint64 chunkSize);
bool isInitialized() const; [[nodiscard]] bool isInitialized() const;
bool isFinished() const; [[nodiscard]] bool isFinished() const;
private: private:
Q_DISABLE_COPY(StreamingDecryptor) Q_DISABLE_COPY(StreamingDecryptor)
@ -127,7 +127,7 @@ private:
public: public:
void forgetSensitiveData(const AccountPtr &account); void forgetSensitiveData(const AccountPtr &account);
bool newMnemonicGenerated() const; [[nodiscard]] bool newMnemonicGenerated() const;
public slots: public slots:
void slotRequestMnemonic(); void slotRequestMnemonic();
@ -150,8 +150,8 @@ private:
void fetchFromKeyChain(const AccountPtr &account); void fetchFromKeyChain(const AccountPtr &account);
bool checkPublicKeyValidity(const AccountPtr &account) const; [[nodiscard]] bool checkPublicKeyValidity(const AccountPtr &account) const;
bool checkServerPublicKeyValidity(const QByteArray &serverPublicKeyString) const; [[nodiscard]] bool checkServerPublicKeyValidity(const QByteArray &serverPublicKeyString) const;
void writePrivateKey(const AccountPtr &account); void writePrivateKey(const AccountPtr &account);
void writeCertificate(const AccountPtr &account); void writeCertificate(const AccountPtr &account);
void writeMnemonic(const AccountPtr &account); void writeMnemonic(const AccountPtr &account);
@ -186,7 +186,7 @@ public:
void addEncryptedFile(const EncryptedFile& f); void addEncryptedFile(const EncryptedFile& f);
void removeEncryptedFile(const EncryptedFile& f); void removeEncryptedFile(const EncryptedFile& f);
void removeAllEncryptedFiles(); void removeAllEncryptedFiles();
QVector<EncryptedFile> files() const; [[nodiscard]] QVector<EncryptedFile> files() const;
private: private:
@ -196,11 +196,11 @@ private:
void setupEmptyMetadata(); void setupEmptyMetadata();
void setupExistingMetadata(const QByteArray& metadata); void setupExistingMetadata(const QByteArray& metadata);
QByteArray encryptMetadataKey(const QByteArray& metadataKey) const; [[nodiscard]] QByteArray encryptMetadataKey(const QByteArray& metadataKey) const;
QByteArray decryptMetadataKey(const QByteArray& encryptedKey) const; [[nodiscard]] QByteArray decryptMetadataKey(const QByteArray& encryptedKey) const;
QByteArray encryptJsonObject(const QByteArray& obj, const QByteArray pass) const; [[nodiscard]] QByteArray encryptJsonObject(const QByteArray& obj, const QByteArray pass) const;
QByteArray decryptJsonObject(const QByteArray& encryptedJsonBlob, const QByteArray& pass) const; [[nodiscard]] QByteArray decryptJsonObject(const QByteArray& encryptedJsonBlob, const QByteArray& pass) const;
QVector<EncryptedFile> _files; QVector<EncryptedFile> _files;
QMap<int, QByteArray> _metadataKeys; QMap<int, QByteArray> _metadataKeys;

View file

@ -43,9 +43,9 @@ public:
enum Scope { UserScope, enum Scope { UserScope,
SystemScope }; SystemScope };
QString configPath() const; [[nodiscard]] QString configPath() const;
QString configFile() const; [[nodiscard]] QString configFile() const;
QString excludeFile(Scope scope) const; [[nodiscard]] QString excludeFile(Scope scope) const;
static QString excludeFileFromSystem(); // doesn't access config dir static QString excludeFileFromSystem(); // doesn't access config dir
/** /**
@ -53,11 +53,11 @@ public:
* *
* Returns the path of the new backup. * Returns the path of the new backup.
*/ */
QString backup() const; [[nodiscard]] QString backup() const;
bool exists(); bool exists();
QString defaultConnection() const; [[nodiscard]] QString defaultConnection() const;
// the certs do not depend on a connection. // the certs do not depend on a connection.
QByteArray caCerts(); QByteArray caCerts();
@ -66,49 +66,49 @@ public:
bool passwordStorageAllowed(const QString &connection = QString()); bool passwordStorageAllowed(const QString &connection = QString());
/* Server poll interval in milliseconds */ /* Server poll interval in milliseconds */
std::chrono::milliseconds remotePollInterval(const QString &connection = QString()) const; [[nodiscard]] std::chrono::milliseconds remotePollInterval(const QString &connection = QString()) const;
/* Set poll interval. Value in milliseconds has to be larger than 5000 */ /* Set poll interval. Value in milliseconds has to be larger than 5000 */
void setRemotePollInterval(std::chrono::milliseconds interval, const QString &connection = QString()); void setRemotePollInterval(std::chrono::milliseconds interval, const QString &connection = QString());
/* Interval to check for new notifications */ /* Interval to check for new notifications */
std::chrono::milliseconds notificationRefreshInterval(const QString &connection = QString()) const; [[nodiscard]] std::chrono::milliseconds notificationRefreshInterval(const QString &connection = QString()) const;
/* Force sync interval, in milliseconds */ /* Force sync interval, in milliseconds */
std::chrono::milliseconds forceSyncInterval(const QString &connection = QString()) const; [[nodiscard]] std::chrono::milliseconds forceSyncInterval(const QString &connection = QString()) const;
/** /**
* Interval in milliseconds within which full local discovery is required * Interval in milliseconds within which full local discovery is required
* *
* Use -1 to disable regular full local discoveries. * Use -1 to disable regular full local discoveries.
*/ */
std::chrono::milliseconds fullLocalDiscoveryInterval() const; [[nodiscard]] std::chrono::milliseconds fullLocalDiscoveryInterval() const;
bool monoIcons() const; [[nodiscard]] bool monoIcons() const;
void setMonoIcons(bool); void setMonoIcons(bool);
bool promptDeleteFiles() const; [[nodiscard]] bool promptDeleteFiles() const;
void setPromptDeleteFiles(bool promptDeleteFiles); void setPromptDeleteFiles(bool promptDeleteFiles);
bool crashReporter() const; [[nodiscard]] bool crashReporter() const;
void setCrashReporter(bool enabled); void setCrashReporter(bool enabled);
bool automaticLogDir() const; [[nodiscard]] bool automaticLogDir() const;
void setAutomaticLogDir(bool enabled); void setAutomaticLogDir(bool enabled);
QString logDir() const; [[nodiscard]] QString logDir() const;
void setLogDir(const QString &dir); void setLogDir(const QString &dir);
bool logDebug() const; [[nodiscard]] bool logDebug() const;
void setLogDebug(bool enabled); void setLogDebug(bool enabled);
int logExpire() const; [[nodiscard]] int logExpire() const;
void setLogExpire(int hours); void setLogExpire(int hours);
bool logFlush() const; [[nodiscard]] bool logFlush() const;
void setLogFlush(bool enabled); void setLogFlush(bool enabled);
// Whether experimental UI options should be shown // Whether experimental UI options should be shown
bool showExperimentalOptions() const; [[nodiscard]] bool showExperimentalOptions() const;
// proxy settings // proxy settings
void setProxyType(int proxyType, void setProxyType(int proxyType,
@ -117,86 +117,86 @@ public:
const QString &user = QString(), const QString &user = QString(),
const QString &pass = QString()); const QString &pass = QString());
int proxyType() const; [[nodiscard]] int proxyType() const;
QString proxyHostName() const; [[nodiscard]] QString proxyHostName() const;
int proxyPort() const; [[nodiscard]] int proxyPort() const;
bool proxyNeedsAuth() const; [[nodiscard]] bool proxyNeedsAuth() const;
QString proxyUser() const; [[nodiscard]] QString proxyUser() const;
QString proxyPassword() const; [[nodiscard]] QString proxyPassword() const;
/** 0: no limit, 1: manual, >0: automatic */ /** 0: no limit, 1: manual, >0: automatic */
int useUploadLimit() const; [[nodiscard]] int useUploadLimit() const;
int useDownloadLimit() const; [[nodiscard]] int useDownloadLimit() const;
void setUseUploadLimit(int); void setUseUploadLimit(int);
void setUseDownloadLimit(int); void setUseDownloadLimit(int);
/** in kbyte/s */ /** in kbyte/s */
int uploadLimit() const; [[nodiscard]] int uploadLimit() const;
int downloadLimit() const; [[nodiscard]] int downloadLimit() const;
void setUploadLimit(int kbytes); void setUploadLimit(int kbytes);
void setDownloadLimit(int kbytes); void setDownloadLimit(int kbytes);
/** [checked, size in MB] **/ /** [checked, size in MB] **/
QPair<bool, qint64> newBigFolderSizeLimit() const; [[nodiscard]] QPair<bool, qint64> newBigFolderSizeLimit() const;
void setNewBigFolderSizeLimit(bool isChecked, qint64 mbytes); void setNewBigFolderSizeLimit(bool isChecked, qint64 mbytes);
bool useNewBigFolderSizeLimit() const; [[nodiscard]] bool useNewBigFolderSizeLimit() const;
bool confirmExternalStorage() const; [[nodiscard]] bool confirmExternalStorage() const;
void setConfirmExternalStorage(bool); void setConfirmExternalStorage(bool);
/** If we should move the files deleted on the server in the trash */ /** If we should move the files deleted on the server in the trash */
bool moveToTrash() const; [[nodiscard]] bool moveToTrash() const;
void setMoveToTrash(bool); void setMoveToTrash(bool);
bool showMainDialogAsNormalWindow() const; [[nodiscard]] bool showMainDialogAsNormalWindow() const;
static bool setConfDir(const QString &value); static bool setConfDir(const QString &value);
bool optionalServerNotifications() const; [[nodiscard]] bool optionalServerNotifications() const;
void setOptionalServerNotifications(bool show); void setOptionalServerNotifications(bool show);
bool showCallNotifications() const; [[nodiscard]] bool showCallNotifications() const;
void setShowCallNotifications(bool show); void setShowCallNotifications(bool show);
bool showInExplorerNavigationPane() const; [[nodiscard]] bool showInExplorerNavigationPane() const;
void setShowInExplorerNavigationPane(bool show); void setShowInExplorerNavigationPane(bool show);
int timeout() const; [[nodiscard]] int timeout() const;
qint64 chunkSize() const; [[nodiscard]] qint64 chunkSize() const;
qint64 maxChunkSize() const; [[nodiscard]] qint64 maxChunkSize() const;
qint64 minChunkSize() const; [[nodiscard]] qint64 minChunkSize() const;
std::chrono::milliseconds targetChunkUploadDuration() const; [[nodiscard]] std::chrono::milliseconds targetChunkUploadDuration() const;
void saveGeometry(QWidget *w); void saveGeometry(QWidget *w);
void restoreGeometry(QWidget *w); void restoreGeometry(QWidget *w);
// how often the check about new versions runs // how often the check about new versions runs
std::chrono::milliseconds updateCheckInterval(const QString &connection = QString()) const; [[nodiscard]] std::chrono::milliseconds updateCheckInterval(const QString &connection = QString()) const;
// skipUpdateCheck completely disables the updater and hides its UI // skipUpdateCheck completely disables the updater and hides its UI
bool skipUpdateCheck(const QString &connection = QString()) const; [[nodiscard]] bool skipUpdateCheck(const QString &connection = QString()) const;
void setSkipUpdateCheck(bool, const QString &); void setSkipUpdateCheck(bool, const QString &);
// autoUpdateCheck allows the user to make the choice in the UI // autoUpdateCheck allows the user to make the choice in the UI
bool autoUpdateCheck(const QString &connection = QString()) const; [[nodiscard]] bool autoUpdateCheck(const QString &connection = QString()) const;
void setAutoUpdateCheck(bool, const QString &); void setAutoUpdateCheck(bool, const QString &);
/** Query-parameter 'updatesegment' for the update check, value between 0 and 99. /** Query-parameter 'updatesegment' for the update check, value between 0 and 99.
Used to throttle down desktop release rollout in order to keep the update servers alive at peak times. Used to throttle down desktop release rollout in order to keep the update servers alive at peak times.
See: https://github.com/nextcloud/client_updater_server/pull/36 */ See: https://github.com/nextcloud/client_updater_server/pull/36 */
int updateSegment() const; [[nodiscard]] int updateSegment() const;
QString updateChannel() const; [[nodiscard]] QString updateChannel() const;
void setUpdateChannel(const QString &channel); void setUpdateChannel(const QString &channel);
void saveGeometryHeader(QHeaderView *header); void saveGeometryHeader(QHeaderView *header);
void restoreGeometryHeader(QHeaderView *header); void restoreGeometryHeader(QHeaderView *header);
QString certificatePath() const; [[nodiscard]] QString certificatePath() const;
void setCertificatePath(const QString &cPath); void setCertificatePath(const QString &cPath);
QString certificatePasswd() const; [[nodiscard]] QString certificatePasswd() const;
void setCertificatePasswd(const QString &cPasswd); void setCertificatePasswd(const QString &cPasswd);
/** The client version that last used this settings file. /** The client version that last used this settings file.
Updated by configVersionMigration() at client startup. */ Updated by configVersionMigration() at client startup. */
QString clientVersionString() const; [[nodiscard]] QString clientVersionString() const;
void setClientVersionString(const QString &version); void setClientVersionString(const QString &version);
/** Returns a new settings pre-set in a specific group. The Settings will be created /** Returns a new settings pre-set in a specific group. The Settings will be created
@ -207,18 +207,18 @@ public:
static void setupDefaultExcludeFilePaths(ExcludedFiles &excludedFiles); static void setupDefaultExcludeFilePaths(ExcludedFiles &excludedFiles);
protected: protected:
QVariant getPolicySetting(const QString &policy, const QVariant &defaultValue = QVariant()) const; [[nodiscard]] QVariant getPolicySetting(const QString &policy, const QVariant &defaultValue = QVariant()) const;
void storeData(const QString &group, const QString &key, const QVariant &value); void storeData(const QString &group, const QString &key, const QVariant &value);
QVariant retrieveData(const QString &group, const QString &key) const; [[nodiscard]] QVariant retrieveData(const QString &group, const QString &key) const;
void removeData(const QString &group, const QString &key); void removeData(const QString &group, const QString &key);
bool dataExists(const QString &group, const QString &key) const; [[nodiscard]] bool dataExists(const QString &group, const QString &key) const;
private: private:
QVariant getValue(const QString &param, const QString &group = QString(), [[nodiscard]] QVariant getValue(const QString &param, const QString &group = QString(),
const QVariant &defaultValue = QVariant()) const; const QVariant &defaultValue = QVariant()) const;
void setValue(const QString &key, const QVariant &value); void setValue(const QString &key, const QVariant &value);
QString keychainProxyPasswordKey() const; [[nodiscard]] QString keychainProxyPasswordKey() const;
private: private:
using SharedCreds = QSharedPointer<AbstractCredentials>; using SharedCreds = QSharedPointer<AbstractCredentials>;

View file

@ -32,7 +32,7 @@ public:
explicit CookieJar(QObject *parent = nullptr); explicit CookieJar(QObject *parent = nullptr);
~CookieJar() override; ~CookieJar() override;
bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url) override; bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url) override;
QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const override; [[nodiscard]] QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const override;
void clearSessionCookies(); void clearSessionCookies();

View file

@ -43,16 +43,16 @@ public:
*/ */
virtual void setAccount(Account *account); virtual void setAccount(Account *account);
virtual QString authType() const = 0; [[nodiscard]] virtual QString authType() const = 0;
virtual QString user() const = 0; [[nodiscard]] virtual QString user() const = 0;
virtual QString password() const = 0; [[nodiscard]] virtual QString password() const = 0;
virtual QNetworkAccessManager *createQNAM() const = 0; [[nodiscard]] virtual QNetworkAccessManager *createQNAM() const = 0;
/** Whether there are credentials that can be used for a connection attempt. */ /** Whether there are credentials that can be used for a connection attempt. */
virtual bool ready() const = 0; [[nodiscard]] virtual bool ready() const = 0;
/** Whether fetchFromKeychain() was called before. */ /** Whether fetchFromKeychain() was called before. */
bool wasFetched() const { return _wasFetched; } [[nodiscard]] bool wasFetched() const { return _wasFetched; }
/** Trigger (async) fetching of credential information /** Trigger (async) fetching of credential information
* *

View file

@ -26,11 +26,11 @@ class OWNCLOUDSYNC_EXPORT DummyCredentials : public AbstractCredentials
public: public:
QString _user; QString _user;
QString _password; QString _password;
QString authType() const override; [[nodiscard]] QString authType() const override;
QString user() const override; [[nodiscard]] QString user() const override;
QString password() const override; [[nodiscard]] QString password() const override;
QNetworkAccessManager *createQNAM() const override; [[nodiscard]] QNetworkAccessManager *createQNAM() const override;
bool ready() const override; [[nodiscard]] bool ready() const override;
bool stillValid(QNetworkReply *reply) override; bool stillValid(QNetworkReply *reply) override;
void fetchFromKeychain() override; void fetchFromKeychain() override;
void askFromUser() override; void askFromUser() override;

View file

@ -83,15 +83,15 @@ public:
explicit HttpCredentials(const QString &user, const QString &password, explicit HttpCredentials(const QString &user, const QString &password,
const QByteArray &clientCertBundle = QByteArray(), const QByteArray &clientCertPassword = QByteArray()); const QByteArray &clientCertBundle = QByteArray(), const QByteArray &clientCertPassword = QByteArray());
QString authType() const override; [[nodiscard]] QString authType() const override;
QNetworkAccessManager *createQNAM() const override; [[nodiscard]] QNetworkAccessManager *createQNAM() const override;
bool ready() const override; [[nodiscard]] bool ready() const override;
void fetchFromKeychain() override; void fetchFromKeychain() override;
bool stillValid(QNetworkReply *reply) override; bool stillValid(QNetworkReply *reply) override;
void persist() override; void persist() override;
QString user() const override; [[nodiscard]] QString user() const override;
// the password or token // the password or token
QString password() const override; [[nodiscard]] QString password() const override;
void invalidateToken() override; void invalidateToken() override;
void forgetSensitiveData() override; void forgetSensitiveData() override;
QString fetchUser(); QString fetchUser();
@ -106,7 +106,7 @@ public:
void setAccount(Account *account) override; void setAccount(Account *account) override;
// Whether we are using OAuth // Whether we are using OAuth
bool isUsingOAuth() const { return !_refreshToken.isNull(); } [[nodiscard]] bool isUsingOAuth() const { return !_refreshToken.isNull(); }
bool retryIfNeeded(AbstractNetworkJob *) override; bool retryIfNeeded(AbstractNetworkJob *) override;

View file

@ -47,13 +47,13 @@ public:
~Job() override; ~Job() override;
QKeychain::Error error() const; [[nodiscard]] QKeychain::Error error() const;
QString errorString() const; [[nodiscard]] QString errorString() const;
QByteArray binaryData() const; [[nodiscard]] QByteArray binaryData() const;
QString textData() const; [[nodiscard]] QString textData() const;
bool insecureFallback() const; [[nodiscard]] bool insecureFallback() const;
// If we use it but don't support insecure fallback, give us nice compilation errors ;p // If we use it but don't support insecure fallback, give us nice compilation errors ;p
#if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK) #if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK)
@ -64,7 +64,7 @@ public:
* @return Whether this job autodeletes itself once finished() has been emitted. Default is true. * @return Whether this job autodeletes itself once finished() has been emitted. Default is true.
* @see setAutoDelete() * @see setAutoDelete()
*/ */
bool autoDelete() const; [[nodiscard]] bool autoDelete() const;
/** /**
* Set whether this job should autodelete itself once finished() has been emitted. * Set whether this job should autodelete itself once finished() has been emitted.

View file

@ -11,8 +11,8 @@ class OWNCLOUDSYNC_EXPORT DateTimeProvider
public: public:
virtual ~DateTimeProvider(); virtual ~DateTimeProvider();
virtual QDateTime currentDateTime() const; [[nodiscard]] virtual QDateTime currentDateTime() const;
virtual QDate currentDate() const; [[nodiscard]] virtual QDate currentDate() const;
}; };
} }

View file

@ -32,7 +32,7 @@ public:
void start() override; void start() override;
QByteArray folderToken() const; [[nodiscard]] QByteArray folderToken() const;
void setFolderToken(const QByteArray &folderToken); void setFolderToken(const QByteArray &folderToken);
private: private:

View file

@ -96,7 +96,7 @@ public:
_isInsideEncryptedTree = isInsideEncryptedTree; _isInsideEncryptedTree = isInsideEncryptedTree;
} }
bool isInsideEncryptedTree() const [[nodiscard]] bool isInsideEncryptedTree() const
{ {
return _isInsideEncryptedTree; return _isInsideEncryptedTree;
} }
@ -135,7 +135,7 @@ private:
{ {
return base.isEmpty() ? name : base + QLatin1Char('/') + name; return base.isEmpty() ? name : base + QLatin1Char('/') + name;
} }
PathTuple addName(const QString &name) const [[nodiscard]] PathTuple addName(const QString &name) const
{ {
PathTuple result; PathTuple result;
result._original = pathAppend(_original, name); result._original = pathAppend(_original, name);
@ -190,9 +190,9 @@ private:
*/ */
bool checkPermissions(const SyncFileItemPtr &item); bool checkPermissions(const SyncFileItemPtr &item);
bool isAnyParentBeingRestored(const QString &file) const; [[nodiscard]] bool isAnyParentBeingRestored(const QString &file) const;
bool isRename(const QString &originalPath) const; [[nodiscard]] bool isRename(const QString &originalPath) const;
struct MovePermissionResult struct MovePermissionResult
{ {
@ -217,11 +217,11 @@ private:
void dbError(); void dbError();
void addVirtualFileSuffix(QString &str) const; void addVirtualFileSuffix(QString &str) const;
bool hasVirtualFileSuffix(const QString &str) const; [[nodiscard]] bool hasVirtualFileSuffix(const QString &str) const;
void chopVirtualFileSuffix(QString &str) const; void chopVirtualFileSuffix(QString &str) const;
/** Convenience to detect suffix-vfs modes */ /** Convenience to detect suffix-vfs modes */
bool isVfsWithSuffix() const; [[nodiscard]] bool isVfsWithSuffix() const;
/** Start a remote discovery network job /** Start a remote discovery network job
* *

View file

@ -61,7 +61,7 @@ struct RemoteInfo
bool isE2eEncrypted = false; bool isE2eEncrypted = false;
QString e2eMangledName; QString e2eMangledName;
bool isValid() const { return !name.isNull(); } [[nodiscard]] bool isValid() const { return !name.isNull(); }
QString directDownloadUrl; QString directDownloadUrl;
QString directDownloadCookies; QString directDownloadCookies;
@ -88,7 +88,7 @@ struct LocalInfo
bool isHidden = false; bool isHidden = false;
bool isVirtualFile = false; bool isVirtualFile = false;
bool isSymLink = false; bool isSymLink = false;
bool isValid() const { return !name.isNull(); } [[nodiscard]] bool isValid() const { return !name.isNull(); }
}; };
/** /**
@ -222,7 +222,7 @@ class DiscoveryPhase : public QObject
* Useful for avoiding processing of items that have already been claimed in * Useful for avoiding processing of items that have already been claimed in
* a rename (would otherwise be discovered as deletions). * a rename (would otherwise be discovered as deletions).
*/ */
bool isRenamed(const QString &p) const { return _renamedItemsLocal.contains(p) || _renamedItemsRemote.contains(p); } [[nodiscard]] bool isRenamed(const QString &p) const { return _renamedItemsLocal.contains(p) || _renamedItemsRemote.contains(p); }
int _currentlyActiveJobs = 0; int _currentlyActiveJobs = 0;
@ -232,7 +232,7 @@ class DiscoveryPhase : public QObject
void scheduleMoreJobs(); void scheduleMoreJobs();
bool isInSelectiveSyncBlackList(const QString &path) const; [[nodiscard]] bool isInSelectiveSyncBlackList(const QString &path) const;
// Check if the new folder should be deselected or not. // Check if the new folder should be deselected or not.
// May be async. "Return" via the callback, true if the item is blacklisted // May be async. "Return" via the callback, true if the item is blacklisted
@ -244,7 +244,7 @@ class DiscoveryPhase : public QObject
* Note that it only considers parent directory renames. So if A/B got renamed to C/D, * Note that it only considers parent directory renames. So if A/B got renamed to C/D,
* checking A/B/file would yield C/D/file, but checking A/B would yield A/B. * checking A/B/file would yield C/D/file, but checking A/B would yield A/B.
*/ */
QString adjustRenamedPath(const QString &original, SyncFileItem::Direction) const; [[nodiscard]] QString adjustRenamedPath(const QString &original, SyncFileItem::Direction) const;
/** If the db-path is scheduled for deletion, abort it. /** If the db-path is scheduled for deletion, abort it.
* *

View file

@ -33,7 +33,7 @@ public:
explicit EncryptFolderJob(const AccountPtr &account, SyncJournalDb *journal, const QString &path, const QByteArray &fileId, QObject *parent = nullptr); explicit EncryptFolderJob(const AccountPtr &account, SyncJournalDb *journal, const QString &path, const QByteArray &fileId, QObject *parent = nullptr);
void start(); void start();
QString errorString() const; [[nodiscard]] QString errorString() const;
signals: signals:
void finished(int status); void finished(int status);

View file

@ -66,7 +66,7 @@ public:
void startSyncPartialDiscovery(); void startSyncPartialDiscovery();
/** Access list of files that shall be locally rediscovered. */ /** Access list of files that shall be locally rediscovered. */
const std::set<QString> &localDiscoveryPaths() const; [[nodiscard]] const std::set<QString> &localDiscoveryPaths() const;
public slots: public slots:
/** /**

Some files were not shown because too many files have changed in this diff Show more