File indexing completed on 2024-04-21 15:02:48

0001 /*
0002     KPeople - Duplicates
0003     SPDX-FileCopyrightText: 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-or-later
0006 */
0007 
0008 #ifndef MATCH_H
0009 #define MATCH_H
0010 
0011 #include <QList>
0012 #include <QPersistentModelIndex>
0013 #include <qnamespace.h>
0014 
0015 #include "backends/abstractcontact.h"
0016 #include "kpeople/kpeople_export.h"
0017 
0018 namespace KContacts
0019 {
0020 class Addressee;
0021 }
0022 
0023 namespace KPeople
0024 {
0025 class KPEOPLE_EXPORT Match
0026 {
0027     Q_GADGET
0028 public:
0029     enum MatchReason {
0030         NameMatch,
0031         EmailMatch,
0032     };
0033     Q_ENUM(MatchReason)
0034 
0035     Match()
0036     {
0037     }
0038     Match(const QList<MatchReason> &roles, const QPersistentModelIndex &a, const QPersistentModelIndex &b);
0039     bool operator==(const Match &m) const;
0040     bool operator<(const Match &m) const;
0041     QStringList matchReasons() const;
0042     static QString matchValue(MatchReason r, const AbstractContact::Ptr &addr);
0043     static QList<Match::MatchReason> matchAt(const AbstractContact::Ptr &value, const AbstractContact::Ptr &toCompare);
0044 
0045     QList<MatchReason> reasons;
0046     QPersistentModelIndex indexA, indexB;
0047 };
0048 
0049 }
0050 
0051 Q_DECLARE_METATYPE(KPeople::Match)
0052 
0053 #endif // MATCH_H