diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2013-07-07 20:15:28 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2013-07-10 02:11:16 +0200 |
commit | 16361fd6e9621104f1059840888967c801572f64 (patch) | |
tree | 50fa2134394dfd08fb52ba2dd7371b0b5b312830 /src | |
parent | b3232d4ada69467b8c535776d43873bd7b73dadc (diff) | |
download | tdedocker-16361fd6e9621104f1059840888967c801572f64.tar.gz tdedocker-16361fd6e9621104f1059840888967c801572f64.zip |
Translations converted to gettext
Diffstat (limited to 'src')
-rw-r--r-- | src/customtraylabel.cpp | 49 | ||||
-rw-r--r-- | src/kdocker.cpp | 72 | ||||
-rw-r--r-- | src/main.cpp | 4 | ||||
-rw-r--r-- | src/qtraylabel.cpp | 4 | ||||
-rw-r--r-- | src/traylabelmgr.cpp | 36 |
5 files changed, 78 insertions, 87 deletions
diff --git a/src/customtraylabel.cpp b/src/customtraylabel.cpp index aca36e1..8683c96 100644 --- a/src/customtraylabel.cpp +++ b/src/customtraylabel.cpp @@ -29,6 +29,9 @@ #include <qsize.h> #include <stdlib.h> +#include <kglobal.h> +#include <klocale.h> + #include "trace.h" #include "customtraylabel.h" #include "traylabelmgr.h" @@ -59,44 +62,44 @@ void CustomTrayLabel::installMenu() TrayLabelMgr *tlMgr = TrayLabelMgr::instance(); mOptionsMenu = new QPopupMenu(this); - mSessionManagement = new QAction(tr("Dock when session restored"), 0, this); + mSessionManagement = new QAction(i18n("Dock when session restored"), 0, this); mSessionManagement->setToggleAction(true); connect(mSessionManagement, SIGNAL(toggled(bool)), this, SLOT(enableSessionManagement(bool))); mSessionManagement->addTo(mOptionsMenu); - mAutoLaunch = new QAction(tr("Launch on startup"), 0, this); + mAutoLaunch = new QAction(i18n("Launch on startup"), 0, this); mAutoLaunch->setToggleAction(true); connect(mAutoLaunch, SIGNAL(activated()), this, SLOT(slotSetLaunchOnStartup())); mAutoLaunch->addTo(mOptionsMenu); - mOptionsMenu->insertItem(tr("Set Icon"), this, SLOT(setCustomIcon())); + mOptionsMenu->insertItem(i18n("Set Icon"), this, SLOT(setCustomIcon())); - mBalloonTimeout = new QAction(tr("Set balloon timeout"), 0, this); + mBalloonTimeout = new QAction(i18n("Set balloon timeout"), 0, this); connect(mBalloonTimeout, SIGNAL(activated()), this, SLOT(slotSetBalloonTimeout())); mBalloonTimeout->addTo(mOptionsMenu); - mDockWhenObscured = new QAction(tr("Dock when obscured"), 0, this); + mDockWhenObscured = new QAction(i18n("Dock when obscured"), 0, this); mDockWhenObscured->setToggleAction(true); connect(mDockWhenObscured, SIGNAL(toggled(bool)), this, SLOT(setDockWhenObscured(bool))); mDockWhenObscured->addTo(mOptionsMenu); - mDockWhenMinimized = new QAction(tr("Dock when minimized"), 0, this); + mDockWhenMinimized = new QAction(i18n("Dock when minimized"), 0, this); mDockWhenMinimized->setToggleAction(true); connect(mDockWhenMinimized, SIGNAL(toggled(bool)), this, SLOT(setDockWhenMinimized(bool))); mDockWhenMinimized->addTo(mOptionsMenu); - mDockWhenFocusLost = new QAction(tr("Dock when focus lost"), 0, this); + mDockWhenFocusLost = new QAction(i18n("Dock when focus lost"), 0, this); mDockWhenFocusLost->setToggleAction(true); connect(mDockWhenFocusLost, SIGNAL(toggled(bool)), this, SLOT(setDockWhenFocusLost(bool))); mDockWhenFocusLost->addTo(mOptionsMenu); - mSkipTaskbar = new QAction(tr("Skip taskbar"), 0, this); + mSkipTaskbar = new QAction(i18n("Skip taskbar"), 0, this); mSkipTaskbar->setToggleAction(true); connect(mSkipTaskbar, SIGNAL(toggled(bool)), this, SLOT(setSkipTaskbar(bool))); @@ -104,17 +107,17 @@ void CustomTrayLabel::installMenu() mMainMenu = new QPopupMenu(this); mMainMenu->insertItem(QIconSet(kdocker_png), - tr("About KDocker"), tlMgr, SLOT(about())); + i18n("About KDocker"), tlMgr, SLOT(about())); mMainMenu->insertSeparator(); - mMainMenu->insertItem(tr("Options"), mOptionsMenu); - mMainMenu->insertItem(tr("Dock Another"), tlMgr, SLOT(dockAnother())); - mMainMenu->insertItem(tr("Undock All"), tlMgr, SLOT(undockAll())); + mMainMenu->insertItem(i18n("Options"), mOptionsMenu); + mMainMenu->insertItem(i18n("Dock Another"), tlMgr, SLOT(dockAnother())); + mMainMenu->insertItem(i18n("Undock All"), tlMgr, SLOT(undockAll())); mMainMenu->insertSeparator(); mShowId = mMainMenu->insertItem(QString("Show/Hide [untitled]"), this, SLOT(toggleShow())); - mMainMenu->insertItem(QString(tr("Undock")), this, SLOT(undock())); - mMainMenu->insertItem(QString(tr("Close")), this, SLOT(close())); + mMainMenu->insertItem(QString(i18n("Undock")), this, SLOT(undock())); + mMainMenu->insertItem(QString(i18n("Close")), this, SLOT(close())); connect(mMainMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu())); @@ -212,8 +215,8 @@ void CustomTrayLabel::setCustomIcon(void) if (icon.isNull()) return; // user cancelled if (!QPixmap(icon).isNull()) break; TRACE("Attempting to set icon to %s", icon.latin1()); - QMessageBox::critical(this, tr("KDocker"), - tr("%1 is not a valid icon").arg(icon)); + QMessageBox::critical(this, i18n("KDocker"), + i18n("%1 is not a valid icon").arg(icon)); } setTrayIcon(icon); @@ -223,8 +226,8 @@ void CustomTrayLabel::setCustomIcon(void) void CustomTrayLabel::slotSetBalloonTimeout(void) { bool ok; - int timeout = QInputDialog::getInteger(tr("KDocker"), - tr("Enter balloon timeout (secs). 0 to disable ballooning"), + int timeout = QInputDialog::getInteger(i18n("KDocker"), + i18n("Enter balloon timeout (secs). 0 to disable ballooning"), balloonTimeout()/1000, 0, 60, 1, &ok); if (!ok) return; @@ -256,10 +259,10 @@ void CustomTrayLabel::slotSetLaunchOnStartup() } // Request user to provide file name himself - if (QMessageBox::critical(NULL, tr("KDocker"), - tr("\"%1\" is not a valid executable " + if (QMessageBox::critical(NULL, i18n("KDocker"), + i18n("\"%1\" is not a valid executable " "or was not found in your $PATH").arg(app), - tr("Select program"), tr("Cancel")) == 1) + i18n("Select program"), i18n("Cancel")) == 1) { mAutoLaunch->setOn(false); return; // cancelled @@ -280,7 +283,7 @@ void CustomTrayLabel::updateMenu(void) { QString title = appClass(); // + "(" + appTitle() + ")"; mMainMenu->changeItem(mShowId, QIconSet(*pixmap()), - QString((isWithdrawn() ? tr("Show %1") : tr("Hide %1")).arg(title))); + QString((isWithdrawn() ? i18n("Show %1") : i18n("Hide %1")).arg(title))); } void CustomTrayLabel::mapEvent(void) @@ -354,7 +357,7 @@ bool CustomTrayLabel::canDockWindow(Window w) void CustomTrayLabel::dropEvent(QDropEvent *) { QMessageBox::information(NULL, "KDocker", - tr("You cannot drop an item into the tray icon. Drop it on the window\n" + i18n("You cannot drop an item into the tray icon. Drop it on the window\n" "that is brought in front when you hover the item over the tray icon")); } diff --git a/src/kdocker.cpp b/src/kdocker.cpp index 40cf00a..fd6ce9b 100644 --- a/src/kdocker.cpp +++ b/src/kdocker.cpp @@ -22,12 +22,13 @@ #include <qsessionmanager.h> #include <qdir.h> #include <qfile.h> -#include <qtranslator.h> #include <qtextcodec.h> #include <qtextstream.h> #include <qtimer.h> #include <qstring.h> +#include <klocale.h> + #include "trace.h" #include "traylabelmgr.h" #include "kdocker.h" @@ -46,25 +47,6 @@ KDocker::KDocker(int& argc, char** argv) { INIT_TRACE(); - /* - * Load localisation strings. Most examples I have seen load QTranslator - * in main(). As a result the translator object lingers around till the end - * of the program. I tried the same thing here and all i got was translations - * for usage(). You dont want to know about the sleepless night i spent - * trying to figure this out (yup, the source helped) - */ - QTranslator *translator = new QTranslator(0); - QString f = QString("kdocker_") + QTextCodec::locale(); - - if (!translator->load(f, QString(TRANSLATIONS_PATH)) && - !translator->load(f, applicationDirPath() + "/i18n") && - !translator->load(f, QDir::currentDirPath() + "/i18n")) { - qDebug("Sorry, your locale is not supported. If you are interested " - "in providing translations for your locale, contact " - "gramakri@uiuc.edu\n"); - } - installTranslator(translator); - // Attempt doing anything only if the CLI arguments were good opterr = 0; // suppress the warning int option; @@ -108,32 +90,32 @@ void KDocker::printVersion(void) // Prints the CLI arguments. Does not return void KDocker::printUsage(char optopt) { - if (optopt != 'h') qDebug(tr("kdocker: invalid option -- %1").arg(optopt)); - - qDebug(tr("Usage: KDocker [options] command\n")); - qDebug(tr("Docks any application into the system tray\n")); - qDebug(tr("command \tCommand to execute\n")); - qDebug(tr("Options")); - qDebug(tr("-a \tShow author information")); - qDebug(tr("-b \tDont warn about non-normal windows (blind mode)")); - qDebug(tr("-d \tDisable session management")); - qDebug(tr("-e \tEnable session management")); - qDebug(tr("-f \tDock window that has the focus(active window)")); - qDebug(tr("-h \tDisplay this help")); - qDebug(tr("-i icon\tCustom dock Icon")); - qDebug(tr("-l \tLaunch on startup")); - qDebug(tr("-m \tKeep application window mapped (dont hide on dock)")); - qDebug(tr("-o \tDock when obscured")); - qDebug(tr("-p secs\tSet ballooning timeout (popup time)")); - qDebug(tr("-q \tDisable ballooning title changes (quiet)")); - qDebug(tr("-t \tRemove this application from the task bar")); - qDebug(tr("-v \tDisplay version")); - qDebug(tr("-w wid \tWindow id of the application to dock\n")); + if (optopt != 'h') qDebug(i18n("kdocker: invalid option -- %1").arg(optopt).local8Bit()); + + qDebug(i18n("Usage: KDocker [options] command\n").local8Bit()); + qDebug(i18n("Docks any application into the system tray\n").local8Bit()); + qDebug(i18n("command \tCommand to execute\n").local8Bit()); + qDebug(i18n("Options").local8Bit()); + qDebug(i18n("-a \tShow author information").local8Bit()); + qDebug(i18n("-b \tDont warn about non-normal windows (blind mode)").local8Bit()); + qDebug(i18n("-d \tDisable session management").local8Bit()); + qDebug(i18n("-e \tEnable session management").local8Bit()); + qDebug(i18n("-f \tDock window that has the focus(active window)").local8Bit()); + qDebug(i18n("-h \tDisplay this help").local8Bit()); + qDebug(i18n("-i icon\tCustom dock Icon").local8Bit()); + qDebug(i18n("-l \tLaunch on startup").local8Bit()); + qDebug(i18n("-m \tKeep application window mapped (dont hide on dock)").local8Bit()); + qDebug(i18n("-o \tDock when obscured").local8Bit()); + qDebug(i18n("-p secs\tSet ballooning timeout (popup time)").local8Bit()); + qDebug(i18n("-q \tDisable ballooning title changes (quiet)").local8Bit()); + qDebug(i18n("-t \tRemove this application from the task bar").local8Bit()); + qDebug(i18n("-v \tDisplay version").local8Bit()); + qDebug(i18n("-w wid \tWindow id of the application to dock\n").local8Bit()); - qDebug(tr("NOTE: Use -d for all startup scripts.\n")); + qDebug(i18n("NOTE: Use -d for all startup scripts.\n").local8Bit()); - qDebug(tr("Bugs and wishes to gramakri@uiuc.edu")); - qDebug(tr("Project information at http://kdocker.sourceforge.net")); + qDebug(i18n("Bugs and wishes to gramakri@uiuc.edu").local8Bit()); + qDebug(i18n("Project information at http://kdocker.sourceforge.net").local8Bit()); } void KDocker::notifyPreviousInstance(Window prevInstance) @@ -197,7 +179,7 @@ bool KDocker::x11EventFilter(XEvent * event) client->data.l[1], (unsigned) mSelectionOwner); char tmp[50]; struct stat buf; - sprintf(tmp, TMPFILE_PREFIX "%ld", client->data.l[1]); + sprintf(tmp, QString(TMPFILE_PREFIX "%ld").local8Bit(), client->data.l[1]); if (stat(tmp, &buf) || (getuid()!=buf.st_uid)) { /* diff --git a/src/main.cpp b/src/main.cpp index e507079..579e2fa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,6 +24,8 @@ #include <unistd.h> #include <signal.h> +#include <klocale.h> + #include <qdir.h> #include "kdocker.h" #include "traylabelmgr.h" @@ -38,7 +40,7 @@ static void sighandler(int sig) return; } - qDebug(qApp->translate("KDocker", "Caught signal %1. Cleaning up.").arg(sig)); + qDebug(i18n("Caught signal %1. Cleaning up.").arg(sig).local8Bit()); ((KDocker *)qApp)->trayLabelMgr()->undockAll(); } diff --git a/src/qtraylabel.cpp b/src/qtraylabel.cpp index c3daaa3..a29e442 100644 --- a/src/qtraylabel.cpp +++ b/src/qtraylabel.cpp @@ -32,6 +32,8 @@ #include "trace.h" #include "qtraylabel.h" +#include <kglobal.h> + #include <X11/cursorfont.h> #include <X11/xpm.h> #include <Xmu/WinUtil.h> @@ -84,7 +86,7 @@ const char *QTrayLabel::me(void) const } QTrayLabel::QTrayLabel(Window w, QWidget* parent, const QString& text) - :QLabel(parent, text, WStyle_Customize | WStyle_NoBorder | WStyle_Tool), + :QLabel(parent, text.utf8(), WStyle_Customize | WStyle_NoBorder | WStyle_Tool), mDockedWindow(w), mPid(0) { initialize(); diff --git a/src/traylabelmgr.cpp b/src/traylabelmgr.cpp index 3b63cfc..9bbf013 100644 --- a/src/traylabelmgr.cpp +++ b/src/traylabelmgr.cpp @@ -29,6 +29,8 @@ #include <qtextstream.h> #include <qfiledialog.h> +#include <klocale.h> + #include "trace.h" #include "traylabelmgr.h" #include "util.h" @@ -60,8 +62,8 @@ TrayLabelMgr::~TrayLabelMgr() void TrayLabelMgr::about(void) { - if (QMessageBox::information(NULL, tr("About KDocker"), - tr("Bugs/wishes to Girish Ramakrishnan (gramakri@uiuc.edu)\n" + if (QMessageBox::information(NULL, i18n("About KDocker"), + i18n("Bugs/wishes to Girish Ramakrishnan (gramakri@uiuc.edu)\n" "English translation by Girish (gramakri@uiuc.edu)\n\n" "http://kdocker.sourceforge.net for updates"), QString::null, SHOW_TRACE_TEXT) == 1) SHOW_TRACE(); @@ -89,8 +91,8 @@ void TrayLabelMgr::startup(void) return; } - if (QMessageBox::warning(NULL, tr("KDocker"), - tr(state == SysTrayAbsent ? "No system tray found" + if (QMessageBox::warning(NULL, i18n("KDocker"), + i18n(state == SysTrayAbsent ? "No system tray found" : "System tray appears to be hidden"), QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort) { @@ -204,7 +206,7 @@ bool TrayLabelMgr::processCommand(int argc, char** argv) case '?': return false; case 'a': - qDebug(tr("Girish Ramakrishnan (gramakri@uiuc.edu)")); + qDebug(i18n("Girish Ramakrishnan (gramakri@uiuc.edu)").local8Bit()); return false; case 'b': check_normality = false; @@ -279,14 +281,14 @@ QTrayLabel *TrayLabelMgr::selectAndDock(Window w, bool checkNormality) { if (w == None) { - qDebug(tr("Select the application/window to dock with button1.")); - qDebug(tr("Click any other button to abort\n")); + qDebug(i18n("Select the application/window to dock with button1.").local8Bit()); + qDebug(i18n("Click any other button to abort\n").local8Bit()); const char *err = NULL; if ((w = selectWindow(QPaintDevice::x11AppDisplay(), &err)) == None) { - if (err) QMessageBox::critical(NULL, tr("KDocker"), tr(err)); + if (err) QMessageBox::critical(NULL, i18n("KDocker"), i18n(err)); return NULL; } } @@ -297,8 +299,8 @@ QTrayLabel *TrayLabelMgr::selectAndDock(Window w, bool checkNormality) * Abort should be the only option here really. "Ignore" is provided here * for the curious user who wants to screw himself very badly */ - if (QMessageBox::warning(NULL, tr("KDocker"), - tr("The window you are attempting to dock does not seem to be a" + if (QMessageBox::warning(NULL, i18n("KDocker"), + i18n("The window you are attempting to dock does not seem to be a" " normal window."), QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort) return NULL; @@ -308,8 +310,8 @@ QTrayLabel *TrayLabelMgr::selectAndDock(Window w, bool checkNormality) TRACE("0x%x is not docked", (unsigned) w); - QMessageBox::message(tr("KDocker"), - tr("This window is already docked.\n" + QMessageBox::message(i18n("KDocker"), + i18n("This window is already docked.\n" "Click on system tray icon to toggle docking.")); return NULL; } @@ -350,7 +352,7 @@ QTrayLabel *TrayLabelMgr::dockApplication(char *argv[]) if (execvp(argv[0], argv) == -1) { - qDebug(tr("Failed to exec [%1]: %2").arg(argv[0]).arg(strerror(errno))); + qDebug(i18n("Failed to exec [%1]: %2").arg(argv[0]).arg(strerror(errno)).local8Bit()); ::exit(0); // will become a zombie in some systems :( return NULL; } @@ -359,7 +361,7 @@ QTrayLabel *TrayLabelMgr::dockApplication(char *argv[]) if (pid == -1) { QMessageBox::critical(NULL, "KDocker", - tr("Failed to fork: %1").arg(strerror(errno))); + i18n("Failed to fork: %1").arg(strerror(errno))); return NULL; } @@ -425,9 +427,9 @@ void TrayLabelMgr::notifySysTrayAbsence() if (state == SysTrayPresent) return; // So sweet of the systray to come back so soon - if (QMessageBox::warning(NULL, tr("KDocker"), - tr("The System tray was hidden or removed"), - tr("Undock All"), tr("Ignore")) == 0) + if (QMessageBox::warning(NULL, i18n("KDocker"), + i18n("The System tray was hidden or removed"), + i18n("Undock All"), i18n("Ignore")) == 0) undockAll(); } |