Merge remote-tracking branch 'origin/feature/autoreload-db' into develop

This commit is contained in:
Jonathan White 2016-11-25 12:04:44 -05:00
commit 3d249365c2
No known key found for this signature in database
GPG key ID: 506BDC439519BC13
39 changed files with 28723 additions and 495 deletions

View file

@ -113,12 +113,6 @@ void DatabaseOpenWidget::openDatabase()
if (m_db) {
Q_EMIT editFinished(true);
// this is a c++11 equivalent foreach construct
// if c++11 is not available another iteration loop style is needed!
for (auto widget : qApp->topLevelWidgets()) {
if(widget->inherits("QMainWindow"))
static_cast<MainWindow*>(widget)->configuredMinimizeWindow();
}
}
else {
MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n")

View file

@ -69,24 +69,6 @@
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="PasswordEdit" name="editPassword">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="buttonTogglePassword">
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@ -111,6 +93,24 @@
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="PasswordEdit" name="editPassword">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="buttonTogglePassword">
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>

View file

@ -39,6 +39,7 @@
#include "http/HttpSettings.h"
#include "http/OptionDialog.h"
#include "gui/SettingsWidget.h"
#include "gui/PasswordGeneratorWidget.h"
class HttpPlugin: public ISettingsPage
{
@ -168,6 +169,7 @@ MainWindow::MainWindow()
m_ui->actionGroupDelete->setIcon(filePath()->icon("actions", "group-delete", false));
m_ui->actionSettings->setIcon(filePath()->icon("actions", "configure"));
m_ui->actionPasswordGenerator->setIcon(filePath()->icon("actions", "password-generator", false));
m_ui->actionAbout->setIcon(filePath()->icon("actions", "help-about"));
@ -261,6 +263,8 @@ MainWindow::MainWindow()
SLOT(deleteGroup()));
connect(m_ui->actionSettings, SIGNAL(triggered()), SLOT(switchToSettings()));
connect(m_ui->actionPasswordGenerator, SIGNAL(toggled(bool)), SLOT(switchToPasswordGen(bool)));
connect(m_ui->passwordGeneratorWidget, SIGNAL(dialogTerminated()), SLOT(closePasswordGen()));
connect(m_ui->actionAbout, SIGNAL(triggered()), SLOT(showAboutDialog()));
@ -329,21 +333,20 @@ void MainWindow::openDatabase(const QString& fileName, const QString& pw, const
m_ui->tabWidget->openDatabase(fileName, pw, keyFile);
}
void MainWindow::configuredMinimizeWindow()
void MainWindow::minimizeWindow()
{
bool minimize = isTrayIconEnabled() &&
config()->get("GUI/MinimizeToTray").toBool() &&
config()->get("GUI/MinimizeOnClose").toBool() &&
config()->get("GUI/MinimizeOnStartup").toBool();
if (minimize) {
if (isTrayIconEnabled() && config()->get("GUI/MinimizeToTray").toBool()) {
hide();
} else {
setWindowState(Qt::WindowMinimized);
}
}
void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
{
bool inDatabaseTabWidget = (m_ui->stackedWidget->currentIndex() == 0);
bool inWelcomeWidget = (m_ui->stackedWidget->currentIndex() == 2);
int currentIndex = m_ui->stackedWidget->currentIndex();
bool inDatabaseTabWidget = (currentIndex == 0);
bool inWelcomeWidget = (currentIndex == 2);
if (inDatabaseTabWidget && m_ui->tabWidget->currentIndex() != -1) {
DatabaseWidget* dbWidget = m_ui->tabWidget->currentDatabaseWidget();
@ -455,6 +458,12 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
m_ui->actionRepairDatabase->setEnabled(inDatabaseTabWidgetOrWelcomeWidget);
m_ui->actionLockDatabases->setEnabled(m_ui->tabWidget->hasLockableDatabases());
if ((3 == currentIndex) != m_ui->actionPasswordGenerator->isChecked()) {
bool blocked = m_ui->actionPasswordGenerator->blockSignals(true);
m_ui->actionPasswordGenerator->toggle();
m_ui->actionPasswordGenerator->blockSignals(blocked);
}
}
void MainWindow::updateWindowTitle()
@ -503,6 +512,24 @@ void MainWindow::switchToSettings()
m_ui->stackedWidget->setCurrentIndex(1);
}
void MainWindow::switchToPasswordGen(bool enabled)
{
if (enabled == true) {
m_ui->passwordGeneratorWidget->loadSettings();
m_ui->passwordGeneratorWidget->regeneratePassword();
m_ui->passwordGeneratorWidget->setStandaloneMode(true);
m_ui->stackedWidget->setCurrentIndex(3);
} else {
m_ui->passwordGeneratorWidget->saveSettings();
switchToDatabases();
}
}
void MainWindow::closePasswordGen()
{
switchToPasswordGen(false);
}
void MainWindow::databaseStatusChanged(DatabaseWidget *)
{
updateTrayIcon();
@ -523,7 +550,6 @@ void MainWindow::databaseTabChanged(int tabIndex)
void MainWindow::closeEvent(QCloseEvent* event)
{
bool minimizeOnClose = isTrayIconEnabled() &&
config()->get("GUI/MinimizeToTray").toBool() &&
config()->get("GUI/MinimizeOnClose").toBool();
if (minimizeOnClose && !appExitCalled)
{

View file

@ -38,7 +38,7 @@ class MainWindow : public QMainWindow
public:
MainWindow();
~MainWindow();
void configuredMinimizeWindow();
void minimizeWindow();
public Q_SLOTS:
void openDatabase(const QString& fileName, const QString& pw = QString(),
@ -54,6 +54,8 @@ private Q_SLOTS:
void showAboutDialog();
void switchToDatabases();
void switchToSettings();
void switchToPasswordGen(bool enabled);
void closePasswordGen();
void databaseStatusChanged(DatabaseWidget *dbWidget);
void databaseTabChanged(int tabIndex);
void openRecentDatabase(QAction* action);

View file

@ -87,6 +87,13 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="pagePasswordGenerator">
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="PasswordGeneratorWidget" name="passwordGeneratorWidget" native="true"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
@ -171,6 +178,7 @@
<string>Tools</string>
</property>
<addaction name="actionLockDatabases"/>
<addaction name="actionPasswordGenerator"/>
<addaction name="actionSettings"/>
</widget>
<widget class="QMenu" name="menuView">
@ -205,6 +213,7 @@
<addaction name="actionEntryCopyUsername"/>
<addaction name="actionEntryCopyPassword"/>
<addaction name="separator"/>
<addaction name="actionPasswordGenerator"/>
<addaction name="actionLockDatabases"/>
<addaction name="separator"/>
</widget>
@ -372,6 +381,14 @@
<string>&amp;Settings</string>
</property>
</action>
<action name="actionPasswordGenerator">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Password Generator</string>
</property>
</action>
<action name="actionEntryAutoType">
<property name="enabled">
<bool>false</bool>
@ -453,6 +470,12 @@
<header>gui/WelcomeWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>PasswordGeneratorWidget</class>
<extends>QWidget</extends>
<header>gui/PasswordGeneratorWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>

View file

@ -17,6 +17,10 @@
#include "PasswordEdit.h"
#include "core/Config.h"
#include <QFontDatabase>
const QColor PasswordEdit::CorrectSoFarColor = QColor(255, 205, 15);
const QColor PasswordEdit::ErrorColor = QColor(255, 125, 125);
@ -24,6 +28,13 @@ PasswordEdit::PasswordEdit(QWidget* parent)
: QLineEdit(parent)
, m_basePasswordEdit(nullptr)
{
setEchoMode(QLineEdit::Password);
updateStylesheet();
// set font to system monospace font and increase letter spacing
QFont passwordFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
passwordFont.setLetterSpacing(QFont::PercentageSpacing, 110);
setFont(passwordFont);
}
void PasswordEdit::enableVerifyMode(PasswordEdit* basePasswordEdit)
@ -31,6 +42,8 @@ void PasswordEdit::enableVerifyMode(PasswordEdit* basePasswordEdit)
m_basePasswordEdit = basePasswordEdit;
updateStylesheet();
connect(m_basePasswordEdit, SIGNAL(textChanged(QString)), SLOT(autocompletePassword(QString)));
connect(m_basePasswordEdit, SIGNAL(textChanged(QString)), SLOT(updateStylesheet()));
connect(this, SIGNAL(textChanged(QString)), SLOT(updateStylesheet()));
@ -40,6 +53,21 @@ void PasswordEdit::enableVerifyMode(PasswordEdit* basePasswordEdit)
void PasswordEdit::setShowPassword(bool show)
{
setEchoMode(show ? QLineEdit::Normal : QLineEdit::Password);
// if I have a parent, I'm the child
if (m_basePasswordEdit){
if (config()->get("security/passwordsrepeat").toBool()) {
setEnabled(!show);
setReadOnly(show);
setText(m_basePasswordEdit->text());
}
else {
// This fix a bug when the QLineEdit is disabled while switching config
if (isEnabled() == false) {
setEnabled(true);
setReadOnly(false);
}
}
}
updateStylesheet();
Q_EMIT showPasswordChanged(show);
}
@ -53,15 +81,6 @@ void PasswordEdit::updateStylesheet()
{
QString stylesheet("QLineEdit { ");
if (echoMode() == QLineEdit::Normal) {
#ifdef Q_OS_MAC
// Qt on Mac OS doesn't seem to know the generic monospace family (tested with 4.8.6)
stylesheet.append("font-family: monospace,Menlo,Monaco; ");
#else
stylesheet.append("font-family: monospace,Courier New; ");
#endif
}
if (m_basePasswordEdit && !passwordsEqual()) {
stylesheet.append("background: %1; ");
@ -76,3 +95,10 @@ void PasswordEdit::updateStylesheet()
stylesheet.append("}");
setStyleSheet(stylesheet);
}
void PasswordEdit::autocompletePassword(QString password)
{
if (config()->get("security/passwordsrepeat").toBool() && echoMode() == QLineEdit::Normal) {
setText(password);
}
}

View file

@ -39,6 +39,7 @@ Q_SIGNALS:
private Q_SLOTS:
void updateStylesheet();
void autocompletePassword(QString password);
private:
bool passwordsEqual() const;

View file

@ -34,18 +34,23 @@ PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent)
m_ui->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
connect(m_ui->editNewPassword->lineEdit(), SIGNAL(textChanged(QString)), SLOT(updateApplyEnabled(QString)));
connect(m_ui->togglePasswordButton, SIGNAL(toggled(bool)), m_ui->editNewPassword, SLOT(setEcho(bool)));
connect(m_ui->buttonApply, SIGNAL(clicked()), SLOT(emitNewPassword()));
connect(m_ui->buttonApply, SIGNAL(clicked()), SLOT(saveSettings()));
connect(m_ui->editNewPassword, SIGNAL(textChanged(QString)), SLOT(updateApplyEnabled(QString)));
connect(m_ui->editNewPassword, SIGNAL(textChanged(QString)), SLOT(updatePasswordStrength(QString)));
connect(m_ui->togglePasswordButton, SIGNAL(toggled(bool)), SLOT(togglePasswordShown(bool)));
connect(m_ui->buttonApply, SIGNAL(clicked()), SLOT(applyPassword()));
connect(m_ui->buttonGenerate, SIGNAL(clicked()), SLOT(generatePassword()));
connect(m_ui->sliderLength, SIGNAL(valueChanged(int)), SLOT(sliderMoved()));
connect(m_ui->spinBoxLength, SIGNAL(valueChanged(int)), SLOT(spinBoxChanged()));
connect(m_ui->optionButtons, SIGNAL(buttonClicked(int)), SLOT(updateGenerator()));
m_ui->editNewPassword->setGenerator(m_generator.data());
// set font size of password quality and entropy labels dynamically to 80% of the default font size
QFont defaultFont;
defaultFont.setPointSize(static_cast<int>(defaultFont.pointSize() * 0.8f));
m_ui->entropyLabel->setFont(defaultFont);
m_ui->strengthLabel->setFont(defaultFont);
loadSettings();
reset();
}
@ -82,17 +87,28 @@ void PasswordGeneratorWidget::saveSettings()
void PasswordGeneratorWidget::reset()
{
m_ui->editNewPassword->lineEdit()->setText("");
m_ui->togglePasswordButton->setChecked(config()->get("security/passwordscleartext").toBool());
m_ui->editNewPassword->setText("");
setStandaloneMode(false);
togglePasswordShown(config()->get("security/passwordscleartext").toBool());
updateGenerator();
}
void PasswordGeneratorWidget::setStandaloneMode(bool standalone)
{
if (standalone) {
m_ui->buttonApply->setText(tr("Close"));
togglePasswordShown(true);
} else {
m_ui->buttonApply->setText(tr("Apply"));
}
}
void PasswordGeneratorWidget::regeneratePassword()
{
if (m_generator->isValid()) {
QString password = m_generator->generatePassword();
m_ui->editNewPassword->setEditText(password);
m_ui->editNewPassword->setText(password);
updatePasswordStrength(password);
}
}
@ -101,9 +117,30 @@ void PasswordGeneratorWidget::updateApplyEnabled(const QString& password)
m_ui->buttonApply->setEnabled(!password.isEmpty());
}
void PasswordGeneratorWidget::emitNewPassword()
void PasswordGeneratorWidget::updatePasswordStrength(const QString& password)
{
Q_EMIT newPassword(m_ui->editNewPassword->lineEdit()->text());
double entropy = m_generator->calculateEntropy(password);
m_ui->entropyLabel->setText(tr("Entropy: %1 bit").arg(QString::number(entropy, 'f', 2)));
if (entropy > m_ui->entropyProgressBar->maximum()) {
entropy = m_ui->entropyProgressBar->maximum();
}
m_ui->entropyProgressBar->setValue(entropy);
colorStrengthIndicator(entropy);
}
void PasswordGeneratorWidget::generatePassword()
{
QString password = m_generator->generatePassword();
m_ui->editNewPassword->setText(password);
}
void PasswordGeneratorWidget::applyPassword()
{
saveSettings();
Q_EMIT appliedPassword(m_ui->editNewPassword->text());
Q_EMIT dialogTerminated();
}
void PasswordGeneratorWidget::sliderMoved()
@ -133,6 +170,41 @@ void PasswordGeneratorWidget::spinBoxChanged()
updateGenerator();
}
void PasswordGeneratorWidget::togglePasswordShown(bool showing)
{
m_ui->editNewPassword->setShowPassword(showing);
bool blockSignals = m_ui->togglePasswordButton->blockSignals(true);
m_ui->togglePasswordButton->setChecked(showing);
m_ui->togglePasswordButton->blockSignals(blockSignals);
}
void PasswordGeneratorWidget::colorStrengthIndicator(double entropy)
{
// Take the existing stylesheet and convert the text and background color to arguments
QString style = m_ui->entropyProgressBar->styleSheet();
QRegularExpression re("(QProgressBar::chunk\\s*\\{.*?background-color:)[^;]+;",
QRegularExpression::CaseInsensitiveOption |
QRegularExpression::DotMatchesEverythingOption);
style.replace(re, "\\1 %1;");
// Set the color and background based on entropy
// colors are taking from the KDE breeze palette
// <https://community.kde.org/KDE_Visual_Design_Group/HIG/Color>
if (entropy < 35) {
m_ui->entropyProgressBar->setStyleSheet(style.arg("#c0392b"));
m_ui->strengthLabel->setText(tr("Password Quality: %1").arg(tr("Poor")));
} else if (entropy >= 35 && entropy < 55) {
m_ui->entropyProgressBar->setStyleSheet(style.arg("#f39c1f"));
m_ui->strengthLabel->setText(tr("Password Quality: %1").arg(tr("Weak")));
} else if (entropy >= 55 && entropy < 100) {
m_ui->entropyProgressBar->setStyleSheet(style.arg("#11d116"));
m_ui->strengthLabel->setText(tr("Password Quality: %1").arg(tr("Good")));
} else {
m_ui->entropyProgressBar->setStyleSheet(style.arg("#27ae60"));
m_ui->strengthLabel->setText(tr("Password Quality: %1").arg(tr("Excellent")));
}
}
PasswordGenerator::CharClasses PasswordGeneratorWidget::charClasses()
{
PasswordGenerator::CharClasses classes;

View file

@ -20,6 +20,7 @@
#include <QWidget>
#include <QComboBox>
#include <QLabel>
#include "core/PasswordGenerator.h"
@ -37,19 +38,25 @@ public:
explicit PasswordGeneratorWidget(QWidget* parent = nullptr);
~PasswordGeneratorWidget();
void loadSettings();
void saveSettings();
void reset();
void setStandaloneMode(bool standalone);
void regeneratePassword();
Q_SIGNALS:
void newPassword(const QString& password);
void appliedPassword(const QString& password);
void dialogTerminated();
private Q_SLOTS:
void applyPassword();
void generatePassword();
void updateApplyEnabled(const QString& password);
void updatePasswordStrength(const QString& password);
void togglePasswordShown(bool hidden);
void emitNewPassword();
void saveSettings();
void sliderMoved();
void spinBoxChanged();
void colorStrengthIndicator(double entropy);
void updateGenerator();

View file

@ -6,60 +6,197 @@
<rect>
<x>0</x>
<y>0</y>
<width>434</width>
<height>250</height>
<width>500</width>
<height>278</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="passwordFieldLayout">
<property name="bottomMargin">
<number>10</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="1" column="1">
<widget class="QProgressBar" name="entropyProgressBar">
<property name="minimumSize">
<size>
<width>50</width>
<height>5</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>5</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QProgressBar {
border: none;
height: 2px;
font-size: 1px;
background-color: transparent;
padding: 0 1px;
}
QProgressBar::chunk {
background-color: #c0392b;
border-radius: 2px;
}</string>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
<property name="textDirection">
<enum>QProgressBar::TopToBottom</enum>
</property>
<property name="format">
<string>%p%</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelNewPassword">
<property name="text">
<string>Password:</string>
</property>
<property name="buddy">
<cstring>editNewPassword</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<item row="2" column="1">
<layout class="QHBoxLayout" name="passwordStrengthTextLayout">
<item>
<widget class="PasswordComboBox" name="editNewPassword">
<property name="editable">
<bool>true</bool>
<widget class="QLabel" name="strengthLabel">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>strength</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="margin">
<number>3</number>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="togglePasswordButton">
<property name="checkable">
<bool>true</bool>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="entropyLabel">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>entropy</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
</property>
<property name="margin">
<number>3</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelLength">
<property name="text">
<string>Length:</string>
<item row="0" column="1">
<widget class="PasswordEdit" name="editNewPassword">
<property name="maxLength">
<number>999</number>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item row="3" column="0">
<widget class="QLabel" name="labelLength">
<property name="text">
<string>&amp;Length:</string>
</property>
<property name="buddy">
<cstring>spinBoxLength</cstring>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<layout class="QHBoxLayout" name="passwordLengthSliderLayout">
<property name="spacing">
<number>15</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<item>
<widget class="QSlider" name="sliderLength">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>64</number>
<number>128</number>
</property>
<property name="sliderPosition">
<number>20</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -72,7 +209,7 @@
</property>
</widget>
</item>
<item>
<item alignment="Qt::AlignRight">
<widget class="QSpinBox" name="spinBoxLength">
<property name="minimum">
<number>1</number>
@ -80,30 +217,139 @@
<property name="maximum">
<number>999</number>
</property>
<property name="value">
<number>20</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="togglePasswordButton">
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Character Types</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<layout class="QHBoxLayout" name="optionsLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Character Types</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QToolButton" name="checkBoxUpper">
<property name="toolTip">
<string>Upper Case Letters</string>
</property>
<layout class="QHBoxLayout" name="alphabetLayout">
<item>
<widget class="QToolButton" name="checkBoxUpper">
<property name="minimumSize">
<size>
<width>0</width>
<height>26</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Upper Case Letters</string>
</property>
<property name="text">
<string notr="true">A-Z</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">optionButtons</string>
</attribute>
</widget>
</item>
<item>
<widget class="QToolButton" name="checkBoxLower">
<property name="minimumSize">
<size>
<width>0</width>
<height>26</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Lower Case Letters</string>
</property>
<property name="text">
<string notr="true">a-z</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">optionButtons</string>
</attribute>
</widget>
</item>
<item>
<widget class="QToolButton" name="checkBoxNumbers">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Numbers</string>
</property>
<property name="text">
<string notr="true">0-9</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">optionButtons</string>
</attribute>
</widget>
</item>
<item>
<widget class="QToolButton" name="checkBoxSpecialChars">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Special Characters</string>
</property>
<property name="text">
<string notr="true">/*_&amp; ...</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">optionButtons</string>
</attribute>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxExcludeAlike">
<property name="text">
<string notr="true">A-Z</string>
</property>
<property name="checkable">
<bool>true</bool>
<string>Exclude look-alike characters</string>
</property>
<attribute name="buttonGroup">
<string notr="true">optionButtons</string>
@ -111,115 +357,38 @@
</widget>
</item>
<item>
<widget class="QToolButton" name="checkBoxLower">
<property name="toolTip">
<string>Lower Case Letters</string>
</property>
<widget class="QCheckBox" name="checkBoxEnsureEvery">
<property name="text">
<string notr="true">a-z</string>
</property>
<property name="checkable">
<bool>true</bool>
<string>Pick characters from every group</string>
</property>
<attribute name="buttonGroup">
<string notr="true">optionButtons</string>
</attribute>
</widget>
</item>
<item>
<widget class="QToolButton" name="checkBoxNumbers">
<property name="toolTip">
<string>Numbers</string>
</property>
<property name="text">
<string notr="true">0-9</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">optionButtons</string>
</attribute>
</widget>
</item>
<item>
<widget class="QToolButton" name="checkBoxSpecialChars">
<property name="toolTip">
<string>Special Characters</string>
</property>
<property name="text">
<string notr="true">/*_&amp; ...</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">optionButtons</string>
</attribute>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxExcludeAlike">
<property name="text">
<string>Exclude look-alike characters</string>
</property>
<attribute name="buttonGroup">
<string notr="true">optionButtons</string>
</attribute>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxEnsureEvery">
<property name="text">
<string>Ensure that the password contains characters from every group</string>
</property>
<attribute name="buttonGroup">
<string notr="true">optionButtons</string>
</attribute>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonApply">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Accept</string>
</property>
</widget>
<layout class="QVBoxLayout" name="globalButtonsLayout">
<item>
<widget class="QPushButton" name="buttonGenerate">
<property name="text">
<string>Generate</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonApply">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Accept</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
@ -227,9 +396,9 @@
</widget>
<customwidgets>
<customwidget>
<class>PasswordComboBox</class>
<extends>QComboBox</extends>
<header location="global">gui/PasswordComboBox.h</header>
<class>PasswordEdit</class>
<extends>QLineEdit</extends>
<header>gui/PasswordEdit.h</header>
</customwidget>
</customwidgets>
<tabstops>
@ -243,6 +412,7 @@
<tabstop>checkBoxSpecialChars</tabstop>
<tabstop>checkBoxExcludeAlike</tabstop>
<tabstop>checkBoxEnsureEvery</tabstop>
<tabstop>buttonGenerate</tabstop>
<tabstop>buttonApply</tabstop>
</tabstops>
<resources/>

View file

@ -74,11 +74,7 @@ SettingsWidget::SettingsWidget(QWidget* parent)
connect(m_generalUi->autoSaveAfterEveryChangeCheckBox, SIGNAL(toggled(bool)),
this, SLOT(enableAutoSaveOnExit(bool)));
connect(m_generalUi->systrayShowCheckBox, SIGNAL(toggled(bool)),
this, SLOT(enableSystrayMinimizeToTray(bool)));
connect(m_generalUi->systrayMinimizeToTrayCheckBox, SIGNAL(toggled(bool)),
this, SLOT(enableSystrayMinimizeToTray2(bool)));
connect(m_generalUi->systrayMinimizeOnCloseCheckBox, SIGNAL(toggled(bool)),
m_generalUi->systrayMinimizeOnStartup, SLOT(setEnabled(bool)));
this, SLOT(enableSystray(bool)));
connect(m_secUi->clearClipboardCheckBox, SIGNAL(toggled(bool)),
m_secUi->clearClipboardSpinBox, SLOT(setEnabled(bool)));
@ -142,6 +138,7 @@ void SettingsWidget::loadSettings()
m_secUi->lockDatabaseMinimizeCheckBox->setChecked(config()->get("security/lockdatabaseminimize").toBool());
m_secUi->passwordCleartextCheckBox->setChecked(config()->get("security/passwordscleartext").toBool());
m_secUi->passwordRepeatCheckBox->setChecked(config()->get("security/passwordsrepeat").toBool());
m_secUi->autoTypeAskCheckBox->setChecked(config()->get("security/autotypeask").toBool());
@ -187,6 +184,7 @@ void SettingsWidget::saveSettings()
config()->set("security/lockdatabaseminimize", m_secUi->lockDatabaseMinimizeCheckBox->isChecked());
config()->set("security/passwordscleartext", m_secUi->passwordCleartextCheckBox->isChecked());
config()->set("security/passwordsrepeat", m_secUi->passwordRepeatCheckBox->isChecked());
config()->set("security/autotypeask", m_secUi->autoTypeAskCheckBox->isChecked());
@ -211,18 +209,8 @@ void SettingsWidget::enableAutoSaveOnExit(bool checked)
m_generalUi->autoSaveOnExitCheckBox->setEnabled(!checked);
}
void SettingsWidget::enableSystrayMinimizeToTray(bool checked)
void SettingsWidget::enableSystray(bool checked)
{
m_generalUi->systrayMinimizeToTrayCheckBox->setEnabled(checked);
bool checked2 = m_generalUi->systrayMinimizeToTrayCheckBox->checkState();
m_generalUi->systrayMinimizeOnCloseCheckBox->setEnabled(checked && checked2);
bool checked3 = m_generalUi->systrayMinimizeOnCloseCheckBox->checkState();
m_generalUi->systrayMinimizeOnStartup->setEnabled(checked && checked2 && checked3);
}
void SettingsWidget::enableSystrayMinimizeToTray2(bool checked)
{
m_generalUi->systrayMinimizeOnCloseCheckBox->setEnabled(checked);
bool checked2 = m_generalUi->systrayMinimizeOnCloseCheckBox->checkState();
m_generalUi->systrayMinimizeOnStartup->setEnabled(checked && checked2);
}

View file

@ -51,8 +51,7 @@ private Q_SLOTS:
void saveSettings();
void reject();
void enableAutoSaveOnExit(bool checked);
void enableSystrayMinimizeToTray(bool checked);
void enableSystrayMinimizeToTray2(bool checked);
void enableSystray(bool checked);
private:
QWidget* const m_secWidget;

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>684</width>
<height>459</height>
<height>452</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
@ -37,7 +37,7 @@
<item row="2" column="0">
<widget class="QCheckBox" name="openPreviousDatabasesOnStartupCheckBox">
<property name="text">
<string>Open previous databases on startup</string>
<string>Load previous databases on startup</string>
</property>
</widget>
</item>
@ -113,12 +113,9 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<width>40</width>
<height>20</height>
</size>
</property>
@ -166,7 +163,7 @@
<bool>false</bool>
</property>
<property name="text">
<string>Hide window to system tray instead of App Exit</string>
<string>Hide window to system tray instead of app exit</string>
</property>
</widget>
</item>
@ -177,26 +174,10 @@
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>60</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="systrayMinimizeOnStartup">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Hide window to system tray on App start</string>
<string>Minimize window at application startup</string>
</property>
</widget>
</item>

View file

@ -72,6 +72,13 @@
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="passwordRepeatCheckBox">
<property name="text">
<string>Don't require password repeat when it is visible</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="autoTypeAskCheckBox">
<property name="text">
<string>Always ask before performing auto-type</string>

View file

@ -93,7 +93,7 @@ void EditEntryWidget::setupMain()
connect(m_mainUi->tooglePasswordGeneratorButton, SIGNAL(toggled(bool)), SLOT(togglePasswordGeneratorButton(bool)));
connect(m_mainUi->expireCheck, SIGNAL(toggled(bool)), m_mainUi->expireDatePicker, SLOT(setEnabled(bool)));
m_mainUi->passwordRepeatEdit->enableVerifyMode(m_mainUi->passwordEdit);
connect(m_mainUi->passwordGenerator, SIGNAL(newPassword(QString)), SLOT(setGeneratedPassword(QString)));
connect(m_mainUi->passwordGenerator, SIGNAL(appliedPassword(QString)), SLOT(setGeneratedPassword(QString)));
m_mainUi->expirePresets->setMenu(createPresetsMenu());
connect(m_mainUi->expirePresets->menu(), SIGNAL(triggered(QAction*)), this, SLOT(useExpiryPreset(QAction*)));

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>372</width>
<height>301</height>
<height>364</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
@ -78,7 +78,7 @@
<item>
<widget class="QToolButton" name="tooglePasswordGeneratorButton">
<property name="text">
<string>Gen.</string>
<string>Generate</string>
</property>
<property name="checkable">
<bool>true</bool>