| Summary: | Copy with Ctrl+C doesn't copy marked text but current track with artist info | ||
|---|---|---|---|
| Product: | [Applications] amarok | Reporter: | Christoph Burgmer <chrislb> |
| Component: | general | Assignee: | Amarok Bugs <amarok-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | wishlist | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Other | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Christoph Burgmer
2006-12-10 17:48:32 UTC
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 */
|