Merge branch '2.0'

This commit is contained in:
Felix Geyer 2016-09-02 12:01:49 +02:00 committed by Jonathan White
commit ad834f0f58
10 changed files with 38 additions and 12 deletions

View File

@ -503,7 +503,7 @@ Group* Group::clone(Entry::CloneFlags entryFlags) const
}
Q_FOREACH (Group* groupChild, children()) {
Group* clonedGroupChild = groupChild->clone();
Group* clonedGroupChild = groupChild->clone(entryFlags);
clonedGroupChild->setParent(clonedGroup);
}

View File

@ -391,6 +391,9 @@ bool DatabaseTabWidget::saveDatabaseAs(Database* db)
return false;
}
// refresh fileinfo since the file didn't exist before
fileInfo.refresh();
dbStruct.modified = false;
dbStruct.saveToFilename = true;
dbStruct.readOnly = false;

View File

@ -353,14 +353,24 @@ void DatabaseWidget::deleteEntries()
}
}
else {
if (selected.size() > 1) {
QMessageBox::StandardButton result = MessageBox::question(
QMessageBox::StandardButton result;
if (selected.size() == 1) {
result = MessageBox::question(
this, tr("Move entry to recycle bin?"),
tr("Do you really want to move entry \"%1\" to the recycle bin?")
.arg(selectedEntries.first()->title()),
QMessageBox::Yes | QMessageBox::No);
}
else {
result = MessageBox::question(
this, tr("Move entries to recycle bin?"),
tr("Do you really want to move %n entry(s) to the recycle bin?", 0, selected.size()),
QMessageBox::Yes | QMessageBox::No);
if (result == QMessageBox::No) {
return;
}
}
if (result == QMessageBox::No) {
return;
}
Q_FOREACH (Entry* entry, selectedEntries) {

View File

@ -49,7 +49,7 @@ void PasswordComboBox::setEcho(bool echo)
// Qt on Mac OS doesn't seem to know the generic monospace family (tested with 4.8.6)
setStyleSheet("QComboBox { font-family: monospace,Menlo,Monaco; }");
#else
setStyleSheet("QComboBox { font-family: monospace,Courier; }");
setStyleSheet("QComboBox { font-family: monospace,Courier New; }");
#endif
}
else {

View File

@ -58,7 +58,7 @@ void PasswordEdit::updateStylesheet()
// 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; ");
stylesheet.append("font-family: monospace,Courier New; ");
#endif
}

View File

@ -88,6 +88,14 @@ void PasswordGeneratorWidget::reset()
updateGenerator();
}
void PasswordGeneratorWidget::regeneratePassword()
{
if (m_generator->isValid()) {
QString password = m_generator->generatePassword();
m_ui->editNewPassword->setEditText(password);
}
}
void PasswordGeneratorWidget::updateApplyEnabled(const QString& password)
{
m_ui->buttonApply->setEnabled(!password.isEmpty());
@ -199,8 +207,5 @@ void PasswordGeneratorWidget::updateGenerator()
m_generator->setCharClasses(classes);
m_generator->setFlags(flags);
if (m_generator->isValid()) {
QString password = m_generator->generatePassword();
m_ui->editNewPassword->setEditText(password);
}
regeneratePassword();
}

View File

@ -38,6 +38,7 @@ public:
~PasswordGeneratorWidget();
void loadSettings();
void reset();
void regeneratePassword();
Q_SIGNALS:
void newPassword(const QString& password);

View File

@ -515,6 +515,7 @@ bool EditEntryWidget::hasBeenModified() const
void EditEntryWidget::togglePasswordGeneratorButton(bool checked)
{
m_mainUi->passwordGenerator->regeneratePassword();
m_mainUi->passwordGenerator->setVisible(checked);
}

View File

@ -385,7 +385,12 @@ void TestGroup::testClone()
QVERIFY(clonedSubGroupEntry->uuid() != subGroupEntry->uuid());
QCOMPARE(clonedSubGroupEntry->title(), QString("SubGroupEntry"));
Group* clonedGroupKeepUuid = originalGroup->clone(Entry::CloneNoFlags);
QCOMPARE(clonedGroupKeepUuid->entries().at(0)->uuid(), originalGroupEntry->uuid());
QCOMPARE(clonedGroupKeepUuid->children().at(0)->entries().at(0)->uuid(), subGroupEntry->uuid());
delete clonedGroup;
delete clonedGroupKeepUuid;
delete db;
}

View File

@ -240,6 +240,7 @@ void TestGui::testSearch()
QVERIFY(entryDeleteWidget->isEnabled());
QVERIFY(!m_db->metadata()->recycleBin());
MessageBox::setNextAnswer(QMessageBox::Yes);
QTest::mouseClick(entryDeleteWidget, Qt::LeftButton);
QCOMPARE(entryView->model()->rowCount(), 3);