[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: [PATCH] RFC: Changing the language of individual KDE programs
From:       David Jarvie <lists () astrojar ! org ! uk>
Date:       2007-05-19 10:57:49
Message-ID: 200705191157.50615.lists () astrojar ! org ! uk
[Download RAW message or body]

On Tuesday 15 May 2007 09:05:29 Thomas Diehl wrote:
> I just received the following update on this more than 6 year old
> wishlist item with now 328 votes
> (http://bugs.kde.org/show_bug.cgi?id=24348). If this is true we won't
> see the requested feature in KDE 4.0 either:
>
> Well, the bug was essentially closed by Krzysztof Lichota (SVN commit
> 644712 http://websvn.kde.org/branches/KDE/3.5/kdelibs/?pathrev=647712)
> but his contribution was reverted for no new feature is allowed to the
> stable branch before it is implemented in trunk... and there seems to be
> nobody who'd will to be that... (see also some discussion in BR 103467
> http://bugs.kde.org/show_bug.cgi?id=103467 )

Attached is a patch to implement this function in trunk. Also required is to 
move klanguagebutton.{h,cpp} back from kdebase/runtime/kcontrol/locale/ into 
kdelibs/kdeui/widgets/.

The patch includes the addition of one new method to each of KLocale, 
KStandardAction and KHelpMenu, plus the new class KSwitchLanguageDialog. Ok 
to commit on Monday?

-- 
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/kalarm

["switchlang.diff" (text/x-diff)]

Index: kdelibs/kdecore/localization/klocale.cpp
===================================================================
--- kdelibs/kdecore/localization/klocale.cpp	(revision 665362)
+++ kdelibs/kdecore/localization/klocale.cpp	(working copy)
@@ -494,6 +494,11 @@
   return true; // we found something. Maybe it's only English, but we found \
something  }
 
+bool KLocale::isApplicationTranslatedInto( const QString & lang)
+{
+  return d->isApplicationTranslatedInto( lang );
+}
+
 bool KLocalePrivate::isApplicationTranslatedInto( const QString & lang)
 {
   if ( lang.isEmpty() ) {
Index: kdelibs/kdecore/localization/klocale.h
===================================================================
--- kdelibs/kdecore/localization/klocale.h	(revision 665362)
+++ kdelibs/kdecore/localization/klocale.h	(working copy)
@@ -1080,7 +1080,14 @@
    */
   bool useTranscript() const;
 
+  /**
+   * Checks whether or not the active catalog is found for the given language.
+   *
+   * @param language language to check
+   */
+  bool isApplicationTranslatedInto( const QString & language);
 
+
   /**
    * @internal Called from KConfigBackend to initialize language.
    */
Index: kdelibs/kdeui/CMakeLists.txt
===================================================================
--- kdelibs/kdeui/CMakeLists.txt	(revision 665362)
+++ kdelibs/kdeui/CMakeLists.txt	(working copy)
@@ -77,6 +77,7 @@
  dialogs/kprogressdialog.cpp
  dialogs/kshortcutsdialog.cpp
  dialogs/ksplashscreen.cpp
+ dialogs/kswitchlanguagedialog.cpp
  dialogs/ktip.cpp
  findreplace/kfind.cpp
  findreplace/kreplace.cpp
@@ -171,6 +172,7 @@
  widgets/khistorycombobox.cpp
  widgets/kkeysequencewidget.cpp
  widgets/kinformationlabel.cpp
+ widgets/klanguagebutton.cpp
  widgets/kled.cpp
  widgets/klineedit.cpp
  widgets/kmainwindow.cpp
@@ -317,6 +319,7 @@
  dialogs/ksplashscreen.h
  dialogs/kshortcutsdialog.h
  dialogs/kshortcutseditor.h
+ dialogs/kswitchlanguagedialog.h
  dialogs/ktip.h
  findreplace/kfind.h
  findreplace/kreplace.h
@@ -399,6 +402,7 @@
  widgets/khistorycombobox.h
  widgets/kkeysequencewidget.h
  widgets/kinformationlabel.h
+ widgets/klanguagebutton.h
  widgets/kled.h
  widgets/klineedit.h
  widgets/kmainwindow.h
Index: kdelibs/kdeui/dialogs/kswitchlanguagedialog.cpp
===================================================================
--- kdelibs/kdeui/dialogs/kswitchlanguagedialog.cpp	(revision 0)
+++ kdelibs/kdeui/dialogs/kswitchlanguagedialog.cpp	(revision 0)
@@ -0,0 +1,328 @@
+/*
+ * This file is part of the KDE Libraries
+ * Copyright (C) 2007 Krzysztof Lichota (lichota@mimuw.edu.pl)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "kswitchlanguagedialog.moc"
+
+#include <QtGui/QLayout>
+#include <QtGui/QLabel>
+#include <QtCore/QMap>
+
+#include <klanguagebutton.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kdebug.h>
+#include <kpushbutton.h>
+
+struct LanguageRowData
+{
+    QLabel *label;
+    KLanguageButton *languageButton;
+    KPushButton *removeButton;
+    
+    void setRowWidgets(
+        QLabel *label,
+        KLanguageButton *languageButton,
+        KPushButton *removeButton
+        )
+    {
+        this->label = label;
+        this->languageButton = languageButton;
+        this->removeButton = removeButton;
+    }
+    
+};
+
+class KSwitchLanguageDialogPrivate
+{
+public:
+    KSwitchLanguageDialogPrivate(KSwitchLanguageDialog *parent);
+    
+    KSwitchLanguageDialog *p; //parent class
+    
+    /**
+        Fills language button with names of languages for which given application \
has translation. +    */
+    void fillApplicationLanguages(KLanguageButton *button);
+    
+    /**
+        Adds one button with language to widget.
+    */
+    void addLanguageButton(const QString & languageCode, bool primaryLanguage);
+    
+    /**
+        Returns list of languages chosen for application or default languages is \
they are not set. +    */
+    QStringList applicationLanguageList();
+    
+    QMap<KPushButton*, LanguageRowData> languageRows;
+    QList<KLanguageButton*> languageButtons;
+    QGridLayout *languagesLayout;
+    QWidget *page;
+};
+
+/*************************** KSwitchLanguageDialog **************************/
+
+KSwitchLanguageDialog::KSwitchLanguageDialog( QWidget *parent )
+  : KDialog(parent),
+    d(new KSwitchLanguageDialogPrivate(this))
+{
+    setCaption(i18n("Switch application language"));
+    setButtons(Ok | Cancel);
+    setDefaultButton(Ok);
+    showButtonSeparator(true);
+    connect(this, SIGNAL(okClicked()), SLOT(slotOk()));
+
+    d->page = new QWidget( this );
+    setMainWidget(d->page);
+    QVBoxLayout *topLayout = new QVBoxLayout( d->page );
+    topLayout->setSpacing( spacingHint() );
+    QLabel *label = new QLabel( i18n("Please choose language which should be used \
for this application:"), d->page ); +    topLayout->addWidget( label );
+    
+    QHBoxLayout *languageHorizontalLayout = new QHBoxLayout();
+    topLayout->addLayout(languageHorizontalLayout);
+    
+    d->languagesLayout = new QGridLayout();
+    languageHorizontalLayout->addLayout(d->languagesLayout);
+    languageHorizontalLayout->addStretch();
+    
+    QStringList defaultLanguages = d->applicationLanguageList();
+
+    int count = defaultLanguages.count();
+    for (int i = 0; i < count; ++i)
+    {
+        QString language = defaultLanguages[i];
+        bool primaryLanguage = (i == 0);
+        d->addLanguageButton(language, primaryLanguage);
+    }
+    
+    if (!count)
+    {
+        d->addLanguageButton(KGlobal::locale()->defaultLanguage(), true);
+    }
+    
+    QHBoxLayout *addButtonHorizontalLayout = new QHBoxLayout();
+    topLayout->addLayout(addButtonHorizontalLayout);
+    
+    KPushButton *addLangButton = new KPushButton(i18n("Add fallback language"), \
d->page); +    addLangButton->setToolTip(i18n("Adds one more language which will be \
used if other translations do not contain proper translation")); +    \
connect(addLangButton, SIGNAL(clicked()), this, SLOT(slotAddLanguageButton())); +    \
addButtonHorizontalLayout->addWidget(addLangButton); +    \
addButtonHorizontalLayout->addStretch(); +    
+    topLayout->addStretch(10);
+}
+
+KSwitchLanguageDialog::~KSwitchLanguageDialog()
+{
+    delete d;
+}
+
+void KSwitchLanguageDialog::slotAddLanguageButton()
+{
+    //adding new button with en_US as it should always be present
+    d->addLanguageButton("en_US", d->languageButtons.isEmpty());
+}
+
+void KSwitchLanguageDialog::removeButtonClicked()
+{
+    QObject const *signalSender = sender();
+    if (!signalSender)
+    {
+        kError() << "KSwitchLanguageDialog::removeButtonClicked() called directly, \
not using signal" << endl; +        return;
+    }
+    
+    KPushButton *removeButton = const_cast<KPushButton*>(::qobject_cast<const \
KPushButton*>(signalSender)); +    if (!removeButton)
+    {
+        kError() << "KSwitchLanguageDialog::removeButtonClicked() called from \
something else than KPushButton" << endl; +        return;
+    }
+    
+    QMap<KPushButton *, LanguageRowData>::iterator it = \
d->languageRows.find(removeButton); +    if (it == d->languageRows.end())
+    {
+        kError() << "KSwitchLanguageDialog::removeButtonClicked called from unknown \
KPushButton" << endl; +        return;
+    }
+
+    LanguageRowData languageRowData = it.value();
+    
+    d->languageButtons.removeAll(languageRowData.languageButton);
+    
+    languageRowData.label->deleteLater();
+    languageRowData.languageButton->deleteLater();
+    languageRowData.removeButton->deleteLater();
+    d->languageRows.erase(it);
+}
+
+void KSwitchLanguageDialog::languageOnButtonChanged(const QString & languageCode)
+{
+    for ( int i = 0, count = d->languageButtons.count(); i < count; ++i )
+    {
+        KLanguageButton *languageButton = d->languageButtons[i];
+        if (languageButton->current() == languageCode)
+        {
+            //update all buttons which have matching id
+            //might update buttons which were not changed, but well...
+            languageButton->setText(KGlobal::locale()->twoAlphaToLanguageName(languageCode));
 +        }
+    }
+}
+
+void KSwitchLanguageDialog::slotOk()
+{
+    QString languageString;
+    bool first = true;
+ 
+    for ( int i = 0, count = d->languageButtons.count(); i < count; ++i )
+    {
+        KLanguageButton *languageButton = d->languageButtons[i];
+        
+        if (!first)
+        {
+            languageString += ':';
+        }
+        languageString += languageButton->current();
+        first = false;
+    }
+    
+    if (d->applicationLanguageList().join(":") != languageString)
+    {
+        //list is different from defaults or saved languages list
+        KConfigGroup group(KGlobal::config(), "Locale");
+    
+        group.writeEntry("Language", languageString);
+        group.sync();
+        
+        KMessageBox::information(
+            this,
+            i18n("Language for this application has been changed. The change will \
take effect upon next start of application"), //text +            i18n("Application \
language changed"), //caption +            "ApplicationLanguageChangedWarning" \
//dontShowAgainName +            );
+    }
+
+    accept();
+}
+
+/************************ KSwitchLanguageDialogPrivate ***********************/
+
+KSwitchLanguageDialogPrivate::KSwitchLanguageDialogPrivate(
+    KSwitchLanguageDialog *parent)
+  : p(parent)
+{
+    //NOTE: do NOT use "p" in constructor, it is not fully constructed
+}
+
+void KSwitchLanguageDialogPrivate::fillApplicationLanguages(KLanguageButton *button)
+{
+    KLocale *locale = KGlobal::locale();
+    QStringList allLanguages = locale->allLanguagesTwoAlpha();
+    for ( int i = 0, count = allLanguages.count(); i < count; ++i )
+    {
+        QString languageCode = allLanguages[i];
+        if (locale->isApplicationTranslatedInto(languageCode))
+        {
+            button->insertItem(
+                locale->twoAlphaToLanguageName(languageCode),
+                languageCode
+                );
+        }
+    }
+}
+
+QStringList KSwitchLanguageDialogPrivate::applicationLanguageList()
+{
+    KSharedConfigPtr config = KGlobal::config();
+    QStringList languagesList;
+    
+    if (config->hasGroup("Locale"))
+    {
+        KConfigGroup group(config, "Locale");
+        if (group.hasKey("Language"))
+        {
+            languagesList = group.readEntry("Language", QStringList(), ':');
+        }
+    }
+    return languagesList.isEmpty() ? KGlobal::locale()->languageList() : \
languagesList; +}
+
+void KSwitchLanguageDialogPrivate::addLanguageButton(const QString & languageCode, \
bool primaryLanguage) +{
+    QString labelText = primaryLanguage ? i18n("Primary language:") : i18n("Fallback \
language:"); +    
+    KLanguageButton *languageButton = new KLanguageButton(page);
+    
+    languageButton->setText(KGlobal::locale()->twoAlphaToLanguageName(languageCode));
 +    
+    fillApplicationLanguages(languageButton);
+    
+    languageButton->setCurrentItem(languageCode);
+    
+    QObject::connect(
+        languageButton, 
+        SIGNAL(activated(const QString &)), 
+        p,
+        SLOT(languageOnButtonChanged(const QString &))
+        );
+    
+    LanguageRowData languageRowData;
+    KPushButton *removeButton = 0;
+    
+    if (!primaryLanguage)
+    {
+        removeButton = new KPushButton(i18n("Remove"), page);
+        
+        QObject::connect(
+            removeButton, 
+            SIGNAL(clicked()),
+            p,
+            SLOT(removeButtonClicked())
+            );
+    }
+        
+    languageButton->setToolTip(primaryLanguage
+          ? i18n("This is main application language which will be used first before \
any other languages") +          : i18n("This is language which will be used if any \
previous languages does not contain proper translation")); +    
+    int numRows = languagesLayout->rowCount();
+    
+    QLabel *languageLabel = new QLabel(labelText, page);
+    languagesLayout->addWidget( languageLabel, numRows + 1, 1, Qt::AlignLeft );
+    languagesLayout->addWidget( languageButton, numRows + 1, 2, Qt::AlignLeft );
+    
+    if (!primaryLanguage)
+    {
+        languagesLayout->addWidget( removeButton, numRows + 1, 3, Qt::AlignLeft );
+        languageRowData.setRowWidgets( languageLabel, languageButton, removeButton \
); +        removeButton->show();
+    }
+    
+    languageRows.insert(removeButton, languageRowData);
+    
+    languageButtons.append(languageButton);
+    languageButton->show();
+    languageLabel->show();
+}
+
Index: kdelibs/kdeui/dialogs/kswitchlanguagedialog.h
===================================================================
--- kdelibs/kdeui/dialogs/kswitchlanguagedialog.h	(revision 0)
+++ kdelibs/kdeui/dialogs/kswitchlanguagedialog.h	(revision 0)
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the KDE Libraries
+ * Copyright (C) 2007 Krzysztof Lichota (lichota@mimuw.edu.pl)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+ 
+#ifndef _KSWITCHLANGUAGEDIALOG_H_
+#define _KSWITCHLANGUAGEDIALOG_H_
+
+#include <kdialog.h>
+
+class KSwitchLanguageDialogPrivate;
+
+/**
+ * @short Standard "switch application language" dialog box.
+ *
+ * This class provides "switch application language" dialog box that is used
+ * in KHelpMenu
+ *
+ * @author Krzysztof Lichota (lichota@mimuw.edu.pl)
+ */
+
+class KDEUI_EXPORT KSwitchLanguageDialog : public KDialog
+{
+  Q_OBJECT
+
+  public:
+        /**
+            * Constructor. Creates a fully featured "Switch application language" \
dialog box. +            * Note that this dialog is made modeless in the KHelpMenu \
class so +            * the users may expect a modeless dialog.
+            *
+            * @param parent The parent of the dialog box. You should use the
+            *        toplevel window so that the dialog becomes centered.
+            * @param name Internal name of the widget. This name in not used in the
+            *        caption.
+            * @param modal If false, this widget will be modeless and must be
+            *        made visible using QWidget::show(). Otherwise it will be
+            *        modal and must be made visible using QWidget::exec()
+            */
+        KSwitchLanguageDialog( QWidget *parent = 0 );
+        
+        virtual ~KSwitchLanguageDialog();
+    
+    protected slots:
+        /**
+        * Activated when the Ok button has been clicked.
+        */
+        virtual void slotOk();
+        
+        /**
+            Called when one of language buttons changes state.
+        */
+        virtual void languageOnButtonChanged( const QString & );
+        
+        /**
+            Called to add one language button to dialog.
+        */
+        virtual void slotAddLanguageButton();
+        
+        /**
+            Called when "Remove" language button is clicked.
+        */
+        virtual void removeButtonClicked();
+        
+    protected:
+        KSwitchLanguageDialogPrivate * const d;
+        
+        friend class KSwitchLanguageDialogPrivate;
+};
+
+#endif
Index: kdelibs/kdeui/actions/kstandardaction.h
===================================================================
--- kdelibs/kdeui/actions/kstandardaction.h	(revision 665362)
+++ kdelibs/kdeui/actions/kstandardaction.h	(working copy)
@@ -157,7 +157,8 @@
     ConfigureNotifications,
     FullScreen,
     Clear,
-    PasteText
+    PasteText,
+    SwitchApplicationLanguage
   };
 
   /**
Index: kdelibs/kdeui/actions/kstandardaction.cpp
===================================================================
--- kdelibs/kdeui/actions/kstandardaction.cpp	(revision 665362)
+++ kdelibs/kdeui/actions/kstandardaction.cpp	(working copy)
@@ -540,6 +540,11 @@
   return KStandardAction::create( ReportBug, recvr, slot, parent );
 }
 
+KAction *switchApplicationLanguage( const QObject *recvr, const char *slot, QObject \
*parent ) +{
+  return KStandardAction::create( SwitchApplicationLanguage, recvr, slot, parent );
+}
+
 KAction *aboutApp( const QObject *recvr, const char *slot, QObject *parent )
 {
   return KStandardAction::create( AboutApp, recvr, slot, parent );
Index: kdelibs/kdeui/actions/kstandardaction_p.h
===================================================================
--- kdelibs/kdeui/actions/kstandardaction_p.h	(revision 665362)
+++ kdelibs/kdeui/actions/kstandardaction_p.h	(working copy)
@@ -110,6 +110,7 @@
   { WhatsThis,     KStandardShortcut::WhatsThis, "help_whats_this", \
I18N_NOOP("What's &This?"), 0, "help-whatsthis" },  { TipofDay,      \
KStandardShortcut::AccelNone, "help_show_tip", I18N_NOOP("Tip of the &Day"), 0, \
"idea" },  { ReportBug,     KStandardShortcut::AccelNone, "help_report_bug", \
I18N_NOOP("&Report Bug..."), 0, 0 }, +  { SwitchApplicationLanguage, \
KStandardShortcut::AccelNone, "switch_application_language", I18N_NOOP("Switch \
application &language..."), 0, 0 },  { AboutApp,      KStandardShortcut::AccelNone, \
"help_about_app", I18N_NOOP("&About %1"), 0, 0 },  { AboutKDE,      \
KStandardShortcut::AccelNone, "help_about_kde", I18N_NOOP("About &KDE"), \
0,"about-kde" },  { ActionNone, KStandardShortcut::AccelNone, 0, 0, 0, 0 }
Index: kdelibs/kdeui/widgets/khelpmenu.cpp
===================================================================
--- kdelibs/kdeui/widgets/khelpmenu.cpp	(revision 665362)
+++ kdelibs/kdeui/widgets/khelpmenu.cpp	(working copy)
@@ -45,6 +45,7 @@
 #include <kstandardshortcut.h>
 #include <kstandardaction.h>
 #include <kstandardguiitem.h>
+#include <kswitchlanguagedialog.h>
 #include <ktoolinvocation.h>
 
 #include <config.h>
@@ -56,6 +57,8 @@
 {
 public:
     KHelpMenuPrivate()
+      : mSwitchApplicationLanguage(0),
+        mSwitchApplicationLanguageAction(0)
     {
         mMenu = 0;
         mAboutApp = 0;
@@ -73,12 +76,14 @@
         delete mAboutApp;
         delete mAboutKDE;
         delete mBugReport;
+        delete mSwitchApplicationLanguage;
     }
 
     KMenu *mMenu;
     KDialog *mAboutApp;
     KAboutKdeDialog *mAboutKDE;
     KBugReport *mBugReport;
+    KSwitchLanguageDialog *mSwitchApplicationLanguage;
 
 // TODO evaluate if we use static_cast<QWidget*>(parent()) instead of mParent to win \
that bit of memory  QWidget *mParent;
@@ -86,7 +91,7 @@
 
     bool mShowWhatsThis;
 
-    QAction *mHandBookAction, *mWhatsThisAction, *mReportBugAction, \
*mAboutAppAction, *mAboutKDEAction; +    QAction *mHandBookAction, *mWhatsThisAction, \
*mReportBugAction, *mSwitchApplicationLanguageAction, *mAboutAppAction, \
*mAboutKDEAction;  
     const KAboutData *mAboutData;
 };
@@ -115,6 +120,7 @@
     if (showWhatsThis)
       actions->addAction(KStandardAction::WhatsThis, this, \
                SLOT(contextHelpActivated()));
     actions->addAction(KStandardAction::ReportBug, this, SLOT(reportBug()));
+    actions->addAction(KStandardAction::SwitchApplicationLanguage, this, \
                SLOT(switchApplicationLanguage()));
     actions->addAction(KStandardAction::AboutApp, this, SLOT(aboutApplication()));
     actions->addAction(KStandardAction::AboutKDE, this, SLOT(aboutKDE()));
   }
@@ -160,6 +166,14 @@
       need_separator = true;
     }
 
+    if (KAuthorized::authorizeKAction("switch_application_language"))
+    {
+      if (need_separator)
+        d->mMenu->addSeparator();
+      d->mSwitchApplicationLanguageAction = d->mMenu->addAction( i18n( "Switch \
application &language..." ), this, SLOT(switchApplicationLanguage()) ); +      \
need_separator = true; +    }
+
     if (need_separator)
       d->mMenu->addSeparator();
 
@@ -194,6 +208,10 @@
       return d->mReportBugAction;
     break;
 
+    case menuSwitchLanguage:
+      return d->mSwitchApplicationLanguageAction;
+    break;
+
     case menuAboutApp:
       return d->mAboutAppAction;
     break;
@@ -280,6 +298,17 @@
 }
 
 
+void KHelpMenu::switchApplicationLanguage()
+{
+  if ( !d->mSwitchApplicationLanguage )
+  {
+    d->mSwitchApplicationLanguage = new KSwitchLanguageDialog( d->mParent );
+    connect( d->mSwitchApplicationLanguage, SIGNAL(finished()), this, SLOT( \
dialogFinished()) ); +  }
+  d->mSwitchApplicationLanguage->show();
+}
+
+
 void KHelpMenu::dialogFinished()
 {
   QTimer::singleShot( 0, this, SLOT(timerExpired()) );
@@ -298,6 +327,11 @@
     delete d->mBugReport; d->mBugReport = 0;
   }
 
+  if ( d->mSwitchApplicationLanguage && !d->mSwitchApplicationLanguage->isVisible() \
) +  {
+    delete d->mSwitchApplicationLanguage; d->mSwitchApplicationLanguage = 0;
+  }
+
   if( d->mAboutApp && !d->mAboutApp->isVisible() )
   {
     delete d->mAboutApp; d->mAboutApp = 0;
Index: kdelibs/kdeui/widgets/khelpmenu.h
===================================================================
--- kdelibs/kdeui/widgets/khelpmenu.h	(revision 665362)
+++ kdelibs/kdeui/widgets/khelpmenu.h	(working copy)
@@ -171,7 +171,8 @@
       menuWhatsThis = 1,
       menuAboutApp = 2,
       menuAboutKDE = 3,
-      menuReportBug = 4
+      menuReportBug = 4,
+      menuSwitchLanguage = 5
     };
 
     /**
@@ -216,6 +217,11 @@
      */
     void reportBug();
 
+    /**
+     * Opens the changing default application language dialog box.
+     */
+    void switchApplicationLanguage();
+
   private Q_SLOTS:
     /**
      * Connected to the menu pointer (if created) to detect a delete
Index: kdebase/runtime/kcontrol/locale/CMakeLists.txt
===================================================================
--- kdebase/runtime/kcontrol/locale/CMakeLists.txt	(revision 665440)
+++ kdebase/runtime/kcontrol/locale/CMakeLists.txt	(working copy)
@@ -10,7 +10,6 @@
    main.cpp 
    toplevel.cpp 
    kcmlocale.cpp 
-   klanguagebutton.cpp 
    klocalesample.cpp 
    localenum.cpp 
    localemon.cpp 



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic