mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-08-03 20:56:49 -04:00
Directory monitoring does not removes zims opened
This commit is contained in:
parent
17702f887b
commit
34a4a9ce48
@ -906,5 +906,6 @@ void ContentManager::updateLibraryFromDir(QString monitorDir)
|
||||
|
||||
void ContentManager::handleDisappearedZimFile(QString bookId)
|
||||
{
|
||||
if (!KiwixApp::instance()->getTabWidget()->getTabZimIds().contains(bookId))
|
||||
mp_library->removeBookFromLibraryById(bookId);
|
||||
}
|
||||
|
@ -106,10 +106,10 @@ void KiwixApp::init()
|
||||
mp_manager->asyncUpdateLibraryFromDir(monitorDir);
|
||||
});
|
||||
|
||||
setupDirectoryMonitoring();
|
||||
|
||||
/* Restore Tabs before directory monitoring to ensure we know what tabs user had. */
|
||||
restoreTabs();
|
||||
restoreWindowState();
|
||||
setupDirectoryMonitoring();
|
||||
}
|
||||
|
||||
void KiwixApp::setupDirectoryMonitoring()
|
||||
|
@ -284,6 +284,15 @@ QStringList TabBar::getTabUrls() const {
|
||||
return idList;
|
||||
}
|
||||
|
||||
QStringList TabBar::getTabZimIds() const
|
||||
{
|
||||
QStringList idList;
|
||||
for (int index = 0; index <= mp_stackedWidget->count(); index++)
|
||||
if (ZimView* zv = qobject_cast<ZimView*>(mp_stackedWidget->widget(index)))
|
||||
idList.push_back(zv->getWebView()->zimId());
|
||||
return idList;
|
||||
}
|
||||
|
||||
void TabBar::closeTab(int index)
|
||||
{
|
||||
// The first and last tabs (i.e. the library tab and the + (new tab) button)
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
void openFindInPageBar();
|
||||
void closeTabsByZimId(const QString &id);
|
||||
QStringList getTabUrls() const;
|
||||
QStringList getTabZimIds() const;
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
Loading…
x
Reference in New Issue
Block a user