From 254690e899dce589ce3b172c998b031a6405895b Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 1 Nov 2016 21:13:42 +0000 Subject: [PATCH] Correctly set i18n suffix in mousemark spinbox. Summary: QSpinBox can't handle plural suffixes. Something previously done by KIntSpinBox. Using setSuffix(ki18np("pixel", "pixels")).toString() does nothing, as at the time of conversion we don't know which one to use. This patch uses KPluralHandlingSpinBox and correct ki18np. Note, "new" dependency was already linked implicitly in other kwin, but we need to add it for this KCM. Test Plan: Opened KCM (in English) set counter to 1 pixel and 2 pixels. No longer had a big warning. Also appropriate number of s's appeared. Reviewers: #plasma Subscribers: plasma-devel, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D3222 --- CMakeLists.txt | 35 ++++++++--------- effects/mousemark/CMakeLists.txt | 1 + effects/mousemark/mousemark_config.cpp | 2 +- effects/mousemark/mousemark_config.ui | 53 ++++++++++++-------------- 4 files changed, 44 insertions(+), 47 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f43cd81a8..52eeaea487 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,7 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Declarative KCMUtils KIO + TextWidgets NewStuff Service XmlGui @@ -340,10 +341,10 @@ add_subdirectory(helpers) ########### next target ############### set(kwin_KDEINIT_SRCS - workspace.cpp + workspace.cpp dbusinterface.cpp abstract_client.cpp - client.cpp + client.cpp client_machine.cpp cursor.cpp debug_console.cpp @@ -356,25 +357,25 @@ set(kwin_KDEINIT_SRCS pointer_input.cpp touch_input.cpp netinfo.cpp - placement.cpp - atoms.cpp - utils.cpp - layers.cpp - main.cpp - options.cpp + placement.cpp + atoms.cpp + utils.cpp + layers.cpp + main.cpp + options.cpp outline.cpp - events.cpp - killwindow.cpp - geometrytip.cpp + events.cpp + killwindow.cpp + geometrytip.cpp screens.cpp shadow.cpp - sm.cpp - group.cpp - manage.cpp + sm.cpp + group.cpp + manage.cpp overlaywindow.cpp - activation.cpp - useractions.cpp - geometry.cpp + activation.cpp + useractions.cpp + geometry.cpp rules.cpp composite.cpp toplevel.cpp diff --git a/effects/mousemark/CMakeLists.txt b/effects/mousemark/CMakeLists.txt index 5d95a8acd6..9002f7c344 100644 --- a/effects/mousemark/CMakeLists.txt +++ b/effects/mousemark/CMakeLists.txt @@ -12,6 +12,7 @@ target_link_libraries(kwin_mousemark_config KF5::GlobalAccel KF5::I18n KF5::Service + KF5::TextWidgets KF5::XmlGui ) diff --git a/effects/mousemark/mousemark_config.cpp b/effects/mousemark/mousemark_config.cpp index 8f9f0d1927..68164a071b 100644 --- a/effects/mousemark/mousemark_config.cpp +++ b/effects/mousemark/mousemark_config.cpp @@ -52,7 +52,7 @@ MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList { m_ui = new MouseMarkEffectConfigForm(this); - m_ui->kcfg_LineWidth->setSuffix(ki18np(" pixel", " pixels").toString()); + m_ui->kcfg_LineWidth->setSuffix(ki18np(" pixel", " pixels")); QVBoxLayout* layout = new QVBoxLayout(this); diff --git a/effects/mousemark/mousemark_config.ui b/effects/mousemark/mousemark_config.ui index b86db7e4cd..6bfbb3dfad 100644 --- a/effects/mousemark/mousemark_config.ui +++ b/effects/mousemark/mousemark_config.ui @@ -17,10 +17,10 @@ Appearance - + - &Width: + Wid&th: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -30,26 +30,7 @@ - - - - - 0 - 0 - - - - 1 - - - 10 - - - 3 - - - - + &Color: @@ -62,7 +43,7 @@ - + @@ -72,15 +53,24 @@ + + + + 1 + + + 10 + + + 3 + + + - - - KShortcutsEditor::GlobalAction - - + @@ -106,9 +96,14 @@ KShortcutsEditor QWidget -
KShortcutsEditor
+
kshortcutseditor.h
1
+ + KPluralHandlingSpinBox + QSpinBox +
kpluralhandlingspinbox.h
+