Add ability to export database as HTML for printing
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "core/Metadata.h"
|
||||
#include "core/Tools.h"
|
||||
#include "format/CsvExporter.h"
|
||||
#include "format/HtmlExporter.h"
|
||||
#include "gui/Clipboard.h"
|
||||
#include "gui/DatabaseOpenDialog.h"
|
||||
#include "gui/DatabaseWidget.h"
|
||||
@@ -402,6 +403,32 @@ void DatabaseTabWidget::exportToCsv()
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseTabWidget::exportToHtml()
|
||||
{
|
||||
auto db = databaseWidgetFromIndex(currentIndex())->database();
|
||||
if (!db) {
|
||||
Q_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
|
||||
QString fileName = fileDialog()->getSaveFileName(this,
|
||||
tr("Export database to HTML file"),
|
||||
QString(),
|
||||
tr("HTML file").append(" (*.html)"),
|
||||
nullptr,
|
||||
nullptr,
|
||||
"html");
|
||||
if (fileName.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
HtmlExporter htmlExporter;
|
||||
if (!htmlExporter.exportDatabase(fileName, db)) {
|
||||
emit messageGlobal(tr("Writing the HTML file failed.").append("\n").append(htmlExporter.errorString()),
|
||||
MessageWidget::Error);
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseTabWidget::changeMasterKey()
|
||||
{
|
||||
currentDatabaseWidget()->switchToMasterKeyChange();
|
||||
|
||||
Reference in New Issue
Block a user