From a27ca79cf32eed11eb0273f8a0e76f596f7236f2 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Fri, 2 Jan 2015 23:18:27 +0100 Subject: [PATCH] Improve Audio handling Say "Play Sound" instead of "Follow this link" Only offer to stop sound when there's one playing Inspired by https://git.reviewboard.kde.org/r/120683 by Nidhi Jain --- ui/pageview.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/pageview.cpp b/ui/pageview.cpp index 9fe128eea..2dd8cf1c6 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -2430,8 +2430,12 @@ void PageView::mouseReleaseEvent( QMouseEvent * e ) KMenu menu( this ); QAction * actProcessLink = menu.addAction( i18n( "Follow This Link" ) ); QAction * actStopSound = 0; - if ( link->actionType() == Okular::Action::Sound ) - actStopSound = menu.addAction( i18n( "Stop Sound" ) ); + if ( link->actionType() == Okular::Action::Sound ) { + actProcessLink->setText( i18n( "Play this Sound" ) ); + if ( Okular::AudioPlayer::instance()->state() == Okular::AudioPlayer::PlayingState ) { + actStopSound = menu.addAction( i18n( "Stop Sound" ) ); + } + } QAction * actCopyLinkLocation = 0; if ( dynamic_cast< const Okular::BrowseAction * >( link ) ) actCopyLinkLocation = menu.addAction( KIcon( "edit-copy" ), i18n( "Copy Link Address" ) );