| 1 |
/* |
| 2 |
* Copyright (C) 2012-2014 Canonical, Ltd. |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License as published by |
| 6 |
* the Free Software Foundation; version 3. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#ifndef _LOMIRI_CONTACTS_H_ |
| 18 |
#define _LOMIRI_CONTACTS_H_ |
| 19 |
|
| 20 |
#include <QtCore/QObject> |
| 21 |
#include <QtCore/QString> |
| 22 |
#include <QtCore/QUrl> |
| 23 |
#include <QtCore/QScopedPointer> |
| 24 |
#include <QtCore/QFileSystemWatcher> |
| •25 |
#include <QContactAbstractRequest> |
| •26 |
#include <QJSValue> |
| 27 |
#include <QtVersit/qversitreader.h> |
| •28 |
|
| 29 |
QTCONTACTS_USE_NAMESPACE |
| 30 |
QTVERSIT_USE_NAMESPACE |
| 31 |
|
| 32 |
class ContactsPrivate; |
| 33 |
class LomiriContacts : public QObject |
| 34 |
{ |
| 35 |
Q_OBJECT |
| •36 |
Q_PROPERTY(QString tempPath READ tempPath CONSTANT) |
| 37 |
Q_PROPERTY(QString aggregateCollectionId READ aggregateCollectionId CONSTANT) |
| •38 |
Q_PROPERTY(QString defaultCollectionId READ defaultCollectionId WRITE setDefaultCollectionId NOTIFY defaultCollectionIdChanged) |
| •39 |
|
| 40 |
public: |
| 41 |
LomiriContacts(QObject *parent = 0); |
| •42 |
~LomiriContacts(); |
| 43 |
|
| 44 |
enum ImportError { |
| 45 |
ImportNoError = QVersitReader::NoError, |
| 46 |
ImportUnspecifiedError = QVersitReader::UnspecifiedError, |
| 47 |
ImportIOError = QVersitReader::IOError, |
| 48 |
ImportOutOfMemoryError = QVersitReader::OutOfMemoryError, |
| 49 |
ImportNotReadyError = QVersitReader::NotReadyError, |
| 50 |
ImportParseError = QVersitReader::ParseError |
| 51 |
}; |
| 52 |
Q_ENUM(ImportError) |
| 53 |
|
| 54 |
QString tempPath() const; |
| •55 |
QString aggregateCollectionId() const; |
| 56 |
|
| 57 |
Q_INVOKABLE QString contactInitialsFromString(const QString &value); |
| 58 |
Q_INVOKABLE QString normalized(const QString &value); |
| 59 |
Q_INVOKABLE QString copyImage(const QUrl &imageUrl); |
| •60 |
Q_INVOKABLE QUrl storeAvatarImage(const QUrl &imageUrl); |
| 61 |
Q_INVOKABLE bool containsLetters(const QString &value); |
| 62 |
Q_INVOKABLE bool removeFile(const QUrl &file); |
| 63 |
Q_INVOKABLE QUrl tempFile(const QString &suffix); |
| 64 |
Q_INVOKABLE uint qHash(const QString &str); |
| 65 |
Q_INVOKABLE void importContacts(const QUrl &url); |
| •66 |
Q_INVOKABLE void removeAggregateContacts(const QStringList &aggregateIds, const QJSValue &callback); |
| 67 |
|
| 68 |
QString defaultCollectionId() const; |
| 69 |
void setDefaultCollectionId(const QString &newDefaultCollectionId); |
| 70 |
|
| 71 |
Q_SIGNALS: |
| 72 |
void imageCopyDone(const QString &id, const QString &fileName); |
| 73 |
void importCompleted(ImportError error, const QStringList &ids); |
| •74 |
|
| 75 |
|
| •76 |
void defaultCollectionIdChanged(); |
| 77 |
|
| 78 |
private Q_SLOTS: |
| 79 |
void startImport(QVersitReader::State state); |
| 80 |
|
| 81 |
private: |
| 82 |
QScopedPointer<ContactsPrivate> d; |
| •83 |
|
| 84 |
}; |
| 85 |
|
| 86 |
|
| 87 |
#endif //_LOMIRI_CONTACTS_H_ |