aboutsummaryrefslogtreecommitdiff
path: root/src/forms
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-08-04 13:12:32 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2017-08-04 13:12:32 +0200
commita85dc7d9133c3cf4c94a2ef37db4f53a3d0e4c91 (patch)
tree81cc123c4afbaf726fbc4a8a6b87d50732432b4b /src/forms
parentUpdated documentation (diff)
downloadsmolbote-a85dc7d9133c3cf4c94a2ef37db4f53a3d0e4c91.tar.xz
Profile window fixes
Diffstat (limited to 'src/forms')
-rw-r--r--src/forms/profilesdialog.cpp4
-rw-r--r--src/forms/profilesdialog.ui2
-rw-r--r--src/forms/profileview.cpp58
-rw-r--r--src/forms/profileview.h4
-rw-r--r--src/forms/profileview.ui7
5 files changed, 37 insertions, 38 deletions
diff --git a/src/forms/profilesdialog.cpp b/src/forms/profilesdialog.cpp
index 34bd063..557d865 100644
--- a/src/forms/profilesdialog.cpp
+++ b/src/forms/profilesdialog.cpp
@@ -51,7 +51,9 @@ ProfilesDialog::ProfilesDialog(MainWindow *window, QWidget *parent) :
connect(ui->listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(viewProfile(int)));
connect(ui->new_toolButton, SIGNAL(released()), this, SLOT(newProfile()));
- connect(this, SIGNAL(accepted()), this, SLOT(loadSelectedProfile()));
+ disconnect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(loadSelectedProfile()));
+ connect(ui->buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), m_view, SLOT(updateProfile()));
loadProfiles();
}
diff --git a/src/forms/profilesdialog.ui b/src/forms/profilesdialog.ui
index 7a140b5..7e8bad5 100644
--- a/src/forms/profilesdialog.ui
+++ b/src/forms/profilesdialog.ui
@@ -69,7 +69,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Save</set>
</property>
</widget>
</item>
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();
}
diff --git a/src/forms/profileview.h b/src/forms/profileview.h
index 5dbdb59..a2ac98e 100644
--- a/src/forms/profileview.h
+++ b/src/forms/profileview.h
@@ -42,13 +42,11 @@ public:
public slots:
void showProfile();
void showCookies();
-
-private slots:
void updateProfile();
private:
- WebEngineProfile *_profile;
Ui::ProfileView *ui;
+ WebEngineProfile *m_profile;
CookiesForm *m_cookiesForm;
};
diff --git a/src/forms/profileview.ui b/src/forms/profileview.ui
index bed045a..5823d02 100644
--- a/src/forms/profileview.ui
+++ b/src/forms/profileview.ui
@@ -216,13 +216,6 @@
</widget>
</widget>
</item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Save</set>
- </property>
- </widget>
- </item>
</layout>
</widget>
<resources/>