mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-28 15:27:18 -05:00
Add (not yet functional) SettingsWidget.
This commit is contained in:
parent
9fc62a1d81
commit
21a2e9583b
@ -68,6 +68,7 @@ set(keepassx_SOURCES
|
|||||||
gui/KeePass1OpenDialog.cpp
|
gui/KeePass1OpenDialog.cpp
|
||||||
gui/LineEdit.cpp
|
gui/LineEdit.cpp
|
||||||
gui/MainWindow.cpp
|
gui/MainWindow.cpp
|
||||||
|
gui/SettingsWidget.cpp
|
||||||
gui/entry/EditEntryWidget.cpp
|
gui/entry/EditEntryWidget.cpp
|
||||||
gui/entry/EntryAttachmentsModel.cpp
|
gui/entry/EntryAttachmentsModel.cpp
|
||||||
gui/entry/EntryAttributesModel.cpp
|
gui/entry/EntryAttributesModel.cpp
|
||||||
@ -110,6 +111,7 @@ set(keepassx_MOC
|
|||||||
gui/KeePass1OpenDialog.h
|
gui/KeePass1OpenDialog.h
|
||||||
gui/LineEdit.h
|
gui/LineEdit.h
|
||||||
gui/MainWindow.h
|
gui/MainWindow.h
|
||||||
|
gui/SettingsWidget.h
|
||||||
gui/entry/EditEntryWidget.h
|
gui/entry/EditEntryWidget.h
|
||||||
gui/entry/EntryAttachmentsModel.h
|
gui/entry/EntryAttachmentsModel.h
|
||||||
gui/entry/EntryAttributesModel.h
|
gui/entry/EntryAttributesModel.h
|
||||||
@ -135,6 +137,7 @@ set(keepassx_FORMS
|
|||||||
gui/EditWidgetIcons.ui
|
gui/EditWidgetIcons.ui
|
||||||
gui/MainWindow.ui
|
gui/MainWindow.ui
|
||||||
gui/SearchWidget.ui
|
gui/SearchWidget.ui
|
||||||
|
gui/SettingsWidgetSecurity.ui
|
||||||
gui/entry/EditEntryWidgetAdvanced.ui
|
gui/entry/EditEntryWidgetAdvanced.ui
|
||||||
gui/entry/EditEntryWidgetHistory.ui
|
gui/entry/EditEntryWidgetHistory.ui
|
||||||
gui/entry/EditEntryWidgetMain.ui
|
gui/entry/EditEntryWidgetMain.ui
|
||||||
|
@ -52,6 +52,9 @@ MainWindow::MainWindow()
|
|||||||
SLOT(updateWindowTitle()));
|
SLOT(updateWindowTitle()));
|
||||||
connect(m_ui->tabWidget, SIGNAL(currentChanged(int)),
|
connect(m_ui->tabWidget, SIGNAL(currentChanged(int)),
|
||||||
SLOT(updateWindowTitle()));
|
SLOT(updateWindowTitle()));
|
||||||
|
connect(m_ui->stackedWidget, SIGNAL(currentChanged(int)), SLOT(setMenuActionState()));
|
||||||
|
connect(m_ui->settingsWidget, SIGNAL(accepted()), SLOT(switchToDatabases()));
|
||||||
|
connect(m_ui->settingsWidget, SIGNAL(rejected()), SLOT(switchToDatabases()));
|
||||||
|
|
||||||
connect(m_ui->actionDatabaseNew, SIGNAL(triggered()), m_ui->tabWidget,
|
connect(m_ui->actionDatabaseNew, SIGNAL(triggered()), m_ui->tabWidget,
|
||||||
SLOT(newDatabase()));
|
SLOT(newDatabase()));
|
||||||
@ -70,7 +73,6 @@ MainWindow::MainWindow()
|
|||||||
connect(m_ui->actionImportKeePass1, SIGNAL(triggered()), m_ui->tabWidget,
|
connect(m_ui->actionImportKeePass1, SIGNAL(triggered()), m_ui->tabWidget,
|
||||||
SLOT(importKeePass1Database()));
|
SLOT(importKeePass1Database()));
|
||||||
connect(m_ui->actionQuit, SIGNAL(triggered()), SLOT(close()));
|
connect(m_ui->actionQuit, SIGNAL(triggered()), SLOT(close()));
|
||||||
connect(m_ui->actionAbout, SIGNAL(triggered()), SLOT(showAboutDialog()));
|
|
||||||
|
|
||||||
connect(m_ui->actionEntryNew, SIGNAL(triggered()), m_ui->tabWidget,
|
connect(m_ui->actionEntryNew, SIGNAL(triggered()), m_ui->tabWidget,
|
||||||
SLOT(createEntry()));
|
SLOT(createEntry()));
|
||||||
@ -92,6 +94,10 @@ MainWindow::MainWindow()
|
|||||||
connect(m_ui->actionGroupDelete, SIGNAL(triggered()), m_ui->tabWidget,
|
connect(m_ui->actionGroupDelete, SIGNAL(triggered()), m_ui->tabWidget,
|
||||||
SLOT(deleteGroup()));
|
SLOT(deleteGroup()));
|
||||||
|
|
||||||
|
connect(m_ui->actionSettings, SIGNAL(triggered()), SLOT(switchToSettings()));
|
||||||
|
|
||||||
|
connect(m_ui->actionAbout, SIGNAL(triggered()), SLOT(showAboutDialog()));
|
||||||
|
|
||||||
connect(m_ui->actionSearch, SIGNAL(triggered()), m_ui->tabWidget,
|
connect(m_ui->actionSearch, SIGNAL(triggered()), m_ui->tabWidget,
|
||||||
SLOT(toggleSearch()));
|
SLOT(toggleSearch()));
|
||||||
}
|
}
|
||||||
@ -109,8 +115,9 @@ const QString MainWindow::BaseWindowTitle = "KeePassX";
|
|||||||
|
|
||||||
void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
||||||
{
|
{
|
||||||
if (m_ui->tabWidget->currentIndex() != -1) {
|
bool inDatabaseTabWidget = (m_ui->stackedWidget->currentIndex() == 0);
|
||||||
m_ui->actionDatabaseClose->setEnabled(true);
|
|
||||||
|
if (inDatabaseTabWidget && m_ui->tabWidget->currentIndex() != -1) {
|
||||||
DatabaseWidget* dbWidget = m_ui->tabWidget->currentDatabaseWidget();
|
DatabaseWidget* dbWidget = m_ui->tabWidget->currentDatabaseWidget();
|
||||||
Q_ASSERT(dbWidget);
|
Q_ASSERT(dbWidget);
|
||||||
|
|
||||||
@ -179,6 +186,10 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
|||||||
|
|
||||||
m_ui->actionDatabaseClose->setEnabled(false);
|
m_ui->actionDatabaseClose->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_ui->actionDatabaseNew->setEnabled(inDatabaseTabWidget);
|
||||||
|
m_ui->actionDatabaseOpen->setEnabled(inDatabaseTabWidget);
|
||||||
|
m_ui->actionImportKeePass1->setEnabled(inDatabaseTabWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateWindowTitle()
|
void MainWindow::updateWindowTitle()
|
||||||
@ -198,6 +209,17 @@ void MainWindow::showAboutDialog()
|
|||||||
aboutDialog->show();
|
aboutDialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::switchToDatabases()
|
||||||
|
{
|
||||||
|
m_ui->stackedWidget->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::switchToSettings()
|
||||||
|
{
|
||||||
|
m_ui->settingsWidget->loadSettings();
|
||||||
|
m_ui->stackedWidget->setCurrentIndex(1);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent* event) {
|
void MainWindow::closeEvent(QCloseEvent* event) {
|
||||||
if (!m_ui->tabWidget->closeAllDatabases()) {
|
if (!m_ui->tabWidget->closeAllDatabases()) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
@ -45,6 +45,8 @@ private Q_SLOTS:
|
|||||||
void setMenuActionState(DatabaseWidget::Mode mode = DatabaseWidget::None);
|
void setMenuActionState(DatabaseWidget::Mode mode = DatabaseWidget::None);
|
||||||
void updateWindowTitle();
|
void updateWindowTitle();
|
||||||
void showAboutDialog();
|
void showAboutDialog();
|
||||||
|
void switchToDatabases();
|
||||||
|
void switchToSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback = 0);
|
static void setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback = 0);
|
||||||
|
@ -16,16 +16,34 @@
|
|||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="DatabaseTabWidget" name="tabWidget">
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>-1</number>
|
<number>0</number>
|
||||||
</property>
|
|
||||||
<property name="tabsClosable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="movable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QWidget" name="pageDatabase">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="DatabaseTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
<property name="tabsClosable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="movable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="pageSettings">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="SettingsWidget" name="settingsWidget" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -81,9 +99,16 @@
|
|||||||
<addaction name="actionGroupEdit"/>
|
<addaction name="actionGroupEdit"/>
|
||||||
<addaction name="actionGroupDelete"/>
|
<addaction name="actionGroupDelete"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuExtras">
|
||||||
|
<property name="title">
|
||||||
|
<string>Extras</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionSettings"/>
|
||||||
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
<addaction name="menuEntries"/>
|
<addaction name="menuEntries"/>
|
||||||
<addaction name="menuGroups"/>
|
<addaction name="menuGroups"/>
|
||||||
|
<addaction name="menuExtras"/>
|
||||||
<addaction name="menuHelp"/>
|
<addaction name="menuHelp"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="toolBar">
|
<widget class="QToolBar" name="toolBar">
|
||||||
@ -252,6 +277,11 @@
|
|||||||
<string>Copy password to clipboard</string>
|
<string>Copy password to clipboard</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionSettings">
|
||||||
|
<property name="text">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
@ -260,6 +290,12 @@
|
|||||||
<header>gui/DatabaseTabWidget.h</header>
|
<header>gui/DatabaseTabWidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>SettingsWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/SettingsWidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
50
src/gui/SettingsWidget.cpp
Normal file
50
src/gui/SettingsWidget.cpp
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 2 or (at your option)
|
||||||
|
* version 3 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "SettingsWidget.h"
|
||||||
|
#include "ui_SettingsWidgetSecurity.h"
|
||||||
|
|
||||||
|
#include <QtGui/QLabel>
|
||||||
|
|
||||||
|
SettingsWidget::SettingsWidget(QWidget* parent)
|
||||||
|
: EditWidget(parent)
|
||||||
|
, m_secWidget(new QWidget())
|
||||||
|
, m_secUi(new Ui::SettingsWidgetSecurity())
|
||||||
|
{
|
||||||
|
headlineLabel()->setText(tr("Application Settings"));
|
||||||
|
|
||||||
|
m_secUi->setupUi(m_secWidget);
|
||||||
|
add(tr("Security"), m_secWidget);
|
||||||
|
|
||||||
|
connect(this, SIGNAL(accepted()), SLOT(saveSettings()));
|
||||||
|
|
||||||
|
connect(m_secUi->clearClipboardCheckBox, SIGNAL(toggled(bool)),
|
||||||
|
m_secUi->clearClipboardSpinBox, SLOT(setEnabled(bool)));
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsWidget::~SettingsWidget()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsWidget::loadSettings()
|
||||||
|
{
|
||||||
|
setCurrentRow(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsWidget::saveSettings()
|
||||||
|
{
|
||||||
|
}
|
44
src/gui/SettingsWidget.h
Normal file
44
src/gui/SettingsWidget.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 2 or (at your option)
|
||||||
|
* version 3 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef KEEPASSX_SETTINGSWIDGET_H
|
||||||
|
#define KEEPASSX_SETTINGSWIDGET_H
|
||||||
|
|
||||||
|
#include "gui/EditWidget.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class SettingsWidgetSecurity;
|
||||||
|
}
|
||||||
|
|
||||||
|
class SettingsWidget : public EditWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit SettingsWidget(QWidget* parent = 0);
|
||||||
|
~SettingsWidget();
|
||||||
|
void loadSettings();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void saveSettings();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QWidget* const m_secWidget;
|
||||||
|
const QScopedPointer<Ui::SettingsWidgetSecurity> m_secUi;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // KEEPASSX_SETTINGSWIDGET_H
|
41
src/gui/SettingsWidgetSecurity.ui
Normal file
41
src/gui/SettingsWidgetSecurity.ui
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>SettingsWidgetSecurity</class>
|
||||||
|
<widget class="QWidget" name="SettingsWidgetSecurity">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>374</width>
|
||||||
|
<height>303</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QCheckBox" name="clearClipboardCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Clear clipboard after</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="clearClipboardSpinBox">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> sec</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>999</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
x
Reference in New Issue
Block a user