native dialogs and replace if exists dialog on import document

preferencesAboutTextFull
Clément Fauconnier 6 years ago
parent 40a9bdc089
commit 5ed4a41dba
  1. 10
      src/adaptors/UBExportAdaptor.cpp
  2. 2
      src/adaptors/UBImportDocument.cpp
  3. 14
      src/board/UBBoardController.cpp
  4. 2
      src/board/UBBoardController.h
  5. 2
      src/document/UBDocumentController.cpp

@ -65,15 +65,7 @@ QString UBExportAdaptor::askForFileName(UBDocumentProxy* pDocument, const QStrin
QString defaultPath = UBSettings::settings()->lastExportFilePath->get().toString() + "/" + defaultName; QString defaultPath = UBSettings::settings()->lastExportFilePath->get().toString() + "/" + defaultName;
bool useNativeDialog = true; QString filename = QFileDialog::getSaveFileName(UBApplication::mainWindow, pDialogTitle, defaultPath, QString());
#ifdef Q_OS_MAC
int versionMac = QSysInfo::macVersion();
if (versionMac == QSysInfo::MV_Unknown || versionMac >= QSysInfo::MV_MAVERICKS){ // version 11 is MacOSX 10.9 Mavericks
useNativeDialog = false;
}
#endif
QString filename = QFileDialog::getSaveFileName(UBApplication::mainWindow, pDialogTitle, defaultPath, QString(), 0, useNativeDialog?(QFileDialog::Option)0:QFileDialog::DontUseNativeDialog);
if (filename.size() == 0) if (filename.size() == 0)
{ {

@ -185,7 +185,7 @@ UBDocumentProxy* UBImportDocument::importFile(const QFile& pFile, const QString&
return NULL; return NULL;
} }
UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocumentFromDir(documentRootFolder, pGroup, ""); UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocumentFromDir(documentRootFolder, pGroup, "", false, false, true);
UBApplication::showMessage(tr("Import successful.")); UBApplication::showMessage(tr("Import successful."));
return newDocument; return newDocument;
} }

@ -1537,7 +1537,7 @@ void UBBoardController::setActiveDocumentScene(int pSceneIndex)
setActiveDocumentScene(selectedDocument(), pSceneIndex); setActiveDocumentScene(selectedDocument(), pSceneIndex);
} }
void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, const int pSceneIndex, bool forceReload) void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, const int pSceneIndex, bool forceReload, bool onImport)
{ {
saveViewState(); saveViewState();
@ -1554,9 +1554,15 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
if (targetScene) if (targetScene)
{ {
freezeW3CWidgets(true); if (mActiveScene && !onImport)
{
ClearUndoStack(); persistCurrentScene();
freezeW3CWidgets(true);
ClearUndoStack();
}else
{
UBApplication::undoStack->clear();
}
mActiveScene = targetScene; mActiveScene = targetScene;
mActiveSceneIndex = index; mActiveSceneIndex = index;

@ -179,7 +179,7 @@ class UBBoardController : public UBDocumentContainer
void findUniquesItems(const QUndoCommand *parent, QSet<QGraphicsItem *> &itms); void findUniquesItems(const QUndoCommand *parent, QSet<QGraphicsItem *> &itms);
void ClearUndoStack(); void ClearUndoStack();
void setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, int pSceneIndex = 0, bool forceReload = false); void setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, int pSceneIndex = 0, bool forceReload = false, bool onImport = false);
void setActiveDocumentScene(int pSceneIndex); void setActiveDocumentScene(int pSceneIndex);
void moveSceneToIndex(int source, int target); void moveSceneToIndex(int source, int target);

@ -1686,7 +1686,7 @@ void UBDocumentController::selectDocument(UBDocumentProxy* proxy, bool setAsCurr
if (proxy != mBoardController->selectedDocument()) // only if wanted Document is different from document actually on Board, // ALTI/AOU - 20140217 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 //issue 1629 - NNE - 20131105 : When set a current document, change in the board controller
mBoardController->setActiveDocumentScene(proxy, 0, false); mBoardController->setActiveDocumentScene(proxy, 0, false, onImport);
} }
} }

Loading…
Cancel
Save