mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
LocationBar settings will now be loaded from settings file only once,
not with each new webtab
This commit is contained in:
parent
b49a133bbe
commit
a63dc4c317
@ -122,7 +122,8 @@ SOURCES += main.cpp\
|
||||
tools/widget.cpp \
|
||||
3rdparty/squeezelabelv2.cpp \
|
||||
3rdparty/squeezelabelv1.cpp \
|
||||
tools/buttonwithmenu.cpp
|
||||
tools/buttonwithmenu.cpp \
|
||||
navigation/locationbarsettings.cpp
|
||||
|
||||
HEADERS += \
|
||||
3rdparty/qtwin.h \
|
||||
@ -205,7 +206,8 @@ HEADERS += \
|
||||
tools/widget.h \
|
||||
3rdparty/squeezelabelv2.h \
|
||||
3rdparty/squeezelabelv1.h \
|
||||
tools/buttonwithmenu.h
|
||||
tools/buttonwithmenu.h \
|
||||
navigation/locationbarsettings.h
|
||||
|
||||
FORMS += \
|
||||
preferences/autofillmanager.ui \
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
enum MessageType{ SetAdBlockIconEnabled, CheckPrivateBrowsing , ReloadSettings };
|
||||
|
||||
void loadSettings();
|
||||
void reloadSettings() { emit message(ReloadSettings, true); }
|
||||
void reloadSettings() { loadSettings(); emit message(ReloadSettings, true); }
|
||||
bool restoreStateSlot(QupZilla* window);
|
||||
void makeNewWindow(bool tryRestore, const QUrl &startUrl=QUrl());
|
||||
void addNewTab(const QUrl &url = QUrl());
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "adblockicon.h"
|
||||
#include "closedtabsmanager.h"
|
||||
#include "statusbarmessage.h"
|
||||
#include "locationbarsettings.h"
|
||||
|
||||
const QString QupZilla::VERSION = "1.0.0-b3";
|
||||
//const QString QupZilla::BUILDTIME = QLocale(QLocale::English).toDateTime(__DATE__" "__TIME__, "MMM d yyyy hh:mm:ss").toString("MM/dd/yyyy hh:ss");
|
||||
@ -499,7 +500,7 @@ void QupZilla::receiveMessage(MainApplication::MessageType mes, bool state)
|
||||
case MainApplication::ReloadSettings:
|
||||
loadSettings();
|
||||
m_tabWidget->loadSettings();
|
||||
// m_locationBar->loadSettings();
|
||||
LocationBarSettings::instance()->loadSettings();
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -934,15 +935,12 @@ void QupZilla::showBookmarksToolbar()
|
||||
|
||||
void QupZilla::showBookmarksSideBar()
|
||||
{
|
||||
bool saveToSettings = false;
|
||||
if (!m_sideBar) {
|
||||
m_sideBar = new SideBar(this);
|
||||
addDockWidget(Qt::LeftDockWidgetArea, m_sideBar);
|
||||
m_sideBar->showBookmarks();
|
||||
saveToSettings = true;
|
||||
} else if (m_actionShowBookmarksSideBar->isChecked()){
|
||||
m_sideBar->showBookmarks();
|
||||
saveToSettings = true;
|
||||
} else {
|
||||
m_sideBar->close();
|
||||
}
|
||||
|
@ -28,14 +28,13 @@
|
||||
#include "bookmarkicon.h"
|
||||
#include "progressbar.h"
|
||||
#include "statusbarmessage.h"
|
||||
#include "locationbarsettings.h"
|
||||
|
||||
LocationBar::LocationBar(QupZilla* mainClass)
|
||||
: LineEdit()
|
||||
,m_selectAllOnDoubleClick(false)
|
||||
,m_addComWithCtrl(false)
|
||||
,m_addCountryWithAlt(false)
|
||||
,p_QupZilla(mainClass)
|
||||
,m_webView(0)
|
||||
,m_locationBarSettings(LocationBarSettings::instance())
|
||||
{
|
||||
m_siteIcon = new QToolButton(this);
|
||||
m_siteIcon->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
@ -76,7 +75,6 @@ LocationBar::LocationBar(QupZilla* mainClass)
|
||||
setWidgetSpacing(0);
|
||||
this->setMinimumHeight(25);
|
||||
this->setMaximumHeight(25);
|
||||
loadSettings();
|
||||
|
||||
m_locationCompleter = new LocationCompleter();
|
||||
setCompleter(m_locationCompleter);
|
||||
@ -97,15 +95,6 @@ LocationBar::LocationBar(QupZilla* mainClass)
|
||||
// setLeftMargin(m_siteIcon->sizeHint().width()+1);
|
||||
}
|
||||
|
||||
void LocationBar::loadSettings()
|
||||
{
|
||||
QSettings settings(p_QupZilla->activeProfil()+"settings.ini", QSettings::IniFormat);
|
||||
settings.beginGroup("AddressBar");
|
||||
m_selectAllOnDoubleClick = settings.value("SelectAllTextOnDoubleClick",true).toBool();
|
||||
m_addComWithCtrl = settings.value("AddComDomainWithCtrlKey",false).toBool();
|
||||
m_addCountryWithAlt = settings.value("AddCountryDomainWithAltKey",true).toBool();
|
||||
}
|
||||
|
||||
void LocationBar::urlEnter()
|
||||
{
|
||||
m_webView->setFocus();
|
||||
@ -263,7 +252,7 @@ void LocationBar::dropEvent(QDropEvent* event)
|
||||
|
||||
void LocationBar::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && m_selectAllOnDoubleClick)
|
||||
if (event->button() == Qt::LeftButton && m_locationBarSettings->selectAllOnDoubleClick)
|
||||
selectAll();
|
||||
else
|
||||
QLineEdit::mouseDoubleClickEvent(event);
|
||||
@ -278,9 +267,9 @@ void LocationBar::keyPressEvent(QKeyEvent *event)
|
||||
}
|
||||
|
||||
QString localDomain = tr(".co.uk","Append domain name on ALT key = Should be different for every country");
|
||||
if (event->key() == Qt::Key_Control && m_addComWithCtrl && !text().endsWith(".com")) //Disabled for a while
|
||||
if (event->key() == Qt::Key_Control && m_locationBarSettings->addComWithCtrl && !text().endsWith(".com")) //Disabled for a while
|
||||
setText(text().append(".com"));
|
||||
if (event->key() == Qt::Key_Alt && m_addCountryWithAlt && !text().endsWith(localDomain) && !text().endsWith("/"))
|
||||
if (event->key() == Qt::Key_Alt && m_locationBarSettings->addCountryWithAlt && !text().endsWith(localDomain) && !text().endsWith("/"))
|
||||
setText(text().append(localDomain));
|
||||
|
||||
QLineEdit::keyPressEvent(event);
|
||||
|
@ -38,6 +38,7 @@ class LocationCompleter;
|
||||
class ClickableLabel;
|
||||
class BookmarkIcon;
|
||||
class WebView;
|
||||
class LocationBarSettings;
|
||||
class LocationBar : public LineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -47,8 +48,6 @@ public:
|
||||
|
||||
void setWebView(WebView* view) { m_webView = view; }
|
||||
|
||||
void loadSettings();
|
||||
|
||||
public slots:
|
||||
void showUrl(const QUrl &url, bool empty = true);
|
||||
|
||||
@ -77,12 +76,10 @@ private:
|
||||
ClickableLabel* m_rssIcon;
|
||||
QToolButton* m_siteIcon;
|
||||
|
||||
bool m_selectAllOnDoubleClick;
|
||||
bool m_addComWithCtrl;
|
||||
bool m_addCountryWithAlt;
|
||||
QupZilla* p_QupZilla;
|
||||
WebView* m_webView;
|
||||
LocationCompleter* m_locationCompleter;
|
||||
LocationBarSettings* m_locationBarSettings;
|
||||
|
||||
bool m_rssIconVisible;
|
||||
};
|
||||
|
28
src/navigation/locationbarsettings.cpp
Normal file
28
src/navigation/locationbarsettings.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "locationbarsettings.h"
|
||||
#include "mainapplication.h"
|
||||
|
||||
LocationBarSettings* LocationBarSettings::s_instance = 0;
|
||||
bool LocationBarSettings::selectAllOnDoubleClick = false;
|
||||
bool LocationBarSettings::addComWithCtrl = false;
|
||||
bool LocationBarSettings::addCountryWithAlt = false;
|
||||
|
||||
LocationBarSettings::LocationBarSettings()
|
||||
{
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
LocationBarSettings* LocationBarSettings::instance()
|
||||
{
|
||||
if (!s_instance)
|
||||
s_instance = new LocationBarSettings();
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
void LocationBarSettings::loadSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat);
|
||||
settings.beginGroup("AddressBar");
|
||||
selectAllOnDoubleClick = settings.value("SelectAllTextOnDoubleClick",true).toBool();
|
||||
addComWithCtrl = settings.value("AddComDomainWithCtrlKey",false).toBool();
|
||||
addCountryWithAlt = settings.value("AddCountryDomainWithAltKey",true).toBool();
|
||||
}
|
22
src/navigation/locationbarsettings.h
Normal file
22
src/navigation/locationbarsettings.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef LOCATIONBARSETTINGS_H
|
||||
#define LOCATIONBARSETTINGS_H
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
class LocationBarSettings
|
||||
{
|
||||
public:
|
||||
LocationBarSettings();
|
||||
|
||||
static LocationBarSettings* instance();
|
||||
|
||||
static void loadSettings();
|
||||
static bool selectAllOnDoubleClick;
|
||||
static bool addComWithCtrl;
|
||||
static bool addCountryWithAlt;
|
||||
|
||||
private:
|
||||
static LocationBarSettings* s_instance;
|
||||
};
|
||||
|
||||
#endif // LOCATIONBARSETTINGS_H
|
@ -722,10 +722,9 @@ void Preferences::saveSettings()
|
||||
m_pluginsList->save();
|
||||
mApp->cookieJar()->loadSettings();
|
||||
mApp->history()->loadSettings();
|
||||
mApp->loadSettings();
|
||||
mApp->reloadSettings();
|
||||
mApp->plugins()->c2f_saveSettings();
|
||||
mApp->networkManager()->loadSettings();
|
||||
mApp->reloadSettings();
|
||||
mApp->desktopNotifications()->loadSettings();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user