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.
This commit is contained in:
schlimmchen 2019-10-22 17:47:43 +02:00 committed by Jonathan White
parent 957ba90073
commit c2b16c663f
2 changed files with 12 additions and 0 deletions

View File

@ -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);

View File

@ -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);