// Get handles for the views.
backButtonPointer = mainViewUi.backButton;
forwardButtonPointer = mainViewUi.forwardButton;
+ QPushButton *homeButtonPointer = mainViewUi.homeButton;
urlLineEditPointer = mainViewUi.urlLineEdit;
webEngineViewPointer = mainViewUi.webEngineView;
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);
// 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());
}
<number>0</number>
</property>
+ <!-- The back button. -->
<item>
<widget class="QPushButton" name="backButton">
<property name="icon">
<property name="iconSize">
<size>
- <width>24</width>
<height>24</height>
+ <width>24</width>
</size>
</property>
</widget>
</item>
+ <!-- The forward button. -->
<item>
<widget class="QPushButton" name="forwardButton">
<property name="icon">
<property name="iconSize">
<size>
+ <height>24</height>
<width>24</width>
+ </size>
+ </property>
+
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+
+ <!-- The home button. -->
+ <item>
+ <widget class="QPushButton" name="homeButton">
+ <property name="icon">
+ <iconset theme="home" />
+ </property>
+
+ <property name="iconSize">
+ <size>
<height>24</height>
+ <width>24</width>
</size>
</property>
</widget>
</item>
+ <!-- The URL line edit.-->
<item>
<widget class="KLineEdit" name="urlLineEdit" />
</item>
</layout>
</item>
+ <!-- The WebEngine view. -->
<item>
<widget class="QWebEngineView" name="webEngineView" />
</item>