diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 0642f63d..ae4c2180 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -238,7 +238,10 @@ QDialog::DialogCode UBPersistenceManager::processInteractiveReplacementDialog(UB if (mDocumentTreeStructureModel->currentIndex() == replaceIndex) { - UBApplication::documentController->selectDocument(pProxy, true, true); + if (pProxy->pageCount() > 0) + { + UBApplication::documentController->selectDocument(pProxy, true, true); + } } if (replaceProxy) { diff --git a/src/document/UBDocumentContainer.cpp b/src/document/UBDocumentContainer.cpp index 2609158b..445b1304 100644 --- a/src/document/UBDocumentContainer.cpp +++ b/src/document/UBDocumentContainer.cpp @@ -49,7 +49,6 @@ void UBDocumentContainer::setDocument(UBDocumentProxy* document, bool forceReloa { mCurrentDocument = document; - //qDebug() << documentThumbs(); clearThumbPage(); reloadThumbnails(); emit documentSet(mCurrentDocument); diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index 3f5791d0..6166f806 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -1854,12 +1854,15 @@ void UBDocumentController::selectDocument(UBDocumentProxy* proxy, bool setAsCurr if (setAsCurrentDocument) { UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel->setCurrentDocument(proxy); QModelIndex indexCurrentDoc = UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel->indexForProxy(proxy); - mDocumentUI->documentTreeView->setSelectedAndExpanded(indexCurrentDoc, true, editMode); - - if (proxy != mBoardController->selectedDocument()) // only if wanted Document is different from document actually on Board, // ALTI/AOU - 20140217 + if (indexCurrentDoc.isValid()) { - //issue 1629 - NNE - 20131105 : When set a current document, change in the board controller - mBoardController->setActiveDocumentScene(proxy, 0, true, onImport); + mDocumentUI->documentTreeView->setSelectedAndExpanded(indexCurrentDoc, true, editMode); + + if (proxy != mBoardController->selectedDocument()) // only if wanted Document is different from document actually on Board, // ALTI/AOU - 20140217 + { + //issue 1629 - NNE - 20131105 : When set a current document, change in the board controller + mBoardController->setActiveDocumentScene(proxy, 0, true, onImport); + } } } diff --git a/src/gui/UBDocumentNavigator.cpp b/src/gui/UBDocumentNavigator.cpp index 7d045b3a..4f0adba3 100644 --- a/src/gui/UBDocumentNavigator.cpp +++ b/src/gui/UBDocumentNavigator.cpp @@ -224,6 +224,8 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage) mThumbsWithLabels[iPage].setThumbnail(newItem); if (mLastClickedThumbnail == oldItem) mLastClickedThumbnail = newItem; + if (mSelectedThumbnail == oldItem) + mSelectedThumbnail = newItem; delete oldItem; oldItem = NULL; } @@ -317,7 +319,7 @@ void UBDocumentNavigator::resizeEvent(QResizeEvent *event) mThumbnailWidth = (width() > mThumbnailMinWidth) ? width() - 2*border() : mThumbnailMinWidth; if(mSelectedThumbnail) - ensureVisible(mSelectedThumbnail); + ensureVisible(mSelectedThumbnail); // Refresh the scene refreshScene();