From 3089894d20ab8cc7a502db331bbbfa4882f2289e Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Thu, 22 Feb 2018 21:31:32 +0100 Subject: [PATCH 01/14] Allow KeePassXC version overrides from file in addition to Git tags --- .gitignore | 1 + CMakeLists.txt | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 61dfb90d..c96688e9 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ release*/ *.swp .DS_Store +.version \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fb00a02..edfd341a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,19 +80,22 @@ set_property(CACHE KEEPASSXC_BUILD_TYPE PROPERTY STRINGS Snapshot Release PreRel execute_process(COMMAND git tag --points-at HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_TAG) -if(GIT_TAG) - string(REGEX REPLACE "\r?\n$" "" GIT_TAG "${GIT_TAG}") +if(NOT GIT_TAG AND EXISTS ${CMAKE_SOURCE_DIR}/.version) + file(READ ${CMAKE_SOURCE_DIR}/.version OVERRIDE_VERSION) +endif() - if(GIT_TAG MATCHES "^[\\.0-9]+-(alpha|beta)[0-9]+$") +string(REGEX REPLACE "(\r?\n)+" "" OVERRIDE_VERSION "${OVERRIDE_VERSION}") +if(OVERRIDE_VERSION) + if(OVERRIDE_VERSION MATCHES "^[\\.0-9]+-(alpha|beta)[0-9]+$") set(KEEPASSXC_BUILD_TYPE PreRelease) - set(KEEPASSXC_VERSION ${GIT_TAG}) - elseif(GIT_TAG MATCHES "^[\\.0-9]+$") + set(KEEPASSXC_VERSION ${OVERRIDE_VERSION}) + elseif(OVERRIDE_VERSION MATCHES "^[\\.0-9]+$") set(KEEPASSXC_BUILD_TYPE Release) - set(KEEPASSXC_VERSION ${GIT_TAG}) + set(KEEPASSXC_VERSION ${OVERRIDE_VERSION}) endif() endif() -if(KEEPASSXC_BUILD_TYPE STREQUAL "PreRelease" AND NOT GIT_TAG) +if(KEEPASSXC_BUILD_TYPE STREQUAL "PreRelease" AND NOT OVERRIDE_VERSION) set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-preview") elseif(KEEPASSXC_BUILD_TYPE STREQUAL "Snapshot") set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-snapshot") From 32a407824039d30128fa5a2c2483cf552f90a926 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Thu, 22 Feb 2018 21:53:29 +0100 Subject: [PATCH 02/14] Add .version file when generating source tarball --- release-tool | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/release-tool b/release-tool index 0df84e34..b08caadb 100755 --- a/release-tool +++ b/release-tool @@ -614,9 +614,19 @@ build() { if ${BUILD_SOURCE_TARBALL}; then logInfo "Creating source tarball..." local app_name_lower="$(echo "$APP_NAME" | tr '[:upper:]' '[:lower:]')" - TARBALL_NAME="${app_name_lower}-${RELEASE_NAME}-src.tar.xz" - git archive --format=tar "$TAG_NAME" --prefix="${app_name_lower}-${RELEASE_NAME}/" \ - | xz -6 > "${OUTPUT_DIR}/${TARBALL_NAME}" + local prefix="${app_name_lower}-${RELEASE_NAME}" + local tarball_name="${prefix}-src.tar" + + git archive --format=tar "$TAG_NAME" --prefix="${prefix}/" --output="${OUTPUT_DIR}/${tarball_name}" + + # add .version file to tar + mkdir "${prefix}" + echo -n ${RELEASE_NAME} > "${prefix}/.version" + tar --append --file="${OUTPUT_DIR}/${tarball_name}" "${prefix}/.version" + rm "${prefix}/.version" + rmdir "${prefix}" 2> /dev/null + + xz -6 "${OUTPUT_DIR}/${tarball_name}" fi if [ -e "${OUTPUT_DIR}/build-release" ]; then From daaa3c5b41317b3838cbf7aa64666eb2fcb9335f Mon Sep 17 00:00:00 2001 From: Weslly Date: Fri, 23 Feb 2018 06:43:43 -0300 Subject: [PATCH 03/14] Enable focus outline for global auto-type shortcut on macOS --- src/gui/SettingsWidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/SettingsWidget.cpp b/src/gui/SettingsWidget.cpp index 9e4152e2..56b1b2a3 100644 --- a/src/gui/SettingsWidget.cpp +++ b/src/gui/SettingsWidget.cpp @@ -150,6 +150,7 @@ void SettingsWidget::loadSettings() if (m_globalAutoTypeKey > 0 && m_globalAutoTypeModifiers > 0) { m_generalUi->autoTypeShortcutWidget->setShortcut(m_globalAutoTypeKey, m_globalAutoTypeModifiers); } + m_generalUi->autoTypeShortcutWidget->setAttribute(Qt::WA_MacShowFocusRect, true); m_generalUi->autoTypeDelaySpinBox->setValue(config()->get("AutoTypeDelay").toInt()); } From 8dad78194fcd18850cebbf462be6fb0116cc5e00 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Sat, 24 Feb 2018 23:20:53 +0100 Subject: [PATCH 04/14] Fix libgcrypt and libgpg-errror paths in AppImage, resolves #1522 --- AppImage-Recipe.sh | 8 ++++++-- release-tool | 16 +++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/AppImage-Recipe.sh b/AppImage-Recipe.sh index 2187fde1..342dd084 100755 --- a/AppImage-Recipe.sh +++ b/AppImage-Recipe.sh @@ -66,14 +66,18 @@ cp "$QXCB_PLUGIN" ".${QT_PLUGIN_PATH}/platforms/" get_apprun copy_deps + +# protect our libgpg-error from being deleted +mv ./opt/gpg-error-127/lib/x86_64-linux-gnu/libgpg-error.so.0 ./protected.so delete_blacklisted +mv ./protected.so ./opt/gpg-error-127/lib/x86_64-linux-gnu/libgpg-error.so.0 get_desktop get_icon cat << EOF > ./usr/bin/keepassxc_env #!/usr/bin/env bash -export LD_LIBRARY_PATH="/opt/libgcrypt20-18/lib/x86_64-linux-gnu:\${LD_LIBRARY_PATH}" -export LD_LIBRARY_PATH="/opt/gpg-error-127/lib/x86_64-linux-gnu:\${LD_LIBRARY_PATH}" +export LD_LIBRARY_PATH="../opt/libgcrypt20-18/lib/x86_64-linux-gnu:\${LD_LIBRARY_PATH}" +export LD_LIBRARY_PATH="../opt/gpg-error-127/lib/x86_64-linux-gnu:\${LD_LIBRARY_PATH}" export LD_LIBRARY_PATH="..$(dirname ${QT_PLUGIN_PATH})/lib:\${LD_LIBRARY_PATH}" export QT_PLUGIN_PATH="..${QT_PLUGIN_PATH}:\${KPXC_QT_PLUGIN_PATH}" diff --git a/release-tool b/release-tool index b08caadb..c0739a0b 100755 --- a/release-tool +++ b/release-tool @@ -619,17 +619,19 @@ build() { git archive --format=tar "$TAG_NAME" --prefix="${prefix}/" --output="${OUTPUT_DIR}/${tarball_name}" - # add .version file to tar - mkdir "${prefix}" - echo -n ${RELEASE_NAME} > "${prefix}/.version" - tar --append --file="${OUTPUT_DIR}/${tarball_name}" "${prefix}/.version" - rm "${prefix}/.version" - rmdir "${prefix}" 2> /dev/null + if ! ${BUILD_SNAPSHOT}; then + # add .version file to tar + mkdir "${prefix}" + echo -n ${RELEASE_NAME} > "${prefix}/.version" + tar --append --file="${OUTPUT_DIR}/${tarball_name}" "${prefix}/.version" + rm "${prefix}/.version" + rmdir "${prefix}" 2> /dev/null + fi xz -6 "${OUTPUT_DIR}/${tarball_name}" fi - if [ -e "${OUTPUT_DIR}/build-release" ]; then + if ! ${BUILD_SNAPSHOT} && [ -e "${OUTPUT_DIR}/build-release" ]; then logInfo "Cleaning existing build directory..." rm -r "${OUTPUT_DIR}/build-release" 2> /dev/null if [ $? -ne 0 ]; then From 5e2e12977da0da336baf3127bad992b83e8f5f6a Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Sun, 25 Feb 2018 12:58:54 -0500 Subject: [PATCH 05/14] Correct intermittent crash due to stale history items --- src/gui/entry/EditEntryWidget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index ac968180..b180c2a0 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -755,6 +755,8 @@ bool EditEntryWidget::commitEntry() } #endif + m_historyModel->setEntries(m_entry->historyItems()); + showMessage(tr("Entry updated successfully."), MessageWidget::Positive); return true; } From 8c4df3706297cfa117ed208abd5d7904f52f432a Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Sun, 25 Feb 2018 13:15:44 -0500 Subject: [PATCH 06/14] Only show entry update message when hitting apply --- src/gui/DatabaseWidget.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index fda7586d..06b7b87b 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -795,10 +795,6 @@ void DatabaseWidget::switchToView(bool accepted) m_newParent = nullptr; } - if (accepted) { - showMessage(tr("Entry updated successfully."), MessageWidget::Positive, false, 2000); - } - setCurrentWidget(m_mainWidget); } From fd71b4a22e981961da8d6c3de5faaf514429e733 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Thu, 22 Feb 2018 23:19:26 -0500 Subject: [PATCH 07/14] Convert from unicode to image based paperclip --- .../application/16x16/actions/paperclip.png | Bin 0 -> 352 bytes .../application/22x22/actions/paperclip.png | Bin 0 -> 421 bytes .../application/32x32/actions/paperclip.png | Bin 0 -> 559 bytes share/icons/svg/paperclip.svgz | Bin 0 -> 1326 bytes src/gui/entry/EntryModel.cpp | 34 ++++++++---------- src/gui/entry/EntryModel.h | 5 ++- src/gui/entry/EntryView.cpp | 4 +++ 7 files changed, 23 insertions(+), 20 deletions(-) create mode 100644 share/icons/application/16x16/actions/paperclip.png create mode 100644 share/icons/application/22x22/actions/paperclip.png create mode 100644 share/icons/application/32x32/actions/paperclip.png create mode 100644 share/icons/svg/paperclip.svgz diff --git a/share/icons/application/16x16/actions/paperclip.png b/share/icons/application/16x16/actions/paperclip.png new file mode 100644 index 0000000000000000000000000000000000000000..cd61805ef0f07bfcd9b726683cec2fa616001d8f GIT binary patch literal 352 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?- z*&xiwU%2=ykRe&(8c`CQpH@mmtT}V`<;yxP|;ma7sn8b z-l>-jy__8d*dDykZ0c2VG+3LEm@DNN_<>=Y+(9Gu4O6Cstt=9>-gttO#a}?$w!us+ zYvb<+g6a3G|D843{QtkPv9))Pw#{SK>#Tl)$$K912=95c!Q~!Lk@$_{wPsd_%GW*P zH*2~hFu(T)bF_r(pA!sq1$t)}o%+b6{`!cc!n#kDJ$u^@8a#3rz0wq?u{B`ve|=02?- zt02r6a&uJ@kRe&(8c`CQpH@mmtT}V`<;yx0|TRyr;B5V zMeow9`}J5IMUHs%U>zMpb=cW&cK=)1OuQo%1;-blv3JhX&&{r8oXBpXZSy5gu_!(5|rWYDmRQ zvx`R}9>_j6d0MdMk>#Dox*zm528iG3@2`&&t}Q({fz|VYddJ&@rCK{!tER+9i5)Rp z)wG$xMsNR-3*6UZn{TUn1}zUeGUaH~-KNRf{%;EplS%2XcJZ4%jOM~qVFi06Z MUHx3vIVCg!0JOxa=l}o! literal 0 HcmV?d00001 diff --git a/share/icons/application/32x32/actions/paperclip.png b/share/icons/application/32x32/actions/paperclip.png new file mode 100644 index 0000000000000000000000000000000000000000..cb57d13783baeaf0a42cb9cc096d52aa801f858d GIT binary patch literal 559 zcmV+~0?_@5P)v7R zEG+CT(xpi{3$YN1r4R%a0(K&TU}K|IY$QbxqF@k9AvueE$H}s1Zr0f#;s?ja&3p5{ zZ)V;syDe!rfm^tM0ldXMtR~i}g>(3fcIo#WmzoyehmRrn5ED3sd2C`su{(|7dWb)- zh~0_U?K*{b^_h1zc&Q@xDENGn21bIvRK(VUk2h(c72K{PlEXj>cH=4zG-==rW_rXf zVi`C4DKt>izyqAdP(|!$@WFlx)$M^JI27~Cv7~;fYam-w=4iq{GSkE@Xl_a1WF3BWE_ZIK{TV3xRda;WDmZL2>47yi)8=BN)PCMTeI^ xQa7=P{V4^Lo?5?P64w-GzJ(8Xf|b-lKLIK$S)&2gUKIcU002ovPDHLkV1h^c@B{z= literal 0 HcmV?d00001 diff --git a/share/icons/svg/paperclip.svgz b/share/icons/svg/paperclip.svgz new file mode 100644 index 0000000000000000000000000000000000000000..f82480bca157b52e725c1c7e997df2f270d87214 GIT binary patch literal 1326 zcmV+}1=0E+iwFP!000000F74Lj@vd6ea}}A%1et%6fe3Owu81ofdYLf+5~+uP-rEt zt*k5xqP({E>pMg0vfg!z3P^S|*E2JRl-Hjw$A&zs-qgC?c$_kisJ7Hq-R?Ku*Dt>W znMce}v{ljQR&Bgid!M!+*5-Ntfe-@0tyxv&#ybo{w+h4V)HhW3`>-lQ)u^Lt2NQD2 zLvL{}7x%JP#ZW)1QXh}HH8!#}A7455)#L1aKA-7XS|^_8dB{X4L;xOvxwb=b32s9H zX`Hm4T^r@NagX6x8TbU#drlQ?yk>`1#A{*%&Zd4b`hOb^Bz>qEk0j zC#9P}aa5)&N@c=HZ{rWD-XDgICv#@s>uTfuR$Nv8H@EMv);KC^b^b|THXb94KoprG z&vi8%mP7z-WeaY+u2)9&&#vIq!>ZCHf&w#O>C2|>D9q-?p%@{q=JJf@f(r6oTuPO( z$|r*HG+I!2n z<<1<6UhV1PGh)@8hF=JZE^&eFYmCO^JPOOd3cC$brG5 zT0h|a2i>T?Xt7()M$5hj4&T$C>Pp=+%zH(6bD_IdpjV~O8&AA7p6eD2!FYUlF5ZQY z9@A0fzSO()s%242*;C)ctsgXaG2PxzW3RX%bH7__3mzWu&a(FH zda=Qbrc;3A-guWQ>byybBSZzvHlLO1*x}7)KWCEN($-d+96N35!QGyDOc~Fz)E6n6 z6Y0K&wu;fkXSZcBlS~C)v=i(`mrppT$D%Rr6o&85&34@t!@G z)DDE^zCh4e!nT@##tJc(U#1qg9Nabl^&u;pI)eeb&Uh-YNdy~X2ABy%WK#+!<2u;9 z3$d&rozS~92wdcZ@=BW4mOq#<_i99+B&n(R5b9{&SpGWEHUu%YFVz0Xc;)nd9E5 zkiNZ!Mg`IhNWvU6OGWqzK*jtHYh9RQ-I0tWLMcP`q&e^cqzryLP^1bNIktk-ixbB^ z99v}fhLePM98U}mPP8n?N#X9`B;+_Gj7;n?;R3mm*9;nX-3x kBK!zx;Txs<0It60VmS2*KP&E}Kkv8y09 #include #include +#include #include "core/DatabaseIcons.h" #include "core/Entry.h" #include "core/Global.h" #include "core/Group.h" #include "core/Metadata.h" +#include "core/FilePath.h" // String being displayed when hiding content const QString EntryModel::HiddenContentDisplay(QString("\u25cf").repeated(6)); @@ -35,15 +37,17 @@ const QString EntryModel::HiddenContentDisplay(QString("\u25cf").repeated(6)); // Format used to display dates const Qt::DateFormat EntryModel::DateFormat = Qt::DefaultLocaleShortDate; -// Paperclip symbol -const QString EntryModel::PaperClipDisplay("\U0001f4ce"); - EntryModel::EntryModel(QObject* parent) : QAbstractTableModel(parent) , m_group(nullptr) , m_hideUsernames(false) , m_hidePasswords(true) + , m_paperClipPixmap(FilePath::instance()->icon("actions", "paperclip").pixmap(16)) + , m_paperClipPixmapCentered(24, 16) { + m_paperClipPixmapCentered.fill(Qt::transparent); + QPainter painter(&m_paperClipPixmapCentered); + painter.drawPixmap(8, 0, m_paperClipPixmap); } Entry* EntryModel::entryFromIndex(const QModelIndex& index) const @@ -205,9 +209,6 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const case Accessed: result = entry->timeInfo().lastAccessTime().toLocalTime().toString(EntryModel::DateFormat); return result; - case Paperclip: - result = entry->attachments()->keys().isEmpty() ? QString() : EntryModel::PaperClipDisplay; - return result; case Attachments: // Display comma-separated list of attachments QList attachments = entry->attachments()->keys(); @@ -238,7 +239,7 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const case Paperclip: // Display entries with attachments above those without when // sorting ascendingly (and vice versa when sorting descendingly) - return entry->attachments()->keys().isEmpty() ? 1 : 0; + return entry->attachments()->isEmpty() ? 1 : 0; default: // For all other columns, simply use data provided by Qt::Display- // Role for sorting @@ -257,6 +258,10 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const } else { return entry->iconScaledPixmap(); } + case Paperclip: + if (!entry->attachments()->isEmpty()) { + return m_paperClipPixmapCentered; + } } } else if (role == Qt::FontRole) { QFont font; @@ -279,12 +284,6 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const if (index.column() == Paperclip) { return Qt::AlignCenter; } - } else if (role == Qt::SizeHintRole) { - if (index.column() == Paperclip) { - QFont font; - QFontMetrics fm(font); - return fm.width(PaperClipDisplay) / 2; - } } return QVariant(); @@ -316,15 +315,12 @@ QVariant EntryModel::headerData(int section, Qt::Orientation orientation, int ro return tr("Modified"); case Accessed: return tr("Accessed"); - case Paperclip: - return EntryModel::PaperClipDisplay; case Attachments: return tr("Attachments"); } - } else if (role == Qt::TextAlignmentRole) { - switch (section) { - case Paperclip: - return Qt::AlignCenter; + } else if (role == Qt::DecorationRole) { + if (section == Paperclip) { + return m_paperClipPixmap; } } diff --git a/src/gui/entry/EntryModel.h b/src/gui/entry/EntryModel.h index 7c668a5f..a2323c64 100644 --- a/src/gui/entry/EntryModel.h +++ b/src/gui/entry/EntryModel.h @@ -19,6 +19,7 @@ #define KEEPASSX_ENTRYMODEL_H #include +#include class Entry; class Group; @@ -95,9 +96,11 @@ private: bool m_hideUsernames; bool m_hidePasswords; + QPixmap m_paperClipPixmap; + QPixmap m_paperClipPixmapCentered; + static const QString HiddenContentDisplay; static const Qt::DateFormat DateFormat; - static const QString PaperClipDisplay; }; #endif // KEEPASSX_ENTRYMODEL_H diff --git a/src/gui/entry/EntryView.cpp b/src/gui/entry/EntryView.cpp index 67169d27..dbbdd144 100644 --- a/src/gui/entry/EntryView.cpp +++ b/src/gui/entry/EntryView.cpp @@ -72,6 +72,10 @@ EntryView::EntryView(QWidget* parent) m_columnActions->setExclusive(false); for (int columnIndex = 1; columnIndex < header()->count(); ++columnIndex) { QString caption = m_model->headerData(columnIndex, Qt::Horizontal, Qt::DisplayRole).toString(); + if (columnIndex == EntryModel::Paperclip) { + caption = tr("Attachments (icon)"); + } + QAction* action = m_headerMenu->addAction(caption); action->setCheckable(true); action->setData(columnIndex); From 77e345570d6c0d5e52cddf28d6759d27a805b5e9 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Sat, 24 Feb 2018 07:44:28 -0500 Subject: [PATCH 08/14] Correct test failures; moved gui calls into gui objects --- src/gui/entry/EntryModel.cpp | 15 ++++++++++----- src/gui/entry/EntryModel.h | 2 ++ src/gui/entry/EntryView.cpp | 3 +++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gui/entry/EntryModel.cpp b/src/gui/entry/EntryModel.cpp index ab2a8114..afd25aa1 100644 --- a/src/gui/entry/EntryModel.cpp +++ b/src/gui/entry/EntryModel.cpp @@ -29,7 +29,6 @@ #include "core/Global.h" #include "core/Group.h" #include "core/Metadata.h" -#include "core/FilePath.h" // String being displayed when hiding content const QString EntryModel::HiddenContentDisplay(QString("\u25cf").repeated(6)); @@ -42,12 +41,9 @@ EntryModel::EntryModel(QObject* parent) , m_group(nullptr) , m_hideUsernames(false) , m_hidePasswords(true) - , m_paperClipPixmap(FilePath::instance()->icon("actions", "paperclip").pixmap(16)) + , m_paperClipPixmap(16, 16) , m_paperClipPixmapCentered(24, 16) { - m_paperClipPixmapCentered.fill(Qt::transparent); - QPainter painter(&m_paperClipPixmapCentered); - painter.drawPixmap(8, 0, m_paperClipPixmap); } Entry* EntryModel::entryFromIndex(const QModelIndex& index) const @@ -504,3 +500,12 @@ void EntryModel::togglePasswordsHidden(const bool hide) { setPasswordsHidden(hide); } + +void EntryModel::setPaperClipPixmap(const QPixmap& paperclip) +{ + m_paperClipPixmap = paperclip; + + m_paperClipPixmapCentered.fill(Qt::transparent); + QPainter painter2(&m_paperClipPixmapCentered); + painter2.drawPixmap(8, 0, paperclip); +} diff --git a/src/gui/entry/EntryModel.h b/src/gui/entry/EntryModel.h index a2323c64..b436c6a9 100644 --- a/src/gui/entry/EntryModel.h +++ b/src/gui/entry/EntryModel.h @@ -66,6 +66,8 @@ public: bool isPasswordsHidden() const; void setPasswordsHidden(const bool hide); + void setPaperClipPixmap(const QPixmap& paperclip); + signals: void switchedToListMode(); void switchedToSearchMode(); diff --git a/src/gui/entry/EntryView.cpp b/src/gui/entry/EntryView.cpp index dbbdd144..f39dd218 100644 --- a/src/gui/entry/EntryView.cpp +++ b/src/gui/entry/EntryView.cpp @@ -22,6 +22,7 @@ #include #include +#include "core/FilePath.h" #include "gui/SortFilterHideProxyModel.h" EntryView::EntryView(QWidget* parent) @@ -114,6 +115,8 @@ EntryView::EntryView(QWidget* parent) m_sortModel->sort(EntryModel::Title, Qt::AscendingOrder); sortByColumn(EntryModel::Title, Qt::AscendingOrder); m_defaultListViewState = header()->saveState(); + + m_model->setPaperClipPixmap(filePath()->icon("actions", "paperclip").pixmap(16)); } void EntryView::keyPressEvent(QKeyEvent* event) From 686adbe65a56ce0fb57ae95b07cb919d51decb52 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Wed, 21 Feb 2018 21:25:04 -0500 Subject: [PATCH 09/14] Set paperclip column to be fixed size; correct test failures --- src/gui/entry/EntryModel.cpp | 12 ++--- src/gui/entry/EntryModel.h | 1 - src/gui/entry/EntryView.cpp | 91 +++++++++++++++++++++--------------- src/gui/entry/EntryView.h | 5 +- 4 files changed, 61 insertions(+), 48 deletions(-) diff --git a/src/gui/entry/EntryModel.cpp b/src/gui/entry/EntryModel.cpp index afd25aa1..6f7ebf6a 100644 --- a/src/gui/entry/EntryModel.cpp +++ b/src/gui/entry/EntryModel.cpp @@ -41,8 +41,6 @@ EntryModel::EntryModel(QObject* parent) , m_group(nullptr) , m_hideUsernames(false) , m_hidePasswords(true) - , m_paperClipPixmap(16, 16) - , m_paperClipPixmapCentered(24, 16) { } @@ -251,13 +249,13 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const case Title: if (entry->isExpired()) { return databaseIcons()->iconPixmap(DatabaseIcons::ExpiredIconIndex); - } else { - return entry->iconScaledPixmap(); } + return entry->iconScaledPixmap(); case Paperclip: if (!entry->attachments()->isEmpty()) { - return m_paperClipPixmapCentered; + return m_paperClipPixmap; } + break; } } else if (role == Qt::FontRole) { QFont font; @@ -504,8 +502,4 @@ void EntryModel::togglePasswordsHidden(const bool hide) void EntryModel::setPaperClipPixmap(const QPixmap& paperclip) { m_paperClipPixmap = paperclip; - - m_paperClipPixmapCentered.fill(Qt::transparent); - QPainter painter2(&m_paperClipPixmapCentered); - painter2.drawPixmap(8, 0, paperclip); } diff --git a/src/gui/entry/EntryModel.h b/src/gui/entry/EntryModel.h index b436c6a9..4fc76504 100644 --- a/src/gui/entry/EntryModel.h +++ b/src/gui/entry/EntryModel.h @@ -99,7 +99,6 @@ private: bool m_hidePasswords; QPixmap m_paperClipPixmap; - QPixmap m_paperClipPixmapCentered; static const QString HiddenContentDisplay; static const Qt::DateFormat DateFormat; diff --git a/src/gui/entry/EntryView.cpp b/src/gui/entry/EntryView.cpp index f39dd218..19978a80 100644 --- a/src/gui/entry/EntryView.cpp +++ b/src/gui/entry/EntryView.cpp @@ -90,19 +90,18 @@ EntryView::EntryView(QWidget* parent) m_headerMenu->addSeparator(); m_headerMenu->addAction(tr("Reset to defaults"), this, SLOT(resetViewToDefaults())); + header()->setMinimumSectionSize(24); header()->setDefaultSectionSize(100); - // Stretching of last section interferes with fitting columns to window header()->setStretchLastSection(false); header()->setContextMenuPolicy(Qt::CustomContextMenu); + connect(header(), SIGNAL(customContextMenuRequested(QPoint)), SLOT(showHeaderMenu(QPoint))); connect(header(), SIGNAL(sectionCountChanged(int, int)), SIGNAL(viewStateChanged())); connect(header(), SIGNAL(sectionMoved(int, int, int)), SIGNAL(viewStateChanged())); connect(header(), SIGNAL(sectionResized(int, int, int)), SIGNAL(viewStateChanged())); connect(header(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), SIGNAL(viewStateChanged())); - // TODO: not working as expected, columns will end up being very small, - // most likely due to the widget not being sized properly at this time - //fitColumnsToWindow(); + resetFixedColumns(); // Configure default search view state and save for later use header()->showSection(EntryModel::ParentGroup); @@ -299,9 +298,11 @@ QByteArray EntryView::viewState() const /** * Set view state */ -bool EntryView::setViewState(const QByteArray& state) const +bool EntryView::setViewState(const QByteArray& state) { - return header()->restoreState(state); + bool status = header()->restoreState(state); + resetFixedColumns(); + return status; } /** @@ -374,6 +375,8 @@ void EntryView::toggleColumnVisibility(QAction *action) void EntryView::fitColumnsToWindow() { header()->resizeSections(QHeaderView::Stretch); + resetFixedColumns(); + fillRemainingWidth(true); emit viewStateChanged(); } @@ -385,37 +388,8 @@ void EntryView::fitColumnsToContents() { // Resize columns to fit contents header()->resizeSections(QHeaderView::ResizeToContents); - - // Determine total width of currently visible columns. If there is - // still some space available on the header, equally distribute it to - // visible columns and add remaining fraction to last visible column - int width = 0; - for (int columnIndex = 0; columnIndex < header()->count(); ++columnIndex) { - if (!header()->isSectionHidden(columnIndex)) { - width += header()->sectionSize(columnIndex); - } - } - int visible = header()->count() - header()->hiddenSectionCount(); - int avail = header()->width() - width; - if ((visible <= 0) || (avail <= 0)) { - return; - } - int add = avail / visible; - width = 0; - int last = 0; - for (int columnIndex = 0; columnIndex < header()->count(); ++columnIndex) { - if (!header()->isSectionHidden(columnIndex)) { - header()->resizeSection(columnIndex, header()->sectionSize(columnIndex) + add); - width += header()->sectionSize(columnIndex); - if (header()->visualIndex(columnIndex) > last) { - last = header()->visualIndex(columnIndex); - } - } - } - header()->resizeSection(header()->logicalIndex(last), header()->sectionSize(last) + (header()->width() - width)); - - // Shouldn't be necessary due to use of header()->resizeSection, but - // lets just do it anyway for the sake of completeness + resetFixedColumns(); + fillRemainingWidth(false); emit viewStateChanged(); } @@ -435,3 +409,46 @@ void EntryView::resetViewToDefaults() fitColumnsToWindow(); } + +void EntryView::fillRemainingWidth(bool lastColumnOnly) +{ + // Determine total width of currently visible columns + int width = 0; + int lastColumnIndex = 0; + for (int columnIndex = 0; columnIndex < header()->count(); ++columnIndex) { + if (!header()->isSectionHidden(columnIndex)) { + width += header()->sectionSize(columnIndex); + } + if (header()->visualIndex(columnIndex) > lastColumnIndex) { + lastColumnIndex = header()->visualIndex(columnIndex); + } + } + + int numColumns = header()->count() - header()->hiddenSectionCount(); + int availWidth = header()->width() - width; + if ((numColumns <= 0) || (availWidth <= 0)) { + return; + } + + if (!lastColumnOnly) { + // Equally distribute remaining width to visible columns + int add = availWidth / numColumns; + width = 0; + for (int columnIndex = 0; columnIndex < header()->count(); ++columnIndex) { + if (!header()->isSectionHidden(columnIndex)) { + header()->resizeSection(columnIndex, header()->sectionSize(columnIndex) + add); + width += header()->sectionSize(columnIndex); + } + } + } + + // Add remaining width to last column + header()->resizeSection(header()->logicalIndex(lastColumnIndex), header()->sectionSize(lastColumnIndex) + (header()->width() - width)); +} + +void EntryView::resetFixedColumns() +{ + header()->setSectionResizeMode(EntryModel::Paperclip, QHeaderView::Fixed); + header()->resizeSection(EntryModel::Paperclip, header()->minimumSectionSize()); +} + diff --git a/src/gui/entry/EntryView.h b/src/gui/entry/EntryView.h index 26672a66..a8422c56 100644 --- a/src/gui/entry/EntryView.h +++ b/src/gui/entry/EntryView.h @@ -48,7 +48,7 @@ public: bool isPasswordsHidden() const; void setPasswordsHidden(const bool hide); QByteArray viewState() const; - bool setViewState(const QByteArray& state) const; + bool setViewState(const QByteArray& state); public slots: void setGroup(Group* group); @@ -74,6 +74,9 @@ private slots: void resetViewToDefaults(); private: + void fillRemainingWidth(bool lastColumnOnly); + void resetFixedColumns(); + EntryModel* const m_model; SortFilterHideProxyModel* const m_sortModel; bool m_inSearchMode; From a06a1f84e08f01186f723b64a035ac7985f265b6 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Wed, 21 Feb 2018 23:01:02 +0100 Subject: [PATCH 10/14] Don't hardcode install_name_tool change path, resolves #1518 --- CMakeLists.txt | 2 ++ share/translations/CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 2 +- src/proxy/CMakeLists.txt | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index edfd341a..7a1b0245 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -298,6 +298,8 @@ if(Qt5Core_VERSION VERSION_LESS "5.2.0") message(FATAL_ERROR "Qt version 5.2.0 or higher is required") endif() +get_filename_component(Qt5_PREFIX ${Qt5_DIR}/../../.. REALPATH) + set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) diff --git a/share/translations/CMakeLists.txt b/share/translations/CMakeLists.txt index 78ff0bcc..5ca73969 100644 --- a/share/translations/CMakeLists.txt +++ b/share/translations/CMakeLists.txt @@ -23,12 +23,12 @@ message(STATUS "Including translations...\n") qt5_add_translation(QM_FILES ${TRANSLATION_FILES}) if(MINGW) - file(GLOB QTBASE_TRANSLATIONS ${Qt5_DIR}/../../../share/qt5/translations/qtbase_*.qm) + file(GLOB QTBASE_TRANSLATIONS ${Qt5_PREFIX}/share/qt5/translations/qtbase_*.qm) elseif(APPLE OR KEEPASSXC_DIST_APPIMAGE) file(GLOB QTBASE_TRANSLATIONS /usr/share/qt/translations/qtbase_*.qm /usr/share/qt5/translations/qtbase_*.qm - ${Qt5_DIR}/../../../translations/qtbase_*.qm) + ${Qt5_PREFIX}/translations/qtbase_*.qm) endif() set(QM_FILES ${QM_FILES} ${QTBASE_TRANSLATIONS}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f9e562df..10a06e0f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -382,7 +382,7 @@ if(MINGW) include(DeployQt4) install_qt4_executable(${PROGNAME}.exe) add_custom_command(TARGET ${PROGNAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${Qt5_DIR}/../../../share/qt5/plugins/platforms/qwindows$<$:d>.dll + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${Qt5_PREFIX}/share/qt5/plugins/platforms/qwindows$<$:d>.dll $) install(FILES $/qwindows$<$:d>.dll DESTINATION "platforms") endif() diff --git a/src/proxy/CMakeLists.txt b/src/proxy/CMakeLists.txt index 35e02ea2..f19481c0 100755 --- a/src/proxy/CMakeLists.txt +++ b/src/proxy/CMakeLists.txt @@ -42,13 +42,13 @@ if(WITH_XC_BROWSER) add_custom_command(TARGET keepassxc-proxy POST_BUILD - COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore "@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore" ${PROXY_APP_DIR} + COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change ${Qt5_PREFIX}/lib/QtCore.framework/Versions/5/QtCore "@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore" ${PROXY_APP_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src COMMENT "Changing linking of keepassxc-proxy QtCore") add_custom_command(TARGET keepassxc-proxy POST_BUILD - COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change /usr/local/opt/qt/lib/QtNetwork.framework/Versions/5/QtNetwork "@executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork" ${PROXY_APP_DIR} + COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change ${Qt5_PREFIX}/lib/QtNetwork.framework/Versions/5/QtNetwork "@executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork" ${PROXY_APP_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src COMMENT "Changing linking of keepassxc-proxy QtNetwork") endif() From ad92b11f127043845de792a5503ba13f35984d62 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Sun, 25 Feb 2018 02:00:31 +0100 Subject: [PATCH 11/14] Use edlided label for details widget title and adjust layout spacing --- src/gui/DatabaseWidget.cpp | 8 +- src/gui/DetailsWidget.cpp | 4 +- src/gui/DetailsWidget.ui | 342 ++++++++++++++++++++++--------------- 3 files changed, 211 insertions(+), 143 deletions(-) diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 06b7b87b..ff9d15fc 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -76,7 +76,7 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent) m_messageWidget = new MessageWidget(this); m_messageWidget->setHidden(true); - QVBoxLayout* mainLayout = new QVBoxLayout(); + auto* mainLayout = new QVBoxLayout(); QLayout* layout = new QHBoxLayout(); mainLayout->addWidget(m_messageWidget); mainLayout->addLayout(layout); @@ -119,7 +119,7 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent) connect(m_detailsView, SIGNAL(errorOccurred(QString)), this, SLOT(showErrorMessage(QString))); - QVBoxLayout* vLayout = new QVBoxLayout(rightHandSideWidget); + auto* vLayout = new QVBoxLayout(rightHandSideWidget); vLayout->setMargin(0); vLayout->addWidget(m_searchingLabel); vLayout->addWidget(m_detailSplitter); @@ -127,8 +127,8 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent) m_detailSplitter->addWidget(m_entryView); m_detailSplitter->addWidget(m_detailsView); - m_detailSplitter->setStretchFactor(0, 80); - m_detailSplitter->setStretchFactor(1, 20); + m_detailSplitter->setStretchFactor(0, 100); + m_detailSplitter->setStretchFactor(1, 0); m_searchingLabel->setVisible(false); diff --git a/src/gui/DetailsWidget.cpp b/src/gui/DetailsWidget.cpp index 1ac20c9d..77de2466 100644 --- a/src/gui/DetailsWidget.cpp +++ b/src/gui/DetailsWidget.cpp @@ -134,7 +134,7 @@ void DetailsWidget::updateEntryHeaderLine() { Q_ASSERT(m_currentEntry); const QString title = m_currentEntry->resolveMultiplePlaceholders(m_currentEntry->title()); - m_ui->entryTitleLabel->setText(hierarchy(m_currentEntry->group(), title)); + m_ui->entryTitleLabel->setRawText(hierarchy(m_currentEntry->group(), title)); m_ui->entryIcon->setPixmap(preparePixmap(m_currentEntry->iconPixmap(), 16)); } @@ -250,7 +250,7 @@ void DetailsWidget::updateEntryAutotypeTab() void DetailsWidget::updateGroupHeaderLine() { Q_ASSERT(m_currentGroup); - m_ui->groupTitleLabel->setText(hierarchy(m_currentGroup, {})); + m_ui->groupTitleLabel->setRawText(hierarchy(m_currentGroup, {})); m_ui->groupIcon->setPixmap(preparePixmap(m_currentGroup->iconPixmap(), 32)); } diff --git a/src/gui/DetailsWidget.ui b/src/gui/DetailsWidget.ui index 5446f651..53787d71 100644 --- a/src/gui/DetailsWidget.ui +++ b/src/gui/DetailsWidget.ui @@ -25,11 +25,26 @@ + + 0 + + + 0 + + + 0 + + + 0 + - + QLayout::SetDefaultConstraint + + 9 + @@ -44,9 +59,9 @@ - + - + 0 0 @@ -61,19 +76,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -152,22 +154,75 @@ - - - - - Qt::Horizontal + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + - - QSizePolicy::Fixed - - + - 20 - 20 + 100 + 0 - + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + PointingHandCursor + + + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + @@ -194,21 +249,8 @@ - - - - - 100 - 0 - - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - + + 0 @@ -222,20 +264,20 @@ - Password + Expiration Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - 100 - 0 - + + + + + 0 + 0 + @@ -261,24 +303,24 @@ - - - + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + - 100 - 0 + 20 + 20 - - PointingHandCursor - - - - - + - - + + 0 @@ -292,25 +334,22 @@ - Expiration + Password Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + Qt::Vertical - 20 - 10 + 0 + 0 @@ -418,11 +457,26 @@ + + 0 + + + 0 + + + 0 + + + 0 + - + QLayout::SetDefaultConstraint + + 9 + @@ -437,9 +491,9 @@ - + - + 0 0 @@ -454,19 +508,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -503,22 +544,50 @@ - - - - - Qt::Horizontal + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + - - QSizePolicy::Fixed + + + + + + + 0 + 0 + - - - 20 - 20 - + + + 75 + true + - + + Expiration + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + @@ -543,7 +612,40 @@ - + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + @@ -567,45 +669,11 @@ - - - - - - - - 0 - 0 - - - - - 75 - true - - - - Expiration - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - + Qt::Vertical - - - 20 - 10 - - From 09d3896304b021b57bfb0987221a4650aea4d10d Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Sun, 25 Feb 2018 20:02:12 +0100 Subject: [PATCH 12/14] Force Docker rebuild --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5bcef9ab..31d8cf6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ FROM ubuntu:14.04 -ENV REBUILD_COUNTER=5 +ENV REBUILD_COUNTER=6 ENV QT5_VERSION=59 ENV QT5_PPA_VERSION=${QT5_VERSION}4 From 2e9f247e292e1d0ebe088c2532479e721bdf0e9a Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Mon, 26 Feb 2018 00:26:28 +0100 Subject: [PATCH 13/14] Enable proper KeePassXC-Browser interaction for AppImage --- AppImage-Recipe.sh | 5 +++++ src/browser/BrowserOptionDialog.cpp | 6 ++++++ src/browser/HostInstaller.cpp | 11 +++++++++++ 3 files changed, 22 insertions(+) diff --git a/AppImage-Recipe.sh b/AppImage-Recipe.sh index 342dd084..96e7b409 100755 --- a/AppImage-Recipe.sh +++ b/AppImage-Recipe.sh @@ -88,6 +88,11 @@ unset XDG_DATA_DIRS if [ "\${1}" == "cli" ]; then shift exec keepassxc-cli "\$@" +elif [ "\${1}" == "proxy" ]; then + shift + exec keepassxc-proxy "\$@" +elif [ -v CHROME_WRAPPER ] || [ -v MOZ_LAUNCHED_CHILD ]; then + exec keepassxc-proxy "\$@" else exec keepassxc "\$@" fi diff --git a/src/browser/BrowserOptionDialog.cpp b/src/browser/BrowserOptionDialog.cpp index f6d634a8..39b514fd 100755 --- a/src/browser/BrowserOptionDialog.cpp +++ b/src/browser/BrowserOptionDialog.cpp @@ -19,6 +19,7 @@ #include "BrowserOptionDialog.h" #include "ui_BrowserOptionDialog.h" +#include "config-keepassx.h" #include "BrowserSettings.h" #include "core/FilePath.h" @@ -45,6 +46,11 @@ BrowserOptionDialog::BrowserOptionDialog(QWidget* parent) : connect(m_ui->useCustomProxy, SIGNAL(toggled(bool)), m_ui->customProxyLocation, SLOT(setEnabled(bool))); connect(m_ui->useCustomProxy, SIGNAL(toggled(bool)), m_ui->customProxyLocationBrowseButton, SLOT(setEnabled(bool))); connect(m_ui->customProxyLocationBrowseButton, SIGNAL(clicked()), this, SLOT(showProxyLocationFileDialog())); + +#ifdef KEEPASSXC_DIST_APPIMAGE + m_ui->supportBrowserProxy->setChecked(true); + m_ui->supportBrowserProxy->setEnabled(false); +#endif } BrowserOptionDialog::~BrowserOptionDialog() diff --git a/src/browser/HostInstaller.cpp b/src/browser/HostInstaller.cpp index 9271da69..9b27ab1c 100644 --- a/src/browser/HostInstaller.cpp +++ b/src/browser/HostInstaller.cpp @@ -17,12 +17,14 @@ */ #include "HostInstaller.h" +#include "config-keepassx.h" #include #include #include #include #include #include +#include #include const QString HostInstaller::HOST_NAME = "org.keepassxc.keepassxc_browser"; @@ -161,6 +163,13 @@ QString HostInstaller::getInstallDir(SupportedBrowsers browser) const QJsonObject HostInstaller::constructFile(SupportedBrowsers browser, const bool& proxy, const QString& location) { QString path; +#ifdef KEEPASSXC_DIST_APPIMAGE + if (proxy && !location.isEmpty()) { + path = location; + } else { + path = QProcessEnvironment::systemEnvironment().value("APPIMAGE"); + } +#else if (proxy) { if (!location.isEmpty()) { path = location; @@ -178,6 +187,8 @@ QJsonObject HostInstaller::constructFile(SupportedBrowsers browser, const bool& path.replace("/","\\"); #endif +#endif // #ifdef KEEPASSXC_DIST_APPIMAGE + QJsonObject script; script["name"] = HostInstaller::HOST_NAME; script["description"] = "KeePassXC integration with native messaging support"; From 0668c2be94e8ea7eda2459f578bea4160eee88b3 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Mon, 26 Feb 2018 01:34:16 +0100 Subject: [PATCH 14/14] Inform user that KeePassXC-Browser is not supported for Snaps at the moment --- src/browser/BrowserOptionDialog.cpp | 17 +++++++++++++---- src/browser/BrowserOptionDialog.ui | 3 +++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/browser/BrowserOptionDialog.cpp b/src/browser/BrowserOptionDialog.cpp index 39b514fd..693e62d2 100755 --- a/src/browser/BrowserOptionDialog.cpp +++ b/src/browser/BrowserOptionDialog.cpp @@ -47,10 +47,7 @@ BrowserOptionDialog::BrowserOptionDialog(QWidget* parent) : connect(m_ui->useCustomProxy, SIGNAL(toggled(bool)), m_ui->customProxyLocationBrowseButton, SLOT(setEnabled(bool))); connect(m_ui->customProxyLocationBrowseButton, SIGNAL(clicked()), this, SLOT(showProxyLocationFileDialog())); -#ifdef KEEPASSXC_DIST_APPIMAGE - m_ui->supportBrowserProxy->setChecked(true); - m_ui->supportBrowserProxy->setEnabled(false); -#endif + m_ui->browserGlobalWarningWidget->setVisible(false); } BrowserOptionDialog::~BrowserOptionDialog() @@ -90,6 +87,18 @@ void BrowserOptionDialog::loadSettings() m_ui->chromiumSupport->setChecked(settings.chromiumSupport()); m_ui->firefoxSupport->setChecked(settings.firefoxSupport()); m_ui->vivaldiSupport->setChecked(settings.vivaldiSupport()); + +#if defined(KEEPASSXC_DIST_APPIMAGE) + m_ui->supportBrowserProxy->setChecked(true); + m_ui->supportBrowserProxy->setEnabled(false); +#elif defined(KEEPASSXC_DIST_SNAP) + m_ui->enableBrowserSupport->setChecked(false); + m_ui->enableBrowserSupport->setEnabled(false); + m_ui->browserGlobalWarningWidget->showMessage( + tr("We're sorry, but KeePassXC-Browser is not supported for Snap releases at the moment."), MessageWidget::Warning); + m_ui->browserGlobalWarningWidget->setCloseButtonVisible(false); + m_ui->browserGlobalWarningWidget->setAutoHideTimeout(-1); +#endif } void BrowserOptionDialog::saveSettings() diff --git a/src/browser/BrowserOptionDialog.ui b/src/browser/BrowserOptionDialog.ui index 9bb0250b..e8237945 100755 --- a/src/browser/BrowserOptionDialog.ui +++ b/src/browser/BrowserOptionDialog.ui @@ -26,6 +26,9 @@ 0 + + +