diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp
index 993e28c8f..2f3d7083b 100644
--- a/src/gui/MainWindow.cpp
+++ b/src/gui/MainWindow.cpp
@@ -277,6 +277,11 @@ MainWindow::MainWindow()
connect(m_ui->actionPasswordGenerator, SIGNAL(toggled(bool)), SLOT(switchToPasswordGen(bool)));
connect(m_ui->passwordGeneratorWidget, SIGNAL(dialogTerminated()), SLOT(closePasswordGen()));
+ connect(m_ui->welcomeWidget, SIGNAL(newDatabase()), SLOT(switchToNewDatabase()));
+ connect(m_ui->welcomeWidget, SIGNAL(openDatabase()), SLOT(switchToOpenDatabase()));
+ connect(m_ui->welcomeWidget, SIGNAL(openDatabaseFile(QString)), SLOT(switchToDatabaseFile(QString)));
+ connect(m_ui->welcomeWidget, SIGNAL(importKeePass1Database()), SLOT(switchToKeePass1Database()));
+
connect(m_ui->actionAbout, SIGNAL(triggered()), SLOT(showAboutDialog()));
connect(m_ui->tabWidget, SIGNAL(messageGlobal(QString,MessageWidget::MessageType)), this, SLOT(displayGlobalMessage(QString, MessageWidget::MessageType)));
@@ -537,6 +542,30 @@ void MainWindow::closePasswordGen()
switchToPasswordGen(false);
}
+void MainWindow::switchToNewDatabase()
+{
+ m_ui->tabWidget->newDatabase();
+ switchToDatabases();
+}
+
+void MainWindow::switchToOpenDatabase()
+{
+ m_ui->tabWidget->openDatabase();
+ switchToDatabases();
+}
+
+void MainWindow::switchToDatabaseFile(QString file)
+{
+ m_ui->tabWidget->openDatabase(file);
+ switchToDatabases();
+}
+
+void MainWindow::switchToKeePass1Database()
+{
+ m_ui->tabWidget->importKeePass1Database();
+ switchToDatabases();
+}
+
void MainWindow::databaseStatusChanged(DatabaseWidget *)
{
updateTrayIcon();
diff --git a/src/gui/MainWindow.h b/src/gui/MainWindow.h
index 4182140c7..694b38e7a 100644
--- a/src/gui/MainWindow.h
+++ b/src/gui/MainWindow.h
@@ -55,6 +55,10 @@ private Q_SLOTS:
void switchToDatabases();
void switchToSettings();
void switchToPasswordGen(bool enabled);
+ void switchToNewDatabase();
+ void switchToOpenDatabase();
+ void switchToDatabaseFile(QString file);
+ void switchToKeePass1Database();
void closePasswordGen();
void databaseStatusChanged(DatabaseWidget *dbWidget);
void databaseTabChanged(int tabIndex);
diff --git a/src/gui/MainWindow.ui b/src/gui/MainWindow.ui
index 44afe68ac..6e3ecf684 100644
--- a/src/gui/MainWindow.ui
+++ b/src/gui/MainWindow.ui
@@ -105,7 +105,45 @@
-
-
+
+
-
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::MinimumExpanding
+
+
+
+ 50
+ 20
+
+
+
+
+ -
+
+ horizontalSpacer_2
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::MinimumExpanding
+
+
+
+ 50
+ 20
+
+
+
+
+
@@ -277,9 +315,9 @@
-
- Merge from KeePassX database
-
+
+ Merge from KeePassX database
+
diff --git a/src/gui/WelcomeWidget.cpp b/src/gui/WelcomeWidget.cpp
index 842546ecc..cb7a1de2e 100644
--- a/src/gui/WelcomeWidget.cpp
+++ b/src/gui/WelcomeWidget.cpp
@@ -18,13 +18,51 @@
#include "WelcomeWidget.h"
#include "ui_WelcomeWidget.h"
+#include "config-keepassx.h"
+#include "core/FilePath.h"
+#include "core/Config.h"
+
WelcomeWidget::WelcomeWidget(QWidget* parent)
: QWidget(parent)
, m_ui(new Ui::WelcomeWidget())
{
m_ui->setupUi(this);
+
+ m_ui->welcomeLabel->setText(m_ui->welcomeLabel->text() + " " + KEEPASSX_VERSION);
+ QFont welcomeLabelFont = m_ui->welcomeLabel->font();
+ welcomeLabelFont.setBold(true);
+ welcomeLabelFont.setPointSize(welcomeLabelFont.pointSize() + 4);
+ m_ui->welcomeLabel->setFont(welcomeLabelFont);
+
+ m_ui->iconLabel->setPixmap(filePath()->applicationIcon().pixmap(64));
+
+ m_ui->recentListWidget->clear();
+ const QStringList lastDatabases = config()->get("LastDatabases", QVariant()).toStringList();
+ for (const QString& database : lastDatabases) {
+ QListWidgetItem *itm = new QListWidgetItem;
+ itm->setText(database);
+ m_ui->recentListWidget->addItem(itm);
+ }
+ bool recent_visibility = (m_ui->recentListWidget->count() > 0);
+ m_ui->startLabel->setVisible(!recent_visibility);
+ m_ui->recentListWidget->setVisible(recent_visibility);
+ m_ui->recentLabel->setVisible(recent_visibility);
+
+ connect(m_ui->buttonNewDatabase, SIGNAL(clicked()), SIGNAL(newDatabase()));
+ connect(m_ui->buttonOpenDatabase, SIGNAL(clicked()), SIGNAL(openDatabase()));
+ connect(m_ui->buttonImportKeePass1, SIGNAL(clicked()), SIGNAL(importKeePass1Database()));
+ connect(m_ui->recentListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this,
+ SLOT(openDatabaseFromFile(QListWidgetItem*)));
}
WelcomeWidget::~WelcomeWidget()
{
}
+
+void WelcomeWidget::openDatabaseFromFile(QListWidgetItem* item)
+{
+ if (item->text().isEmpty()) {
+ return;
+ }
+ Q_EMIT openDatabaseFile(item->text());
+}
\ No newline at end of file
diff --git a/src/gui/WelcomeWidget.h b/src/gui/WelcomeWidget.h
index 80a0dde1c..dbd0d2e27 100644
--- a/src/gui/WelcomeWidget.h
+++ b/src/gui/WelcomeWidget.h
@@ -19,6 +19,7 @@
#define KEEPASSX_WELCOMEWIDGET_H
#include
+#include
namespace Ui {
class WelcomeWidget;
@@ -32,6 +33,15 @@ public:
explicit WelcomeWidget(QWidget* parent = nullptr);
~WelcomeWidget();
+Q_SIGNALS:
+ void newDatabase();
+ void openDatabase();
+ void openDatabaseFile(QString);
+ void importKeePass1Database();
+
+private Q_SLOTS:
+ void openDatabaseFromFile(QListWidgetItem* item);
+
private:
const QScopedPointer m_ui;
};
diff --git a/src/gui/WelcomeWidget.ui b/src/gui/WelcomeWidget.ui
index 4382e7c77..8d6a7c49a 100644
--- a/src/gui/WelcomeWidget.ui
+++ b/src/gui/WelcomeWidget.ui
@@ -2,17 +2,170 @@
WelcomeWidget
+
+
+ 0
+ 0
+ 450
+ 401
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 450
+ 0
+
+
-
-
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
- Welcome!
+ Welcome to KeePassXC
Qt::AlignCenter
+ -
+
+
+ Start storing your passwords securely in a KeePassXC database
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 20
+
+
+
+
+ -
+
+
+ Create new database
+
+
+
+ -
+
+
+ Open existing database
+
+
+
+ -
+
+
+ Import from KeePass 1
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Minimum
+
+
+
+ 0
+ 5
+
+
+
+
+ -
+
+
+ Recent databases
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+