Summary: | Missing conditions for smart playlists: "does not start with" and "does not end with" | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Elias Probst <mail> |
Component: | Playlists/Saved Playlists | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | 1.4.4 | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Elias Probst
2007-01-03 13:15:40 UTC
SVN commit 621290 by pndiku: BUG: 139552 * Add "does not start with" and "does not end with" conditions to the Smart Playlist editor[1]. * Add dropdown picker for Mount Points in Smart Playlist Editor. [1] I acknowledge that this may be overkill. :-) M +12 -0 playlistbrowseritem.cpp M +21 -4 smartplaylisteditor.cpp --- trunk/extragear/multimedia/amarok/src/playlistbrowseritem.cpp #621289:621290 @@ -3219,8 +3219,20 @@ filters[0].prepend( "./" ); qb.addFilter( table, value, filters[0], QueryBuilder::modeBeginMatch ); } + else if ( condition == i18n( "does not start with" ) ) + { + // need to take care of absolute paths + if ( field == "tags.url" ) + if ( filters[0].startsWith( "/" ) ) + filters[0].prepend( '.' ); + else if ( !filters[0].startsWith( "./" ) ) + filters[0].prepend( "./" ); + qb.excludeFilter( table, value, filters[0], QueryBuilder::modeBeginMatch ); + } else if ( condition == i18n( "ends with" ) ) qb.addFilter( table, value, filters[0], QueryBuilder::modeEndMatch ); + else if ( condition == i18n( "does not end with" ) ) + qb.excludeFilter( table, value, filters[0], QueryBuilder::modeEndMatch ); else if ( condition == i18n( "is greater than") || condition == i18n( "is after" ) ) qb.addNumericFilter( table, value, filters[0], QueryBuilder::modeGreater ); else if ( condition == i18n( "is smaller than") || condition == i18n( "is before" ) ) --- trunk/extragear/multimedia/amarok/src/smartplaylisteditor.cpp #621289:621290 @@ -10,6 +10,7 @@ #include "debug.h" #include "collectiondb.h" #include "metabundle.h" +#include "mountpointmanager.h" #include "smartplaylisteditor.h" #include <kcombobox.h> @@ -714,8 +715,21 @@ } searchCriteria += CollectionDB::likeCondition( value, false, true ); } + else if( criteria == i18n("does not start with") ) + { + if( field == "tags.url" ) + { + if( value.startsWith( "/" ) ) + value = '.' + value; + if( !value.startsWith( "./" ) ) + value = "./" + value; + } + searchCriteria += " NOT " + CollectionDB::likeCondition( value, false, true ); + } else if( criteria == i18n("ends with") ) searchCriteria += CollectionDB::likeCondition( value, true, false ); + else if( criteria == i18n("does not end with") ) + searchCriteria += " NOT " + CollectionDB::likeCondition( value, true, false ); else if( criteria == i18n("is greater than") || criteria == i18n("is after") ) searchCriteria += " > " + value; else if( criteria == i18n("is smaller than") || criteria == i18n("is before" ) ) @@ -768,8 +782,8 @@ loadEditWidgets(); m_currentValueType = valueType; - //enable auto-completion for artist, album and genre - if( valueType == AutoCompletionString ) { //Artist, Composer, Album, Genre + //enable auto-completion for artist, album, composer, label, mountpoint and genre + if( valueType == AutoCompletionString ) { QStringList items; m_comboBox->clear(); m_comboBox->completionObject()->clear(); @@ -783,6 +797,8 @@ items = CollectionDB::instance()->albumList(); else if (currentField == FLabel ) //label items = CollectionDB::instance()->labelList(); + else if (currentField == FMountPoint ) //mount point + items = MountPointManager::instance()->collectionFolders(); else //genre items = CollectionDB::instance()->genreList(); @@ -953,7 +969,8 @@ case String: case AutoCompletionString: items << i18n( "contains" ) << i18n( "does not contain" ) << i18n( "is" ) << i18n( "is not" ) - << i18n( "starts with" ) << i18n( "ends with" ); + << i18n( "starts with" ) << i18n( "does not start with" ) + << i18n( "ends with" ) << i18n( "does not end with" ); break; case Rating: @@ -992,12 +1009,12 @@ case FAlbum: case FGenre: case FLabel: + case FMountPoint: valueType = AutoCompletionString; break; case FTitle: case FComment: case FFilePath: - case FMountPoint: valueType = String; break; case FLength: Thank you for fixing it! Will this go into 1.4.5? I don't think it's overkill... I wouldn't have made a wish out of it, if I hadn't really needed it ;-) |