From 60f02a24baa322a3fad2819278322b7fedbe9b07 Mon Sep 17 00:00:00 2001 From: schlimmchen Date: Tue, 22 Oct 2019 17:47:43 +0200 Subject: [PATCH] no "Share" tab without WITH_XC_KEESHARE if KeePassXC is compiled with WITH_XC_KEESHARE=OFF, the "Share" tab of the EntryPreviewWidget for groups is removed from the GUI completely. closes #3619. --- src/gui/EntryPreviewWidget.cpp | 11 +++++++++++ src/gui/EntryPreviewWidget.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/gui/EntryPreviewWidget.cpp b/src/gui/EntryPreviewWidget.cpp index c20c85be9f..af8c1cd21d 100644 --- a/src/gui/EntryPreviewWidget.cpp +++ b/src/gui/EntryPreviewWidget.cpp @@ -72,6 +72,10 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent) m_ui->groupCloseButton->setIcon(filePath()->icon("actions", "dialog-close")); connect(m_ui->groupCloseButton, SIGNAL(clicked()), SLOT(hide())); connect(m_ui->groupTabWidget, SIGNAL(tabBarClicked(int)), SLOT(updateTabIndexes()), Qt::QueuedConnection); + +#if !defined(WITH_XC_KEESHARE) + removeTab(m_ui->groupTabWidget, m_ui->groupShareTab); +#endif } EntryPreviewWidget::~EntryPreviewWidget() @@ -376,6 +380,13 @@ void EntryPreviewWidget::openEntryUrl() } } +void EntryPreviewWidget::removeTab(QTabWidget* tabWidget, QWidget* widget) +{ + const int tabIndex = tabWidget->indexOf(widget); + Q_ASSERT(tabIndex != -1); + tabWidget->removeTab(tabIndex); +} + void EntryPreviewWidget::setTabEnabled(QTabWidget* tabWidget, QWidget* widget, bool enabled) { const int tabIndex = tabWidget->indexOf(widget); diff --git a/src/gui/EntryPreviewWidget.h b/src/gui/EntryPreviewWidget.h index ddf17b2956..0887c49d45 100644 --- a/src/gui/EntryPreviewWidget.h +++ b/src/gui/EntryPreviewWidget.h @@ -67,6 +67,7 @@ private slots: void openEntryUrl(); private: + void removeTab(QTabWidget* tabWidget, QWidget* widget); void setTabEnabled(QTabWidget* tabWidget, QWidget* widget, bool enabled); static QPixmap preparePixmap(const QPixmap& pixmap, int size);