[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [amarok] /: Handle numeric fields properly in filter creation dialogs
From:       Matěj_Laitl <matej () laitl ! cz>
Date:       2016-08-07 9:39:07
Message-ID: E1bWKXz-0005zK-0r () code ! kde ! org
[Download RAW message or body]

Git commit 6c49cfdfd97faa146ce7b0d8e95ce2bf596f2b0d by Matěj Laitl, on behalf of \
Stefano Pettini. Committed on 07/08/2016 at 09:34.
Pushed by laitl into branch 'master'.

Handle numeric fields properly in filter creation dialogs

Every numeric field, like length, disc number and track number, were
not properly parsed by the filter dialog or by the dynamic playlist
dialog into the textual query string used to then apply the filter.

The bug was due to what sounds like an "optimization" that swapped the
first and second value of a "between" condition, to make sure the
smaller value was always the first value and the larger always the
second. The problem was that this was applied also to non-between
conditions, actually swapping the lenth or disc number with 0, making
0 appear in the textual representation of the condition.

The fix makes sure that "optimization" is applied only in case of
actual "between" conditions, leaving the values "unoptimized" for any
other kind of condition (=, <, > and similar).

REVIEW: 128245
BUG: 341661

M  +2    -0    ChangeLog
M  +5    -1    src/widgets/MetaQueryWidget.cpp

http://commits.kde.org/amarok/6c49cfdfd97faa146ce7b0d8e95ce2bf596f2b0d

diff --git a/ChangeLog b/ChangeLog
index c036f8a..b5e55c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,8 @@ VERSION 2.9.0
      MySQL 5.7+ thanks to Terje Rosten, Stefano Pettini. (BR 354255)
 
   BUGFIXES:
+   * Fix integer fields, like length, always showing up as zero in filter creation
+     dialog; thanks to Stefano Pettini. (BR 341661)
 
 
 VERSION 2.8.90
diff --git a/src/widgets/MetaQueryWidget.cpp b/src/widgets/MetaQueryWidget.cpp
index abce6b7..40f15d6 100644
--- a/src/widgets/MetaQueryWidget.cpp
+++ b/src/widgets/MetaQueryWidget.cpp
@@ -1081,7 +1081,11 @@ QString MetaQueryWidget::Filter::toString( bool invert ) const
     }
     else if( isNumeric() )
     {
-        if (numValue < numValue2) // two values are only used for "between". We want \
to order them by size +        if ( condition != Between )
+        {
+            strValue1 = QString::number( numValue );
+        }
+        else if (numValue < numValue2) // two values are only used for "between". We \
want to order them by size  {
             strValue1 = QString::number( numValue );
             strValue2 = QString::number( numValue2 );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic