mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
parent
a16f7e7cca
commit
0755702fe3
@ -39,6 +39,12 @@ MainWindow::MainWindow()
|
|||||||
toggleViewAction->setText(tr("Show toolbar"));
|
toggleViewAction->setText(tr("Show toolbar"));
|
||||||
m_ui->menuView->addAction(toggleViewAction);
|
m_ui->menuView->addAction(toggleViewAction);
|
||||||
|
|
||||||
|
m_clearHistoryAction = new QAction("Clear history", m_ui->menuFile);
|
||||||
|
m_lastDatabasesActions = new QActionGroup(m_ui->menuRecentDatabases);
|
||||||
|
connect(m_clearHistoryAction, SIGNAL(triggered()), this, SLOT(clearLastDatabases()));
|
||||||
|
connect(m_lastDatabasesActions, SIGNAL(triggered(QAction*)), this, SLOT(openRecentDatabase(QAction*)));
|
||||||
|
connect(m_ui->menuRecentDatabases, SIGNAL(aboutToShow()), this, SLOT(updateLastDatabasesMenu()));
|
||||||
|
|
||||||
Qt::Key globalAutoTypeKey = static_cast<Qt::Key>(config()->get("GlobalAutoTypeKey").toInt());
|
Qt::Key globalAutoTypeKey = static_cast<Qt::Key>(config()->get("GlobalAutoTypeKey").toInt());
|
||||||
Qt::KeyboardModifiers globalAutoTypeModifiers = static_cast<Qt::KeyboardModifiers>(
|
Qt::KeyboardModifiers globalAutoTypeModifiers = static_cast<Qt::KeyboardModifiers>(
|
||||||
config()->get("GlobalAutoTypeModifiers").toInt());
|
config()->get("GlobalAutoTypeModifiers").toInt());
|
||||||
@ -145,6 +151,28 @@ MainWindow::~MainWindow()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateLastDatabasesMenu() {
|
||||||
|
m_ui->menuRecentDatabases->clear();
|
||||||
|
|
||||||
|
QStringList lastDatabases = config()->get("LastDatabases", QVariant()).toStringList();
|
||||||
|
Q_FOREACH (const QString& database, lastDatabases) {
|
||||||
|
QAction* action = m_ui->menuRecentDatabases->addAction(database);
|
||||||
|
m_lastDatabasesActions->addAction(action);
|
||||||
|
}
|
||||||
|
m_ui->menuRecentDatabases->addSeparator();
|
||||||
|
m_ui->menuRecentDatabases->addAction(m_clearHistoryAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::openRecentDatabase(QAction* action)
|
||||||
|
{
|
||||||
|
openDatabase(action->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::clearLastDatabases()
|
||||||
|
{
|
||||||
|
config()->set("LastDatabases", QVariant());
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::openDatabase(const QString& fileName, const QString& pw, const QString& keyFile)
|
void MainWindow::openDatabase(const QString& fileName, const QString& pw, const QString& keyFile)
|
||||||
{
|
{
|
||||||
m_ui->tabWidget->openDatabase(fileName, pw, keyFile);
|
m_ui->tabWidget->openDatabase(fileName, pw, keyFile);
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#ifndef KEEPASSX_MAINWINDOW_H
|
#ifndef KEEPASSX_MAINWINDOW_H
|
||||||
#define KEEPASSX_MAINWINDOW_H
|
#define KEEPASSX_MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QtGui/QActionGroup>
|
||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
|
|
||||||
#include "gui/DatabaseWidget.h"
|
#include "gui/DatabaseWidget.h"
|
||||||
@ -48,6 +49,9 @@ private Q_SLOTS:
|
|||||||
void switchToDatabases();
|
void switchToDatabases();
|
||||||
void switchToSettings();
|
void switchToSettings();
|
||||||
void databaseTabChanged(int tabIndex);
|
void databaseTabChanged(int tabIndex);
|
||||||
|
void openRecentDatabase(QAction* action);
|
||||||
|
void clearLastDatabases();
|
||||||
|
void updateLastDatabasesMenu();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback = 0);
|
static void setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback = 0);
|
||||||
@ -55,6 +59,8 @@ private:
|
|||||||
static const QString BaseWindowTitle;
|
static const QString BaseWindowTitle;
|
||||||
|
|
||||||
const QScopedPointer<Ui::MainWindow> m_ui;
|
const QScopedPointer<Ui::MainWindow> m_ui;
|
||||||
|
QAction* m_clearHistoryAction;
|
||||||
|
QActionGroup* m_lastDatabasesActions;
|
||||||
|
|
||||||
Q_DISABLE_COPY(MainWindow)
|
Q_DISABLE_COPY(MainWindow)
|
||||||
};
|
};
|
||||||
|
@ -77,8 +77,14 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Database</string>
|
<string>Database</string>
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QMenu" name="menuRecentDatabases">
|
||||||
|
<property name="title">
|
||||||
|
<string>Recent databases</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
<addaction name="actionDatabaseNew"/>
|
<addaction name="actionDatabaseNew"/>
|
||||||
<addaction name="actionDatabaseOpen"/>
|
<addaction name="actionDatabaseOpen"/>
|
||||||
|
<addaction name="menuRecentDatabases"/>
|
||||||
<addaction name="actionDatabaseSave"/>
|
<addaction name="actionDatabaseSave"/>
|
||||||
<addaction name="actionDatabaseSaveAs"/>
|
<addaction name="actionDatabaseSaveAs"/>
|
||||||
<addaction name="actionDatabaseClose"/>
|
<addaction name="actionDatabaseClose"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user