Hello community, here is the log from the commit of package libyui-qt for openSUSE:Factory checked in at 2020-01-04 19:20:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libyui-qt (Old) and /work/SRC/openSUSE:Factory/.libyui-qt.new.6675 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libyui-qt" Sat Jan 4 19:20:43 2020 rev:67 rq:758510 version:2.52.1 Changes: -------- --- /work/SRC/openSUSE:Factory/libyui-qt/libyui-qt.changes 2019-12-14 12:04:18.367394366 +0100 +++ /work/SRC/openSUSE:Factory/.libyui-qt.new.6675/libyui-qt.changes 2020-01-04 19:20:51.689124483 +0100 @@ -1,0 +2,6 @@ +Fri Dec 20 11:51:53 CET 2019 - [email protected] + +- handle new sort-key when sorting tables (bsc#1140018) +- 2.52.1 + +------------------------------------------------------------------- Old: ---- libyui-qt-2.52.0.tar.bz2 New: ---- libyui-qt-2.52.1.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libyui-qt-doc.spec ++++++ --- /var/tmp/diff_new_pack.jg1Srl/_old 2020-01-04 19:20:52.069124651 +0100 +++ /var/tmp/diff_new_pack.jg1Srl/_new 2020-01-04 19:20:52.073124653 +0100 @@ -21,7 +21,7 @@ Name: %{parent}-doc # DO NOT manually bump the version here; instead, use rake version:bump -Version: 2.52.0 +Version: 2.52.1 Release: 0 Source: %{parent}-%{version}.tar.bz2 ++++++ libyui-qt.spec ++++++ --- /var/tmp/diff_new_pack.jg1Srl/_old 2020-01-04 19:20:52.089124660 +0100 +++ /var/tmp/diff_new_pack.jg1Srl/_new 2020-01-04 19:20:52.089124660 +0100 @@ -18,7 +18,7 @@ Name: libyui-qt # DO NOT manually bump the version here; instead, use rake version:bump -Version: 2.52.0 +Version: 2.52.1 Release: 0 Source: %{name}-%{version}.tar.bz2 @@ -30,7 +30,7 @@ BuildRequires: gcc-c++ BuildRequires: pkg-config -%define libyui_devel_version libyui-devel >= 3.9.0 +%define libyui_devel_version libyui-devel >= 3.9.1 BuildRequires: %{libyui_devel_version} BuildRequires: fontconfig-devel BuildRequires: pkgconfig(Qt5Core) ++++++ libyui-qt-2.52.0.tar.bz2 -> libyui-qt-2.52.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.52.0/VERSION.cmake new/libyui-qt-2.52.1/VERSION.cmake --- old/libyui-qt-2.52.0/VERSION.cmake 2019-12-10 17:07:37.000000000 +0100 +++ new/libyui-qt-2.52.1/VERSION.cmake 2019-12-20 13:54:01.000000000 +0100 @@ -1,6 +1,6 @@ SET(VERSION_MAJOR "2") SET(VERSION_MINOR "52") -SET(VERSION_PATCH "0") +SET(VERSION_PATCH "1") SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${GIT_SHA1_VERSION}" ) ##### This is needed for the libyui-qt core ONLY. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.52.0/package/libyui-qt-doc.spec new/libyui-qt-2.52.1/package/libyui-qt-doc.spec --- old/libyui-qt-2.52.0/package/libyui-qt-doc.spec 2019-12-10 17:07:37.000000000 +0100 +++ new/libyui-qt-2.52.1/package/libyui-qt-doc.spec 2019-12-20 13:54:01.000000000 +0100 @@ -21,7 +21,7 @@ Name: %{parent}-doc # DO NOT manually bump the version here; instead, use rake version:bump -Version: 2.52.0 +Version: 2.52.1 Release: 0 Source: %{parent}-%{version}.tar.bz2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.52.0/package/libyui-qt.changes new/libyui-qt-2.52.1/package/libyui-qt.changes --- old/libyui-qt-2.52.0/package/libyui-qt.changes 2019-12-10 17:07:37.000000000 +0100 +++ new/libyui-qt-2.52.1/package/libyui-qt.changes 2019-12-20 13:54:01.000000000 +0100 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Fri Dec 20 11:51:53 CET 2019 - [email protected] + +- handle new sort-key when sorting tables (bsc#1140018) +- 2.52.1 + +------------------------------------------------------------------- Mon Dec 9 10:57:10 UTC 2019 - Rodion Iafarov <[email protected]> - Add support to operate on many widgets with rest-api (bsc#1132247) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.52.0/package/libyui-qt.spec new/libyui-qt-2.52.1/package/libyui-qt.spec --- old/libyui-qt-2.52.0/package/libyui-qt.spec 2019-12-10 17:07:37.000000000 +0100 +++ new/libyui-qt-2.52.1/package/libyui-qt.spec 2019-12-20 13:54:01.000000000 +0100 @@ -18,7 +18,7 @@ Name: libyui-qt # DO NOT manually bump the version here; instead, use rake version:bump -Version: 2.52.0 +Version: 2.52.1 Release: 0 Source: %{name}-%{version}.tar.bz2 @@ -30,7 +30,7 @@ BuildRequires: gcc-c++ BuildRequires: pkg-config -%define libyui_devel_version libyui-devel >= 3.9.0 +%define libyui_devel_version libyui-devel >= 3.9.1 BuildRequires: %{libyui_devel_version} BuildRequires: fontconfig-devel BuildRequires: pkgconfig(Qt5Core) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.52.0/src/QY2ListView.cc new/libyui-qt-2.52.1/src/QY2ListView.cc --- old/libyui-qt-2.52.0/src/QY2ListView.cc 2019-12-10 17:07:37.000000000 +0100 +++ new/libyui-qt-2.52.1/src/QY2ListView.cc 2019-12-20 13:54:01.000000000 +0100 @@ -395,16 +395,10 @@ bool QY2ListViewItem::operator< ( const QTreeWidgetItem & otherListViewItem ) const { - bool sortByInsertionSequence = false; - QY2ListView * parentListView = dynamic_cast<QY2ListView *> (treeWidget()); - - if ( parentListView ) - sortByInsertionSequence = parentListView->sortByInsertionSequence(); + const QY2ListViewItem * other = dynamic_cast<const QY2ListViewItem *> (&otherListViewItem); - if ( sortByInsertionSequence ) + if ( sortByInsertionSequence() ) { - const QY2ListViewItem * other = dynamic_cast<const QY2ListViewItem *> (&otherListViewItem); - if ( other ) { return ( this->serial() < other->serial() ); @@ -418,29 +412,55 @@ { return ( this->serial() < otherCheckListItem->serial() ); } - } - // numeric sorting if columns are numbers int column = treeWidget()->sortColumn(); - QString text1=text(column).trimmed(); - QString text2=otherListViewItem.text(column).trimmed(); - text1=text1.left(text1.indexOf(QChar(' '))); - text2=text2.left(text2.indexOf(QChar(' '))); + if (other) + { + return compare(smartSortKey(column), other->smartSortKey(column)); + } + + return compare(text(column).trimmed(), otherListViewItem.text(column).trimmed()); +} + + +bool +QY2ListViewItem::sortByInsertionSequence() const +{ + QY2ListView * parentListView = dynamic_cast<QY2ListView *> (treeWidget()); + + if ( parentListView ) + return parentListView->sortByInsertionSequence(); + + return false; +} + + +bool +QY2ListViewItem::compare(const QString& text1, const QString& text2) const +{ + // numeric sorting if columns are numbers bool ok1, ok2; // conversion to int successful - bool retval = text1.toInt(&ok1) < text2.toInt(&ok2); + bool retval = text1.toLongLong(&ok1) < text2.toLongLong(&ok2); - if (ok1 && ok2 ) + if (ok1 && ok2) return retval; // int < int else if (ok1 && !ok2) return true; // int < string else if (!ok1 && ok2) return false; // string > int - // and finally non-numeric sorting is done by the base class - return QTreeWidgetItem::operator<(otherListViewItem); + // and finally non-numeric sorting is done locale aware + return QString::localeAwareCompare(text1, text2) < 0; // string < string +} + + +QString +QY2ListViewItem::smartSortKey(int column) const +{ + return text(column).trimmed(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.52.0/src/QY2ListView.h new/libyui-qt-2.52.1/src/QY2ListView.h --- old/libyui-qt-2.52.0/src/QY2ListView.h 2019-12-10 17:07:37.000000000 +0100 +++ new/libyui-qt-2.52.1/src/QY2ListView.h 2019-12-20 13:54:01.000000000 +0100 @@ -230,7 +230,7 @@ /** * Enhanced QTreeWidgetItem **/ -class QY2ListViewItem: public QTreeWidgetItem +class QY2ListViewItem : public QTreeWidgetItem { public: @@ -275,12 +275,30 @@ virtual bool operator< ( const QTreeWidgetItem & other ) const; /** + * Returns 'true' if the sort order should always be the item insertion + * order, 'false' if the user can change the sort order by clicking on a + * column header. + **/ + bool sortByInsertionSequence() const; + + /** * Return this item's serial number. * Useful for comparison functions that order by insertion sequence. **/ int serial() const { return _serial; } /** + * Compare two string locate-aware. Strings representing integers + * have special handling. + **/ + bool compare(const QString& text1, const QString& text2) const; + + /** + * The text of the table cell or the sort-key if available. + **/ + virtual QString smartSortKey(int column) const; + + /** * Returns a tool tip text for a specific column of this item. * 'column' is -1 if the mouse pointer is in the tree indentation area. * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.52.0/src/YQTable.cc new/libyui-qt-2.52.1/src/YQTable.cc --- old/libyui-qt-2.52.0/src/YQTable.cc 2019-12-10 17:07:37.000000000 +0100 +++ new/libyui-qt-2.52.1/src/YQTable.cc 2019-12-20 13:54:01.000000000 +0100 @@ -468,3 +468,15 @@ } } } + + +QString +YQTableListViewItem::smartSortKey(int column) const +{ + const YTableCell* tableCell = origItem()->cell(column); + + if (tableCell->hasSortKey()) + return QString::fromUtf8(tableCell->sortKey().c_str()); + else + return text(column).trimmed(); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.52.0/src/YQTable.h new/libyui-qt-2.52.1/src/YQTable.h --- old/libyui-qt-2.52.0/src/YQTable.h 2019-12-10 17:07:37.000000000 +0100 +++ new/libyui-qt-2.52.1/src/YQTable.h 2019-12-20 13:54:01.000000000 +0100 @@ -195,7 +195,7 @@ /** * Visual representation of a YTableItem. **/ -class YQTableListViewItem: public QY2ListViewItem +class YQTableListViewItem : public QY2ListViewItem { public: @@ -221,6 +221,11 @@ **/ void updateCell( const YTableCell * cell ); + /** + * The text of the table cell or the sort-key if available. + **/ + virtual QString smartSortKey(int column) const override; + protected: YQTable * _table;
