mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-06 05:57:37 +03:00
Add share indication label in group view (#2742)
* When viewing a shared group, the sharing state is indicated by a label similar to the search label. * Banner shows on children of shared groups * When searching, share banner is hidden * Fixed issue where group/entry information was not updated after change
This commit is contained in:
parent
a2bd08ca8a
commit
ebb87e6379
5 changed files with 74 additions and 5 deletions
|
@ -61,8 +61,6 @@
|
|||
#include "keeshare/KeeShare.h"
|
||||
#include "touchid/TouchID.h"
|
||||
|
||||
#include "config-keepassx.h"
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include <sys/vfs.h>
|
||||
#endif
|
||||
|
@ -80,6 +78,9 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
|
|||
, m_previewView(new EntryPreviewWidget(this))
|
||||
, m_previewSplitter(new QSplitter(m_mainWidget))
|
||||
, m_searchingLabel(new QLabel(this))
|
||||
#ifdef WITH_XC_KEESHARE
|
||||
, m_shareLabel(new QLabel(this))
|
||||
#endif
|
||||
, m_csvImportWizard(new CsvImportWizard(this))
|
||||
, m_editEntryWidget(new EditEntryWidget(this))
|
||||
, m_editGroupWidget(new EditGroupWidget(this))
|
||||
|
@ -103,6 +104,9 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
|
|||
auto* vbox = new QVBoxLayout();
|
||||
vbox->setMargin(0);
|
||||
vbox->addWidget(m_searchingLabel);
|
||||
#ifdef WITH_XC_KEESHARE
|
||||
vbox->addWidget(m_shareLabel);
|
||||
#endif
|
||||
vbox->addWidget(m_previewSplitter);
|
||||
rightHandSideWidget->setLayout(vbox);
|
||||
m_entryView = new EntryView(rightHandSideWidget);
|
||||
|
@ -134,6 +138,16 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
|
|||
"border-radius: 4px;");
|
||||
m_searchingLabel->setVisible(false);
|
||||
|
||||
#ifdef WITH_XC_KEESHARE
|
||||
m_shareLabel->setText(tr("Shared group..."));
|
||||
m_shareLabel->setAlignment(Qt::AlignCenter);
|
||||
m_shareLabel->setStyleSheet("color: rgb(0, 0, 0);"
|
||||
"background-color: rgb(255, 253, 160);"
|
||||
"border: 2px solid rgb(190, 190, 190);"
|
||||
"border-radius: 4px;");
|
||||
m_shareLabel->setVisible(false);
|
||||
#endif
|
||||
|
||||
m_previewView->hide();
|
||||
m_previewSplitter->addWidget(m_entryView);
|
||||
m_previewSplitter->addWidget(m_previewView);
|
||||
|
@ -765,9 +779,9 @@ void DatabaseWidget::switchToMainView(bool previousDialogAccepted)
|
|||
|
||||
setCurrentWidget(m_mainWidget);
|
||||
|
||||
if (sender() == m_entryView) {
|
||||
if (sender() == m_entryView || sender() == m_editEntryWidget) {
|
||||
onEntryChanged(m_entryView->currentEntry());
|
||||
} else if (sender() == m_groupView) {
|
||||
} else if (sender() == m_groupView || sender() == m_editGroupWidget) {
|
||||
onGroupChanged(m_groupView->currentGroup());
|
||||
}
|
||||
}
|
||||
|
@ -1089,6 +1103,7 @@ void DatabaseWidget::search(const QString& searchtext)
|
|||
}
|
||||
|
||||
m_searchingLabel->setVisible(true);
|
||||
m_shareLabel->setVisible(false);
|
||||
|
||||
emit searchModeActivated();
|
||||
}
|
||||
|
@ -1117,6 +1132,16 @@ void DatabaseWidget::onGroupChanged(Group* group)
|
|||
}
|
||||
|
||||
m_previewView->setGroup(group);
|
||||
|
||||
#ifdef WITH_XC_KEESHARE
|
||||
auto shareLabel = KeeShare::sharingLabel(group);
|
||||
if (!shareLabel.isEmpty()) {
|
||||
m_shareLabel->setText(shareLabel);
|
||||
m_shareLabel->setVisible(true);
|
||||
} else {
|
||||
m_shareLabel->setVisible(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DatabaseWidget::onDatabaseModified()
|
||||
|
@ -1140,6 +1165,7 @@ void DatabaseWidget::endSearch()
|
|||
|
||||
// Show the normal entry view of the current group
|
||||
m_entryView->displayGroup(currentGroup());
|
||||
onGroupChanged(currentGroup());
|
||||
|
||||
emit listModeActivated();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue