Commit d1df75e0 authored by Scott Wheeler's avatar Scott Wheeler

Make it so that you can't reload playlists which aren't associated with an

m3u file, added the reload action to the ui.rc  and fixed a memory leak.

svn path=/trunk/kdemultimedia/juk/; revision=235999
parent b53c4d2f
......@@ -701,6 +701,7 @@ void JuK::slotPlaylistChanged()
actionCollection()->action("file_save")->setEnabled(false);
actionCollection()->action("file_save_as")->setEnabled(false);
actionCollection()->action("renamePlaylist")->setEnabled(false);
actionCollection()->action("reloadPlaylist")->setEnabled(false);
actionCollection()->action("deleteItemPlaylist")->setEnabled(false);
}
else {
......@@ -708,6 +709,11 @@ void JuK::slotPlaylistChanged()
actionCollection()->action("file_save_as")->setEnabled(true);
actionCollection()->action("renamePlaylist")->setEnabled(true);
actionCollection()->action("deleteItemPlaylist")->setEnabled(true);
if(m_splitter->fileBasedListSelected() || m_splitter->dynamicListSelected())
actionCollection()->action("reloadPlaylist")->setEnabled(true);
else
actionCollection()->action("reloadPlaylist")->setEnabled(false);
}
if(m_splitter->hasListSelected())
actionCollection()->action("duplicatePlaylist")->setEnabled(true);
......
......@@ -10,6 +10,7 @@
<Action name="renamePlaylist"/>
<Action name="duplicatePlaylist"/>
<Action name="reloadPlaylist"/>
<Action name="deleteItemPlaylist"/>
<Separator/>
......
......@@ -689,7 +689,9 @@ void PlaylistSplitter::slotChangePlaylist(const PlaylistList &l)
if(l.count() == 1) {
m_playlistStack->raiseWidget(l.first());
m_editor->slotSetItems(playlistSelection());
m_dynamicList = 0;
if(m_dynamicList != l.first())
m_dynamicList = 0;
if(m_searchWidget) {
m_searchWidget->setSearch(l.first()->search());
......
......@@ -130,6 +130,16 @@ public:
*/
bool collectionListSelected() const { return visiblePlaylist() == m_collection; }
/**
* Returns true if the selected list has a file associated with it.
*/
bool fileBasedListSelected() { return !visiblePlaylist()->fileName().isNull(); }
/**
* Returns true if the currently selected playlist is a dynamic list.
*/
bool dynamicListSelected() { return m_dynamicList && visiblePlaylist() == m_dynamicList; }
bool hasListSelected() const { return m_playlistBox->hasSelection(); }
/**
......
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