Commit 0263a271 authored by Daniel Molkentin's avatar Daniel Molkentin

Patch based on the work of Matt Proud to allow inline renaming of multiple files.

CCMAIL:prou0045@d.umn.edu

svn path=/trunk/kdemultimedia/juk/; revision=211821
parent 0806bed8
......@@ -535,7 +535,7 @@ void Playlist::setup()
m_rmbMenu->insertSeparator();
m_rmbEditID = m_rmbMenu->insertItem(SmallIcon("edittool"), i18n("Edit"), this, SLOT(slotRenameTag()));
connect(this, SIGNAL(selectionChanged()),
this, SLOT(slotEmitSelected()));
connect(this, SIGNAL(doubleClicked(QListViewItem *)),
......@@ -543,7 +543,7 @@ void Playlist::setup()
connect(this, SIGNAL(contextMenuRequested( QListViewItem *, const QPoint&, int)),
this, SLOT(slotShowRMBMenu(QListViewItem *, const QPoint &, int)));
connect(this, SIGNAL(itemRenamed(QListViewItem *, const QString &, int)),
this, SLOT(slotApplyTags(QListViewItem *, const QString &, int)));
this, SLOT(slotApplyModification(QListViewItem *, const QString &, int)));
//////////////////////////////////////////////////
......@@ -582,7 +582,7 @@ void Playlist::slotShowRMBMenu(QListViewItem *item, const QPoint &point, int col
void Playlist::slotRenameTag()
{
// setup completions and validators
CollectionList *list = CollectionList::instance();
KLineEdit *edit = renameLineEdit();
......@@ -609,9 +609,9 @@ void Playlist::slotRenameTag()
rename(currentItem(), m_currentColumn);
}
void Playlist::slotApplyTags(QListViewItem *item, const QString &text, int column)
void Playlist::applyTag(QListViewItem *item, const QString &text, int column)
{
// kdDebug() << "Applying " << text << " at column " << column << ", replacing \"" << item->text(column) << "\"" << endl;
//kdDebug() << "Applying " << text << " at column " << column << ", replacing \"" << item->text(column) << "\"" << endl;
PlaylistItem *i = static_cast<PlaylistItem *>(item);
......@@ -651,6 +651,23 @@ void Playlist::slotApplyTags(QListViewItem *item, const QString &text, int colum
i->slotRefresh();
}
void Playlist::slotApplyModification(QListViewItem *item, const QString &text, int column)
{
QPtrList<QListViewItem> selectedSongs = KListView::selectedItems();
if (selectedSongs.count() > 1)
{
if (KMessageBox::warningYesNo(0, i18n("This will rename multiple files! Are you sure?"), QString::null,
KStdGuiItem::yes(), KStdGuiItem::no(), "WarnMultipleTags") == KMessageBox::No)
return;
QPtrListIterator<QListViewItem> it(selectedSongs);
for(; it.current(); ++it)
applyTag((*it), text, column);
}
else
applyTag(item, text, column);
}
////////////////////////////////////////////////////////////////////////////////
// helper functions
////////////////////////////////////////////////////////////////////////////////
......
......@@ -190,13 +190,14 @@ signals:
private:
void setup();
void applyTag(QListViewItem *item, const QString &text, int column);
QPtrStack<PlaylistItem> m_history;
private slots:
void slotEmitSelected() { emit signalSelectionChanged(selectedItems()); }
void slotEmitDoubleClicked(QListViewItem *) { emit signalDoubleClicked(); }
void slotShowRMBMenu(QListViewItem *item, const QPoint &point, int column);
void slotApplyTags(QListViewItem *item, const QString &text, int column);
void slotApplyModification(QListViewItem *item, const QString &text, int column);
void slotRenameTag();
private:
......@@ -220,6 +221,7 @@ private:
int m_rmbPasteID;
int m_rmbEditID;
int m_rmbEditMultipleID;
};
QDataStream &operator<<(QDataStream &s, const Playlist &p);
......
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