| 1 |
/* |
| 2 |
* This file is part of buteo-sync-plugins package |
| 3 |
* |
| 4 |
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 5 |
* Copyright (C) 2013 - 2021 Jolla Ltd. |
| 6 |
* |
| 7 |
* This library is free software; you can redistribute it and/or |
| 8 |
* modify it under the terms of the GNU Lesser General Public License |
| 9 |
* version 2.1 as published by the Free Software Foundation. |
| 10 |
* |
| 11 |
* This library is distributed in the hope that it will be useful, but |
| 12 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Lesser General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU Lesser General Public |
| 17 |
* License along with this library; if not, write to the Free Software |
| 18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 19 |
* 02110-1301 USA |
| 20 |
* |
| 21 |
*/ |
| 22 |
#ifndef CONTACTSCHANGENOTIFIERPLUGIN_H |
| 23 |
#define CONTACTSCHANGENOTIFIERPLUGIN_H |
| 24 |
|
| 25 |
#include "StorageChangeNotifierPlugin.h" |
| 26 |
#include "StorageChangeNotifierPluginLoader.h" |
| 27 |
|
| 28 |
class ContactsChangeNotifier; |
| 29 |
|
| 30 |
class ContactsChangeNotifierPlugin : public Buteo::StorageChangeNotifierPlugin |
| 31 |
{ |
| 32 |
Q_OBJECT |
| 33 |
|
| 34 |
public: |
| 35 |
/*! \brief constructor |
| 36 |
* see StorageChangeNotifierPlugin |
| 37 |
*/ |
| 38 |
ContactsChangeNotifierPlugin(const QString& aStorageName); |
| 39 |
|
| 40 |
/*! \brief destructor |
| 41 |
*/ |
| 42 |
~ContactsChangeNotifierPlugin(); |
| 43 |
|
| 44 |
/*! \brief see StorageChangeNotifierPlugin::name |
| 45 |
*/ |
| 46 |
QString name() const; |
| 47 |
|
| 48 |
/*! \brief see StorageChangeNotifierPlugin::hasChanges |
| 49 |
*/ |
| 50 |
bool hasChanges() const; |
| 51 |
|
| 52 |
/*! \brief see StorageChangeNotifierPlugin::changesReceived |
| 53 |
*/ |
| 54 |
void changesReceived(); |
| 55 |
|
| 56 |
/*! \brief see StorageChangeNotifierPlugin::enable |
| 57 |
*/ |
| 58 |
void enable(); |
| 59 |
|
| 60 |
/*! \brief see StorageChangeNotifierPlugin::disable |
| 61 |
*/ |
| 62 |
void disable(bool disableAfterNextChange = false); |
| 63 |
|
| 64 |
private Q_SLOTS: |
| 65 |
/*! \brief handles a change notification from contacts notifier |
| 66 |
*/ |
| 67 |
void onChange(); |
| 68 |
|
| 69 |
private: |
| 70 |
ContactsChangeNotifier* icontactsChangeNotifier; |
| 71 |
bool ihasChanges; |
| 72 |
bool iDisableLater; |
| 73 |
}; |
| 74 |
|
| 75 |
|
| 76 |
class ContactsChangeNotifierPluginLoader : public Buteo::StorageChangeNotifierPluginLoader |
| 77 |
{ |
| 78 |
Q_OBJECT |
| 79 |
Q_PLUGIN_METADATA(IID "com.buteo.plugins.storage.ContactsChangeNotifierPluginLoader") |
| 80 |
Q_INTERFACES(Buteo::StorageChangeNotifierPluginLoader) |
| 81 |
|
| 82 |
public: |
| 83 |
Buteo::StorageChangeNotifierPlugin* createPlugin(const QString& aStorageName) override; |
| 84 |
}; |
| 85 |
|
| 86 |
#endif |