| 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 |
|
| 26 |
class LomiriContacts : public QObject |
| 27 |
{ |
| 28 |
Q_OBJECT |
| 29 |
Q_PROPERTY(QString tempPath READ tempPath) |
| 30 |
Q_PROPERTY(bool updateIsRunning READ updateIsRunning NOTIFY updateIsRunningChanged) |
| 31 |
|
| 32 |
public: |
| 33 |
LomiriContacts(QObject *parent = 0); |
| 34 |
|
| 35 |
QString tempPath() const; |
| 36 |
|
| 37 |
Q_INVOKABLE QString contactInitialsFromString(const QString &value); |
| 38 |
Q_INVOKABLE QString normalized(const QString &value); |
| 39 |
Q_INVOKABLE QString copyImage(const QUrl &imageUrl); |
| 40 |
Q_INVOKABLE QUrl storeAvatarImage(const QUrl &imageUrl); |
| 41 |
Q_INVOKABLE bool containsLetters(const QString &value); |
| 42 |
Q_INVOKABLE bool removeFile(const QUrl &file); |
| 43 |
Q_INVOKABLE bool updateIsRunning() const; |
| 44 |
Q_INVOKABLE QUrl tempFile(const QString &suffix); |
| 45 |
Q_INVOKABLE uint qHash(const QString &str); |
| 46 |
|
| 47 |
Q_SIGNALS: |
| 48 |
void imageCopyDone(const QString &id, const QString &fileName); |
| 49 |
void updateIsRunningChanged(); |
| 50 |
|
| 51 |
private: |
| 52 |
QScopedPointer<QFileSystemWatcher> m_fileWatcher; |
| 53 |
|
| 54 |
static QString updaterLockFile(); |
| 55 |
|
| 56 |
}; |
| 57 |
|
| 58 |
#endif //_LOMIRI_CONTACTS_H_ |