0
0
mirror of https://github.com/keepassxreboot/keepassxc.git synced 2024-09-20 04:12:15 +02:00

Merge branch 'release/2.2.3' into develop

This commit is contained in:
Janek Bevendorff 2017-11-26 18:23:48 +01:00
commit 8651736e61
No known key found for this signature in database
GPG Key ID: 2FDEB0D40BCA5E11
9 changed files with 94 additions and 53 deletions

View File

@ -87,14 +87,15 @@ else
fi
EOF
chmod +x ./usr/bin/keepassxc_env
sed -i 's/Exec=keepassxc/Exec=keepassxc_env/' org.${LOWERAPP}.desktop
get_desktopintegration "org.${LOWERAPP}"
GLIBC_NEEDED=$(glibc_needed)
sed -i 's/Exec=keepassxc/Exec=keepassxc_env/' org.${LOWERAPP}.${APP}.desktop
get_desktopintegration "org.${LOWERAPP}.${APP}"
cd ..
generate_type2_appimage
GLIBC_NEEDED=$(glibc_needed)
NO_GLIBC_VERSION=true
mv ../out/*.AppImage ../KeePassXC-${VERSION}-${ARCH}.AppImage
rmdir ../out > /dev/null 2>&1
generate_type2_appimage -u "gh-releases-zsync|keepassxreboot|keepassxc|latest|KeePassXC-*-${ARCH}.AppImage.zsync"
mv ../out/*.AppImage* ../
rm -rf ../out

View File

@ -24,7 +24,8 @@ RUN set -x \
&& apt-get -y install software-properties-common
RUN set -x \
&& add-apt-repository ppa:beineri/opt-qt${QT5_PPA_VERSION}-trusty
&& add-apt-repository ppa:beineri/opt-qt${QT5_PPA_VERSION}-trusty \
&& add-apt-repository ppa:phoerious/keepassxc
RUN set -x \
&& apt-get update -y \
@ -42,7 +43,9 @@ RUN set -x \
zlib1g-dev \
libxi-dev \
libxtst-dev \
mesa-common-dev
mesa-common-dev \
libyubikey-dev \
libykpers-1-dev
ENV CMAKE_PREFIX_PATH=/opt/qt${QT5_VERSION}/lib/cmake
ENV LD_LIBRARY_PATH=/opt/qt${QT5_VERSION}/lib
@ -52,34 +55,8 @@ RUN set -x \
# AppImage dependencies
RUN set -x \
&& apt-get install -y \
wget \
libfuse2
# build libyubikey
ENV YUBIKEY_VERSION=1.13
RUN set -x \
&& wget "https://developers.yubico.com/yubico-c/Releases/libyubikey-${YUBIKEY_VERSION}.tar.gz" \
&& tar xf libyubikey-${YUBIKEY_VERSION}.tar.gz \
&& cd libyubikey-${YUBIKEY_VERSION} \
&& ./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu \
&& make \
&& make install \
&& cd .. \
&& rm -Rf libyubikey-${YUBIKEY_VERSION}*
# build libykpers-1
ENV YKPERS_VERSION=1.18.0
RUN set -x \
&& apt-get install -y libusb-dev
RUN set -x \
&& wget "https://developers.yubico.com/yubikey-personalization/Releases/ykpers-${YKPERS_VERSION}.tar.gz" \
&& tar xf ykpers-${YKPERS_VERSION}.tar.gz \
&& cd ykpers-${YKPERS_VERSION} \
&& ./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu \
&& make \
&& make install \
&& cd .. \
&& rm -Rf ykpers-${YKPERS_VERSION}*
libfuse2 \
wget
VOLUME /keepassxc/src
VOLUME /keepassxc/out

View File

@ -298,8 +298,7 @@ bool DatabaseTabWidget::closeDatabase(Database* db)
if (!saveDatabase(db)) {
return false;
}
}
else {
} else if (dbStruct.dbWidget->currentMode() != DatabaseWidget::LockedMode) {
QMessageBox::StandardButton result =
MessageBox::question(
this, tr("Save changes?"),
@ -309,8 +308,7 @@ bool DatabaseTabWidget::closeDatabase(Database* db)
if (!saveDatabase(db)) {
return false;
}
}
else if (result == QMessageBox::Cancel) {
} else if (result == QMessageBox::Cancel) {
return false;
}
}
@ -355,8 +353,13 @@ bool DatabaseTabWidget::saveDatabase(Database* db)
{
DatabaseManagerStruct& dbStruct = m_dbList[db];
if (dbStruct.saveToFilename) {
if (dbStruct.dbWidget->currentMode() == DatabaseWidget::LockedMode) {
// Never allow saving a locked database; it causes corruption
// We return true since a save is not required
return true;
}
if (dbStruct.saveToFilename) {
dbStruct.dbWidget->blockAutoReload(true);
QString errorMessage = db->saveToFile(dbStruct.canonicalFilePath);
dbStruct.dbWidget->blockAutoReload(false);
@ -375,7 +378,6 @@ bool DatabaseTabWidget::saveDatabase(Database* db)
MessageWidget::Error);
return false;
}
} else {
return saveDatabaseAs(db);
}

View File

@ -1206,7 +1206,7 @@ void DatabaseWidget::onWatchedFileChanged()
void DatabaseWidget::reloadDatabaseFile()
{
if (m_db == nullptr) {
if (!m_db || currentMode() == DatabaseWidget::LockedMode) {
return;
}

View File

@ -32,8 +32,17 @@ PasswordEdit::PasswordEdit(QWidget* parent)
setEchoMode(QLineEdit::Password);
updateStylesheet();
// set font to system monospace font and increase letter spacing
// use a monospace font for the password field
QFont passwordFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
#ifdef Q_OS_WIN
// try to use Consolas on Windows, because the default Courier New has too many similar characters
QFont consolasFont = QFontDatabase().font("Consolas", passwordFont.styleName(), passwordFont.pointSize());
const QFont defaultFont;
if (passwordFont != defaultFont) {
passwordFont = consolasFont;
}
#endif
passwordFont.setLetterSpacing(QFont::PercentageSpacing, 110);
setFont(passwordFont);
}

View File

@ -536,6 +536,7 @@ void EditEntryWidget::loadEntry(Entry* entry, bool create, bool history, const Q
m_database = database;
m_create = create;
m_history = history;
m_saved = false;
if (history) {
setHeadline(QString("%1 > %2").arg(parentName, tr("Entry history")));
@ -712,6 +713,7 @@ void EditEntryWidget::saveEntry()
}
updateEntryData(m_entry);
m_saved = true;
if (!m_create) {
m_entry->endUpdate();
@ -790,7 +792,7 @@ void EditEntryWidget::cancel()
clear();
emit editFinished(false);
emit editFinished(m_saved);
}
void EditEntryWidget::clear()

View File

@ -147,6 +147,7 @@ private:
bool m_create;
bool m_history;
bool m_saved;
#ifdef WITH_XC_SSHAGENT
bool m_sshAgentEnabled;
KeeAgentSettings m_sshAgentSettings;

View File

@ -372,15 +372,27 @@ void TestGui::testAddEntry()
QTest::keyClicks(passwordRepeatEdit, "something 2");
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
// Add entry "something 3"
// Add entry "something 3" using the apply button then click ok
QTest::mouseClick(entryNewWidget, Qt::LeftButton);
QTest::keyClicks(titleEdit, "something 3");
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Apply), Qt::LeftButton);
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
// Add entry "something 4" using the apply button then click cancel
QTest::mouseClick(entryNewWidget, Qt::LeftButton);
QTest::keyClicks(titleEdit, "something 4");
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Apply), Qt::LeftButton);
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Cancel), Qt::LeftButton);
// Add entry "something 5" but click cancel button (does NOT add entry)
QTest::mouseClick(entryNewWidget, Qt::LeftButton);
QTest::keyClicks(titleEdit, "something 5");
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Cancel), Qt::LeftButton);
QApplication::processEvents();
// Confirm that 4 entries now exist
QTRY_COMPARE(entryView->model()->rowCount(), 4);
// Confirm that 5 entries now exist
QTRY_COMPARE(entryView->model()->rowCount(), 5);
}
void TestGui::testPasswordEntryEntropy()
@ -553,7 +565,7 @@ void TestGui::testTotp()
void TestGui::testSearch()
{
// Add canned entries for consistent testing
testAddEntry();
Q_UNUSED(addCannedEntries());
QToolBar* toolBar = m_mainWindow->findChild<QToolBar*>("toolBar");
@ -669,7 +681,7 @@ void TestGui::testSearch()
void TestGui::testDeleteEntry()
{
// Add canned entries for consistent testing
testAddEntry();
Q_UNUSED(addCannedEntries());
GroupView* groupView = m_dbWidget->findChild<GroupView*>("groupView");
EntryView* entryView = m_dbWidget->findChild<EntryView*>("entryView");
@ -945,6 +957,42 @@ void TestGui::cleanupTestCase()
delete m_mainWindow;
}
int TestGui::addCannedEntries()
{
int entries_added = 0;
// Find buttons
QToolBar* toolBar = m_mainWindow->findChild<QToolBar*>("toolBar");
QWidget* entryNewWidget = toolBar->widgetForAction(m_mainWindow->findChild<QAction*>("actionEntryNew"));
EditEntryWidget* editEntryWidget = m_dbWidget->findChild<EditEntryWidget*>("editEntryWidget");
QLineEdit* titleEdit = editEntryWidget->findChild<QLineEdit*>("titleEdit");
QLineEdit* passwordEdit = editEntryWidget->findChild<QLineEdit*>("passwordEdit");
QLineEdit* passwordRepeatEdit = editEntryWidget->findChild<QLineEdit*>("passwordRepeatEdit");
// Add entry "test" and confirm added
QTest::mouseClick(entryNewWidget, Qt::LeftButton);
QTest::keyClicks(titleEdit, "test");
QDialogButtonBox* editEntryWidgetButtonBox = editEntryWidget->findChild<QDialogButtonBox*>("buttonBox");
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
++entries_added;
// Add entry "something 2"
QTest::mouseClick(entryNewWidget, Qt::LeftButton);
QTest::keyClicks(titleEdit, "something 2");
QTest::keyClicks(passwordEdit, "something 2");
QTest::keyClicks(passwordRepeatEdit, "something 2");
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
++entries_added;
// Add entry "something 3"
QTest::mouseClick(entryNewWidget, Qt::LeftButton);
QTest::keyClicks(titleEdit, "something 3");
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
++entries_added;
return entries_added;
}
void TestGui::checkDatabase(QString dbFileName)
{
if (dbFileName.isEmpty())

View File

@ -62,6 +62,7 @@ private slots:
void testDatabaseLocking();
private:
int addCannedEntries();
void checkDatabase(QString dbFileName = "");
void triggerAction(const QString& name);
void dragAndDropGroup(const QModelIndex& sourceIndex, const QModelIndex& targetIndex, int row,