]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/commitdiff
Add a homepage setting.
authorSoren Stoutner <soren@stoutner.com>
Sun, 30 Jan 2022 04:13:42 +0000 (21:13 -0700)
committerSoren Stoutner <soren@stoutner.com>
Sun, 30 Jan 2022 04:13:42 +0000 (21:13 -0700)
src/mainview.cpp
src/settings.kcfg
src/settings.ui

index b1adcbf2dc49f66c6796fb18a5e8a520c159e572..5c596624d3a130192f6aae13eea3363d07ac2c07 100644 (file)
@@ -60,12 +60,15 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     // Set the focus on the WebEngine view.
     webEngineViewPointer->setFocus();
 
-    // Load a website.
-    webEngineViewPointer->setUrl(QUrl(QStringLiteral("https://www.stoutner.com/")));
+    // Load the homepage.  TODO.  Consider sanitizing the homepage input and adding things like protocols if they are missing.
+    webEngineViewPointer->setUrl(Settings::homepage());
 }
 
 void MainView::loadUrl(const QString &urlFromUser)
 {
+    // Remove the focus from the URL line edit.
+    urlLineEditPointer->clearFocus();
+
     // Load the URL, adding standard protocol sections if needed.  TODO.  Replace this with logic that prefers HTTPS.
     webEngineViewPointer->setUrl(QUrl::fromUserInput(urlFromUser));
 }
index 7ef17aa73a3969de2f9b45e801ad9a3b1e6c57f0..d4c5ffda7456fad517f1b6e0e2a47077f372848e 100644 (file)
@@ -18,6 +18,7 @@
   You should have received a copy of the GNU General Public License
   along with Privacy Browser PC.  If not, see <http://www.gnu.org/licenses/>. -->
 
+  <!-- The options are partially displayed at <https://api.kde.org/frameworks/kconfig/html/classKConfigSkeleton.html>. -->
 <kcfg
     xmlns="http://www.kde.org/standards/kcfg/1.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     <kcfgfile name="settings"/>
 
     <group name="General">
+        <entry name="homepage" type="Url">
+            <default>https://www.mojeek.com/</default>
+        </entry>
+
         <entry name="zoomFactor" type="Double">
             <default>1.00</default>
         </entry>
index 35d51b893156082bc4ab133f64cc7feb23c079cd..a6c876fee813bd18bd57673ac36b20cfd5c58dc6 100644 (file)
 
         <layout class="QFormLayout">
             <item row="0" column="0">
+                <widget class="QLabel" name="homepageLabel">
+                    <property name="text">
+                        <string>Homepage</string>
+                    </property>
+
+                    <property name="toolTip">
+                        <string>Set the hompage.</string>
+                    </property>
+
+                    <property name="whatsThis">
+                        <string>Set the homepage.  The default is https://www.mojeek.com/.</string>
+                    </property>
+                </widget>
+            </item>
+
+            <item row="0" column="1">
+                <widget class="KLineEdit" name="kcfg_homepage">
+                    <property name="toolTip">
+                        <string>Set the hompage.</string>
+                    </property>
+
+                    <property name="whatsThis">
+                        <string>Set the homepage.  The default is https://www.mojeek.com/.</string>
+                    </property>
+                </widget>
+            </item>
+
+
+            <item row="1" column="0">
                 <widget class="QLabel" name="zoomFactorLabel">
                     <property name="text">
                         <string>Zoom factor</string>
                     </property>
+
+                    <property name="toolTip">
+                        <string>Set the zoom factor between 0.25 and 5.00.</string>
+                    </property>
+
+                    <property name="whatsThis">
+                        <string>Set the zoom factor between 0.25 and 5.00.  The default is 1.00.</string>
+                    </property>
                 </widget>
             </item>
 
-            <item row="0" column="1">
+            <item row="1" column="1">
                 <widget class="QDoubleSpinBox" name="kcfg_zoomFactor">
                     <property name="toolTip">
                         <string>Set the zoom factor between 0.25 and 5.00.</string>