diff --git a/src/keeshare/KeeShare.cpp b/src/keeshare/KeeShare.cpp index 01d11f02c..d1cbde099 100644 --- a/src/keeshare/KeeShare.cpp +++ b/src/keeshare/KeeShare.cpp @@ -162,18 +162,32 @@ QString KeeShare::sharingLabel(const Group* group) } const auto reference = referenceOf(share); + if (!reference.isValid()) { + return tr("Invalid sharing reference"); + } + QStringList messages; switch (reference.type) { case KeeShareSettings::Inactive: - return tr("Inactive share %1").arg(reference.path); + messages << tr("Inactive share %1").arg(reference.path); + break; case KeeShareSettings::ImportFrom: - return tr("Imported from %1").arg(reference.path); + messages << tr("Imported from %1").arg(reference.path); + break; case KeeShareSettings::ExportTo: - return tr("Exported to %1").arg(reference.path); + messages << tr("Exported to %1").arg(reference.path); + break; case KeeShareSettings::SynchronizeWith: - return tr("Synchronized with %1").arg(reference.path); + messages << tr("Synchronized with %1").arg(reference.path); + break; } - - return {}; + const auto active = KeeShare::active(); + if (reference.isImporting() && !active.in) { + messages << tr("Import is disabled in settings"); + } + if (reference.isExporting() && !active.out) { + messages << tr("Export is disabled in settings"); + } + return messages.join("\n"); } QPixmap KeeShare::indicatorBadge(const Group* group, QPixmap pixmap) diff --git a/src/keeshare/ShareObserver.cpp b/src/keeshare/ShareObserver.cpp index 82d02a7da..295883ab8 100644 --- a/src/keeshare/ShareObserver.cpp +++ b/src/keeshare/ShareObserver.cpp @@ -190,7 +190,6 @@ void ShareObserver::reinitialize() KeeShareSettings::Reference newReference; }; - const auto active = KeeShare::active(); QList updated; const QList groups = m_db->rootGroup()->groupsRecursive(true); for (Group* group : groups) { @@ -202,9 +201,7 @@ void ShareObserver::reinitialize() m_groupToReference.remove(couple.group); m_referenceToGroup.remove(couple.oldReference); m_shareToGroup.remove(couple.oldReference.path); - if (couple.newReference.isValid() - && ((active.in && couple.newReference.isImporting()) - || (active.out && couple.newReference.isExporting()))) { + if (couple.newReference.isValid()) { m_groupToReference[couple.group] = couple.newReference; m_referenceToGroup[couple.newReference] = couple.group; m_shareToGroup[couple.newReference.path] = couple.group;