diff --git a/YACReaderLibrary/db/comic_model.cpp b/YACReaderLibrary/db/comic_model.cpp index 36037483..2e991a51 100644 --- a/YACReaderLibrary/db/comic_model.cpp +++ b/YACReaderLibrary/db/comic_model.cpp @@ -295,8 +295,8 @@ void ComicModel::setupFolderModelData(unsigned long long int folderId,const QStr QSqlDatabase::removeDatabase(_databasePath); endResetModel(); - if(_data.length()==0) - emit isEmpty(); + /*if(_data.length()==0) + emit isEmpty();*/ } void ComicModel::setupLabelModelData(unsigned long long parentLabel, const QString &databasePath) @@ -321,8 +321,8 @@ void ComicModel::setupLabelModelData(unsigned long long parentLabel, const QStri QSqlDatabase::removeDatabase(_databasePath); endResetModel(); - if(_data.length()==0) - emit isEmpty(); + /*if(_data.length()==0) + emit isEmpty();*/ } void ComicModel::setupFavoritesModelData(const QString &databasePath) @@ -347,8 +347,8 @@ void ComicModel::setupFavoritesModelData(const QString &databasePath) QSqlDatabase::removeDatabase(_databasePath); endResetModel(); - if(_data.length()==0) - emit isEmpty(); + /*if(_data.length()==0) + emit isEmpty();*/ } void ComicModel::setupReadingModelData(const QString &databasePath) @@ -371,8 +371,8 @@ void ComicModel::setupReadingModelData(const QString &databasePath) QSqlDatabase::removeDatabase(_databasePath); endResetModel(); - if(_data.length()==0) - emit isEmpty(); + /*if(_data.length()==0) + emit isEmpty();*/ } void ComicModel::setupModelData(const SearchModifiers modifier, const QString &filter, const QString &databasePath) @@ -708,7 +708,7 @@ void ComicModel::removeInTransaction(int row) delete _data.at(row); _data.removeAt(row); - endRemoveRows(); + endRemoveRows(); } void ComicModel::remove(ComicDB * comic, int row) diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 58381061..8606bc7e 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -1672,15 +1672,11 @@ void LibraryWindow::selectSubfolder(const QModelIndex &mi, int child) navigationController->selectedFolder(dest); } -void LibraryWindow::checkEmptyFolder(QStringList * paths) +//this methods is only using after deleting comics +//TODO broken window :) +void LibraryWindow::checkEmptyFolder() { - if(paths == 0) - { - QStringList pathList = comicsModel->getPaths(currentPath()); - paths = &pathList; - } - - if(paths->size()>0 && !importedCovers) + if(comicsModel->rowCount()>0 && !importedCovers) { disableComicsActions(false); } @@ -1688,9 +1684,11 @@ void LibraryWindow::checkEmptyFolder(QStringList * paths) { disableComicsActions(true); #ifndef Q_OS_MAC - if(paths->size()>0) + if(comicsModel->rowCount()>0) toggleFullScreenAction->setEnabled(true); #endif + if(comicsModel->rowCount() == 0) + navigationController->reselectCurrentFolder(); } } diff --git a/YACReaderLibrary/library_window.h b/YACReaderLibrary/library_window.h index fc087386..5bdb7cb2 100644 --- a/YACReaderLibrary/library_window.h +++ b/YACReaderLibrary/library_window.h @@ -300,7 +300,7 @@ public: public slots: void loadLibrary(const QString & path); void selectSubfolder(const QModelIndex & mi, int child); - void checkEmptyFolder(QStringList * paths = 0); + void checkEmptyFolder(); void openComic(); void createLibrary(); void create(QString source,QString dest, QString name); diff --git a/YACReaderLibrary/yacreader_navigation_controller.cpp b/YACReaderLibrary/yacreader_navigation_controller.cpp index dfd01e3b..e228b964 100644 --- a/YACReaderLibrary/yacreader_navigation_controller.cpp +++ b/YACReaderLibrary/yacreader_navigation_controller.cpp @@ -259,6 +259,7 @@ void YACReaderNavigationController::setupConnections() connect(libraryWindow->listsView,SIGNAL(clicked(QModelIndex)),this,SLOT(selectedList(QModelIndex))); connect(libraryWindow->historyController,SIGNAL(modelIndexSelected(YACReaderLibrarySourceContainer)),this,SLOT(selectedIndexFromHistory(YACReaderLibrarySourceContainer))); connect(libraryWindow->emptyFolderWidget,SIGNAL(subfolderSelected(QModelIndex,int)),this,SLOT(selectSubfolder(QModelIndex,int))); + connect(libraryWindow->comicsModel,SIGNAL(isEmpty()),this,SLOT(reselectCurrentFolder())); } qulonglong YACReaderNavigationController::folderModelIndexToID(const QModelIndex &mi)