blob: c804a064fde1dd2c185474946ce32fad4103b434 [file] [log] [blame]
Edric Milaret67007d12015-05-07 09:40:09 -04001/***************************************************************************
2 * Copyright (C) 2015 by Savoir-Faire Linux *
3 * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17 **************************************************************************/
18
19#ifndef WINDOWSCONTACTBACKEND_H
20#define WINDOWSCONTACTBACKEND_H
21
22#include <QObject>
23#include <QStandardPaths>
24#include <QDir>
25#include <QXmlStreamReader>
26#include <QtConcurrent/QtConcurrent>
Edric Milaretdb76aa82015-05-11 16:01:00 -040027#include <QImage>
Edric Milaret67007d12015-05-07 09:40:09 -040028
29#include "person.h"
30#include "collectioninterface.h"
31#include "contactmethod.h"
32#include "phonedirectorymodel.h"
33
34class WindowsContactBackend : public CollectionInterface
35{
36public:
37 explicit WindowsContactBackend(CollectionMediator<Person>* mediator, CollectionInterface* parent = nullptr);
38 virtual ~WindowsContactBackend();
39
40 virtual bool load() override;
41 virtual bool reload() override;
42 virtual bool clear() override;
43 virtual QString name () const override;
44 virtual QString category () const override;
45 virtual bool isEnabled() const override;
46 virtual QByteArray id () const override;
47 virtual FlagPack<CollectionInterface::SupportedFeatures> supportedFeatures() const override;
48
49private:
50 bool loadRun();
51private:
52 CollectionMediator<Person>* mediator_;
Edric Milaretdb76aa82015-05-11 16:01:00 -040053 constexpr static int sizePhoto_ = 50;
Edric Milaret67007d12015-05-07 09:40:09 -040054};
55
56class WindowsContactEditor : public CollectionEditor<Person>
57{
58public:
59 WindowsContactEditor(CollectionMediator<Person>* m, WindowsContactBackend* parent);
60 ~WindowsContactEditor();
61 virtual bool save ( const Person* item ) override;
62 virtual bool remove ( const Person* item ) override;
63 virtual bool edit ( Person* item ) override;
64 virtual bool addNew ( const Person* item ) override;
65 virtual bool addExisting( const Person* item ) override;
66
67private:
68 virtual QVector<Person*> items() const override;
69
70 QVector<Person*> items_;
71 WindowsContactBackend* collection_;
72};
73
74#endif // WINDOWSCONTACTBACKEND_H