Add dummy PasswordGeneratorWidget.

Refs #52
This commit is contained in:
Florian Geyer 2013-03-10 22:23:10 +01:00
parent f9dc314e72
commit 870417d9c4
7 changed files with 153 additions and 11 deletions

View File

@ -81,6 +81,7 @@ set(keepassx_SOURCES
gui/KeePass1OpenWidget.cpp
gui/LineEdit.cpp
gui/MainWindow.cpp
gui/PasswordGeneratorWidget.cpp
gui/SettingsWidget.cpp
gui/SortFilterHideProxyModel.cpp
gui/UnlockDatabaseWidget.cpp
@ -142,6 +143,7 @@ set(keepassx_MOC
gui/KeePass1OpenWidget.h
gui/LineEdit.h
gui/MainWindow.h
gui/PasswordGeneratorWidget.h
gui/SettingsWidget.h
gui/SortFilterHideProxyModel.h
gui/UnlockDatabaseWidget.h
@ -173,6 +175,7 @@ set(keepassx_FORMS
gui/EditWidgetIcons.ui
gui/EditWidgetProperties.ui
gui/MainWindow.ui
gui/PasswordGeneratorWidget.ui
gui/SearchWidget.ui
gui/SettingsWidgetGeneral.ui
gui/SettingsWidgetSecurity.ui

View File

@ -0,0 +1,31 @@
/*
* Copyright (C) 2013 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 "PasswordGeneratorWidget.h"
#include "ui_PasswordGeneratorWidget.h"
PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent)
: QWidget(parent)
, m_ui(new Ui::PasswordGeneratorWidget())
{
m_ui->setupUi(this);
}
PasswordGeneratorWidget::~PasswordGeneratorWidget()
{
;
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (C) 2013 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_PASSWORDGENERATORWIDGET_H
#define KEEPASSX_PASSWORDGENERATORWIDGET_H
#include <QtGui/QWidget>
#include "core/Global.h"
namespace Ui {
class PasswordGeneratorWidget;
}
class PasswordGeneratorWidget : public QWidget
{
Q_OBJECT
public:
explicit PasswordGeneratorWidget(QWidget* parent = Q_NULLPTR);
~PasswordGeneratorWidget();
private:
const QScopedPointer<Ui::PasswordGeneratorWidget> m_ui;
};
#endif // KEEPASSX_PASSWORDGENERATORWIDGET_H

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PasswordGeneratorWidget</class>
<widget class="QWidget" name="PasswordGeneratorWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>383</width>
<height>181</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Password Generator</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -89,12 +89,15 @@ void EditEntryWidget::setupMain()
add(tr("Entry"), m_mainWidget);
connect(m_mainUi->togglePasswordButton, SIGNAL(toggled(bool)), SLOT(togglePassword(bool)));
connect(m_mainUi->tooglePasswordGeneratorButton, SIGNAL(toggled(bool)), SLOT(togglePasswordGeneratorButton(bool)));
connect(m_mainUi->expireCheck, SIGNAL(toggled(bool)), m_mainUi->expireDatePicker, SLOT(setEnabled(bool)));
connect(m_mainUi->passwordEdit, SIGNAL(textEdited(QString)), SLOT(setPasswordCheckColors()));
connect(m_mainUi->passwordRepeatEdit, SIGNAL(textEdited(QString)), SLOT(setPasswordCheckColors()));
m_mainUi->expirePresets->setMenu(createPresetsMenu());
connect(m_mainUi->expirePresets->menu(), SIGNAL(triggered(QAction*)), this, SLOT(useExpiryPreset(QAction*)));
m_mainUi->passwordGenerator->hide();
}
void EditEntryWidget::setupAdvanced()
@ -276,6 +279,7 @@ void EditEntryWidget::setForms(const Entry* entry, bool restore)
m_mainUi->expireCheck->setEnabled(!m_history);
m_mainUi->expireDatePicker->setReadOnly(m_history);
m_mainUi->notesEdit->setReadOnly(m_history);
m_mainUi->tooglePasswordGeneratorButton->setChecked(false);
m_advancedUi->addAttachmentButton->setEnabled(!m_history);
m_advancedUi->removeAttachmentButton->setEnabled(!m_history);
m_advancedUi->addAttributeButton->setEnabled(!m_history);
@ -478,6 +482,11 @@ void EditEntryWidget::togglePassword(bool checked)
m_mainUi->passwordRepeatEdit->setEchoMode(checked ? QLineEdit::Password : QLineEdit::Normal);
}
void EditEntryWidget::togglePasswordGeneratorButton(bool checked)
{
m_mainUi->passwordGenerator->setVisible(checked);
}
bool EditEntryWidget::passwordsEqual()
{
return m_mainUi->passwordEdit->text() == m_mainUi->passwordRepeatEdit->text();

View File

@ -63,6 +63,7 @@ public:
void createPresetsMenu(QMenu* expirePresetsMenu);
QString entryTitle() const;
Q_SIGNALS:
void editFinished(bool accepted);
void historyEntryActivated(Entry* entry);
@ -71,6 +72,7 @@ private Q_SLOTS:
void saveEntry();
void cancel();
void togglePassword(bool checked);
void togglePasswordGeneratorButton(bool checked);
void setPasswordCheckColors();
void insertAttribute();
void editCurrentAttribute();

View File

@ -75,28 +75,45 @@
</item>
</layout>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="passwordRepeatLabel">
<property name="text">
<string>Repeat:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="passwordRepeatEdit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLineEdit" name="passwordRepeatEdit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tooglePasswordGeneratorButton">
<property name="text">
<string>Gen.</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<item row="6" column="1">
<widget class="PasswordGeneratorWidget" name="passwordGenerator" native="true"/>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="expireCheck">
<property name="text">
<string>Expires</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="7" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QDateTimeEdit" name="expireDatePicker">
@ -117,14 +134,14 @@
</item>
</layout>
</item>
<item row="6" column="0">
<item row="8" column="0">
<widget class="QLabel" name="notesLabel">
<property name="text">
<string>Notes:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="8" column="1">
<widget class="QPlainTextEdit" name="notesEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -136,6 +153,14 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>PasswordGeneratorWidget</class>
<extends>QWidget</extends>
<header>gui/PasswordGeneratorWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>titleEdit</tabstop>
<tabstop>usernameEdit</tabstop>
@ -143,9 +168,11 @@
<tabstop>passwordEdit</tabstop>
<tabstop>passwordRepeatEdit</tabstop>
<tabstop>togglePasswordButton</tabstop>
<tabstop>tooglePasswordGeneratorButton</tabstop>
<tabstop>expireCheck</tabstop>
<tabstop>expireDatePicker</tabstop>
<tabstop>expirePresets</tabstop>
<tabstop>notesEdit</tabstop>
</tabstops>
<resources/>
<connections/>