[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdeconnect-kde/contacts] plugins/contacts: Emit signal indicating cache has been updated
From: Simon Redman <null () kde ! org>
Date: 2018-03-31 19:29:10
Message-ID: E1f2MBa-0000IV-U4 () code ! kde ! org
[Download RAW message or body]
Git commit bd6e2f0c99683315e032b5d6b69a9452dbfd24d7 by Simon Redman.
Committed on 31/03/2018 at 19:29.
Pushed by sredman into branch 'contacts'.
Emit signal indicating cache has been updated
M +8 -0 plugins/contacts/contactsplugin.cpp
M +6 -2 plugins/contacts/contactsplugin.h
https://commits.kde.org/kdeconnect-kde/bd6e2f0c99683315e032b5d6b69a9452dbfd24d7
diff --git a/plugins/contacts/contactsplugin.cpp \
b/plugins/contacts/contactsplugin.cpp index 8256ec28..41123c5f 100644
--- a/plugins/contacts/contactsplugin.cpp
+++ b/plugins/contacts/contactsplugin.cpp
@@ -43,6 +43,13 @@ ContactsPlugin::ContactsPlugin (QObject* parent, const \
QVariantList& args) : KdeConnectPlugin(parent, args) {
vcardsPath = QString(*vcardsLocation).append("/kdeconnect-").append(device()->id());
+ // Register custom types with dbus
+ qRegisterMetaType<uID>("uID");
+ qDBusRegisterMetaType<uID>();
+
+ qRegisterMetaType<uIDList_t>("uIDList_t");
+ qDBusRegisterMetaType<uIDList_t>();
+
// Create the storage directory if it doesn't exist
if (!QDir().mkpath(vcardsPath)) {
qCWarning(KDECONNECT_PLUGIN_CONTACTS) << "handleResponseVCards:" << "Unable \
to create VCard directory"; @@ -175,6 +182,7 @@ bool \
ContactsPlugin::handleResponseVCards (const NetworkPacket& np) { fileWriteStream << \
np.get<QString>(ID); }
qCDebug(KDECONNECT_PLUGIN_CONTACTS) << "handleResponseVCards:" << "Got" << \
uIDs.size() << "VCards"; + Q_EMIT localCacheSynchronized(uIDs);
return true;
}
diff --git a/plugins/contacts/contactsplugin.h b/plugins/contacts/contactsplugin.h
index 97e43580..9f4ee2f6 100644
--- a/plugins/contacts/contactsplugin.h
+++ b/plugins/contacts/contactsplugin.h
@@ -80,8 +80,10 @@ Q_GLOBAL_STATIC_WITH_ARGS(
#define METADATA_EXTENSION QStringLiteral(".meta")
typedef QString uID;
+Q_DECLARE_METATYPE(uID)
-typedef QList<uID> uIDList_t;
+typedef QStringList uIDList_t;
+Q_DECLARE_METATYPE(uIDList_t)
class Q_DECL_EXPORT ContactsPlugin : public KdeConnectPlugin {
Q_OBJECT
@@ -118,9 +120,11 @@ public:
Q_SIGNALS:
/**
* Emitted to indicate that we have locally cached all remote contacts
+ *
+ * @param newContacts The list of just-synchronized contacts
*/
Q_SCRIPTABLE
- void localCacheSynchronized ();
+ void localCacheSynchronized (const uIDList_t& newContacts);
protected:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic