fixed deleting list

This commit is contained in:
Luis Ángel San Martín
2014-11-21 22:19:36 +01:00
parent 12604854ea
commit f95d6715fa
3 changed files with 8 additions and 1 deletions

View File

@ -1607,13 +1607,14 @@ void LibraryWindow::deleteSelectedReadingList()
QModelIndexList selectedLists = listsView->selectionModel()->selectedIndexes(); QModelIndexList selectedLists = listsView->selectionModel()->selectedIndexes();
if(!selectedLists.isEmpty()) if(!selectedLists.isEmpty())
{ {
QModelIndex mi = selectedLists.at(0); QModelIndex mi = listsModelProxy->mapToSource(selectedLists.at(0));
if(listsModel->isEditable(mi)) if(listsModel->isEditable(mi))
{ {
int ret = QMessageBox::question(this,tr("Delete list/label"),tr("The selected item will be deleted, your comics or folders will NOT be deleted from your disk. Are you sure?"),QMessageBox::Yes,QMessageBox::No); int ret = QMessageBox::question(this,tr("Delete list/label"),tr("The selected item will be deleted, your comics or folders will NOT be deleted from your disk. Are you sure?"),QMessageBox::Yes,QMessageBox::No);
if(ret == QMessageBox::Yes) if(ret == QMessageBox::Yes)
{ {
listsModel->deleteItem(mi); listsModel->deleteItem(mi);
navigationController->reselectCurrentList();
} }
} }
} }

View File

@ -152,6 +152,11 @@ void YACReaderNavigationController::selectedList(const QModelIndex &mi)
libraryWindow->foldersView->clearSelection(); libraryWindow->foldersView->clearSelection();
} }
void YACReaderNavigationController::reselectCurrentList()
{
selectedList(libraryWindow->listsView->currentIndex());
}
void YACReaderNavigationController::selectedIndexFromHistory(const QModelIndex &sourceMI) void YACReaderNavigationController::selectedIndexFromHistory(const QModelIndex &sourceMI)
{ {
//TODO NO searching allowed, just disable backward/forward actions in searching mode //TODO NO searching allowed, just disable backward/forward actions in searching mode

View File

@ -21,6 +21,7 @@ public slots:
void reselectCurrentFolder(); void reselectCurrentFolder();
//reading lists //reading lists
void selectedList(const QModelIndex & mi); void selectedList(const QModelIndex & mi);
void reselectCurrentList();
//history navigation //history navigation
void selectedIndexFromHistory(const QModelIndex & mi); void selectedIndexFromHistory(const QModelIndex & mi);
//empty subfolder //empty subfolder