Commit 90cc6f98 authored by Scott Wheeler's avatar Scott Wheeler

A bit of a dirty hack to diable the directory scanner while renaming of files

is taking place.  I'd really like to at some point find a way to do this without
going through the ugly levels of redirection that this uses, but based on the
current class hierarchy this will have to do.

CCMAIL:69670-done@bugs.kde.org

svn path=/trunk/kdemultimedia/juk/; revision=303829
parent 07fb12bf
......@@ -43,6 +43,12 @@ public:
virtual ~JuK();
virtual KActionCollection *actionCollection() const;
/**
* This forwards on the request to enable or disable directory scanning for
* new files being added or removed.
*/
void setDirWatchEnabled(bool enabled) { m_splitter->setDirWatchEnabled(enabled); }
signals:
void signalEdit();
void signalNewSong(const QString& songTitle);
......
......@@ -43,6 +43,7 @@
#include "collectionlist.h"
#include "filerenamer.h"
#include "actioncollection.h"
#include "juk.h"
#include "tag.h"
/**
......@@ -588,13 +589,25 @@ void Playlist::slotRefresh()
void Playlist::slotRenameFile()
{
// TODO: find a less dirty hack for signaling disabling of the file
// renamer that doesn't involve going through these layers of indirection.
JuK *mainWindow = dynamic_cast<JuK *>(kapp->mainWidget());
Q_ASSERT(mainWindow);
if(mainWindow)
mainWindow->setDirWatchEnabled(false);
FileRenamer renamer;
PlaylistItemList items = selectedItems();
if(items.count() == 1) {
renamer.rename(items[0]);
} else {
renamer.rename(items);
}
if(items.count() == 1)
renamer.rename(items[0]);
else
renamer.rename(items);
if(mainWindow)
mainWindow->setDirWatchEnabled(true);
}
void Playlist::slotGuessTagInfo(TagGuesser::Type type)
......
......@@ -294,6 +294,14 @@ Playlist *PlaylistSplitter::createPlaylist(const QString &name, bool raise)
return p;
}
void PlaylistSplitter::setDirWatchEnabled(bool enabled)
{
if(enabled)
m_dirWatch.startScan();
else
m_dirWatch.stopScan();
}
////////////////////////////////////////////////////////////////////////////////
// public slots
////////////////////////////////////////////////////////////////////////////////
......
......@@ -106,6 +106,13 @@ public:
*/
Playlist *createPlaylist(const QString &name, bool raise = true);
/**
* This can be used to turn on or off scanning for new files. This is
* presently used so that the file renamer can temporariy disable searching
* for new files while it performs the rename.
*/
void setDirWatchEnabled(bool enabled);
public slots:
/**
......
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