Commit 254690e8 authored by David Edmundson's avatar David Edmundson

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
parent 3a179f32
......@@ -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
......
......@@ -12,6 +12,7 @@ target_link_libraries(kwin_mousemark_config
KF5::GlobalAccel
KF5::I18n
KF5::Service
KF5::TextWidgets
KF5::XmlGui
)
......
......@@ -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);
......
......@@ -17,10 +17,10 @@
<string>Appearance</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>&amp;Width:</string>
<string>Wid&amp;th:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
......@@ -30,26 +30,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="kcfg_LineWidth">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>3</number>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&amp;Color:</string>
......@@ -62,7 +43,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="KColorCombo" name="kcfg_Color">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
......@@ -72,15 +53,24 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KPluralHandlingSpinBox" name="kcfg_LineWidth">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>3</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="KShortcutsEditor" name="editor" native="true">
<property name="actionTypes">
<enum>KShortcutsEditor::GlobalAction</enum>
</property>
</widget>
<widget class="KShortcutsEditor" name="editor"/>
</item>
<item>
<widget class="QLabel" name="label_3">
......@@ -106,9 +96,14 @@
<customwidget>
<class>KShortcutsEditor</class>
<extends>QWidget</extends>
<header location="global">KShortcutsEditor</header>
<header>kshortcutseditor.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KPluralHandlingSpinBox</class>
<extends>QSpinBox</extends>
<header>kpluralhandlingspinbox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
......
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