maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Announce] scout - search contacts, conversations and calendars (https://talk.maemo.org/showthread.php?t=58287)

nicolai 2010-07-12 11:31

Re: [Announce] scout - search contacts, conversations and calendars
 
Quote:

Originally Posted by saxen (Post 749068)
does it search "case sensitive"!? :o

Yes, for the moment the search is case sensitive only.

nicolai

1ion 2010-07-12 11:42

Re: [Announce] scout - search contacts, conversations and calendars
 
Supports English only?

Wichall 2010-07-12 11:46

Re: [Announce] scout - search contacts, conversations and calendars
 
This looks very interesting :) I'll check it out when the case-sensitive thing is fixed

qwerty12 2010-07-12 15:46

Re: [Announce] scout - search contacts, conversations and calendars
 
Hi,

Quote:

Originally Posted by nicolai (Post 748980)
I wished I could open the conversation app for the conversation
search result, but I couldn't find a way to do so.

Code:

--- scout-0.0.1.orig/src/scout-window.cpp
+++ scout-0.0.1/src/scout-window.cpp
@@ -4,6 +4,10 @@
 #include <libosso.h>
 #include "scout-window.h"
 #include <rtcom-eventlogger/event.h>
+#include <rtcom-eventlogger-plugins/chat.h>
+#include <telepathy-glib/interfaces.h>
+#include <telepathy-glib/dbus.h>
+#include <rtcom-telepathy-glib/extensions.h>
 #include <string.h>
 #include <libintl.h>
 #include <locale.h>
@@ -899,37 +903,82 @@
                                const gchar* user_id,
                                int event_id)
 {
-  GtkWidget* window;
-  window = hildon_stackable_window_new();
  RTComElQuery *query = rtcom_el_query_new (self->priv->rt_el);
  rtcom_el_query_prepare (query, "id", event_id, RTCOM_EL_OP_EQUAL, NULL);
  RTComElIter* iter = rtcom_el_get_events(self->priv->rt_el, query);
 
  g_object_unref(query);
-  GtkWidget* text_view = hildon_text_view_new();
-  gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text_view), GTK_WRAP_CHAR);
-  gtk_text_view_set_editable(GTK_TEXT_VIEW(text_view), FALSE);
  gboolean it = rtcom_el_iter_first(iter);
-  if(it)
-  {
-    gchar* text = NULL;
-    rtcom_el_iter_get_values(iter, "free-text", &text, NULL);
+  if (!it)
+    return;
+
+  gchar* remote_uid = NULL;
+  gchar* channel = NULL;
+  gint flags = 0;
+  gchar* local_uid = NULL;
+  rtcom_el_iter_get_values(iter, "remote-uid", &remote_uid, "channel", &channel, "flags", &flags, "local-uid", &local_uid, NULL);
 
-    hildon_text_view_set_placeholder (HILDON_TEXT_VIEW (text_view),
-                                      text);
-    GtkTextBuffer* buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_view));
-    gtk_text_buffer_insert_at_cursor(buffer,
-                                    text,
-                                    strlen(text));
+  if (!((remote_uid || channel) && local_uid))
+    return;
+
+  McAccount *account = osso_abook_account_manager_lookup_by_name (NULL, local_uid);
+  if (!account)
+    goto finally;
+
+  if ((flags & RTCOM_EL_FLAG_CHAT_GROUP) && (flags & RTCOM_EL_FLAG_CHAT_OPAQUE))
+  {
+    if (!channel)
+        goto finally;
+
+    GHashTable *properties = tp_asv_new(TP_IFACE_CHANNEL ".ChannelType", G_TYPE_STRING,
+                        TP_IFACE_CHANNEL_TYPE_TEXT,
+                        TP_IFACE_CHANNEL ".TargetHandleType", G_TYPE_UINT,
+                        TP_HANDLE_TYPE_NONE,
+                        RTCOM_TP_IFACE_CHANNEL_INTERFACE_PERSISTENT ".PersistentID",
+                        G_TYPE_STRING, channel,
+                        NULL);
+
+    mc_account_channelrequest_ht (account,
+                                  properties,
+                                  time (NULL),
+                                  NULL,
+                                  MC_ACCOUNT_CR_FLAG_USE_EXISTING,
+                                  NULL, NULL, NULL, NULL);
+
+    g_hash_table_unref (properties);
  }
  else
  {
-    hildon_text_view_set_placeholder (HILDON_TEXT_VIEW (text_view),
-                                      "no text");
+    McAccountChannelrequestData request;
+
+    MC_ACCOUNT_CRD_INIT (&request);
+    MC_ACCOUNT_CRD_SET (&request, channel_type, TP_IFACE_QUARK_CHANNEL_TYPE_TEXT);
+
+    if ((flags & RTCOM_EL_FLAG_CHAT_ROOM) && channel)
+    {
+      MC_ACCOUNT_CRD_SET (&request, target_handle_type, TP_HANDLE_TYPE_ROOM);
+      MC_ACCOUNT_CRD_SET (&request, target_id, channel);
+    }
+    else if (remote_uid)
+    {
+      MC_ACCOUNT_CRD_SET (&request, target_handle_type, TP_HANDLE_TYPE_CONTACT);
+      MC_ACCOUNT_CRD_SET (&request, target_id, remote_uid);
+    }
+    else
+      goto finally;
+
+      mc_account_channelrequest (account,
+                                &request,
+                                time (NULL),
+                                NULL,
+                                MC_ACCOUNT_CR_FLAG_USE_EXISTING,
+                                NULL, NULL, NULL, NULL);
  }
-  gtk_container_add(GTK_CONTAINER(window), text_view);
-  gtk_window_set_title(GTK_WINDOW(window), user_id);
-  gtk_widget_show_all(window);
+
+finally:
+    g_free (remote_uid);
+    g_free (channel);
+    g_free (local_uid);
 }
 
 static void

Note: I do not take credit for this method; code was taken from the Conversations Inbox Desktop Widget.

Dr.MZ 2010-07-12 19:15

Re: [Announce] scout - search contacts, conversations and calendars
 
Would it be possible to search for additional files to include? Thus it takes no longer the App Search Tool.

Laughing Man 2010-07-12 19:25

Re: [Announce] scout - search contacts, conversations and calendars
 
Have you considered including applications?

robbie 2010-07-14 15:53

Re: [Announce] scout - search contacts, conversations and calendars
 
Quote:

Originally Posted by nicolai (Post 748980)
because I know there is a some demand for such an app.

Understatement of the year?

I really wanted this! Thanks for creating it.

jacktanner 2010-07-14 15:58

Re: [Announce] scout - search contacts, conversations and calendars
 
I'm so excited about a search app!

So, does it index all these things, or does it grep on the fly? Can you give some specifics about how it works?

Any plans to search email?

skalogre 2010-07-14 16:06

Re: [Announce] scout - search contacts, conversations and calendars
 
Between this and the other applications you have thrown together, Nicolai, you should be canonised! Thank you again :)

spooley 2010-07-14 17:46

Re: [Announce] scout - search contacts, conversations and calendars
 
This is very promising, Nicolai. Thank you for your work!

Simon.


All times are GMT. The time now is 06:13.

vBulletin® Version 3.8.8