Skip to content

Commit

Permalink
DEV: fix FEPageExport to fit new logic
Browse files Browse the repository at this point in the history
  • Loading branch information
altairwei committed Apr 13, 2024
1 parent a29d0ac commit 429f669
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
8 changes: 2 additions & 6 deletions src/WizMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,11 +601,7 @@ void WizMainWindow::resizeEvent(QResizeEvent *event)
update();
}

/**
* @brief Show upgrade notification.
*
* @param bUpgradeAvaliable
*/
/** Show WizNotePlus upgrade notification dialog. */
void WizMainWindow::on_checkUpgrade_finished(QJsonObject latestStable, QJsonObject latestTest)
{
if (latestStable.isEmpty() && latestTest.isEmpty())
Expand All @@ -623,7 +619,7 @@ void WizMainWindow::on_checkUpgrade_finished(QJsonObject latestStable, QJsonObje
return;
}

WizUpgradeNotifyDialog notifyDialog(this);
WizUpgradeNotifyDialog notifyDialog;
notifyDialog.showMarkdownContent(strMarkdown);
if (QDialog::Accepted == notifyDialog.exec()) {
QDesktopServices::openUrl(QUrl(strUrl));
Expand Down
29 changes: 12 additions & 17 deletions src/widgets/FileExportWizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,9 @@ void FEPageExport::insertLog(const QString& text)

void FEPageExport::handleExportFile()
{
QStringList notes = field("documents*").toStringList();
auto outputFormats = field("outputFormats*").value<QMap<QString, QString> >();
auto notes = field("documents").toList();

auto outputFormats = field("outputFormats").value<QMap<QString, QString> >();
QString outputFolder = field("outputFolder").toString();
bool keepFolder = field("keepFolder").toBool();

Expand All @@ -725,24 +726,18 @@ void FEPageExport::handleExportFile()
m_progress->setRange(0, notes.size());
m_progress->setValue(0);

// TODO: add databse option
WizDatabase& db = m_dbMgr.db();
foreach (auto &note, notes) {
foreach (const QVariant &note, notes) {
m_progress->setValue(m_progress->value() + 1);
qApp->processEvents();
if (m_cancel) return;

WIZDOCUMENTDATA data;
if (!db.documentFromGuid(note, data)) {
ASKCONTINUE(
tr("Do you want to continue?"),
tr("Can't find document for GUID: %1").arg(note)
);
}
auto data = note.value<const WIZDOCUMENTDATA*>();
insertLog(QString("Exporting %1\n").arg(data->strTitle));

insertLog(QString("Exporting %1\n").arg(data.strTitle));
// Get the corresponding databaset for a document
WizDatabase& db = m_dbMgr.db(data->strKbGUID);

if (data.nProtected == 1) {
if (data->nProtected == 1) {
if (!db.loadUserCert()) {
ASKCONTINUE(
tr("Do you want to continue?"),
Expand Down Expand Up @@ -775,14 +770,14 @@ void FEPageExport::handleExportFile()

QString destFolder = outputFolder;
if (keepFolder)
destFolder = outputFolder + data.strLocation;
destFolder = outputFolder + data->strLocation;

auto format = WizFileExporter::HTML;
if (WizIsMarkdownNote(data))
if (WizIsMarkdownNote(*data))
format = WizFileExporter::Markdown;

bool ok = m_exporter->exportNote(
data, destFolder, format);
*data, destFolder, format);
if (!ok) {
ASKCONTINUE(
tr("Do you want to continue?"),
Expand Down

0 comments on commit 429f669

Please sign in to comment.