Debian Codegraph @

src/imports/Lomiri/Contacts/contacts.h

raw ◀ ▶
Source reconstructed at patch state 3 of 4 — not the installed (fully patched) source.
4 Debian patches touch this file
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(bool updateIsRunning READ updateIsRunning NOTIFY updateIsRunningChanged)
38 Q_PROPERTY(QString aggregateCollectionId READ aggregateCollectionId CONSTANT)
39 Q_PROPERTY(QString defaultCollectionId READ defaultCollectionId WRITE setDefaultCollectionId NOTIFY defaultCollectionIdChanged)
40
41 public:
42 LomiriContacts(QObject *parent = 0);
43 ~LomiriContacts();
44
45 enum ImportError {
46 ImportNoError = QVersitReader::NoError,
47 ImportUnspecifiedError = QVersitReader::UnspecifiedError,
48 ImportIOError = QVersitReader::IOError,
49 ImportOutOfMemoryError = QVersitReader::OutOfMemoryError,
50 ImportNotReadyError = QVersitReader::NotReadyError,
51 ImportParseError = QVersitReader::ParseError
52 };
53 Q_ENUM(ImportError)
54
55 QString tempPath() const;
56 QString aggregateCollectionId() const;
57
58 Q_INVOKABLE QString contactInitialsFromString(const QString &value);
59 Q_INVOKABLE QString normalized(const QString &value);
60 Q_INVOKABLE QString copyImage(const QUrl &imageUrl);
61 Q_INVOKABLE QUrl storeAvatarImage(const QUrl &imageUrl);
62 Q_INVOKABLE bool containsLetters(const QString &value);
63 Q_INVOKABLE bool removeFile(const QUrl &file);
64 Q_INVOKABLE bool updateIsRunning() const;
65 Q_INVOKABLE QUrl tempFile(const QString &suffix);
66 Q_INVOKABLE uint qHash(const QString &str);
67 Q_INVOKABLE void importContacts(const QUrl &url);
68 Q_INVOKABLE void removeAggregateContacts(const QStringList &aggregateIds, const QJSValue &callback);
69
70 QString defaultCollectionId() const;
71 void setDefaultCollectionId(const QString &newDefaultCollectionId);
72
73 Q_SIGNALS:
74 void imageCopyDone(const QString &id, const QString &fileName);
75 void updateIsRunningChanged();
76 void importCompleted(ImportError error, const QStringList &ids);
77
78
79 void defaultCollectionIdChanged();
80
81 private Q_SLOTS:
82 void startImport(QVersitReader::State state);
83
84 private:
85 QScopedPointer<ContactsPrivate> d;
86 QScopedPointer<QFileSystemWatcher> m_fileWatcher;
87
88 static QString updaterLockFile();
89 };
90
91
92 #endif //_LOMIRI_CONTACTS_H_