Version: (using KDE ) Installed from: KDE 3.5.5 OS: Search Pressing Ctrl+C normally copies the text you have marked with the mouse. In Amarok this feature worked till recently when it was changed to actually copy the current track name and artist information no matter which part of your main window is selected (focus). Neither lyrics, album name, wikipedia text nor any other text can now be copied to the clipboard through this key stroke. This is not a question of possibility but of useability, compare Bug 91445.
This is intended
SVN commit 617290 by aumuell: make copy/select all work in context browser's html views BUG: 138635 M +1 -0 ChangeLog M +40 -0 src/htmlview.cpp M +9 -0 src/htmlview.h --- trunk/extragear/multimedia/amarok/ChangeLog #617289:617290 @@ -87,6 +87,7 @@ * Amarok now saves playlists with relative paths by default. BUGFIXES: + * Select All/Copy action would not copy from context browser. (BR 138635) * Xine-engine: When a track was fading out (after pressing Stop), and you started another track, Amarok could become unresponsive. * Improved seeking with xine-engine. No longer jumps to 0 when you seek --- trunk/extragear/multimedia/amarok/src/htmlview.cpp #617289:617290 @@ -10,12 +10,15 @@ #include "htmlview.h" #include "playlist.h" //appendMedia() +#include <qclipboard.h> #include <qfile.h> // External CSS opening #include <qimage.h> // External CSS opening #include <kapplication.h> //kapp +#include <kactioncollection.h> #include <kglobal.h> //kapp #include <kimageeffect.h> // gradient background image +#include <kpopupmenu.h> #include <kstandarddirs.h> //locate file #include <ktempfile.h> @@ -33,6 +36,22 @@ setDNDEnabled( DNDEnabled ); setJScriptEnabled( JScriptEnabled ); + + KActionCollection* ac = actionCollection(); + ac->setAutoConnectShortcuts( true ); + m_copy = KStdAction::copy( this, SLOT( copyText() ), ac, "htmlview_copy" ); + m_selectAll = KStdAction::selectAll( this, SLOT( selectAll() ), ac, "htmlview_select_all" ); + { + KPopupMenu m; + m_copy->plug( &m ); + m_selectAll->plug( &m ); + + m_copy->unplug( &m ); + m_selectAll->unplug( &m ); + } + + connect( this, SIGNAL( selectionChanged() ), SLOT( enableCopyAction() ) ); + enableCopyAction(); } @@ -46,7 +65,28 @@ } } +void +HTMLView::enableCopyAction() +{ + m_copy->setEnabled( hasSelection() ); +} +void +HTMLView::selectAll() +{ + KHTMLPart::selectAll(); +} + +void +HTMLView::copyText() +{ + QString text = selectedText(); + + // Copy both to clipboard and X11-selection + QApplication::clipboard()->setText( text, QClipboard::Clipboard ); + QApplication::clipboard()->setText( text, QClipboard::Selection ); +} + void HTMLView::paletteChange() { delete m_bgGradientImage; delete m_headerGradientImage; --- trunk/extragear/multimedia/amarok/src/htmlview.h #617289:617290 @@ -10,6 +10,7 @@ #include <khtml_part.h> #include <khtmlview.h> +class KAction; class KTempFile; class HTMLView : public KHTMLPart @@ -30,6 +31,14 @@ static KTempFile *m_headerGradientImage; static KTempFile *m_shadowGradientImage; static int m_instances; + + KAction *m_selectAll; + KAction *m_copy; + + private slots: + void enableCopyAction(); + void selectAll(); + void copyText(); }; #endif /* AMAROK_HTMLVIEW_H */