Rename KeyOpenDialog to DatabaseOpenDialog.

This commit is contained in:
Felix Geyer 2012-04-05 18:31:12 +02:00
parent a282745efc
commit 9d1838a0fe
7 changed files with 28 additions and 28 deletions

View File

@ -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
)

View File

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "KeyOpenDialog.h"
#include "ui_KeyOpenDialog.h"
#include "DatabaseOpenDialog.h"
#include "ui_DatabaseOpenDialog.h"
#include <QtGui/QMessageBox>
@ -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);

View File

@ -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<Ui::KeyOpenDialog> m_ui;
QScopedPointer<Ui::DatabaseOpenDialog> m_ui;
CompositeKey m_key;
QString m_filename;
Q_DISABLE_COPY(KeyOpenDialog)
Q_DISABLE_COPY(DatabaseOpenDialog)
};
#endif // KEEPASSX_KEYOPENDIALOG_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KeyOpenDialog</class>
<widget class="QDialog" name="KeyOpenDialog">
<class>DatabaseOpenDialog</class>
<widget class="QDialog" name="DatabaseOpenDialog">
<property name="geometry">
<rect>
<x>0</x>

View File

@ -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);

View File

@ -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<Database*, DatabaseManagerStruct> m_dbList;
DatabaseManagerStruct m_curDbStruct;
KeyOpenDialog* m_curKeyDialog;
DatabaseOpenDialog* m_curKeyDialog;
};
#endif // KEEPASSX_DATABASETABWIDGET_H

View File

@ -42,7 +42,7 @@ void TestGui::testOpenDatabase()
QAction* actionDatabaseOpen = m_mainWindow->findChild<QAction*>("actionDatabaseOpen");
fileDialog()->setNextFileName(QString(KEEPASSX_TEST_DATA_DIR).append("/NewDatabase.kdbx"));
actionDatabaseOpen->trigger();
QWidget* keyDialog = m_mainWindow->findChild<QWidget*>("KeyOpenDialog");
QWidget* keyDialog = m_mainWindow->findChild<QWidget*>("DatabaseOpenDialog");
QVERIFY(keyDialog);
QTest::qWaitForWindowShown(keyDialog);