Debian Codegraph @

src/imports/Lomiri/Contacts/contacts.h

raw ◀ ▶
Source reconstructed at patch state 2 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 <QtVersit/qversitreader.h>
27
28 QTCONTACTS_USE_NAMESPACE
29 QTVERSIT_USE_NAMESPACE
30
31 class ContactsPrivate;
32 class LomiriContacts : public QObject
33 {
34 Q_OBJECT
35 Q_PROPERTY(QString tempPath READ tempPath CONSTANT)
36 Q_PROPERTY(bool updateIsRunning READ updateIsRunning NOTIFY updateIsRunningChanged)
37 Q_PROPERTY(QString aggregateCollectionId READ aggregateCollectionId CONSTANT)
38
39 public:
40 LomiriContacts(QObject *parent = 0);
41 ~LomiriContacts();
42
43 enum ImportError {
44 ImportNoError = QVersitReader::NoError,
45 ImportUnspecifiedError = QVersitReader::UnspecifiedError,
46 ImportIOError = QVersitReader::IOError,
47 ImportOutOfMemoryError = QVersitReader::OutOfMemoryError,
48 ImportNotReadyError = QVersitReader::NotReadyError,
49 ImportParseError = QVersitReader::ParseError
50 };
51 Q_ENUM(ImportError)
52
53 QString tempPath() const;
54 QString aggregateCollectionId() const;
55
56 Q_INVOKABLE QString contactInitialsFromString(const QString &value);
57 Q_INVOKABLE QString normalized(const QString &value);
58 Q_INVOKABLE QString copyImage(const QUrl &imageUrl);
59 Q_INVOKABLE QUrl storeAvatarImage(const QUrl &imageUrl);
60 Q_INVOKABLE bool containsLetters(const QString &value);
61 Q_INVOKABLE bool removeFile(const QUrl &file);
62 Q_INVOKABLE bool updateIsRunning() const;
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
67 Q_SIGNALS:
68 void imageCopyDone(const QString &id, const QString &fileName);
69 void updateIsRunningChanged();
70 void importCompleted(ImportError error, const QStringList &ids);
71
72
73 private Q_SLOTS:
74 void startImport(QVersitReader::State state);
75
76 private:
77 QScopedPointer<ContactsPrivate> d;
78 QScopedPointer<QFileSystemWatcher> m_fileWatcher;
79
80 static QString updaterLockFile();
81 };
82
83
84 #endif //_LOMIRI_CONTACTS_H_