3
Copyright (c) 2003,2004,2005 uim Project http://uim.freedesktop.org/
7
Redistribution and use in source and binary forms, with or without
8
modification, are permitted provided that the following conditions
11
1. Redistributions of source code must retain the above copyright
12
notice, this list of conditions and the following disclaimer.
13
2. Redistributions in binary form must reproduce the above copyright
14
notice, this list of conditions and the following disclaimer in the
15
documentation and/or other materials provided with the distribution.
16
3. Neither the name of authors nor the names of its contributors
17
may be used to endorse or promote products derived from this software
18
without specific prior written permission.
20
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
21
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
24
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33
#include "toolbar-common-quimhelpertoolbar.h"
34
#include "toolbar-common-uimstateindicator.h"
37
#include <qtoolbutton.h>
41
#include "uim/uim-compat-scm.h"
42
#include "qtgettext.h"
44
static const QString ICONDIR = UIM_PIXMAPSDIR;
46
QUimHelperToolbar::QUimHelperToolbar( QWidget *parent, const char *name, WFlags f )
47
: QHBox( parent, name, f )
49
new UimStateIndicator( this );
51
m_swicon = QPixmap( ICONDIR + "/switcher-icon.png" );
52
m_preficon = QPixmap( ICONDIR + "/configure-qt.png");
54
m_contextMenu = new QPopupMenu( this );
55
m_contextMenu->insertItem( m_swicon, _("Execute uim's input method switcher"), this, SLOT(slotExecImSwitcher()) );
56
m_contextMenu->insertItem( m_preficon, _("Execute uim's preference tool"), this, SLOT(slotExecPref()) );
57
m_contextMenu->insertItem( _("Execute uim's Japanese dictionary tool"), this, SLOT(slotExecDict()) );
58
m_contextMenu->insertItem( _("Execute uim's input pad tool"), this, SLOT(slotExecInputPad()) );
59
m_contextMenu->insertItem( _("Execute uim's handwriting input pad tool"), this, SLOT(slotExecHandwritingInputPad()) );
60
m_contextMenu->insertItem( _("Execute uim's help tool"), this, SLOT(slotExecHelp()) );
61
m_contextMenu->insertItem( _("Quit this toolbar"), this, SIGNAL(quitToolbar()) );
64
addExecImSwitcherButton();
67
addExecInputPadButton();
68
addExecHandwritingInputPadButton();
72
QUimHelperToolbar::~QUimHelperToolbar()
76
void QUimHelperToolbar::contextMenuEvent( QContextMenuEvent * e )
78
if( !m_contextMenu->isShown() )
80
m_contextMenu->move( e->globalPos() );
81
m_contextMenu->exec();
85
void QUimHelperToolbar::addExecImSwitcherButton()
87
uim_bool isShowSwitcher = uim_scm_symbol_value_bool("toolbar-show-switcher-button?");
88
if( isShowSwitcher == UIM_FALSE )
91
QToolButton * swButton = new QHelperToolbarButton( this );
92
if( !m_swicon.isNull() )
93
swButton->setPixmap( m_swicon );
95
swButton->setText( "Sw" );
97
QObject::connect( swButton, SIGNAL( clicked() ),
98
this, SLOT( slotExecImSwitcher() ) );
99
QToolTip::add( swButton, _( "exec im-switcher" ) );
103
void QUimHelperToolbar::slotExecImSwitcher()
105
/* exec uim-im-switcher */
106
system( "uim-im-switcher-qt &" );
109
void QUimHelperToolbar::addExecPrefButton()
111
uim_bool isShowPref = uim_scm_symbol_value_bool("toolbar-show-pref-button?");
112
if( isShowPref == UIM_FALSE )
115
QToolButton * prefButton = new QHelperToolbarButton( this );
116
if( !m_preficon.isNull() )
117
prefButton->setPixmap( m_preficon );
119
prefButton->setText( "Pref" );
121
QObject::connect( prefButton, SIGNAL( clicked() ),
122
this, SLOT( slotExecPref() ) );
123
QToolTip::add( prefButton, _( "exec Preference Application" ) );
126
void QUimHelperToolbar::slotExecPref()
128
/* exec uim-pref-qt */
129
system( "uim-pref-qt &" );
132
void QUimHelperToolbar::addExecDictButton()
134
uim_bool isShowDict = uim_scm_symbol_value_bool("toolbar-show-dict-button?");
135
if( isShowDict == UIM_FALSE )
138
QToolButton *dictButton = new QHelperToolbarButton( this );
139
dictButton->setText( "Dic" );
141
QObject::connect( dictButton, SIGNAL( clicked() ),
142
this, SLOT( slotExecDict() ) );
143
QToolTip::add( dictButton, _( "exec Japanese dictionary Tool Application" ) );
146
void QUimHelperToolbar::slotExecDict()
149
system( "uim-dict-gtk&" );
152
void QUimHelperToolbar::addExecInputPadButton()
154
uim_bool isShowInputPad = uim_scm_symbol_value_bool("toolbar-show-input-pad-button?");
155
if( isShowInputPad == UIM_FALSE )
158
QToolButton *inputpadButton = new QHelperToolbarButton( this );
159
inputpadButton->setText( "Pad" );
161
QObject::connect( inputpadButton, SIGNAL( clicked() ),
162
this, SLOT( slotExecInputPad() ) );
163
QToolTip::add( inputpadButton, _( "exec Input Pad Tool Application" ) );
166
void QUimHelperToolbar::slotExecInputPad()
169
system( "uim-chardict-qt &");
172
void QUimHelperToolbar::addExecHandwritingInputPadButton()
174
uim_bool isShowHandwritingInputPad = uim_scm_symbol_value_bool("toolbar-show-handwriting-input-pad-button?");
175
if( isShowHandwritingInputPad == UIM_FALSE )
178
QToolButton *inputpadButton = new QHelperToolbarButton( this );
179
inputpadButton->setText( "Hand" );
181
QObject::connect( inputpadButton, SIGNAL( clicked() ),
182
this, SLOT( slotExecHandwritingInputPad() ) );
183
QToolTip::add( inputpadButton, _( "exec Handwriting Input Pad Tool Application" ) );
186
void QUimHelperToolbar::slotExecHandwritingInputPad()
188
system( "uim-tomoe-gtk &" );
191
void QUimHelperToolbar::addExecHelpButton()
193
uim_bool isShowHelp = uim_scm_symbol_value_bool("toolbar-show-help-button?");
194
if( isShowHelp == UIM_FALSE )
197
QToolButton *helpButton = new QHelperToolbarButton( this );
198
helpButton->setText( "Help" );
200
QObject::connect( helpButton, SIGNAL( clicked() ),
201
this, SLOT( slotExecHelp() ) );
202
QToolTip::add( helpButton, _( "exec Help Application" ) );
205
void QUimHelperToolbar::slotExecHelp()
207
system( "uim-help &" );
210
#include "toolbar-common-quimhelpertoolbar.moc"