Fixed QuaZip for windows, renaming

QuaZip should now usable under windows (fixed include in FindQuaZip)

Renamed the representation from secure and unsecure to signed and
unsigned
This commit is contained in:
Christian Kieschnick 2019-01-07 12:02:21 +01:00
parent 383b8b77eb
commit a978880b0b
9 changed files with 1700 additions and 1699 deletions

View File

@ -20,7 +20,7 @@ ELSE (QUAZIP_INCLUDE_DIRS AND QUAZIP_LIBRARIES)
PATH_SUFFIXES QuaZip/lib
)
FIND_LIBRARY(QUAZIP_LIBRARIES NAMES libquazip${QUAZIP_LIB_VERSION_SUFFIX}.dll HINTS ${QUAZIP_LIBRARY_DIR})
FIND_PATH(QUAZIP_INCLUDE_DIR NAMES quazip.h HINTS ${QUAZIP_LIBRARY_DIR}/../ PATH_SUFFIXES include/quazip)
FIND_PATH(QUAZIP_INCLUDE_DIR NAMES quazip.h HINTS ${QUAZIP_LIBRARY_DIR}/../ PATH_SUFFIXES include/quazip5)
FIND_PATH(QUAZIP_ZLIB_INCLUDE_DIR NAMES zlib.h)
ELSE(WIN32)
FIND_PACKAGE(PkgConfig)

View File

@ -89,11 +89,11 @@ AboutDialog::AboutDialog(QWidget* parent)
extensions += "\n- " + tr("SSH Agent");
#endif
#if defined(WITH_XC_KEESHARE_SECURE) && defined(WITH_XC_KEESHARE_INSECURE)
extensions += "\n- " + tr("KeeShare (secure and insecure sharing)");
extensions += "\n- " + tr("KeeShare (signed and unsigned sharing)");
#elif defined(WITH_XC_KEESHARE_SECURE)
extensions += "\n- " + tr("KeeShare (only secure sharing)");
extensions += "\n- " + tr("KeeShare (only signed sharing)");
#elif defined(WITH_XC_KEESHARE_INSECURE)
extensions += "\n- " + tr("KeeShare (only insecure sharing)");
extensions += "\n- " + tr("KeeShare (only unsigned sharing)");
#endif
#ifdef WITH_XC_YUBIKEY
extensions += "\n- " + tr("YubiKey");

View File

@ -20,6 +20,7 @@
#include "ui_MainWindow.h"
#include <QCloseEvent>
#include <QFileInfo>
#include <QDesktopServices>
#include <QMimeData>
#include <QShortcut>

View File

