diff --git a/src/core/Group.cpp b/src/core/Group.cpp index 2b9e9bcff..43967d58d 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -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); } diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp index d9984d33c..1abb6b452 100644 --- a/src/gui/DatabaseTabWidget.cpp +++ b/src/gui/DatabaseTabWidget.cpp @@ -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; diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 8c3b2b9b5..77d16447e 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -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) { diff --git a/src/gui/PasswordComboBox.cpp b/src/gui/PasswordComboBox.cpp index e1218505d..1f6c068f1 100644 --- a/src/gui/PasswordComboBox.cpp +++ b/src/gui/PasswordComboBox.cpp @@ -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 { diff --git a/src/gui/PasswordEdit.cpp b/src/gui/PasswordEdit.cpp index e5bbf6b34..3fd5d478c 100644 --- a/src/gui/PasswordEdit.cpp +++ b/src/gui/PasswordEdit.cpp @@ -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 } diff --git a/src/gui/PasswordGeneratorWidget.cpp b/src/gui/PasswordGeneratorWidget.cpp index 4cb14c4de..95efa5b2b 100644 --- a/src/gui/PasswordGeneratorWidget.cpp +++ b/src/gui/PasswordGeneratorWidget.cpp @@ -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(); } diff --git a/src/gui/PasswordGeneratorWidget.h b/src/gui/PasswordGeneratorWidget.h index cfb21bbec..46ef08c3b 100644 --- a/src/gui/PasswordGeneratorWidget.h +++ b/src/gui/PasswordGeneratorWidget.h @@ -38,6 +38,7 @@ public: ~PasswordGeneratorWidget(); void loadSettings(); void reset(); + void regeneratePassword(); Q_SIGNALS: void newPassword(const QString& password); diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index 4aded9a02..77f68c927 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -515,6 +515,7 @@ bool EditEntryWidget::hasBeenModified() const void EditEntryWidget::togglePasswordGeneratorButton(bool checked) { + m_mainUi->passwordGenerator->regeneratePassword(); m_mainUi->passwordGenerator->setVisible(checked); } diff --git a/tests/TestGroup.cpp b/tests/TestGroup.cpp index 13ce82ea5..a923776de 100644 --- a/tests/TestGroup.cpp +++ b/tests/TestGroup.cpp @@ -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; } diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index 1585c8a6b..90d7fc2b0 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -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);