Summary: | pasting URLs with middle mousebutton | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Mark Kretschmann <kretschmann> |
Component: | general | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version First Reported In: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Mark Kretschmann
2004-02-12 00:43:30 UTC
CVS commit by markey: Added: pasting clipboard selection into playlist with MidButton, X11-style (BR #75028). CCMAIL: 75028-done@bugs.kde.org M +2 -0 TODO 1.226 M +19 -0 amarok/browserwin.cpp 1.79 M +3 -1 amarok/browserwin.h 1.37 M +2 -1 amarok/playlistwidget.cpp 1.122 --- kdeextragear-1/amarok/TODO #1.225:1.226 @@ -9,4 +9,6 @@ SHORT-TERM (URGENT): + * fix: OSD settings dialog duration option missing "ms" + * fix: #61 <markey> allow removing of playlist items by dragging back into browser. (RFC: is this still appropriate or would it be misleading?) --- kdeextragear-1/amarok/amarok/browserwin.cpp #1.78:1.79 @@ -31,8 +31,10 @@ #include <qtimer.h> //autoClose() +#include <kdebug.h> #include <kiconloader.h> //multiTabBar icons #include <kmultitabbar.h> //m_multiTabBar //BrowserWin includes +#include <qclipboard.h> //eventFilter(); #include <qcolor.h> //setPalettes() #include <qevent.h> //eventFilter() @@ -423,4 +425,6 @@ BrowserWin::BrowserWin( QWidget *parent, connect( m_playlist, SIGNAL( clicked( QListViewItem * ) ), m_sideBar, SLOT( autoClosePages() ) ); + connect( m_playlist, SIGNAL( mouseButtonPressed( int, QListViewItem*, const QPoint&, int ) ), + this, SLOT( playlistPaste( int, QListViewItem*, const QPoint&, int ) ) ); connect( m_lineEdit, SIGNAL( textChanged( const QString& ) ), m_playlist, SLOT( slotTextChanged( const QString& ) ) ); @@ -584,3 +588,18 @@ void BrowserWin::slotAddLocation() //SLO } + +void BrowserWin::playlistPaste( int button, QListViewItem*, const QPoint&, int ) //SLOT +{ + //catch X11-style paste with MidButton and try adding to playlist as new URL + if( button == Qt::MidButton ) + { + QString path = QApplication::clipboard()->text( QClipboard::Selection ); + kdDebug() << "[BrowserWin::playlistPaste] pasting into playlist: " << path << endl; + + //KURL::setPath() does not work here, so we cannot use insertMedia(const QString&) + insertMedia( KURL( path ) ); + } +} + + #include "browserwin.moc" --- kdeextragear-1/amarok/amarok/browserwin.h #1.36:1.37 @@ -112,4 +112,5 @@ class QFont; class QListViewItem; class QPalette; +class QPoint; class QPushButton; class QSplitter; @@ -140,4 +141,5 @@ class BrowserWin : public QWidget void savePlaylist() const; void slotAddLocation(); + void playlistPaste( int button, QListViewItem*, const QPoint&, int ); private: --- kdeextragear-1/amarok/amarok/playlistwidget.cpp #1.121:1.122 @@ -1010,5 +1010,6 @@ void PlaylistWidget::viewportPaintEvent( bool PlaylistWidget::eventFilter( QObject *o, QEvent *e ) { - if( o == header() && e->type() == QEvent::MouseButtonPress && static_cast<QMouseEvent *>(e)->button() == Qt::RightButton ) + if( o == header() && e->type() == QEvent::MouseButtonPress && + static_cast<QMouseEvent *>(e)->button() == Qt::RightButton ) { //currently the only use for this filter is to get mouse clicks on the header() |