From b65341c9d32a9e522fef91e90c89e9e6900f8d42 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 23 Nov 2018 19:18:49 +0100 Subject: Add QT_NO_DEBUG to non-debug builds --- src/forms/cookiesform.cpp | 73 ---------------------------- src/forms/cookiesform.h | 46 ------------------ src/forms/cookiesform.ui | 120 ---------------------------------------------- 3 files changed, 239 deletions(-) delete mode 100644 src/forms/cookiesform.cpp delete mode 100644 src/forms/cookiesform.h delete mode 100644 src/forms/cookiesform.ui (limited to 'src/forms') diff --git a/src/forms/cookiesform.cpp b/src/forms/cookiesform.cpp deleted file mode 100644 index 9060afa..0000000 --- a/src/forms/cookiesform.cpp +++ /dev/null @@ -1,73 +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: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote - * - * SPDX-License-Identifier: GPL-3.0 - */ - -#include "cookiesform.h" -#include "ui_cookiesform.h" -#include - -CookiesForm::CookiesForm(QWebEngineCookieStore *store, QWidget *parent) - : QWidget(parent) - , ui(new Ui::CookiesForm) -{ - setAttribute(Qt::WA_DeleteOnClose, false); - ui->setupUi(this); - ui->treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - - connect(store, &QWebEngineCookieStore::cookieAdded, this, &CookiesForm::addCookie); - connect(ui->treeWidget, &QTreeWidget::currentItemChanged, this, &CookiesForm::showDetails); -} - -CookiesForm::~CookiesForm() -{ - delete ui; -} - -void CookiesForm::addCookie(const QNetworkCookie &cookie) -{ - // find topLevelItem to which to add the cookie - QTreeWidgetItem *domainItem = nullptr; - - // loop through all top level items and check if one matches the domain - for(int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) { - QTreeWidgetItem *parentItem = ui->treeWidget->topLevelItem(i); - if(parentItem->text(0) == cookie.domain()) { - domainItem = parentItem; - break; - } - } - - // no topLevelItem matches - if(!domainItem) { - domainItem = new QTreeWidgetItem(ui->treeWidget); - domainItem->setText(0, cookie.domain()); - } - - QTreeWidgetItem *item = new QTreeWidgetItem(domainItem); - item->setText(0, cookie.name()); - item->setText(1, cookie.expirationDate().toString(Qt::RFC2822Date)); - - item->setData(0, ValueRole, cookie.value()); - item->setData(0, IsHttpOnlyRole, cookie.isHttpOnly() ? tr("yes") : tr("no")); - item->setData(0, IsSecureRole, cookie.isSecure() ? tr("yes") : tr("no")); - item->setData(0, IsSessionCookieRole, cookie.isSessionCookie() ? tr("yes") : tr("no")); - item->setData(0, PathRole, cookie.path()); -} - -void CookiesForm::showDetails(QTreeWidgetItem *current, QTreeWidgetItem *previous) -{ - Q_UNUSED(previous) - if(!current) { - return; - } - - ui->value->setPlainText(current->data(0, ValueRole).toString()); - ui->httponly->setText(current->data(0, IsHttpOnlyRole).toString()); - ui->secure->setText(current->data(0, IsSecureRole).toString()); - ui->session->setText(current->data(0, IsSessionCookieRole).toString()); - ui->path->setText(current->data(0, PathRole).toString()); -} diff --git a/src/forms/cookiesform.h b/src/forms/cookiesform.h deleted file mode 100644 index a950ae1..0000000 --- a/src/forms/cookiesform.h +++ /dev/null @@ -1,46 +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: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote - * - * SPDX-License-Identifier: GPL-3.0 - */ - -#ifndef COOKIESFORM_H -#define COOKIESFORM_H - -#include -#include -#include - -namespace Ui -{ -class CookiesForm; -} - -class CookiesForm : public QWidget -{ - Q_OBJECT - -public: - enum DetailsRoles { - ValueRole = Qt::UserRole, - - IsHttpOnlyRole = Qt::UserRole + 1, - IsSecureRole = Qt::UserRole + 2, - IsSessionCookieRole = Qt::UserRole + 3, - PathRole = Qt::UserRole + 4 - }; - - explicit CookiesForm(QWebEngineCookieStore *store, QWidget *parent = 0); - ~CookiesForm(); - -private slots: - void addCookie(const QNetworkCookie &cookie); - void showDetails(QTreeWidgetItem *current, QTreeWidgetItem *previous); - -private: - Ui::CookiesForm *ui; -}; - -#endif // COOKIESFORM_H diff --git a/src/forms/cookiesform.ui b/src/forms/cookiesform.ui deleted file mode 100644 index f5546bd..0000000 --- a/src/forms/cookiesform.ui +++ /dev/null @@ -1,120 +0,0 @@ - - - CookiesForm - - - - 0 - 0 - 480 - 640 - - - - Cookies - - - - - - false - - - - Name - - - - - Expiration - - - - - - - - Details - - - - - - - - Is HTTP Only - - - - - - - Is Secure - - - - - - - Is Session Cookie - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path - - - - - - - - - - - - - - - - - 0 - 0 - - - - true - - - - - - - - - - - -- cgit v1.2.1