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