From 9d1838a0fe28f0c4b622adeafeb58c228bce9f90 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Thu, 5 Apr 2012 18:31:12 +0200 Subject: [PATCH] Rename KeyOpenDialog to DatabaseOpenDialog. --- src/CMakeLists.txt | 6 ++--- ...yOpenDialog.cpp => DatabaseOpenDialog.cpp} | 24 +++++++++---------- .../{KeyOpenDialog.h => DatabaseOpenDialog.h} | 12 +++++----- ...KeyOpenDialog.ui => DatabaseOpenDialog.ui} | 4 ++-- src/gui/DatabaseTabWidget.cpp | 4 ++-- src/gui/DatabaseTabWidget.h | 4 ++-- tests/gui/TestGui.cpp | 2 +- 7 files changed, 28 insertions(+), 28 deletions(-) rename src/gui/{KeyOpenDialog.cpp => DatabaseOpenDialog.cpp} (86%) rename src/gui/{KeyOpenDialog.h => DatabaseOpenDialog.h} (82%) rename src/gui/{KeyOpenDialog.ui => DatabaseOpenDialog.ui} (96%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ed5478afa..31cd09907 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -47,6 +47,7 @@ set(keepassx_SOURCES format/KeePass2XmlReader.cpp format/KeePass2XmlWriter.cpp gui/ChangeMasterKeyWidget.cpp + gui/DatabaseOpenDialog.cpp gui/DatabaseTabWidget.cpp gui/DatabaseWidget.cpp gui/EditEntryWidget.cpp @@ -56,7 +57,6 @@ set(keepassx_SOURCES gui/FileDialog.cpp gui/GroupModel.cpp gui/GroupView.cpp - gui/KeyOpenDialog.cpp gui/MainWindow.cpp keys/CompositeKey.cpp keys/FileKey.cpp @@ -74,6 +74,7 @@ set(keepassx_MOC core/Group.h core/Metadata.h gui/ChangeMasterKeyWidget.h + gui/DatabaseOpenDialog.h gui/DatabaseTabWidget.h gui/DatabaseWidget.h gui/EditEntryWidget.h @@ -82,7 +83,6 @@ set(keepassx_MOC gui/EntryView.h gui/GroupModel.h gui/GroupView.h - gui/KeyOpenDialog.h gui/MainWindow.h streams/HashedBlockStream.h streams/LayeredStream.h @@ -92,11 +92,11 @@ set(keepassx_MOC set(keepassx_FORMS gui/ChangeMasterKeyWidget.ui + gui/DatabaseOpenDialog.ui gui/EditEntryWidget.ui gui/EditEntryWidgetMain.ui gui/EditEntryWidgetNotes.ui gui/EditGroupWidget.ui - gui/KeyOpenDialog.ui gui/MainWindow.ui ) diff --git a/src/gui/KeyOpenDialog.cpp b/src/gui/DatabaseOpenDialog.cpp similarity index 86% rename from src/gui/KeyOpenDialog.cpp rename to src/gui/DatabaseOpenDialog.cpp index 95631c3a4..802c53199 100644 --- a/src/gui/KeyOpenDialog.cpp +++ b/src/gui/DatabaseOpenDialog.cpp @@ -15,8 +15,8 @@ * along with this program. If not, see . */ -#include "KeyOpenDialog.h" -#include "ui_KeyOpenDialog.h" +#include "DatabaseOpenDialog.h" +#include "ui_DatabaseOpenDialog.h" #include @@ -25,9 +25,9 @@ #include "keys/FileKey.h" #include "keys/PasswordKey.h" -KeyOpenDialog::KeyOpenDialog(const QString& filename, QWidget* parent) +DatabaseOpenDialog::DatabaseOpenDialog(const QString& filename, QWidget* parent) : QDialog(parent) - , m_ui(new Ui::KeyOpenDialog()) + , m_ui(new Ui::DatabaseOpenDialog()) , m_filename(filename) { m_ui->setupUi(this); @@ -54,16 +54,16 @@ KeyOpenDialog::KeyOpenDialog(const QString& filename, QWidget* parent) } } -KeyOpenDialog::~KeyOpenDialog() +DatabaseOpenDialog::~DatabaseOpenDialog() { } -CompositeKey KeyOpenDialog::key() +CompositeKey DatabaseOpenDialog::key() { return m_key; } -void KeyOpenDialog::createKey() +void DatabaseOpenDialog::createKey() { if (m_ui->checkPassword->isChecked()) { m_key.addKey(PasswordKey(m_ui->editPassword->text())); @@ -91,29 +91,29 @@ void KeyOpenDialog::createKey() accept(); } -void KeyOpenDialog::togglePassword(bool checked) +void DatabaseOpenDialog::togglePassword(bool checked) { m_ui->editPassword->setEchoMode(checked ? QLineEdit::Password : QLineEdit::Normal); } -void KeyOpenDialog::activatePassword() +void DatabaseOpenDialog::activatePassword() { m_ui->checkPassword->setChecked(true); } -void KeyOpenDialog::activateKeyFile() +void DatabaseOpenDialog::activateKeyFile() { m_ui->checkKeyFile->setChecked(true); } -void KeyOpenDialog::setOkButtonEnabled() +void DatabaseOpenDialog::setOkButtonEnabled() { bool enable = m_ui->checkPassword->isChecked() || (m_ui->checkKeyFile->isChecked() && !m_ui->comboKeyFile->currentText().isEmpty()); m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enable); } -void KeyOpenDialog::browseKeyFile() +void DatabaseOpenDialog::browseKeyFile() { QString filters = QString("%1 (*);;%2 (*.key)").arg(tr("All files"), tr("Key files")); QString filename = fileDialog()->getOpenFileName(this, tr("Select key file"), QString(), filters); diff --git a/src/gui/KeyOpenDialog.h b/src/gui/DatabaseOpenDialog.h similarity index 82% rename from src/gui/KeyOpenDialog.h rename to src/gui/DatabaseOpenDialog.h index 1962f80d5..e60873990 100644 --- a/src/gui/KeyOpenDialog.h +++ b/src/gui/DatabaseOpenDialog.h @@ -24,16 +24,16 @@ #include "keys/CompositeKey.h" namespace Ui { - class KeyOpenDialog; + class DatabaseOpenDialog; } -class KeyOpenDialog : public QDialog +class DatabaseOpenDialog : public QDialog { Q_OBJECT public: - explicit KeyOpenDialog(const QString& filename, QWidget* parent = 0); - ~KeyOpenDialog(); + explicit DatabaseOpenDialog(const QString& filename, QWidget* parent = 0); + ~DatabaseOpenDialog(); CompositeKey key(); private Q_SLOTS: @@ -45,11 +45,11 @@ private Q_SLOTS: void browseKeyFile(); private: - QScopedPointer m_ui; + QScopedPointer m_ui; CompositeKey m_key; QString m_filename; - Q_DISABLE_COPY(KeyOpenDialog) + Q_DISABLE_COPY(DatabaseOpenDialog) }; #endif // KEEPASSX_KEYOPENDIALOG_H diff --git a/src/gui/KeyOpenDialog.ui b/src/gui/DatabaseOpenDialog.ui similarity index 96% rename from src/gui/KeyOpenDialog.ui rename to src/gui/DatabaseOpenDialog.ui index 6f4aee6e7..58932bbac 100644 --- a/src/gui/KeyOpenDialog.ui +++ b/src/gui/DatabaseOpenDialog.ui @@ -1,7 +1,7 @@ - KeyOpenDialog - + DatabaseOpenDialog + 0 diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp index eb41ad058..e24773afa 100644 --- a/src/gui/DatabaseTabWidget.cpp +++ b/src/gui/DatabaseTabWidget.cpp @@ -27,7 +27,7 @@ #include "gui/FileDialog.h" #include "gui/EntryView.h" #include "gui/GroupView.h" -#include "gui/KeyOpenDialog.h" +#include "gui/DatabaseOpenDialog.h" DatabaseManagerStruct::DatabaseManagerStruct() : file(0) @@ -86,7 +86,7 @@ void DatabaseTabWidget::openDatabase(const QString& fileName) void DatabaseTabWidget::openDatabaseDialog() { - m_curKeyDialog = new KeyOpenDialog(m_curDbStruct.fileName, m_window); + m_curKeyDialog = new DatabaseOpenDialog(m_curDbStruct.fileName, m_window); connect(m_curKeyDialog, SIGNAL(accepted()), SLOT(openDatabaseRead())); connect(m_curKeyDialog, SIGNAL(rejected()), SLOT(openDatabaseCleanup())); m_curKeyDialog->setModal(true); diff --git a/src/gui/DatabaseTabWidget.h b/src/gui/DatabaseTabWidget.h index e1ae05b90..d69ca658d 100644 --- a/src/gui/DatabaseTabWidget.h +++ b/src/gui/DatabaseTabWidget.h @@ -26,7 +26,7 @@ #include "format/KeePass2Writer.h" class DatabaseWidget; -class KeyOpenDialog; +class DatabaseOpenDialog; class QFile; class QTabWidget; @@ -85,7 +85,7 @@ private: KeePass2Writer m_writer; QHash m_dbList; DatabaseManagerStruct m_curDbStruct; - KeyOpenDialog* m_curKeyDialog; + DatabaseOpenDialog* m_curKeyDialog; }; #endif // KEEPASSX_DATABASETABWIDGET_H diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index 51e9df4a9..f4de88fce 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -42,7 +42,7 @@ void TestGui::testOpenDatabase() QAction* actionDatabaseOpen = m_mainWindow->findChild("actionDatabaseOpen"); fileDialog()->setNextFileName(QString(KEEPASSX_TEST_DATA_DIR).append("/NewDatabase.kdbx")); actionDatabaseOpen->trigger(); - QWidget* keyDialog = m_mainWindow->findChild("KeyOpenDialog"); + QWidget* keyDialog = m_mainWindow->findChild("DatabaseOpenDialog"); QVERIFY(keyDialog); QTest::qWaitForWindowShown(keyDialog);