Commit 066a5f08 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use Q_REQUIRED_RESULT

parent ab645641
......@@ -341,7 +341,8 @@ void StringUtilTest::test_stripOffMessagePrefixBenchmark()
{
const QString subject = QStringLiteral("Fwd: Hello World Subject");
QBENCHMARK {
StringUtil::stripOffPrefixes(subject);
QString result = StringUtil::stripOffPrefixes(subject);
Q_UNUSED(result);
}
}
......
......@@ -70,7 +70,7 @@ public:
*
* @note does not delete it unless it failed...
*/
AttachmentPart::Ptr compressedPart() const;
Q_REQUIRED_RESULT AttachmentPart::Ptr compressedPart() const;
/**
* Returns whether the compressed part is larger than the original part.
......
......@@ -53,7 +53,7 @@ public:
/**
* Returns the compression method used
*/
KZip::Compression compression() const;
Q_REQUIRED_RESULT KZip::Compression compression() const;
protected Q_SLOTS:
void doStart() override;
......
......@@ -60,7 +60,7 @@ public:
/**
* Returns the mime content to load the attachment from.
*/
const KMime::Content *mimeContent() const;
Q_REQUIRED_RESULT const KMime::Content *mimeContent() const;
protected Q_SLOTS:
void doStart() override;
......
......@@ -37,12 +37,12 @@ public:
/**
* Returns the url that will be loaded as attachment.
*/
QUrl url() const;
Q_REQUIRED_RESULT QUrl url() const;
/**
* Returns the maximum size the attachment is allowed to have.
*/
qint64 maximumAllowedSize() const;
Q_REQUIRED_RESULT qint64 maximumAllowedSize() const;
/**
* Sets the @p url of the folder that will be loaded as attachment.
......
......@@ -24,7 +24,7 @@
namespace MessageCore {
class AttachmentFromUrlBaseJob;
namespace AttachmentFromUrlUtils {
MESSAGECORE_EXPORT MessageCore::AttachmentFromUrlBaseJob *createAttachmentJob(const QUrl &url, QObject *parent);
Q_REQUIRED_RESULT MESSAGECORE_EXPORT MessageCore::AttachmentFromUrlBaseJob *createAttachmentJob(const QUrl &url, QObject *parent);
}
}
......
......@@ -57,7 +57,7 @@ public:
/**
* Returns the loaded attachment.
*/
AttachmentPart::Ptr attachmentPart() const;
Q_REQUIRED_RESULT AttachmentPart::Ptr attachmentPart() const;
protected:
/**
......
......@@ -69,7 +69,7 @@ public:
/**
* Returns the name of the attachment.
*/
QString name() const;
Q_REQUIRED_RESULT QString name() const;
/**
* Sets the file @p name of the attachment.
......@@ -82,7 +82,7 @@ public:
/**
* Returns the file name of the attachment.
*/
QString fileName() const;
Q_REQUIRED_RESULT QString fileName() const;
/**
* Sets the @p description of the attachment.
......@@ -92,7 +92,7 @@ public:
/**
* Returns the description of the attachment.
*/
QString description() const;
Q_REQUIRED_RESULT QString description() const;
/**
* Sets whether the attachment will be displayed inline the message.
......@@ -102,7 +102,7 @@ public:
/**
* Returns whether the attachment will be displayed inline the message.
*/
bool isInline() const;
Q_REQUIRED_RESULT bool isInline() const;
/**
* Sets whether encoding of the attachment will be determined automatically.
......@@ -112,7 +112,7 @@ public:
/**
* Returns whether encoding of the attachment will be determined automatically.
*/
bool isAutoEncoding() const;
Q_REQUIRED_RESULT bool isAutoEncoding() const;
/**
* Sets the @p encoding that will be used for the attachment.
......@@ -124,7 +124,7 @@ public:
/**
* Returns the encoding that will be used for the attachment.
*/
KMime::Headers::contentEncoding encoding() const;
Q_REQUIRED_RESULT KMime::Headers::contentEncoding encoding() const;
/**
* Sets the @p charset that will be used for the attachment.
......@@ -134,7 +134,7 @@ public:
/**
* Returns the charset that will be used for the attachment.
*/
QByteArray charset() const;
Q_REQUIRED_RESULT QByteArray charset() const;
/**
* Sets the @p mimeType of the attachment.
......@@ -144,7 +144,7 @@ public:
/**
* Returns the mime type of the attachment.
*/
QByteArray mimeType() const;
Q_REQUIRED_RESULT QByteArray mimeType() const;
/**
* Sets whether the attachment is @p compressed.
......@@ -154,7 +154,7 @@ public:
/**
* Returns whether the attachment is compressed.
*/
bool isCompressed() const;
Q_REQUIRED_RESULT bool isCompressed() const;
/**
* Sets whether the attachment is @p encrypted.
......@@ -164,7 +164,7 @@ public:
/**
* Returns whether the attachment is encrypted.
*/
bool isEncrypted() const;
Q_REQUIRED_RESULT bool isEncrypted() const;
/**
* Sets whether the attachment is @p signed.
......@@ -174,7 +174,7 @@ public:
/**
* Returns whether the attachment is signed.
*/
bool isSigned() const;
Q_REQUIRED_RESULT bool isSigned() const;
/**
* Sets the payload @p data of the attachment.
......@@ -184,21 +184,21 @@ public:
/**
* Returns the payload data of the attachment.
*/
QByteArray data() const;
Q_REQUIRED_RESULT QByteArray data() const;
/**
* Returns the size of the attachment.
*/
qint64 size() const;
Q_REQUIRED_RESULT qint64 size() const;
/**
* Returns whether the specified attachment part is an encapsulated message
* (message/rfc822) or a collection of encapsulated messages (multipart/digest)
*/
bool isMessageOrMessageCollection() const;
Q_REQUIRED_RESULT bool isMessageOrMessageCollection() const;
void setUrl(const QUrl &url);
QUrl url() const;
Q_REQUIRED_RESULT QUrl url() const;
private:
//@cond PRIVATE
......
......@@ -68,7 +68,7 @@ public:
/**
* Returns the modified attachment.
*/
AttachmentPart::Ptr attachmentPart() const;
Q_REQUIRED_RESULT AttachmentPart::Ptr attachmentPart() const;
/**
* Sets whether the encryption status of the attachment can be changed.
......@@ -78,7 +78,7 @@ public:
/**
* Returns whether the encryption status of the attachment can be changed.
*/
bool isEncryptEnabled() const;
Q_REQUIRED_RESULT bool isEncryptEnabled() const;
/**
* Sets whether the signature status of the attachment can be changed.
......@@ -88,7 +88,7 @@ public:
/**
* Returns whether the signature status of the attachment can be changed.
*/
bool isSignEnabled() const;
Q_REQUIRED_RESULT bool isSignEnabled() const;
public Q_SLOTS:
void accept() override;
......
......@@ -33,8 +33,8 @@ public:
~AttachmentUpdateJob() override;
void start() override;
AttachmentPart::Ptr originalPart() const;
AttachmentPart::Ptr updatedPart() const;
Q_REQUIRED_RESULT AttachmentPart::Ptr originalPart() const;
Q_REQUIRED_RESULT AttachmentPart::Ptr updatedPart() const;
private:
//@cond PRIVATE
class Private;
......
......@@ -34,19 +34,19 @@ public:
void updateColors();
QColor misspelledDefaultTextColor() const;
QColor quoteLevel1DefaultTextColor() const;
QColor quoteLevel2DefaultTextColor() const;
QColor quoteLevel3DefaultTextColor() const;
QColor pgpSignedTrustedMessageColor() const;
QColor pgpSignedTrustedTextColor() const;
QColor pgpSignedUntrustedMessageColor() const;
QColor pgpSignedUntrustedTextColor() const;
QColor pgpSignedBadMessageColor() const;
QColor pgpSignedBadTextColor() const;
QColor pgpEncryptedMessageColor() const;
QColor pgpEncryptedTextColor() const;
QColor linkColor() const;
Q_REQUIRED_RESULT QColor misspelledDefaultTextColor() const;
Q_REQUIRED_RESULT QColor quoteLevel1DefaultTextColor() const;
Q_REQUIRED_RESULT QColor quoteLevel2DefaultTextColor() const;
Q_REQUIRED_RESULT QColor quoteLevel3DefaultTextColor() const;
Q_REQUIRED_RESULT QColor pgpSignedTrustedMessageColor() const;
Q_REQUIRED_RESULT QColor pgpSignedTrustedTextColor() const;
Q_REQUIRED_RESULT QColor pgpSignedUntrustedMessageColor() const;
Q_REQUIRED_RESULT QColor pgpSignedUntrustedTextColor() const;
Q_REQUIRED_RESULT QColor pgpSignedBadMessageColor() const;
Q_REQUIRED_RESULT QColor pgpSignedBadTextColor() const;
Q_REQUIRED_RESULT QColor pgpEncryptedMessageColor() const;
Q_REQUIRED_RESULT QColor pgpEncryptedTextColor() const;
Q_REQUIRED_RESULT QColor linkColor() const;
private:
void initializeColors();
......
......@@ -73,7 +73,7 @@ public:
/**
* Returns the collected images.
*/
const std::vector<KMime::Content *> &images() const;
Q_REQUIRED_RESULT const std::vector<KMime::Content *> &images() const;
private:
//@cond PRIVATE
......
......@@ -74,7 +74,7 @@ public:
*/
MailingList &operator=(const MailingList &other);
bool operator==(const MailingList &other) const;
Q_REQUIRED_RESULT bool operator==(const MailingList &other) const;
/**
* Destroys the mailing list.
*/
......@@ -83,7 +83,7 @@ public:
/**
* Returns the features the mailing list supports.
*/
Features features() const;
Q_REQUIRED_RESULT Features features() const;
/**
* Sets the @p handler for the mailing list.
......@@ -93,7 +93,7 @@ public:
/**
* Returns the handler for the mailing list.
*/
Handler handler() const;
Q_REQUIRED_RESULT Handler handler() const;
/**
* Sets the list of List-Post @p urls.
......@@ -103,7 +103,7 @@ public:
/**
* Returns the list of List-Post urls.
*/
QList<QUrl> postUrls() const;
Q_REQUIRED_RESULT QList<QUrl> postUrls() const;
/**
* Sets the list of List-Subscribe @p urls.
......@@ -113,7 +113,7 @@ public:
/**
* Returns the list of List-Subscribe urls.
*/
QList<QUrl> subscribeUrls() const;
Q_REQUIRED_RESULT QList<QUrl> subscribeUrls() const;
/**
* Sets the list of List-Unsubscribe @p urls.
......@@ -123,7 +123,7 @@ public:
/**
* Returns the list of List-Unsubscribe urls.
*/
QList<QUrl> unsubscribeUrls() const;
Q_REQUIRED_RESULT QList<QUrl> unsubscribeUrls() const;
/**
* Sets the list of List-Help @p urls.
......@@ -133,7 +133,7 @@ public:
/**
* Returns the list of List-Help urls.
*/
QList<QUrl> helpUrls() const;
Q_REQUIRED_RESULT QList<QUrl> helpUrls() const;
/**
* Sets the list of List-Archive @p urls.
......@@ -143,7 +143,7 @@ public:
/**
* Returns the list of List-Archive urls.
*/
QList<QUrl> archiveUrls() const;
Q_REQUIRED_RESULT QList<QUrl> archiveUrls() const;
/**
* Sets the list of List-Owner @p urls.
......@@ -153,7 +153,7 @@ public:
/**
* Returns the list of List-Owner urls.
*/
QList<QUrl> ownerUrls() const;
Q_REQUIRED_RESULT QList<QUrl> ownerUrls() const;
/**
* Sets the Archived-At @p url.
......@@ -163,7 +163,7 @@ public:
/**
* Returns the Archived-At @p url.
*/
QList<QUrl> archivedAtUrls() const;
Q_REQUIRED_RESULT QList<QUrl> archivedAtUrls() const;
/**
* Sets the @p id of the mailing list.
......@@ -173,7 +173,7 @@ public:
/**
* Returns the @p id of the mailing list.
*/
QString id() const;
Q_REQUIRED_RESULT QString id() const;
/**
* Saves the configuration for the mailing list to the config @p group.
......
......@@ -49,26 +49,26 @@ namespace StringUtil {
/**
* Parses a mailto: url and extracts the information in the QMap (field name as key).
*/
MESSAGECORE_EXPORT QMap<QString, QString> parseMailtoUrl(const QUrl &url);
Q_REQUIRED_RESULT MESSAGECORE_EXPORT QMap<QString, QString> parseMailtoUrl(const QUrl &url);
/**
* Strips the signature blocks from a message text. "-- " is considered as a signature block separator.
*
* @param message The message to remove the signature block from.
*/
MESSAGECORE_EXPORT QString stripSignature(const QString &message);
Q_REQUIRED_RESULT MESSAGECORE_EXPORT QString stripSignature(const QString &message);
/**
* Splits the given address list @p text into separate addresses.
*/
MESSAGECORE_EXPORT KMime::Types::AddressList splitAddressField(const QByteArray &text);
Q_REQUIRED_RESULT MESSAGECORE_EXPORT KMime::Types::AddressList splitAddressField(const QByteArray &text);
/**
* Generates the Message-Id. It uses either the Message-Id @p suffix
* defined by the user or the given email address as suffix. The @p address
* must be given as addr-spec as defined in RFC 2822.
*/
MESSAGECORE_EXPORT QString generateMessageId(const QString &address, const QString &suffix);
Q_REQUIRED_RESULT MESSAGECORE_EXPORT QString generateMessageId(const QString &address, const QString &suffix);
/**
* Quotes the following characters which have a special meaning in HTML:
......@@ -76,7 +76,7 @@ MESSAGECORE_EXPORT QString generateMessageId(const QString &address, const QStri
* @p removeLineBreaks is false. If @p removeLineBreaks is true, then
* '\\n' is removed. Last but not least '\\r' is removed.
*/
MESSAGECORE_EXPORT QString quoteHtmlChars(const QString &text, bool removeLineBreaks = false);
Q_REQUIRED_RESULT MESSAGECORE_EXPORT QString quoteHtmlChars(const QString &text, bool removeLineBreaks = false);
/**
* Removes all private header fields (e.g. *Status: and X-KMail-*) from the given @p message.
......@@ -87,12 +87,12 @@ MESSAGECORE_EXPORT void removePrivateHeaderFields(const KMime::Message::Ptr &mes
/**
* Returns the @p message contents with the headers that should not be sent stripped off.
*/
MESSAGECORE_EXPORT QByteArray asSendableString(const KMime::Message::Ptr &message);
Q_REQUIRED_RESULT MESSAGECORE_EXPORT QByteArray asSendableString(const KMime::Message::Ptr &message);
/**
* Return the message header with the headers that should not be sent stripped off.
*/
MESSAGECORE_EXPORT QByteArray headerAsSendableString(const KMime::Message::Ptr &message);
Q_REQUIRED_RESULT MESSAGECORE_EXPORT QByteArray headerAsSendableString(const KMime::Message::Ptr &message);
/**
* Used to determine if the visible part of the anchor contains
......@@ -130,34 +130,34 @@ enum AddressMode {
* @p The number of addresses to show before collapsing the rest, if expandable is set to
* ExpandableAddresses.
*/
MESSAGECORE_EXPORT QString emailAddrAsAnchor(const KMime::Headers::Generics::MailboxList *mailboxList, Display display = DisplayNameOnly,
Q_REQUIRED_RESULT MESSAGECORE_EXPORT QString emailAddrAsAnchor(const KMime::Headers::Generics::MailboxList *mailboxList, Display display = DisplayNameOnly,
const QString &cssStyle = QString(), Link link = ShowLink, AddressMode expandable = FullAddresses,
const QString &fieldName = QString(), int collapseNumber = 4);
/**
* Same as above method, only for AddressList headers.
*/
MESSAGECORE_EXPORT QString emailAddrAsAnchor(const KMime::Headers::Generics::AddressList *addressList, Display display = DisplayNameOnly,
Q_REQUIRED_RESULT MESSAGECORE_EXPORT QString emailAddrAsAnchor(const KMime::Headers::Generics::AddressList *addressList, Display display = DisplayNameOnly,
const QString &cssStyle = QString(), Link link = ShowLink, AddressMode expandable = FullAddresses,
const QString &fieldName = QString(), int collapseNumber = 4);
/**
* Same as the above, only for Mailbox::List types.
*/
MESSAGECORE_EXPORT QString emailAddrAsAnchor(const QVector<KMime::Types::Mailbox> &mailboxList, Display display = DisplayNameOnly,
Q_REQUIRED_RESULT MESSAGECORE_EXPORT QString emailAddrAsAnchor(const QVector<KMime::Types::Mailbox> &mailboxList, Display display = DisplayNameOnly,
const QString &cssStyle = QString(), Link link = ShowLink, AddressMode expandable = FullAddresses,
const QString &fieldName = QString(), int collapseNumber = 4);
/**
* Returns true if the given address is contained in the given address list.
*/
MESSAGECORE_EXPORT bool addressIsInAddressList(const QString &address, const QStringList &addresses);
Q_REQUIRED_RESULT MESSAGECORE_EXPORT bool addressIsInAddressList(const QString &address, const QStringList &addresses);
/**
* Uses the hostname as domain part and tries to determine the real name
* from the entries in the password file.
*/
MESSAGECORE_EXPORT QString guessEmailAddressFromLoginName(const QString &userName);
Q_REQUIRED_RESULT MESSAGECORE_EXPORT QString guessEmailAddressFromLoginName(const QString &userName);
/**
* Relayouts the given string so that the invidual lines don't exceed the given
......@@ -174,27 +174,27 @@ MESSAGECORE_EXPORT QString guessEmailAddressFromLoginName(const QString &userNam
* @param maxLineLength reformat text to be this amount of columns at maximum. Note that this
* also includes the trailing \n!
*/
MESSAGECORE_EXPORT QString smartQuote(const QString &message, int maxLineLength);
Q_REQUIRED_RESULT MESSAGECORE_EXPORT QString smartQuote(const QString &message, int maxLineLength);
/**
* Convert quote wildcards into the final quote prefix.
* @param wildString the string to be converted
* @param fromDisplayString displayable string of the from email address
*/
MESSAGECORE_EXPORT QString formatQuotePrefix(const QString &wildString, const QString &fromDisplayString);
Q_REQUIRED_RESULT MESSAGECORE_EXPORT QString formatQuotePrefix(const QString &wildString, const QString &fromDisplayString);
/**
* Cleans a filename by replacing characters not allowed or wanted on the filesystem
* e.g. ':', '/', '\' with '_'
*/
MESSAGECORE_EXPORT QString cleanFileName(const QString &fileName);
Q_REQUIRED_RESULT MESSAGECORE_EXPORT QString cleanFileName(const QString &fileName);
/**
* Removes the forward and reply markes (e.g. Re: or Fwd:) from a @p subject string.
* Additional markers to act on can be specified in the MessageCore::GlobalSettings
* object.
*/
MESSAGECORE_EXPORT QString stripOffPrefixes(const QString &subject);
Q_REQUIRED_RESULT MESSAGECORE_EXPORT QString stripOffPrefixes(const QString &subject);
MESSAGECORE_EXPORT void setEncodingFile(QUrl &url, const QString &encoding);
}
......
......@@ -142,7 +142,7 @@ public:
/**
* Returns the currently set Grouping option.
*/
Grouping grouping() const;
Q_REQUIRED_RESULT Grouping grouping() const;
/**
* Sets the Grouping option.
......@@ -162,7 +162,7 @@ public:
/**
* Returns the current GroupExpandPolicy.
*/
GroupExpandPolicy groupExpandPolicy() const
Q_REQUIRED_RESULT GroupExpandPolicy groupExpandPolicy() const
{
return mGroupExpandPolicy;
}
......@@ -187,7 +187,7 @@ public:
/**
* Returns the current threading method.
*/
Threading threading() const
Q_REQUIRED_RESULT Threading threading() const
{
return mThreading;
}
......@@ -210,7 +210,7 @@ public:
/**
* Returns the current thread leader determination method.
*/
ThreadLeader threadLeader() const
Q_REQUIRED_RESULT ThreadLeader threadLeader() const
{
return mThreadLeader;
}
......@@ -263,7 +263,7 @@ public:
/**
* Returns the current fill view strategy.
*/
FillViewStrategy fillViewStrategy() const
Q_REQUIRED_RESULT FillViewStrategy fillViewStrategy() const
{
return mFillViewStrategy;
}
......
......@@ -38,7 +38,7 @@ protected:
/**
* Returns the Item for the specified model index. Reimplemented from ThemeDelegate.
*/
Item *itemFromIndex(const QModelIndex &index) const override;
Q_REQUIRED_RESULT Item *itemFromIndex(const QModelIndex &index) const override;
};
} // namespace Core
} // namespace MessageList
......
......@@ -49,12 +49,12 @@ public:
* Returns true if the specified parameters match this filter and false otherwise.
* The msg pointer must not be null.
*/
bool match(const MessageItem *item) const;
Q_REQUIRED_RESULT bool match(const MessageItem *item) const;
/**
* Returns the currently set status mask
*/
QList<Akonadi::MessageStatus> status() const
Q_REQUIRED_RESULT QList<Akonadi::MessageStatus> status() const
{
return mStatus;
}
......@@ -110,9 +110,9 @@ public:
* Returns true if this filter is empty (0 status mask, empty search string and empty tag)
* and it's useless to call match() that will always return true.
*/
bool isEmpty() const;
Q_REQUIRED_RESULT bool isEmpty() const;
QuickSearchLine::SearchOptions currentOptions() const;
Q_REQUIRED_RESULT QuickSearchLine::SearchOptions currentOptions() const;
Q_SIGNALS:
void finished();
......
......@@ -33,7 +33,7 @@ public:
explicit GroupHeaderItem(const QString &label);
~GroupHeaderItem() override;
const QString &label() const;
Q_REQUIRED_RESULT const QString &label() const;
void setLabel(const QString &label);
private:
......
......@@ -86,12 +86,12 @@ public:
/**
* Returns the type of this item. The Type can be set only in the constructor.
*/
Type type() const;
Q_REQUIRED_RESULT Type type() const;
/**
* The initial expand status we have to honor when attacching to the viewable root.
*/
InitialExpandStatus initialExpandStatus() const;
Q_REQUIRED_RESULT InitialExpandStatus initialExpandStatus() const;
/**
* Set the initial expand status we have to honor when attacching to the viewable root.
......@@ -101,13 +101,13 @@ public:
/**
* Is this item attached to the viewable root ?
*/
bool isViewable() const;
Q_REQUIRED_RESULT bool isViewable() const;
/**
* Return true if Item pointed by it is an ancestor of this item (that is,
* if it is its parent, parent of its parent, parent of its parent of its parent etc...
*/
bool hasAncestor(const Item *it) const;
Q_REQUIRED_RESULT bool hasAncestor(const Item *it) const;
/**
* Makes this item viewable, that is, notifies its existence to any listener
......@@ -120,46 +120,46 @@ public:
/**