]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/mainview.cpp
Create a home icon.
[PrivacyBrowserPC.git] / src / mainview.cpp
index 8749760773e6acdd9540a236855ad761d805a6e2..25f3b4c5ea0d1b6f39de2439abea2bff200d58f3 100644 (file)
@@ -41,6 +41,7 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     // Get handles for the views.
     backButtonPointer = mainViewUi.backButton;
     forwardButtonPointer = mainViewUi.forwardButton;
+    QPushButton *homeButtonPointer = mainViewUi.homeButton;
     urlLineEditPointer = mainViewUi.urlLineEdit;
     webEngineViewPointer = mainViewUi.webEngineView;
 
@@ -56,9 +57,10 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     connect(webEngineViewPointer, SIGNAL(loadProgress(int)), this, SLOT(updateInterface()));
     connect(webEngineViewPointer, SIGNAL(loadFinished(bool)), this, SLOT(updateInterface()));
 
-    // Setup the forward and back buttons.
+    // Setup the URL bar buttons.
     connect(backButtonPointer, SIGNAL(clicked()), webEngineViewPointer, SLOT(back()));
     connect(forwardButtonPointer, SIGNAL(clicked()), webEngineViewPointer, SLOT(forward()));
+    connect(homeButtonPointer, SIGNAL(clicked()), this, SLOT(goHome()));
 
     // Instantiate the mouse event pointer.
     MouseEventFilter *mouseEventFilterPointer = new MouseEventFilter(webEngineViewPointer);
@@ -75,6 +77,12 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     // Set the focus on the WebEngine view.
     webEngineViewPointer->setFocus();
 
+    // Load the homepage.
+    goHome();
+}
+
+void MainView::goHome()
+{
     // Load the homepage.  TODO.  Consider sanitizing the homepage input and adding things like protocols if they are missing.
     webEngineViewPointer->setUrl(Settings::homepage());
 }