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 10a54ce7 authored by Michael Pyne's avatar Michael Pyne

Fix bug 83882 by taking advantage of Scott's updates to taglib. I could only

reproduce the bug while using the inline tag editor, so I added code to that
to check for unwritable files or errors updating the tag, and JuK now displays
a dialog box if any files didn't update right.

If you haven't updated kdesupport recently, now would be a good time.

CCMAIL:wheeler@kde.org
CCMAIL:83882-done@bugs.kde.org

svn path=/trunk/kdemultimedia/juk/; revision=328139
parent 741c60ac
......@@ -1704,7 +1704,7 @@ void Playlist::slotRenameTag()
rename(currentItem(), m_currentColumn);
}
void Playlist::editTag(PlaylistItem *item, const QString &text, int column)
bool Playlist::editTag(PlaylistItem *item, const QString &text, int column)
{
switch(column - columnOffset())
{
......@@ -1738,13 +1738,18 @@ void Playlist::editTag(PlaylistItem *item, const QString &text, int column)
}
}
item->file().tag()->save();
item->refresh();
if(item->file().tag()->save()) {
item->refresh();
return true;
}
return false;
}
void Playlist::slotInlineEditDone(QListViewItem *, const QString &, int column)
{
QString text = renameLineEdit()->text();
QStringList failedFiles;
PlaylistItemList l = selectedItems();
if(text == m_editText ||
......@@ -1760,10 +1765,19 @@ void Playlist::slotInlineEditDone(QListViewItem *, const QString &, int column)
}
for(PlaylistItemList::ConstIterator it = l.begin(); it != l.end(); ++it) {
editTag(*it, text, column);
QFileInfo fi((*it)->file().absFilePath());
if(!fi.isWritable() || !editTag(*it, text, column))
failedFiles += fi.absFilePath();
processEvents();
}
if(!failedFiles.isEmpty())
KMessageBox::detailedSorry(this,
i18n("Could not save to specified file(s)."),
i18n("Could Not Write to:\n") + failedFiles.join("\n"));
CollectionList::instance()->dataChanged();
dataChanged();
update();
......
......@@ -439,9 +439,9 @@ private:
/**
* Writes \a text to \a item in \a column. This is used by the inline tag
* editor.
* editor. Returns false if the tag update failed.
*/
void editTag(PlaylistItem *item, const QString &text, int column);
bool editTag(PlaylistItem *item, const QString &text, int column);
/**
* Returns the index of the left most visible column in the playlist.
......
......@@ -67,8 +67,9 @@ Tag::Tag(const QString &fileName) :
}
}
void Tag::save()
bool Tag::save()
{
bool result;
TagLib::ID3v2::FrameFactory::instance()->setDefaultTextEncoding(TagLib::String::UTF8);
TagLib::File *file = 0;
......@@ -89,13 +90,15 @@ void Tag::save()
file->tag()->setTrack(m_track);
file->tag()->setYear(m_year);
file->save();
result = file->save();
}
else
else {
kdError(65432) << "Couldn't save file." << endl;
result = false;
}
delete file;
return result;
}
CacheDataStream &Tag::read(CacheDataStream &s)
......
......@@ -33,7 +33,7 @@ class Tag
public:
Tag(const QString &fileName);
void save();
bool save();
QString title() const { return m_title; }
QString artist() const { return m_artist; }
......
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