/* * Copyright (C) 2012-2014 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef _LOMIRI_CONTACTS_H_ #define _LOMIRI_CONTACTS_H_ #include #include #include #include #include #include #include #include QTCONTACTS_USE_NAMESPACE QTVERSIT_USE_NAMESPACE class ContactsPrivate; class LomiriContacts : public QObject { Q_OBJECT Q_PROPERTY(QString tempPath READ tempPath CONSTANT) Q_PROPERTY(QString aggregateCollectionId READ aggregateCollectionId CONSTANT) Q_PROPERTY(QString defaultCollectionId READ defaultCollectionId WRITE setDefaultCollectionId NOTIFY defaultCollectionIdChanged) public: LomiriContacts(QObject *parent = 0); ~LomiriContacts(); enum ImportError { ImportNoError = QVersitReader::NoError, ImportUnspecifiedError = QVersitReader::UnspecifiedError, ImportIOError = QVersitReader::IOError, ImportOutOfMemoryError = QVersitReader::OutOfMemoryError, ImportNotReadyError = QVersitReader::NotReadyError, ImportParseError = QVersitReader::ParseError }; Q_ENUM(ImportError) QString tempPath() const; QString aggregateCollectionId() const; Q_INVOKABLE QString contactInitialsFromString(const QString &value); Q_INVOKABLE QString normalized(const QString &value); Q_INVOKABLE QString copyImage(const QUrl &imageUrl); Q_INVOKABLE QUrl storeAvatarImage(const QUrl &imageUrl); Q_INVOKABLE bool containsLetters(const QString &value); Q_INVOKABLE bool removeFile(const QUrl &file); Q_INVOKABLE QUrl tempFile(const QString &suffix); Q_INVOKABLE uint qHash(const QString &str); Q_INVOKABLE void importContacts(const QUrl &url); Q_INVOKABLE void removeAggregateContacts(const QStringList &aggregateIds, const QJSValue &callback); QString defaultCollectionId() const; void setDefaultCollectionId(const QString &newDefaultCollectionId); Q_SIGNALS: void imageCopyDone(const QString &id, const QString &fileName); void importCompleted(ImportError error, const QStringList &ids); void defaultCollectionIdChanged(); private Q_SLOTS: void startImport(QVersitReader::State state); private: QScopedPointer d; }; #endif //_LOMIRI_CONTACTS_H_