mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-08-03 20:56:49 -04:00
Don't monitor files while in All files view.
When downloading a file, with monitor directory set same as download directory, the changes in fs may send a double booksChanged signal. The first is due to adding/removing books while the second is the explicit booksChanged. This change stops monitoring while in All files view. To save the edge case when the user themselves adds books in monitor directory (while Kiwix is in All files view), a connection is added to Local Files button - to call loadMonitorDir().
This commit is contained in:
parent
80129ea336
commit
a11a75a814
@ -26,6 +26,7 @@ public:
|
||||
void setCurrentLanguage(QString language);
|
||||
void setCurrentCategoryFilter(QString category);
|
||||
void setCurrentContentTypeFilter(QList<ContentTypeFilter*>& contentTypeFilter);
|
||||
bool isLocalLibrary() const { return m_local; }
|
||||
|
||||
private:
|
||||
Library* mp_library;
|
||||
|
@ -22,6 +22,13 @@ ContentManagerSide::ContentManagerSide(QWidget *parent) :
|
||||
connect(mp_ui->localFileButton, &QRadioButton::toggled,
|
||||
this, [=](bool checked) { mp_ui->localFileButton->setStyleSheet(
|
||||
checked ?"*{font-weight: bold}" : "");});
|
||||
connect(mp_ui->localFileButton, &QRadioButton::toggled,
|
||||
this, [=](bool checked) {
|
||||
if (checked) {
|
||||
QString monitorDir = KiwixApp::instance()->getSettingsManager()->getMonitorDir();
|
||||
KiwixApp::instance()->getLibrary()->asyncLoadMonitorDir(monitorDir);
|
||||
}
|
||||
});
|
||||
mp_ui->localFileButton->setStyleSheet("*{font-weight: bold}");
|
||||
|
||||
mp_ui->allFileButton->setText(gt("all-files"));
|
||||
|
@ -102,6 +102,7 @@ void KiwixApp::init()
|
||||
}
|
||||
});
|
||||
connect(&m_watcher, &QFileSystemWatcher::directoryChanged, this, [=](QString monitorDir) {
|
||||
if (getContentManager()->isLocalLibrary())
|
||||
m_library.asyncLoadMonitorDir(monitorDir);
|
||||
});
|
||||
QString monitorDir = m_settingsManager.getMonitorDir();
|
||||
|
Loading…
x
Reference in New Issue
Block a user