Merging isf-wsc-efl and scim-panel-efl processes
[platform/core/uifw/isf.git] / ism / src / isf_panel_agent_base.cpp
1 /** @file scim_panel.cpp
2  *  @brief Implementation of class PanelAgent.
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) 2005 James Su <suzhe@tsinghua.org.cn>
11  * Copyright (c) 2012-2015 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 signals
31  *    a. m_signal_set_keyboard_ise and m_signal_get_keyboard_ise
32  *    b. m_signal_focus_in and m_signal_focus_out
33  *    c. m_signal_expand_candidate, m_signal_contract_candidate and m_signal_set_candidate_ui
34  *    d. m_signal_get_ise_list, m_signal_get_keyboard_ise_list, m_signal_update_ise_geometry and m_signal_get_ise_information
35  *    e. m_signal_set_active_ise_by_uuid and m_signal_get_ise_info_by_uuid
36  *    f. m_signal_accept_connection, m_signal_close_connection and m_signal_exit
37  * 2. Add new interface APIs in PanelClient class
38  *    a. get_helper_manager_id (), has_helper_manager_pending_event () and filter_helper_manager_event ()
39  *    b. update_candidate_panel_event (), update_input_panel_event () and select_aux ()
40  *    c. candidate_more_window_show () and candidate_more_window_hide ()
41  *    d. update_displayed_candidate_number () and update_candidate_item_layout ()
42  *    e. stop_helper (), send_longpress_event () and update_ise_list ()
43  *    f. filter_event (), filter_exception_event () and get_server_id ()
44  * 3. Donot use thread to receive message
45  * 4. Monitor socket frontend for self-recovery function
46  *
47  * $Id: scim_panel_agent.cpp,v 1.8.2.1 2006/01/09 14:32:18 suzhe Exp $
48  *
49  */
50
51 #define Uses_SCIM_TRANSACTION
52 #define Uses_SCIM_TRANS_COMMANDS
53 #define Uses_SCIM_PANEL_AGENT
54 #define Uses_SCIM_HELPER
55 #define Uses_SCIM_SOCKET
56 #define Uses_SCIM_EVENT
57 #define Uses_SCIM_CONFIG
58 #define Uses_SCIM_CONFIG_MODULE
59 #define Uses_SCIM_CONFIG_PATH
60 #define Uses_SCIM_UTILITY
61
62 #include <string.h>
63 #include <sys/types.h>
64 #include <sys/times.h>
65 #include <dlog.h>
66 #include <unistd.h>
67 #include "scim_private.h"
68 #include "scim.h"
69 #include "scim_stl_map.h"
70 #include "privilege_checker.h"
71
72 #ifdef LOG_TAG
73 # undef LOG_TAG
74 #endif
75 #define LOG_TAG             "ISF_PANEL_AGENT_BASE"
76
77
78 namespace scim
79 {
80
81
82 PanelAgentBase::PanelAgentBase (const String& name)
83     :m_name (name)
84 {
85 }
86
87 PanelAgentBase::~PanelAgentBase ()
88 {
89 }
90
91 bool PanelAgentBase::initialize (InfoManager* info_manager, const String& display, bool resident)
92 {
93     LOGW ("not implemented for %s", m_name.c_str ());
94     return false;
95 }
96
97 bool PanelAgentBase::valid (void) const
98 {
99     LOGW ("not implemented for %s", m_name.c_str ());
100     return false;
101 }
102
103 void PanelAgentBase::stop (void)
104 {
105     LOGW ("not implemented for %s", m_name.c_str ());
106 }
107
108
109 void PanelAgentBase::update_panel_event (int client,  uint32 context, int cmd, uint32 nType, uint32 nValue)
110 {
111     LOGW ("not implemented for %s", m_name.c_str ());
112 }
113
114 void PanelAgentBase::reset_keyboard_ise (int client, uint32 context)
115 {
116     LOGW ("not implemented for %s", m_name.c_str ());
117 }
118
119 void PanelAgentBase::update_keyboard_ise_list (int client, uint32 context)
120 {
121     LOGW ("not implemented for %s", m_name.c_str ());
122 }
123
124 void PanelAgentBase::change_factory (int client, uint32 context, const String&  uuid)
125 {
126     LOGW ("not implemented for %s", m_name.c_str ());
127 }
128
129 void PanelAgentBase::helper_candidate_show (int client, uint32 context, const String&  uuid)
130 {
131     LOGW ("not implemented for %s", m_name.c_str ());
132 }
133
134 void PanelAgentBase::helper_candidate_hide (int client, uint32 context, const String&  uuid)
135 {
136     LOGW ("not implemented for %s", m_name.c_str ());
137 }
138
139 /* if the uuid is empty, it must send to panelclient otherwise HelperAgent
140  */
141 void PanelAgentBase::candidate_more_window_show (int client, uint32 context)
142 {
143     LOGW ("not implemented for %s", m_name.c_str ());
144 }
145 /* if the uuid is empty, it must send to panelclient otherwise HelperAgent
146  */
147 void PanelAgentBase::candidate_more_window_hide (int client, uint32 context)
148 {
149     LOGW ("not implemented for %s", m_name.c_str ());
150 }
151
152 void PanelAgentBase::update_helper_lookup_table (int client, uint32 context, const String&  uuid, const LookupTable& table)
153 {
154     LOGW ("not implemented for %s", m_name.c_str ());
155 }
156
157 //select_aux
158 //helper_select_aux
159 //SCIM_TRANS_CMD_SELECT_AUX
160 //this function called by two places, will send message to help(with uuid) or app
161 void PanelAgentBase::select_aux (int client, uint32 context, uint32 item)
162 {
163     LOGW ("not implemented for %s", m_name.c_str ());
164 }
165 //SCIM_TRANS_CMD_SELECT_CANDIDATE
166 //this function called by two places, will send message to help(with uuid) or app
167 void PanelAgentBase::select_candidate (int client, uint32 context, uint32 item)
168 {
169     LOGW ("not implemented for %s", m_name.c_str ());
170 }
171
172 void PanelAgentBase::lookup_table_page_up (int client, uint32 context)
173 {
174     LOGW ("not implemented for %s", m_name.c_str ());
175 }
176
177 void PanelAgentBase::lookup_table_page_down (int client, uint32 context)
178 {
179     LOGW ("not implemented for %s", m_name.c_str ());
180 }
181
182 void PanelAgentBase::update_lookup_table_page_size (int client, uint32 context, uint32 size)
183 {
184     LOGW ("not implemented for %s", m_name.c_str ());
185 }
186
187 void PanelAgentBase::update_candidate_item_layout (int client, uint32 context, const std::vector<uint32>& row_items)
188 {
189     LOGW ("not implemented for %s", m_name.c_str ());
190 }
191
192 void PanelAgentBase::select_associate (int client, uint32 context, uint32 item)
193 {
194     LOGW ("not implemented for %s", m_name.c_str ());
195 }
196
197 void PanelAgentBase::associate_table_page_up (int client, uint32 context)
198 {
199     LOGW ("not implemented for %s", m_name.c_str ());
200 }
201
202 void PanelAgentBase::associate_table_page_down (int client, uint32 context)
203 {
204     LOGW ("not implemented for %s", m_name.c_str ());
205 }
206
207 void PanelAgentBase::update_associate_table_page_size (int client, uint32 context, uint32 size)
208 {
209     LOGW ("not implemented for %s", m_name.c_str ());
210 }
211
212 void PanelAgentBase::update_displayed_candidate_number (int client, uint32 context, uint32 size)
213 {
214     LOGW ("not implemented for %s", m_name.c_str ());
215 }
216
217 void PanelAgentBase::send_longpress_event (int client, uint32 context, uint32 index)
218 {
219     LOGW ("not implemented for %s", m_name.c_str ());
220 }
221
222 void PanelAgentBase::trigger_property (int client, uint32 context, const String&  property)
223 {
224     LOGW ("not implemented for %s", m_name.c_str ());
225 }
226
227 void PanelAgentBase::socket_start_helper (int client, uint32 context, const String& ic_uuid)
228 {
229     LOGW ("not implemented for %s", m_name.c_str ());
230 }
231
232
233 void PanelAgentBase::exit (int client, uint32 context)
234 {
235     LOGW ("not implemented for %s", m_name.c_str ());
236 }
237
238 void PanelAgentBase::focus_out_helper (int client, uint32 context, const String& uuid)
239 {
240     LOGW ("not implemented for %s", m_name.c_str ());
241 }
242
243 void PanelAgentBase::focus_in_helper (int client, uint32 context, const String& uuid)
244 {
245     LOGW ("not implemented for %s", m_name.c_str ());
246 }
247
248 void PanelAgentBase::show_helper (int client, uint32 context, const String& uuid, char* data, size_t& len)
249 {
250     LOGW ("not implemented for %s", m_name.c_str ());
251 }
252
253 void PanelAgentBase::hide_helper (int client, uint32 context, const String& uuid)
254 {
255     LOGW ("not implemented for %s", m_name.c_str ());
256 }
257
258 void PanelAgentBase::set_helper_mode (int client, uint32 context, const String& uuid, uint32& mode)
259 {
260     LOGW ("not implemented for %s", m_name.c_str ());
261 }
262
263 void PanelAgentBase::set_helper_language (int client, uint32 context, const String& uuid, uint32& language)
264 {
265     LOGW ("not implemented for %s", m_name.c_str ());
266 }
267
268 void PanelAgentBase::set_helper_imdata (int client, uint32 context, const String& uuid, const char* imdata, size_t& len)
269 {
270     LOGW ("not implemented for %s", m_name.c_str ());
271 }
272
273 void PanelAgentBase::set_helper_return_key_type (int client, uint32 context, const String& uuid, uint32 type)
274 {
275     LOGW ("not implemented for %s", m_name.c_str ());
276 }
277
278 void PanelAgentBase::get_helper_return_key_type (int client, uint32 context, const String& uuid, _OUT_ uint32& type)
279 {
280     LOGW ("not implemented for %s", m_name.c_str ());
281 }
282
283 void PanelAgentBase::set_helper_return_key_disable (int client, uint32 context, const String& uuid, uint32 disabled)
284 {
285     LOGW ("not implemented for %s", m_name.c_str ());
286 }
287
288 void PanelAgentBase::get_helper_return_key_disable (int client, uint32 context, const String& uuid, _OUT_ uint32& disabled)
289 {
290     LOGW ("not implemented for %s", m_name.c_str ());
291 }
292
293 void PanelAgentBase::set_helper_layout (int client, uint32 context, const String& uuid, uint32& layout)
294 {
295     LOGW ("not implemented for %s", m_name.c_str ());
296 }
297
298 void PanelAgentBase::set_helper_input_mode (int client, uint32 context, const String& uuid, uint32& mode)
299 {
300     LOGW ("not implemented for %s", m_name.c_str ());
301 }
302
303 void PanelAgentBase::set_helper_input_hint (int client, uint32 context, const String& uuid, uint32& hint)
304 {
305     LOGW ("not implemented for %s", m_name.c_str ());
306 }
307
308 void PanelAgentBase::set_helper_bidi_direction (int client, uint32 context, const String& uuid, uint32& direction)
309 {
310     LOGW ("not implemented for %s", m_name.c_str ());
311 }
312
313 void PanelAgentBase::set_helper_caps_mode (int client, uint32 context, const String& uuid, uint32& mode)
314 {
315     LOGW ("not implemented for %s", m_name.c_str ());
316 }
317
318 void PanelAgentBase::show_helper_option_window (int client, uint32 context, const String& uuid)
319 {
320     LOGW ("not implemented for %s", m_name.c_str ());
321 }
322
323 bool PanelAgentBase::process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, _OUT_ uint32& result)
324 {
325     LOGW ("not implemented for %s", m_name.c_str ());
326     return false;
327 }
328
329 bool PanelAgentBase::get_helper_geometry (int client, uint32 context, String& uuid, _OUT_ struct rectinfo& info)
330 {
331     LOGW ("not implemented for %s", m_name.c_str ());
332     return false;
333 }
334
335 void PanelAgentBase::get_helper_imdata (int client, uint32 context, String& uuid, _OUT_ char** imdata, _OUT_ size_t& len)
336 {
337     LOGW ("not implemented for %s", m_name.c_str ());
338 }
339
340 void PanelAgentBase::get_helper_layout (int client, uint32 context, String& uuid, uint32& layout)
341 {
342     LOGW ("not implemented for %s", m_name.c_str ());
343 }
344
345
346 void PanelAgentBase::get_ise_language_locale (int client, uint32 context, String& uuid, _OUT_ char* data, _OUT_ size_t& len)
347 {
348     LOGW ("not implemented for %s", m_name.c_str ());
349 }
350
351 void PanelAgentBase::check_option_window (int client, uint32 context, String& uuid, _OUT_ uint32& avail)
352 {
353     LOGW ("not implemented for %s", m_name.c_str ());
354 }
355
356 void PanelAgentBase::reset_ise_option (int client, uint32 context)
357 {
358     LOGW ("not implemented for %s", m_name.c_str ());
359 }
360
361 void PanelAgentBase::reset_helper_context (int client, uint32 context, const String& uuid)
362 {
363     LOGW ("not implemented for %s", m_name.c_str ());
364 }
365
366 void PanelAgentBase::reload_config (int client)
367 {
368     LOGW ("not implemented for %s", m_name.c_str ());
369 }
370
371 void PanelAgentBase::socket_update_surrounding_text (int client, uint32 context, String& uuid, String text, uint32 cursor)
372 {
373     LOGW ("not implemented for %s", m_name.c_str ());
374 }
375
376 void PanelAgentBase::socket_update_selection (int client, uint32 context, String& uuid, String text)
377 {
378     LOGW ("not implemented for %s", m_name.c_str ());
379 }
380
381 void PanelAgentBase::socket_get_keyboard_ise_list (int client, uint32 context, const String& uuid, std::vector<String>& list)
382 {
383     LOGW ("not implemented for %s", m_name.c_str ());
384 }
385
386 void PanelAgentBase::socket_get_candidate_ui (int client, uint32 context, const String& uuid,  int style,  int mode)
387 {
388     LOGW ("not implemented for %s", m_name.c_str ());
389 }
390
391 void PanelAgentBase::socket_get_candidate_geometry (int client, uint32 context, const String& uuid, struct rectinfo& info)
392 {
393     LOGW ("not implemented for %s", m_name.c_str ());
394 }
395 void PanelAgentBase::socket_get_keyboard_ise (int client, uint32 context, const String& uuid, String& ise_name, String& ise_uuid)
396 {
397     LOGW ("not implemented for %s", m_name.c_str ());
398 }
399
400 void PanelAgentBase::helper_detach_input_context (int client, uint32 context, const String& ic_uuid)
401 {
402     LOGW ("not implemented for %s", m_name.c_str ());
403 }
404
405 void PanelAgentBase::helper_process_imengine_event (int client, uint32 context, const String& ic_uuid, const Transaction& nest_transaction)
406 {
407     LOGW ("not implemented for %s", m_name.c_str ());
408 }
409
410 void PanelAgentBase::process_helper_event (int client, uint32 context, String target_uuid, String active_uuid, Transaction& nest_trans)
411 {
412     LOGW ("not implemented for %s", m_name.c_str ());
413 }
414
415 void PanelAgentBase::socket_helper_key_event (int client, uint32 context, int cmd , KeyEvent& key)
416 {
417     LOGW ("not implemented for %s", m_name.c_str ());
418 }
419
420 //SCIM_TRANS_CMD_GET_SURROUNDING_TEXT
421 //socket_helper_get_surrounding_text
422 void PanelAgentBase::socket_helper_get_surrounding_text (int client, uint32 context, uint32 maxlen_before, uint32 maxlen_after)
423 {
424     LOGW ("not implemented for %s", m_name.c_str ());
425 }
426 //SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT
427 //socket_helper_delete_surrounding_text
428 void PanelAgentBase::socket_helper_delete_surrounding_text (int client, uint32 context, uint32 offset, uint32 len)
429 {
430     LOGD ("not implemented ");
431 }
432 //SCIM_TRANS_CMD_GET_SELECTION
433 void PanelAgentBase::socket_helper_get_selection (int client, uint32 context)
434 {
435     LOGW ("not implemented for %s", m_name.c_str ());
436 }
437 //SCIM_TRANS_CMD_SET_SELECTION
438 void PanelAgentBase::socket_helper_set_selection (int client, uint32 context, uint32 start, uint32 end)
439 {
440     LOGW ("not implemented for %s", m_name.c_str ());
441 }
442
443 //socket_helper_update_input_context
444 //ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT
445 void PanelAgentBase::update_ise_input_context (int client, uint32 context, uint32 type, uint32 value)
446 {
447     LOGW ("not implemented for %s", m_name.c_str ());
448 }
449
450 //socket_helper_send_private_command
451 //SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND
452 void PanelAgentBase::send_private_command (int client, uint32 context, String command)
453 {
454     LOGW ("not implemented for %s", m_name.c_str ());
455 }
456
457 //SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION
458 void PanelAgentBase::helper_all_update_spot_location (int client, uint32 context, String uuid, int x, int y)
459 {
460     LOGW ("not implemented for %s", m_name.c_str ());
461 }
462 //ISM_TRANS_CMD_UPDATE_CURSOR_POSITION
463 void PanelAgentBase::helper_all_update_cursor_position (int client, uint32 context, String uuid, int cursor_pos)
464 {
465     LOGW ("not implemented for %s", m_name.c_str ());
466 }
467 //SCIM_TRANS_CMD_UPDATE_SCREEN
468 void PanelAgentBase::helper_all_update_screen (int client, uint32 context, String uuid, int screen)
469 {
470     LOGW ("not implemented for %s", m_name.c_str ());
471 }
472
473 //socket_helper_commit_string
474 //SCIM_TRANS_CMD_COMMIT_STRING
475 void PanelAgentBase::commit_string (int client, uint32 context,const WideString& wstr)
476 {
477     LOGW ("not implemented for %s", m_name.c_str ());
478 }
479 //socket_helper_show_preedit_string
480 //SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
481 void PanelAgentBase::show_preedit_string (int client, uint32 context)
482 {
483     LOGW ("not implemented for %s", m_name.c_str ());
484 }
485 //socket_helper_hide_preedit_string
486 //SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
487 void PanelAgentBase::hide_preedit_string (int client, uint32 context)
488 {
489     LOGW ("not implemented for %s", m_name.c_str ());
490 }
491 //socket_helper_update_preedit_string
492 //SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
493 void PanelAgentBase::update_preedit_string (int client, uint32 context, WideString wstr, AttributeList& attrs, uint32 caret)
494 {
495     LOGW ("not implemented for %s", m_name.c_str ());
496 }
497 //socket_helper_update_preedit_caret
498 //SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
499 void PanelAgentBase::update_preedit_caret (int client, uint32 context, uint32 caret)
500 {
501     LOGW ("not implemented for %s", m_name.c_str ());
502 }
503 //socket_helper_register_helper
504 //SCIM_TRANS_CMD_HELPER_ATTACH_INPUT_CONTEXT
505 //SCIM_TRANS_CMD_UPDATE_SCREEN
506 void PanelAgentBase::helper_attach_input_context_and_update_screen (int client, std::vector < std::pair <uint32, String> >& helper_ic_index,
507         uint32 current_screen)
508 {
509     LOGW ("not implemented for %s", m_name.c_str ());
510 }
511
512
513 } /* namespace scim */
514
515 /*
516 vi:ts=4:nowrap:ai:expandtab
517 */