Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Klein <42714034+libklein@users.noreply.github.com>2022-10-03 06:04:21 +0300
committerGitHub <noreply@github.com>2022-10-03 06:04:21 +0300
commit54f9b25b5213550c3185477f09b34a1b412395ff (patch)
tree4376b83b6ef93c43272ff9ac9d7fb47851cb2fa3
parent9366c5c23318a2ba8a6c623a00db502936c843d8 (diff)
Add XML Export option to GUI. (#8524)
* Add XML Export option to GUI. * Update database export screenshot.
-rw-r--r--docs/images/export_database.pngbin82145 -> 128522 bytes
-rw-r--r--docs/topics/ImportExport.adoc2
-rw-r--r--share/translations/keepassxc_en.ts20
-rw-r--r--src/gui/DatabaseTabWidget.cpp34
-rw-r--r--src/gui/DatabaseTabWidget.h1
-rw-r--r--src/gui/MainWindow.cpp2
-rw-r--r--src/gui/MainWindow.ui19
7 files changed, 76 insertions, 2 deletions
diff --git a/docs/images/export_database.png b/docs/images/export_database.png
index 92a417ac0..aa46f0865 100644
--- a/docs/images/export_database.png
+++ b/docs/images/export_database.png
Binary files differ
diff --git a/docs/topics/ImportExport.adoc b/docs/topics/ImportExport.adoc
index f56135a1c..5a1991d08 100644
--- a/docs/topics/ImportExport.adoc
+++ b/docs/topics/ImportExport.adoc
@@ -55,7 +55,7 @@ To import a KeePass 1 database file in KeePassXC, perform the following steps:
6. The data from the `.kdb` file gets imported and converted to the new format, which is compatible with KeePassXC. You can now start using the new database file (`.kdbx`) in KeePassXC.
== Exporting Databases
-KeePassXC supports multiple ways to export your database for transfer to another program or to print out and archive. To export your database into the KDB XML format, you must use the KeePassXC CLI: `keepassxc-cli export <database.kdbx>`.
+KeePassXC supports multiple ways to export your database for transfer to another program or to print out and archive.
WARNING: Exporting your database will result in all of your passwords and sensitive information being stored in an unencrypted format. We do not recommend saving your exported database for long periods of time as that can cause a compromise of sensitive information.
diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts
index e22ccb977..ac5d43f56 100644
--- a/share/translations/keepassxc_en.ts
+++ b/share/translations/keepassxc_en.ts
@@ -2246,6 +2246,18 @@ This is definitely a bug, please report it to the developers.</source>
<comment>Database tab name modifier</comment>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Export database to XML file</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>XML file</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Writing the XML file failed</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>DatabaseWidget</name>
@@ -5434,6 +5446,14 @@ We recommend you use the AppImage available on our downloads page.</source>
<source>Copy Password and TOTP</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>&amp;XML File…</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>XML File…</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>ManageDatabase</name>
diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp
index 21c367b8f..8437a701b 100644
--- a/src/gui/DatabaseTabWidget.cpp
+++ b/src/gui/DatabaseTabWidget.cpp
@@ -493,6 +493,40 @@ void DatabaseTabWidget::exportToHtml()
exportDialog->exec();
}
+void DatabaseTabWidget::exportToXML()
+{
+ auto db = databaseWidgetFromIndex(currentIndex())->database();
+ if (!db) {
+ Q_ASSERT(false);
+ return;
+ }
+
+ if (!warnOnExport()) {
+ return;
+ }
+
+ auto fileName = fileDialog()->getSaveFileName(
+ this, tr("Export database to XML file"), FileDialog::getLastDir("xml"), tr("XML file").append(" (*.xml)"));
+ if (fileName.isEmpty()) {
+ return;
+ }
+
+ FileDialog::saveLastDir("xml", fileName, true);
+
+ QByteArray xmlData;
+ QString err;
+ if (!db->extract(xmlData, &err)) {
+ emit messageGlobal(tr("Writing the XML file failed").append("\n").append(err), MessageWidget::Error);
+ }
+
+ QFile file(fileName);
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
+ emit messageGlobal(tr("Writing the XML file failed").append("\n").append(file.errorString()),
+ MessageWidget::Error);
+ }
+ file.write(xmlData);
+}
+
bool DatabaseTabWidget::warnOnExport()
{
auto ans =
diff --git a/src/gui/DatabaseTabWidget.h b/src/gui/DatabaseTabWidget.h
index dfd0cff83..38a1822bf 100644
--- a/src/gui/DatabaseTabWidget.h
+++ b/src/gui/DatabaseTabWidget.h
@@ -71,6 +71,7 @@ public slots:
bool saveDatabaseBackup(int index = -1);
void exportToCsv();
void exportToHtml();
+ void exportToXML();
bool lockDatabases();
void lockDatabasesDelayed();
diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp
index d761e914e..6e0207d66 100644
--- a/src/gui/MainWindow.cpp
+++ b/src/gui/MainWindow.cpp
@@ -485,6 +485,7 @@ MainWindow::MainWindow()
connect(m_ui->actionImportOpVault, SIGNAL(triggered()), m_ui->tabWidget, SLOT(importOpVaultDatabase()));
connect(m_ui->actionExportCsv, SIGNAL(triggered()), m_ui->tabWidget, SLOT(exportToCsv()));
connect(m_ui->actionExportHtml, SIGNAL(triggered()), m_ui->tabWidget, SLOT(exportToHtml()));
+ connect(m_ui->actionExportXML, SIGNAL(triggered()), m_ui->tabWidget, SLOT(exportToXML()));
connect(
m_ui->actionLockDatabase, SIGNAL(triggered()), m_ui->tabWidget, SLOT(lockAndSwitchToFirstUnlockedDatabase()));
connect(m_ui->actionLockDatabaseToolbar, SIGNAL(triggered()), m_ui->actionLockDatabase, SIGNAL(triggered()));
@@ -973,6 +974,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
m_ui->menuExport->setEnabled(true);
m_ui->actionExportCsv->setEnabled(true);
m_ui->actionExportHtml->setEnabled(true);
+ m_ui->actionExportXML->setEnabled(true);
m_ui->actionDatabaseMerge->setEnabled(m_ui->tabWidget->currentIndex() != -1);
#ifdef WITH_XC_SSHAGENT
bool singleEntryHasSshKey =
diff --git a/src/gui/MainWindow.ui b/src/gui/MainWindow.ui
index f41cd508b..60b9d1b80 100644
--- a/src/gui/MainWindow.ui
+++ b/src/gui/MainWindow.ui
@@ -216,7 +216,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
- <height>21</height>
+ <height>25</height>
</rect>
</property>
<property name="contextMenuPolicy">
@@ -245,6 +245,12 @@
</property>
<addaction name="actionExportCsv"/>
<addaction name="actionExportHtml"/>
+ <addaction name="actionExportXML"/>
+ </widget>
+ <widget class="QMenu" name="menu_Quit">
+ <property name="title">
+ <string>&amp;Quit</string>
+ </property>
</widget>
<addaction name="actionDatabaseNew"/>
<addaction name="actionDatabaseOpen"/>
@@ -1101,6 +1107,17 @@
<string>&amp;Lock Database</string>
</property>
</action>
+ <action name="actionExportXML">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;XML File…</string>
+ </property>
+ <property name="toolTip">
+ <string>XML File…</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>