Git commit b4b59198a3b991df198a294f7abb1e2f6d945e56 by Mat?j Laitl. Committed on 24/10/2011 at 22:39. Pushed by laitl into branch 'master'.
Add keyboard shortcut for collection search: Ctrl+F Also change name of the "Jump to" action to "Search playlist" and rename appropriate methods. Both actions now ensure that relevant dock and widget gets shown upon firing the shortcut. Patch by Silver Juurik <silverjuurik at gmail.com> REVIEW: 102956 FEATURE: 257381 GUI: "Jump to" keyboard shortcut renamed to "Search playlist" FIXED-IN: 2.5 M +2 -0 ChangeLog M +19 -6 src/MainWindow.cpp M +2 -1 src/MainWindow.h M +6 -0 src/browsers/collectionbrowser/CollectionWidget.cpp M +1 -0 src/browsers/collectionbrowser/CollectionWidget.h http://commits.kde.org/amarok/b4b59198a3b991df198a294f7abb1e2f6d945e56 diff --git a/ChangeLog b/ChangeLog index 970b546..821a93d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ Amarok ChangeLog Version 2.5.0-Beta 1 FEATURES: + * Ctrl+F now activates collection browser and focuses the seach collection + bar. (BR 257381) * Music store based on the Amazon catalogue * Podcast subscription synchronisation and podcast status synchronisation with Gpodder service. diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 2d2ebac..ea99659 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -585,13 +585,21 @@ MainWindow::slotAddStream() //SLOT } void -MainWindow::slotJumpTo() // slot +MainWindow::slotFocusPlaylistSearch() { - DEBUG_BLOCK - + showDock( AmarokDockPlaylist ); // ensure that the dock is visible if tabbed m_playlistDock.data()->searchWidget()->focusInputLine(); } +void +MainWindow::slotFocusCollectionSearch() +{ + // ensure collection browser is activated within navigation dock: + browserDock()->list()->navigate( QString("collections") ); + showDock( AmarokDockNavigation ); // ensure that the dock is visible if tabbed + m_collectionBrowser->focusInputLine(); +} + #ifdef DEBUG_BUILD_TYPE void MainWindow::showNetworkRequestViewer() //SLOT @@ -827,10 +835,15 @@ MainWindow::createActions() action->setShortcut( KShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_F ) ); connect( action, SIGNAL( triggered() ), SLOT( slotFullScreen() ) ); - action = new KAction( i18n( "Jump to" ), this ); - ac->addAction( "jumpTo", action ); + action = new KAction( i18n( "Search playlist" ), this ); + ac->addAction( "searchPlaylist", action ); action->setShortcut( KShortcut( Qt::CTRL + Qt::Key_J ) ); - connect( action, SIGNAL( triggered() ), SLOT( slotJumpTo() ) ); + connect( action, SIGNAL( triggered() ), SLOT( slotFocusPlaylistSearch()) ); + + action = new KAction( i18n( "Search collection" ), this ); + ac->addAction( "searchCollection", action ); + action->setShortcut( KShortcut( Qt::CTRL + Qt::Key_F ) ); + connect( action, SIGNAL( triggered() ), SLOT( slotFocusCollectionSearch()) ); action = new KAction( KIcon( "music-amarok" ), i18n("Show active track"), this ); ac->addAction( "show_active_track", action ); diff --git a/src/MainWindow.h b/src/MainWindow.h index 076628f..984aa28 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -143,7 +143,8 @@ class AMAROK_EXPORT MainWindow : public KMainWindow void slotPlayMedia(); void slotAddLocation( bool directPlay = false ); void slotAddStream(); - void slotJumpTo(); + void slotFocusPlaylistSearch(); + void slotFocusCollectionSearch(); #ifdef DEBUG_BUILD_TYPE void showNetworkRequestViewer(); #endif // DEBUG_BUILD_TYPE diff --git a/src/browsers/collectionbrowser/CollectionWidget.cpp b/src/browsers/collectionbrowser/CollectionWidget.cpp index ace058a..a2c3ead 100644 --- a/src/browsers/collectionbrowser/CollectionWidget.cpp +++ b/src/browsers/collectionbrowser/CollectionWidget.cpp @@ -305,6 +305,12 @@ CollectionWidget::~CollectionWidget() void +CollectionWidget::focusInputLine() +{ + return d->searchWidget->comboBox()->setFocus(); +} + +void CollectionWidget::sortLevelSelected( QAction *action ) { Q_UNUSED( action ); diff --git a/src/browsers/collectionbrowser/CollectionWidget.h b/src/browsers/collectionbrowser/CollectionWidget.h index a206914..d62404f 100644 --- a/src/browsers/collectionbrowser/CollectionWidget.h +++ b/src/browsers/collectionbrowser/CollectionWidget.h @@ -54,6 +54,7 @@ class CollectionWidget : public BrowserCategory /** Set the current views selected levels */ void setLevels( const QList<int> &levels ); + void focusInputLine(); public slots: void sortLevelSelected( QAction * ); void sortByArtistAlbum();