aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 1f979ca..fa7f01d 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -114,10 +114,10 @@ MainWindow::~MainWindow()
void MainWindow::addNewTab(const QUrl &url)
{
if(!url.isEmpty()) {
- tabBar->addTab(profile, url);
+ tabBar->addTab(m_profile, url);
} else {
Settings settings;
- tabBar->addTab(profile, settings.value("newtab").toUrl());
+ tabBar->addTab(m_profile, settings.value("newtab").toUrl());
}
}
@@ -146,24 +146,24 @@ void MainWindow::about()
void MainWindow::loadProfile(const QString &name)
{
- if(profile) {
- profile->deleteLater();
+ if(m_profile) {
+ m_profile->deleteLater();
}
if(name.isEmpty()) {
+ //profileName = tr("Off the record");
+ m_profile = new WebEngineProfile(this);
qDebug("Creating off-the-record profile");
- profileName = tr("Off the record");
- profile = new WebEngineProfile(this);
} else {
- profileName = name;
- qDebug("Using profile: %s", qUtf8Printable(profileName));
- profile = new WebEngineProfile(profileName, this);
+ //profileName = name;
+ m_profile = new WebEngineProfile(name, this);
+ qDebug("Using profile: %s", qUtf8Printable(m_profile->storageName()));
}
UrlRequestInterceptor *interceptor = new UrlRequestInterceptor(this);
interceptor->setSubscription(blocklistManager->subscription());
- profile->setRequestInterceptor(interceptor);
- connect(profile, SIGNAL(downloadRequested(QWebEngineDownloadItem*)), Browser::instance()->downloads(), SLOT(addDownload(QWebEngineDownloadItem*)));
+ m_profile->setRequestInterceptor(interceptor);
+ connect(m_profile, SIGNAL(downloadRequested(QWebEngineDownloadItem*)), Browser::instance()->downloads(), SLOT(addDownload(QWebEngineDownloadItem*)));
}
void MainWindow::loadProfileGUI()
@@ -172,7 +172,7 @@ void MainWindow::loadProfileGUI()
QString name = QInputDialog::getText(this, tr("Load Profile"), tr("Enter Profile name"), QLineEdit::Normal, QString(""), &ok);
if(ok) {
loadProfile(name);
- tabBar->setProfile(profile);
+ tabBar->setProfile(m_profile);
}
}
@@ -212,15 +212,12 @@ void MainWindow::handleUrlChanged()
void MainWindow::handleTitleUpdated(const QString &title)
{
- // For some reason, the long dash gets garbled if read from the settings
- //setWindowTitle(title + settings.value("window/title").toString());
-
Settings settings;
- setWindowTitle(settings.value("window/title").toString().replace("$title", title).replace("$profile", profileName));
+ setWindowTitle(settings.value("window/title").toString().replace("$title", title).replace("$profile", m_profile->storageName()));
}
void MainWindow::execProfileEditor()
{
- ProfileDialog *dialog = new ProfileDialog(profile, this);
+ ProfileDialog *dialog = new ProfileDialog(m_profile, this);
dialog->exec();
}