Commit bb1d0688 authored by Scott Wheeler's avatar Scott Wheeler

Don't create a new file handle when we're renaming files. This keeps weird

things from happening if we rename the file to a name we previously used.

BUG:91503

svn path=/trunk/kdemultimedia/juk/; revision=359731
parent 962af35c
......@@ -134,6 +134,7 @@ void FileHandle::setFile(const QString &path)
else {
d->absFilePath = resolveSymLinks(path);
d->fileInfo.setFile(path);
d->tag->setFileName(d->absFilePath);
}
}
......
......@@ -721,8 +721,10 @@ void FileRenamer::rename(const PlaylistItemList &items)
for(QMap<QString, QString>::ConstIterator it = map.begin();
it != map.end(); ++it)
{
if(moveFile(it.key(), it.data()))
itemMap[it.key()]->setFile(FileHandle(it.data()));
if(moveFile(it.key(), it.data())) {
itemMap[it.key()]->setFile(it.data());
itemMap[it.key()]->refresh();
}
else
errorFiles << i18n("%1 to %2").arg(it.key()).arg(it.data());
......
......@@ -59,6 +59,14 @@ void PlaylistItem::setFile(const FileHandle &file)
refresh();
}
void PlaylistItem::setFile(const QString &file)
{
QString oldPath = d->fileHandle.absFilePath();
d->fileHandle.setFile(file);
m_collectionItem->updateCollectionDict(oldPath, d->fileHandle.absFilePath());
refresh();
}
FileHandle PlaylistItem::file() const
{
return d->fileHandle;
......
......@@ -65,6 +65,7 @@ public:
static int lastColumn() { return FullPathColumn; }
void setFile(const FileHandle &file);
void setFile(const QString &file);
FileHandle file() const;
virtual QString text(int column) const;
......
......@@ -57,6 +57,8 @@ public:
void setYear(int value) { m_year = value; }
void setComment(const QString &value) { m_comment = value; }
void setFileName(const QString &value) { m_fileName = value; }
int seconds() const { return m_seconds; }
int bitrate() const { return m_bitrate; }
......
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