From 04b3b3dbc56aa9c34b7d25c136ce41aa203081ae Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Sun, 26 Feb 2017 18:47:36 +0100 Subject: [PATCH 1/5] Assign role 'NoRole' instead of 'Accept' to not mess with button order --- src/gui/DatabaseTabWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp index 8042c1130..3168fc383 100644 --- a/src/gui/DatabaseTabWidget.cpp +++ b/src/gui/DatabaseTabWidget.cpp @@ -165,7 +165,7 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw, msgBox.setIcon(QMessageBox::Question); msgBox.addButton(QMessageBox::Yes); msgBox.addButton(QMessageBox::No); - auto readOnlyButton = msgBox.addButton(tr("Open read-only"), QMessageBox::AcceptRole); + auto readOnlyButton = msgBox.addButton(tr("Open read-only"), QMessageBox::NoRole); msgBox.setDefaultButton(readOnlyButton); msgBox.setEscapeButton(QMessageBox::No); auto result = msgBox.exec(); From a31c423d9e9e67ff56efd007f27b674884d817ac Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Sun, 26 Feb 2017 21:31:53 +0100 Subject: [PATCH 2/5] Fix compiler warnings in QHttp library --- src/http/Protocol.cpp | 2 +- src/http/qhttp/http-parser/http_parser.h | 6 +++--- src/http/qhttp/private/httpreader.hxx | 2 +- src/http/qhttp/private/qhttpclient_private.hpp | 2 +- src/http/qhttp/private/qhttpserver_private.hpp | 2 +- src/http/qhttp/private/qhttpserverconnection_private.hpp | 2 +- src/http/qhttp/qhttpabstracts.cpp | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/http/Protocol.cpp b/src/http/Protocol.cpp index 40a1445c0..bcb30f0b1 100644 --- a/src/http/Protocol.cpp +++ b/src/http/Protocol.cpp @@ -110,7 +110,7 @@ static QByteArray encrypt2(const QByteArray & data, SymmetricCipherGcrypt & ciph //Encrypt QByteArray buffer = data + QByteArray(paddingSize, paddingSize); cipher.reset(); - cipher.processInPlace(buffer); + Q_UNUSED(cipher.processInPlace(buffer)); return buffer; } diff --git a/src/http/qhttp/http-parser/http_parser.h b/src/http/qhttp/http-parser/http_parser.h index 45c72a078..005db96ec 100644 --- a/src/http/qhttp/http-parser/http_parser.h +++ b/src/http/qhttp/http-parser/http_parser.h @@ -91,7 +91,7 @@ typedef int (*http_cb) (http_parser*); /* Status Codes */ -#define HTTP_STATUS_MAP(XX) \ +#define HTTPPARSER_HTTP_STATUS_MAP(XX) \ XX(100, CONTINUE, Continue) \ XX(101, SWITCHING_PROTOCOLS, Switching Protocols) \ XX(102, PROCESSING, Processing) \ @@ -150,12 +150,12 @@ typedef int (*http_cb) (http_parser*); XX(507, INSUFFICIENT_STORAGE, Insufficient Storage) \ XX(508, LOOP_DETECTED, Loop Detected) \ XX(510, NOT_EXTENDED, Not Extended) \ - XX(511, NETWORK_AUTHENTICATION_REQUIRED, Network Authentication Required) \ + XX(511, NETWORK_AUTHENTICATION_REQUIRED, Network Authentication Required) enum http_status { #define XX(num, name, string) HTTP_STATUS_##name = num, - HTTP_STATUS_MAP(XX) + HTTPPARSER_HTTP_STATUS_MAP(XX) #undef XX }; diff --git a/src/http/qhttp/private/httpreader.hxx b/src/http/qhttp/private/httpreader.hxx index 174b31a95..338ed2a2f 100644 --- a/src/http/qhttp/private/httpreader.hxx +++ b/src/http/qhttp/private/httpreader.hxx @@ -41,7 +41,7 @@ public: if ( !icollectRequired ) // not allowed to collect data return false; - int newLength = icollectedData.length() + (int) length; + int newLength = icollectedData.length() + static_cast(length); if ( icollectCapacity > 0 && newLength > icollectCapacity ) return false; // the capacity is full diff --git a/src/http/qhttp/private/qhttpclient_private.hpp b/src/http/qhttp/private/qhttpclient_private.hpp index 3206da5f3..9c6cd0989 100644 --- a/src/http/qhttp/private/qhttpclient_private.hpp +++ b/src/http/qhttp/private/qhttpclient_private.hpp @@ -112,7 +112,7 @@ protected: void onReadyRead() { while ( isocket.bytesAvailable() > 0 ) { char buffer[4097] = {0}; - size_t readLength = (size_t) isocket.readRaw(buffer, 4096); + size_t readLength = static_cast(isocket.readRaw(buffer, 4096)); parse(buffer, readLength); } diff --git a/src/http/qhttp/private/qhttpserver_private.hpp b/src/http/qhttp/private/qhttpserver_private.hpp index 93c96d2e1..e7c081af4 100644 --- a/src/http/qhttp/private/qhttpserver_private.hpp +++ b/src/http/qhttp/private/qhttpserver_private.hpp @@ -42,7 +42,7 @@ public: // if it's a QLocalServer virtual void incomingConnection(quintptr socketDescriptor) { - iserver->incomingConnection((qintptr) socketDescriptor); + iserver->incomingConnection(static_cast(socketDescriptor)); } }; diff --git a/src/http/qhttp/private/qhttpserverconnection_private.hpp b/src/http/qhttp/private/qhttpserverconnection_private.hpp index fd4475864..53b349fa9 100644 --- a/src/http/qhttp/private/qhttpserverconnection_private.hpp +++ b/src/http/qhttp/private/qhttpserverconnection_private.hpp @@ -83,7 +83,7 @@ public: void onReadyRead() { while ( isocket.bytesAvailable() > 0 ) { char buffer[4097] = {0}; - size_t readLength = (size_t) isocket.readRaw(buffer, 4096); + size_t readLength = static_cast(isocket.readRaw(buffer, 4096)); parse(buffer, readLength); } diff --git a/src/http/qhttp/qhttpabstracts.cpp b/src/http/qhttp/qhttpabstracts.cpp index 1b106e51f..a29a90b9f 100644 --- a/src/http/qhttp/qhttpabstracts.cpp +++ b/src/http/qhttp/qhttpabstracts.cpp @@ -8,7 +8,7 @@ namespace qhttp { # error "to compile QHttp classes, Qt 5.0 or later is needed." #endif -#define HTTP_STATUS_MAP(XX) \ +#define QHTTPABSTRACTS_HTTP_STATUS_MAP(XX) \ XX(100, "Continue") \ XX(101, "Switching Protocols") \ /* RFC 2518) obsoleted by RFC 4918 */ \ @@ -78,7 +78,7 @@ static struct { int code; const char* message; } g_status_codes[] { - HTTP_STATUS_MAP(PATCH_STATUS_CODES) + QHTTPABSTRACTS_HTTP_STATUS_MAP(PATCH_STATUS_CODES) }; #undef PATCH_STATUS_CODES From 5654dc99076286be726865d8ac5b8afcd94b52dd Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Tue, 28 Feb 2017 14:30:12 +0100 Subject: [PATCH 3/5] Update README to reflect current text from our website --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e892f1b01..ab5df61aa 100644 --- a/README.md +++ b/README.md @@ -3,22 +3,23 @@ [![Travis Build Status](https://travis-ci.org/keepassxreboot/keepassxc.svg?branch=develop)](https://travis-ci.org/keepassxreboot/keepassxc) [![Coverage Status](https://coveralls.io/repos/github/keepassxreboot/keepassxc/badge.svg)](https://coveralls.io/github/keepassxreboot/keepassxc) ## About -KeePassXC is a fork of [KeePassX](https://www.keepassx.org/) that [aims to incorporate stalled pull requests, features, and bug fixes that have never made it into the main KeePassX repository](https://github.com/keepassxreboot/keepassx/issues/43). +KeePassXC is a community fork of [KeePassX](https://www.keepassx.org/) with the goal to extend and improve it with new features and bugfixes to provide a feature-rich, fully cross-platform and modern open-source password manager. ## Additional features compared to KeePassX -- Autotype on all three major platforms (Linux, Windows, OS X) +- Auto-Type on all three major platforms (Linux, Windows, OS X) - Stand-alone password generator - Password strength meter -- Use website's favicons as entry icons +- Using website favicons as entry icons - Merging of databases - Automatic reload when the database changed on disk - KeePassHTTP support for use with [PassIFox](https://addons.mozilla.org/en-us/firefox/addon/passifox/) in Mozilla Firefox and [chromeIPass](https://chrome.google.com/webstore/detail/chromeipass/ompiailgknfdndiefoaoiligalphfdae) in Google Chrome or Chromium. +- Many bug fixes For a full list of features and changes, read the [CHANGELOG](CHANGELOG) document. ### Note about KeePassHTTP -KeePassHTTP is not a highly secure protocol and has certain flaw which allow an attacker to decrypt your passwords when they manage to intercept communication between a KeePassHTTP server and PassIFox/chromeIPass over a network connection (see [here](https://github.com/pfn/keepasshttp/issues/258) and [here](https://github.com/keepassxreboot/keepassxc/issues/147)). KeePassXC therefore strictly limits communication between itself and the browser plugin to your local computer. As long as your computer is not compromised, your passwords are fairly safe that way, but still use it at your own risk! +KeePassHTTP is not a highly secure protocol and has certain flaw which allow an attacker to decrypt your passwords when they manage to intercept communication between a KeePassHTTP server and PassIFox/chromeIPass over a network connection (see [here](https://github.com/pfn/keepasshttp/issues/258) and [here](https://github.com/keepassxreboot/keepassxc/issues/147)). KeePassXC therefore strictly limits communication between itself and the browser plugin to your local computer. As long as your computer is not compromised, your passwords are fairly safe that way, but use it at your own risk! ### Installation Pre-compiled binaries can be found on the [downloads page](https://keepassxc.org/download). Additionally, individual Linux distributions may ship their own versions, so please check out your distribution's package list to see if KeePassXC is available. From 4061fc7cf879a85c98fdd738c94e1ac88ac025a3 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Tue, 28 Feb 2017 22:45:40 -0500 Subject: [PATCH 4/5] Delete a custom icon with multiple entries using it (#357) * Made it possible to delete a custom icon with multiple entries using it --- src/gui/EditWidgetIcons.cpp | 74 ++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 25 deletions(-) diff --git a/src/gui/EditWidgetIcons.cpp b/src/gui/EditWidgetIcons.cpp index dd5c933a2..8cd9837d8 100644 --- a/src/gui/EditWidgetIcons.cpp +++ b/src/gui/EditWidgetIcons.cpp @@ -273,50 +273,74 @@ void EditWidgetIcons::removeCustomIcon() QModelIndex index = m_ui->customIconsView->currentIndex(); if (index.isValid()) { Uuid iconUuid = m_customIconModel->uuidFromIndex(index); - int iconUsedCount = 0; const QList allEntries = m_database->rootGroup()->entriesRecursive(true); + QList entriesWithSameIcon; QList historyEntriesWithSameIcon; for (Entry* entry : allEntries) { - bool isHistoryEntry = !entry->group(); if (iconUuid == entry->iconUuid()) { - if (isHistoryEntry) { + // Check if this is a history entry (no assigned group) + if (!entry->group()) { historyEntriesWithSameIcon << entry; - } - else if (m_currentUuid != entry->uuid()) { - iconUsedCount++; + } else if (m_currentUuid != entry->uuid()) { + entriesWithSameIcon << entry; } } } const QList allGroups = m_database->rootGroup()->groupsRecursive(true); - for (const Group* group : allGroups) { + QList groupsWithSameIcon; + + for (Group* group : allGroups) { if (iconUuid == group->iconUuid() && m_currentUuid != group->uuid()) { - iconUsedCount++; + groupsWithSameIcon << group; } } - if (iconUsedCount == 0) { - for (Entry* entry : asConst(historyEntriesWithSameIcon)) { - entry->setUpdateTimeinfo(false); - entry->setIcon(0); - entry->setUpdateTimeinfo(true); - } + int iconUseCount = entriesWithSameIcon.size() + groupsWithSameIcon.size(); + if (iconUseCount > 0) { + QMessageBox::StandardButton ans = MessageBox::question(this, tr("Confirm Delete"), + tr("This icon is used by %1 entries, and will be replaced " + "by the default icon. Are you sure you want to delete it?") + .arg(iconUseCount), QMessageBox::Yes | QMessageBox::No); - m_database->metadata()->removeCustomIcon(iconUuid); - m_customIconModel->setIcons(m_database->metadata()->customIconsScaledPixmaps(), - m_database->metadata()->customIconsOrder()); - if (m_customIconModel->rowCount() > 0) { - m_ui->customIconsView->setCurrentIndex(m_customIconModel->index(0, 0)); - } - else { - updateRadioButtonDefaultIcons(); + if (ans == QMessageBox::No) { + // Early out, nothing is changed + return; + } else { + // Revert matched entries to the default entry icon + for (Entry* entry : asConst(entriesWithSameIcon)) { + entry->setIcon(Entry::DefaultIconNumber); + } + + // Revert matched groups to the default group icon + for (Group* group : asConst(groupsWithSameIcon)) { + group->setIcon(Group::DefaultIconNumber); + } } } - else { - Q_EMIT messageEditEntry( - tr("Can't delete icon. Still used by %1 items.").arg(iconUsedCount), MessageWidget::Error); + + + // Remove the icon from history entries + for (Entry* entry : asConst(historyEntriesWithSameIcon)) { + entry->setUpdateTimeinfo(false); + entry->setIcon(0); + entry->setUpdateTimeinfo(true); + } + + // Remove the icon from the database + m_database->metadata()->removeCustomIcon(iconUuid); + m_customIconModel->setIcons(m_database->metadata()->customIconsScaledPixmaps(), + m_database->metadata()->customIconsOrder()); + + // Reset the current icon view + updateRadioButtonDefaultIcons(); + + if (m_database->resolveEntry(m_currentUuid) != nullptr) { + m_ui->defaultIconsView->setCurrentIndex(m_defaultIconModel->index(Entry::DefaultIconNumber)); + } else { + m_ui->defaultIconsView->setCurrentIndex(m_defaultIconModel->index(Group::DefaultIconNumber)); } } } From 52ab7b886546ead91d978564006a8dbbd9b8b205 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Wed, 1 Mar 2017 22:32:14 +0100 Subject: [PATCH 5/5] Use unified toolbar on OS X --- src/gui/MainWindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index a7347b35a..3298c8b6c 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -281,6 +281,10 @@ MainWindow::MainWindow() connect(m_ui->passwordGeneratorWidget, SIGNAL(dialogTerminated()), SLOT(closePasswordGen())); connect(m_ui->actionAbout, SIGNAL(triggered()), SLOT(showAboutDialog())); + +#ifdef Q_OS_MAC + setUnifiedTitleAndToolBarOnMac(true); +#endif updateTrayIcon(); }