mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-24 13:41:33 -05:00
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:
parent
383b8b77eb
commit
a978880b0b
@ -6,38 +6,38 @@
|
|||||||
|
|
||||||
|
|
||||||
IF (QUAZIP_INCLUDE_DIRS AND QUAZIP_LIBRARIES)
|
IF (QUAZIP_INCLUDE_DIRS AND QUAZIP_LIBRARIES)
|
||||||
# in cache already
|
# in cache already
|
||||||
SET(QUAZIP_FOUND TRUE)
|
SET(QUAZIP_FOUND TRUE)
|
||||||
ELSE (QUAZIP_INCLUDE_DIRS AND QUAZIP_LIBRARIES)
|
ELSE (QUAZIP_INCLUDE_DIRS AND QUAZIP_LIBRARIES)
|
||||||
IF (Qt5Core_FOUND)
|
IF (Qt5Core_FOUND)
|
||||||
set(QUAZIP_LIB_VERSION_SUFFIX 5)
|
set(QUAZIP_LIB_VERSION_SUFFIX 5)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
IF (WIN32)
|
IF (WIN32)
|
||||||
FIND_PATH(QUAZIP_LIBRARY_DIR
|
FIND_PATH(QUAZIP_LIBRARY_DIR
|
||||||
WIN32_DEBUG_POSTFIX d
|
WIN32_DEBUG_POSTFIX d
|
||||||
NAMES libquazip${QUAZIP_LIB_VERSION_SUFFIX}.dll
|
NAMES libquazip${QUAZIP_LIB_VERSION_SUFFIX}.dll
|
||||||
HINTS "C:/Programme/" "C:/Program Files"
|
HINTS "C:/Programme/" "C:/Program Files"
|
||||||
PATH_SUFFIXES QuaZip/lib
|
PATH_SUFFIXES QuaZip/lib
|
||||||
)
|
)
|
||||||
FIND_LIBRARY(QUAZIP_LIBRARIES NAMES libquazip${QUAZIP_LIB_VERSION_SUFFIX}.dll HINTS ${QUAZIP_LIBRARY_DIR})
|
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)
|
FIND_PATH(QUAZIP_ZLIB_INCLUDE_DIR NAMES zlib.h)
|
||||||
ELSE(WIN32)
|
ELSE(WIN32)
|
||||||
FIND_PACKAGE(PkgConfig)
|
FIND_PACKAGE(PkgConfig)
|
||||||
# pkg_check_modules(PC_QCA2 QUIET qca2)
|
# pkg_check_modules(PC_QCA2 QUIET qca2)
|
||||||
pkg_check_modules(PC_QUAZIP quazip)
|
pkg_check_modules(PC_QUAZIP quazip)
|
||||||
FIND_LIBRARY(QUAZIP_LIBRARIES
|
FIND_LIBRARY(QUAZIP_LIBRARIES
|
||||||
WIN32_DEBUG_POSTFIX d
|
WIN32_DEBUG_POSTFIX d
|
||||||
NAMES quazip${QUAZIP_LIB_VERSION_SUFFIX}
|
NAMES quazip${QUAZIP_LIB_VERSION_SUFFIX}
|
||||||
HINTS /usr/lib /usr/lib64
|
HINTS /usr/lib /usr/lib64
|
||||||
)
|
)
|
||||||
FIND_PATH(QUAZIP_INCLUDE_DIR quazip.h
|
FIND_PATH(QUAZIP_INCLUDE_DIR quazip.h
|
||||||
HINTS /usr/include /usr/local/include
|
HINTS /usr/include /usr/local/include
|
||||||
PATH_SUFFIXES quazip${QUAZIP_LIB_VERSION_SUFFIX}
|
PATH_SUFFIXES quazip${QUAZIP_LIB_VERSION_SUFFIX}
|
||||||
)
|
)
|
||||||
FIND_PATH(QUAZIP_ZLIB_INCLUDE_DIR zlib.h HINTS /usr/include /usr/local/include)
|
FIND_PATH(QUAZIP_ZLIB_INCLUDE_DIR zlib.h HINTS /usr/include /usr/local/include)
|
||||||
ENDIF (WIN32)
|
ENDIF (WIN32)
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
SET(QUAZIP_INCLUDE_DIRS ${QUAZIP_INCLUDE_DIR} ${QUAZIP_ZLIB_INCLUDE_DIR})
|
SET(QUAZIP_INCLUDE_DIRS ${QUAZIP_INCLUDE_DIR} ${QUAZIP_ZLIB_INCLUDE_DIR})
|
||||||
find_package_handle_standard_args(QUAZIP DEFAULT_MSG QUAZIP_LIBRARIES QUAZIP_INCLUDE_DIR QUAZIP_ZLIB_INCLUDE_DIR QUAZIP_INCLUDE_DIRS)
|
find_package_handle_standard_args(QUAZIP DEFAULT_MSG QUAZIP_LIBRARIES QUAZIP_INCLUDE_DIR QUAZIP_ZLIB_INCLUDE_DIR QUAZIP_INCLUDE_DIRS)
|
||||||
ENDIF (QUAZIP_INCLUDE_DIRS AND QUAZIP_LIBRARIES)
|
ENDIF (QUAZIP_INCLUDE_DIRS AND QUAZIP_LIBRARIES)
|
||||||
|
@ -28,90 +28,90 @@
|
|||||||
#include <QSysInfo>
|
#include <QSysInfo>
|
||||||
|
|
||||||
AboutDialog::AboutDialog(QWidget* parent)
|
AboutDialog::AboutDialog(QWidget* parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, m_ui(new Ui::AboutDialog())
|
, m_ui(new Ui::AboutDialog())
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
resize(minimumSize());
|
resize(minimumSize());
|
||||||
setWindowFlags(Qt::Sheet);
|
setWindowFlags(Qt::Sheet);
|
||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
|
||||||
m_ui->nameLabel->setText(m_ui->nameLabel->text().replace("${VERSION}", KEEPASSXC_VERSION));
|
m_ui->nameLabel->setText(m_ui->nameLabel->text().replace("${VERSION}", KEEPASSXC_VERSION));
|
||||||
QFont nameLabelFont = m_ui->nameLabel->font();
|
QFont nameLabelFont = m_ui->nameLabel->font();
|
||||||
nameLabelFont.setPointSize(nameLabelFont.pointSize() + 4);
|
nameLabelFont.setPointSize(nameLabelFont.pointSize() + 4);
|
||||||
m_ui->nameLabel->setFont(nameLabelFont);
|
m_ui->nameLabel->setFont(nameLabelFont);
|
||||||
|
|
||||||
m_ui->iconLabel->setPixmap(filePath()->applicationIcon().pixmap(48));
|
m_ui->iconLabel->setPixmap(filePath()->applicationIcon().pixmap(48));
|
||||||
|
|
||||||
QString commitHash;
|
QString commitHash;
|
||||||
if (!QString(GIT_HEAD).isEmpty()) {
|
if (!QString(GIT_HEAD).isEmpty()) {
|
||||||
commitHash = GIT_HEAD;
|
commitHash = GIT_HEAD;
|
||||||
} else if (!QString(DIST_HASH).contains("Format")) {
|
} else if (!QString(DIST_HASH).contains("Format")) {
|
||||||
commitHash = DIST_HASH;
|
commitHash = DIST_HASH;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString debugInfo = "KeePassXC - ";
|
QString debugInfo = "KeePassXC - ";
|
||||||
debugInfo.append(tr("Version %1").arg(KEEPASSXC_VERSION).append("\n"));
|
debugInfo.append(tr("Version %1").arg(KEEPASSXC_VERSION).append("\n"));
|
||||||
#ifndef KEEPASSXC_BUILD_TYPE_RELEASE
|
#ifndef KEEPASSXC_BUILD_TYPE_RELEASE
|
||||||
debugInfo.append(tr("Build Type: %1").arg(KEEPASSXC_BUILD_TYPE).append("\n"));
|
debugInfo.append(tr("Build Type: %1").arg(KEEPASSXC_BUILD_TYPE).append("\n"));
|
||||||
#endif
|
#endif
|
||||||
if (!commitHash.isEmpty()) {
|
if (!commitHash.isEmpty()) {
|
||||||
debugInfo.append(tr("Revision: %1").arg(commitHash.left(7)).append("\n"));
|
debugInfo.append(tr("Revision: %1").arg(commitHash.left(7)).append("\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KEEPASSXC_DIST
|
#ifdef KEEPASSXC_DIST
|
||||||
debugInfo.append(tr("Distribution: %1").arg(KEEPASSXC_DIST_TYPE).append("\n"));
|
debugInfo.append(tr("Distribution: %1").arg(KEEPASSXC_DIST_TYPE).append("\n"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
debugInfo.append("\n").append(
|
debugInfo.append("\n").append(
|
||||||
QString("%1\n- Qt %2\n- %3\n\n")
|
QString("%1\n- Qt %2\n- %3\n\n")
|
||||||
.arg(tr("Libraries:"), QString::fromLocal8Bit(qVersion()), Crypto::backendVersion()));
|
.arg(tr("Libraries:"), QString::fromLocal8Bit(qVersion()), Crypto::backendVersion()));
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
|
||||||
debugInfo.append(tr("Operating system: %1\nCPU architecture: %2\nKernel: %3 %4")
|
debugInfo.append(tr("Operating system: %1\nCPU architecture: %2\nKernel: %3 %4")
|
||||||
.arg(QSysInfo::prettyProductName(),
|
.arg(QSysInfo::prettyProductName(),
|
||||||
QSysInfo::currentCpuArchitecture(),
|
QSysInfo::currentCpuArchitecture(),
|
||||||
QSysInfo::kernelType(),
|
QSysInfo::kernelType(),
|
||||||
QSysInfo::kernelVersion()));
|
QSysInfo::kernelVersion()));
|
||||||
|
|
||||||
debugInfo.append("\n\n");
|
debugInfo.append("\n\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString extensions;
|
QString extensions;
|
||||||
#ifdef WITH_XC_AUTOTYPE
|
#ifdef WITH_XC_AUTOTYPE
|
||||||
extensions += "\n- " + tr("Auto-Type");
|
extensions += "\n- " + tr("Auto-Type");
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_XC_BROWSER
|
#ifdef WITH_XC_BROWSER
|
||||||
extensions += "\n- " + tr("Browser Integration");
|
extensions += "\n- " + tr("Browser Integration");
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_XC_SSHAGENT
|
#ifdef WITH_XC_SSHAGENT
|
||||||
extensions += "\n- " + tr("SSH Agent");
|
extensions += "\n- " + tr("SSH Agent");
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_XC_KEESHARE_SECURE) && defined(WITH_XC_KEESHARE_INSECURE)
|
#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)
|
#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)
|
#elif defined(WITH_XC_KEESHARE_INSECURE)
|
||||||
extensions += "\n- " + tr("KeeShare (only insecure sharing)");
|
extensions += "\n- " + tr("KeeShare (only unsigned sharing)");
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_XC_YUBIKEY
|
#ifdef WITH_XC_YUBIKEY
|
||||||
extensions += "\n- " + tr("YubiKey");
|
extensions += "\n- " + tr("YubiKey");
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_XC_TOUCHID
|
#ifdef WITH_XC_TOUCHID
|
||||||
extensions += "\n- " + tr("TouchID");
|
extensions += "\n- " + tr("TouchID");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (extensions.isEmpty())
|
if (extensions.isEmpty())
|
||||||
extensions = " " + tr("None");
|
extensions = " " + tr("None");
|
||||||
|
|
||||||
debugInfo.append(tr("Enabled extensions:").append(extensions));
|
debugInfo.append(tr("Enabled extensions:").append(extensions));
|
||||||
|
|
||||||
m_ui->debugInfo->setPlainText(debugInfo);
|
m_ui->debugInfo->setPlainText(debugInfo);
|
||||||
|
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
|
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
|
||||||
connect(m_ui->copyToClipboard, SIGNAL(clicked()), SLOT(copyToClipboard()));
|
connect(m_ui->copyToClipboard, SIGNAL(clicked()), SLOT(copyToClipboard()));
|
||||||
}
|
}
|
||||||
|
|
||||||
AboutDialog::~AboutDialog()
|
AboutDialog::~AboutDialog()
|
||||||
@ -120,6 +120,6 @@ AboutDialog::~AboutDialog()
|
|||||||
|
|
||||||
void AboutDialog::copyToClipboard()
|
void AboutDialog::copyToClipboard()
|
||||||
{
|
{
|
||||||
QClipboard* clipboard = QApplication::clipboard();
|
QClipboard* clipboard = QApplication::clipboard();
|
||||||
clipboard->setText(m_ui->debugInfo->toPlainText());
|
clipboard->setText(m_ui->debugInfo->toPlainText());
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -129,12 +129,12 @@ bool KeeShare::isEnabled(const Group* group)
|
|||||||
{
|
{
|
||||||
const auto reference = KeeShare::referenceOf(group);
|
const auto reference = KeeShare::referenceOf(group);
|
||||||
#if !defined(WITH_XC_KEESHARE_SECURE)
|
#if !defined(WITH_XC_KEESHARE_SECURE)
|
||||||
if (reference.path.endsWith(secureContainerFileType(), Qt::CaseInsensitive)){
|
if (reference.path.endsWith(signedContainerFileType(), Qt::CaseInsensitive)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if !defined(WITH_XC_KEESHARE_INSECURE)
|
#if !defined(WITH_XC_KEESHARE_INSECURE)
|
||||||
if (reference.path.endsWith(insecureContainerFileType(), Qt::CaseInsensitive)){
|
if (reference.path.endsWith(unsignedContainerFileType(), Qt::CaseInsensitive)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#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");
|
static const QString filetype("kdbx.share");
|
||||||
return filetype;
|
return filetype;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &KeeShare::insecureContainerFileType()
|
const QString &KeeShare::unsignedContainerFileType()
|
||||||
{
|
{
|
||||||
static const QString filetype("kdbx");
|
static const QString filetype("kdbx");
|
||||||
return filetype;
|
return filetype;
|
||||||
|
@ -56,8 +56,8 @@ public:
|
|||||||
|
|
||||||
void connectDatabase(QSharedPointer<Database> newDb, QSharedPointer<Database> oldDb);
|
void connectDatabase(QSharedPointer<Database> newDb, QSharedPointer<Database> oldDb);
|
||||||
|
|
||||||
static const QString& secureContainerFileType();
|
static const QString& signedContainerFileType();
|
||||||
static const QString& insecureContainerFileType();
|
static const QString& unsignedContainerFileType();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void activeChanged();
|
void activeChanged();
|
||||||
|
@ -29,26 +29,26 @@
|
|||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
|
||||||
SettingsWidgetKeeShare::SettingsWidgetKeeShare(QWidget* parent)
|
SettingsWidgetKeeShare::SettingsWidgetKeeShare(QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, m_ui(new Ui::SettingsWidgetKeeShare())
|
, m_ui(new Ui::SettingsWidgetKeeShare())
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
#if !defined(WITH_XC_KEESHARE_SECURE)
|
#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);
|
m_ui->ownCertificateGroupBox->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
connect(m_ui->ownCertificateSignerEdit, SIGNAL(textChanged(QString)), SLOT(setVerificationExporter(QString)));
|
connect(m_ui->ownCertificateSignerEdit, SIGNAL(textChanged(QString)), SLOT(setVerificationExporter(QString)));
|
||||||
|
|
||||||
connect(m_ui->generateOwnCerticateButton, SIGNAL(clicked(bool)), SLOT(generateCertificate()));
|
connect(m_ui->generateOwnCerticateButton, SIGNAL(clicked(bool)), SLOT(generateCertificate()));
|
||||||
connect(m_ui->importOwnCertificateButton, SIGNAL(clicked(bool)), SLOT(importCertificate()));
|
connect(m_ui->importOwnCertificateButton, SIGNAL(clicked(bool)), SLOT(importCertificate()));
|
||||||
connect(m_ui->exportOwnCertificateButton, SIGNAL(clicked(bool)), SLOT(exportCertificate()));
|
connect(m_ui->exportOwnCertificateButton, SIGNAL(clicked(bool)), SLOT(exportCertificate()));
|
||||||
|
|
||||||
connect(m_ui->trustImportedCertificateButton, SIGNAL(clicked(bool)), SLOT(trustSelectedCertificates()));
|
connect(m_ui->trustImportedCertificateButton, SIGNAL(clicked(bool)), SLOT(trustSelectedCertificates()));
|
||||||
connect(m_ui->askImportedCertificateButton, SIGNAL(clicked(bool)), SLOT(askSelectedCertificates()));
|
connect(m_ui->askImportedCertificateButton, SIGNAL(clicked(bool)), SLOT(askSelectedCertificates()));
|
||||||
connect(m_ui->untrustImportedCertificateButton, SIGNAL(clicked(bool)), SLOT(untrustSelectedCertificates()));
|
connect(m_ui->untrustImportedCertificateButton, SIGNAL(clicked(bool)), SLOT(untrustSelectedCertificates()));
|
||||||
connect(m_ui->removeImportedCertificateButton, SIGNAL(clicked(bool)), SLOT(removeSelectedCertificates()));
|
connect(m_ui->removeImportedCertificateButton, SIGNAL(clicked(bool)), SLOT(removeSelectedCertificates()));
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsWidgetKeeShare::~SettingsWidgetKeeShare()
|
SettingsWidgetKeeShare::~SettingsWidgetKeeShare()
|
||||||
@ -57,181 +57,181 @@ SettingsWidgetKeeShare::~SettingsWidgetKeeShare()
|
|||||||
|
|
||||||
void SettingsWidgetKeeShare::loadSettings()
|
void SettingsWidgetKeeShare::loadSettings()
|
||||||
{
|
{
|
||||||
const auto active = KeeShare::active();
|
const auto active = KeeShare::active();
|
||||||
m_ui->enableExportCheckBox->setChecked(active.out);
|
m_ui->enableExportCheckBox->setChecked(active.out);
|
||||||
m_ui->enableImportCheckBox->setChecked(active.in);
|
m_ui->enableImportCheckBox->setChecked(active.in);
|
||||||
|
|
||||||
m_own = KeeShare::own();
|
m_own = KeeShare::own();
|
||||||
updateOwnCertificate();
|
updateOwnCertificate();
|
||||||
|
|
||||||
m_foreign = KeeShare::foreign();
|
m_foreign = KeeShare::foreign();
|
||||||
updateForeignCertificates();
|
updateForeignCertificates();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidgetKeeShare::updateForeignCertificates()
|
void SettingsWidgetKeeShare::updateForeignCertificates()
|
||||||
{
|
{
|
||||||
m_importedCertificateModel.reset(new QStandardItemModel());
|
m_importedCertificateModel.reset(new QStandardItemModel());
|
||||||
m_importedCertificateModel->setHorizontalHeaderLabels(QStringList() << tr("Path") << tr("Status")
|
m_importedCertificateModel->setHorizontalHeaderLabels(QStringList() << tr("Path") << tr("Status")
|
||||||
#if defined(WITH_XC_KEESHARE_SECURE)
|
#if defined(WITH_XC_KEESHARE_SECURE)
|
||||||
<< tr("Signer") << tr("Fingerprint") << tr("Certificate")
|
<< tr("Signer") << tr("Fingerprint") << tr("Certificate")
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const auto& scopedCertificate : m_foreign.certificates) {
|
for (const auto& scopedCertificate : m_foreign.certificates) {
|
||||||
const auto items = QList<QStandardItem*>()
|
const auto items = QList<QStandardItem*>()
|
||||||
<< new QStandardItem(scopedCertificate.path)
|
<< new QStandardItem(scopedCertificate.path)
|
||||||
<< new QStandardItem(scopedCertificate.trust == KeeShareSettings::Trust::Ask ? tr("Ask")
|
<< new QStandardItem(scopedCertificate.trust == KeeShareSettings::Trust::Ask ? tr("Ask")
|
||||||
: (scopedCertificate.trust == KeeShareSettings::Trust::Trusted ? tr("Trusted")
|
: (scopedCertificate.trust == KeeShareSettings::Trust::Trusted ? tr("Trusted")
|
||||||
: tr("Untrusted")))
|
: tr("Untrusted")))
|
||||||
#if defined(WITH_XC_KEESHARE_SECURE)
|
#if defined(WITH_XC_KEESHARE_SECURE)
|
||||||
<< new QStandardItem(scopedCertificate.isKnown() ? scopedCertificate.certificate.signer : tr("Unknown"))
|
<< new QStandardItem(scopedCertificate.isKnown() ? scopedCertificate.certificate.signer : tr("Unknown"))
|
||||||
<< new QStandardItem(scopedCertificate.certificate.fingerprint())
|
<< new QStandardItem(scopedCertificate.certificate.fingerprint())
|
||||||
<< new QStandardItem(scopedCertificate.certificate.publicKey())
|
<< new QStandardItem(scopedCertificate.certificate.publicKey())
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
m_importedCertificateModel->appendRow(items);
|
m_importedCertificateModel->appendRow(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui->importedCertificateTableView->setModel(m_importedCertificateModel.data());
|
m_ui->importedCertificateTableView->setModel(m_importedCertificateModel.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidgetKeeShare::updateOwnCertificate()
|
void SettingsWidgetKeeShare::updateOwnCertificate()
|
||||||
{
|
{
|
||||||
m_ui->ownCertificateSignerEdit->setText(m_own.certificate.signer);
|
m_ui->ownCertificateSignerEdit->setText(m_own.certificate.signer);
|
||||||
m_ui->ownCertificatePublicKeyEdit->setText(m_own.certificate.publicKey());
|
m_ui->ownCertificatePublicKeyEdit->setText(m_own.certificate.publicKey());
|
||||||
m_ui->ownCertificatePrivateKeyEdit->setText(m_own.key.privateKey());
|
m_ui->ownCertificatePrivateKeyEdit->setText(m_own.key.privateKey());
|
||||||
m_ui->ownCertificateFingerprintEdit->setText(m_own.certificate.fingerprint());
|
m_ui->ownCertificateFingerprintEdit->setText(m_own.certificate.fingerprint());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidgetKeeShare::saveSettings()
|
void SettingsWidgetKeeShare::saveSettings()
|
||||||
{
|
{
|
||||||
KeeShareSettings::Active active;
|
KeeShareSettings::Active active;
|
||||||
active.out = m_ui->enableExportCheckBox->isChecked();
|
active.out = m_ui->enableExportCheckBox->isChecked();
|
||||||
active.in = m_ui->enableImportCheckBox->isChecked();
|
active.in = m_ui->enableImportCheckBox->isChecked();
|
||||||
// TODO HNH: This depends on the order of saving new data - a better model would be to
|
// TODO HNH: This depends on the order of saving new data - a better model would be to
|
||||||
// store changes to the settings in a temporary object and check on the final values
|
// store changes to the settings in a temporary object and check on the final values
|
||||||
// of this object (similar scheme to Entry) - this way we could validate the settings before save
|
// of this object (similar scheme to Entry) - this way we could validate the settings before save
|
||||||
KeeShare::setOwn(m_own);
|
KeeShare::setOwn(m_own);
|
||||||
KeeShare::setForeign(m_foreign);
|
KeeShare::setForeign(m_foreign);
|
||||||
KeeShare::setActive(active);
|
KeeShare::setActive(active);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidgetKeeShare::setVerificationExporter(const QString& signer)
|
void SettingsWidgetKeeShare::setVerificationExporter(const QString& signer)
|
||||||
{
|
{
|
||||||
m_own.certificate.signer = signer;
|
m_own.certificate.signer = signer;
|
||||||
m_ui->ownCertificateSignerEdit->setText(m_own.certificate.signer);
|
m_ui->ownCertificateSignerEdit->setText(m_own.certificate.signer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidgetKeeShare::generateCertificate()
|
void SettingsWidgetKeeShare::generateCertificate()
|
||||||
{
|
{
|
||||||
m_own = KeeShareSettings::Own::generate();
|
m_own = KeeShareSettings::Own::generate();
|
||||||
m_ui->ownCertificateSignerEdit->setText(m_own.certificate.signer);
|
m_ui->ownCertificateSignerEdit->setText(m_own.certificate.signer);
|
||||||
m_ui->ownCertificatePublicKeyEdit->setText(m_own.certificate.publicKey());
|
m_ui->ownCertificatePublicKeyEdit->setText(m_own.certificate.publicKey());
|
||||||
m_ui->ownCertificatePrivateKeyEdit->setText(m_own.key.privateKey());
|
m_ui->ownCertificatePrivateKeyEdit->setText(m_own.key.privateKey());
|
||||||
m_ui->ownCertificateFingerprintEdit->setText(m_own.certificate.fingerprint());
|
m_ui->ownCertificateFingerprintEdit->setText(m_own.certificate.fingerprint());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidgetKeeShare::importCertificate()
|
void SettingsWidgetKeeShare::importCertificate()
|
||||||
{
|
{
|
||||||
QString defaultDirPath = config()->get("KeeShare/LastKeyDir").toString();
|
QString defaultDirPath = config()->get("KeeShare/LastKeyDir").toString();
|
||||||
const bool dirExists = !defaultDirPath.isEmpty() && QDir(defaultDirPath).exists();
|
const bool dirExists = !defaultDirPath.isEmpty() && QDir(defaultDirPath).exists();
|
||||||
if (!dirExists) {
|
if (!dirExists) {
|
||||||
defaultDirPath = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first();
|
defaultDirPath = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first();
|
||||||
}
|
}
|
||||||
const auto filetype = tr("key.share", "Filetype for KeeShare key");
|
const auto filetype = tr("key.share", "Filetype for KeeShare key");
|
||||||
const auto filters = QString("%1 (*." + filetype + ");;%2 (*)").arg(tr("KeeShare key file"), tr("All files"));
|
const auto filters = QString("%1 (*." + filetype + ");;%2 (*)").arg(tr("KeeShare key file"), tr("All files"));
|
||||||
QString filename = fileDialog()->getOpenFileName(this, tr("Select path"), defaultDirPath, filters, nullptr, QFileDialog::Options(0));
|
QString filename = fileDialog()->getOpenFileName(this, tr("Select path"), defaultDirPath, filters, nullptr, QFileDialog::Options(0));
|
||||||
if (filename.isEmpty()) {
|
if (filename.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
file.open(QIODevice::ReadOnly);
|
file.open(QIODevice::ReadOnly);
|
||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
m_own = KeeShareSettings::Own::deserialize(stream.readAll());
|
m_own = KeeShareSettings::Own::deserialize(stream.readAll());
|
||||||
file.close();
|
file.close();
|
||||||
config()->set("KeeShare/LastKeyDir", QFileInfo(filename).absolutePath());
|
config()->set("KeeShare/LastKeyDir", QFileInfo(filename).absolutePath());
|
||||||
|
|
||||||
updateOwnCertificate();
|
updateOwnCertificate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidgetKeeShare::exportCertificate()
|
void SettingsWidgetKeeShare::exportCertificate()
|
||||||
{
|
{
|
||||||
if (KeeShare::own() != m_own) {
|
if (KeeShare::own() != m_own) {
|
||||||
QMessageBox warning;
|
QMessageBox warning;
|
||||||
warning.setIcon(QMessageBox::Warning);
|
warning.setIcon(QMessageBox::Warning);
|
||||||
warning.setWindowTitle(tr("Exporting changed certificate"));
|
warning.setWindowTitle(tr("Exporting changed certificate"));
|
||||||
warning.setText(tr("The exported certificate is not the same as the one in use. Do you want to export the current certificate?"));
|
warning.setText(tr("The exported certificate is not the same as the one in use. Do you want to export the current certificate?"));
|
||||||
auto yes = warning.addButton(QMessageBox::StandardButton::Yes);
|
auto yes = warning.addButton(QMessageBox::StandardButton::Yes);
|
||||||
auto no = warning.addButton(QMessageBox::StandardButton::No);
|
auto no = warning.addButton(QMessageBox::StandardButton::No);
|
||||||
warning.setDefaultButton(no);
|
warning.setDefaultButton(no);
|
||||||
warning.exec();
|
warning.exec();
|
||||||
if (warning.clickedButton() != yes) {
|
if (warning.clickedButton() != yes) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString defaultDirPath = config()->get("KeeShare/LastKeyDir").toString();
|
QString defaultDirPath = config()->get("KeeShare/LastKeyDir").toString();
|
||||||
const bool dirExists = !defaultDirPath.isEmpty() && QDir(defaultDirPath).exists();
|
const bool dirExists = !defaultDirPath.isEmpty() && QDir(defaultDirPath).exists();
|
||||||
if (!dirExists) {
|
if (!dirExists) {
|
||||||
defaultDirPath = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first();
|
defaultDirPath = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first();
|
||||||
}
|
}
|
||||||
const auto filetype = tr("key.share", "Filetype for KeeShare key");
|
const auto filetype = tr("key.share", "Filetype for KeeShare key");
|
||||||
const auto filters = QString("%1 (*." + filetype + ");;%2 (*)").arg(tr("KeeShare key file"), tr("All files"));
|
const auto filters = QString("%1 (*." + filetype + ");;%2 (*)").arg(tr("KeeShare key file"), tr("All files"));
|
||||||
QString filename = tr("%1.%2", "Template for KeeShare key file").arg(m_own.certificate.signer).arg(filetype);
|
QString filename = tr("%1.%2", "Template for KeeShare key file").arg(m_own.certificate.signer).arg(filetype);
|
||||||
filename = fileDialog()->getSaveFileName(this, tr("Select path"), defaultDirPath, filters, nullptr, QFileDialog::Options(0), filetype, filename);
|
filename = fileDialog()->getSaveFileName(this, tr("Select path"), defaultDirPath, filters, nullptr, QFileDialog::Options(0), filetype, filename);
|
||||||
if (filename.isEmpty()) {
|
if (filename.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
file.open(QIODevice::Truncate | QIODevice::WriteOnly);
|
file.open(QIODevice::Truncate | QIODevice::WriteOnly);
|
||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
stream << KeeShareSettings::Own::serialize(m_own);
|
stream << KeeShareSettings::Own::serialize(m_own);
|
||||||
stream.flush();
|
stream.flush();
|
||||||
file.close();
|
file.close();
|
||||||
config()->set("KeeShare/LastKeyDir", QFileInfo(filename).absolutePath());
|
config()->set("KeeShare/LastKeyDir", QFileInfo(filename).absolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidgetKeeShare::trustSelectedCertificates()
|
void SettingsWidgetKeeShare::trustSelectedCertificates()
|
||||||
{
|
{
|
||||||
const auto* selectionModel = m_ui->importedCertificateTableView->selectionModel();
|
const auto* selectionModel = m_ui->importedCertificateTableView->selectionModel();
|
||||||
Q_ASSERT(selectionModel);
|
Q_ASSERT(selectionModel);
|
||||||
for (const auto& index : selectionModel->selectedRows()) {
|
for (const auto& index : selectionModel->selectedRows()) {
|
||||||
m_foreign.certificates[index.row()].trust = KeeShareSettings::Trust::Trusted;
|
m_foreign.certificates[index.row()].trust = KeeShareSettings::Trust::Trusted;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateForeignCertificates();
|
updateForeignCertificates();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidgetKeeShare::askSelectedCertificates()
|
void SettingsWidgetKeeShare::askSelectedCertificates()
|
||||||
{
|
{
|
||||||
const auto* selectionModel = m_ui->importedCertificateTableView->selectionModel();
|
const auto* selectionModel = m_ui->importedCertificateTableView->selectionModel();
|
||||||
Q_ASSERT(selectionModel);
|
Q_ASSERT(selectionModel);
|
||||||
for (const auto& index : selectionModel->selectedRows()) {
|
for (const auto& index : selectionModel->selectedRows()) {
|
||||||
m_foreign.certificates[index.row()].trust = KeeShareSettings::Trust::Ask;
|
m_foreign.certificates[index.row()].trust = KeeShareSettings::Trust::Ask;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateForeignCertificates();
|
updateForeignCertificates();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidgetKeeShare::untrustSelectedCertificates()
|
void SettingsWidgetKeeShare::untrustSelectedCertificates()
|
||||||
{
|
{
|
||||||
const auto* selectionModel = m_ui->importedCertificateTableView->selectionModel();
|
const auto* selectionModel = m_ui->importedCertificateTableView->selectionModel();
|
||||||
Q_ASSERT(selectionModel);
|
Q_ASSERT(selectionModel);
|
||||||
for (const auto& index : selectionModel->selectedRows()) {
|
for (const auto& index : selectionModel->selectedRows()) {
|
||||||
m_foreign.certificates[index.row()].trust = KeeShareSettings::Trust::Untrusted;
|
m_foreign.certificates[index.row()].trust = KeeShareSettings::Trust::Untrusted;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateForeignCertificates();
|
updateForeignCertificates();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidgetKeeShare::removeSelectedCertificates()
|
void SettingsWidgetKeeShare::removeSelectedCertificates()
|
||||||
{
|
{
|
||||||
auto certificates = m_foreign.certificates;
|
auto certificates = m_foreign.certificates;
|
||||||
const auto* selectionModel = m_ui->importedCertificateTableView->selectionModel();
|
const auto* selectionModel = m_ui->importedCertificateTableView->selectionModel();
|
||||||
Q_ASSERT(selectionModel);
|
Q_ASSERT(selectionModel);
|
||||||
for (const auto& index : selectionModel->selectedRows()) {
|
for (const auto& index : selectionModel->selectedRows()) {
|
||||||
certificates.removeOne(m_foreign.certificates[index.row()]);
|
certificates.removeOne(m_foreign.certificates[index.row()]);
|
||||||
}
|
}
|
||||||
m_foreign.certificates = certificates;
|
m_foreign.certificates = certificates;
|
||||||
|
|
||||||
updateForeignCertificates();
|
updateForeignCertificates();
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -77,10 +77,10 @@ private:
|
|||||||
static void resolveReferenceAttributes(Entry* targetEntry, const Database* sourceDb);
|
static void resolveReferenceAttributes(Entry* targetEntry, const Database* sourceDb);
|
||||||
|
|
||||||
static Database* exportIntoContainer(const KeeShareSettings::Reference& reference, const Group* sourceRoot);
|
static Database* exportIntoContainer(const KeeShareSettings::Reference& reference, const Group* sourceRoot);
|
||||||
static Result exportIntoReferenceInsecureContainer(const KeeShareSettings::Reference &reference, Database *targetDb);
|
static Result exportIntoReferenceUnsignedContainer(const KeeShareSettings::Reference &reference, Database *targetDb);
|
||||||
static Result exportIntoReferenceSecureContainer(const KeeShareSettings::Reference &reference, Database *targetDb);
|
static Result exportIntoReferenceSignedContainer(const KeeShareSettings::Reference &reference, Database *targetDb);
|
||||||
static Result importSecureContainerInto(const KeeShareSettings::Reference& reference, Group* targetGroup);
|
static Result importSingedContainerInto(const KeeShareSettings::Reference& reference, Group* targetGroup);
|
||||||
static Result importInsecureContainerInto(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 importContainerInto(const KeeShareSettings::Reference& reference, Group* targetGroup);
|
||||||
static Result importDatabaseInto();
|
static Result importDatabaseInto();
|
||||||
|
|
||||||
|
@ -31,54 +31,54 @@
|
|||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
EditGroupWidgetKeeShare::EditGroupWidgetKeeShare(QWidget* parent)
|
EditGroupWidgetKeeShare::EditGroupWidgetKeeShare(QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, m_ui(new Ui::EditGroupWidgetKeeShare())
|
, m_ui(new Ui::EditGroupWidgetKeeShare())
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
m_ui->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
|
m_ui->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
|
||||||
m_ui->togglePasswordGeneratorButton->setIcon(filePath()->icon("actions", "password-generator", false));
|
m_ui->togglePasswordGeneratorButton->setIcon(filePath()->icon("actions", "password-generator", false));
|
||||||
|
|
||||||
m_ui->passwordGenerator->layout()->setContentsMargins(0, 0, 0, 0);
|
m_ui->passwordGenerator->layout()->setContentsMargins(0, 0, 0, 0);
|
||||||
m_ui->passwordGenerator->hide();
|
m_ui->passwordGenerator->hide();
|
||||||
m_ui->passwordGenerator->reset();
|
m_ui->passwordGenerator->reset();
|
||||||
|
|
||||||
m_ui->messageWidget->hide();
|
m_ui->messageWidget->hide();
|
||||||
m_ui->messageWidget->setCloseButtonVisible(false);
|
m_ui->messageWidget->setCloseButtonVisible(false);
|
||||||
m_ui->messageWidget->setAutoHideTimeout(-1);
|
m_ui->messageWidget->setAutoHideTimeout(-1);
|
||||||
|
|
||||||
connect(m_ui->togglePasswordButton, SIGNAL(toggled(bool)), m_ui->passwordEdit, SLOT(setShowPassword(bool)));
|
connect(m_ui->togglePasswordButton, SIGNAL(toggled(bool)), m_ui->passwordEdit, SLOT(setShowPassword(bool)));
|
||||||
connect(m_ui->togglePasswordGeneratorButton, SIGNAL(toggled(bool)), SLOT(togglePasswordGeneratorButton(bool)));
|
connect(m_ui->togglePasswordGeneratorButton, SIGNAL(toggled(bool)), SLOT(togglePasswordGeneratorButton(bool)));
|
||||||
connect(m_ui->passwordEdit, SIGNAL(textChanged(QString)), SLOT(selectPassword()));
|
connect(m_ui->passwordEdit, SIGNAL(textChanged(QString)), SLOT(selectPassword()));
|
||||||
connect(m_ui->passwordGenerator, SIGNAL(appliedPassword(QString)), SLOT(setGeneratedPassword(QString)));
|
connect(m_ui->passwordGenerator, SIGNAL(appliedPassword(QString)), SLOT(setGeneratedPassword(QString)));
|
||||||
connect(m_ui->pathEdit, SIGNAL(editingFinished()), SLOT(selectPath()));
|
connect(m_ui->pathEdit, SIGNAL(editingFinished()), SLOT(selectPath()));
|
||||||
connect(m_ui->pathSelectionButton, SIGNAL(pressed()), SLOT(launchPathSelectionDialog()));
|
connect(m_ui->pathSelectionButton, SIGNAL(pressed()), SLOT(launchPathSelectionDialog()));
|
||||||
connect(m_ui->typeComboBox, SIGNAL(currentIndexChanged(int)), SLOT(selectType()));
|
connect(m_ui->typeComboBox, SIGNAL(currentIndexChanged(int)), SLOT(selectType()));
|
||||||
|
|
||||||
connect(KeeShare::instance(), SIGNAL(activeChanged()), SLOT(showSharingState()));
|
connect(KeeShare::instance(), SIGNAL(activeChanged()), SLOT(showSharingState()));
|
||||||
|
|
||||||
const auto types = QList<KeeShareSettings::Type>() << KeeShareSettings::Inactive
|
const auto types = QList<KeeShareSettings::Type>() << KeeShareSettings::Inactive
|
||||||
<< KeeShareSettings::ImportFrom
|
<< KeeShareSettings::ImportFrom
|
||||||
<< KeeShareSettings::ExportTo
|
<< KeeShareSettings::ExportTo
|
||||||
<< KeeShareSettings::SynchronizeWith;
|
<< KeeShareSettings::SynchronizeWith;
|
||||||
for (const auto& type : types) {
|
for (const auto& type : types) {
|
||||||
QString name;
|
QString name;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case KeeShareSettings::Inactive:
|
case KeeShareSettings::Inactive:
|
||||||
name = tr("Inactive");
|
name = tr("Inactive");
|
||||||
break;
|
break;
|
||||||
case KeeShareSettings::ImportFrom:
|
case KeeShareSettings::ImportFrom:
|
||||||
name = tr("Import from path");
|
name = tr("Import from path");
|
||||||
break;
|
break;
|
||||||
case KeeShareSettings::ExportTo:
|
case KeeShareSettings::ExportTo:
|
||||||
name = tr("Export to path");
|
name = tr("Export to path");
|
||||||
break;
|
break;
|
||||||
case KeeShareSettings::SynchronizeWith:
|
case KeeShareSettings::SynchronizeWith:
|
||||||
name = tr("Synchronize with path");
|
name = tr("Synchronize with path");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_ui->typeComboBox->insertItem(type, name, static_cast<int>(type));
|
m_ui->typeComboBox->insertItem(type, name, static_cast<int>(type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EditGroupWidgetKeeShare::~EditGroupWidgetKeeShare()
|
EditGroupWidgetKeeShare::~EditGroupWidgetKeeShare()
|
||||||
@ -87,198 +87,198 @@ EditGroupWidgetKeeShare::~EditGroupWidgetKeeShare()
|
|||||||
|
|
||||||
void EditGroupWidgetKeeShare::setGroup(Group* temporaryGroup)
|
void EditGroupWidgetKeeShare::setGroup(Group* temporaryGroup)
|
||||||
{
|
{
|
||||||
if (m_temporaryGroup) {
|
if (m_temporaryGroup) {
|
||||||
m_temporaryGroup->disconnect(this);
|
m_temporaryGroup->disconnect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_temporaryGroup = temporaryGroup;
|
m_temporaryGroup = temporaryGroup;
|
||||||
|
|
||||||
if (m_temporaryGroup) {
|
if (m_temporaryGroup) {
|
||||||
connect(m_temporaryGroup, SIGNAL(groupModified()), SLOT(update()));
|
connect(m_temporaryGroup, SIGNAL(groupModified()), SLOT(update()));
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditGroupWidgetKeeShare::showSharingState()
|
void EditGroupWidgetKeeShare::showSharingState()
|
||||||
{
|
{
|
||||||
if (!m_temporaryGroup) {
|
if (!m_temporaryGroup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto supportedExtensions = QStringList();
|
auto supportedExtensions = QStringList();
|
||||||
#if defined(WITH_XC_KEESHARE_INSECURE)
|
#if defined(WITH_XC_KEESHARE_INSECURE)
|
||||||
supportedExtensions << KeeShare::insecureContainerFileType();
|
supportedExtensions << KeeShare::unsignedContainerFileType();
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_XC_KEESHARE_SECURE)
|
#if defined(WITH_XC_KEESHARE_SECURE)
|
||||||
supportedExtensions << KeeShare::secureContainerFileType();
|
supportedExtensions << KeeShare::signedContainerFileType();
|
||||||
#endif
|
#endif
|
||||||
const auto reference = KeeShare::referenceOf(m_temporaryGroup);
|
const auto reference = KeeShare::referenceOf(m_temporaryGroup);
|
||||||
if (!reference.path.isEmpty()) {
|
if (!reference.path.isEmpty()) {
|
||||||
bool supported = false;
|
bool supported = false;
|
||||||
for(const auto &extension : supportedExtensions){
|
for(const auto &extension : supportedExtensions){
|
||||||
if (reference.path.endsWith(extension, Qt::CaseInsensitive)){
|
if (reference.path.endsWith(extension, Qt::CaseInsensitive)){
|
||||||
supported = true;
|
supported = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!supported) {
|
if (!supported) {
|
||||||
m_ui->messageWidget->showMessage(
|
m_ui->messageWidget->showMessage(
|
||||||
tr("Your KeePassXC version does not support sharing your container type. Please use %1.")
|
tr("Your KeePassXC version does not support sharing your container type. Please use %1.")
|
||||||
.arg(supportedExtensions.join(", ")),
|
.arg(supportedExtensions.join(", ")),
|
||||||
MessageWidget::Warning);
|
MessageWidget::Warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const auto active = KeeShare::active();
|
const auto active = KeeShare::active();
|
||||||
if (!active.in && !active.out) {
|
if (!active.in && !active.out) {
|
||||||
m_ui->messageWidget->showMessage(tr("Database sharing is disabled"), MessageWidget::Information);
|
m_ui->messageWidget->showMessage(tr("Database sharing is disabled"), MessageWidget::Information);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (active.in && !active.out) {
|
if (active.in && !active.out) {
|
||||||
m_ui->messageWidget->showMessage(tr("Database export is disabled"), MessageWidget::Information);
|
m_ui->messageWidget->showMessage(tr("Database export is disabled"), MessageWidget::Information);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!active.in && active.out) {
|
if (!active.in && active.out) {
|
||||||
m_ui->messageWidget->showMessage(tr("Database import is disabled"), MessageWidget::Information);
|
m_ui->messageWidget->showMessage(tr("Database import is disabled"), MessageWidget::Information);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditGroupWidgetKeeShare::update()
|
void EditGroupWidgetKeeShare::update()
|
||||||
{
|
{
|
||||||
if (!m_temporaryGroup) {
|
if (!m_temporaryGroup) {
|
||||||
m_ui->passwordEdit->clear();
|
m_ui->passwordEdit->clear();
|
||||||
m_ui->pathEdit->clear();
|
m_ui->pathEdit->clear();
|
||||||
} else {
|
} else {
|
||||||
const auto reference = KeeShare::referenceOf(m_temporaryGroup);
|
const auto reference = KeeShare::referenceOf(m_temporaryGroup);
|
||||||
|
|
||||||
m_ui->typeComboBox->setCurrentIndex(reference.type);
|
m_ui->typeComboBox->setCurrentIndex(reference.type);
|
||||||
m_ui->passwordEdit->setText(reference.password);
|
m_ui->passwordEdit->setText(reference.password);
|
||||||
m_ui->pathEdit->setText(reference.path);
|
m_ui->pathEdit->setText(reference.path);
|
||||||
|
|
||||||
showSharingState();
|
showSharingState();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui->passwordGenerator->hide();
|
m_ui->passwordGenerator->hide();
|
||||||
m_ui->togglePasswordGeneratorButton->setChecked(false);
|
m_ui->togglePasswordGeneratorButton->setChecked(false);
|
||||||
m_ui->togglePasswordButton->setChecked(false);
|
m_ui->togglePasswordButton->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditGroupWidgetKeeShare::togglePasswordGeneratorButton(bool checked)
|
void EditGroupWidgetKeeShare::togglePasswordGeneratorButton(bool checked)
|
||||||
{
|
{
|
||||||
m_ui->passwordGenerator->regeneratePassword();
|
m_ui->passwordGenerator->regeneratePassword();
|
||||||
m_ui->passwordGenerator->setVisible(checked);
|
m_ui->passwordGenerator->setVisible(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditGroupWidgetKeeShare::setGeneratedPassword(const QString& password)
|
void EditGroupWidgetKeeShare::setGeneratedPassword(const QString& password)
|
||||||
{
|
{
|
||||||
if (!m_temporaryGroup) {
|
if (!m_temporaryGroup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto reference = KeeShare::referenceOf(m_temporaryGroup);
|
auto reference = KeeShare::referenceOf(m_temporaryGroup);
|
||||||
reference.password = password;
|
reference.password = password;
|
||||||
KeeShare::setReferenceTo(m_temporaryGroup, reference);
|
KeeShare::setReferenceTo(m_temporaryGroup, reference);
|
||||||
m_ui->togglePasswordGeneratorButton->setChecked(false);
|
m_ui->togglePasswordGeneratorButton->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditGroupWidgetKeeShare::selectPath()
|
void EditGroupWidgetKeeShare::selectPath()
|
||||||
{
|
{
|
||||||
if (!m_temporaryGroup) {
|
if (!m_temporaryGroup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto reference = KeeShare::referenceOf(m_temporaryGroup);
|
auto reference = KeeShare::referenceOf(m_temporaryGroup);
|
||||||
reference.path = m_ui->pathEdit->text();
|
reference.path = m_ui->pathEdit->text();
|
||||||
KeeShare::setReferenceTo(m_temporaryGroup, reference);
|
KeeShare::setReferenceTo(m_temporaryGroup, reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditGroupWidgetKeeShare::launchPathSelectionDialog()
|
void EditGroupWidgetKeeShare::launchPathSelectionDialog()
|
||||||
{
|
{
|
||||||
if (!m_temporaryGroup) {
|
if (!m_temporaryGroup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString defaultDirPath = config()->get("KeeShare/LastShareDir").toString();
|
QString defaultDirPath = config()->get("KeeShare/LastShareDir").toString();
|
||||||
const bool dirExists = !defaultDirPath.isEmpty() && QDir(defaultDirPath).exists();
|
const bool dirExists = !defaultDirPath.isEmpty() && QDir(defaultDirPath).exists();
|
||||||
if (!dirExists) {
|
if (!dirExists) {
|
||||||
defaultDirPath = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first();
|
defaultDirPath = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first();
|
||||||
}
|
}
|
||||||
auto reference = KeeShare::referenceOf(m_temporaryGroup);
|
auto reference = KeeShare::referenceOf(m_temporaryGroup);
|
||||||
QString defaultFiletype = "";
|
QString defaultFiletype = "";
|
||||||
auto supportedExtensions = QStringList();
|
auto supportedExtensions = QStringList();
|
||||||
auto unsupportedExtensions = QStringList();
|
auto unsupportedExtensions = QStringList();
|
||||||
auto knownFilters = QStringList() << QString("%1 (*)").arg("All files");
|
auto knownFilters = QStringList() << QString("%1 (*)").arg("All files");
|
||||||
#if defined(WITH_XC_KEESHARE_INSECURE)
|
#if defined(WITH_XC_KEESHARE_INSECURE)
|
||||||
defaultFiletype = KeeShare::insecureContainerFileType();
|
defaultFiletype = KeeShare::unsignedContainerFileType();
|
||||||
supportedExtensions << KeeShare::insecureContainerFileType();
|
supportedExtensions << KeeShare::unsignedContainerFileType();
|
||||||
knownFilters.prepend(QString("%1 (*.%2)").arg(tr("KeeShare insecure container"), KeeShare::insecureContainerFileType()));
|
knownFilters.prepend(QString("%1 (*.%2)").arg(tr("KeeShare unsigned container"), KeeShare::unsignedContainerFileType()));
|
||||||
#else
|
#else
|
||||||
unsupportedExtensions << KeeShare::insecureContainerFileType();
|
unsupportedExtensions << KeeShare::unsignedContainerFileType();
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_XC_KEESHARE_SECURE)
|
#if defined(WITH_XC_KEESHARE_SECURE)
|
||||||
defaultFiletype = KeeShare::secureContainerFileType();
|
defaultFiletype = KeeShare::signedContainerFileType();
|
||||||
supportedExtensions << KeeShare::secureContainerFileType();
|
supportedExtensions << KeeShare::signedContainerFileType();
|
||||||
knownFilters.prepend(QString("%1 (*.%2)").arg(tr("KeeShare secure container"), KeeShare::secureContainerFileType()));
|
knownFilters.prepend(QString("%1 (*.%2)").arg(tr("KeeShare signed container"), KeeShare::signedContainerFileType()));
|
||||||
#else
|
#else
|
||||||
unsupportedExtensions << KeeShare::secureContainerFileType();
|
unsupportedExtensions << KeeShare::signedContainerFileType();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const auto filters = knownFilters.join(";;");
|
const auto filters = knownFilters.join(";;");
|
||||||
auto filename = reference.path;
|
auto filename = reference.path;
|
||||||
if (filename.isEmpty()) {
|
if (filename.isEmpty()) {
|
||||||
filename = m_temporaryGroup->name();
|
filename = m_temporaryGroup->name();
|
||||||
}
|
}
|
||||||
switch (reference.type) {
|
switch (reference.type) {
|
||||||
case KeeShareSettings::ImportFrom:
|
case KeeShareSettings::ImportFrom:
|
||||||
filename = fileDialog()->getFileName(
|
filename = fileDialog()->getFileName(
|
||||||
this, tr("Select import source"), defaultDirPath, filters, nullptr, QFileDialog::DontConfirmOverwrite,
|
this, tr("Select import source"), defaultDirPath, filters, nullptr, QFileDialog::DontConfirmOverwrite,
|
||||||
defaultFiletype, filename);
|
defaultFiletype, filename);
|
||||||
break;
|
break;
|
||||||
case KeeShareSettings::ExportTo:
|
case KeeShareSettings::ExportTo:
|
||||||
filename = fileDialog()->getFileName(
|
filename = fileDialog()->getFileName(
|
||||||
this, tr("Select export target"), defaultDirPath, filters, nullptr, QFileDialog::Option(0), defaultFiletype, filename);
|
this, tr("Select export target"), defaultDirPath, filters, nullptr, QFileDialog::Option(0), defaultFiletype, filename);
|
||||||
break;
|
break;
|
||||||
case KeeShareSettings::SynchronizeWith:
|
case KeeShareSettings::SynchronizeWith:
|
||||||
case KeeShareSettings::Inactive:
|
case KeeShareSettings::Inactive:
|
||||||
filename = fileDialog()->getFileName(
|
filename = fileDialog()->getFileName(
|
||||||
this, tr("Select import/export file"), defaultDirPath, filters, nullptr, QFileDialog::Option(0), defaultFiletype, filename);
|
this, tr("Select import/export file"), defaultDirPath, filters, nullptr, QFileDialog::Option(0), defaultFiletype, filename);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filename.isEmpty()) {
|
if (filename.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool validFilename = false;
|
bool validFilename = false;
|
||||||
for(const auto& extension : supportedExtensions + unsupportedExtensions){
|
for(const auto& extension : supportedExtensions + unsupportedExtensions){
|
||||||
if (filename.endsWith(extension, Qt::CaseInsensitive)) {
|
if (filename.endsWith(extension, Qt::CaseInsensitive)) {
|
||||||
validFilename = true;
|
validFilename = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!validFilename){
|
if (!validFilename){
|
||||||
filename += (!filename.endsWith(".") ? "." : "") + defaultFiletype;
|
filename += (!filename.endsWith(".") ? "." : "") + defaultFiletype;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui->pathEdit->setText(filename);
|
m_ui->pathEdit->setText(filename);
|
||||||
selectPath();
|
selectPath();
|
||||||
config()->set("KeeShare/LastShareDir", QFileInfo(filename).absolutePath());
|
config()->set("KeeShare/LastShareDir", QFileInfo(filename).absolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditGroupWidgetKeeShare::selectPassword()
|
void EditGroupWidgetKeeShare::selectPassword()
|
||||||
{
|
{
|
||||||
if (!m_temporaryGroup) {
|
if (!m_temporaryGroup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto reference = KeeShare::referenceOf(m_temporaryGroup);
|
auto reference = KeeShare::referenceOf(m_temporaryGroup);
|
||||||
reference.password = m_ui->passwordEdit->text();
|
reference.password = m_ui->passwordEdit->text();
|
||||||
KeeShare::setReferenceTo(m_temporaryGroup, reference);
|
KeeShare::setReferenceTo(m_temporaryGroup, reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditGroupWidgetKeeShare::selectType()
|
void EditGroupWidgetKeeShare::selectType()
|
||||||
{
|
{
|
||||||
if (!m_temporaryGroup) {
|
if (!m_temporaryGroup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto reference = KeeShare::referenceOf(m_temporaryGroup);
|
auto reference = KeeShare::referenceOf(m_temporaryGroup);
|
||||||
reference.type = static_cast<KeeShareSettings::Type>(m_ui->typeComboBox->currentData().toInt());
|
reference.type = static_cast<KeeShareSettings::Type>(m_ui->typeComboBox->currentData().toInt());
|
||||||
KeeShare::setReferenceTo(m_temporaryGroup, reference);
|
KeeShare::setReferenceTo(m_temporaryGroup, reference);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user