diff --git a/src/lib/navigation/goicon.cpp b/src/lib/navigation/goicon.cpp index cfcb04a97..fa7a6449a 100644 --- a/src/lib/navigation/goicon.cpp +++ b/src/lib/navigation/goicon.cpp @@ -24,7 +24,6 @@ GoIcon::GoIcon(QWidget* parent) { setObjectName("locationbar-goicon"); setCursor(Qt::PointingHandCursor); - setHidden(true); } void GoIcon::contextMenuEvent(QContextMenuEvent* ev) diff --git a/src/lib/navigation/locationbar.cpp b/src/lib/navigation/locationbar.cpp index f7580478b..d32d08b95 100644 --- a/src/lib/navigation/locationbar.cpp +++ b/src/lib/navigation/locationbar.cpp @@ -56,7 +56,6 @@ LocationBar::LocationBar(QupZilla* mainClass) , m_progressVisible(false) , m_forcePaintEvent(false) , m_inlineCompletionVisible(false) - , m_drawCursor(true) , m_popupClosed(false) { setObjectName("locationbar"); @@ -77,9 +76,9 @@ LocationBar::LocationBar(QupZilla* mainClass) addWidget(m_siteIcon, LineEdit::LeftSide); addWidget(m_autofillIcon, LineEdit::RightSide); - addWidget(m_goIcon, LineEdit::RightSide); addWidget(m_bookmarkIcon, LineEdit::RightSide); addWidget(m_rssIcon, LineEdit::RightSide); + addWidget(m_goIcon, LineEdit::RightSide); addWidget(down, LineEdit::RightSide); m_completer.setLocationBar(this); @@ -100,7 +99,7 @@ LocationBar::LocationBar(QupZilla* mainClass) updatePlaceHolderText(); // Hide icons by default - m_goIcon->hide(); + hideGoButton(); m_rssIcon->hide(); m_autofillIcon->hide(); } @@ -148,7 +147,6 @@ void LocationBar::completionPopupClosed() { m_inlineCompletionVisible = false; m_popupClosed = true; - m_drawCursor = true; } QUrl LocationBar::createUrl() @@ -220,20 +218,11 @@ void LocationBar::textEdit() m_completer.closePopup(); } - // Decide whether to draw cursor - if (text().length() <= 1 && m_drawCursor && !m_popupClosed) { - m_drawCursor = false; - } - showGoButton(); } void LocationBar::showGoButton() { - if (m_goIcon->isVisible()) { - return; - } - m_rssIconVisible = m_rssIcon->isVisible(); m_bookmarkIcon->hide(); @@ -245,13 +234,12 @@ void LocationBar::showGoButton() void LocationBar::hideGoButton() { - if (!m_goIcon->isVisible()) { - return; - } - m_rssIcon->setVisible(m_rssIconVisible); m_bookmarkIcon->show(); - m_goIcon->hide(); + + if (!qzSettings->alwaysShowGoIcon) { + m_goIcon->hide(); + } updateTextMargins(); } diff --git a/src/lib/navigation/locationbar.h b/src/lib/navigation/locationbar.h index e9bffa97a..e22c65725 100644 --- a/src/lib/navigation/locationbar.h +++ b/src/lib/navigation/locationbar.h @@ -126,7 +126,6 @@ private: bool m_forcePaintEvent; bool m_inlineCompletionVisible; - bool m_drawCursor; bool m_popupClosed; }; diff --git a/src/lib/other/qzsettings.cpp b/src/lib/other/qzsettings.cpp index 82b0ad52f..6c4c24df1 100644 --- a/src/lib/other/qzsettings.cpp +++ b/src/lib/other/qzsettings.cpp @@ -33,6 +33,7 @@ void QzSettings::loadSettings() showLoadingProgress = settings.value("ShowLoadingProgress", false).toBool(); showLocationSuggestions = settings.value("showSuggestions", 0).toInt(); showSwitchTab = settings.value("showSwitchTab", true).toBool(); + alwaysShowGoIcon = settings.value("alwaysShowGoIcon", false).toBool(); settings.endGroup(); settings.beginGroup("SearchEngines"); diff --git a/src/lib/other/qzsettings.h b/src/lib/other/qzsettings.h index f517fa157..ff0953ee4 100644 --- a/src/lib/other/qzsettings.h +++ b/src/lib/other/qzsettings.h @@ -38,6 +38,7 @@ public: bool showLoadingProgress; int showLocationSuggestions; bool showSwitchTab; + bool alwaysShowGoIcon; // SearchEngines bool showSearchSuggestions; diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index e7c1db405..b7936c7b7 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -221,6 +221,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) settings.beginGroup("AddressBar"); ui->addressbarCompletion->setCurrentIndex(settings.value("showSuggestions", 0).toInt()); ui->completionShowSwitchTab->setChecked(settings.value("showSwitchTab", true).toBool()); + ui->alwaysShowGoIcon->setChecked(settings.value("alwaysShowGoIcon", false).toBool()); ui->selectAllOnFocus->setChecked(settings.value("SelectAllTextOnDoubleClick", true).toBool()); ui->selectAllOnClick->setChecked(settings.value("SelectAllTextOnClick", false).toBool()); ui->addCountryWithAlt->setChecked(settings.value("AddCountryDomainWithAltKey", true).toBool()); @@ -971,6 +972,7 @@ void Preferences::saveSettings() //AddressBar settings.beginGroup("AddressBar"); settings.setValue("showSuggestions", ui->addressbarCompletion->currentIndex()); + settings.setValue("alwaysShowGoIcon", ui->alwaysShowGoIcon->isChecked()); settings.setValue("showSwitchTab", ui->completionShowSwitchTab->isChecked()); settings.setValue("SelectAllTextOnDoubleClick", ui->selectAllOnFocus->isChecked()); settings.setValue("SelectAllTextOnClick", ui->selectAllOnClick->isChecked()); diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui index 374a95d32..de3f37892 100644 --- a/src/lib/preferences/preferences.ui +++ b/src/lib/preferences/preferences.ui @@ -140,8 +140,8 @@ 0 0 - 602 - 469 + 608 + 485 @@ -843,6 +843,13 @@ + + + + Always show go icon + + +