Skip to content

Commit

Permalink
Add default folder for bookmark ex/import
Browse files Browse the repository at this point in the history
Document folder is the default folder to ex/import.
  • Loading branch information
ShaopengLin authored and kelson42 committed Aug 11, 2024
1 parent a324fd9 commit 3f04646
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/readinglistbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

#include <QListWidgetItem>
#include <QFileDialog>
#include <QStandardPaths>

const QString documentsDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);

ReadingListBar::ReadingListBar(QWidget *parent) :
QWidget(parent),
Expand Down Expand Up @@ -119,9 +122,10 @@ void ReadingListBar::onExport()
{
auto app = KiwixApp::instance();
auto kiwixLibrary = app->getLibrary()->getKiwixLibrary();
auto suggestedFilePath = documentsDir + "/kiwix_readinglist.xml";
QString fileName = QFileDialog::getSaveFileName(app->getMainWindow(),
gt("save-file-as-window-title"),
"kiwix_readinglist.xml", "(*.xml)");
suggestedFilePath, "(*.xml)");
if (fileName.isEmpty())
return;

Expand All @@ -135,7 +139,7 @@ void ReadingListBar::onImport()
auto library = app->getLibrary();
QString fileName = QFileDialog::getOpenFileName(app->getMainWindow(),
gt("open-file"),
QString(), "(*.xml)");
documentsDir, "(*.xml)");
if (fileName.isEmpty())
return;

Expand Down

0 comments on commit 3f04646

Please sign in to comment.