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. 10
      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;
bool useNativeDialog = true;
#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);
QString filename = QFileDialog::getSaveFileName(UBApplication::mainWindow, pDialogTitle, defaultPath, QString());
if (filename.size() == 0)
{

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

@ -1537,7 +1537,7 @@ void UBBoardController::setActiveDocumentScene(int 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();
@ -1554,9 +1554,15 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
if (targetScene)
{
if (mActiveScene && !onImport)
{
persistCurrentScene();
freezeW3CWidgets(true);
ClearUndoStack();
}else
{
UBApplication::undoStack->clear();
}
mActiveScene = targetScene;
mActiveSceneIndex = index;

@ -179,7 +179,7 @@ class UBBoardController : public UBDocumentContainer
void findUniquesItems(const QUndoCommand *parent, QSet<QGraphicsItem *> &itms);
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 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
{
//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