Skip to content

Commit 963c125

Browse files
committed
joplinimportdialog: remember selected directory
Signed-off-by: Patrizio Bekerle <[email protected]>
1 parent 4dd827d commit 963c125

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# QOwnNotes Changelog
22

3+
## 26.1.2
4+
5+
- The **Joplin Import Dialog** now remembers the last selected directory
6+
- The directory path is automatically restored when reopening the dialog
7+
- The directory is only restored if it still exists on disk
8+
39
## 26.1.1
410

511
- **Notes and note folders can now be deleted together** in a single operation when enabling

src/dialogs/joplinimportdialog.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ JoplinImportDialog::JoplinImportDialog(QWidget* parent)
4646
ui->attachmentImportCheckBox->setChecked(
4747
settings.value(QStringLiteral("JoplinImport/AttachmentImportCheckBoxChecked"), true)
4848
.toBool());
49+
50+
// Load the last selected directory
51+
QString lastDirectory = settings.value(QStringLiteral("JoplinImport/LastDirectory")).toString();
52+
if (!lastDirectory.isEmpty()) {
53+
QDir dir(lastDirectory);
54+
if (dir.exists()) {
55+
ui->directoryLineEdit->setText(lastDirectory);
56+
}
57+
}
4958
}
5059

5160
JoplinImportDialog::~JoplinImportDialog() {
@@ -61,6 +70,12 @@ JoplinImportDialog::~JoplinImportDialog() {
6170
settings.setValue(QStringLiteral("JoplinImport/AttachmentImportCheckBoxChecked"),
6271
ui->attachmentImportCheckBox->isChecked());
6372

73+
// Save the last selected directory
74+
QString currentDirectory = ui->directoryLineEdit->text();
75+
if (!currentDirectory.isEmpty()) {
76+
settings.setValue(QStringLiteral("JoplinImport/LastDirectory"), currentDirectory);
77+
}
78+
6479
delete ui;
6580
}
6681

0 commit comments

Comments
 (0)