aboutsummaryrefslogtreecommitdiff
path: root/src/forms/profileview.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-01-15 00:35:58 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-01-15 00:35:58 +0100
commit2660fff9e6191808aa83197639a663b73a27bbfa (patch)
treee01930c4202d87c5b74f701938a0004a952425a1 /src/forms/profileview.cpp
parentInitial plugins testing (diff)
downloadsmolbote-2660fff9e6191808aa83197639a663b73a27bbfa.tar.xz
Moved ProfileView to ProfileEditorPlugin
Diffstat (limited to 'src/forms/profileview.cpp')
-rw-r--r--src/forms/profileview.cpp132
1 files changed, 0 insertions, 132 deletions
diff --git a/src/forms/profileview.cpp b/src/forms/profileview.cpp
deleted file mode 100644
index 3d85963..0000000
--- a/src/forms/profileview.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * This file is part of smolbote. It's copyrighted by the contributors recorded
- * in the version control history of the file, available from its original
- * location: git://neueland.iserlohn-fortress.net/smolbote.git
- *
- * SPDX-License-Identifier: GPL-3.0
- */
-
-#include "profileview.h"
-#include "ui_profileview.h"
-
-#include "forms/cookiesform.h"
-#include "webengine/webengineprofile.h"
-#include <QComboBox>
-#include <QLineEdit>
-#include <QPlainTextEdit>
-#include <QPushButton>
-
-#include <QDialogButtonBox>
-
-#include <QFormLayout>
-
-ProfileView::ProfileView(WebEngineProfile *profile, QWidget *parent)
- : QDialog(parent)
- , ui(new Ui::ProfileView)
-{
- ui->setupUi(this);
- setProfile(profile);
-
- // actions
- connect(ui->clearCache_pushButton, &QPushButton::clicked, [this]() {
- this->m_profile->clearHttpCache();
- });
- connect(ui->clearHistory_pushButton, &QPushButton::clicked, [this]() {
- this->m_profile->clearAllVisitedLinks();
- });
-
- connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &ProfileView::updateProfile);
- connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &ProfileView::close);
-}
-
-ProfileView::~ProfileView()
-{
- delete ui;
-}
-
-void ProfileView::setProfile(WebEngineProfile *profile)
-{
- Q_CHECK_PTR(profile);
-
- m_profile = profile;
- setWindowTitle(m_profile->name());
-
- m_cookiesForm = new CookiesForm(m_profile->cookieStore(), this);
- //ui->tabWidget->addTab(m_cookiesForm, m_cookiesForm->windowTitle());
-
- // general
- ui->homepage_lineEdit->setText(m_profile->homepage().toString());
- ui->newtab_lineEdit->setText(m_profile->newtab().toString());
-
- // http
- 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(m_profile->persistentStoragePath());
- ui->cachePath_lineEdit->setText(m_profile->cachePath());
-
- // policy
- ui->cookiePolicy->setCurrentIndex(m_profile->persistentCookiesPolicy());
-
- //ui->formLayout_3->addWidget(m_cookiesForm);
- ui->verticalLayout_3->addWidget(m_cookiesForm);
-}
-
-void ProfileView::showProfile()
-{
- ui->tabWidget->setCurrentIndex(0);
- show();
-}
-
-void ProfileView::showCookies()
-{
- ui->tabWidget->setCurrentIndex(2);
- show();
-}
-
-void ProfileView::updateProfile()
-{
- 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
- m_profile->setHttpUserAgent(ui->userAgent->toPlainText());
- m_profile->setHttpAcceptLanguage(ui->acceptLanguage->toPlainText());
- switch(ui->cacheType->currentIndex()) {
- case 0:
- m_profile->setHttpCacheType(QWebEngineProfile::MemoryHttpCache);
- break;
- case 1:
- m_profile->setHttpCacheType(QWebEngineProfile::DiskHttpCache);
- break;
- case 2:
- m_profile->setHttpCacheType(QWebEngineProfile::NoCache);
- break;
- default:
- break;
- }
- m_profile->setHttpCacheMaximumSize(ui->cacheSize->text().toInt());
-
- // policy
- switch(ui->cookiePolicy->currentIndex()) {
- case 0:
- m_profile->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
- break;
- case 1:
- m_profile->setPersistentCookiesPolicy(QWebEngineProfile::AllowPersistentCookies);
- break;
- case 2:
- m_profile->setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies);
- break;
- default:
- break;
- }
-
- m_profile->saveProfile();
-}