Commit a51b780a authored by Michael Pyne's avatar Michael Pyne

Forgot to commit these files, needed to fix bug 89324.

CCMAIL:89324@bugs.kde.org

svn path=/trunk/kdemultimedia/juk/; revision=346644
parent d9447994
......@@ -252,7 +252,8 @@ void CompactViewMode::updateHeights()
// TreeViewMode
////////////////////////////////////////////////////////////////////////////////
TreeViewMode::TreeViewMode(PlaylistBox *b) : CompactViewMode(b), m_treeViewItems(5003, false)
TreeViewMode::TreeViewMode(PlaylistBox *b) : CompactViewMode(b),
m_treeViewItems(5003, false), m_canDeletePlaylists(true)
{
}
......@@ -305,6 +306,12 @@ void TreeViewMode::slotRemoveItem(const QString &item, unsigned column)
return;
TreeViewItemPlaylist *itemPlaylist = m_treeViewItems[itemKey];
if(!m_canDeletePlaylists) {
m_pendingItemsToRemove << itemKey;
return;
}
m_treeViewItems.remove(itemKey);
itemPlaylist->deleteLater();
emit signalPlaylistDestroyed(itemPlaylist);
......@@ -358,6 +365,25 @@ void TreeViewMode::slotAddItems(const QStringList &items, unsigned column)
}
}
void TreeViewMode::slotCanDeletePlaylist(bool canDelete)
{
m_canDeletePlaylists = canDelete;
if(!canDelete)
return;
QStringList categories;
categories << "artists" << "albums" << "genres";
for(QStringList::ConstIterator it = m_pendingItemsToRemove.begin(); it != m_pendingItemsToRemove.end(); ++it) {
m_treeViewItems[*it]->deleteLater();
emit signalPlaylistDestroyed(m_treeViewItems[*it]);
m_treeViewItems.remove(*it);
}
m_pendingItemsToRemove.clear();
}
void TreeViewMode::setupCategories()
{
PlaylistBox::Item *i;
......
......@@ -108,12 +108,16 @@ public slots:
void slotRemoveItem(const QString &item, unsigned column);
void slotAddItems(const QStringList &items, unsigned column);
void slotCanDeletePlaylist(bool canDelete);
signals:
void signalPlaylistDestroyed(Playlist*);
private:
QDict<PlaylistBox::Item> m_searchCategories;
QDict<TreeViewItemPlaylist> m_treeViewItems;
QStringList m_pendingItemsToRemove;
bool m_canDeletePlaylists;
};
#endif
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