1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Fixed "Open blank tab" on new tab option on OS/2

This commit is contained in:
David Rosca 2014-11-08 11:54:46 +01:00
parent addd5d1f43
commit 4320eb202f
2 changed files with 15 additions and 14 deletions

View File

@ -140,10 +140,10 @@ Preferences::Preferences(BrowserWindow* window, QWidget* parent)
Settings settings; Settings settings;
//GENERAL URLs //GENERAL URLs
settings.beginGroup("Web-URL-Settings"); settings.beginGroup("Web-URL-Settings");
m_homepage = settings.value("homepage", "qupzilla:start").toString(); m_homepage = settings.value("homepage", QUrl(QSL("qupzilla:start"))).toUrl();
m_newTabUrl = settings.value("newTabUrl", "qupzilla:speeddial").toString(); m_newTabUrl = settings.value("newTabUrl", QUrl(QSL("qupzilla:speeddial"))).toUrl();
ui->homepage->setText(m_homepage); ui->homepage->setText(m_homepage.toEncoded());
ui->newTabUrl->setText(m_newTabUrl); ui->newTabUrl->setText(m_newTabUrl.toEncoded());
int afterLaunch = settings.value("afterLaunch", 3).toInt(); int afterLaunch = settings.value("afterLaunch", 3).toInt();
settings.endGroup(); settings.endGroup();
ui->afterLaunch->setCurrentIndex(afterLaunch); ui->afterLaunch->setCurrentIndex(afterLaunch);
@ -170,13 +170,13 @@ Preferences::Preferences(BrowserWindow* window, QWidget* parent)
#endif #endif
ui->newTabFrame->setVisible(false); ui->newTabFrame->setVisible(false);
if (m_newTabUrl.isEmpty()) { if (m_newTabUrl.isEmpty() || m_newTabUrl.toString() == QL1S("about:blank")) {
ui->newTab->setCurrentIndex(0); ui->newTab->setCurrentIndex(0);
} }
else if (m_newTabUrl == m_homepage) { else if (m_newTabUrl == m_homepage) {
ui->newTab->setCurrentIndex(1); ui->newTab->setCurrentIndex(1);
} }
else if (m_newTabUrl == QLatin1String("qupzilla:speeddial")) { else if (m_newTabUrl.toString() == QL1S("qupzilla:speeddial")) {
ui->newTab->setCurrentIndex(2); ui->newTab->setCurrentIndex(2);
} }
else { else {
@ -879,15 +879,15 @@ void Preferences::saveSettings()
{ {
Settings settings; Settings settings;
//GENERAL URLs //GENERAL URLs
settings.beginGroup("Web-URL-Settings"); QUrl homepage = QUrl::fromEncoded(ui->homepage->text().toUtf8());
settings.setValue("homepage", ui->homepage->text());
QString homepage = ui->homepage->text(); settings.beginGroup("Web-URL-Settings");
settings.setValue("homepage", homepage);
settings.setValue("afterLaunch", ui->afterLaunch->currentIndex()); settings.setValue("afterLaunch", ui->afterLaunch->currentIndex());
switch (ui->newTab->currentIndex()) { switch (ui->newTab->currentIndex()) {
case 0: case 0:
settings.setValue("newTabUrl", QString()); settings.setValue("newTabUrl", QUrl(QSL("about:blank")));
break; break;
case 1: case 1:
@ -895,11 +895,11 @@ void Preferences::saveSettings()
break; break;
case 2: case 2:
settings.setValue("newTabUrl", "qupzilla:speeddial"); settings.setValue("newTabUrl", QUrl(QSL("qupzilla:speeddial")));
break; break;
case 3: case 3:
settings.setValue("newTabUrl", ui->newTabUrl->text()); settings.setValue("newTabUrl", QUrl::fromEncoded(ui->newTabUrl->text().toUtf8()));
break; break;
default: default:

View File

@ -18,6 +18,7 @@
#ifndef PREFERENCES_H #ifndef PREFERENCES_H
#define PREFERENCES_H #define PREFERENCES_H
#include <QUrl>
#include <QDialog> #include <QDialog>
#include <QPointer> #include <QPointer>
@ -104,8 +105,8 @@ private:
ThemeManager* m_themesManager; ThemeManager* m_themesManager;
QPointer<DesktopNotification> m_notification; QPointer<DesktopNotification> m_notification;
QString m_homepage; QUrl m_homepage;
QString m_newTabUrl; QUrl m_newTabUrl;
QString m_actProfileName; QString m_actProfileName;
int m_afterLaunch; int m_afterLaunch;
int m_onNewTab; int m_onNewTab;