mirror of
https://github.com/transmission/transmission
synced 2024-12-23 00:04:06 +00:00
#5841: Fix initial watchdir scan in Qt client
Run the initial scan after application has finished initializing and session has been created. Otherwise, adding torrents is a no-op.
This commit is contained in:
parent
64757f640a
commit
79848c36c0
2 changed files with 14 additions and 1 deletions
|
@ -92,7 +92,7 @@ WatchDir :: setPath (const QString& path, bool isEnabled)
|
|||
connect (myWatcher, SIGNAL(directoryChanged(const QString&)),
|
||||
this, SLOT(watcherActivated(const QString&)));
|
||||
//std::cerr << "watching " << qPrintable(path) << " for new .torrent files" << std::endl;
|
||||
watcherActivated (path); // trigger the watchdir for .torrent files in there already
|
||||
QTimer::singleShot (0, this, SLOT (rescanAllWatchedDirectories ())); // trigger the watchdir for .torrent files in there already
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,3 +140,13 @@ WatchDir :: watcherActivated (const QString& path)
|
|||
// for comparison the next time around
|
||||
myWatchDirFiles = files;
|
||||
}
|
||||
|
||||
void
|
||||
WatchDir :: rescanAllWatchedDirectories ()
|
||||
{
|
||||
if (myWatcher == nullptr)
|
||||
return;
|
||||
|
||||
foreach (const QString& path, myWatcher->directories ())
|
||||
watcherActivated (path);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,9 @@ class WatchDir: public QObject
|
|||
void watcherActivated (const QString& path);
|
||||
void onTimeout ();
|
||||
|
||||
private slots:
|
||||
void rescanAllWatchedDirectories ();
|
||||
|
||||
private:
|
||||
const TorrentModel& myModel;
|
||||
QSet<QString> myWatchDirFiles;
|
||||
|
|
Loading…
Reference in a new issue