mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Show browser integration tab dynamically
This commit is contained in:
parent
7078086b50
commit
bbc71b3144
@ -74,6 +74,18 @@ void EditWidget::addPage(const QString& labelText, const QIcon& icon, QWidget* w
|
||||
m_ui->categoryList->addCategory(labelText, icon);
|
||||
}
|
||||
|
||||
bool EditWidget::hasPage(QWidget* widget)
|
||||
{
|
||||
for (int i = 0; i < m_ui->stackedWidget->count(); i++) {
|
||||
auto* scrollArea = qobject_cast<QScrollArea*>(m_ui->stackedWidget->widget(i));
|
||||
if (scrollArea && scrollArea->widget() == widget) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void EditWidget::setPageHidden(QWidget* widget, bool hidden)
|
||||
{
|
||||
int index = -1;
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
~EditWidget();
|
||||
|
||||
void addPage(const QString& labelText, const QIcon& icon, QWidget* widget);
|
||||
bool hasPage(QWidget* widget);
|
||||
void setPageHidden(QWidget* widget, bool hidden);
|
||||
void setCurrentPage(int index);
|
||||
void setHeadline(const QString& text);
|
||||
|
@ -265,9 +265,8 @@ void EditEntryWidget::setupAutoType()
|
||||
#ifdef WITH_XC_BROWSER
|
||||
void EditEntryWidget::setupBrowser()
|
||||
{
|
||||
m_browserUi->setupUi(m_browserWidget);
|
||||
|
||||
if (config()->get(Config::Browser_Enabled).toBool()) {
|
||||
m_browserUi->setupUi(m_browserWidget);
|
||||
addPage(tr("Browser Integration"), Resources::instance()->icon("internet-web-browser"), m_browserWidget);
|
||||
m_additionalURLsDataModel->setEntryAttributes(m_entryAttributes);
|
||||
m_browserUi->additionalURLsView->setModel(m_additionalURLsDataModel);
|
||||
@ -932,35 +931,44 @@ void EditEntryWidget::setForms(Entry* entry, bool restore)
|
||||
#endif
|
||||
|
||||
#ifdef WITH_XC_BROWSER
|
||||
if (m_customData->contains(BrowserService::OPTION_SKIP_AUTO_SUBMIT)) {
|
||||
// clang-format off
|
||||
m_browserUi->skipAutoSubmitCheckbox->setChecked(m_customData->value(BrowserService::OPTION_SKIP_AUTO_SUBMIT) == TRUE_STR);
|
||||
// clang-format on
|
||||
} else {
|
||||
m_browserUi->skipAutoSubmitCheckbox->setChecked(false);
|
||||
if (config()->get(Config::Browser_Enabled).toBool()) {
|
||||
if (!hasPage(m_browserWidget)) {
|
||||
setupBrowser();
|
||||
}
|
||||
|
||||
if (m_customData->contains(BrowserService::OPTION_SKIP_AUTO_SUBMIT)) {
|
||||
// clang-format off
|
||||
m_browserUi->skipAutoSubmitCheckbox->setChecked(m_customData->value(BrowserService::OPTION_SKIP_AUTO_SUBMIT) == TRUE_STR);
|
||||
// clang-format on
|
||||
} else {
|
||||
m_browserUi->skipAutoSubmitCheckbox->setChecked(false);
|
||||
}
|
||||
|
||||
if (m_customData->contains(BrowserService::OPTION_HIDE_ENTRY)) {
|
||||
m_browserUi->hideEntryCheckbox->setChecked(m_customData->value(BrowserService::OPTION_HIDE_ENTRY)
|
||||
== TRUE_STR);
|
||||
} else {
|
||||
m_browserUi->hideEntryCheckbox->setChecked(false);
|
||||
}
|
||||
|
||||
if (m_customData->contains(BrowserService::OPTION_ONLY_HTTP_AUTH)) {
|
||||
m_browserUi->onlyHttpAuthCheckbox->setChecked(m_customData->value(BrowserService::OPTION_ONLY_HTTP_AUTH)
|
||||
== TRUE_STR);
|
||||
} else {
|
||||
m_browserUi->onlyHttpAuthCheckbox->setChecked(false);
|
||||
}
|
||||
|
||||
m_browserUi->addURLButton->setEnabled(!m_history);
|
||||
m_browserUi->removeURLButton->setEnabled(false);
|
||||
m_browserUi->editURLButton->setEnabled(false);
|
||||
m_browserUi->additionalURLsView->setEditTriggers(editTriggers);
|
||||
|
||||
if (m_additionalURLsDataModel->rowCount() != 0) {
|
||||
m_browserUi->additionalURLsView->setCurrentIndex(m_additionalURLsDataModel->index(0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
if (m_customData->contains(BrowserService::OPTION_HIDE_ENTRY)) {
|
||||
m_browserUi->hideEntryCheckbox->setChecked(m_customData->value(BrowserService::OPTION_HIDE_ENTRY) == TRUE_STR);
|
||||
} else {
|
||||
m_browserUi->hideEntryCheckbox->setChecked(false);
|
||||
}
|
||||
|
||||
if (m_customData->contains(BrowserService::OPTION_ONLY_HTTP_AUTH)) {
|
||||
m_browserUi->onlyHttpAuthCheckbox->setChecked(m_customData->value(BrowserService::OPTION_ONLY_HTTP_AUTH)
|
||||
== TRUE_STR);
|
||||
} else {
|
||||
m_browserUi->onlyHttpAuthCheckbox->setChecked(false);
|
||||
}
|
||||
|
||||
m_browserUi->addURLButton->setEnabled(!m_history);
|
||||
m_browserUi->removeURLButton->setEnabled(false);
|
||||
m_browserUi->editURLButton->setEnabled(false);
|
||||
m_browserUi->additionalURLsView->setEditTriggers(editTriggers);
|
||||
|
||||
if (m_additionalURLsDataModel->rowCount() != 0) {
|
||||
m_browserUi->additionalURLsView->setCurrentIndex(m_additionalURLsDataModel->index(0, 0));
|
||||
}
|
||||
setPageHidden(m_browserWidget, !config()->get(Config::Browser_Enabled).toBool());
|
||||
#endif
|
||||
|
||||
m_editWidgetProperties->setFields(entry->timeInfo(), entry->uuid());
|
||||
|
Loading…
Reference in New Issue
Block a user