mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
fix RecentDatabases, closes #386
This commit is contained in:
parent
1418712b4c
commit
7ca13b3d51
@ -378,6 +378,11 @@ void MainWindow::openRecentDatabase(QAction* action)
|
||||
void MainWindow::clearLastDatabases()
|
||||
{
|
||||
config()->set("LastDatabases", QVariant());
|
||||
bool inWelcomeWidget = (m_ui->stackedWidget->currentIndex() == 2);
|
||||
|
||||
if (inWelcomeWidget) {
|
||||
m_ui->welcomeWidget->refreshLastDatabases();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::openDatabase(const QString& fileName, const QString& pw, const QString& keyFile)
|
||||
|
@ -36,13 +36,8 @@ WelcomeWidget::WelcomeWidget(QWidget* parent)
|
||||
|
||||
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);
|
||||
}
|
||||
refreshLastDatabases();
|
||||
|
||||
bool recent_visibility = (m_ui->recentListWidget->count() > 0);
|
||||
m_ui->startLabel->setVisible(!recent_visibility);
|
||||
m_ui->recentListWidget->setVisible(recent_visibility);
|
||||
@ -52,7 +47,7 @@ WelcomeWidget::WelcomeWidget(QWidget* parent)
|
||||
connect(m_ui->buttonOpenDatabase, SIGNAL(clicked()), SIGNAL(openDatabase()));
|
||||
connect(m_ui->buttonImportKeePass1, SIGNAL(clicked()), SIGNAL(importKeePass1Database()));
|
||||
connect(m_ui->buttonImportCSV, SIGNAL(clicked()), SIGNAL(importCsv()));
|
||||
connect(m_ui->recentListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this,
|
||||
connect(m_ui->recentListWidget, SIGNAL(itemActivated(QListWidgetItem*)), this,
|
||||
SLOT(openDatabaseFromFile(QListWidgetItem*)));
|
||||
}
|
||||
|
||||
@ -67,3 +62,14 @@ void WelcomeWidget::openDatabaseFromFile(QListWidgetItem* item)
|
||||
}
|
||||
emit openDatabaseFile(item->text());
|
||||
}
|
||||
|
||||
void WelcomeWidget::refreshLastDatabases()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -32,6 +32,7 @@ class WelcomeWidget : public QWidget
|
||||
public:
|
||||
explicit WelcomeWidget(QWidget* parent = nullptr);
|
||||
~WelcomeWidget();
|
||||
void refreshLastDatabases();
|
||||
|
||||
signals:
|
||||
void newDatabase();
|
||||
|
Loading…
Reference in New Issue
Block a user