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

Store list of duplicate items

parent c39aaea0
......@@ -69,6 +69,7 @@ set(kaddressbook_xxport_SRCS
)
set(kaddressbook_merge_SRCS
merge/matchcontact.cpp
merge/mergecontacts.cpp
merge/mergecontactsdialog.cpp
merge/searchduplicatecontactwizard.cpp
......
......@@ -17,7 +17,8 @@
#include "matchcontact.h"
MatchContact::MatchContact(const Akonadi::Item &items)
: mListItem(items)
MatchContact::MatchContact(const QList<Akonadi::Item> &items)
: mListItem(items),
mType(None)
{
}
......@@ -22,9 +22,19 @@
struct MatchContact
{
MatchContact(const Akonadi::Item &items);
enum MatchType {
None = 0,
Name = 1,
Emails = 2,
Phone = 4,
NickName = 8
};
Q_ENUMS(MatchType)
Q_DECLARE_FLAGS(MatchTypes, MatchType)
MatchContact(const QList<Akonadi::Item> &items);
QList<Akonadi::Item> mListItem;
MatchType mType;
};
#endif // MATCHCONTACT_H
......@@ -34,14 +34,6 @@ private Q_SLOTS:
void slotSearchDuplicateContactFinished(SearchPotentialDuplicateContactJob *);
private:
enum MatchType {
None = 0,
Name = 1,
Emails = 2,
Phone = 4,
NickName = 8
};
void searchDuplicateContact(const Akonadi::Item::List &list);
};
......
......@@ -41,6 +41,11 @@ void SearchPotentialDuplicateContactJob::start()
Q_EMIT finished(this);
}
QList<QList<Akonadi::Item> > SearchPotentialDuplicateContactJob::potentialDuplicateContacts() const
{
return mListDuplicate;
}
QList<Akonadi::Item> SearchPotentialDuplicateContactJob::checkList(const QList<Akonadi::Item> &lstItem)
{
QList<Akonadi::Item> notDuplicate;
......@@ -56,7 +61,9 @@ QList<Akonadi::Item> SearchPotentialDuplicateContactJob::checkList(const QList<A
}
if (!lst.isEmpty()) {
lst.append(firstItem);
mListDuplicate.append(lst);
}
//qDebug()<<"not duplicate number"<<notDuplicate.count();
//qDebug()<<" duplicate number "<<lst.count();
}
......
......@@ -31,6 +31,8 @@ public:
void start();
QList<QList<Akonadi::Item> > potentialDuplicateContacts() const;
Q_SIGNALS:
void finished(SearchPotentialDuplicateContactJob *);
......@@ -38,6 +40,7 @@ private:
QList<Akonadi::Item> checkList(const QList<Akonadi::Item> &lstItem);
bool isDuplicate(const Akonadi::Item &itemA, const Akonadi::Item &itemB);
Akonadi::Item::List mListItem;
QList<QList<Akonadi::Item> > mListDuplicate;
};
#endif // SEARCHPOTENTIALDUPLICATECONTACTJOB_H
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