Revision: 6587
Author: nogu.dev
Date: Sun Jul 25 15:24:28 2010
Log: * helper/toolbar-common-gtk.c
- (right_click_menu_activated):
Use g_spawn_command_line_async() instead of system()
and check return value.
* qt4/toolbar/common-quimhelpertoolbar.cpp
- (launchHelperApplication): New function.
- (QUimHelperToolbar::slotExecImSwitcher): Use launchHelperApplication().
- (QUimHelperToolbar::slotExecPref): Ditto.
- (QUimHelperToolbar::slotExecDict): Ditto.
- (QUimHelperToolbar::slotExecInputPad): Ditto.
- (QUimHelperToolbar::slotExecHelp): Ditto.
http://code.google.com/p/uim/source/detail?r=6587
Modified:
/trunk/helper/toolbar-common-gtk.c
/trunk/qt4/toolbar/common-quimhelpertoolbar.cpp
=======================================
--- /trunk/helper/toolbar-common-gtk.c Tue Jul 20 01:25:40 2010
+++ /trunk/helper/toolbar-common-gtk.c Sun Jul 25 15:24:28 2010
@@ -85,7 +85,7 @@
N_("Switch input method"),
NULL,
"im_switcher",
- "uim-im-switcher-gtk &",
+ "uim-im-switcher-gtk",
"toolbar-show-switcher-button?",
UIM_FALSE
},
@@ -94,7 +94,7 @@
N_("Preference"),
NULL,
GTK_STOCK_PREFERENCES,
- "uim-pref-gtk &",
+ "uim-pref-gtk",
"toolbar-show-pref-button?",
UIM_FALSE
},
@@ -103,7 +103,7 @@
N_("Japanese dictionary editor"),
NULL,
"uim-dict",
- "uim-dict-gtk &",
+ "uim-dict-gtk",
"toolbar-show-dict-button?",
UIM_FALSE
},
@@ -112,7 +112,7 @@
N_("Input pad"),
NULL,
GTK_STOCK_BOLD,
- "uim-input-pad-ja &",
+ "uim-input-pad-ja",
"toolbar-show-input-pad-button?",
UIM_FALSE
},
@@ -125,7 +125,7 @@
#else
NULL,
#endif
- "uim-tomoe-gtk &",
+ "uim-tomoe-gtk",
"toolbar-show-handwriting-input-pad-button?",
UIM_FALSE
},
@@ -134,7 +134,7 @@
N_("Help"),
NULL,
GTK_STOCK_HELP,
- "uim-help &",
+ "uim-help",
"toolbar-show-help-button?",
UIM_FALSE
}
@@ -240,8 +240,15 @@
{
const char *command = data;
- if (command)
- system(command);
+ if (command) {
+ if (!g_spawn_command_line_async(command, NULL)) {
+ GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
+ _("Cannot launch '%s'."), command);
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+ }
+ }
}
static gboolean
=======================================
--- /trunk/qt4/toolbar/common-quimhelpertoolbar.cpp Fri Jul 23 22:59:29 2010
+++ /trunk/qt4/toolbar/common-quimhelpertoolbar.cpp Sun Jul 25 15:24:28 2010
@@ -40,6 +40,7 @@
#include <QtGui/QHBoxLayout>
#include <QtGui/QImage>
#include <QtGui/QMenu>
+#include <QtGui/QMessageBox>
#include <QtGui/QToolButton>
#include "uim/uim-scm.h"
@@ -47,6 +48,14 @@
static const QString ICONDIR = UIM_PIXMAPSDIR;
static const QString ACTION_ICONDIR = KDE4_ICONDIR "/oxygen/16x16/actions";
+
+static void launchHelperApplication( const QString &command )
+{
+ if ( !command.isEmpty() && !QProcess::startDetached( command ) ) {
+ QMessageBox::warning( 0, "uim",
+ _( "Cannot launch '%1'." ).arg( command ) );
+ }
+}
QUimHelperToolbar::QUimHelperToolbar( QWidget *parent, bool isApplet )
: QFrame( parent )
@@ -178,7 +187,7 @@
void QUimHelperToolbar::slotExecImSwitcher()
{
/* exec uim-im-switcher */
- QProcess::startDetached( "uim-im-switcher-qt4" );
+ launchHelperApplication( "uim-im-switcher-qt4" );
}
void QUimHelperToolbar::addExecPrefButton()
@@ -202,8 +211,8 @@
void QUimHelperToolbar::slotExecPref()
{
- /* exec uim-pref-qt */
- QProcess::startDetached( "uim-pref-qt4" );
+ /* exec uim-pref-qt4 */
+ launchHelperApplication( "uim-pref-qt4" );
}
void QUimHelperToolbar::addExecDictButton()
@@ -228,7 +237,7 @@
void QUimHelperToolbar::slotExecDict()
{
/* exec uim-dict */
- QProcess::startDetached( "uim-dict-gtk" );
+ launchHelperApplication( "uim-dict-gtk" );
}
void QUimHelperToolbar::addExecInputPadButton()
@@ -253,7 +262,7 @@
void QUimHelperToolbar::slotExecInputPad()
{
/* exec input pad */
- QProcess::startDetached( "uim-chardict-qt4" );
+ launchHelperApplication( "uim-chardict-qt4" );
}
void QUimHelperToolbar::addExecHandwritingInputPadButton()
@@ -277,7 +286,7 @@
void QUimHelperToolbar::slotExecHandwritingInputPad()
{
- QProcess::startDetached( "uim-tomoe-gtk" );
+ launchHelperApplication( "uim-tomoe-gtk" );
}
void QUimHelperToolbar::addExecHelpButton()
@@ -301,7 +310,7 @@
void QUimHelperToolbar::slotExecHelp()
{
- QProcess::startDetached( "uim-help" );
+ launchHelperApplication( "uim-help" );
}
void QUimHelperToolbar::setMargin( int margin )