Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit ba6b33ad authored by Sebastian Kügler's avatar Sebastian Kügler

Replace KMessageBox with KMessageWidget for missing language warnings

Less modal dialogs, especially not in a loop.

Also line-break tooltips: they'd otherwise not word-wrap which
completely screws them up by forcing everything onto one line. They're
now sensibly sized and readable.

CCMAIL:mgraesslin@kde.org
parent a0920be3
......@@ -8,6 +8,7 @@ add_library(kcm_translations ${kcm_translations_PART_SRCS})
target_link_libraries(kcm_translations
Qt5::Widgets
KF5::WidgetsAddons
KF5::KCMUtils
KF5::I18n
)
......
......@@ -26,6 +26,7 @@
#include <KLocalizedString>
#include <KMessageBox>
#include <KPluginFactory>
#include <KMessageWidget>
#include <QListWidget>
#include <QListWidgetItem>
......@@ -37,7 +38,8 @@ K_PLUGIN_FACTORY(KCMTranslationsFactory, registerPlugin<KCMTranslations>();)
KCMTranslations::KCMTranslations(QWidget *parent, const QVariantList &args)
: KCModule(parent, args),
m_ui(new Ui::KCMTranslationsWidget)
m_ui(new Ui::KCMTranslationsWidget),
m_messageWidget(0)
{
KAboutData *about = new KAboutData(I18N_NOOP("KCMTranslations"),
i18n("Translations"),
......@@ -110,15 +112,28 @@ void KCMTranslations::load()
// Then update all the widgets to use the new settings
initWidgets();
// Now we have a ui built tell the user about the missing languages
foreach (const QString &languageCode, missingLanguages) {
KMessageBox::information(this, i18nc("%1 is the language code",
"You have the language with code '%1' in your list "
"of languages to use for translation but the "
"localization files for it could not be found. The "
"language has been removed from your configuration. "
"If you want to add it again please install the "
"localization files for it and add the language again.", languageCode));
if (missingLanguages.count()) {
const QString txt = i18ncp("%1 is the language code",
"The translation files for the language with the code '%2' "
"could not be found. The "
"language has been removed from your configuration. "
"If you want to add it back, please install the "
"localization files for it and add the language again.",
"The translation files for the languages with the codes "
"'%2' could not be found. These "
"languages have been removed from your configuration. "
"If you want to add them back, please install the "
"localization files for it and the languages again.",
missingLanguages.count(),
missingLanguages.join("', '"));
m_messageWidget = new KMessageWidget(this);
m_messageWidget->setMessageType(KMessageWidget::Information);
m_messageWidget->setWordWrap(true);
m_messageWidget->setText(txt);
m_ui->verticalLayout->insertWidget(0, m_messageWidget);
}
}
......@@ -193,9 +208,9 @@ void KCMTranslations::initTranslations()
m_ui->m_selectTranslations->setAvailableLabel(i18n("Available Languages:"));
QString availableHelp = i18n("This is the list of installed KDE Plasma language "
"translations not currently being used. To use a language "
"translations not currently being used. <br />To use a language "
"translation move it to the 'Preferred Languages' list in "
"the order of preference. If no suitable languages are "
"the order of preference. <br />If no suitable languages are "
"listed, then you may need to install more language packages "
"using your usual installation method.");
m_ui->m_selectTranslations->availableListWidget()->setToolTip(availableHelp);
......@@ -204,8 +219,8 @@ void KCMTranslations::initTranslations()
m_ui->m_selectTranslations->setSelectedLabel(i18n("Preferred Languages:"));
QString selectedHelp = i18n("This is the list of installed KDE Plasma language "
"translations currently being used, listed in order of "
"preference. If a translation is not available for the "
"first language in the list, the next language will be used. "
"preference. <br />If a translation is not available for the "
"first language in the list, the next language will be used. <br /> "
"If no other translations are available then US English will "
"be used.");
m_ui->m_selectTranslations->selectedListWidget()->setToolTip(selectedHelp);
......
......@@ -27,10 +27,11 @@
#include <KConfigGroup>
class QListWidgetItem;
class QCheckBox;
class KPushButton;
class KComboBox;
class KIntNumInput;
// class QCheckBox;
// class KPushButton;
// class KComboBox;
// class KIntNumInput;
class KMessageWidget;
namespace Ui
{
......@@ -82,6 +83,7 @@ private:
KConfigGroup m_config;
Ui::KCMTranslationsWidget *m_ui;
KMessageWidget *m_messageWidget;
};
#endif //KCMTRANSLATIONS_H
\ No newline at end of file
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>702</width>
<height>425</height>
<width>687</width>
<height>333</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -16,68 +16,62 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="m_tabWidgetSettings">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="KActionSelector" name="m_selectTranslations" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="availableLabel" stdset="0">
<string>Available Translations:</string>
</property>
<property name="selectedLabel" stdset="0">
<string>Preferred Translations:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QPushButton" name="m_buttonTranslationsInstall">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Install more translations</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="KActionSelector" name="m_selectTranslations">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="availableLabel">
<string>Available &amp;Translations:</string>
</property>
<property name="selectedLabel">
<string>Preferred Trans&amp;lations:</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_buttonTranslationsInstall">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Install more translations</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
......@@ -88,10 +82,6 @@
<header>kactionselector.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>m_tabWidgetSettings</tabstop>
<tabstop>m_buttonTranslationsInstall</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment