File indexing completed on 2024-05-12 04:58:12
0001 /* ============================================================ 0002 * Falkon - Qt web browser 0003 * Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com> 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 * ============================================================ */ 0018 #include "qzsettings.h" 0019 #include "webview.h" 0020 0021 QzSettings::QzSettings() 0022 { 0023 loadSettings(); 0024 } 0025 0026 void QzSettings::loadSettings() 0027 { 0028 Settings settings; 0029 settings.beginGroup(QSL("AddressBar")); 0030 selectAllOnDoubleClick = settings.value(QSL("SelectAllTextOnDoubleClick"), true).toBool(); 0031 selectAllOnClick = settings.value(QSL("SelectAllTextOnClick"), false).toBool(); 0032 showLoadingProgress = settings.value(QSL("ShowLoadingProgress"), false).toBool(); 0033 showLocationSuggestions = settings.value(QSL("showSuggestions"), 0).toInt(); 0034 showSwitchTab = settings.value(QSL("showSwitchTab"), true).toBool(); 0035 alwaysShowGoIcon = settings.value(QSL("alwaysShowGoIcon"), false).toBool(); 0036 useInlineCompletion = settings.value(QSL("useInlineCompletion"), true).toBool(); 0037 showZoomLabel = settings.value(QSL("showZoomLabel"), true).toBool(); 0038 completionPopupExpandToWindow = settings.value(QSL("CompletionPopupExpandToWindow"), false).toBool(); 0039 settings.endGroup(); 0040 0041 settings.beginGroup(QSL("SearchEngines")); 0042 searchOnEngineChange = settings.value(QSL("SearchOnEngineChange"), true).toBool(); 0043 searchFromAddressBar = settings.value(QSL("SearchFromAddressBar"), true).toBool(); 0044 searchWithDefaultEngine = settings.value(QSL("SearchWithDefaultEngine"), true).toBool(); 0045 showABSearchSuggestions = settings.value(QSL("showSearchSuggestions"), true).toBool(); 0046 showWSBSearchSuggestions = settings.value(QSL("showSuggestions"), true).toBool(); 0047 settings.endGroup(); 0048 0049 settings.beginGroup(QSL("Web-Browser-Settings")); 0050 defaultZoomLevel = settings.value(QSL("DefaultZoomLevel"), WebView::zoomLevels().indexOf(100)).toInt(); 0051 loadTabsOnActivation = settings.value(QSL("LoadTabsOnActivation"), true).toBool(); 0052 autoOpenProtocols = settings.value(QSL("AutomaticallyOpenProtocols"), QStringList()).toStringList(); 0053 blockedProtocols = settings.value(QSL("BlockOpeningProtocols"), QStringList()).toStringList(); 0054 allowedSchemes = settings.value(QSL("AllowedSchemes"), QStringList()).toStringList(); 0055 blockedSchemes = settings.value(QSL("BlockedSchemes"), QStringList()).toStringList(); 0056 settings.endGroup(); 0057 0058 settings.beginGroup(QSL("Browser-Tabs-Settings")); 0059 newTabPosition = settings.value(QSL("OpenNewTabsSelected"), false).toBool() ? Qz::NT_CleanSelectedTab : Qz::NT_CleanNotSelectedTab; 0060 tabsOnTop = settings.value(QSL("TabsOnTop"), true).toBool(); 0061 openPopupsInTabs = settings.value(QSL("OpenPopupsInTabs"), false).toBool(); 0062 alwaysSwitchTabsWithWheel = settings.value(QSL("AlwaysSwitchTabsWithWheel"), false).toBool(); 0063 settings.endGroup(); 0064 } 0065 0066 void QzSettings::saveSettings() 0067 { 0068 Settings settings; 0069 settings.beginGroup(QSL("Web-Browser-Settings")); 0070 settings.setValue(QSL("AutomaticallyOpenProtocols"), autoOpenProtocols); 0071 settings.setValue(QSL("BlockOpeningProtocols"), blockedProtocols); 0072 settings.endGroup(); 0073 0074 settings.beginGroup(QSL("Browser-Tabs-Settings")); 0075 settings.setValue(QSL("TabsOnTop"), tabsOnTop); 0076 settings.endGroup(); 0077 }