searchEngineYahooActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("im-yahoo")));
searchEngineCustomActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("search")));
zoomFactorActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("zoom")));
- domainSettingsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("network-server-symbolic")));
+ domainSettingsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("settings-configure")));
// Update the on-the-fly menus.
connect(browserViewPointer, SIGNAL(updateUserAgentActions(QString)), this, SLOT(updateUserAgentActions(QString)));
// Create a URL line edit.
urlLineEditPointer = new KLineEdit();
+ // Add an edit or add domain settings action to the URL line edit.
+ QAction *addOrEditDomainSettingsActionPointer = urlLineEditPointer->addAction(QIcon::fromTheme("settings-configure"), QLineEdit::TrailingPosition);
+
+ // Add or edit the current domain settings.
+ connect(addOrEditDomainSettingsActionPointer, SIGNAL(triggered()), this, SLOT(addOrEditDomainSettings()));
+
// Populate the URL toolbar.
urlToolBarPointer->insertWidget(javaScriptActionPointer, urlLineEditPointer);
connect(urlLineEditPointer, SIGNAL(returnKeyPressed(const QString)), this, SLOT(loadUrlFromLineEdit(const QString)));
// Update the URL line edit on page loads.
- connect(browserViewPointer, SIGNAL(updateUrlLineEdit(QString)), this, SLOT(updateUrlLineEdit(QString)));
+ connect(browserViewPointer, SIGNAL(updateUrlLineEdit(QUrl)), this, SLOT(updateUrlLineEdit(QUrl)));
// Get a handle for the status bar.
QStatusBar *statusBarPointer = statusBar();
domainSettingsPalette.setColor(QPalette::Base, QColor("#C8E6C9"));
// Update the applied palette.
- connect(browserViewPointer, SIGNAL(updateDomainSettingsIndicator(bool)), this, SLOT(updateDomainSettingsIndicator(bool)));
+ connect(browserViewPointer, SIGNAL(updateDomainSettingsIndicator(bool, QString)), this, SLOT(updateDomainSettingsIndicator(bool, QString)));
// Load the initial website.
browserViewPointer->loadInitialWebsite();
}
+void BrowserWindow::addOrEditDomainSettings() const
+{
+ // Remove the focus from the URL line edit.
+ urlLineEditPointer->clearFocus();
+
+ // Create the domain settings dialog pointer.
+ DomainSettingsDialog *domainSettingsDialogPointer;
+
+ // Run the commands according to the current domain settings status.
+ if (currentDomainSettingsDomain == "") // Domain settings are not currently applied.
+ {
+ // Instruct the domain settings dialog to add a new domain.
+ domainSettingsDialogPointer = new DomainSettingsDialog(DomainSettingsDialog::ADD_DOMAIN, currentUrl.host());
+ }
+ else // Domain settings are currently applied.
+ {
+ // Instruct the domain settings dialog to edit the current domain.
+ domainSettingsDialogPointer = new DomainSettingsDialog(DomainSettingsDialog::EDIT_DOMAIN, currentDomainSettingsDomain);
+ }
+
+ // Set the dialog window title.
+ domainSettingsDialogPointer->setWindowTitle(i18nc("The domain settings dialog title", "Domain Settings"));
+
+ // Set the modality.
+ domainSettingsDialogPointer->setWindowModality(Qt::WindowModality::WindowModal);;
+
+ // Show the dialog.
+ domainSettingsDialogPointer->show();
+
+ // Reload the tabs when domain settings are updated.
+ connect(domainSettingsDialogPointer, SIGNAL(domainSettingsUpdated()), browserViewPointer, SLOT(applyDomainSettingsAndReload()));
+}
+
void BrowserWindow::back() const
{
// Remove the focus from the URL line edit.
// Remove the focus from the URL line edit.
urlLineEditPointer->clearFocus();
- // Instantiate the domain settings window.
+ // Instantiate the domain settings dialog.
DomainSettingsDialog *domainSettingsDialogPointer = new DomainSettingsDialog();
// Set the dialog window title.
browserViewPointer->toggleLocalStorage();
}
-void BrowserWindow::updateDomainSettingsIndicator(const bool &status) const
+void BrowserWindow::updateDomainSettingsIndicator(const bool &status, const QString &domainSettingsDomain)
{
// Set the domain palette according to the status.
if (status) urlLineEditPointer->setPalette(domainSettingsPalette);
else urlLineEditPointer->setPalette(noDomainSettingsPalette);
+
+ // Store the domain.
+ currentDomainSettingsDomain = domainSettingsDomain;
}
void BrowserWindow::updateJavaScriptAction(const bool &isEnabled) const
searchEngineLabelPointer->setText(SearchEngineHelper::getSearchUrl(searchEngineString));
}
-void BrowserWindow::updateUrlLineEdit(const QString &newUrl) const
+void BrowserWindow::updateUrlLineEdit(const QUrl &newUrl)
{
// Update the URL line edit if it does not have focus.
if (!urlLineEditPointer->hasFocus())
{
// Update the URL line edit.
- urlLineEditPointer->setText(newUrl);
+ urlLineEditPointer->setText(newUrl.toString());
}
+
+ // Store the current URL.
+ currentUrl = newUrl;
}
void BrowserWindow::updateUserAgentLabel(const QString &userAgentDatabaseName) const