Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 913b4130 authored by Scott Wheeler's avatar Scott Wheeler

Make it possible to turn the history on and off -- defaulting to off.

svn path=/trunk/kdemultimedia/juk/; revision=241969
parent 4a1c1c65
...@@ -341,6 +341,8 @@ void JuK::setupActions() ...@@ -341,6 +341,8 @@ void JuK::setupActions()
0, actionCollection(), "showSearch"); 0, actionCollection(), "showSearch");
m_showEditorAction = new KToggleAction(i18n("Show &Tag Editor"), "edit", m_showEditorAction = new KToggleAction(i18n("Show &Tag Editor"), "edit",
0, actionCollection(), "showEditor"); 0, actionCollection(), "showEditor");
m_showHistoryAction = new KToggleAction(i18n("Show &History Editor"), "history",
0, actionCollection(), "showHistory");
createSplitterAction(i18n("Refresh Items"), SLOT(slotRefresh()), "refresh", "reload"); createSplitterAction(i18n("Refresh Items"), SLOT(slotRefresh()), "refresh", "reload");
...@@ -464,6 +466,8 @@ void JuK::setupSplitterConnections() ...@@ -464,6 +466,8 @@ void JuK::setupSplitterConnections()
m_splitter, SLOT(slotSetSearchVisible(bool))); m_splitter, SLOT(slotSetSearchVisible(bool)));
connect(m_showEditorAction, SIGNAL(toggled(bool)), connect(m_showEditorAction, SIGNAL(toggled(bool)),
m_splitter, SLOT(slotSetEditorVisible(bool))); m_splitter, SLOT(slotSetEditorVisible(bool)));
connect(m_showHistoryAction, SIGNAL(toggled(bool)),
m_splitter, SLOT(slotSetHistoryVisible(bool)));
connect(this, SIGNAL(dockWindowPositionChanged(QDockWindow *)), connect(this, SIGNAL(dockWindowPositionChanged(QDockWindow *)),
m_sliderAction, SLOT(slotUpdateOrientation(QDockWindow *))); m_sliderAction, SLOT(slotUpdateOrientation(QDockWindow *)));
connect(m_splitter, SIGNAL(signalPlaylistChanged()), connect(m_splitter, SIGNAL(signalPlaylistChanged()),
...@@ -611,6 +615,10 @@ void JuK::readConfig() ...@@ -611,6 +615,10 @@ void JuK::readConfig()
bool showEditor = config->readBoolEntry("ShowEditor", false); bool showEditor = config->readBoolEntry("ShowEditor", false);
m_showEditorAction->setChecked(showEditor); m_showEditorAction->setChecked(showEditor);
m_splitter->slotSetEditorVisible(showEditor); m_splitter->slotSetEditorVisible(showEditor);
bool showHistory = config->readBoolEntry("ShowHistory", false);
m_showHistoryAction->setChecked(showHistory);
m_splitter->slotSetHistoryVisible(showHistory);
} }
{ // general settings { // general settings
KConfigGroupSaver saver(config, "Settings"); KConfigGroupSaver saver(config, "Settings");
...@@ -648,6 +656,7 @@ void JuK::saveConfig() ...@@ -648,6 +656,7 @@ void JuK::saveConfig()
config->writeEntry("ShowEditor", m_showEditorAction->isChecked()); config->writeEntry("ShowEditor", m_showEditorAction->isChecked());
config->writeEntry("ShowSearch", m_showSearchAction->isChecked()); config->writeEntry("ShowSearch", m_showSearchAction->isChecked());
config->writeEntry("ShowHistory", m_showHistoryAction->isChecked());
} }
{ // general settings { // general settings
KConfigGroupSaver saver(config, "Settings"); KConfigGroupSaver saver(config, "Settings");
......
...@@ -188,6 +188,7 @@ private: ...@@ -188,6 +188,7 @@ private:
// actions // actions
KToggleAction *m_showSearchAction; KToggleAction *m_showSearchAction;
KToggleAction *m_showEditorAction; KToggleAction *m_showEditorAction;
KToggleAction *m_showHistoryAction;
SliderAction *m_sliderAction; SliderAction *m_sliderAction;
KToggleAction *m_randomPlayAction; KToggleAction *m_randomPlayAction;
KToggleAction *m_toggleSystemTrayAction; KToggleAction *m_toggleSystemTrayAction;
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<Menu name="view" noMerge="1"><text>&amp;View</text> <Menu name="view" noMerge="1"><text>&amp;View</text>
<Action name="showSearch"/> <Action name="showSearch"/>
<Action name="showEditor"/> <Action name="showEditor"/>
<Action name="showHistory"/>
<Action name="showColumns"/> <Action name="showColumns"/>
<Separator/> <Separator/>
......
...@@ -823,8 +823,8 @@ void Playlist::polish() ...@@ -823,8 +823,8 @@ void Playlist::polish()
// hide some columns by default // hide some columns by default
////////////////////////////////////////////////// //////////////////////////////////////////////////
hideColumn(PlaylistItem::CommentColumn); hideColumn(PlaylistItem::CommentColumn + columnOffset());
hideColumn(PlaylistItem::FileNameColumn); hideColumn(PlaylistItem::FileNameColumn + columnOffset());
connect(this, SIGNAL(selectionChanged()), connect(this, SIGNAL(selectionChanged()),
this, SLOT(slotEmitSelected())); this, SLOT(slotEmitSelected()));
......
...@@ -276,7 +276,20 @@ void PlaylistBox::duplicate(Item *item) ...@@ -276,7 +276,20 @@ void PlaylistBox::duplicate(Item *item)
} }
} }
void PlaylistBox::deleteItems(const ItemList &items) void PlaylistBox::deleteItem(Playlist *playlist)
{
Item *i = m_playlistDict.find(playlist);
if(!i)
return;
ItemList l;
l.append(i);
deleteItems(l, false);
}
void PlaylistBox::deleteItems(const ItemList &items, bool confirm)
{ {
if(items.isEmpty()) if(items.isEmpty())
return; return;
...@@ -288,29 +301,31 @@ void PlaylistBox::deleteItems(const ItemList &items) ...@@ -288,29 +301,31 @@ void PlaylistBox::deleteItems(const ItemList &items)
files.append((*it)->playlist()->fileName()); files.append((*it)->playlist()->fileName());
} }
if(!files.isEmpty()) { if(confirm) {
int remove = KMessageBox::warningYesNoCancelList( if(!files.isEmpty()) {
this, i18n("Do you want to delete these files from the disk as well?"), files); int remove = KMessageBox::warningYesNoCancelList(
this, i18n("Do you want to delete these files from the disk as well?"), files);
if(remove == KMessageBox::Yes) { if(remove == KMessageBox::Yes) {
QStringList couldNotDelete; QStringList couldNotDelete;
for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) {
if(!QFile::remove(*it)) if(!QFile::remove(*it))
couldNotDelete.append(*it); couldNotDelete.append(*it);
}
// Would be nice if there were a KMessageBox::sorryList() to use with
// couldNotDelete.
if(!couldNotDelete.isEmpty())
KMessageBox::sorry(this, i18n("Could not delete all of the specified files."));
} }
else if(remove == KMessageBox::Cancel)
// Would be nice if there were a KMessageBox::sorryList() to use with return;
// couldNotDelete. }
else {
if(!couldNotDelete.isEmpty()) if(KMessageBox::warningYesNo(this, i18n("Are you sure you want to remove these items?")) == KMessageBox::No)
KMessageBox::sorry(this, i18n("Could not delete all of the specified files.")); return;
} }
else if(remove == KMessageBox::Cancel)
return;
}
else {
if(KMessageBox::warningYesNo(this, i18n("Are you sure you want to remove these items?")) == KMessageBox::No)
return;
} }
QValueList< QPair<Item *, Playlist *> > removeQueue; QValueList< QPair<Item *, Playlist *> > removeQueue;
......
...@@ -67,6 +67,11 @@ public: ...@@ -67,6 +67,11 @@ public:
void saveAs(); void saveAs();
void rename(); void rename();
void duplicate(); void duplicate();
/**
* Delete the item associated with \a playlist.
*/
void deleteItem(Playlist *playlist);
void deleteItems() { deleteItems(selectedItems()); } void deleteItems() { deleteItems(selectedItems()); }
bool hasSelection() const { return m_hasSelection; } bool hasSelection() const { return m_hasSelection; }
...@@ -99,7 +104,7 @@ private: ...@@ -99,7 +104,7 @@ private:
void saveAs(Item *item); void saveAs(Item *item);
void rename(Item *item); void rename(Item *item);
void duplicate(Item *item); void duplicate(Item *item);
void deleteItems(const QValueList<Item *> &items); void deleteItems(const QValueList<Item *> &items, bool confirm = true);
virtual void decode(QMimeSource *s, Item *item); virtual void decode(QMimeSource *s, Item *item);
virtual void contentsDropEvent(QDropEvent *e); virtual void contentsDropEvent(QDropEvent *e);
......
...@@ -51,8 +51,8 @@ void processEvents() ...@@ -51,8 +51,8 @@ void processEvents()
PlaylistSplitter::PlaylistSplitter(QWidget *parent, const char *name) : PlaylistSplitter::PlaylistSplitter(QWidget *parent, const char *name) :
QSplitter(Qt::Horizontal, parent, name), QSplitter(Qt::Horizontal, parent, name),
m_playingItem(0), m_searchWidget(0), m_dynamicList(0), m_playingItem(0), m_searchWidget(0), m_history(0),
m_nextPlaylistItem(0) m_dynamicList(0), m_nextPlaylistItem(0)
{ {
#ifndef NO_DEBUG #ifndef NO_DEBUG
m_restore = KCmdLineArgs::parsedArgs()->isSet("restore"); m_restore = KCmdLineArgs::parsedArgs()->isSet("restore");
...@@ -402,6 +402,20 @@ void PlaylistSplitter::slotSetSearchVisible(bool visible) ...@@ -402,6 +402,20 @@ void PlaylistSplitter::slotSetSearchVisible(bool visible)
redisplaySearch(); redisplaySearch();
} }
void PlaylistSplitter::slotSetHistoryVisible(bool visible)
{
if(visible && !m_history) {
m_history = new HistoryPlaylist(m_playlistStack);
setupPlaylist(m_history, false, "history", true);
return;
}
if(!visible && m_history) {
m_playlistBox->deleteItem(m_history);
m_history = 0;
}
}
void PlaylistSplitter::slotAdvancedSearch() void PlaylistSplitter::slotAdvancedSearch()
{ {
AdvancedSearchDialog *d = AdvancedSearchDialog *d =
...@@ -476,9 +490,6 @@ void PlaylistSplitter::setupLayout() ...@@ -476,9 +490,6 @@ void PlaylistSplitter::setupLayout()
setupPlaylist(m_collection, true, "folder_sound", true); setupPlaylist(m_collection, true, "folder_sound", true);
connect(m_collection, SIGNAL(signalCollectionChanged()), m_editor, SLOT(slotUpdateCollection())); connect(m_collection, SIGNAL(signalCollectionChanged()), m_editor, SLOT(slotUpdateCollection()));
m_history = new HistoryPlaylist(m_playlistStack);
setupPlaylist(m_history, false, "history", true);
// Create the search widget -- this must be done after the CollectionList is created. // Create the search widget -- this must be done after the CollectionList is created.
m_searchWidget = new SearchWidget(editorSplitter, "searchWidget"); m_searchWidget = new SearchWidget(editorSplitter, "searchWidget");
editorSplitter->moveToFirst(m_searchWidget); editorSplitter->moveToFirst(m_searchWidget);
......
...@@ -242,7 +242,7 @@ public slots: ...@@ -242,7 +242,7 @@ public slots:
void slotSetEditorVisible(bool visible) { m_editor->setShown(visible); } void slotSetEditorVisible(bool visible) { m_editor->setShown(visible); }
void slotSetSearchVisible(bool visible); void slotSetSearchVisible(bool visible);
void slotSetHistoryVisible(bool visible);
void slotAdvancedSearch(); void slotAdvancedSearch();
/** /**
......
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