searchEngineYahooActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_yahoo"));
searchEngineCustomActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_custom"));
javaScriptActionPointer = actionCollectionPointer->addAction(QStringLiteral("javascript"));
+ localStorageActionPointer = actionCollectionPointer->addAction(QStringLiteral("local_storage"));
domainSettingsActionPointer = actionCollectionPointer->addAction(QStringLiteral("domain_settings"));
// Create the action groups
searchEngineBingActionPointer->setText(i18nc("Search engine", "Bing"));
searchEngineYahooActionPointer->setText(i18nc("Search engine", "Yahoo"));
javaScriptActionPointer->setText(i18nc("JavaScript button", "JavaScript"));
+ localStorageActionPointer->setText(i18nc("Local Storage Button", "Local Storage"));
domainSettingsActionPointer->setText(i18nc("Domain Settings button", "Domain Settings"));
// Set the action icons.
domainSettingsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("network-server-symbolic")));
// Update the on-the-fly menus.
- connect(browserViewPointer, SIGNAL(userAgentUpdated(QString)), this, SLOT(updateOnTheFlyUserAgent(QString)));
- connect(browserViewPointer, SIGNAL(zoomFactorUpdated(double)), this, SLOT(updateOnTheFlyZoomFactor(double)));
- connect(browserViewPointer, SIGNAL(searchEngineUpdated(QString)), this, SLOT(updateOnTheFlySearchEngine(QString)));
+ connect(browserViewPointer, SIGNAL(updateUserAgentActions(QString)), this, SLOT(updateUserAgentActions(QString)));
+ connect(browserViewPointer, SIGNAL(updateZoomFactorAction(double)), this, SLOT(updateZoomFactorAction(double)));
+ connect(browserViewPointer, SIGNAL(updateSearchEngineActions(QString)), this, SLOT(updateSearchEngineActions(QString)));
// Apply the on-the-fly settings when selected.
connect(userAgentActionGroupPointer, SIGNAL(triggered(QAction*)), browserViewPointer, SLOT(applyOnTheFlyUserAgent(QAction*)));
// Connect the URL toolbar actions.
connect(javaScriptActionPointer, SIGNAL(triggered()), this, SLOT(toggleJavaScript()));
+ connect(localStorageActionPointer, SIGNAL(triggered()), this, SLOT(toggleLocalStorage()));
connect(domainSettingsActionPointer, SIGNAL(triggered()), this, SLOT(openDomainSettings()));
// Update the URL toolbar actions.
connect(browserViewPointer, SIGNAL(updateBackAction(bool)), backActionPointer, SLOT(setEnabled(bool)));
connect(browserViewPointer, SIGNAL(updateForwardAction(bool)), forwardActionPointer, SLOT(setEnabled(bool)));
connect(browserViewPointer, SIGNAL(updateJavaScriptAction(bool)), this, SLOT(updateJavaScriptAction(bool)));
+ connect(browserViewPointer, SIGNAL(updateLocalStorageAction(bool)), this, SLOT(updateLocalStorageAction(bool)));
// Setup the GUI based on the browser_ui.rc file.
setupGUI(StandardWindowOption::Default, ("browser_ui.rc"));
urlLineEditPointer = new KLineEdit();
// Populate the URL toolbar.
- urlToolBarPointer->addWidget(urlLineEditPointer);
- urlToolBarPointer->addAction(javaScriptActionPointer);
- urlToolBarPointer->addAction(domainSettingsActionPointer);
+ urlToolBarPointer->insertWidget(javaScriptActionPointer, urlLineEditPointer);
// Load a new URL from the URL line edit.
connect(urlLineEditPointer, SIGNAL(returnKeyPressed(const QString)), this, SLOT(loadUrlFromLineEdit(const QString)));
// Get a handle for the status bar.
QStatusBar *statusBarPointer = statusBar();
+ // Create a progress bar.
+ progressBarPointer = new QProgressBar();
+
+ // Add the progress bar to to the status bar.
+ statusBarPointer->addPermanentWidget(progressBarPointer);
+
// Update the status bar with the URL when a link is hovered.
connect(browserViewPointer, SIGNAL(linkHovered(QString)), statusBarPointer, SLOT(showMessage(QString)));
+ // Update the progress bar.
+ connect(browserViewPointer, SIGNAL(showProgressBar(const int)), this, SLOT(showProgressBar(const int)));
+ connect(browserViewPointer, SIGNAL(hideProgressBar()), progressBarPointer, SLOT(hide()));
+
// Get the URL line edit palettes.
noDomainSettingsPalette = urlLineEditPointer->palette();
domainSettingsPalette = urlLineEditPointer->palette();
browserViewPointer->applyOnTheFlyZoomFactor(newZoomFactor);
// Update the on-the-fly action text.
- updateOnTheFlyZoomFactor(newZoomFactor);
+ updateZoomFactorAction(newZoomFactor);
}
}
browserViewPointer->refresh();
}
-void BrowserWindow::toggleJavaScript() const
+void BrowserWindow::showProgressBar(const int &progress) const
{
- // Remove the focus from the URL line edit.
- urlLineEditPointer->clearFocus();
+ // Set the progress bar value.
+ progressBarPointer->setValue(progress);
- // Toggle JavaScript.
- browserViewPointer->toggleJavaScript();
+ // Show the progress bar.
+ progressBarPointer->show();
}
QSize BrowserWindow::sizeHint() const
}
}
+void BrowserWindow::toggleJavaScript() const
+{
+ // Remove the focus from the URL line edit.
+ urlLineEditPointer->clearFocus();
+
+ // Toggle JavaScript.
+ browserViewPointer->toggleJavaScript();
+}
+
+void BrowserWindow::toggleLocalStorage() const
+{
+ // Remove the focus from the URL line edit.
+ urlLineEditPointer->clearFocus();
+
+ // Toggle JavaScript.
+ browserViewPointer->toggleLocalStorage();
+}
+
void BrowserWindow::updateDomainSettingsIndicator(const bool &status) const
{
// Set the domain palette according to the status.
else javaScriptActionPointer->setIcon(QIcon(":/icons/privacy-mode"));
}
-void BrowserWindow::updateOnTheFlySearchEngine(const QString &searchEngine) const
+void BrowserWindow::updateLocalStorageAction(const bool &isEnabled) const
+{
+ // Set the icon according to the status.
+ if (isEnabled) localStorageActionPointer->setIcon(QIcon::fromTheme("disk-quota-low"));
+ else localStorageActionPointer->setIcon(QIcon::fromTheme("disk-quota"));
+}
+
+void BrowserWindow::updateSearchEngineActions(const QString &searchEngine) const
{
// Initialize the custom search engine flag.
bool customSearchEngine = false;
}
}
-void BrowserWindow::updateOnTheFlyUserAgent(const QString &userAgent) const
+void BrowserWindow::updateUserAgentActions(const QString &userAgent) const
{
// Initialize the custom user agent flag.
bool customUserAgent = false;
}
}
-void BrowserWindow::updateOnTheFlyZoomFactor(const double &zoomFactor)
+void BrowserWindow::updateZoomFactorAction(const double &zoomFactor)
{
// Set the current zoom factor.
currentZoomFactor = zoomFactor;