File indexing completed on 2024-05-19 05:11:52
0001 /* 0002 * This file is part of the KDE Akonadi Search Project 0003 * SPDX-FileCopyrightText: 2013 Vishesh Handa <me@vhanda.in> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 * 0007 */ 0008 0009 #pragma once 0010 0011 #include "query.h" 0012 #include "search_pim_export.h" 0013 0014 #include <QString> 0015 0016 #include <memory> 0017 0018 namespace Akonadi 0019 { 0020 namespace Search 0021 { 0022 namespace PIM 0023 { 0024 class ContactQueryPrivate; 0025 0026 /** 0027 * Query for a list of contacts matching a criteria 0028 */ 0029 class AKONADI_SEARCH_PIM_EXPORT ContactQuery : public Query 0030 { 0031 public: 0032 ContactQuery(); 0033 ~ContactQuery() override; 0034 0035 void matchName(const QString &name); 0036 void matchNickname(const QString &nick); 0037 void matchEmail(const QString &email); 0038 void matchUID(const QString &uid); 0039 void match(const QString &str); 0040 0041 enum MatchCriteria { 0042 ExactMatch, 0043 StartsWithMatch, 0044 }; 0045 0046 void setMatchCriteria(MatchCriteria m); 0047 [[nodiscard]] MatchCriteria matchCriteria() const; 0048 0049 ResultIterator exec() override; 0050 0051 [[nodiscard]] int limit() const; 0052 void setLimit(int limit); 0053 0054 private: 0055 std::unique_ptr<ContactQueryPrivate> const d; 0056 }; 0057 } 0058 } 0059 }