Tizen 2.1 base
[platform/core/uifw/isf.git] / ism / src / scim_helper.cpp
1 /** @file scim_helper.cpp
2  *  @brief Implementation of class HelperAgent.
3  */
4
5 /* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
6
7 /*
8  * Smart Common Input Method
9  *
10  * Copyright (c) 2004-2005 James Su <suzhe@tsinghua.org.cn>
11  * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
12  *
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Lesser General Public
16  * License as published by the Free Software Foundation; either
17  * version 2 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public
25  * License along with this program; if not, write to the
26  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
27  * Boston, MA  02111-1307  USA
28  *
29  * Modifications by Samsung Electronics Co., Ltd.
30  * 1. Add new interface APIs for keyboard ISE
31  *    a. expand_candidate (), contract_candidate () and set_candidate_style ()
32  *    b. set_keyboard_ise_by_uuid () and reset_keyboard_ise ()
33  *    c. get_surrounding_text () and delete_surrounding_text ()
34  *    d. show_preedit_string (), hide_preedit_string (), update_preedit_string () and update_preedit_caret ()
35  *    e. show_candidate_string (), hide_candidate_string () and update_candidate_string ()
36  *
37  * $Id: scim_helper.cpp,v 1.13 2005/05/24 12:22:51 suzhe Exp $
38  *
39  */
40
41 #define Uses_SCIM_TRANSACTION
42 #define Uses_SCIM_TRANS_COMMANDS
43 #define Uses_SCIM_HELPER
44 #define Uses_SCIM_SOCKET
45 #define Uses_SCIM_EVENT
46
47 #include <string.h>
48
49 #include "scim_private.h"
50 #include "scim.h"
51
52 namespace scim {
53
54 typedef Signal3<void, const HelperAgent *, int, const String &>
55         HelperAgentSignalVoid;
56
57 typedef Signal4<void, const HelperAgent *, int, const String &, const String &>
58         HelperAgentSignalString;
59
60 typedef Signal4<void, const HelperAgent *, int, const String &, const std::vector<String> &>
61         HelperAgentSignalStringVector;
62
63 typedef Signal5<void, const HelperAgent *, int, const String &, const String &, const String &>
64         HelperAgentSignalString2;
65
66 typedef Signal4<void, const HelperAgent *, int, const String &, int>
67         HelperAgentSignalInt;
68
69 typedef Signal5<void, const HelperAgent *, int, const String &, int, int>
70         HelperAgentSignalIntInt;
71
72 typedef Signal4<void, const HelperAgent *, int, const String &, const Transaction &>
73         HelperAgentSignalTransaction;
74
75 typedef Signal4<void, const HelperAgent *, int, const String &, const rectinfo &>
76         HelperAgentSignalRect;
77
78 typedef Signal2<void, const HelperAgent *, struct rectinfo &>
79         HelperAgentSignalSize;
80
81 typedef Signal2<void, const HelperAgent *, uint32 &>
82         HelperAgentSignalUintVoid;
83
84 typedef Signal3<void, const HelperAgent *, int, uint32 &>
85         HelperAgentSignalIntUint;
86
87 typedef Signal3 <void, const HelperAgent *, char *, size_t &>
88         HelperAgentSignalRawVoid;
89
90 typedef Signal3 <void, const HelperAgent *, char **, size_t &>
91         HelperAgentSignalGetRawVoid;
92
93 typedef Signal4 <void, const HelperAgent *, int, char *, size_t &>
94         HelperAgentSignalIntRawVoid;
95
96 typedef Signal3 <void, const HelperAgent *, int, char **>
97         HelperAgentSignalIntGetStringVoid;
98
99 typedef Signal2<void, const HelperAgent *, const std::vector<uint32> &>
100         HelperAgentSignalUintVector;
101
102 class HelperAgent::HelperAgentImpl
103 {
104 public:
105     SocketClient socket;
106     SocketClient socket_active;
107     Transaction  recv;
108     Transaction  send;
109     uint32       magic;
110     uint32       magic_active;
111     int          timeout;
112
113     HelperAgentSignalVoid           signal_exit;
114     HelperAgentSignalVoid           signal_attach_input_context;
115     HelperAgentSignalVoid           signal_detach_input_context;
116     HelperAgentSignalVoid           signal_reload_config;
117     HelperAgentSignalInt            signal_update_screen;
118     HelperAgentSignalIntInt         signal_update_spot_location;
119     HelperAgentSignalInt            signal_update_cursor_position;
120     HelperAgentSignalInt            signal_update_surrounding_text;
121     HelperAgentSignalString         signal_trigger_property;
122     HelperAgentSignalTransaction    signal_process_imengine_event;
123     HelperAgentSignalVoid           signal_focus_out;
124     HelperAgentSignalVoid           signal_focus_in;
125     HelperAgentSignalIntRawVoid     signal_ise_show;
126     HelperAgentSignalVoid           signal_ise_hide;
127     HelperAgentSignalSize           signal_get_geometry;
128     HelperAgentSignalUintVoid       signal_set_mode;
129     HelperAgentSignalUintVoid       signal_set_language;
130     HelperAgentSignalRawVoid        signal_set_imdata;
131     HelperAgentSignalGetRawVoid     signal_get_imdata;
132     HelperAgentSignalIntGetStringVoid   signal_get_language_locale;
133     HelperAgentSignalUintVoid           signal_set_return_key_type;
134     HelperAgentSignalUintVoid           signal_get_return_key_type;
135     HelperAgentSignalUintVoid           signal_set_return_key_disable;
136     HelperAgentSignalUintVoid           signal_get_return_key_disable;
137     HelperAgentSignalUintVoid           signal_set_layout;
138     HelperAgentSignalUintVoid           signal_get_layout;
139     HelperAgentSignalUintVoid           signal_set_caps_mode;
140     HelperAgentSignalVoid               signal_reset_input_context;
141     HelperAgentSignalIntInt             signal_update_candidate_ui;
142     HelperAgentSignalRect               signal_update_candidate_geometry;
143     HelperAgentSignalString2            signal_update_keyboard_ise;
144     HelperAgentSignalStringVector       signal_update_keyboard_ise_list;
145     HelperAgentSignalVoid               signal_candidate_more_window_show;
146     HelperAgentSignalVoid               signal_candidate_more_window_hide;
147     HelperAgentSignalInt                signal_select_aux;
148     HelperAgentSignalInt                signal_select_candidate;
149     HelperAgentSignalVoid               signal_candidate_table_page_up;
150     HelperAgentSignalVoid               signal_candidate_table_page_down;
151     HelperAgentSignalInt                signal_update_candidate_table_page_size;
152     HelperAgentSignalUintVector         signal_update_candidate_item_layout;
153     HelperAgentSignalInt                signal_select_associate;
154     HelperAgentSignalVoid               signal_associate_table_page_up;
155     HelperAgentSignalVoid               signal_associate_table_page_down;
156     HelperAgentSignalInt                signal_update_associate_table_page_size;
157     HelperAgentSignalVoid               signal_reset_ise_context;
158     HelperAgentSignalUintVoid           signal_turn_on_log;
159     HelperAgentSignalInt                signal_update_displayed_candidate_number;
160     HelperAgentSignalInt                signal_longpress_candidate;
161
162 public:
163     HelperAgentImpl () : magic (0), magic_active (0), timeout (-1) { }
164 };
165
166 HelperAgent::HelperAgent ()
167     : m_impl (new HelperAgentImpl ())
168 {
169 }
170
171 HelperAgent::~HelperAgent ()
172 {
173     delete m_impl;
174 }
175
176 /**
177  * @brief Open socket connection to the Panel.
178  *
179  * @param info The information of this Helper object.
180  * @param display The display which this Helper object should run on.
181  *
182  * @return The connection socket id. -1 means failed to create
183  *         the connection.
184  */
185 int
186 HelperAgent::open_connection (const HelperInfo &info,
187                               const String     &display)
188 {
189     if (m_impl->socket.is_connected ())
190         close_connection ();
191
192     SocketAddress address (scim_get_default_panel_socket_address (display));
193     int timeout = scim_get_default_socket_timeout ();
194     uint32 magic;
195
196     if (!address.valid ())
197         return -1;
198     bool ret;
199     int  i;
200     ret = m_impl->socket.connect (address);
201     if (ret == false) {
202         scim_usleep (100000);
203         std::cerr << " Re-connecting to PanelAgent server.";
204         ISF_LOG (" Re-connecting to PanelAgent server.\n");
205         for (i = 0; i < 200; ++i) {
206             if (m_impl->socket.connect (address)) {
207                 ret = true;
208                 break;
209             }
210             std::cerr << ".";
211             scim_usleep (100000);
212         }
213         std::cerr << " Connected :" << i << "\n";
214         ISF_LOG ("  Connected :%d\n", i);
215     }
216
217     if (ret == false)
218     {
219         std::cerr << "m_impl->socket.connect () is failed!!!\n";
220         ISF_LOG ("m_impl->socket.connect () is failed!!!\n");
221         return -1;
222     }
223
224     if (!scim_socket_open_connection (magic,
225                                       String ("Helper"),
226                                       String ("Panel"),
227                                       m_impl->socket,
228                                       timeout)) {
229         m_impl->socket.close ();
230         std::cerr << "scim_socket_open_connection () is failed!!!\n";
231         ISF_LOG ("scim_socket_open_connection () is failed!!!\n");
232         return -1;
233     }
234
235     ISF_LOG ("scim_socket_open_connection () is successful.\n");
236     m_impl->send.clear ();
237     m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
238     m_impl->send.put_data (magic);
239     m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_REGISTER_HELPER);
240     m_impl->send.put_data (info.uuid);
241     m_impl->send.put_data (info.name);
242     m_impl->send.put_data (info.icon);
243     m_impl->send.put_data (info.description);
244     m_impl->send.put_data (info.option);
245
246     if (!m_impl->send.write_to_socket (m_impl->socket, magic)) {
247         m_impl->socket.close ();
248         return -1;
249     }
250
251     int cmd;
252     if (m_impl->recv.read_from_socket (m_impl->socket, timeout) &&
253         m_impl->recv.get_command (cmd) && cmd == SCIM_TRANS_CMD_REPLY &&
254         m_impl->recv.get_command (cmd) && cmd == SCIM_TRANS_CMD_OK) {
255         m_impl->magic = magic;
256         m_impl->timeout = timeout;
257
258         while (m_impl->recv.get_command (cmd)) {
259             switch (cmd) {
260                 case SCIM_TRANS_CMD_HELPER_ATTACH_INPUT_CONTEXT:
261                 {
262                     uint32 ic;
263                     String ic_uuid;
264                     while (m_impl->recv.get_data (ic) && m_impl->recv.get_data (ic_uuid))
265                         m_impl->signal_attach_input_context (this, ic, ic_uuid);
266                     break;
267                 }
268                 case SCIM_TRANS_CMD_UPDATE_SCREEN:
269                 {
270                     uint32 screen;
271                     if (m_impl->recv.get_data (screen))
272                         m_impl->signal_update_screen (this, (uint32) -1, String (""), (int) screen);
273                     break;
274                 }
275                 default:
276                     break;
277             }
278         }
279     }
280
281     /* connect to the panel agent as the active helper client */
282     if (!m_impl->socket_active.connect (address)) return -1;
283     if (!scim_socket_open_connection (magic,
284                                       String ("Helper_Active"),
285                                       String ("Panel"),
286                                       m_impl->socket_active,
287                                       timeout)) {
288         m_impl->socket_active.close ();
289         return -1;
290     }
291
292     if (m_impl->socket_active.set_nonblock_mode () == -1)
293         std::cerr << __func__ << " socket_active.set_nonblock_mode () is failed!!!\n";
294
295     m_impl->magic_active = magic;
296
297     m_impl->send.clear ();
298     m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
299     m_impl->send.put_data (magic);
300     m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_REGISTER_ACTIVE_HELPER);
301     m_impl->send.put_data (info.uuid);
302     m_impl->send.put_data (info.name);
303     m_impl->send.put_data (info.icon);
304     m_impl->send.put_data (info.description);
305     m_impl->send.put_data (info.option);
306
307     if (!m_impl->send.write_to_socket (m_impl->socket_active, magic)) {
308         m_impl->socket_active.close ();
309         return -1;
310     }
311
312     return m_impl->socket.get_id ();
313 }
314
315 /**
316  * @brief Close the socket connection to Panel.
317  */
318 void
319 HelperAgent::close_connection ()
320 {
321     m_impl->socket.close ();
322     m_impl->socket_active.close ();
323     m_impl->send.clear ();
324     m_impl->recv.clear ();
325     m_impl->magic        = 0;
326     m_impl->magic_active = 0;
327     m_impl->timeout      = 0;
328 }
329
330 /**
331  * @brief Get the connection id previously returned by open_connection().
332  *
333  * @return the connection id
334  */
335 int
336 HelperAgent::get_connection_number () const
337 {
338     if (m_impl->socket.is_connected ())
339         return m_impl->socket.get_id ();
340     return -1;
341 }
342
343 /**
344  * @brief Check whether this HelperAgent has been connected to a Panel.
345  *
346  * Return true when it is connected to panel, otherwise return false.
347  */
348 bool
349 HelperAgent::is_connected () const
350 {
351     return m_impl->socket.is_connected ();
352 }
353
354 /**
355  * @brief Check if there are any events available to be processed.
356  *
357  * If it returns true then Helper object should call
358  * HelperAgent::filter_event() to process them.
359  *
360  * @return true if there are any events available.
361  */
362 bool
363 HelperAgent::has_pending_event () const
364 {
365     if (m_impl->socket.is_connected () && m_impl->socket.wait_for_data (0) > 0)
366         return true;
367
368     return false;
369 }
370
371 /**
372  * @brief Process the pending events.
373  *
374  * This function will emit the corresponding signals according
375  * to the events.
376  *
377  * @return false if the connection is broken, otherwise return true.
378  */
379 bool
380 HelperAgent::filter_event ()
381 {
382     if (!m_impl->socket.is_connected () || !m_impl->recv.read_from_socket (m_impl->socket, m_impl->timeout))
383         return false;
384
385     int cmd;
386
387     uint32 ic = (uint32) -1;
388     String ic_uuid;
389
390     if (!m_impl->recv.get_command (cmd) || cmd != SCIM_TRANS_CMD_REPLY)
391         return true;
392
393     /* If there are ic and ic_uuid then read them. */
394     if (!(m_impl->recv.get_data_type () == SCIM_TRANS_DATA_COMMAND) &&
395         !(m_impl->recv.get_data (ic) && m_impl->recv.get_data (ic_uuid)))
396         return true;
397
398     while (m_impl->recv.get_command (cmd)) {
399         switch (cmd) {
400             case SCIM_TRANS_CMD_EXIT:
401                 m_impl->signal_exit (this, ic, ic_uuid);
402                 break;
403             case SCIM_TRANS_CMD_RELOAD_CONFIG:
404                 m_impl->signal_reload_config (this, ic, ic_uuid);
405                 break;
406             case SCIM_TRANS_CMD_UPDATE_SCREEN:
407             {
408                 uint32 screen;
409                 if (m_impl->recv.get_data (screen))
410                     m_impl->signal_update_screen (this, ic, ic_uuid, (int) screen);
411                 break;
412             }
413             case SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION:
414             {
415                 uint32 x, y;
416                 if (m_impl->recv.get_data (x) && m_impl->recv.get_data (y))
417                     m_impl->signal_update_spot_location (this, ic, ic_uuid, (int) x, (int) y);
418                 break;
419             }
420             case ISM_TRANS_CMD_UPDATE_CURSOR_POSITION:
421             {
422                 uint32 cursor_pos;
423                 if (m_impl->recv.get_data (cursor_pos))
424                     m_impl->signal_update_cursor_position (this, ic, ic_uuid, (int) cursor_pos);
425                 break;
426             }
427             case ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT:
428             {
429                 String text;
430                 uint32 cursor;
431                 if (m_impl->recv.get_data (text) && m_impl->recv.get_data (cursor))
432                     m_impl->signal_update_surrounding_text (this, ic, text, (int) cursor);
433                 break;
434             }
435             case SCIM_TRANS_CMD_TRIGGER_PROPERTY:
436             {
437                 String property;
438                 if (m_impl->recv.get_data (property))
439                     m_impl->signal_trigger_property (this, ic, ic_uuid, property);
440                 break;
441             }
442             case SCIM_TRANS_CMD_HELPER_PROCESS_IMENGINE_EVENT:
443             {
444                 Transaction trans;
445                 if (m_impl->recv.get_data (trans))
446                     m_impl->signal_process_imengine_event (this, ic, ic_uuid, trans);
447                 break;
448             }
449             case SCIM_TRANS_CMD_HELPER_ATTACH_INPUT_CONTEXT:
450                 m_impl->signal_attach_input_context (this, ic, ic_uuid);
451                 break;
452             case SCIM_TRANS_CMD_HELPER_DETACH_INPUT_CONTEXT:
453                 m_impl->signal_detach_input_context (this, ic, ic_uuid);
454                 break;
455             case SCIM_TRANS_CMD_FOCUS_OUT:
456             {
457                 m_impl->signal_focus_out (this, ic, ic_uuid);
458                 break;
459             }
460             case SCIM_TRANS_CMD_FOCUS_IN:
461             {
462                 m_impl->signal_focus_in (this, ic, ic_uuid);
463                 break;
464             }
465             case ISM_TRANS_CMD_SHOW_ISE_PANEL:
466             {
467                 char   *data = NULL;
468                 size_t  len;
469                 if (m_impl->recv.get_data (&data, len))
470                     m_impl->signal_ise_show (this, ic, data, len);
471                 if (data)
472                     delete [] data;
473                 break;
474             }
475             case ISM_TRANS_CMD_HIDE_ISE_PANEL:
476             {
477                 m_impl->signal_ise_hide (this, ic, ic_uuid);
478                 break;
479             }
480             case ISM_TRANS_CMD_GET_ACTIVE_ISE_GEOMETRY:
481             {
482                 struct rectinfo info = {0, 0, 0, 0};
483                 m_impl->signal_get_geometry (this, info);
484                 m_impl->send.clear ();
485                 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
486                 m_impl->send.put_data (info.pos_x);
487                 m_impl->send.put_data (info.pos_y);
488                 m_impl->send.put_data (info.width);
489                 m_impl->send.put_data (info.height);
490                 m_impl->send.write_to_socket (m_impl->socket);
491                 break;
492             }
493             case ISM_TRANS_CMD_SET_ISE_MODE:
494             {
495                 uint32 mode;
496                 if (m_impl->recv.get_data (mode))
497                     m_impl->signal_set_mode (this, mode);
498                 break;
499             }
500             case ISM_TRANS_CMD_SET_ISE_LANGUAGE:
501             {
502                 uint32 language;
503                 if (m_impl->recv.get_data (language))
504                     m_impl->signal_set_language (this, language);
505                 break;
506             }
507             case ISM_TRANS_CMD_SET_ISE_IMDATA:
508             {
509                 char   *imdata = NULL;
510                 size_t  len;
511                 if (m_impl->recv.get_data (&imdata, len))
512                     m_impl->signal_set_imdata (this, imdata, len);
513
514                 if (NULL != imdata)
515                     delete[] imdata;
516                 break;
517             }
518             case ISM_TRANS_CMD_GET_ISE_IMDATA:
519             {
520                 char   *buf = NULL;
521                 size_t  len = 0;
522
523                 m_impl->signal_get_imdata (this, &buf, len);
524                 m_impl->send.clear ();
525                 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
526                 m_impl->send.put_data (buf, len);
527                 m_impl->send.write_to_socket (m_impl->socket);
528                 if (NULL != buf)
529                     delete[] buf;
530                 break;
531             }
532             case ISM_TRANS_CMD_GET_ISE_LANGUAGE_LOCALE:
533             {
534                 char *buf = NULL;
535                 m_impl->signal_get_language_locale (this, ic, &buf);
536                 m_impl->send.clear ();
537                 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
538                 if (buf != NULL)
539                     m_impl->send.put_data (buf, strlen (buf));
540                 m_impl->send.write_to_socket (m_impl->socket);
541                 if (NULL != buf)
542                     delete[] buf;
543                 break;
544             }
545             case ISM_TRANS_CMD_SET_RETURN_KEY_TYPE:
546             {
547                 uint32 type = 0;
548                 if (m_impl->recv.get_data (type)) {
549                     m_impl->signal_set_return_key_type (this, type);
550                 }
551                 break;
552             }
553             case ISM_TRANS_CMD_GET_RETURN_KEY_TYPE:
554             {
555                 uint32 type = 0;
556                 m_impl->signal_get_return_key_type (this, type);
557                 m_impl->send.clear ();
558                 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
559                 m_impl->send.put_data (type);
560                 m_impl->send.write_to_socket (m_impl->socket);
561                 break;
562             }
563             case ISM_TRANS_CMD_SET_RETURN_KEY_DISABLE:
564             {
565                 uint32 disabled = 0;
566                 if (m_impl->recv.get_data (disabled)) {
567                     m_impl->signal_set_return_key_disable (this, disabled);
568                 }
569                 break;
570             }
571             case ISM_TRANS_CMD_GET_RETURN_KEY_DISABLE:
572             {
573                 uint32 disabled = 0;
574                 m_impl->signal_get_return_key_type (this, disabled);
575                 m_impl->send.clear ();
576                 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
577                 m_impl->send.put_data (disabled);
578                 m_impl->send.write_to_socket (m_impl->socket);
579                 break;
580             }
581             case ISM_TRANS_CMD_SET_LAYOUT:
582             {
583                 uint32 layout;
584
585                 if (m_impl->recv.get_data (layout))
586                     m_impl->signal_set_layout (this, layout);
587                 break;
588             }
589             case ISM_TRANS_CMD_GET_LAYOUT:
590             {
591                 uint32 layout = 0;
592
593                 m_impl->signal_get_layout (this, layout);
594                 m_impl->send.clear ();
595                 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
596                 m_impl->send.put_data (layout);
597                 m_impl->send.write_to_socket (m_impl->socket);
598                 break;
599             }
600             case ISM_TRANS_CMD_SET_CAPS_MODE:
601             {
602                 uint32 mode;
603
604                 if (m_impl->recv.get_data (mode))
605                     m_impl->signal_set_caps_mode (this, mode);
606                 break;
607             }
608             case SCIM_TRANS_CMD_PANEL_RESET_INPUT_CONTEXT:
609             {
610                 m_impl->signal_reset_input_context (this, ic, ic_uuid);
611                 break;
612             }
613             case ISM_TRANS_CMD_UPDATE_CANDIDATE_UI:
614             {
615                 uint32 style, mode;
616                 if (m_impl->recv.get_data (style) && m_impl->recv.get_data (mode))
617                     m_impl->signal_update_candidate_ui (this, ic, ic_uuid, style, mode);
618                 break;
619             }
620             case ISM_TRANS_CMD_UPDATE_CANDIDATE_GEOMETRY:
621             {
622                 struct rectinfo info = {0, 0, 0, 0};
623                 if (m_impl->recv.get_data (info.pos_x)
624                     && m_impl->recv.get_data (info.pos_y)
625                     && m_impl->recv.get_data (info.width)
626                     && m_impl->recv.get_data (info.height))
627                     m_impl->signal_update_candidate_geometry (this, ic, ic_uuid, info);
628                 break;
629             }
630             case ISM_TRANS_CMD_UPDATE_KEYBOARD_ISE:
631             {
632                 String name, uuid;
633                 if (m_impl->recv.get_data (name) && m_impl->recv.get_data (uuid))
634                     m_impl->signal_update_keyboard_ise (this, ic, ic_uuid, name, uuid);
635                 break;
636             }
637             case ISM_TRANS_CMD_UPDATE_KEYBOARD_ISE_LIST:
638             {
639                 uint32 num;
640                 String ise;
641                 std::vector<String> list;
642                 if (m_impl->recv.get_data (num)) {
643                     for (unsigned int i = 0; i < num; i++) {
644                         if (m_impl->recv.get_data (ise)) {
645                             list.push_back (ise);
646                         } else {
647                             list.clear ();
648                             break;
649                         }
650                     }
651                     m_impl->signal_update_keyboard_ise_list (this, ic, ic_uuid, list);
652                 }
653                 break;
654             }
655             case ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_SHOW:
656             {
657                 m_impl->signal_candidate_more_window_show (this, ic, ic_uuid);
658                 break;
659             }
660             case ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_HIDE:
661             {
662                 m_impl->signal_candidate_more_window_hide (this, ic, ic_uuid);
663                 break;
664             }
665             case ISM_TRANS_CMD_SELECT_AUX:
666             {
667                 uint32 item;
668                 if (m_impl->recv.get_data (item))
669                     m_impl->signal_select_aux (this, ic, ic_uuid, item);
670                 break;
671             }
672             case SCIM_TRANS_CMD_SELECT_CANDIDATE:
673             {
674                 uint32 item;
675                 if (m_impl->recv.get_data (item))
676                     m_impl->signal_select_candidate (this, ic, ic_uuid, item);
677                 break;
678             }
679             case SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_UP:
680             {
681                 m_impl->signal_candidate_table_page_up (this, ic, ic_uuid);
682                 break;
683             }
684             case SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_DOWN:
685             {
686                 m_impl->signal_candidate_table_page_down (this, ic, ic_uuid);
687                 break;
688             }
689             case SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE_PAGE_SIZE:
690             {
691                 uint32 size;
692                 if (m_impl->recv.get_data (size))
693                     m_impl->signal_update_candidate_table_page_size (this, ic, ic_uuid, size);
694                 break;
695             }
696             case ISM_TRANS_CMD_UPDATE_CANDIDATE_ITEM_LAYOUT:
697             {
698                 std::vector<uint32> row_items;
699                 if (m_impl->recv.get_data (row_items))
700                     m_impl->signal_update_candidate_item_layout (this, row_items);
701                 break;
702             }
703             case ISM_TRANS_CMD_SELECT_ASSOCIATE:
704             {
705                 uint32 item;
706                 if (m_impl->recv.get_data (item))
707                     m_impl->signal_select_associate (this, ic, ic_uuid, item);
708                 break;
709             }
710             case ISM_TRANS_CMD_ASSOCIATE_TABLE_PAGE_UP:
711             {
712                 m_impl->signal_associate_table_page_up (this, ic, ic_uuid);
713                 break;
714             }
715             case ISM_TRANS_CMD_ASSOCIATE_TABLE_PAGE_DOWN:
716             {
717                 m_impl->signal_associate_table_page_down (this, ic, ic_uuid);
718                 break;
719             }
720             case ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE_PAGE_SIZE:
721             {
722                 uint32 size;
723                 if (m_impl->recv.get_data (size))
724                     m_impl->signal_update_associate_table_page_size (this, ic, ic_uuid, size);
725                 break;
726             }
727             case ISM_TRANS_CMD_RESET_ISE_CONTEXT:
728             {
729                 m_impl->signal_reset_ise_context (this, ic, ic_uuid);
730                 break;
731             }
732             case ISM_TRANS_CMD_TURN_ON_LOG:
733             {
734                 uint32 isOn;
735                 if (m_impl->recv.get_data (isOn))
736                     m_impl->signal_turn_on_log (this, isOn);
737                 break;
738             }
739             case ISM_TRANS_CMD_UPDATE_DISPLAYED_CANDIDATE:
740             {
741                 uint32 size;
742                 if (m_impl->recv.get_data (size))
743                     m_impl->signal_update_displayed_candidate_number (this, ic, ic_uuid, size);
744                 break;
745             }
746             case ISM_TRANS_CMD_LONGPRESS_CANDIDATE:
747             {
748                 uint32 index;
749                 if (m_impl->recv.get_data (index))
750                     m_impl->signal_longpress_candidate (this, ic, ic_uuid, index);
751                 break;
752             }
753             default:
754                 break;
755         }
756     }
757     return true;
758 }
759
760 /**
761  * @brief Request SCIM to reload all configuration.
762  *
763  * This function should only by used by Setup Helper to request
764  * scim's reloading the configuration.
765  */
766 void
767 HelperAgent::reload_config () const
768 {
769     if (m_impl->socket_active.is_connected ()) {
770         m_impl->send.clear ();
771         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
772         m_impl->send.put_data (m_impl->magic_active);
773         m_impl->send.put_command (SCIM_TRANS_CMD_RELOAD_CONFIG);
774         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
775     }
776 }
777
778 /**
779  * @brief Register some properties into Panel.
780  *
781  * This function send the request to Panel to register a list
782  * of Properties.
783  *
784  * @param properties The list of Properties to be registered into Panel.
785  *
786  * @sa scim::Property.
787  */
788 void
789 HelperAgent::register_properties (const PropertyList &properties) const
790 {
791     if (m_impl->socket_active.is_connected ()) {
792         m_impl->send.clear ();
793         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
794         m_impl->send.put_data (m_impl->magic_active);
795         m_impl->send.put_command (SCIM_TRANS_CMD_REGISTER_PROPERTIES);
796         m_impl->send.put_data (properties);
797         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
798     }
799 }
800
801 /**
802  * @brief Update a registered property.
803  *
804  * @param property The property to be updated.
805  */
806 void
807 HelperAgent::update_property (const Property &property) const
808 {
809     if (m_impl->socket_active.is_connected ()) {
810         m_impl->send.clear ();
811         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
812         m_impl->send.put_data (m_impl->magic_active);
813         m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PROPERTY);
814         m_impl->send.put_data (property);
815         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
816     }
817 }
818
819 /**
820  * @brief Send a set of events to an IMEngineInstance.
821  *
822  * All events should be put into a Transaction.
823  * And the events can only be received by one IMEngineInstance object.
824  *
825  * @param ic The handle of the Input Context to receive the events.
826  * @param ic_uuid The UUID of the Input Context.
827  * @param trans The Transaction object holds the events.
828  */
829 void
830 HelperAgent::send_imengine_event (int                ic,
831                                   const String      &ic_uuid,
832                                   const Transaction &trans) const
833 {
834     if (m_impl->socket_active.is_connected ()) {
835         m_impl->send.clear ();
836         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
837         m_impl->send.put_data (m_impl->magic_active);
838         m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_SEND_IMENGINE_EVENT);
839         m_impl->send.put_data ((uint32)ic);
840         m_impl->send.put_data (ic_uuid);
841         m_impl->send.put_data (trans);
842         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
843     }
844 }
845
846 /**
847  * @brief Send a KeyEvent to an IMEngineInstance.
848  *
849  * @param ic The handle of the IMEngineInstance to receive the event.
850  *        -1 means the currently focused IMEngineInstance.
851  * @param ic_uuid The UUID of the IMEngineInstance. Empty means don't match.
852  * @param key The KeyEvent to be sent.
853  */
854 void
855 HelperAgent::send_key_event (int            ic,
856                              const String   &ic_uuid,
857                              const KeyEvent &key) const
858 {
859     if (m_impl->socket_active.is_connected ()) {
860         m_impl->send.clear ();
861         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
862         m_impl->send.put_data (m_impl->magic_active);
863         m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_SEND_KEY_EVENT);
864         m_impl->send.put_data ((uint32)ic);
865         m_impl->send.put_data (ic_uuid);
866         m_impl->send.put_data (key);
867         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
868     }
869 }
870
871 /**
872  * @brief Forward a KeyEvent to client application directly.
873  *
874  * @param ic The handle of the client Input Context to receive the event.
875  *        -1 means the currently focused Input Context.
876  * @param ic_uuid The UUID of the IMEngine used by the Input Context.
877  *        Empty means don't match.
878  * @param key The KeyEvent to be forwarded.
879  */
880 void
881 HelperAgent::forward_key_event (int            ic,
882                                 const String   &ic_uuid,
883                                 const KeyEvent &key) const
884 {
885     if (m_impl->socket_active.is_connected ()) {
886         m_impl->send.clear ();
887         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
888         m_impl->send.put_data (m_impl->magic_active);
889         m_impl->send.put_command (SCIM_TRANS_CMD_FORWARD_KEY_EVENT);
890         m_impl->send.put_data ((uint32)ic);
891         m_impl->send.put_data (ic_uuid);
892         m_impl->send.put_data (key);
893         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
894     }
895 }
896
897 /**
898  * @brief Commit a WideString to client application directly.
899  *
900  * @param ic The handle of the client Input Context to receive the WideString.
901  *        -1 means the currently focused Input Context.
902  * @param ic_uuid The UUID of the IMEngine used by the Input Context.
903  *        Empty means don't match.
904  * @param wstr The WideString to be committed.
905  */
906 void
907 HelperAgent::commit_string (int               ic,
908                             const String     &ic_uuid,
909                             const WideString &wstr) const
910 {
911     if (m_impl->socket_active.is_connected ()) {
912         m_impl->send.clear ();
913         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
914         m_impl->send.put_data (m_impl->magic_active);
915         m_impl->send.put_command (SCIM_TRANS_CMD_COMMIT_STRING);
916         m_impl->send.put_data ((uint32)ic);
917         m_impl->send.put_data (ic_uuid);
918         m_impl->send.put_data (wstr);
919         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
920     }
921 }
922
923 /**
924  * @brief Request to show preedit string.
925  *
926  * @param ic The handle of the client Input Context to receive the request.
927  *        -1 means the currently focused Input Context.
928  * @param ic_uuid The UUID of the IMEngine used by the Input Context.
929  *        Empty means don't match.
930  */
931 void
932 HelperAgent::show_preedit_string (int               ic,
933                                   const String     &ic_uuid) const
934 {
935     if (m_impl->socket_active.is_connected ()) {
936         m_impl->send.clear ();
937         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
938         m_impl->send.put_data (m_impl->magic_active);
939         m_impl->send.put_command (SCIM_TRANS_CMD_SHOW_PREEDIT_STRING);
940         m_impl->send.put_data ((uint32)ic);
941         m_impl->send.put_data (ic_uuid);
942         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
943     }
944 }
945
946 /**
947  * @brief Request to show aux string.
948  */
949 void
950 HelperAgent::show_aux_string (void) const
951 {
952     if (m_impl->socket_active.is_connected ()) {
953         m_impl->send.clear ();
954         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
955         m_impl->send.put_data (m_impl->magic_active);
956         m_impl->send.put_command (SCIM_TRANS_CMD_SHOW_AUX_STRING);
957         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
958     }
959 }
960
961 /**
962  * @brief Request to show candidate string.
963  */
964 void
965 HelperAgent::show_candidate_string (void) const
966 {
967     if (m_impl->socket_active.is_connected ()) {
968         m_impl->send.clear ();
969         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
970         m_impl->send.put_data (m_impl->magic_active);
971         m_impl->send.put_command (SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE);
972         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
973     }
974 }
975
976 /**
977  * @brief Request to show associate string.
978  */
979 void
980 HelperAgent::show_associate_string (void) const
981 {
982     if (m_impl->socket_active.is_connected ()) {
983         m_impl->send.clear ();
984         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
985         m_impl->send.put_data (m_impl->magic_active);
986         m_impl->send.put_command (ISM_TRANS_CMD_SHOW_ASSOCIATE_TABLE);
987         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
988     }
989 }
990
991 /**
992  * @brief Request to hide preedit string.
993  *
994  * @param ic The handle of the client Input Context to receive the request.
995  *        -1 means the currently focused Input Context.
996  * @param ic_uuid The UUID of the IMEngine used by the Input Context.
997  *        Empty means don't match.
998  */
999 void
1000 HelperAgent::hide_preedit_string (int               ic,
1001                                   const String     &ic_uuid) const
1002 {
1003     if (m_impl->socket_active.is_connected ()) {
1004         m_impl->send.clear ();
1005         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1006         m_impl->send.put_data (m_impl->magic_active);
1007         m_impl->send.put_command (SCIM_TRANS_CMD_HIDE_PREEDIT_STRING);
1008         m_impl->send.put_data ((uint32)ic);
1009         m_impl->send.put_data (ic_uuid);
1010         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1011     }
1012 }
1013
1014 /**
1015  * @brief Request to hide aux string.
1016  */
1017 void
1018 HelperAgent::hide_aux_string (void) const
1019 {
1020     if (m_impl->socket_active.is_connected ()) {
1021         m_impl->send.clear ();
1022         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1023         m_impl->send.put_data (m_impl->magic_active);
1024         m_impl->send.put_command (SCIM_TRANS_CMD_HIDE_AUX_STRING);
1025         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1026     }
1027 }
1028
1029 /**
1030  * @brief Request to hide candidate string.
1031  */
1032 void
1033 HelperAgent::hide_candidate_string (void) const
1034 {
1035     if (m_impl->socket_active.is_connected ()) {
1036         m_impl->send.clear ();
1037         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1038         m_impl->send.put_data (m_impl->magic_active);
1039         m_impl->send.put_command (SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE);
1040         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1041     }
1042 }
1043
1044 /**
1045  * @brief Request to hide associate string.
1046  */
1047 void
1048 HelperAgent::hide_associate_string (void) const
1049 {
1050     if (m_impl->socket_active.is_connected ()) {
1051         m_impl->send.clear ();
1052         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1053         m_impl->send.put_data (m_impl->magic_active);
1054         m_impl->send.put_command (ISM_TRANS_CMD_HIDE_ASSOCIATE_TABLE);
1055         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1056     }
1057 }
1058
1059 /**
1060  * @brief Update a new WideString for preedit.
1061  *
1062  * @param ic The handle of the client Input Context to receive the WideString.
1063  *        -1 means the currently focused Input Context.
1064  * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1065  *        Empty means don't match.
1066  * @param wstr The WideString to be updated.
1067  * @param attrs The attribute list for preedit string.
1068  */
1069 void
1070 HelperAgent::update_preedit_string (int                  ic,
1071                                     const String        &ic_uuid,
1072                                     const WideString    &str,
1073                                     const AttributeList &attrs) const
1074 {
1075     if (m_impl->socket_active.is_connected ()) {
1076         m_impl->send.clear ();
1077         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1078         m_impl->send.put_data (m_impl->magic_active);
1079         m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING);
1080         m_impl->send.put_data ((uint32)ic);
1081         m_impl->send.put_data (ic_uuid);
1082         m_impl->send.put_data (str);
1083         m_impl->send.put_data (attrs);
1084         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1085     }
1086 }
1087
1088 /**
1089  * @brief Update the preedit caret position in the preedit string.
1090  *
1091  * @param caret - the new position of the preedit caret.
1092  */
1093 void
1094 HelperAgent::update_preedit_caret (int caret) const
1095 {
1096     if (m_impl->socket_active.is_connected ()) {
1097         m_impl->send.clear ();
1098         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1099         m_impl->send.put_data (m_impl->magic_active);
1100         m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET);
1101         m_impl->send.put_data ((uint32)caret);
1102         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1103     }
1104 }
1105
1106 /**
1107  * @brief Update a new string for aux.
1108  *
1109  * @param str The string to be updated.
1110  * @param attrs The attribute list for aux string.
1111  */
1112 void
1113 HelperAgent::update_aux_string (const String        &str,
1114                                 const AttributeList &attrs) const
1115 {
1116     if (m_impl->socket_active.is_connected ()) {
1117         m_impl->send.clear ();
1118         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1119         m_impl->send.put_data (m_impl->magic_active);
1120         m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_AUX_STRING);
1121         m_impl->send.put_data (str);
1122         m_impl->send.put_data (attrs);
1123         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1124     }
1125 }
1126
1127 /**
1128  * @brief Request to update candidate.
1129  *
1130  * @param table The lookup table for candidate.
1131  */
1132 void
1133 HelperAgent::update_candidate_string (const LookupTable &table) const
1134 {
1135     if (m_impl->socket_active.is_connected ()) {
1136         m_impl->send.clear ();
1137         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1138         m_impl->send.put_data (m_impl->magic_active);
1139         m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE);
1140         m_impl->send.put_data (table);
1141         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1142     }
1143 }
1144
1145 /**
1146  * @brief Request to update associate.
1147  *
1148  * @param table The lookup table for associate.
1149  */
1150 void
1151 HelperAgent::update_associate_string (const LookupTable &table) const
1152 {
1153     if (m_impl->socket_active.is_connected ()) {
1154         m_impl->send.clear ();
1155         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1156         m_impl->send.put_data (m_impl->magic_active);
1157         m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE);
1158         m_impl->send.put_data (table);
1159         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1160     }
1161 }
1162
1163 /**
1164  * @brief When the input context of ISE is changed,
1165  *         ISE can call this function to notify application
1166  *
1167  * @param type  type of event.
1168  * @param value value of event.
1169  */
1170 void
1171 HelperAgent::update_input_context (uint32 type, uint32 value) const
1172 {
1173     if (m_impl->socket_active.is_connected ()) {
1174         m_impl->send.clear ();
1175         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1176         m_impl->send.put_data (m_impl->magic_active);
1177         m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT);
1178         m_impl->send.put_data (type);
1179         m_impl->send.put_data (value);
1180         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1181     }
1182 }
1183
1184 /**
1185  * @brief Request to get surrounding text.
1186  *
1187  * @param uuid The helper ISE UUID.
1188  * @param maxlen_before The max length of before.
1189  * @param maxlen_after The max length of after.
1190  */
1191 void
1192 HelperAgent::get_surrounding_text (const String &uuid, int maxlen_before, int maxlen_after) const
1193 {
1194     if (m_impl->socket_active.is_connected ()) {
1195         m_impl->send.clear ();
1196         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1197         m_impl->send.put_data (m_impl->magic_active);
1198         m_impl->send.put_command (SCIM_TRANS_CMD_GET_SURROUNDING_TEXT);
1199         m_impl->send.put_data (uuid);
1200         m_impl->send.put_data (maxlen_before);
1201         m_impl->send.put_data (maxlen_after);
1202         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1203     }
1204 }
1205
1206 /**
1207  * @brief Request to delete surrounding text.
1208  *
1209  * @param offset The offset for cursor position.
1210  * @param len The length for delete text.
1211  */
1212 void
1213 HelperAgent::delete_surrounding_text (int offset, int len) const
1214 {
1215     if (m_impl->socket_active.is_connected ()) {
1216         m_impl->send.clear ();
1217         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1218         m_impl->send.put_data (m_impl->magic_active);
1219         m_impl->send.put_command (SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT);
1220         m_impl->send.put_data (offset);
1221         m_impl->send.put_data (len);
1222         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1223     }
1224 }
1225
1226 /**
1227  * @brief Request to get uuid list of all keyboard ISEs.
1228  *
1229  * @param uuid The helper ISE UUID.
1230  */
1231 void
1232 HelperAgent::get_keyboard_ise_list (const String &uuid) const
1233 {
1234     if (m_impl->socket_active.is_connected ()) {
1235         m_impl->send.clear ();
1236         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1237         m_impl->send.put_data (m_impl->magic_active);
1238         m_impl->send.put_command (ISM_TRANS_CMD_GET_KEYBOARD_ISE_LIST);
1239         m_impl->send.put_data (uuid);
1240         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1241     }
1242 }
1243
1244 /**
1245  * @brief Set candidate position in screen.
1246  *
1247  * @param left The x position in screen.
1248  * @param top The y position in screen.
1249  */
1250 void
1251 HelperAgent::set_candidate_position (int left, int top) const
1252 {
1253     if (m_impl->socket_active.is_connected ()) {
1254         m_impl->send.clear ();
1255         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1256         m_impl->send.put_data (m_impl->magic_active);
1257         m_impl->send.put_command (ISM_TRANS_CMD_SET_CANDIDATE_POSITION);
1258         m_impl->send.put_data (left);
1259         m_impl->send.put_data (top);
1260         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1261     }
1262 }
1263
1264 /**
1265  * @brief Set candidate style.
1266  *
1267  * @param portrait_line - the displayed line number for portrait mode.
1268  * @param mode          - candidate window mode.
1269  */
1270 void
1271 HelperAgent::set_candidate_style (ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line,
1272                                   ISF_CANDIDATE_MODE_T          mode) const
1273 {
1274     if (m_impl->socket_active.is_connected ()) {
1275         m_impl->send.clear ();
1276         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1277         m_impl->send.put_data (m_impl->magic_active);
1278         m_impl->send.put_command (ISM_TRANS_CMD_SET_CANDIDATE_UI);
1279         m_impl->send.put_data (portrait_line);
1280         m_impl->send.put_data (mode);
1281         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1282     }
1283 }
1284
1285 /**
1286  * @brief Request to hide candidate window.
1287  */
1288 void
1289 HelperAgent::candidate_hide (void) const
1290 {
1291     if (m_impl->socket_active.is_connected ()) {
1292         m_impl->send.clear ();
1293         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1294         m_impl->send.put_data (m_impl->magic_active);
1295         m_impl->send.put_command (ISM_TRANS_CMD_HIDE_CANDIDATE);
1296         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1297     }
1298 }
1299
1300 /**
1301  * @brief Request to get candidate window size and position.
1302  *
1303  * @param uuid The helper ISE UUID.
1304  */
1305 void
1306 HelperAgent::get_candidate_window_geometry (const String &uuid) const
1307 {
1308     if (m_impl->socket_active.is_connected ()) {
1309         m_impl->send.clear ();
1310         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1311         m_impl->send.put_data (m_impl->magic_active);
1312         m_impl->send.put_command (ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY);
1313         m_impl->send.put_data (uuid);
1314         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1315     }
1316 }
1317
1318 /**
1319  * @brief Set current keyboard ISE.
1320  *
1321  * @param uuid The keyboard ISE UUID.
1322  */
1323 void
1324 HelperAgent::set_keyboard_ise_by_uuid (const String &uuid) const
1325 {
1326     if (m_impl->socket_active.is_connected ()) {
1327         m_impl->send.clear ();
1328         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1329         m_impl->send.put_data (m_impl->magic_active);
1330         m_impl->send.put_command (ISM_TRANS_CMD_SET_KEYBOARD_ISE_BY_UUID);
1331         m_impl->send.put_data (uuid);
1332         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1333     }
1334 }
1335
1336 /**
1337  * @brief Request to get current keyboard ISE information.
1338  *
1339  * @param uuid The helper ISE UUID.
1340  */
1341 void
1342 HelperAgent::get_keyboard_ise (const String &uuid) const
1343 {
1344     if (m_impl->socket_active.is_connected ()) {
1345         m_impl->send.clear ();
1346         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1347         m_impl->send.put_data (m_impl->magic_active);
1348         m_impl->send.put_command (ISM_TRANS_CMD_GET_KEYBOARD_ISE);
1349         m_impl->send.put_data (uuid);
1350         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1351     }
1352 }
1353
1354 /**
1355  * @brief Update ISE window geometry.
1356  *
1357  * @param x      The x position in screen.
1358  * @param y      The y position in screen.
1359  * @param width  The ISE window width.
1360  * @param height The ISE window height.
1361  */
1362 void
1363 HelperAgent::update_geometry (int x, int y, int width, int height) const
1364 {
1365     if (m_impl->socket_active.is_connected ()) {
1366         m_impl->send.clear ();
1367         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1368         m_impl->send.put_data (m_impl->magic_active);
1369         m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ISE_GEOMETRY);
1370         m_impl->send.put_data (x);
1371         m_impl->send.put_data (y);
1372         m_impl->send.put_data (width);
1373         m_impl->send.put_data (height);
1374         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1375     }
1376 }
1377
1378 /**
1379  * @brief Request to expand candidate window.
1380  */
1381 void
1382 HelperAgent::expand_candidate (void) const
1383 {
1384     if (m_impl->socket_active.is_connected ()) {
1385         m_impl->send.clear ();
1386         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1387         m_impl->send.put_data (m_impl->magic_active);
1388         m_impl->send.put_command (ISM_TRANS_CMD_EXPAND_CANDIDATE);
1389         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1390     }
1391 }
1392
1393 /**
1394  * @brief Request to contract candidate window.
1395  */
1396 void
1397 HelperAgent::contract_candidate (void) const
1398 {
1399     if (m_impl->socket_active.is_connected ()) {
1400         m_impl->send.clear ();
1401         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1402         m_impl->send.put_data (m_impl->magic_active);
1403         m_impl->send.put_command (ISM_TRANS_CMD_CONTRACT_CANDIDATE);
1404         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1405     }
1406 }
1407
1408 /**
1409  * @brief Request to reset keyboard ISE.
1410  */
1411 void
1412 HelperAgent::reset_keyboard_ise (void) const
1413 {
1414     if (m_impl->socket_active.is_connected ()) {
1415         m_impl->send.clear ();
1416         m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1417         m_impl->send.put_data (m_impl->magic_active);
1418         m_impl->send.put_command (ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE);
1419         m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1420     }
1421 }
1422
1423 /**
1424  * @brief Connect a slot to Helper exit signal.
1425  *
1426  * This signal is used to let the Helper exit.
1427  *
1428  * The prototype of the slot is:
1429  *
1430  * void exit (const HelperAgent *agent, int ic, const String &ic_uuid);
1431  *
1432  * Parameters:
1433  * - agent    The pointer to the HelperAgent object which emits this signal.
1434  * - ic       An opaque handle of the currently focused input context.
1435  * - ic_uuid  The UUID of the IMEngineInstance associated with the focused input context.
1436  */
1437 Connection
1438 HelperAgent::signal_connect_exit (HelperAgentSlotVoid *slot)
1439 {
1440     return m_impl->signal_exit.connect (slot);
1441 }
1442
1443 /**
1444  * @brief Connect a slot to Helper attach input context signal.
1445  *
1446  * This signal is used to attach an input context to this helper.
1447  *
1448  * When an input context requst to start this helper, then this
1449  * signal will be emitted as soon as the helper is started.
1450  *
1451  * When an input context want to start an already started helper,
1452  * this signal will also be emitted.
1453  *
1454  * Helper can send some events back to the IMEngineInstance in this
1455  * signal-slot, to inform that it has been started sccessfully.
1456  *
1457  * The prototype of the slot is:
1458  *
1459  * void attach_input_context (const HelperAgent *agent, int ic, const String &ic_uuid);
1460  */
1461 Connection
1462 HelperAgent::signal_connect_attach_input_context (HelperAgentSlotVoid *slot)
1463 {
1464     return m_impl->signal_attach_input_context.connect (slot);
1465 }
1466
1467 /**
1468  * @brief Connect a slot to Helper detach input context signal.
1469  *
1470  * This signal is used to detach an input context from this helper.
1471  *
1472  * When an input context requst to stop this helper, then this
1473  * signal will be emitted.
1474  *
1475  * Helper shouldn't send any event back to the IMEngineInstance, because
1476  * the IMEngineInstance attached to the ic should have been destroyed.
1477  *
1478  * The prototype of the slot is:
1479  *
1480  * void detach_input_context (const HelperAgent *agent, int ic, const String &ic_uuid);
1481  */
1482 Connection
1483 HelperAgent::signal_connect_detach_input_context (HelperAgentSlotVoid *slot)
1484 {
1485     return m_impl->signal_detach_input_context.connect (slot);
1486 }
1487
1488 /**
1489  * @brief Connect a slot to Helper reload config signal.
1490  *
1491  * This signal is used to let the Helper reload configuration.
1492  *
1493  * The prototype of the slot is:
1494  *
1495  * void reload_config (const HelperAgent *agent, int ic, const String &ic_uuid);
1496  */
1497 Connection
1498 HelperAgent::signal_connect_reload_config (HelperAgentSlotVoid *slot)
1499 {
1500     return m_impl->signal_reload_config.connect (slot);
1501 }
1502
1503 /**
1504  * @brief Connect a slot to Helper update screen signal.
1505  *
1506  * This signal is used to let the Helper move its GUI to another screen.
1507  * It can only be emitted when SCIM_HELPER_NEED_SCREEN_INFO is set in HelperInfo.option.
1508  *
1509  * The prototype of the slot is:
1510  *
1511  * void update_screen (const HelperAgent *agent, int ic, const String &ic_uuid, int screen_number);
1512  */
1513 Connection
1514 HelperAgent::signal_connect_update_screen (HelperAgentSlotInt *slot)
1515 {
1516     return m_impl->signal_update_screen.connect (slot);
1517 }
1518
1519 /**
1520  * @brief Connect a slot to Helper update spot location signal.
1521  *
1522  * This signal is used to let the Helper move its GUI according to the current spot location.
1523  * It can only be emitted when SCIM_HELPER_NEED_SPOT_LOCATION_INFO is set in HelperInfo.option.
1524  *
1525  * The prototype of the slot is:
1526  * void update_spot_location (const HelperAgent *agent, int ic, const String &ic_uuid, int x, int y);
1527  */
1528 Connection
1529 HelperAgent::signal_connect_update_spot_location (HelperAgentSlotIntInt *slot)
1530 {
1531     return m_impl->signal_update_spot_location.connect (slot);
1532 }
1533
1534 /**
1535  * @brief Connect a slot to Helper update cursor position signal.
1536  *
1537  * This signal is used to let the Helper get the cursor position information.
1538  *
1539  * The prototype of the slot is:
1540  * void update_cursor_position (const HelperAgent *agent, int ic, const String &ic_uuid, int cursor_pos);
1541  */
1542 Connection
1543 HelperAgent::signal_connect_update_cursor_position (HelperAgentSlotInt *slot)
1544 {
1545     return m_impl->signal_update_cursor_position.connect (slot);
1546 }
1547
1548 /**
1549  * @brief Connect a slot to Helper update surrounding text signal.
1550  *
1551  * This signal is used to let the Helper get the surrounding text.
1552  *
1553  * The prototype of the slot is:
1554  * void update_surrounding_text (const HelperAgent *agent, int ic, const String &text, int cursor);
1555  */
1556 Connection
1557 HelperAgent::signal_connect_update_surrounding_text (HelperAgentSlotInt *slot)
1558 {
1559     return m_impl->signal_update_surrounding_text.connect (slot);
1560 }
1561
1562 /**
1563  * @brief Connect a slot to Helper trigger property signal.
1564  *
1565  * This signal is used to trigger a property registered by this Helper.
1566  * A property will be triggered when user clicks on it.
1567  *
1568  * The prototype of the slot is:
1569  * void trigger_property (const HelperAgent *agent, int ic, const String &ic_uuid, const String &property);
1570  */
1571 Connection
1572 HelperAgent::signal_connect_trigger_property (HelperAgentSlotString *slot)
1573 {
1574     return m_impl->signal_trigger_property.connect (slot);
1575 }
1576
1577 /**
1578  * @brief Connect a slot to Helper process imengine event signal.
1579  *
1580  * This signal is used to deliver the events sent from IMEngine to Helper.
1581  *
1582  * The prototype of the slot is:
1583  * void process_imengine_event (const HelperAgent *agent, int ic, const String &ic_uuid, const Transaction &transaction);
1584  */
1585 Connection
1586 HelperAgent::signal_connect_process_imengine_event (HelperAgentSlotTransaction *slot)
1587 {
1588     return m_impl->signal_process_imengine_event.connect (slot);
1589 }
1590
1591 /**
1592  * @brief Connect a slot to Helper focus out signal.
1593  *
1594  * This signal is used to do something when input context is focus out.
1595  *
1596  * The prototype of the slot is:
1597  * void focus_out (const HelperAgent *agent, int ic, const String &ic_uuid);
1598  */
1599 Connection
1600 HelperAgent::signal_connect_focus_out (HelperAgentSlotVoid *slot)
1601 {
1602     return m_impl->signal_focus_out.connect (slot);
1603 }
1604
1605 /**
1606  * @brief Connect a slot to Helper focus in signal.
1607  *
1608  * This signal is used to do something when input context is focus in.
1609  *
1610  * The prototype of the slot is:
1611  * void focus_in (const HelperAgent *agent, int ic, const String &ic_uuid);
1612  */
1613 Connection
1614 HelperAgent::signal_connect_focus_in (HelperAgentSlotVoid *slot)
1615 {
1616     return m_impl->signal_focus_in.connect (slot);
1617 }
1618
1619 /**
1620  * @brief Connect a slot to Helper show signal.
1621  *
1622  * This signal is used to show Helper ISE window.
1623  *
1624  * The prototype of the slot is:
1625  * void ise_show (const HelperAgent *agent, int ic, char *buf, size_t &len);
1626  */
1627 Connection
1628 HelperAgent::signal_connect_ise_show (HelperAgentSlotIntRawVoid *slot)
1629 {
1630     return m_impl->signal_ise_show.connect (slot);
1631 }
1632
1633 /**
1634  * @brief Connect a slot to Helper hide signal.
1635  *
1636  * This signal is used to hide Helper ISE window.
1637  *
1638  * The prototype of the slot is:
1639  * void ise_hide (const HelperAgent *agent, int ic, const String &ic_uuid);
1640  */
1641 Connection
1642 HelperAgent::signal_connect_ise_hide (HelperAgentSlotVoid *slot)
1643 {
1644     return m_impl->signal_ise_hide.connect (slot);
1645 }
1646
1647 /**
1648  * @brief Connect a slot to Helper get ISE window geometry signal.
1649  *
1650  * This signal is used to get Helper ISE window size and position.
1651  *
1652  * The prototype of the slot is:
1653  * void get_geometry (const HelperAgent *agent, struct rectinfo &info);
1654  */
1655 Connection
1656 HelperAgent::signal_connect_get_geometry (HelperAgentSlotSize *slot)
1657 {
1658     return m_impl->signal_get_geometry.connect (slot);
1659 }
1660
1661 /**
1662  * @brief Connect a slot to Helper set mode signal.
1663  *
1664  * This signal is used to set Helper ISE mode.
1665  *
1666  * The prototype of the slot is:
1667  * void set_mode (const HelperAgent *agent, uint32 &mode);
1668  */
1669 Connection
1670 HelperAgent::signal_connect_set_mode (HelperAgentSlotUintVoid *slot)
1671 {
1672     return m_impl->signal_set_mode.connect (slot);
1673 }
1674
1675 /**
1676  * @brief Connect a slot to Helper set language signal.
1677  *
1678  * This signal is used to set Helper ISE language.
1679  *
1680  * The prototype of the slot is:
1681  * void set_language (const HelperAgent *agent, uint32 &language);
1682  */
1683 Connection
1684 HelperAgent::signal_connect_set_language (HelperAgentSlotUintVoid *slot)
1685 {
1686     return m_impl->signal_set_language.connect (slot);
1687 }
1688
1689 /**
1690  * @brief Connect a slot to Helper set im data signal.
1691  *
1692  * This signal is used to send im data to Helper ISE.
1693  *
1694  * The prototype of the slot is:
1695  * void set_imdata (const HelperAgent *agent, char *buf, size_t &len);
1696  */
1697 Connection
1698 HelperAgent::signal_connect_set_imdata (HelperAgentSlotRawVoid *slot)
1699 {
1700     return m_impl->signal_set_imdata.connect (slot);
1701 }
1702
1703 /**
1704  * @brief Connect a slot to Helper get im data signal.
1705  *
1706  * This signal is used to get im data from Helper ISE.
1707  *
1708  * The prototype of the slot is:
1709  * void get_imdata (const HelperAgent *, char **buf, size_t &len);
1710  */
1711 Connection
1712 HelperAgent::signal_connect_get_imdata (HelperAgentSlotGetRawVoid *slot)
1713 {
1714     return m_impl->signal_get_imdata.connect (slot);
1715 }
1716
1717 /**
1718  * @brief Connect a slot to Helper get language locale signal.
1719  *
1720  * This signal is used to get language locale from Helper ISE.
1721  *
1722  * The prototype of the slot is:
1723  * void get_language_locale (const HelperAgent *, int ic, char **locale);
1724  */
1725 Connection
1726 HelperAgent::signal_connect_get_language_locale (HelperAgentSlotIntGetStringVoid *slot)
1727 {
1728     return m_impl->signal_get_language_locale.connect (slot);
1729 }
1730
1731 /**
1732  * @brief Connect a slot to Helper set return key type signal.
1733  *
1734  * This signal is used to send return key type to Helper ISE.
1735  *
1736  * The prototype of the slot is:
1737  * void set_return_key_type (const HelperAgent *agent, uint32 &type);
1738  */
1739 Connection
1740 HelperAgent::signal_connect_set_return_key_type (HelperAgentSlotUintVoid *slot)
1741 {
1742     return m_impl->signal_set_return_key_type.connect (slot);
1743 }
1744
1745 /**
1746  * @brief Connect a slot to Helper get return key type signal.
1747  *
1748  * This signal is used to get return key type from Helper ISE.
1749  *
1750  * The prototype of the slot is:
1751  * void get_return_key_type (const HelperAgent *agent, uint32 &type);
1752  */
1753 Connection
1754 HelperAgent::signal_connect_get_return_key_type (HelperAgentSlotUintVoid *slot)
1755 {
1756     return m_impl->signal_get_return_key_type.connect (slot);
1757 }
1758
1759 /**
1760  * @brief Connect a slot to Helper set return key disable signal.
1761  *
1762  * This signal is used to send return key disable to Helper ISE.
1763  *
1764  * The prototype of the slot is:
1765  * void set_return_key_disable (const HelperAgent *agent, uint32 &disabled);
1766  */
1767 Connection
1768 HelperAgent::signal_connect_set_return_key_disable (HelperAgentSlotUintVoid *slot)
1769 {
1770     return m_impl->signal_set_return_key_disable.connect (slot);
1771 }
1772
1773 /**
1774  * @brief Connect a slot to Helper get return key disable signal.
1775  *
1776  * This signal is used to get return key disable from Helper ISE.
1777  *
1778  * The prototype of the slot is:
1779  * void get_return_key_disable (const HelperAgent *agent, uint32 &disabled);
1780  */
1781 Connection
1782 HelperAgent::signal_connect_get_return_key_disable (HelperAgentSlotUintVoid *slot)
1783 {
1784     return m_impl->signal_get_return_key_disable.connect (slot);
1785 }
1786
1787 /**
1788  * @brief Connect a slot to Helper set layout signal.
1789  *
1790  * This signal is used to set Helper ISE layout.
1791  *
1792  * The prototype of the slot is:
1793  * void set_layout (const HelperAgent *agent, uint32 &layout);
1794  */
1795 Connection
1796 HelperAgent::signal_connect_set_layout (HelperAgentSlotUintVoid *slot)
1797 {
1798     return m_impl->signal_set_layout.connect (slot);
1799 }
1800
1801 /**
1802  * @brief Connect a slot to Helper get layout signal.
1803  *
1804  * This signal is used to get Helper ISE layout.
1805  *
1806  * The prototype of the slot is:
1807  * void get_layout (const HelperAgent *agent, uint32 &layout);
1808  */
1809 Connection
1810 HelperAgent::signal_connect_get_layout (HelperAgentSlotUintVoid *slot)
1811 {
1812     return m_impl->signal_get_layout.connect (slot);
1813 }
1814
1815 /**
1816  * @brief Connect a slot to Helper set shift mode signal.
1817  *
1818  * This signal is used to set Helper shift mode.
1819  *
1820  * The prototype of the slot is:
1821  * void set_caps_mode (const HelperAgent *agent, uint32 &mode);
1822  */
1823 Connection
1824 HelperAgent::signal_connect_set_caps_mode (HelperAgentSlotUintVoid *slot)
1825 {
1826     return m_impl->signal_set_caps_mode.connect (slot);
1827 }
1828
1829 /**
1830  * @brief Connect a slot to Helper reset input context signal.
1831  *
1832  * This signal is used to reset Helper ISE input context.
1833  *
1834  * The prototype of the slot is:
1835  * void reset_input_context (const HelperAgent *agent, int ic, const String &uuid);
1836  */
1837 Connection
1838 HelperAgent::signal_connect_reset_input_context (HelperAgentSlotVoid *slot)
1839 {
1840     return m_impl->signal_reset_input_context.connect (slot);
1841 }
1842
1843 /**
1844  * @brief Connect a slot to Helper update candidate window geometry signal.
1845  *
1846  * This signal is used to get candidate window size and position.
1847  *
1848  * The prototype of the slot is:
1849  * void update_candidate_geometry (const HelperAgent *agent, int ic, const String &uuid, const rectinfo &info);
1850  */
1851 Connection
1852 HelperAgent::signal_connect_update_candidate_geometry (HelperAgentSlotRect *slot)
1853 {
1854     return m_impl->signal_update_candidate_geometry.connect (slot);
1855 }
1856
1857 /**
1858  * @brief Connect a slot to Helper update keyboard ISE signal.
1859  *
1860  * This signal is used to get current keyboard ISE name and uuid.
1861  *
1862  * The prototype of the slot is:
1863  * void update_keyboard_ise (const HelperAgent *agent, int ic, const String &uuid,
1864  *                           const String &ise_name, const String &ise_uuid);
1865  */
1866 Connection
1867 HelperAgent::signal_connect_update_keyboard_ise (HelperAgentSlotString2 *slot)
1868 {
1869     return m_impl->signal_update_keyboard_ise.connect (slot);
1870 }
1871
1872 /**
1873  * @brief Connect a slot to Helper update keyboard ISE list signal.
1874  *
1875  * This signal is used to get uuid list of all keyboard ISEs.
1876  *
1877  * The prototype of the slot is:
1878  * void update_keyboard_ise_list (const HelperAgent *agent, int ic, const String &uuid,
1879  *                                const std::vector<String> &ise_list);
1880  */
1881 Connection
1882 HelperAgent::signal_connect_update_keyboard_ise_list (HelperAgentSlotStringVector *slot)
1883 {
1884     return m_impl->signal_update_keyboard_ise_list.connect (slot);
1885 }
1886
1887 /**
1888  * @brief Connect a slot to Helper candidate more window show signal.
1889  *
1890  * This signal is used to do someting when candidate more window is showed.
1891  *
1892  * The prototype of the slot is:
1893  * void candidate_more_window_show (const HelperAgent *agent, int ic, const String &uuid);
1894  */
1895 Connection
1896 HelperAgent::signal_connect_candidate_more_window_show (HelperAgentSlotVoid *slot)
1897 {
1898     return m_impl->signal_candidate_more_window_show.connect (slot);
1899 }
1900
1901 /**
1902  * @brief Connect a slot to Helper candidate more window hide signal.
1903  *
1904  * This signal is used to do someting when candidate more window is hidden.
1905  *
1906  * The prototype of the slot is:
1907  * void candidate_more_window_hide (const HelperAgent *agent, int ic, const String &uuid);
1908  */
1909 Connection
1910 HelperAgent::signal_connect_candidate_more_window_hide (HelperAgentSlotVoid *slot)
1911 {
1912     return m_impl->signal_candidate_more_window_hide.connect (slot);
1913 }
1914
1915 /**
1916  * @brief Connect a slot to Helper select aux signal.
1917  *
1918  * This signal is used to do something when aux is selected.
1919  *
1920  * The prototype of the slot is:
1921  * void select_aux (const HelperAgent *agent, int ic, const String &uuid, int index);
1922  */
1923 Connection
1924 HelperAgent::signal_connect_select_aux (HelperAgentSlotInt *slot)
1925 {
1926     return m_impl->signal_select_aux.connect (slot);
1927 }
1928
1929 /**
1930  * @brief Connect a slot to Helper select candidate signal.
1931  *
1932  * This signal is used to do something when candidate is selected.
1933  *
1934  * The prototype of the slot is:
1935  * void select_candidate (const HelperAgent *agent, int ic, const String &uuid, int index);
1936  */
1937 Connection
1938 HelperAgent::signal_connect_select_candidate (HelperAgentSlotInt *slot)
1939 {
1940     return m_impl->signal_select_candidate.connect (slot);
1941 }
1942
1943 /**
1944  * @brief Connect a slot to Helper candidate table page up signal.
1945  *
1946  * This signal is used to do something when candidate table is paged up.
1947  *
1948  * The prototype of the slot is:
1949  * void candidate_table_page_up (const HelperAgent *agent, int ic, const String &uuid);
1950  */
1951 Connection
1952 HelperAgent::signal_connect_candidate_table_page_up (HelperAgentSlotVoid *slot)
1953 {
1954     return m_impl->signal_candidate_table_page_up.connect (slot);
1955 }
1956
1957 /**
1958  * @brief Connect a slot to Helper candidate table page down signal.
1959  *
1960  * This signal is used to do something when candidate table is paged down.
1961  *
1962  * The prototype of the slot is:
1963  * void candidate_table_page_down (const HelperAgent *agent, int ic, const String &uuid);
1964  */
1965 Connection
1966 HelperAgent::signal_connect_candidate_table_page_down (HelperAgentSlotVoid *slot)
1967 {
1968     return m_impl->signal_candidate_table_page_down.connect (slot);
1969 }
1970
1971 /**
1972  * @brief Connect a slot to Helper update candidate table page size signal.
1973  *
1974  * This signal is used to do something when candidate table page size is changed.
1975  *
1976  * The prototype of the slot is:
1977  * void update_candidate_table_page_size (const HelperAgent *, int ic, const String &uuid, int page_size);
1978  */
1979 Connection
1980 HelperAgent::signal_connect_update_candidate_table_page_size (HelperAgentSlotInt *slot)
1981 {
1982     return m_impl->signal_update_candidate_table_page_size.connect (slot);
1983 }
1984
1985 /**
1986  * @brief Connect a slot to Helper update candidate item layout signal.
1987  *
1988  * The prototype of the slot is:
1989  * void update_candidate_item_layout (const HelperAgent *, const std::vector<uint32> &row_items);
1990  */
1991 Connection
1992 HelperAgent::signal_connect_update_candidate_item_layout (HelperAgentSlotUintVector *slot)
1993 {
1994     return m_impl->signal_update_candidate_item_layout.connect (slot);
1995 }
1996
1997 /**
1998  * @brief Connect a slot to Helper select associate signal.
1999  *
2000  * This signal is used to do something when associate is selected.
2001  *
2002  * The prototype of the slot is:
2003  * void select_associate (const HelperAgent *agent, int ic, const String &uuid, int index);
2004  */
2005 Connection
2006 HelperAgent::signal_connect_select_associate (HelperAgentSlotInt *slot)
2007 {
2008     return m_impl->signal_select_associate.connect (slot);
2009 }
2010
2011 /**
2012  * @brief Connect a slot to Helper associate table page up signal.
2013  *
2014  * This signal is used to do something when associate table is paged up.
2015  *
2016  * The prototype of the slot is:
2017  * void associate_table_page_up (const HelperAgent *agent, int ic, const String &uuid);
2018  */
2019 Connection
2020 HelperAgent::signal_connect_associate_table_page_up (HelperAgentSlotVoid *slot)
2021 {
2022     return m_impl->signal_associate_table_page_up.connect (slot);
2023 }
2024
2025 /**
2026  * @brief Connect a slot to Helper associate table page down signal.
2027  *
2028  * This signal is used to do something when associate table is paged down.
2029  *
2030  * The prototype of the slot is:
2031  * void associate_table_page_down (const HelperAgent *agent, int ic, const String &uuid);
2032  */
2033 Connection
2034 HelperAgent::signal_connect_associate_table_page_down (HelperAgentSlotVoid *slot)
2035 {
2036     return m_impl->signal_associate_table_page_down.connect (slot);
2037 }
2038
2039 /**
2040  * @brief Connect a slot to Helper update associate table page size signal.
2041  *
2042  * This signal is used to do something when associate table page size is changed.
2043  *
2044  * The prototype of the slot is:
2045  * void update_associate_table_page_size (const HelperAgent *, int ic, const String &uuid, int page_size);
2046  */
2047 Connection
2048 HelperAgent::signal_connect_update_associate_table_page_size (HelperAgentSlotInt *slot)
2049 {
2050     return m_impl->signal_update_associate_table_page_size.connect (slot);
2051 }
2052
2053 /**
2054  * @brief Connect a slot to Helper turn on log signal.
2055  *
2056  * This signal is used to turn on Helper ISE debug information.
2057  *
2058  * The prototype of the slot is:
2059  * void turn_on_log (const HelperAgent *agent, uint32 &on);
2060  */
2061 Connection
2062 HelperAgent::signal_connect_turn_on_log (HelperAgentSlotUintVoid *slot)
2063 {
2064     return m_impl->signal_turn_on_log.connect (slot);
2065 }
2066
2067 /**
2068  * @brief Connect a slot to Helper update displayed candidate number signal.
2069  *
2070  * This signal is used to inform helper ISE displayed candidate number.
2071  *
2072  * The prototype of the slot is:
2073  * void update_displayed_candidate_number (const HelperAgent *, int ic, const String &uuid, int number);
2074  */
2075 Connection
2076 HelperAgent::signal_connect_update_displayed_candidate_number (HelperAgentSlotInt *slot)
2077 {
2078     return m_impl->signal_update_displayed_candidate_number.connect (slot);
2079 }
2080
2081 /**
2082  * @brief Connect a slot to Helper longpress candidate signal.
2083  *
2084  * This signal is used to do something when candidate is longpress.
2085  *
2086  * The prototype of the slot is:
2087  * void longpress_candidate (const HelperAgent *agent, int ic, const String &uuid, int index);
2088  */
2089 Connection
2090 HelperAgent::signal_connect_longpress_candidate (HelperAgentSlotInt *slot)
2091 {
2092     return m_impl->signal_longpress_candidate.connect (slot);
2093 }
2094
2095 } /* namespace scim */
2096
2097 /*
2098 vi:ts=4:nowrap:ai:expandtab
2099 */
2100