Commit 9485eacb authored by Kacper Kasper's avatar Kacper Kasper

Enable context menu.

parent a0759bab
...@@ -1332,9 +1332,9 @@ void Playlist::takeItem(QTreeWidgetItem *item) ...@@ -1332,9 +1332,9 @@ void Playlist::takeItem(QTreeWidgetItem *item)
{ {
// See the warning in Playlist::insertItem. // See the warning in Playlist::insertItem.
// FIXME m_subtractTime.append(static_cast<PlaylistItem *>(item));
/*m_subtractTime.append(static_cast<PlaylistItem *>(item)); int index = indexOfTopLevelItem(item);
QTreeWidget::takeItem(item);*/ delete takeTopLevelItem(index);
} }
void Playlist::addColumn(const QString &label, int) void Playlist::addColumn(const QString &label, int)
...@@ -1586,9 +1586,9 @@ void Playlist::slotInitialize() ...@@ -1586,9 +1586,9 @@ void Playlist::slotInitialize()
connect(m_headerMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotToggleColumnVisible(QAction*))); connect(m_headerMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotToggleColumnVisible(QAction*)));
// FIXME // FIXME
/* connect(this, SIGNAL(contextMenuRequested(QTreeWidgetItem*,QPoint,int)), connect(this, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(slotShowRMBMenu(QTreeWidgetItem*,QPoint,int))); this, SLOT(slotShowRMBMenu(QPoint)));
connect(this, SIGNAL(itemRenamed(QTreeWidgetItem*,QString,int)), /*connect(this, SIGNAL(itemRenamed(QTreeWidgetItem*,QString,int)),
this, SLOT(slotInlineEditDone(QTreeWidgetItem*,QString,int)));*/ this, SLOT(slotInlineEditDone(QTreeWidgetItem*,QString,int)));*/
connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
this, SLOT(slotPlayCurrent())); this, SLOT(slotPlayCurrent()));
...@@ -1706,6 +1706,7 @@ void Playlist::setup() ...@@ -1706,6 +1706,7 @@ void Playlist::setup()
// FIXME // FIXME
//setItemMargin(3); //setItemMargin(3);
setRootIsDecorated(false); setRootIsDecorated(false);
setContextMenuPolicy(Qt::CustomContextMenu);
connect(header(), SIGNAL(sectionMoved(int,int,int)), this, SLOT(slotColumnOrderChanged(int,int,int))); connect(header(), SIGNAL(sectionMoved(int,int,int)), this, SLOT(slotColumnOrderChanged(int,int,int)));
...@@ -2125,8 +2126,10 @@ void Playlist::slotAddToUpcoming() ...@@ -2125,8 +2126,10 @@ void Playlist::slotAddToUpcoming()
m_collection->upcomingPlaylist()->appendItems(selectedItems()); m_collection->upcomingPlaylist()->appendItems(selectedItems());
} }
void Playlist::slotShowRMBMenu(QTreeWidgetItem *item, const QPoint &point, int column) void Playlist::slotShowRMBMenu(const QPoint &point)
{ {
QTreeWidgetItem *item = itemAt(point);
int column = currentColumn(); // FIXME?
if(!item) if(!item)
return; return;
...@@ -2136,7 +2139,7 @@ void Playlist::slotShowRMBMenu(QTreeWidgetItem *item, const QPoint &point, int c ...@@ -2136,7 +2139,7 @@ void Playlist::slotShowRMBMenu(QTreeWidgetItem *item, const QPoint &point, int c
// Probably more of these actions should be ported over to using KActions. // Probably more of these actions should be ported over to using KActions.
m_rmbMenu = new KMenu(this); m_rmbMenu = new QMenu(this);
m_rmbMenu->addAction(SmallIcon("go-jump-today"), m_rmbMenu->addAction(SmallIcon("go-jump-today"),
i18n("Add to Play Queue"), this, SLOT(slotAddToUpcoming())); i18n("Add to Play Queue"), this, SLOT(slotAddToUpcoming()));
...@@ -2205,7 +2208,7 @@ void Playlist::slotShowRMBMenu(QTreeWidgetItem *item, const QPoint &point, int c ...@@ -2205,7 +2208,7 @@ void Playlist::slotShowRMBMenu(QTreeWidgetItem *item, const QPoint &point, int c
action("viewCover")->setEnabled(file.coverInfo()->hasCover()); action("viewCover")->setEnabled(file.coverInfo()->hasCover());
action("removeCover")->setEnabled(file.coverInfo()->coverId() != CoverManager::NoMatch); action("removeCover")->setEnabled(file.coverInfo()->coverId() != CoverManager::NoMatch);
m_rmbMenu->popup(point); m_rmbMenu->popup(window()->mapToGlobal(mapToGlobal(point)));
m_currentColumn = column + columnOffset(); m_currentColumn = column + columnOffset();
} }
......
...@@ -592,7 +592,7 @@ private slots: ...@@ -592,7 +592,7 @@ private slots:
* Show the RMB menu. Matches the signature for the signal * Show the RMB menu. Matches the signature for the signal
* QListView::contextMenuRequested(). * QListView::contextMenuRequested().
*/ */
void slotShowRMBMenu(QTreeWidgetItem *item, const QPoint &point, int column); void slotShowRMBMenu(const QPoint &point);
/** /**
* This slot is called when the inline tag editor has completed its editing * This slot is called when the inline tag editor has completed its editing
...@@ -702,7 +702,7 @@ private: ...@@ -702,7 +702,7 @@ private:
QString m_fileName; QString m_fileName;
QStringList m_columns; QStringList m_columns;
KMenu *m_rmbMenu; QMenu *m_rmbMenu;
QMenu *m_headerMenu; QMenu *m_headerMenu;
KActionMenu *m_columnVisibleAction; KActionMenu *m_columnVisibleAction;
PlaylistToolTip *m_toolTip; PlaylistToolTip *m_toolTip;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment