gnome: add contacts treeview
Added dependency on libebook1.2-dev in order to fetch
contacts using evolution-data-server.
Contacts from enabled addressbooks are shown in contacts
tree view with photos (if available). The same image is
also shown in the call views.
Double clicking on a contact method should call that
contact.
Refs #69856
Change-Id: I6bd394a1fa23f6e62dd6e0017bff5050584538f8
diff --git a/src/ring_client.cpp b/src/ring_client.cpp
index 59c08dc..c5530aa 100644
--- a/src/ring_client.cpp
+++ b/src/ring_client.cpp
@@ -40,11 +40,16 @@
#include <useractionmodel.h>
#include <clutter-gtk/clutter-gtk.h>
#include <categorizedhistorymodel.h>
+#include <personmodel.h>
+#include <fallbackpersoncollection.h>
+#include <QtCore/QStandardPaths>
#include "ring_client_options.h"
#include "ringmainwindow.h"
#include "backends/minimalhistorybackend.h"
#include "dialogs.h"
+#include "backends/edscontactbackend.h"
+#include "delegates/pixbufdelegate.h"
struct _RingClientClass
{
@@ -65,6 +70,8 @@
QCoreApplication *qtapp;
/* UAM */
QMetaObject::Connection uam_updated;
+
+ GCancellable *cancellable;
};
G_DEFINE_TYPE_WITH_PRIVATE(RingClient, ring_client, GTK_TYPE_APPLICATION);
@@ -189,9 +196,24 @@
return 1;
}
+ /* init delegates */
+ /* FIXME: put in smart pointer? */
+ new PixbufDelegate();
+
/* add backends */
CategorizedHistoryModel::instance()->addCollection<MinimalHistoryBackend>(LoadOptions::FORCE_ENABLED);
+ PersonModel::instance()->addCollection<FallbackPersonCollection>(LoadOptions::FORCE_ENABLED);
+
+ /* TODO: should a local vcard location be added ?
+ * PersonModel::instance()->addCollection<FallbackPersonCollection, QString>(
+ * QStandardPaths::writableLocation(QStandardPaths::DataLocation)+QLatin1Char('/')+"vcard",
+ * LoadOptions::FORCE_ENABLED);
+ */
+
+ /* EDS backend */
+ load_eds_sources(priv->cancellable);
+
/* Override theme since we don't have appropriate icons for a dark them (yet) */
GtkSettings *gtk_settings = gtk_settings_get_default();
g_object_set(G_OBJECT(gtk_settings), "gtk-application-prefer-dark-theme",
@@ -283,6 +305,10 @@
g_debug("quitting");
+ /* cancel any pending cancellable operations */
+ g_cancellable_cancel(priv->cancellable);
+ g_object_unref(priv->cancellable);
+
QObject::disconnect(priv->uam_updated);
/* free the QCoreApplication, which will destroy all libRingClient models
@@ -301,6 +327,7 @@
/* init widget */
priv->win = NULL;
priv->qtapp = NULL;
+ priv->cancellable = g_cancellable_new();
}
static void