Hello community, here is the log from the commit of package ktextwidgets for openSUSE:Factory checked in at 2014-07-15 10:08:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ktextwidgets (Old) and /work/SRC/openSUSE:Factory/.ktextwidgets.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ktextwidgets" Changes: -------- --- /work/SRC/openSUSE:Factory/ktextwidgets/ktextwidgets.changes 2014-06-10 14:36:34.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ktextwidgets.new/ktextwidgets.changes 2014-07-15 10:08:42.000000000 +0200 @@ -1,0 +2,18 @@ +Fri Jul 11 09:48:51 UTC 2014 - [email protected] + +- Define kf5_version within package + +------------------------------------------------------------------- +Tue Jul 1 21:35:48 UTC 2014 - [email protected] + +- Update to 5.0.0 + * Final release of KDE Frameworks 5 + * API improvements and cleanups + * Buildsystem fixes + * For more details please see: + http://www.kde.org/announcements/kde-frameworks-5.0.php +- Drop 0001-Add-KPluralHandlingSpinbox-to-allow-to-add-plural-i1.patch + and 0002-As-discussed-with-david-don-t-allow-to-use-setSuffix.patch, + merged upstream + +------------------------------------------------------------------- Old: ---- 0001-Add-KPluralHandlingSpinbox-to-allow-to-add-plural-i1.patch 0002-As-discussed-with-david-don-t-allow-to-use-setSuffix.patch ktextwidgets-4.100.0.tar.xz New: ---- ktextwidgets-5.0.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ktextwidgets.spec ++++++ --- /var/tmp/diff_new_pack.OXMmDR/_old 2014-07-15 10:08:42.000000000 +0200 +++ /var/tmp/diff_new_pack.OXMmDR/_new 2014-07-15 10:08:42.000000000 +0200 @@ -18,21 +18,22 @@ %define lname libKF5TextWidgets5 Name: ktextwidgets -Version: 4.100.0 +Version: 5.0.0 Release: 0 +%define kf5_version %{version} BuildRequires: cmake >= 2.8.12 -BuildRequires: extra-cmake-modules >= 0.0.14 +BuildRequires: extra-cmake-modules >= 1.0.0 BuildRequires: fdupes -BuildRequires: kcompletion-devel >= %{_kf5_version} -BuildRequires: kconfig-devel >= %{_kf5_version} -BuildRequires: kconfigwidgets-devel >= %{_kf5_version} +BuildRequires: kcompletion-devel >= %{kf5_version} +BuildRequires: kconfig-devel >= %{kf5_version} +BuildRequires: kconfigwidgets-devel >= %{kf5_version} BuildRequires: kf5-filesystem -BuildRequires: ki18n-devel >= %{_kf5_version} -BuildRequires: kiconthemes-devel >= %{_kf5_version} -BuildRequires: kservice-devel >= %{_kf5_version} -BuildRequires: kwidgetsaddons-devel >= %{_kf5_version} -BuildRequires: kwindowsystem-devel >= %{_kf5_version} -BuildRequires: sonnet-devel >= %{_kf5_version} +BuildRequires: ki18n-devel >= %{kf5_version} +BuildRequires: kiconthemes-devel >= %{kf5_version} +BuildRequires: kservice-devel >= %{kf5_version} +BuildRequires: kwidgetsaddons-devel >= %{kf5_version} +BuildRequires: kwindowsystem-devel >= %{kf5_version} +BuildRequires: sonnet-devel >= %{kf5_version} BuildRequires: pkgconfig(Qt5Core) >= 5.2.0 BuildRequires: pkgconfig(Qt5DBus) >= 5.2.0 BuildRequires: pkgconfig(Qt5Test) >= 5.2.0 @@ -41,12 +42,8 @@ License: LGPL-2.1+ Group: System/GUI/KDE Url: http://www.kde.org -Source: http://download.kde.org/unstable/frameworks/%{version}/%{name}-%{version}.tar.xz +Source: http://download.kde.org/stable/frameworks/%{version}/%{name}-%{version}.tar.xz Source1: baselibs.conf -# PATCH-FIX-UPSTREAM 0001-Add-KPluralHandlingSpinbox-to-allow-to-add-plural-i1.patch -Patch0: 0001-Add-KPluralHandlingSpinbox-to-allow-to-add-plural-i1.patch -# PATCH-FIX-UPSTREAM 0002-As-discussed-with-david-don-t-allow-to-use-setSuffix.patch -Patch1: 0002-As-discussed-with-david-don-t-allow-to-use-setSuffix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -68,13 +65,13 @@ Group: Development/Libraries/KDE Requires: %lname = %{version} Requires: extra-cmake-modules -Requires: kcompletion-devel >= %{_kf5_version} -Requires: kconfigwidgets-devel >= %{_kf5_version} -Requires: ki18n-devel >= %{_kf5_version} -Requires: kiconthemes-devel >= %{_kf5_version} -Requires: kservice-devel >= %{_kf5_version} -Requires: kwindowsystem-devel >= %{_kf5_version} -Requires: sonnet-devel >= %{_kf5_version} +Requires: kcompletion-devel >= %{kf5_version} +Requires: kconfigwidgets-devel >= %{kf5_version} +Requires: ki18n-devel >= %{kf5_version} +Requires: kiconthemes-devel >= %{kf5_version} +Requires: kservice-devel >= %{kf5_version} +Requires: kwindowsystem-devel >= %{kf5_version} +Requires: sonnet-devel >= %{kf5_version} Requires: pkgconfig(Qt5Widgets) >= 5.2.0 %description devel @@ -84,8 +81,6 @@ %lang_package -n %lname %prep %setup -q -%patch0 -p1 -%patch1 -p1 %build %cmake_kf5 -d build ++++++ ktextwidgets-4.100.0.tar.xz -> ktextwidgets-5.0.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktextwidgets-4.100.0/CMakeLists.txt new/ktextwidgets-5.0.0/CMakeLists.txt --- old/ktextwidgets-4.100.0/CMakeLists.txt 2014-06-01 14:36:52.000000000 +0200 +++ new/ktextwidgets-5.0.0/CMakeLists.txt 2014-07-01 20:35:10.000000000 +0200 @@ -3,7 +3,7 @@ project(KTextWidgets) # ECM setup -find_package(ECM 0.0.14 REQUIRED NO_MODULE) +find_package(ECM 1.0.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(KDEInstallDirs) @@ -15,8 +15,8 @@ include(ECMGenerateHeaders) include(ECMPackageConfigHelpers) -set(KF5_VERSION "4.100.0") # handled by release scripts -set(KF5_DEP_VERSION "4.100.0") # handled by release scripts +set(KF5_VERSION "5.0.0") # handled by release scripts +set(KF5_DEP_VERSION "5.0.0") # handled by release scripts ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KTEXTWIDGETS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktextwidgets-4.100.0/KF5TextWidgetsConfig.cmake.in new/ktextwidgets-5.0.0/KF5TextWidgetsConfig.cmake.in --- old/ktextwidgets-4.100.0/KF5TextWidgetsConfig.cmake.in 2014-06-01 14:36:52.000000000 +0200 +++ new/ktextwidgets-5.0.0/KF5TextWidgetsConfig.cmake.in 2014-07-01 20:35:10.000000000 +0200 @@ -8,7 +8,7 @@ find_dependency(Qt5Widgets @REQUIRED_QT_VERSION@) find_dependency(KF5Sonnet "@KF5_DEP_VERSION@") - +find_dependency(KF5I18n "@KF5_DEP_VERSION@") include("${CMAKE_CURRENT_LIST_DIR}/KF5TextWidgetsTargets.cmake") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktextwidgets-4.100.0/autotests/CMakeLists.txt new/ktextwidgets-5.0.0/autotests/CMakeLists.txt --- old/ktextwidgets-4.100.0/autotests/CMakeLists.txt 2014-06-01 14:36:52.000000000 +0200 +++ new/ktextwidgets-5.0.0/autotests/CMakeLists.txt 2014-07-01 20:35:10.000000000 +0200 @@ -13,4 +13,5 @@ kreplacetest krichtextedittest ktextedit_unittest + kpluralhandlingspinboxtest ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktextwidgets-4.100.0/autotests/kpluralhandlingspinboxtest.cpp new/ktextwidgets-5.0.0/autotests/kpluralhandlingspinboxtest.cpp --- old/ktextwidgets-4.100.0/autotests/kpluralhandlingspinboxtest.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/ktextwidgets-5.0.0/autotests/kpluralhandlingspinboxtest.cpp 2014-07-01 20:35:10.000000000 +0200 @@ -0,0 +1,69 @@ +/** + * Copyright 2014 Laurent Montel <[email protected]> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include "kpluralhandlingspinboxtest.h" +#include "kpluralhandlingspinbox.h" + +#include <QTest> + +QTEST_MAIN(KPluralHandlingSpinBoxTest) + +KPluralHandlingSpinBoxTest::KPluralHandlingSpinBoxTest() +{ +} + +void KPluralHandlingSpinBoxTest::shouldHaveDefautValue() +{ + KPluralHandlingSpinBox spinbox; + QCOMPARE(spinbox.suffix(), QString()); +} + +void KPluralHandlingSpinBoxTest::shouldUseSingularValueWhenUseValueEqualToOne() +{ + KPluralHandlingSpinBox spinbox; + spinbox.setSuffix(ki18np("singular", "plural")); + spinbox.setValue(1); + QCOMPARE(spinbox.suffix(), QLatin1String("singular")); +} + +void KPluralHandlingSpinBoxTest::shouldUsePlurialValueWhenUseValueSuperiorToOne() +{ + KPluralHandlingSpinBox spinbox; + spinbox.setSuffix(ki18np("singular", "plural")); + spinbox.setValue(2); + QCOMPARE(spinbox.suffix(), QLatin1String("plural")); +} + +void KPluralHandlingSpinBoxTest::shouldUseSingularValueWhenWeChangeValueAndFinishWithValueEqualOne() +{ + KPluralHandlingSpinBox spinbox; + spinbox.setSuffix(ki18np("singular", "plural")); + spinbox.setValue(2); + spinbox.setValue(1); + QCOMPARE(spinbox.suffix(), QLatin1String("singular")); + QCOMPARE(spinbox.value(), 1); +} + +void KPluralHandlingSpinBoxTest::shouldReturnEmptySuffix() +{ + KPluralHandlingSpinBox spinbox; + spinbox.setValue(2); + QCOMPARE(spinbox.suffix(), QString()); +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktextwidgets-4.100.0/autotests/kpluralhandlingspinboxtest.h new/ktextwidgets-5.0.0/autotests/kpluralhandlingspinboxtest.h --- old/ktextwidgets-4.100.0/autotests/kpluralhandlingspinboxtest.h 1970-01-01 01:00:00.000000000 +0100 +++ new/ktextwidgets-5.0.0/autotests/kpluralhandlingspinboxtest.h 2014-07-01 20:35:10.000000000 +0200 @@ -0,0 +1,39 @@ +/** + * Copyright 2014 Laurent Montel <[email protected]> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef KPLURALHANDLINGSPINBOXTEST_H +#define KPLURALHANDLINGSPINBOXTEST_H + +#include <QObject> + +class KPluralHandlingSpinBoxTest : public QObject +{ + Q_OBJECT +public: + KPluralHandlingSpinBoxTest(); + +private Q_SLOTS: + void shouldHaveDefautValue(); + void shouldUseSingularValueWhenUseValueEqualToOne(); + void shouldUsePlurialValueWhenUseValueSuperiorToOne(); + void shouldUseSingularValueWhenWeChangeValueAndFinishWithValueEqualOne(); + void shouldReturnEmptySuffix(); +}; + +#endif // KPLURALHANDLINGSPINBOXTEST_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktextwidgets-4.100.0/po/ca/ktextwidgets5.po new/ktextwidgets-5.0.0/po/ca/ktextwidgets5.po --- old/ktextwidgets-4.100.0/po/ca/ktextwidgets5.po 2014-06-01 14:36:52.000000000 +0200 +++ new/ktextwidgets-5.0.0/po/ca/ktextwidgets5.po 2014-07-01 20:35:10.000000000 +0200 @@ -1,12 +1,11 @@ # Translation of ktextwidgets5.po to Catalan -# Copyright (C) 1998-2014 This_file_is_part_of_KDE +# Copyright (C) 2014 This_file_is_part_of_KDE # This file is distributed under the license LGPL version 2.1 or # version 3 or later versions approved by the membership of KDE e.V. # -# Sebastià Pla i Sanz <[email protected]>, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006. +# Sebastià Pla i Sanz <[email protected]>, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007. # Antoni Bella Pérez <[email protected]>, 2003, 2006, 2011, 2012, 2013. # Albert Astals Cid <[email protected]>, 2004, 2005, 2007. -# Sebastia Pla Sanz <[email protected]>, 2006, 2007. # Josep Ma. Ferrer <[email protected]>, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014. # Robert Millan <[email protected]>, 2009. # Orestes Mas <[email protected]>, 2010. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktextwidgets-4.100.0/po/en_GB/ktextwidgets5.po new/ktextwidgets-5.0.0/po/en_GB/ktextwidgets5.po --- old/ktextwidgets-4.100.0/po/en_GB/ktextwidgets5.po 2014-06-01 14:36:52.000000000 +0200 +++ new/ktextwidgets-5.0.0/po/en_GB/ktextwidgets5.po 2014-07-01 20:35:10.000000000 +0200 @@ -2,19 +2,20 @@ # Malcolm Hunter <[email protected]>, 2002,2003,2004, 2005, 2006, 2007, 2008, 2009. # Jonathan Riddell <[email protected]>, 2003. # Andrew Coles <[email protected]>, 2004, 2005, 2009, 2010. +# Steve Allewell <[email protected]>, 2014. msgid "" msgstr "" "Project-Id-Version: kdelibs4\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2014-04-27 20:56+0000\n" -"PO-Revision-Date: 2010-12-14 12:18+0000\n" -"Last-Translator: Andrew Coles <[email protected]>\n" -"Language-Team: British English <[email protected]>\n" -"Language: \n" +"PO-Revision-Date: 2014-06-28 12:15+0100\n" +"Last-Translator: Steve Allewell <[email protected]>\n" +"Language-Team: British English <[email protected]>\n" +"Language: en_GB\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.1\n" +"X-Generator: Lokalize 1.5\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" #: dialogs/klinkdialog.cpp:52 @@ -522,12 +523,12 @@ #: widgets/krichtextwidget.cpp:408 msgctxt "@item:inmenu lower case roman numerals" msgid "i ii iii" -msgstr "" +msgstr "i ii iii" #: widgets/krichtextwidget.cpp:409 msgctxt "@item:inmenu upper case roman numerals" msgid "I II III" -msgstr "" +msgstr "I II III" #: widgets/krichtextwidget.cpp:425 msgctxt "@action" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktextwidgets-4.100.0/po/nds/ktextwidgets5.po new/ktextwidgets-5.0.0/po/nds/ktextwidgets5.po --- old/ktextwidgets-4.100.0/po/nds/ktextwidgets5.po 2014-06-01 14:36:52.000000000 +0200 +++ new/ktextwidgets-5.0.0/po/nds/ktextwidgets5.po 2014-07-01 20:35:10.000000000 +0200 @@ -9,14 +9,14 @@ "Project-Id-Version: kdelibs4\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2014-04-27 20:56+0000\n" -"PO-Revision-Date: 2014-05-11 00:55+0200\n" +"PO-Revision-Date: 2014-06-18 01:32+0200\n" "Last-Translator: Sönke Dibbern <[email protected]>\n" "Language-Team: Low Saxon <[email protected]>\n" "Language: nds\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.4\n" +"X-Generator: Lokalize 1.5\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" #: dialogs/klinkdialog.cpp:52 @@ -268,7 +268,7 @@ #: findreplace/kfinddialog.cpp:461 msgid "Escape" -msgstr "Escape" +msgstr "Utkniep" #: findreplace/kfinddialog.cpp:462 msgid "TAB" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktextwidgets-4.100.0/po/uk/ktextwidgets5.po new/ktextwidgets-5.0.0/po/uk/ktextwidgets5.po --- old/ktextwidgets-4.100.0/po/uk/ktextwidgets5.po 2014-06-01 14:36:52.000000000 +0200 +++ new/ktextwidgets-5.0.0/po/uk/ktextwidgets5.po 2014-07-01 20:35:10.000000000 +0200 @@ -1,5 +1,7 @@ -# translation of kdelibs4.po to Ukrainian -# Translation of kdelibs4.po to Ukrainian +# Translation of ktextwidgets5.po to Ukrainian +# Copyright (C) 2014 This_file_is_part_of_KDE +# This file is distributed under the license LGPL version 2.1 or +# version 3 or later versions approved by the membership of KDE e.V. # # Eugene Onischenko <[email protected]>, 2002, 2003, 2004, 2005, 2006. # Andriy Rysin <[email protected]>, 2002, 2003, 2006, 2007. @@ -7,7 +9,7 @@ # Yuri Chornoivan <[email protected]>, 2008, 2009, 2010, 2011, 2012, 2013. msgid "" msgstr "" -"Project-Id-Version: kdelibs4\n" +"Project-Id-Version: ktextwidgets5\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2014-04-27 20:56+0000\n" "PO-Revision-Date: 2013-10-15 07:58+0300\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktextwidgets-4.100.0/src/CMakeLists.txt new/ktextwidgets-5.0.0/src/CMakeLists.txt --- old/ktextwidgets-4.100.0/src/CMakeLists.txt 2014-06-01 14:36:52.000000000 +0200 +++ new/ktextwidgets-5.0.0/src/CMakeLists.txt 2014-07-01 20:35:10.000000000 +0200 @@ -8,6 +8,7 @@ widgets/krichtextwidget.cpp widgets/ktextedit.cpp widgets/nestedlisthelper.cpp + widgets/kpluralhandlingspinbox.cpp ) add_library(KF5TextWidgets ${ktextwidgets_LIB_SRCS}) @@ -29,10 +30,10 @@ PUBLIC Qt5::Widgets KF5::SonnetUi + KF5::I18n PRIVATE Qt5::DBus KF5::SonnetCore - KF5::I18n KF5::Service KF5::ConfigWidgets KF5::WindowSystem @@ -50,6 +51,7 @@ KRichTextEdit KRichTextWidget KTextEdit + KPluralHandlingSpinBox RELATIVE widgets REQUIRED_HEADERS KTextWidgets_HEADERS @@ -83,5 +85,5 @@ install( FILES kregexpeditor/kregexpeditor.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) include(ECMGeneratePriFile) -ecm_generate_pri_file(BASE_NAME KTextWidgets LIB_NAME KF5TextWidgets DEPS "widgets SonnetUi" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KF5_INCLUDE_INSTALL_DIR}/KTextWidgets) +ecm_generate_pri_file(BASE_NAME KTextWidgets LIB_NAME KF5TextWidgets DEPS "widgets SonnetUi I18n" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KF5_INCLUDE_INSTALL_DIR}/KTextWidgets) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktextwidgets-4.100.0/src/widgets/kpluralhandlingspinbox.cpp new/ktextwidgets-5.0.0/src/widgets/kpluralhandlingspinbox.cpp --- old/ktextwidgets-4.100.0/src/widgets/kpluralhandlingspinbox.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/ktextwidgets-5.0.0/src/widgets/kpluralhandlingspinbox.cpp 2014-07-01 20:35:10.000000000 +0200 @@ -0,0 +1,64 @@ +/** + * Copyright 2014 Laurent Montel <[email protected]> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include "kpluralhandlingspinbox.h" + +class KPluralHandlingSpinBox::KPluralHandlingSpinBoxPrivate +{ +public: + KPluralHandlingSpinBoxPrivate(QSpinBox *q) + : q(q) + { + connect(q, SIGNAL(valueChanged(int)), q, SLOT(updateSuffix(int))); + } + + void updateSuffix(int value) + { + if (!pluralSuffix.isEmpty()) { + KLocalizedString s = pluralSuffix; + q->setSuffix(s.subs(value).toString()); + } + } + + QSpinBox *q; + KLocalizedString pluralSuffix; +}; + + +KPluralHandlingSpinBox::KPluralHandlingSpinBox(QWidget *parent) + : QSpinBox(parent), + d(new KPluralHandlingSpinBoxPrivate(this)) +{ +} + +KPluralHandlingSpinBox::~KPluralHandlingSpinBox() +{ + delete d; +} + +void KPluralHandlingSpinBox::setSuffix(const KLocalizedString &suffix) +{ + d->pluralSuffix = suffix; + if (suffix.isEmpty()) { + QSpinBox::setSuffix(QString()); + } else { + d->updateSuffix(value()); + } +} +#include "moc_kpluralhandlingspinbox.cpp" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktextwidgets-4.100.0/src/widgets/kpluralhandlingspinbox.h new/ktextwidgets-5.0.0/src/widgets/kpluralhandlingspinbox.h --- old/ktextwidgets-4.100.0/src/widgets/kpluralhandlingspinbox.h 1970-01-01 01:00:00.000000000 +0100 +++ new/ktextwidgets-5.0.0/src/widgets/kpluralhandlingspinbox.h 2014-07-01 20:35:10.000000000 +0200 @@ -0,0 +1,60 @@ +/** + * Copyright 2014 Laurent Montel <[email protected]> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef KPLURALHANDLINGSPINBOX_H +#define KPLURALHANDLINGSPINBOX_H + +#include <ktextwidgets_export.h> +#include <KLocalizedString> +#include <QSpinBox> + + +/** + * @brief A QSpinBox with plural handling for the suffix. + * + * @author Laurent Montel <[email protected]> + * + * @since 5.0 + */ +class KTEXTWIDGETS_EXPORT KPluralHandlingSpinBox : public QSpinBox +{ + Q_OBJECT +public: + /** + * Default constructor + */ + + explicit KPluralHandlingSpinBox(QWidget *parent = 0); + ~KPluralHandlingSpinBox(); + + /** + * Sets the suffix to @p suffix. + * Use this to add a plural-aware suffix, e.g. by using ki18np("singular", "plural"). + */ + void setSuffix(const KLocalizedString &suffix); +private: + class KPluralHandlingSpinBoxPrivate; + friend class KPluralHandlingSpinBoxPrivate; + KPluralHandlingSpinBoxPrivate *const d; + + Q_DISABLE_COPY(KPluralHandlingSpinBox) + Q_PRIVATE_SLOT(d, void updateSuffix(int)) +}; + +#endif // KPLURALHANDLINGSPINBOX_H -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
