summaryrefslogtreecommitdiffstats
path: root/juk/treeviewitemplaylist.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch)
tree9047cf9e6b5c43878d5bf82660adae77ceee097a /juk/treeviewitemplaylist.cpp
downloadtdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz
tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'juk/treeviewitemplaylist.cpp')
-rw-r--r--juk/treeviewitemplaylist.cpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/juk/treeviewitemplaylist.cpp b/juk/treeviewitemplaylist.cpp
new file mode 100644
index 00000000..9096979a
--- /dev/null
+++ b/juk/treeviewitemplaylist.cpp
@@ -0,0 +1,93 @@
+/***************************************************************************
+ begin : Mon Jun 21 2004
+ copyright : (C) 2004 by Michael Pyne
+ email : michael.pyne@kdemail.net
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <kapplication.h>
+#include <kdebug.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+
+#include <qstringlist.h>
+#include <qlistview.h>
+
+#include "collectionlist.h"
+#include "treeviewitemplaylist.h"
+#include "tag.h"
+#include "playlistitem.h"
+#include "playlistsearch.h"
+#include "tagtransactionmanager.h"
+
+TreeViewItemPlaylist::TreeViewItemPlaylist(PlaylistCollection *collection,
+ const PlaylistSearch &search,
+ const QString &name) :
+ SearchPlaylist(collection, search, name, false)
+{
+ PlaylistSearch::Component component = *(search.components().begin());
+ m_columnType = static_cast<PlaylistItem::ColumnType>(*(component.columns().begin()));
+}
+
+void TreeViewItemPlaylist::retag(const QStringList &files, Playlist *)
+{
+ CollectionList *collection = CollectionList::instance();
+
+ if(files.isEmpty())
+ return;
+
+ QString changedTag = i18n("artist");
+ if(m_columnType == PlaylistItem::GenreColumn)
+ changedTag = i18n("genre");
+ else if(m_columnType == PlaylistItem::AlbumColumn)
+ changedTag = i18n("album");
+
+ if(KMessageBox::warningContinueCancelList(
+ this,
+ i18n("You are about to change the %1 on these files.").arg(changedTag),
+ files,
+ i18n("Changing Track Tags"),
+ KStdGuiItem::cont(),
+ "dragDropRetagWarn"
+ ) == KMessageBox::Cancel)
+ {
+ return;
+ }
+
+ QStringList::ConstIterator it;
+ for(it = files.begin(); it != files.end(); ++it) {
+ CollectionListItem *item = collection->lookup(*it);
+ if(!item)
+ continue;
+
+ Tag *tag = TagTransactionManager::duplicateTag(item->file().tag());
+ switch(m_columnType) {
+ case PlaylistItem::ArtistColumn:
+ tag->setArtist(name());
+ break;
+
+ case PlaylistItem::AlbumColumn:
+ tag->setAlbum(name());
+ break;
+
+ case PlaylistItem::GenreColumn:
+ tag->setGenre(name());
+ break;
+
+ default:
+ kdDebug() << "Unhandled column type editing " << *it << endl;
+ }
+
+ TagTransactionManager::instance()->changeTagOnItem(item, tag);
+ }
+}
+
+#include "treeviewitemplaylist.moc"