diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b12237d0..6986be56 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -68,6 +68,7 @@ set(keepassx_SOURCES
gui/KeePass1OpenDialog.cpp
gui/LineEdit.cpp
gui/MainWindow.cpp
+ gui/SettingsWidget.cpp
gui/entry/EditEntryWidget.cpp
gui/entry/EntryAttachmentsModel.cpp
gui/entry/EntryAttributesModel.cpp
@@ -110,6 +111,7 @@ set(keepassx_MOC
gui/KeePass1OpenDialog.h
gui/LineEdit.h
gui/MainWindow.h
+ gui/SettingsWidget.h
gui/entry/EditEntryWidget.h
gui/entry/EntryAttachmentsModel.h
gui/entry/EntryAttributesModel.h
@@ -135,6 +137,7 @@ set(keepassx_FORMS
gui/EditWidgetIcons.ui
gui/MainWindow.ui
gui/SearchWidget.ui
+ gui/SettingsWidgetSecurity.ui
gui/entry/EditEntryWidgetAdvanced.ui
gui/entry/EditEntryWidgetHistory.ui
gui/entry/EditEntryWidgetMain.ui
diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp
index b4787560..c2563ad7 100644
--- a/src/gui/MainWindow.cpp
+++ b/src/gui/MainWindow.cpp
@@ -52,6 +52,9 @@ MainWindow::MainWindow()
SLOT(updateWindowTitle()));
connect(m_ui->tabWidget, SIGNAL(currentChanged(int)),
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,
SLOT(newDatabase()));
@@ -70,7 +73,6 @@ MainWindow::MainWindow()
connect(m_ui->actionImportKeePass1, SIGNAL(triggered()), m_ui->tabWidget,
SLOT(importKeePass1Database()));
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,
SLOT(createEntry()));
@@ -92,6 +94,10 @@ MainWindow::MainWindow()
connect(m_ui->actionGroupDelete, SIGNAL(triggered()), m_ui->tabWidget,
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,
SLOT(toggleSearch()));
}
@@ -109,8 +115,9 @@ const QString MainWindow::BaseWindowTitle = "KeePassX";
void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
{
- if (m_ui->tabWidget->currentIndex() != -1) {
- m_ui->actionDatabaseClose->setEnabled(true);
+ bool inDatabaseTabWidget = (m_ui->stackedWidget->currentIndex() == 0);
+
+ if (inDatabaseTabWidget && m_ui->tabWidget->currentIndex() != -1) {
DatabaseWidget* dbWidget = m_ui->tabWidget->currentDatabaseWidget();
Q_ASSERT(dbWidget);
@@ -179,6 +186,10 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
m_ui->actionDatabaseClose->setEnabled(false);
}
+
+ m_ui->actionDatabaseNew->setEnabled(inDatabaseTabWidget);
+ m_ui->actionDatabaseOpen->setEnabled(inDatabaseTabWidget);
+ m_ui->actionImportKeePass1->setEnabled(inDatabaseTabWidget);
}
void MainWindow::updateWindowTitle()
@@ -198,6 +209,17 @@ void MainWindow::showAboutDialog()
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) {
if (!m_ui->tabWidget->closeAllDatabases()) {
event->ignore();
diff --git a/src/gui/MainWindow.h b/src/gui/MainWindow.h
index 026330d6..b97d59a2 100644
--- a/src/gui/MainWindow.h
+++ b/src/gui/MainWindow.h
@@ -45,6 +45,8 @@ private Q_SLOTS:
void setMenuActionState(DatabaseWidget::Mode mode = DatabaseWidget::None);
void updateWindowTitle();
void showAboutDialog();
+ void switchToDatabases();
+ void switchToSettings();
private:
static void setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback = 0);
diff --git a/src/gui/MainWindow.ui b/src/gui/MainWindow.ui
index b299f558..0bf4d6a6 100644
--- a/src/gui/MainWindow.ui
+++ b/src/gui/MainWindow.ui
@@ -16,16 +16,34 @@
-
-
+
- -1
-
-
- true
-
-
- true
+ 0
+
+
+
-
+
+
+ -1
+
+
+ true
+
+
+ true
+
+
+
+
+
+
+
+ -
+
+
+
+
@@ -81,9 +99,16 @@
+
+
@@ -252,6 +277,11 @@
Copy password to clipboard
+
+
+ Settings
+
+
@@ -260,6 +290,12 @@
1
+
+ SettingsWidget
+ QWidget
+
+ 1
+
diff --git a/src/gui/SettingsWidget.cpp b/src/gui/SettingsWidget.cpp
new file mode 100644
index 00000000..04cfa3b4
--- /dev/null
+++ b/src/gui/SettingsWidget.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 Felix Geyer
+ *
+ * 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 .
+ */
+
+#include "SettingsWidget.h"
+#include "ui_SettingsWidgetSecurity.h"
+
+#include
+
+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()
+{
+}
diff --git a/src/gui/SettingsWidget.h b/src/gui/SettingsWidget.h
new file mode 100644
index 00000000..eea5920a
--- /dev/null
+++ b/src/gui/SettingsWidget.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2012 Felix Geyer
+ *
+ * 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 .
+ */
+
+#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 m_secUi;
+};
+
+#endif // KEEPASSX_SETTINGSWIDGET_H
diff --git a/src/gui/SettingsWidgetSecurity.ui b/src/gui/SettingsWidgetSecurity.ui
new file mode 100644
index 00000000..4c6d45ec
--- /dev/null
+++ b/src/gui/SettingsWidgetSecurity.ui
@@ -0,0 +1,41 @@
+
+
+ SettingsWidgetSecurity
+
+
+
+ 0
+ 0
+ 374
+ 303
+
+
+
+ -
+
+
+ Clear clipboard after
+
+
+ true
+
+
+
+ -
+
+
+ sec
+
+
+ 1
+
+
+ 999
+
+
+
+
+
+
+
+