aboutsummaryrefslogtreecommitdiff
path: root/src/forms/profileview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/forms/profileview.cpp')
-rw-r--r--src/forms/profileview.cpp58
1 files changed, 32 insertions, 26 deletions
diff --git a/src/forms/profileview.cpp b/src/forms/profileview.cpp
index cece4e4..2695311 100644
--- a/src/forms/profileview.cpp
+++ b/src/forms/profileview.cpp
@@ -41,13 +41,13 @@ ProfileView::ProfileView(WebEngineProfile *profile, QWidget *parent) :
// actions
connect(ui->clearCache_pushButton, &QPushButton::clicked, [this]() {
- this->_profile->clearHttpCache();
+ this->m_profile->clearHttpCache();
});
connect(ui->clearHistory_pushButton, &QPushButton::clicked, [this]() {
- this->_profile->clearAllVisitedLinks();
+ this->m_profile->clearAllVisitedLinks();
});
- connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(updateProfile()));
+ //connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(updateProfile()));
}
ProfileView::~ProfileView()
@@ -62,28 +62,28 @@ void ProfileView::setProfile(WebEngineProfile *profile)
}
//Q_ASSERT(profile);
- _profile = profile;
- setWindowTitle(_profile->name());
+ m_profile = profile;
+ setWindowTitle(m_profile->name());
- m_cookiesForm = new CookiesForm(_profile->cookieStore(), this);
+ m_cookiesForm = new CookiesForm(m_profile->cookieStore(), this);
//ui->tabWidget->addTab(m_cookiesForm, m_cookiesForm->windowTitle());
// general
- ui->homepage_lineEdit->setText(_profile->homepage().toString());
- ui->newtab_lineEdit->setText(_profile->newtab().toString());
+ ui->homepage_lineEdit->setText(m_profile->homepage().toString());
+ ui->newtab_lineEdit->setText(m_profile->newtab().toString());
// http
- ui->userAgent->setPlainText(_profile->httpUserAgent());
- ui->acceptLanguage->setPlainText(_profile->httpAcceptLanguage());
- ui->cacheType->setCurrentIndex(_profile->httpCacheType());
- ui->cacheSize->setText(QString::number(_profile->httpCacheMaximumSize()));
+ ui->userAgent->setPlainText(m_profile->httpUserAgent());
+ ui->acceptLanguage->setPlainText(m_profile->httpAcceptLanguage());
+ ui->cacheType->setCurrentIndex(m_profile->httpCacheType());
+ ui->cacheSize->setText(QString::number(m_profile->httpCacheMaximumSize()));
// path
- ui->storagePath_lineEdit->setText(_profile->persistentStoragePath());
- ui->cachePath_lineEdit->setText(_profile->cachePath());
+ ui->storagePath_lineEdit->setText(m_profile->persistentStoragePath());
+ ui->cachePath_lineEdit->setText(m_profile->cachePath());
// policy
- ui->cookiePolicy->setCurrentIndex(_profile->persistentCookiesPolicy());
+ ui->cookiePolicy->setCurrentIndex(m_profile->persistentCookiesPolicy());
//ui->formLayout_3->addWidget(m_cookiesForm);
ui->verticalLayout_3->addWidget(m_cookiesForm);
@@ -97,44 +97,50 @@ void ProfileView::showProfile()
void ProfileView::showCookies()
{
- ui->tabWidget->setCurrentIndex(4);
+ ui->tabWidget->setCurrentIndex(2);
show();
}
void ProfileView::updateProfile()
{
- qDebug("Updating profile...");
+ qDebug("Updating profile [%s]...", qUtf8Printable(m_profile->name()));
+
+ // general
+ m_profile->setHomepage(QUrl::fromUserInput(ui->homepage_lineEdit->text()));
+ m_profile->setNewtab(QUrl::fromUserInput(ui->newtab_lineEdit->text()));
// http
- _profile->setHttpUserAgent(ui->userAgent->toPlainText());
- _profile->setHttpAcceptLanguage(ui->acceptLanguage->toPlainText());
+ m_profile->setHttpUserAgent(ui->userAgent->toPlainText());
+ m_profile->setHttpAcceptLanguage(ui->acceptLanguage->toPlainText());
switch (ui->cacheType->currentIndex()) {
case 0:
- _profile->setHttpCacheType(QWebEngineProfile::MemoryHttpCache);
+ m_profile->setHttpCacheType(QWebEngineProfile::MemoryHttpCache);
break;
case 1:
- _profile->setHttpCacheType(QWebEngineProfile::DiskHttpCache);
+ m_profile->setHttpCacheType(QWebEngineProfile::DiskHttpCache);
break;
case 2:
- _profile->setHttpCacheType(QWebEngineProfile::NoCache);
+ m_profile->setHttpCacheType(QWebEngineProfile::NoCache);
break;
default:
break;
}
- _profile->setHttpCacheMaximumSize(ui->cacheSize->text().toInt());
+ m_profile->setHttpCacheMaximumSize(ui->cacheSize->text().toInt());
// policy
switch (ui->cookiePolicy->currentIndex()) {
case 0:
- _profile->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
+ m_profile->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
break;
case 1:
- _profile->setPersistentCookiesPolicy(QWebEngineProfile::AllowPersistentCookies);
+ m_profile->setPersistentCookiesPolicy(QWebEngineProfile::AllowPersistentCookies);
break;
case 2:
- _profile->setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies);
+ m_profile->setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies);
break;
default:
break;
}
+
+ m_profile->saveProfile();
}