Make KeeShare user messages easier to understand (#2824)

This commit is contained in:
Vladimir Svyatski 2019-03-27 01:54:54 +02:00 committed by Jonathan White
parent d6324feafd
commit e786291086
3 changed files with 27 additions and 22 deletions

View File

@ -164,13 +164,13 @@ QString KeeShare::sharingLabel(const Group* group)
const auto reference = referenceOf(share); const auto reference = referenceOf(share);
switch (reference.type) { switch (reference.type) {
case KeeShareSettings::Inactive: case KeeShareSettings::Inactive:
return tr("Disabled share %1").arg(reference.path); return tr("Inactive share %1").arg(reference.path);
case KeeShareSettings::ImportFrom: case KeeShareSettings::ImportFrom:
return tr("Import from share %1").arg(reference.path); return tr("Imported from %1").arg(reference.path);
case KeeShareSettings::ExportTo: case KeeShareSettings::ExportTo:
return tr("Export to share %1").arg(reference.path); return tr("Exported to %1").arg(reference.path);
case KeeShareSettings::SynchronizeWith: case KeeShareSettings::SynchronizeWith:
return tr("Synchronize with share %1").arg(reference.path); return tr("Synchronized with %1").arg(reference.path);
} }
return {}; return {};
@ -196,13 +196,13 @@ QString KeeShare::referenceTypeLabel(const KeeShareSettings::Reference& referenc
{ {
switch (reference.type) { switch (reference.type) {
case KeeShareSettings::Inactive: case KeeShareSettings::Inactive:
return tr("Disabled share"); return tr("Inactive share");
case KeeShareSettings::ImportFrom: case KeeShareSettings::ImportFrom:
return tr("Import from"); return tr("Imported from");
case KeeShareSettings::ExportTo: case KeeShareSettings::ExportTo:
return tr("Export to"); return tr("Exported to");
case KeeShareSettings::SynchronizeWith: case KeeShareSettings::SynchronizeWith:
return tr("Synchronize with"); return tr("Synchronized with");
} }
return ""; return "";
} }

View File

@ -84,7 +84,7 @@ namespace
key.openKey(QString()); key.openKey(QString());
const auto signer = Signature(); const auto signer = Signature();
if (!signer.verify(data, sign.signature, key)) { if (!signer.verify(data, sign.signature, key)) {
qCritical("Invalid signature for sharing container %s.", qPrintable(reference.path)); qCritical("Invalid signature for shared container %s.", qPrintable(reference.path));
return {Invalid, KeeShareSettings::Certificate()}; return {Invalid, KeeShareSettings::Certificate()};
} }

View File

@ -68,13 +68,13 @@ EditGroupWidgetKeeShare::EditGroupWidgetKeeShare(QWidget* parent)
name = tr("Inactive"); name = tr("Inactive");
break; break;
case KeeShareSettings::ImportFrom: case KeeShareSettings::ImportFrom:
name = tr("Import from path"); name = tr("Import");
break; break;
case KeeShareSettings::ExportTo: case KeeShareSettings::ExportTo:
name = tr("Export to path"); name = tr("Export");
break; break;
case KeeShareSettings::SynchronizeWith: case KeeShareSettings::SynchronizeWith:
name = tr("Synchronize with path"); name = tr("Synchronize");
break; break;
} }
m_ui->typeComboBox->insertItem(type, name, static_cast<int>(type)); m_ui->typeComboBox->insertItem(type, name, static_cast<int>(type));
@ -124,10 +124,10 @@ void EditGroupWidgetKeeShare::showSharingState()
} }
} }
if (!supported) { if (!supported) {
m_ui->messageWidget->showMessage( m_ui->messageWidget->showMessage(tr("Your KeePassXC version does not support sharing this container type.\n"
tr("Your KeePassXC version does not support sharing your container type. Please use %1.") "Supported extensions are: %1.")
.arg(supportedExtensions.join(", ")), .arg(supportedExtensions.join(", ")),
MessageWidget::Warning); MessageWidget::Warning);
return; return;
} }
@ -149,18 +149,18 @@ void EditGroupWidgetKeeShare::showSharingState()
(other.isImporting() && reference.isExporting()) || (other.isExporting() && reference.isImporting()); (other.isImporting() && reference.isExporting()) || (other.isExporting() && reference.isImporting());
} }
if (conflictExport) { if (conflictExport) {
m_ui->messageWidget->showMessage(tr("The export container %1 is already referenced.").arg(reference.path), m_ui->messageWidget->showMessage(tr("%1 is already being exported by this database.").arg(reference.path),
MessageWidget::Error); MessageWidget::Error);
return; return;
} }
if (multipleImport) { if (multipleImport) {
m_ui->messageWidget->showMessage(tr("The import container %1 is already imported.").arg(reference.path), m_ui->messageWidget->showMessage(tr("%1 is already being imported by this database.").arg(reference.path),
MessageWidget::Warning); MessageWidget::Warning);
return; return;
} }
if (cycleImportExport) { if (cycleImportExport) {
m_ui->messageWidget->showMessage( m_ui->messageWidget->showMessage(
tr("The container %1 imported and export by different groups.").arg(reference.path), tr("%1 is being imported and exported by different groups in this database.").arg(reference.path),
MessageWidget::Warning); MessageWidget::Warning);
return; return;
} }
@ -169,15 +169,20 @@ void EditGroupWidgetKeeShare::showSharingState()
} }
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("KeeShare is currently disabled. You can enable import/export in the application settings.",
"KeeShare is a proper noun"),
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 currently disabled by application settings."),
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 currently disabled by application settings."),
MessageWidget::Information);
return; return;
} }
} }