Summary: | Implement support to bookmark folders | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Oleg Atamanenko <oleg.atamanenko+kde> |
Component: | Tools/Bookmark Manager | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | nhn |
Priority: | NOR | ||
Version: | 2.3.0 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 2.3.1 |
Description
Oleg Atamanenko
2010-03-20 17:35:42 UTC
You are talking about bookmarks in the file browser? Yes, I'm talking about bookmarks in file browser. Actually, when I click on 'bookmark media sources view' in File browser amarok creates bookmark but url is strange: amarok://navigate/files, so actual path is not saved and this feature is unuseful. Some progress: git master as of now has Places support in the file browser. commit 2cfbcaed74346500f6e5c9dd901b9f8c41f722c7 Author: Nikolaj Hald Nielsen <nhn@kde.org> Date: Sun Mar 21 14:07:29 2010 +0100 Make bookmarking the file browser also store the patch it is showing. Also fix the name of the bookmarks to be "files" instead of just "/" BUG: 231437 diff --git a/src/amarokurls/NavigationUrlGenerator.cpp b/src/amarokurls/NavigationUrlGenerator.cpp index e38a947..39f1a92 100644 --- a/src/amarokurls/NavigationUrlGenerator.cpp +++ b/src/amarokurls/NavigationUrlGenerator.cpp @@ -25,6 +25,7 @@ #include "browsers/CollectionTreeItemModelBase.h" #include "browsers/collectionbrowser/CollectionWidget.h" #include "browsers/playlistbrowser/PlaylistBrowser.h" +#include "browsers/filebrowser/FileBrowser.h" #include "collection/sqlcollection/SqlMeta.h" #include "PlaylistManager.h" @@ -120,9 +121,23 @@ AmarokUrl NavigationUrlGenerator::CreateAmarokUrl() url.appendArg( "show_years", "false" ); } - //come up with a default name for this url.. QString name = The::mainWindow()->browserWidget()->list()->activeCategoryRecursive()->prettyName(); + + //if in the file browser, also store the file path + if( url.path().endsWith( "files", Qt::CaseInsensitive ) ) + { + + //Give a proper name since it will return "/" as that is what is used in the breadcrumb. + name = i18n( "Files" ); + + FileBrowser * fileBrowser = dynamic_cast<FileBrowser *>( The::mainWindow()->browserWidget()->list()->activeCategory() ); + if( fileBrowser ) + { + url.appendArg( "path", fileBrowser->currentDir() ); + } + } + url.setName( name ); return url; diff --git a/src/amarokurls/NavigationUrlRunner.cpp b/src/amarokurls/NavigationUrlRunner.cpp index cff35b6..169a749 100644 --- a/src/amarokurls/NavigationUrlRunner.cpp +++ b/src/amarokurls/NavigationUrlRunner.cpp @@ -25,6 +25,7 @@ #include "PlaylistManager.h" #include "browsers/CollectionTreeItemModelBase.h" #include "browsers/collectionbrowser/CollectionWidget.h" +#include "browsers/filebrowser/FileBrowser.h" #include "browsers/playlistbrowser/PlaylistBrowser.h" #include "browsers/servicebrowser/ServiceBrowser.h" #include "services/ServiceBase.h" @@ -78,7 +79,7 @@ NavigationUrlRunner::run( AmarokUrl url ) //if we are activating the local collection, check if we need to restore "show cover" and "show year" - //if in the local collection view, also store "show covers" and "show years" + //if in the local collection view, also store "show covers" and "show years" if( url.path().endsWith( "collections", Qt::CaseInsensitive ) ) { if ( args.keys().contains( "show_cover" ) ) @@ -98,6 +99,19 @@ NavigationUrlRunner::run( AmarokUrl url ) } } + //also set the correct path if we are navigating to the file browser + if( url.path().endsWith( "files", Qt::CaseInsensitive ) ) + { + FileBrowser * fileBrowser = dynamic_cast<FileBrowser *>( The::mainWindow()->browserWidget()->list()->activeCategory() ); + if( fileBrowser ) + { + if( args.keys().contains( "path" ) ) + { + fileBrowser->setDir( args.value( "path" ) ); + } + } + } + if ( args.keys().contains( "filter" ) ) active->setFilter( args.value( "filter" ) ); diff --git a/src/browsers/filebrowser/FileBrowser.cpp b/src/browsers/filebrowser/FileBrowser.cpp index 8bf2e15..bf93554 100644 --- a/src/browsers/filebrowser/FileBrowser.cpp +++ b/src/browsers/filebrowser/FileBrowser.cpp @@ -134,6 +134,15 @@ FileBrowser::polish() setupAddItems(); } +QString +FileBrowser::currentDir() +{ + if( m_showingPlaces ) + return "places:"; + else + return m_currentPath; +} + void FileBrowser::itemActivated( const QModelIndex &index ) { @@ -359,8 +368,11 @@ FileBrowser::prettyName() const void FileBrowser::setDir( const QString &dir ) { - //This function just happens to do exactly what we need - addItemActivated( dir ); + + if( dir == "places:" ) + showPlaces(); + else + addItemActivated( dir ); //This function just happens to do exactly what we need } void diff --git a/src/browsers/filebrowser/FileBrowser.h b/src/browsers/filebrowser/FileBrowser.h index 6326bf9..1f7950c 100644 --- a/src/browsers/filebrowser/FileBrowser.h +++ b/src/browsers/filebrowser/FileBrowser.h @@ -45,6 +45,11 @@ public: */ void setDir( const QString &dir ); + /** + * Return the path of the currently shown dir. + */ + QString currentDir(); + protected slots: void itemActivated( const QModelIndex &index ); |