Commit baaac56c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add more Q_REQUIRED_RESULT

parent 437a98ed
Pipeline #148098 passed with stage
in 2 minutes and 25 seconds
......@@ -26,6 +26,6 @@ class SearchPlugin : public QObject, public Akonadi::AbstractSearchPlugin
Q_INTERFACES(Akonadi::AbstractSearchPlugin)
Q_PLUGIN_METADATA(IID "org.kde.akonadi.SearchPlugin" FILE "akonadi_search_plugin.json")
public:
QSet<qint64> search(const QString &query, const QVector<qint64> &collections, const QStringList &mimeTypes) override;
Q_REQUIRED_RESULT QSet<qint64> search(const QString &query, const QVector<qint64> &collections, const QStringList &mimeTypes) override;
};
......@@ -32,7 +32,7 @@ public:
~Query();
void setTerm(const Term &t);
Term term() const;
Q_REQUIRED_RESULT Term term() const;
/**
* Add a type to the results of the query.
......@@ -52,7 +52,7 @@ public:
void setType(const QString &type);
void setTypes(const QStringList &types);
QStringList types() const;
Q_REQUIRED_RESULT QStringList types() const;
/**
* Set some text which should be used to search for Items. This
......@@ -62,17 +62,17 @@ public:
* to give the best possible results.
*/
void setSearchString(const QString &str);
QString searchString() const;
Q_REQUIRED_RESULT QString searchString() const;
/**
* Only a maximum of \p limit results will be returned.
* By default the limit is 100000.
*/
void setLimit(uint limit);
uint limit() const;
Q_REQUIRED_RESULT uint limit() const;
void setOffset(uint offset);
uint offset() const;
Q_REQUIRED_RESULT uint offset() const;
/**
* Filter the results in the specified date range.
......@@ -81,9 +81,9 @@ public:
*/
void setDateFilter(int year, int month = -1, int day = -1);
int yearFilter() const;
int monthFilter() const;
int dayFilter() const;
Q_REQUIRED_RESULT int yearFilter() const;
Q_REQUIRED_RESULT int monthFilter() const;
Q_REQUIRED_RESULT int dayFilter() const;
enum SortingOption {
/**
......@@ -107,14 +107,14 @@ public:
};
void setSortingOption(SortingOption option);
SortingOption sortingOption() const;
Q_REQUIRED_RESULT SortingOption sortingOption() const;
/**
* Sets the property that should be used for sorting. This automatically
* set the sorting mechanism to SortProperty
*/
void setSortingProperty(const QString &property);
QString sortingProperty() const;
Q_REQUIRED_RESULT QString sortingProperty() const;
/**
* Adds a custom option which any search backend could use
......@@ -130,7 +130,7 @@ public:
ResultIterator exec();
QByteArray toJSON() const;
Q_REQUIRED_RESULT QByteArray toJSON() const;
static Query fromJSON(const QByteArray &arr);
QUrl toSearchUrl(const QString &title = QString());
......
......@@ -24,8 +24,6 @@ class Q_DECL_HIDDEN ResultIteratorPrivate : public QSharedData
{
public:
ResultIteratorPrivate()
: queryId(0)
, store(nullptr)
{
}
......@@ -36,8 +34,8 @@ public:
}
}
int queryId;
SearchStore *store;
int queryId = 0;
SearchStore *store = nullptr;
};
/** Result iterator. */
......@@ -55,11 +53,11 @@ public:
bool next();
QByteArray id() const;
QUrl url() const;
Q_REQUIRED_RESULT QByteArray id() const;
Q_REQUIRED_RESULT QUrl url() const;
QString text() const;
QString icon() const;
Q_REQUIRED_RESULT QString text() const;
Q_REQUIRED_RESULT QString icon() const;
private:
QExplicitlySharedDataPointer<ResultIteratorPrivate> d;
......
......@@ -21,7 +21,13 @@ class AKONADI_SEARCH_DEBUG_EXPORT AkonadiSearchDebugSearchPathComboBox : public
Q_OBJECT
public:
explicit AkonadiSearchDebugSearchPathComboBox(QWidget *parent = nullptr);
enum SearchType { Contacts = 0, ContactCompleter, Emails, Notes, Calendars };
enum SearchType {
Contacts = 0,
ContactCompleter,
Emails,
Notes,
Calendars,
};
~AkonadiSearchDebugSearchPathComboBox() override;
Q_REQUIRED_RESULT QString searchPath() const;
......
......@@ -40,7 +40,7 @@ private Q_SLOTS:
void slotError(const QString &errorStr);
private:
QPlainTextEdit *mPlainTextEditor = nullptr;
QPlainTextEdit *const mPlainTextEditor;
AkonadiSearchDebugSearchPathComboBox *const mSearchPathComboBox;
KLineEdit *const mLineEdit;
QPushButton *const mSearchButton;
......
......@@ -38,10 +38,13 @@ public:
void matchUID(const QString &uid);
void match(const QString &str);
enum MatchCriteria { ExactMatch, StartsWithMatch };
enum MatchCriteria {
ExactMatch,
StartsWithMatch,
};
void setMatchCriteria(MatchCriteria m);
MatchCriteria matchCriteria() const;
Q_REQUIRED_RESULT MatchCriteria matchCriteria() const;
ResultIterator exec() override;
......
......@@ -31,7 +31,10 @@ public:
EmailQuery();
~EmailQuery() override;
enum OpType { OpAnd = 0, OpOr };
enum OpType {
OpAnd = 0,
OpOr,
};
void setSplitSearchMatchString(bool split);
......
......@@ -31,7 +31,7 @@ public:
void setOverrideDbPrefixPath(const QString &path);
qlonglong indexedItems(const qlonglong id);
Q_REQUIRED_RESULT qlonglong indexedItems(const qlonglong id);
void findIndexedInDatabase(QSet<Akonadi::Item::Id> &indexed, Akonadi::Collection::Id collectionId, const QString &dbPath);
void findIndexed(QSet<Akonadi::Item::Id> &indexed, Akonadi::Collection::Id collectionId);
......
......@@ -33,7 +33,7 @@ public:
ResultIterator(const ResultIterator &ri);
~ResultIterator();
Akonadi::Item::Id id();
Q_REQUIRED_RESULT Akonadi::Item::Id id();
bool next();
private:
......
......@@ -25,7 +25,7 @@ public:
explicit EmailSearchStore(QObject *parent = nullptr);
Q_REQUIRED_RESULT QStringList types() override;
QString text(int queryId) override;
Q_REQUIRED_RESULT QString text(int queryId) override;
Q_REQUIRED_RESULT QString icon(int) override
{
return QStringLiteral("internet-mail");
......
......@@ -30,13 +30,13 @@ int main(int argc, char **argv)
}
Akonadi::Search::XapianDocument doc;
int size = args.first().toInt();
const int size = args.first().toInt();
for (int i = 0; i < size; i++) {
QByteArray term = QUuid::createUuid().toByteArray().mid(1, 10);
if (parser.isSet(QStringLiteral("p"))) {
std::string stdString(term.constData(), term.length());
const std::string stdString(term.constData(), term.length());
doc.doc().add_posting(stdString, i);
} else {
doc.addTerm(QString::fromUtf8(term));
......
......@@ -28,7 +28,7 @@ int main(int argc, char **argv)
parser.addHelpOption();
parser.process(app);
QStringList args = parser.positionalArguments();
const QStringList args = parser.positionalArguments();
if (args.size() != 1) {
parser.showHelp(1);
}
......@@ -42,13 +42,13 @@ int main(int argc, char **argv)
qDebug() << "Creating the document";
Akonadi::Search::XapianDocument doc;
int size = args.first().toInt();
const int size = args.first().toInt();
for (int i = 0; i < size; i++) {
QByteArray term = QUuid::createUuid().toByteArray().mid(1, 10);
const QByteArray term = QUuid::createUuid().toByteArray().mid(1, 10);
if (parser.isSet(QStringLiteral("p"))) {
std::string stdString(term.constData(), term.length());
const std::string stdString(term.constData(), term.length());
doc.doc().add_posting(stdString, i);
} else {
doc.addTerm(QString::fromUtf8(term));
......
......@@ -26,7 +26,7 @@ public:
void indexText(const QString &text, const QString &prefix, int wdfInc = 1);
void setPosition(int position);
int position() const;
Q_REQUIRED_RESULT int position() const;
void setDocument(Xapian::Document *doc);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment