Skip to content

Commit

Permalink
ticket:5942 Added a menu item to open the temporary directory
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Oct 9, 2020
1 parent b93d4ae commit 15a23ed
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
19 changes: 19 additions & 0 deletions OMEdit/OMEditLIB/MainWindow.cpp
Expand Up @@ -2623,6 +2623,20 @@ void MainWindow::TLMSimulate()
}
}

/*!
* \brief MainWindow::openTemporaryDirectory
* Opens the temporary directory
*/
void MainWindow::openTemporaryDirectory()
{
QUrl temporaryDirectory (QString("file:///%1").arg(Utilities::tempDirectory()));
if (!QDesktopServices::openUrl(temporaryDirectory)) {
MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica,
GUIMessages::getMessage(GUIMessages::UNABLE_TO_OPEN_FILE).arg(temporaryDirectory.toString()),
Helper::scriptingKind, Helper::errorLevel));
}
}

/*!
* \brief MainWindow::openWorkingDirectory
* Opens the current working directory.
Expand Down Expand Up @@ -3542,6 +3556,10 @@ void MainWindow::createActions()
mpShowOMCDiffWidgetAction->setStatusTip(tr("Shows OpenModelica Compiler Diff"));
connect(mpShowOMCDiffWidgetAction, SIGNAL(triggered()), mpOMCProxy, SLOT(openOMCDiffWidget()));
}
// open temporary directory action
mpOpenTemporaryDirectoryAction = new QAction(tr("Open Temporary Directory"), this);
mpOpenTemporaryDirectoryAction->setStatusTip(tr("Opens the temporary directory"));
connect(mpOpenTemporaryDirectoryAction, SIGNAL(triggered()), SLOT(openTemporaryDirectory()));
// open working directory action
mpOpenWorkingDirectoryAction = new QAction(tr("Open Working Directory"), this);
mpOpenWorkingDirectoryAction->setStatusTip(tr("Opens the current working directory"));
Expand Down Expand Up @@ -3975,6 +3993,7 @@ void MainWindow::createMenus()
pToolsMenu->addAction(mpShowOMCDiffWidgetAction);
}
pToolsMenu->addSeparator();
pToolsMenu->addAction(mpOpenTemporaryDirectoryAction);
pToolsMenu->addAction(mpOpenWorkingDirectoryAction);
pToolsMenu->addAction(mpOpenTerminalAction);
pToolsMenu->addSeparator();
Expand Down
2 changes: 2 additions & 0 deletions OMEdit/OMEditLIB/MainWindow.h
Expand Up @@ -381,6 +381,7 @@ class MainWindow : public QMainWindow
QAction *mpShowOMCLoggerWidgetAction;
QAction *mpShowOpenModelicaCommandPromptAction;
QAction *mpShowOMCDiffWidgetAction;
QAction *mpOpenTemporaryDirectoryAction;
QAction *mpOpenWorkingDirectoryAction;
QAction *mpOpenTerminalAction;
QAction *mpOptionsAction;
Expand Down Expand Up @@ -520,6 +521,7 @@ public slots:
void exportToClipboard();
void fetchInterfaceData();
void TLMSimulate();
void openTemporaryDirectory();
void openWorkingDirectory();
void openTerminal();
void openConfigurationOptions();
Expand Down
5 changes: 3 additions & 2 deletions doc/UsersGuide/source/omedit.rst
Expand Up @@ -1755,7 +1755,7 @@ The users can perform multiple searches and go back to old search results using
Search History
Temporary Directory, Working Directory and Log Files
Temporary Directory, Log Files and Working Directory
----------------------------------------------------

On Unix/Linux systems temporary directory is the path in the `TMPDIR` environment variable
Expand All @@ -1765,7 +1765,8 @@ so the complete path is usually `/tmp/OpenModelica<USERNAME>/OMEdit`.
On Windows its the path in the `TEMP` or `TMP` environment variable appended with directory paths
`OpenModelica/OMEdit` so the complete path is usually `%TEMP%/OpenModelica/OMEdit`.

All the log files are always generated in the temporary directory.
All the log files are always generated in the temporary directory. Choose *Tools > Open Temporary Directory*
to open the temporary directory.

By default the working directory has the same path as the temporary directory. You can change
the working directory from *Tools > Options > General* see section :ref:`omedit-options-general`.
Expand Down

0 comments on commit 15a23ed

Please sign in to comment.