Skip to content

Commit b095fce

Browse files
committed
evernoteimportdialog: remember selected file
Signed-off-by: Patrizio Bekerle <[email protected]>
1 parent 963c125 commit b095fce

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
- The **Joplin Import Dialog** now remembers the last selected directory
66
- The directory path is automatically restored when reopening the dialog
77
- The directory is only restored if it still exists on disk
8+
- The **Evernote Import Dialog** now remembers the last selected ENEX file
9+
- The file path is automatically restored when reopening the dialog
10+
- The file is only restored if it still exists on disk
811

912
## 26.1.1
1013

src/dialogs/evernoteimportdialog.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ EvernoteImportDialog::EvernoteImportDialog(QWidget *parent)
3636
ui->attachmentImportCheckBox->setChecked(
3737
settings.value(QStringLiteral("EvernoteImport/AttachmentImportCheckBoxChecked"), true)
3838
.toBool());
39+
40+
// Load the last selected ENEX file
41+
QString lastFile = settings.value(QStringLiteral("EvernoteImport/LastFile")).toString();
42+
if (!lastFile.isEmpty()) {
43+
QFileInfo fileInfo(lastFile);
44+
if (fileInfo.exists() && fileInfo.isFile()) {
45+
ui->fileLineEdit->setText(lastFile);
46+
}
47+
}
3948
}
4049

4150
void EvernoteImportDialog::resetNoteCount() {
@@ -51,6 +60,12 @@ EvernoteImportDialog::~EvernoteImportDialog() {
5160
settings.setValue(QStringLiteral("EvernoteImport/AttachmentImportCheckBoxChecked"),
5261
ui->attachmentImportCheckBox->isChecked());
5362

63+
// Save the last selected ENEX file
64+
QString currentFile = ui->fileLineEdit->text();
65+
if (!currentFile.isEmpty()) {
66+
settings.setValue(QStringLiteral("EvernoteImport/LastFile"), currentFile);
67+
}
68+
5469
storeMetaDataTreeWidgetItemsCheckedState();
5570

5671
delete ui;

0 commit comments

Comments
 (0)