@ -129,12 +129,12 @@ bool KeeShare::isEnabled(const Group* group)
{
const auto reference = KeeShare::referenceOf(group);
#if !defined(WITH_XC_KEESHARE_SECURE)
if (reference.path.endsWith(secureContainerFileType(), Qt::CaseInsensitive)){
if (reference.path.endsWith(signedContainerFileType(), Qt::CaseInsensitive)){
return false;
}
#endif
#if !defined(WITH_XC_KEESHARE_INSECURE)
if (reference.path.endsWith(insecureContainerFileType(), Qt::CaseInsensitive)){
if (reference.path.endsWith(unsignedContainerFileType(), Qt::CaseInsensitive)){
return false;
}
#endif
@ -198,13 +198,13 @@ void KeeShare::connectDatabase(QSharedPointer<Database> newDb, QSharedPointer<Da
}
}
const QString &KeeShare::secureContainerFileType()
const QString &KeeShare::signedContainerFileType()
{
static const QString filetype("kdbx.share");
return filetype;
}
const QString &KeeShare::insecureContainerFileType()
const QString &KeeShare::unsignedContainerFileType()
{
static const QString filetype("kdbx");
return filetype;

View File

@ -56,8 +56,8 @@ public:
void connectDatabase(QSharedPointer<Database> newDb, QSharedPointer<Database> oldDb);
static const QString& secureContainerFileType();
static const QString& insecureContainerFileType();
static const QString& signedContainerFileType();
static const QString& unsignedContainerFileType();
signals:
void activeChanged();

View File

@ -35,7 +35,7 @@ SettingsWidgetKeeShare::SettingsWidgetKeeShare(QWidget* parent)
m_ui->setupUi(this);
#if !defined(WITH_XC_KEESHARE_SECURE)
// Setting does not help the user of Version without secure export
// Setting does not help the user of Version without signed export
m_ui->ownCertificateGroupBox->setVisible(false);
#endif

View File

@ -294,11 +294,11 @@ void ShareObserver::handleFileUpdated(const QString& path)
notifyAbout(success, warning, error);
}
ShareObserver::Result ShareObserver::importSecureContainerInto(const KeeShareSettings::Reference& reference, Group* targetGroup)
ShareObserver::Result ShareObserver::importSingedContainerInto(const KeeShareSettings::Reference& reference, Group* targetGroup)
{
#if !defined(WITH_XC_KEESHARE_SECURE)
Q_UNUSED(targetGroup);
return { reference.path, Result::Warning, tr("Secured share container are not supported - import prevented") };
return { reference.path, Result::Warning, tr("Signed share container are not supported - import prevented") };
#else
QuaZip zip(reference.path);
if (!zip.open(QuaZip::mdUnzip)) {
@ -375,7 +375,7 @@ ShareObserver::Result ShareObserver::importSecureContainerInto(const KeeShareSet
merger.setForcedMergeMode(Group::Synchronize);
const bool changed = merger.merge();
if (changed) {
return {reference.path, Result::Success, tr("Successful secured import")};
return {reference.path, Result::Success, tr("Successful signed import")};
}
}
// Silent ignore of untrusted import or unchanging import
@ -391,7 +391,7 @@ ShareObserver::Result ShareObserver::importSecureContainerInto(const KeeShareSet
merger.setForcedMergeMode(Group::Synchronize);
const bool changed = merger.merge();
if (changed) {
return {reference.path, Result::Success, tr("Successful secured import")};
return {reference.path, Result::Success, tr("Successful signed import")};
}
return {};
}
@ -402,11 +402,11 @@ ShareObserver::Result ShareObserver::importSecureContainerInto(const KeeShareSet
#endif
}
ShareObserver::Result ShareObserver::importInsecureContainerInto(const KeeShareSettings::Reference& reference, Group* targetGroup)
ShareObserver::Result ShareObserver::importUnsignedContainerInto(const KeeShareSettings::Reference& reference, Group* targetGroup)
{
#if !defined(WITH_XC_KEESHARE_INSECURE)
Q_UNUSED(targetGroup);
return {reference.path, Result::Warning, tr("Insecured share container are not supported - import prevented")};
return {reference.path, Result::Warning, tr("Unsigned share container are not supported - import prevented")};
#else
QFile file(reference.path);
if (!file.open(QIODevice::ReadOnly)){
@ -458,7 +458,7 @@ ShareObserver::Result ShareObserver::importInsecureContainerInto(const KeeShareS
merger.setForcedMergeMode(Group::Synchronize);
const bool changed = merger.merge();
if (changed) {
return {reference.path, Result::Success, tr("Successful secured import")};
return {reference.path, Result::Success, tr("Successful signed import")};
}
}
return {};
@ -473,7 +473,7 @@ ShareObserver::Result ShareObserver::importInsecureContainerInto(const KeeShareS
merger.setForcedMergeMode(Group::Synchronize);
const bool changed = merger.merge();
if (changed) {
return {reference.path, Result::Success, tr("Successful unsecured import")};
return {reference.path, Result::Success, tr("Successful unsigned import")};
}
return {};
}
@ -492,11 +492,11 @@ ShareObserver::Result ShareObserver::importContainerInto(const KeeShareSettings:
return {reference.path, Result::Warning, tr("File does not exist")};
}
if (isOfExportType(info, KeeShare::secureContainerFileType())) {
return importSecureContainerInto(reference, targetGroup);
if (isOfExportType(info, KeeShare::signedContainerFileType())) {
return importSingedContainerInto(reference, targetGroup);
}
if (isOfExportType(info, KeeShare::insecureContainerFileType())) {
return importInsecureContainerInto(reference, targetGroup);
if (isOfExportType(info, KeeShare::unsignedContainerFileType())) {
return importUnsignedContainerInto(reference, targetGroup);
}
return {reference.path, Result::Error, tr("Unknown share container type")};
}
@ -604,11 +604,11 @@ QSharedPointer<Database> ShareObserver::database()
return m_db;
}
ShareObserver::Result ShareObserver::exportIntoReferenceSecureContainer(const KeeShareSettings::Reference &reference, Database *targetDb)
ShareObserver::Result ShareObserver::exportIntoReferenceSignedContainer(const KeeShareSettings::Reference &reference, Database *targetDb)
{
#if !defined(WITH_XC_KEESHARE_SECURE)
Q_UNUSED(targetDb);
return {reference.path, Result::Warning, tr("Overwriting secured share container is not supported - export prevented")};
return {reference.path, Result::Warning, tr("Overwriting signed share container is not supported - export prevented")};
#else
QByteArray bytes;
{
@ -670,11 +670,11 @@ ShareObserver::Result ShareObserver::exportIntoReferenceSecureContainer(const Ke
#endif
}
ShareObserver::Result ShareObserver::exportIntoReferenceInsecureContainer(const KeeShareSettings::Reference &reference, Database *targetDb)
ShareObserver::Result ShareObserver::exportIntoReferenceUnsignedContainer(const KeeShareSettings::Reference &reference, Database *targetDb)
{
#if !defined(WITH_XC_KEESHARE_INSECURE)
Q_UNUSED(targetDb);
return {reference.path, Result::Warning, tr("Overwriting secured share container is not supported - export prevented")};
return {reference.path, Result::Warning, tr("Overwriting unsigned share container is not supported - export prevented")};
#else
QFile file(reference.path);
const bool fileOpened = file.open(QIODevice::WriteOnly);
@ -706,13 +706,13 @@ QList<ShareObserver::Result> ShareObserver::exportIntoReferenceContainers()
m_fileWatcher->ignoreFileChanges(reference.path);
QScopedPointer<Database> targetDb(exportIntoContainer(reference, group));
QFileInfo info(reference.path);
if (isOfExportType(info, KeeShare::secureContainerFileType())) {
results << exportIntoReferenceSecureContainer(reference, targetDb.data());
if (isOfExportType(info, KeeShare::signedContainerFileType())) {
results << exportIntoReferenceSignedContainer(reference, targetDb.data());
m_fileWatcher->observeFileChanges(true);
continue;
}
if (isOfExportType(info, KeeShare::insecureContainerFileType())) {
results << exportIntoReferenceInsecureContainer(reference, targetDb.data());
if (isOfExportType(info, KeeShare::unsignedContainerFileType())) {
results << exportIntoReferenceUnsignedContainer(reference, targetDb.data());
m_fileWatcher->observeFileChanges(true);
continue;
}

View File

@ -77,10 +77,10 @@ private:
static void resolveReferenceAttributes(Entry* targetEntry, const Database* sourceDb);
static Database* exportIntoContainer(const KeeShareSettings::Reference& reference, const Group* sourceRoot);
static Result exportIntoReferenceInsecureContainer(const KeeShareSettings::Reference &reference, Database *targetDb);
static Result exportIntoReferenceSecureContainer(const KeeShareSettings::Reference &reference, Database *targetDb);
static Result importSecureContainerInto(const KeeShareSettings::Reference& reference, Group* targetGroup);
static Result importInsecureContainerInto(const KeeShareSettings::Reference& reference, Group* targetGroup);
static Result exportIntoReferenceUnsignedContainer(const KeeShareSettings::Reference &reference, Database *targetDb);
static Result exportIntoReferenceSignedContainer(const KeeShareSettings::Reference &reference, Database *targetDb);
static Result importSingedContainerInto(const KeeShareSettings::Reference& reference, Group* targetGroup);
static Result importUnsignedContainerInto(const KeeShareSettings::Reference& reference, Group* targetGroup);
static Result importContainerInto(const KeeShareSettings::Reference& reference, Group* targetGroup);
static Result importDatabaseInto();

View File

@ -108,10 +108,10 @@ void EditGroupWidgetKeeShare::showSharingState()
auto supportedExtensions = QStringList();
#if defined(WITH_XC_KEESHARE_INSECURE)
supportedExtensions << KeeShare::insecureContainerFileType();
supportedExtensions << KeeShare::unsignedContainerFileType();
#endif
#if defined(WITH_XC_KEESHARE_SECURE)
supportedExtensions << KeeShare::secureContainerFileType();
supportedExtensions << KeeShare::signedContainerFileType();
#endif
const auto reference = KeeShare::referenceOf(m_temporaryGroup);
if (!reference.path.isEmpty()) {
@ -208,18 +208,18 @@ void EditGroupWidgetKeeShare::launchPathSelectionDialog()
auto unsupportedExtensions = QStringList();
auto knownFilters = QStringList() << QString("%1 (*)").arg("All files");
#if defined(WITH_XC_KEESHARE_INSECURE)
defaultFiletype = KeeShare::insecureContainerFileType();
supportedExtensions << KeeShare::insecureContainerFileType();
knownFilters.prepend(QString("%1 (*.%2)").arg(tr("KeeShare insecure container"), KeeShare::insecureContainerFileType()));
defaultFiletype = KeeShare::unsignedContainerFileType();
supportedExtensions << KeeShare::unsignedContainerFileType();
knownFilters.prepend(QString("%1 (*.%2)").arg(tr("KeeShare unsigned container"), KeeShare::unsignedContainerFileType()));
#else
unsupportedExtensions << KeeShare::insecureContainerFileType();
unsupportedExtensions << KeeShare::unsignedContainerFileType();
#endif
#if defined(WITH_XC_KEESHARE_SECURE)
defaultFiletype = KeeShare::secureContainerFileType();
supportedExtensions << KeeShare::secureContainerFileType();
knownFilters.prepend(QString("%1 (*.%2)").arg(tr("KeeShare secure container"), KeeShare::secureContainerFileType()));
defaultFiletype = KeeShare::signedContainerFileType();
supportedExtensions << KeeShare::signedContainerFileType();
knownFilters.prepend(QString("%1 (*.%2)").arg(tr("KeeShare signed container"), KeeShare::signedContainerFileType()));
#else
unsupportedExtensions << KeeShare::secureContainerFileType();
unsupportedExtensions << KeeShare::signedContainerFileType();
#endif
const auto filters = knownFilters.join(";;");