diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts index 2701f7b05..146bb673b 100644 --- a/share/translations/keepassxc_en.ts +++ b/share/translations/keepassxc_en.ts @@ -3084,10 +3084,6 @@ Would you like to correct it? EditGroupWidgetBrowser - - Edit Group - - These settings affect to the group's behaviour with the browser extension. diff --git a/src/gui/group/EditGroupWidget.cpp b/src/gui/group/EditGroupWidget.cpp index fc6f80624..39f5bc445 100644 --- a/src/gui/group/EditGroupWidget.cpp +++ b/src/gui/group/EditGroupWidget.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2011 Felix Geyer - * Copyright (C) 2021 KeePassXC Team + * Copyright (C) 2022 KeePassXC Team * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -73,7 +73,7 @@ EditGroupWidget::EditGroupWidget(QWidget* parent) #if defined(WITH_XC_BROWSER) , m_browserSettingsChanged(false) , m_browserUi(new Ui::EditGroupWidgetBrowser()) - , m_browserWidget(new QScrollArea()) + , m_browserWidget(new QWidget(this)) #endif , m_group(nullptr) { @@ -83,8 +83,7 @@ EditGroupWidget::EditGroupWidget(QWidget* parent) addPage(tr("Icon"), icons()->icon("preferences-desktop-icons"), m_editGroupWidgetIcons); #if defined(WITH_XC_BROWSER) if (config()->get(Config::Browser_Enabled).toBool()) { - addPage(tr("Browser Integration"), icons()->icon("internet-web-browser"), m_browserWidget); - m_browserUi->setupUi(m_browserWidget); + initializeBrowserPage(); } #endif #if defined(WITH_XC_KEESHARE) @@ -135,28 +134,7 @@ void EditGroupWidget::setupModifiedTracking() #if defined(WITH_XC_BROWSER) if (config()->get(Config::Browser_Enabled).toBool()) { - // Browser integration tab - connect( - m_browserUi->browserIntegrationHideEntriesComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setModified())); - connect(m_browserUi->browserIntegrationSkipAutoSubmitComboBox, - SIGNAL(currentIndexChanged(int)), - SLOT(setModified())); - connect( - m_browserUi->browserIntegrationOnlyHttpAuthComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setModified())); - connect( - m_browserUi->browserIntegrationNotHttpAuthComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setModified())); - connect(m_browserUi->browserIntegrationHideEntriesComboBox, - SIGNAL(currentIndexChanged(int)), - SLOT(updateBrowserModified())); - connect(m_browserUi->browserIntegrationSkipAutoSubmitComboBox, - SIGNAL(currentIndexChanged(int)), - SLOT(updateBrowserModified())); - connect(m_browserUi->browserIntegrationOnlyHttpAuthComboBox, - SIGNAL(currentIndexChanged(int)), - SLOT(updateBrowserModified())); - connect(m_browserUi->browserIntegrationNotHttpAuthComboBox, - SIGNAL(currentIndexChanged(int)), - SLOT(updateBrowserModified())); + setupBrowserModifiedTracking(); } #endif } @@ -230,6 +208,14 @@ void EditGroupWidget::loadGroup(Group* group, bool create, const QSharedPointer< inheritOmitWww = parent->resolveCustomDataTriState(BrowserService::OPTION_OMIT_WWW); } + // If the page has not been created at all, some of the elements are null + if (m_browserUi->browserIntegrationHideEntriesComboBox == nullptr + && config()->get(Config::Browser_Enabled).toBool()) { + initializeBrowserPage(); + setupBrowserModifiedTracking(); + } + + setPageHidden(m_browserWidget, false); addTriStateItems(m_browserUi->browserIntegrationHideEntriesComboBox, inheritHideEntries); addTriStateItems(m_browserUi->browserIntegrationSkipAutoSubmitComboBox, inheritSkipSubmit); addTriStateItems(m_browserUi->browserIntegrationOnlyHttpAuthComboBox, inheritOnlyHttp); @@ -246,6 +232,8 @@ void EditGroupWidget::loadGroup(Group* group, bool create, const QSharedPointer< indexFromTriState(group->resolveCustomDataTriState(BrowserService::OPTION_NOT_HTTP_AUTH, false))); m_browserUi->browserIntegrationOmitWwwCombobox->setCurrentIndex( indexFromTriState(group->resolveCustomDataTriState(BrowserService::OPTION_OMIT_WWW, false))); + } else if (hasPage(m_browserWidget)) { + setPageHidden(m_browserWidget, true); } #endif @@ -363,6 +351,34 @@ void EditGroupWidget::cancel() } #ifdef WITH_XC_BROWSER +void EditGroupWidget::initializeBrowserPage() +{ + addPage(tr("Browser Integration"), icons()->icon("internet-web-browser"), m_browserWidget); + m_browserUi->setupUi(m_browserWidget); +} + +void EditGroupWidget::setupBrowserModifiedTracking() +{ + // Browser integration tab + connect(m_browserUi->browserIntegrationHideEntriesComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setModified())); + connect( + m_browserUi->browserIntegrationSkipAutoSubmitComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setModified())); + connect(m_browserUi->browserIntegrationOnlyHttpAuthComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setModified())); + connect(m_browserUi->browserIntegrationNotHttpAuthComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setModified())); + connect(m_browserUi->browserIntegrationHideEntriesComboBox, + SIGNAL(currentIndexChanged(int)), + SLOT(updateBrowserModified())); + connect(m_browserUi->browserIntegrationSkipAutoSubmitComboBox, + SIGNAL(currentIndexChanged(int)), + SLOT(updateBrowserModified())); + connect(m_browserUi->browserIntegrationOnlyHttpAuthComboBox, + SIGNAL(currentIndexChanged(int)), + SLOT(updateBrowserModified())); + connect(m_browserUi->browserIntegrationNotHttpAuthComboBox, + SIGNAL(currentIndexChanged(int)), + SLOT(updateBrowserModified())); +} + void EditGroupWidget::updateBrowserModified() { m_browserSettingsChanged = true; diff --git a/src/gui/group/EditGroupWidget.h b/src/gui/group/EditGroupWidget.h index 412269c85..2b44b6445 100644 --- a/src/gui/group/EditGroupWidget.h +++ b/src/gui/group/EditGroupWidget.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2011 Felix Geyer - * Copyright (C) 2021 KeePassXC Team + * Copyright (C) 2022 KeePassXC Team * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,6 +72,8 @@ private slots: void save(); void cancel(); #ifdef WITH_XC_BROWSER + void initializeBrowserPage(); + void setupBrowserModifiedTracking(); void updateBrowserModified(); #endif @@ -89,7 +91,7 @@ private: #ifdef WITH_XC_BROWSER bool m_browserSettingsChanged; const QScopedPointer m_browserUi; - QPointer m_browserWidget; + QWidget* const m_browserWidget; #endif QScopedPointer m_temporaryGroup; diff --git a/src/gui/group/EditGroupWidgetBrowser.ui b/src/gui/group/EditGroupWidgetBrowser.ui index 94069f7e6..dfe4b5971 100644 --- a/src/gui/group/EditGroupWidgetBrowser.ui +++ b/src/gui/group/EditGroupWidgetBrowser.ui @@ -1,34 +1,7 @@ EditGroupWidgetBrowser - - - - 0 - 0 - 539 - 523 - - - - Edit Group - - - QFrame::NoFrame - - - QFrame::Plain - - - Qt::ScrollBarAlwaysOff - - - QAbstractScrollArea::AdjustToContents - - - true - - + 0 @@ -59,127 +32,126 @@ -    -   0 -   -   -   10 -   -   -   0 -   -   -   0 -    -    -   10 -    -    -   8 -    -    -    -    -   Hide entries from browser extension: -    -    -   Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter -    -    -    -    -    -    -   Hide entries from browser extension toggle for this and sub groups -    -    -    -    -    -    -   Skip Auto-Submit for entries: -    -    -   Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter -    -    -    -    -    -    -   Skip Auto-Submit toggle for this and sub groups -    -    -    -    -    -    -   Use entries only with HTTP Basic Auth: -    -    -   Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter -    -    -    -    -    -    -   Only HTTP Auth toggle for this and sub groups -    -    -    -    -   -    -    Do not use entries with HTTP Basic Auth: -    -    -    Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter -    -    -    -    -    -    -    Do not use HTTP Auth toggle for this and sub groups -    -    -    + + 0 + + + 10 + + + 0 + + + 0 + + + 10 + + + 8 + + + + + Hide entries from browser extension: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Hide entries from browser extension toggle for this and sub groups + + + + + + + Skip Auto-Submit for entries: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Skip Auto-Submit toggle for this and sub groups + + + + + + + Use entries only with HTTP Basic Auth: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Only HTTP Auth toggle for this and sub groups + + + + + + + Do not use entries with HTTP Basic Auth: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Do not use HTTP Auth toggle for this and sub groups + + + -   -    -    Omit WWW subdomain from matching: -    -    -    Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter -    -    -    -    -    -    -    Omit WWW subdomain from matching toggle for this and sub groups -    -    -    -    -    -    -    Qt::Vertical -    -    -    -    20 -    40 -    -    -    -    -    -   + + + Omit WWW subdomain from matching: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Omit WWW subdomain from matching toggle for this and sub groups + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + - browserIntegrationHideEntriesComboBox browserIntegrationSkipAutoSubmitComboBox