Skip to content

Commit

Permalink
no "Share" tab without WITH_XC_KEESHARE
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
schlimmchen authored and droidmonkey committed Oct 24, 2019
1 parent 957ba90 commit c2b16c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gui/EntryPreviewWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/gui/EntryPreviewWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c2b16c6

Please sign in to comment.