mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-02 09:34:58 -05:00
Custom browser feature for Linux/macOS
* Also move "search in all databases" to the general tab
This commit is contained in:
parent
d863496f62
commit
43c82ccb09
@ -182,6 +182,36 @@ void BrowserSettings::setCustomProxyLocation(const QString& location)
|
|||||||
config()->set(Config::Browser_CustomProxyLocation, location);
|
config()->set(Config::Browser_CustomProxyLocation, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BrowserSettings::customBrowserSupport()
|
||||||
|
{
|
||||||
|
return config()->get(Config::Browser_UseCustomBrowser).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BrowserSettings::setCustomBrowserSupport(bool enabled)
|
||||||
|
{
|
||||||
|
config()->set(Config::Browser_UseCustomBrowser, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
int BrowserSettings::customBrowserType()
|
||||||
|
{
|
||||||
|
return config()->get(Config::Browser_CustomBrowserType).toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BrowserSettings::setCustomBrowserType(int type)
|
||||||
|
{
|
||||||
|
config()->set(Config::Browser_CustomBrowserType, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString BrowserSettings::customBrowserLocation()
|
||||||
|
{
|
||||||
|
return config()->get(Config::Browser_CustomBrowserLocation).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BrowserSettings::setCustomBrowserLocation(const QString& location)
|
||||||
|
{
|
||||||
|
config()->set(Config::Browser_CustomBrowserLocation, location);
|
||||||
|
}
|
||||||
|
|
||||||
QString BrowserSettings::proxyLocation()
|
QString BrowserSettings::proxyLocation()
|
||||||
{
|
{
|
||||||
return m_nativeMessageInstaller.getProxyPath();
|
return m_nativeMessageInstaller.getProxyPath();
|
||||||
|
@ -75,7 +75,12 @@ public:
|
|||||||
|
|
||||||
bool browserSupport(BrowserShared::SupportedBrowsers browser);
|
bool browserSupport(BrowserShared::SupportedBrowsers browser);
|
||||||
void setBrowserSupport(BrowserShared::SupportedBrowsers browser, bool enabled);
|
void setBrowserSupport(BrowserShared::SupportedBrowsers browser, bool enabled);
|
||||||
|
bool customBrowserSupport();
|
||||||
|
void setCustomBrowserSupport(bool enabled);
|
||||||
|
int customBrowserType();
|
||||||
|
void setCustomBrowserType(int type);
|
||||||
|
QString customBrowserLocation();
|
||||||
|
void setCustomBrowserLocation(const QString& location);
|
||||||
bool passwordUseNumbers();
|
bool passwordUseNumbers();
|
||||||
void setPasswordUseNumbers(bool useNumbers);
|
void setPasswordUseNumbers(bool useNumbers);
|
||||||
bool passwordUseLowercase();
|
bool passwordUseLowercase();
|
||||||
|
@ -57,8 +57,20 @@ BrowserSettingsWidget::BrowserSettingsWidget(QWidget* parent)
|
|||||||
m_ui->tabWidget->setEnabled(m_ui->enableBrowserSupport->isChecked());
|
m_ui->tabWidget->setEnabled(m_ui->enableBrowserSupport->isChecked());
|
||||||
connect(m_ui->enableBrowserSupport, SIGNAL(toggled(bool)), m_ui->tabWidget, SLOT(setEnabled(bool)));
|
connect(m_ui->enableBrowserSupport, SIGNAL(toggled(bool)), m_ui->tabWidget, SLOT(setEnabled(bool)));
|
||||||
|
|
||||||
|
// Custom Browser option
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
// TODO: Custom browser is disabled on Windows
|
||||||
|
m_ui->customBrowserSupport->setVisible(false);
|
||||||
|
m_ui->customBrowserGroupBox->setVisible(false);
|
||||||
|
#else
|
||||||
|
connect(m_ui->customBrowserLocationBrowseButton, SIGNAL(clicked()), SLOT(showCustomBrowserLocationFileDialog()));
|
||||||
|
connect(m_ui->customBrowserSupport, SIGNAL(toggled(bool)), m_ui->customBrowserGroupBox, SLOT(setEnabled(bool)));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Custom Proxy option
|
||||||
m_ui->customProxyLocation->setEnabled(m_ui->useCustomProxy->isChecked());
|
m_ui->customProxyLocation->setEnabled(m_ui->useCustomProxy->isChecked());
|
||||||
m_ui->customProxyLocationBrowseButton->setEnabled(m_ui->useCustomProxy->isChecked());
|
m_ui->customProxyLocationBrowseButton->setEnabled(m_ui->useCustomProxy->isChecked());
|
||||||
|
|
||||||
connect(m_ui->useCustomProxy, SIGNAL(toggled(bool)), m_ui->customProxyLocation, SLOT(setEnabled(bool)));
|
connect(m_ui->useCustomProxy, SIGNAL(toggled(bool)), m_ui->customProxyLocation, SLOT(setEnabled(bool)));
|
||||||
connect(m_ui->useCustomProxy, SIGNAL(toggled(bool)), m_ui->customProxyLocationBrowseButton, SLOT(setEnabled(bool)));
|
connect(m_ui->useCustomProxy, SIGNAL(toggled(bool)), m_ui->customProxyLocationBrowseButton, SLOT(setEnabled(bool)));
|
||||||
connect(m_ui->useCustomProxy, SIGNAL(toggled(bool)), SLOT(validateCustomProxyLocation()));
|
connect(m_ui->useCustomProxy, SIGNAL(toggled(bool)), SLOT(validateCustomProxyLocation()));
|
||||||
@ -150,6 +162,9 @@ void BrowserSettingsWidget::loadSettings()
|
|||||||
m_ui->browsersGroupBox->setEnabled(false);
|
m_ui->browsersGroupBox->setEnabled(false);
|
||||||
m_ui->updateBinaryPath->setChecked(false);
|
m_ui->updateBinaryPath->setChecked(false);
|
||||||
m_ui->updateBinaryPath->setVisible(false);
|
m_ui->updateBinaryPath->setVisible(false);
|
||||||
|
// No custom browser for snaps
|
||||||
|
m_ui->customBrowserSupport->setVisible(false);
|
||||||
|
m_ui->customBrowserGroupBox->setVisible(false);
|
||||||
// Show notice to user
|
// Show notice to user
|
||||||
m_ui->browserGlobalWarningWidget->showMessage(tr("Please see special instructions for browser extension use below"),
|
m_ui->browserGlobalWarningWidget->showMessage(tr("Please see special instructions for browser extension use below"),
|
||||||
MessageWidget::Warning);
|
MessageWidget::Warning);
|
||||||
@ -157,6 +172,18 @@ void BrowserSettingsWidget::loadSettings()
|
|||||||
m_ui->browserGlobalWarningWidget->setAutoHideTimeout(-1);
|
m_ui->browserGlobalWarningWidget->setAutoHideTimeout(-1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const auto customBrowserSet = settings->customBrowserSupport();
|
||||||
|
m_ui->customBrowserSupport->setChecked(customBrowserSet);
|
||||||
|
m_ui->customBrowserGroupBox->setEnabled(customBrowserSet);
|
||||||
|
m_ui->browserTypeComboBox->clear();
|
||||||
|
m_ui->browserTypeComboBox->addItem(tr("Firefox"), BrowserShared::SupportedBrowsers::FIREFOX);
|
||||||
|
m_ui->browserTypeComboBox->addItem(tr("Chromium"), BrowserShared::SupportedBrowsers::CHROMIUM);
|
||||||
|
auto typeIndex = m_ui->browserTypeComboBox->findData(settings->customBrowserType());
|
||||||
|
if (typeIndex >= 0) {
|
||||||
|
m_ui->browserTypeComboBox->setCurrentIndex(typeIndex);
|
||||||
|
}
|
||||||
|
m_ui->customBrowserLocation->setText(settings->customBrowserLocation());
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
m_ui->customExtensionId->setText(settings->customExtensionId());
|
m_ui->customExtensionId->setText(settings->customExtensionId());
|
||||||
#endif
|
#endif
|
||||||
@ -211,6 +238,18 @@ void BrowserSettingsWidget::saveSettings()
|
|||||||
settings->setBrowserSupport(BrowserShared::BRAVE, m_ui->braveSupport->isChecked());
|
settings->setBrowserSupport(BrowserShared::BRAVE, m_ui->braveSupport->isChecked());
|
||||||
settings->setBrowserSupport(BrowserShared::VIVALDI, m_ui->vivaldiSupport->isChecked());
|
settings->setBrowserSupport(BrowserShared::VIVALDI, m_ui->vivaldiSupport->isChecked());
|
||||||
settings->setBrowserSupport(BrowserShared::TOR_BROWSER, m_ui->torBrowserSupport->isChecked());
|
settings->setBrowserSupport(BrowserShared::TOR_BROWSER, m_ui->torBrowserSupport->isChecked());
|
||||||
|
|
||||||
|
// Custom browser settings
|
||||||
|
bool customBrowserEnabled = m_ui->customBrowserSupport->isChecked();
|
||||||
|
settings->setCustomBrowserType(m_ui->browserTypeComboBox->currentData().toInt());
|
||||||
|
settings->setCustomBrowserLocation(m_ui->customBrowserLocation->text());
|
||||||
|
settings->setCustomBrowserSupport(customBrowserEnabled);
|
||||||
|
settings->setBrowserSupport(BrowserShared::CUSTOM, customBrowserEnabled);
|
||||||
|
|
||||||
|
// If we disabled the custom browser support make sure to clear variables
|
||||||
|
if (!customBrowserEnabled) {
|
||||||
|
settings->setCustomBrowserLocation("");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,3 +267,13 @@ void BrowserSettingsWidget::showProxyLocationFileDialog()
|
|||||||
m_ui->customProxyLocation->setText(proxyLocation);
|
m_ui->customProxyLocation->setText(proxyLocation);
|
||||||
validateCustomProxyLocation();
|
validateCustomProxyLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BrowserSettingsWidget::showCustomBrowserLocationFileDialog()
|
||||||
|
{
|
||||||
|
auto location = QFileDialog::getExistingDirectory(this,
|
||||||
|
tr("Select native messaging host folder location"),
|
||||||
|
QFileInfo(QCoreApplication::applicationDirPath()).filePath());
|
||||||
|
if (!location.isEmpty()) {
|
||||||
|
m_ui->customBrowserLocation->setText(location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -42,6 +42,7 @@ public slots:
|
|||||||
private slots:
|
private slots:
|
||||||
void showProxyLocationFileDialog();
|
void showProxyLocationFileDialog();
|
||||||
void validateCustomProxyLocation();
|
void validateCustomProxyLocation();
|
||||||
|
void showCustomBrowserLocationFileDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::BrowserSettingsWidget> m_ui;
|
QScopedPointer<Ui::BrowserSettingsWidget> m_ui;
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>523</width>
|
<width>584</width>
|
||||||
<height>456</height>
|
<height>467</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -84,23 +84,20 @@
|
|||||||
<property name="horizontalSpacing">
|
<property name="horizontalSpacing">
|
||||||
<number>40</number>
|
<number>40</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="3">
|
<item row="1" column="1">
|
||||||
<spacer name="horizontalSpacer">
|
<widget class="QCheckBox" name="vivaldiSupport">
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>179</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QCheckBox" name="chromeSupport">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Google Chrome</string>
|
<string>Vivaldi</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QCheckBox" name="edgeSupport">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Edge</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -117,26 +114,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QCheckBox" name="chromiumSupport">
|
|
||||||
<property name="text">
|
|
||||||
<string>Chromium</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QCheckBox" name="vivaldiSupport">
|
|
||||||
<property name="text">
|
|
||||||
<string>Vivaldi</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QCheckBox" name="torBrowserSupport">
|
<widget class="QCheckBox" name="torBrowserSupport">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -157,16 +134,39 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3">
|
<item row="0" column="0">
|
||||||
<widget class="QCheckBox" name="edgeSupport">
|
<widget class="QCheckBox" name="chromeSupport">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Edge</string>
|
<string>Google Chrome</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCheckBox" name="chromiumSupport">
|
||||||
|
<property name="text">
|
||||||
|
<string>Chromium</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="4">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -236,6 +236,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="searchInAllDatabases">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>All databases connected to the extension will return matching credentials.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string extracomment="Credentials mean login data requested via browser extension">Search in all opened databases for matching credentials</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="sortByTitle">
|
<widget class="QRadioButton" name="sortByTitle">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -301,16 +311,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="searchInAllDatabases">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>All databases connected to the extension will return matching credentials.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string extracomment="Credentials mean login data requested via browser extension">Search in all opened databases for matching credentials</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="supportKphFields">
|
<widget class="QCheckBox" name="supportKphFields">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -347,14 +347,42 @@
|
|||||||
<string>Use a custom proxy location if you installed a proxy manually.</string>
|
<string>Use a custom proxy location if you installed a proxy manually.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string comment="Meant is the proxy for KeePassXC-Browser">Use a custom proxy location</string>
|
<string comment="Meant is the proxy for KeePassXC-Browser">Use a custom proxy location:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>15</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="customProxyLocation">
|
<widget class="QLineEdit" name="customProxyLocation">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>450</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="accessibleName">
|
<property name="accessibleName">
|
||||||
<string>Custom proxy location field</string>
|
<string>Custom proxy location field</string>
|
||||||
</property>
|
</property>
|
||||||
@ -376,34 +404,203 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="customExtensionBox">
|
<widget class="QCheckBox" name="customBrowserSupport">
|
||||||
<property name="topMargin">
|
<property name="text">
|
||||||
<number>20</number>
|
<string>Use a custom browser configuration location:</string>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<property name="checked">
|
||||||
<widget class="QLabel" name="customExtensionLabel">
|
<bool>false</bool>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Custom extension ID:</string>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item>
|
||||||
</item>
|
<widget class="QGroupBox" name="customBrowserGroupBox">
|
||||||
<item>
|
<property name="title">
|
||||||
<widget class="QLineEdit" name="customExtensionId">
|
<string/>
|
||||||
<property name="accessibleName">
|
</property>
|
||||||
<string>Custom extension ID</string>
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
</property>
|
<item>
|
||||||
<property name="maxLength">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<number>999</number>
|
<item>
|
||||||
</property>
|
<widget class="QLabel" name="customBrowserLabel">
|
||||||
<property name="alignment">
|
<property name="sizePolicy">
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
</property>
|
<horstretch>0</horstretch>
|
||||||
</widget>
|
<verstretch>0</verstretch>
|
||||||
</item>
|
</sizepolicy>
|
||||||
</layout>
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">margin-right: 5px</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Browser type:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="browserTypeComboBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="accessibleName">
|
||||||
|
<string>Toolbar button style</string>
|
||||||
|
</property>
|
||||||
|
<property name="sizeAdjustPolicy">
|
||||||
|
<enum>QComboBox::AdjustToContents</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="customBrowserLabel_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">margin-right: 5px</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Config Location:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="customBrowserLocation">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>350</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="accessibleName">
|
||||||
|
<string>Custom browser location field</string>
|
||||||
|
</property>
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>999</number>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>~/.custom/config/Mozilla/native-messaging-hosts/</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="customBrowserLocationBrowseButton">
|
||||||
|
<property name="accessibleName">
|
||||||
|
<string>Browse for custom browser path</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string extracomment="Button for opening file dialog">Browse...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="customExtensionIdContainer" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="customExtensionBox" stretch="0,0,1">
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="customExtensionLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Custom extension ID:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="customExtensionId">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>250</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="accessibleName">
|
||||||
|
<string>Custom extension ID</string>
|
||||||
|
</property>
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>999</number>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_5">
|
<spacer name="verticalSpacer_5">
|
||||||
|
@ -33,6 +33,7 @@ namespace BrowserShared
|
|||||||
TOR_BROWSER,
|
TOR_BROWSER,
|
||||||
BRAVE,
|
BRAVE,
|
||||||
EDGE,
|
EDGE,
|
||||||
|
CUSTOM,
|
||||||
MAX_SUPPORTED
|
MAX_SUPPORTED
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ void NativeMessageInstaller::setBrowserEnabled(SupportedBrowsers browser, bool e
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Remove the script file
|
// Remove the script file
|
||||||
QString fileName = getNativeMessagePath(browser);
|
const QString fileName = getNativeMessagePath(browser);
|
||||||
QFile::remove(fileName);
|
QFile::remove(fileName);
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
// Remove the registry entry
|
// Remove the registry entry
|
||||||
@ -159,6 +159,8 @@ QString NativeMessageInstaller::getTargetPath(SupportedBrowsers browser) const
|
|||||||
return TARGET_DIR_BRAVE;
|
return TARGET_DIR_BRAVE;
|
||||||
case SupportedBrowsers::EDGE:
|
case SupportedBrowsers::EDGE:
|
||||||
return TARGET_DIR_EDGE;
|
return TARGET_DIR_EDGE;
|
||||||
|
case SupportedBrowsers::CUSTOM:
|
||||||
|
return browserSettings()->customBrowserLocation();
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -188,6 +190,8 @@ QString NativeMessageInstaller::getBrowserName(SupportedBrowsers browser) const
|
|||||||
return QStringLiteral("brave");
|
return QStringLiteral("brave");
|
||||||
case SupportedBrowsers::EDGE:
|
case SupportedBrowsers::EDGE:
|
||||||
return QStringLiteral("edge");
|
return QStringLiteral("edge");
|
||||||
|
case SupportedBrowsers::CUSTOM:
|
||||||
|
return QStringLiteral("custom");
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -223,6 +227,10 @@ QString NativeMessageInstaller::getNativeMessagePath(SupportedBrowsers browser)
|
|||||||
#else
|
#else
|
||||||
basePath = QDir::homePath();
|
basePath = QDir::homePath();
|
||||||
#endif
|
#endif
|
||||||
|
if (browser == SupportedBrowsers::CUSTOM) {
|
||||||
|
return QString("%1/%2.json").arg(getTargetPath(browser), HOST_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
return QStringLiteral("%1%2/%3.json").arg(basePath, getTargetPath(browser), HOST_NAME);
|
return QStringLiteral("%1%2/%3.json").arg(basePath, getTargetPath(browser), HOST_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +275,9 @@ QJsonObject NativeMessageInstaller::constructFile(SupportedBrowsers browser)
|
|||||||
script["type"] = QStringLiteral("stdio");
|
script["type"] = QStringLiteral("stdio");
|
||||||
|
|
||||||
QJsonArray arr;
|
QJsonArray arr;
|
||||||
if (browser == SupportedBrowsers::FIREFOX || browser == SupportedBrowsers::TOR_BROWSER) {
|
if (browser == SupportedBrowsers::FIREFOX || browser == SupportedBrowsers::TOR_BROWSER
|
||||||
|
|| (browser == SupportedBrowsers::CUSTOM
|
||||||
|
&& browserSettings()->customBrowserType() == SupportedBrowsers::FIREFOX)) {
|
||||||
for (const QString& extension : ALLOWED_EXTENSIONS) {
|
for (const QString& extension : ALLOWED_EXTENSIONS) {
|
||||||
arr.append(extension);
|
arr.append(extension);
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,9 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
|||||||
{Config::Browser_SearchInAllDatabases, {QS("Browser/SearchInAllDatabases"), Roaming, false}},
|
{Config::Browser_SearchInAllDatabases, {QS("Browser/SearchInAllDatabases"), Roaming, false}},
|
||||||
{Config::Browser_SupportKphFields, {QS("Browser/SupportKphFields"), Roaming, true}},
|
{Config::Browser_SupportKphFields, {QS("Browser/SupportKphFields"), Roaming, true}},
|
||||||
{Config::Browser_NoMigrationPrompt, {QS("Browser/NoMigrationPrompt"), Roaming, false}},
|
{Config::Browser_NoMigrationPrompt, {QS("Browser/NoMigrationPrompt"), Roaming, false}},
|
||||||
|
{Config::Browser_UseCustomBrowser, {QS("Browser/UseCustomBrowser"), Local, false}},
|
||||||
|
{Config::Browser_CustomBrowserType, {QS("Browser/CustomBrowserType"), Local, -1}},
|
||||||
|
{Config::Browser_CustomBrowserLocation, {QS("Browser/CustomBrowserLocation"), Local, {}}},
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
{Config::Browser_CustomExtensionId, {QS("Browser/CustomExtensionId"), Local, {}}},
|
{Config::Browser_CustomExtensionId, {QS("Browser/CustomExtensionId"), Local, {}}},
|
||||||
#endif
|
#endif
|
||||||
|
@ -133,6 +133,9 @@ public:
|
|||||||
Browser_SearchInAllDatabases,
|
Browser_SearchInAllDatabases,
|
||||||
Browser_SupportKphFields,
|
Browser_SupportKphFields,
|
||||||
Browser_NoMigrationPrompt,
|
Browser_NoMigrationPrompt,
|
||||||
|
Browser_UseCustomBrowser,
|
||||||
|
Browser_CustomBrowserType,
|
||||||
|
Browser_CustomBrowserLocation,
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
Browser_CustomExtensionId,
|
Browser_CustomExtensionId,
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user