Commit 472905d0 authored by Claudio Valerio's avatar Claudio Valerio

fixed (workaround) issue on deleting working page

parent af82e62a
...@@ -94,6 +94,7 @@ UBBoardController::UBBoardController(UBMainWindow* mainWindow) ...@@ -94,6 +94,7 @@ UBBoardController::UBBoardController(UBMainWindow* mainWindow)
, mSystemScaleFactor(1.0) , mSystemScaleFactor(1.0)
, mCleanupDone(false) , mCleanupDone(false)
, mCacheWidgetIsEnabled(false) , mCacheWidgetIsEnabled(false)
, mDeletingSceneIndex(-1)
{ {
mZoomFactor = UBSettings::settings()->boardZoomFactor->get().toDouble(); mZoomFactor = UBSettings::settings()->boardZoomFactor->get().toDouble();
...@@ -670,6 +671,7 @@ void UBBoardController::deleteScene(int nIndex) ...@@ -670,6 +671,7 @@ void UBBoardController::deleteScene(int nIndex)
{ {
if (selectedDocument()->pageCount()>=2) if (selectedDocument()->pageCount()>=2)
{ {
mDeletingSceneIndex = nIndex;
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
persistCurrentScene(); persistCurrentScene();
showMessage(tr("Delete page %1 from document").arg(nIndex), true); showMessage(tr("Delete page %1 from document").arg(nIndex), true);
...@@ -679,12 +681,12 @@ void UBBoardController::deleteScene(int nIndex) ...@@ -679,12 +681,12 @@ void UBBoardController::deleteScene(int nIndex)
deletePages(scIndexes); deletePages(scIndexes);
selectedDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); selectedDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
if (nIndex >= pageCount()) if (nIndex >= pageCount())
nIndex = pageCount()-1; nIndex = pageCount()-1;
setActiveDocumentScene(nIndex); setActiveDocumentScene(nIndex);
showMessage(tr("Page %1 deleted").arg(nIndex)); showMessage(tr("Page %1 deleted").arg(nIndex));
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
mDeletingSceneIndex = -1;
} }
} }
...@@ -1781,7 +1783,7 @@ void UBBoardController::show() ...@@ -1781,7 +1783,7 @@ void UBBoardController::show()
void UBBoardController::persistCurrentScene() void UBBoardController::persistCurrentScene()
{ {
if(UBPersistenceManager::persistenceManager() if(UBPersistenceManager::persistenceManager()
&& selectedDocument() && mActiveScene && selectedDocument() && mActiveScene && mActiveSceneIndex != mDeletingSceneIndex
&& (mActiveSceneIndex >= 0) && (mActiveSceneIndex >= 0)
&& (mActiveScene->isModified() || (UBApplication::boardController->paletteManager()->teacherGuideDockWidget() && UBApplication::boardController->paletteManager()->teacherGuideDockWidget()->teacherGuideWidget()->isModified()))) && (mActiveScene->isModified() || (UBApplication::boardController->paletteManager()->teacherGuideDockWidget() && UBApplication::boardController->paletteManager()->teacherGuideDockWidget()->teacherGuideWidget()->isModified())))
{ {
......
...@@ -280,6 +280,7 @@ class UBBoardController : public UBDocumentContainer ...@@ -280,6 +280,7 @@ class UBBoardController : public UBDocumentContainer
QMap<QAction*, QPair<QString, QString> > mActionTexts; QMap<QAction*, QPair<QString, QString> > mActionTexts;
bool mCacheWidgetIsEnabled; bool mCacheWidgetIsEnabled;
QGraphicsItem* mLastCreatedItem; QGraphicsItem* mLastCreatedItem;
int mDeletingSceneIndex;
private slots: private slots:
void stylusToolDoubleClicked(int tool); void stylusToolDoubleClicked(int tool);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment