mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Merge pull request #368 from keepassxreboot/feature/xc-flag-changes
Compile auto-type by default and encapsulate all networking code using WITH_XC_HTTP
This commit is contained in:
commit
37c9ad8e8d
@ -34,8 +34,8 @@ option(WITH_GUI_TESTS "Enable building of GUI tests" OFF)
|
||||
option(WITH_DEV_BUILD "Use only for development. Disables/warns about deprecated methods." OFF)
|
||||
option(WITH_COVERAGE "Use to build with coverage tests. (GCC ONLY)." OFF)
|
||||
|
||||
option(WITH_XC_AUTOTYPE "Include Autotype." OFF)
|
||||
option(WITH_XC_HTTP "Include KeePassHTTP." OFF)
|
||||
option(WITH_XC_AUTOTYPE "Include Auto-Type." ON)
|
||||
option(WITH_XC_HTTP "Include KeePassHTTP and Custom Icon Downloads." OFF)
|
||||
option(WITH_XC_YUBIKEY "Include Yubikey support." OFF)
|
||||
|
||||
set(KEEPASSXC_VERSION "2.1.3")
|
||||
|
@ -155,7 +155,7 @@ add_feature_info(Autotype WITH_XC_AUTOTYPE "Auto-type passwords in Input fields"
|
||||
|
||||
add_subdirectory(http)
|
||||
if(WITH_XC_HTTP)
|
||||
set(keepasshttp_LIB keepasshttp)
|
||||
set(keepasshttp_LIB keepasshttp qhttp Qt5::Network)
|
||||
endif()
|
||||
|
||||
add_subdirectory(autotype)
|
||||
@ -196,11 +196,9 @@ target_link_libraries(keepassx_core
|
||||
${keepasshttp_LIB}
|
||||
${autotype_LIB}
|
||||
zxcvbn
|
||||
qhttp
|
||||
Qt5::Core
|
||||
Qt5::Concurrent
|
||||
Qt5::Widgets
|
||||
Qt5::Network
|
||||
${GCRYPT_LIBRARIES}
|
||||
${GPGERROR_LIBRARIES}
|
||||
${ZLIB_LIBRARIES})
|
||||
|
@ -28,10 +28,12 @@
|
||||
#include "gui/IconModels.h"
|
||||
#include "gui/MessageBox.h"
|
||||
|
||||
#ifdef WITH_XC_HTTP
|
||||
#include "http/qhttp/qhttpclient.hpp"
|
||||
#include "http/qhttp/qhttpclientresponse.hpp"
|
||||
|
||||
using namespace qhttp::client;
|
||||
#endif
|
||||
|
||||
IconStruct::IconStruct()
|
||||
: uuid(Uuid())
|
||||
@ -45,7 +47,11 @@ EditWidgetIcons::EditWidgetIcons(QWidget* parent)
|
||||
, m_database(nullptr)
|
||||
, m_defaultIconModel(new DefaultIconModel(this))
|
||||
, m_customIconModel(new CustomIconModel(this))
|
||||
#ifdef WITH_XC_HTTP
|
||||
, m_httpClient(nullptr)
|
||||
, m_fallbackToGoogle(true)
|
||||
, m_redirectCount(0)
|
||||
#endif
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
@ -138,18 +144,25 @@ void EditWidgetIcons::load(const Uuid& currentUuid, Database* database, const Ic
|
||||
|
||||
void EditWidgetIcons::setUrl(const QString& url)
|
||||
{
|
||||
#ifdef WITH_XC_HTTP
|
||||
m_url = url;
|
||||
m_ui->faviconButton->setVisible(!url.isEmpty());
|
||||
resetFaviconDownload();
|
||||
#else
|
||||
m_ui->faviconButton->setVisible(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void EditWidgetIcons::downloadFavicon()
|
||||
{
|
||||
#ifdef WITH_XC_HTTP
|
||||
QUrl url = QUrl(m_url);
|
||||
url.setPath("/favicon.ico");
|
||||
fetchFavicon(url);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WITH_XC_HTTP
|
||||
void EditWidgetIcons::fetchFavicon(const QUrl& url)
|
||||
{
|
||||
if (nullptr == m_httpClient) {
|
||||
@ -241,6 +254,7 @@ void EditWidgetIcons::resetFaviconDownload(bool clearRedirect)
|
||||
m_fallbackToGoogle = true;
|
||||
m_ui->faviconButton->setDisabled(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
void EditWidgetIcons::addCustomIcon()
|
||||
{
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <QSet>
|
||||
#include <QUrl>
|
||||
|
||||
#include "config-keepassx.h"
|
||||
#include "core/Global.h"
|
||||
#include "core/Uuid.h"
|
||||
#include "gui/MessageWidget.h"
|
||||
@ -30,11 +31,14 @@ class Database;
|
||||
class DefaultIconModel;
|
||||
class CustomIconModel;
|
||||
|
||||
#ifdef WITH_XC_HTTP
|
||||
namespace qhttp {
|
||||
namespace client {
|
||||
class QHttpClient;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace Ui {
|
||||
class EditWidgetIcons;
|
||||
}
|
||||
@ -68,9 +72,11 @@ Q_SIGNALS:
|
||||
|
||||
private Q_SLOTS:
|
||||
void downloadFavicon();
|
||||
#ifdef WITH_XC_HTTP
|
||||
void fetchFavicon(const QUrl& url);
|
||||
void fetchFaviconFromGoogle(const QString& domain);
|
||||
void resetFaviconDownload(bool clearRedirect = true);
|
||||
#endif
|
||||
void addCustomIcon();
|
||||
void removeCustomIcon();
|
||||
void updateWidgetsDefaultIcons(bool checked);
|
||||
@ -83,12 +89,14 @@ private:
|
||||
Database* m_database;
|
||||
Uuid m_currentUuid;
|
||||
QString m_url;
|
||||
QUrl m_redirectUrl;
|
||||
bool m_fallbackToGoogle = true;
|
||||
unsigned short m_redirectCount = 0;
|
||||
DefaultIconModel* const m_defaultIconModel;
|
||||
CustomIconModel* const m_customIconModel;
|
||||
#ifdef WITH_XC_HTTP
|
||||
QUrl m_redirectUrl;
|
||||
bool m_fallbackToGoogle;
|
||||
unsigned short m_redirectCount;
|
||||
qhttp::client::QHttpClient* m_httpClient;
|
||||
#endif
|
||||
|
||||
Q_DISABLE_COPY(EditWidgetIcons)
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user