From 36dce3fd26194cdf6dbf1ba52cc27cfa1daae389 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Mon, 27 Aug 2018 16:42:51 +0200 Subject: PluginEditor: implement add plugin action --- plugins/ProfileEditor/forms/profileview.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'plugins/ProfileEditor/forms/profileview.cpp') diff --git a/plugins/ProfileEditor/forms/profileview.cpp b/plugins/ProfileEditor/forms/profileview.cpp index 87546e5..85dde12 100644 --- a/plugins/ProfileEditor/forms/profileview.cpp +++ b/plugins/ProfileEditor/forms/profileview.cpp @@ -13,10 +13,11 @@ #include #include -inline void connectSetting(QCheckBox *checkBox, QWebEngineSettings *settings, QWebEngineSettings::WebAttribute attr) +void ProfileView::connectSetting(QCheckBox *checkBox, QWebEngineSettings *settings, QWebEngineSettings::WebAttribute attr) { checkBox->setChecked(settings->testAttribute(attr)); - QObject::connect(checkBox, &QCheckBox::clicked, [settings, attr](bool checked) { + connect(checkBox, &QCheckBox::clicked, [this, settings, attr](bool checked) { + this->m_isChanged = true; settings->setAttribute(attr, checked); }); } @@ -37,26 +38,31 @@ ProfileView::ProfileView(WebProfile *profile, QWidget *parent) // http tab ui->userAgent->setPlainText(m_profile->httpUserAgent()); connect(ui->userAgent, &QPlainTextEdit::textChanged, profile, [=]() { + this->m_isChanged = true; profile->setHttpUserAgent(ui->userAgent->toPlainText()); }); ui->acceptLanguage->setPlainText(m_profile->httpAcceptLanguage()); connect(ui->acceptLanguage, &QPlainTextEdit::textChanged, profile, [=]() { + this->m_isChanged = true; profile->setHttpAcceptLanguage(ui->acceptLanguage->toPlainText()); }); ui->cacheType->setCurrentIndex(m_profile->httpCacheType()); connect(ui->cacheType, QOverload::of(&QComboBox::currentIndexChanged), profile, [=](int index) { + this->m_isChanged = true; profile->setHttpCacheType(static_cast(index)); }); ui->cacheSize->setText(QString::number(m_profile->httpCacheMaximumSize())); connect(ui->cacheSize, &QLineEdit::textChanged, profile, [=](const QString &text) { + this->m_isChanged = true; profile->setHttpCacheMaximumSize(text.toInt()); }); ui->cookiePolicy->setCurrentIndex(m_profile->persistentCookiesPolicy()); connect(ui->cookiePolicy, QOverload::of(&QComboBox::currentIndexChanged), profile, [=](int index) { + this->m_isChanged = true; profile->setPersistentCookiesPolicy(static_cast(index)); }); @@ -81,6 +87,11 @@ ProfileView::~ProfileView() delete ui; } +bool ProfileView::isChanged() const +{ + return m_isChanged; +} + void ProfileView::loadSettings(QWebEngineSettings *settings) { // settings -- cgit v1.2.1