diff --git a/ci/trusty/Dockerfile b/ci/trusty/Dockerfile
new file mode 100644
index 000000000..9bd3424f0
--- /dev/null
+++ b/ci/trusty/Dockerfile
@@ -0,0 +1,38 @@
+# KeePassXC Linux Release Build Dockerfile
+# Copyright (C) 2017 KeePassXC team
+#
+# 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 .
+
+# TIP: check this Dockerfile using this online tool: https://www.fromlatest.io
+
+FROM ubuntu:trusty
+
+RUN set -x \
+ && apt-get -y update \
+ && apt-get -y --no-install-recommends install \
+ git build-essential clang-3.6 libclang-common-3.6-dev clang-format-3.6 cmake3 make \
+ curl ca-certificates gnupg2 \
+ libgcrypt20-dev zlib1g-dev libyubikey-dev libykpers-1-dev \
+ qttools5-dev \
+ qttools5-dev-tools \
+ qtbase5-dev \
+ libqt5x11extras5-dev \
+ libxi-dev \
+ libxtst-dev \
+ xvfb \
+ && apt-get autoremove --purge \
+ && rm -rf /var/lib/apt/lists/*
+
+VOLUME ["/keepassxc"]
+WORKDIR /keepassxc
diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp
index b922f4171..3e26e3092 100644
--- a/src/gui/entry/EditEntryWidget.cpp
+++ b/src/gui/entry/EditEntryWidget.cpp
@@ -285,7 +285,7 @@ void EditEntryWidget::setupSSHAgent()
void EditEntryWidget::updateSSHAgent()
{
KeeAgentSettings settings;
- settings.fromXml(m_entryAttachments->value("KeeAgent.settings"));
+ settings.fromXml(m_advancedUi->attachmentsWidget->getAttachment("KeeAgent.settings"));
m_sshAgentUi->addKeyToAgentCheckBox->setChecked(settings.addAtDatabaseOpen());
m_sshAgentUi->removeKeyFromAgentCheckBox->setChecked(settings.removeAtDatabaseClose());
@@ -299,7 +299,8 @@ void EditEntryWidget::updateSSHAgent()
m_sshAgentUi->attachmentComboBox->addItem("");
- for (QString fileName : m_entryAttachments->keys()) {
+ auto attachments = m_advancedUi->attachmentsWidget->entryAttachments();
+ for (const QString& fileName : attachments->keys()) {
if (fileName == "KeeAgent.settings") {
continue;
}
@@ -382,10 +383,10 @@ void EditEntryWidget::saveSSHAgentConfig()
// we don't use this either but we don't want it to dirty flag the config
settings.setSaveAttachmentToTempFile(m_sshAgentSettings.saveAttachmentToTempFile());
- if (settings.isDefault() && m_entryAttachments->hasKey("KeeAgent.settings")) {
- m_entryAttachments->remove("KeeAgent.settings");
+ if (settings.isDefault()) {
+ m_advancedUi->attachmentsWidget->removeAttachment("KeeAgent.settings");
} else if (settings != m_sshAgentSettings) {
- m_entryAttachments->set("KeeAgent.settings", settings.toXml());
+ m_advancedUi->attachmentsWidget->setAttachment("KeeAgent.settings", settings.toXml());
}
m_sshAgentSettings = settings;
@@ -404,7 +405,7 @@ bool EditEntryWidget::getOpenSSHKey(OpenSSHKey& key)
QByteArray privateKeyData;
if (m_sshAgentUi->attachmentRadioButton->isChecked()) {
- privateKeyData = m_entryAttachments->value(m_sshAgentUi->attachmentComboBox->currentText());
+ privateKeyData = m_advancedUi->attachmentsWidget->getAttachment(m_sshAgentUi->attachmentComboBox->currentText());
} else {
QFile localFile(m_sshAgentUi->externalFileEdit->text());
diff --git a/src/gui/entry/EntryAttachmentsWidget.cpp b/src/gui/entry/EntryAttachmentsWidget.cpp
index 93b73a166..df56e7777 100644
--- a/src/gui/entry/EntryAttachmentsWidget.cpp
+++ b/src/gui/entry/EntryAttachmentsWidget.cpp
@@ -106,6 +106,23 @@ void EntryAttachmentsWidget::setButtonsVisible(bool buttonsVisible)
emit buttonsVisibleChanged(m_buttonsVisible);
}
+QByteArray EntryAttachmentsWidget::getAttachment(const QString &name)
+{
+ return m_entryAttachments->value(name);
+}
+
+void EntryAttachmentsWidget::setAttachment(const QString &name, const QByteArray &value)
+{
+ m_entryAttachments->set(name, value);
+}
+
+void EntryAttachmentsWidget::removeAttachment(const QString &name)
+{
+ if (!isReadOnly() && m_entryAttachments->hasKey(name)) {
+ m_entryAttachments->remove(name);
+ }
+}
+
void EntryAttachmentsWidget::insertAttachments()
{
Q_ASSERT(!isReadOnly());
diff --git a/src/gui/entry/EntryAttachmentsWidget.h b/src/gui/entry/EntryAttachmentsWidget.h
index 41a54d477..5fd19415e 100644
--- a/src/gui/entry/EntryAttachmentsWidget.h
+++ b/src/gui/entry/EntryAttachmentsWidget.h
@@ -8,6 +8,7 @@ namespace Ui {
class EntryAttachmentsWidget;
}
+class QByteArray;
class EntryAttachments;
class EntryAttachmentsModel;
@@ -24,6 +25,10 @@ public:
bool isReadOnly() const;
bool isButtonsVisible() const;
+ QByteArray getAttachment(const QString& name);
+ void setAttachment(const QString& name, const QByteArray& value);
+ void removeAttachment(const QString& name);
+
public slots:
void setEntryAttachments(const EntryAttachments* attachments);
void clearAttachments();