Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/NotepadNext/NotepadNextApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ void parseCommandLine(QCommandLineParser &parser, const QStringList &args)
parser.addOptions({
{"translation", "Overrides the system default translation.", "translation"},
{"reset-settings", "Resets all application settings."},
{"n", "Places the cursor on the line number for the first file specified", "line number"}
{"n", "Places the cursor on the line number for the first file specified", "line number"},
{"workspace", "Opens the specified folder as a workspace", "workspace path"}
});

parser.process(args);
Expand Down Expand Up @@ -207,6 +208,14 @@ bool NotepadNextApplication::init()
// Everything should be ready at this point

window->restoreWindowState();

// Check this after restoring the state, as the state contains the previous visibility state of the FAW dock
if (parser.isSet("workspace")) {
const QString dir = parser.value("workspace");
qInfo("Opening folder as workspace: %s", qUtf8Printable(dir));
window->setFolderAsWorkspacePath(dir);
}

window->show();

DebugManager::resumeDebugOutput();
Expand Down
5 changes: 5 additions & 0 deletions src/NotepadNext/dialogs/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,11 @@ void MainWindow::openFolderAsWorkspaceDialog()

QString dir = QFileDialog::getExistingDirectory(this, tr("Open Folder as Workspace"), dialogDir, QFileDialog::ShowDirsOnly);

setFolderAsWorkspacePath(dir);
}

void MainWindow::setFolderAsWorkspacePath(const QString &dir)
{
if (!dir.isEmpty()) {
FolderAsWorkspaceDock *fawDock = findChild<FolderAsWorkspaceDock *>();
fawDock->setRootPath(dir);
Expand Down
1 change: 1 addition & 0 deletions src/NotepadNext/dialogs/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public slots:
void openFile(const QString &filePath);

void openFolderAsWorkspaceDialog();
void setFolderAsWorkspacePath(const QString &dir);

void reloadFile();

Expand Down