• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A multilingual input method framework


Commit MetaInfo

Revision21d033997577184c47c3938e99cab1e466961aa1 (tree)
Time2006-06-06 20:12:16
Authorekato <ekato@ff9a...>
Commiterekato

Log Message

* qt/immodule-qhelpermanager.{cpp,h}
* qt/immodule-quiminputcontext.{cpp.h}

- Merge r3565:3567 from trunk.

Change Summary

Incremental Difference

--- a/qt/immodule-qhelpermanager.cpp
+++ b/qt/immodule-qhelpermanager.cpp
@@ -168,6 +168,7 @@ void QUimHelperManager::parseHelperStrImChange( const QString &str )
168168 QUimInputContext * cc;
169169 QStringList list = QStringList::split( "\n", str );
170170 QString im_name = list[ 1 ];
171+ QString im_name_sym = "'" + im_name;
171172
172173 if ( str.startsWith( "im_change_this_text_area_only" ) )
173174 {
@@ -184,6 +185,9 @@ void QUimHelperManager::parseHelperStrImChange( const QString &str )
184185 {
185186 uim_switch_im( cc->uimContext(), ( const char* ) im_name );
186187 cc->readIMConf();
188+ uim_prop_update_custom( cc->uimContext(),
189+ "custom-preserved-default-im-name",
190+ ( const char* ) im_name_sym );
187191 }
188192 }
189193 else if ( str.startsWith( "im_change_this_application_only" ) )
@@ -194,6 +198,9 @@ void QUimHelperManager::parseHelperStrImChange( const QString &str )
194198 {
195199 uim_switch_im( cc->uimContext(), ( const char* ) im_name );
196200 cc->readIMConf();
201+ uim_prop_update_custom( cc->uimContext(),
202+ "custom-preserved-default-im-name",
203+ ( const char* ) im_name_sym );
197204 }
198205 }
199206 }
@@ -227,6 +234,14 @@ void QUimHelperManager::sendImList()
227234 uim_helper_send_message( im_uim_fd, ( const char* ) msg.utf8() );
228235 }
229236
237+void QUimHelperManager::send_im_change_whole_desktop( const char *name )
238+{
239+ QString msg;
240+
241+ msg.sprintf("im_change_whole_desktop\n%s\n", name);
242+ uim_helper_send_message( im_uim_fd, ( const char* ) msg );
243+}
244+
230245 void QUimHelperManager::helper_disconnect_cb()
231246 {
232247 im_uim_fd = -1;
--- a/qt/immodule-qhelpermanager.h
+++ b/qt/immodule-qhelpermanager.h
@@ -55,6 +55,7 @@ public:
5555 static void helper_disconnect_cb();
5656 static void update_prop_list_cb( void *ptr, const char *str );
5757 static void update_prop_label_cb( void *ptr, const char *str );
58+ static void send_im_change_whole_desktop( const char *str );
5859
5960 public slots:
6061 void slotStdinActivated( int );
--- a/qt/immodule-quiminputcontext.cpp
+++ b/qt/immodule-quiminputcontext.cpp
@@ -136,6 +136,11 @@ uim_context QUimInputContext::createUimContext( const char *imname )
136136
137137 uim_set_prop_list_update_cb( uc, QUimHelperManager::update_prop_list_cb );
138138 uim_set_prop_label_update_cb( uc, QUimHelperManager::update_prop_label_cb );
139+
140+ uim_set_im_switch_request_cb( uc,
141+ QUimInputContext::switch_app_global_im_cb,
142+ QUimInputContext::switch_system_global_im_cb);
143+
139144 uim_prop_list_update( uc );
140145
141146 return uc;
@@ -453,6 +458,18 @@ void QUimInputContext::cand_deactivate_cb( void *ptr )
453458 ic->candidateDeactivate();
454459 }
455460
461+void QUimInputContext::switch_app_global_im_cb( void *ptr, const char *name )
462+{
463+ QUimInputContext *ic = ( QUimInputContext* ) ptr;
464+ ic->switch_app_global_im( name );
465+}
466+
467+void QUimInputContext::switch_system_global_im_cb( void *ptr, const char *name )
468+{
469+ QUimInputContext *ic = ( QUimInputContext* ) ptr;
470+ ic->switch_system_global_im( name );
471+}
472+
456473 void QUimInputContext::commitString( const QString& str )
457474 {
458475 if ( !isComposing() )
@@ -622,6 +639,29 @@ void QUimInputContext::candidateDeactivate()
622639 candwinIsActive = false;
623640 }
624641
642+void QUimInputContext::switch_app_global_im( const char *name )
643+{
644+ QUimInputContext *cc;
645+ QString im_name_sym;
646+
647+ im_name_sym.sprintf( "'%s", name);
648+
649+ for ( cc = contextList.first(); cc; cc = contextList.next() )
650+ {
651+ if (cc != this) {
652+ uim_switch_im( cc->uimContext(), name );
653+ cc->readIMConf();
654+ }
655+ }
656+ uim_prop_update_custom(this->uimContext(), "custom-preserved-default-im-name", ( const char* ) im_name_sym );
657+}
658+
659+void QUimInputContext::switch_system_global_im( const char *name )
660+{
661+ switch_app_global_im( name );
662+ QUimHelperManager::send_im_change_whole_desktop( name );
663+}
664+
625665 void QUimInputContext::createUimInfo()
626666 {
627667 if ( !uimInfo.isEmpty() )
--- a/qt/immodule-quiminputcontext.h
+++ b/qt/immodule-quiminputcontext.h
@@ -36,9 +36,10 @@ SUCH DAMAGE.
3636 #include <qinputcontext.h>
3737 #include <qptrlist.h>
3838
39-#include <uim/uim.h>
40-#include <uim/uim-util.h>
41-#include <uim/uim-helper.h>
39+#include "uim/uim.h"
40+#include "uim/uim-util.h"
41+#include "uim/uim-helper.h"
42+#include "uim/uim-im-switcher.h"
4243
4344 class CandidateWindow;
4445 class QUimHelperManager;
@@ -104,6 +105,9 @@ private:
104105 static void cand_select_cb( void *ptr, int index );
105106 static void cand_shift_page_cb( void* ptr, int index );
106107 static void cand_deactivate_cb( void *ptr );
108+ //imsw
109+ static void switch_app_global_im_cb( void *ptr, const char *str );
110+ static void switch_system_global_im_cb( void *ptr, const char *str );
107111 /* real functions for callbacks (correspond order) */
108112 //preedit
109113 void clearPreedit();
@@ -113,6 +117,9 @@ private:
113117 void candidateActivate( int nr, int displayLimit );
114118 void candidateSelect( int index );
115119 void candidateDeactivate();
120+ //imsw
121+ void switch_app_global_im( const char *str );
122+ void switch_system_global_im( const char *str );
116123
117124 protected:
118125 QString m_imname;