fixed an issue on OSX where files could no longer be imported by double-clicking or using 'open with'

preferencesAboutTextFull
Clément Fauconnier 2 years ago
parent ed73c7b15e
commit 37cfe3ea30
  1. 27
      src/core/UBApplication.cpp
  2. 2
      src/core/UBApplication.h

@ -81,6 +81,8 @@ const QString UBApplication::mimeTypeUniboardPage = QString("application/vnd.mne
const QString UBApplication::mimeTypeUniboardPageItem = QString("application/vnd.mnemis-uniboard-page-item");
const QString UBApplication::mimeTypeUniboardPageThumbnail = QString("application/vnd.mnemis-uniboard-thumbnail");
QString UBApplication::fileToOpen = "";
#if defined(Q_OS_OSX) || defined(Q_OS_LINUX)
bool bIsMinimized = false;
#endif
@ -309,6 +311,14 @@ int UBApplication::exec(const QString& pFileToImport)
boardController->paletteManager()->rightPalette());
if (!UBApplication::fileToOpen.isEmpty())
{
if (!UBApplication::fileToOpen.endsWith("ubx"))
applicationController->importFile(UBApplication::fileToOpen);
else
applicationController->showMessage(tr("Cannot open your UBX file directly. Please import it in Documents mode instead"), false);
}
connect(applicationController, SIGNAL(mainModeChanged(UBApplicationController::MainMode)),
boardController->paletteManager(), SLOT(slot_changeMainMode(UBApplicationController::MainMode)));
@ -575,10 +585,21 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event)
UBPlatformUtils::setFrontProcess();
if (!fileToOpenEvent->file().endsWith("ubx"))
applicationController->importFile(fileToOpenEvent->file());
if (applicationController)
{
if (!fileToOpenEvent->file().endsWith("ubx"))
applicationController->importFile(fileToOpenEvent->file());
else
applicationController->showMessage(tr("Cannot open your UBX file directly. Please import it in Documents mode instead"), false);
}
else
applicationController->showMessage(tr("Cannot open your UBX file directly. Please import it in Documents mode instead"), false);
{
//startup : progressdialog.exec() is called and fileOpenEvent is consumed too early
// we store the file and will import it when the documents tree is ready
UBApplication::fileToOpen = fileToOpenEvent->file();
return true;
}
}
if (event->type() == QEvent::TabletLeaveProximity)

@ -86,6 +86,8 @@ class UBApplication : public SingleApplication
static const QString mimeTypeUniboardPageItem;
static const QString mimeTypeUniboardPageThumbnail;
static QString fileToOpen;
static void showMessage(const QString& message, bool showSpinningWheel = false);
static void setDisabled(bool disable);

Loading…
Cancel
Save