mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
parent
6d66c5a470
commit
5b6db60605
@ -24,10 +24,12 @@
|
||||
#include "datapaths.h"
|
||||
#include "mainapplication.h"
|
||||
#include "networkmanager.h"
|
||||
#include "clickablelabel.h"
|
||||
#include "ui_clearprivatedata.h"
|
||||
#include "iconprovider.h"
|
||||
#include "qztools.h"
|
||||
#include "cookiemanager.h"
|
||||
#include "desktopnotificationsfactory.h"
|
||||
#include "html5permissions/html5permissionsdialog.h"
|
||||
|
||||
#include <QNetworkCookie>
|
||||
#include <QMessageBox>
|
||||
@ -46,11 +48,11 @@ ClearPrivateData::ClearPrivateData(QWidget* parent)
|
||||
ui->setupUi(this);
|
||||
ui->buttonBox->setFocus();
|
||||
connect(ui->history, SIGNAL(clicked(bool)), this, SLOT(historyClicked(bool)));
|
||||
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(dialogAccepted()));
|
||||
connect(ui->optimizeDb, SIGNAL(clicked(QPoint)), this, SLOT(optimizeDb()));
|
||||
|
||||
//Resizing +2 of sizeHint to get visible underlined link
|
||||
resize(sizeHint().width(), sizeHint().height() + 2);
|
||||
connect(ui->clear, SIGNAL(clicked(bool)), this, SLOT(dialogAccepted()));
|
||||
connect(ui->optimizeDb, SIGNAL(clicked(bool)), this, SLOT(optimizeDb()));
|
||||
connect(ui->editCookies, SIGNAL(clicked()), this, SLOT(showCookieManager()));
|
||||
connect(ui->editNotifs, SIGNAL(clicked()), this, SLOT(showNotifsPerms()));
|
||||
connect(ui->editGeoloc, SIGNAL(clicked()), this, SLOT(showGeolocPerms()));
|
||||
|
||||
Settings settings;
|
||||
settings.beginGroup("ClearPrivateData");
|
||||
@ -104,14 +106,6 @@ void ClearPrivateData::closeEvent(QCloseEvent* e)
|
||||
|
||||
void ClearPrivateData::dialogAccepted()
|
||||
{
|
||||
QMessageBox::StandardButton b = QMessageBox::question(this, tr("Clear Private Data"),
|
||||
tr("Are you sure to clear selected private data?"),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||
|
||||
if (b != QMessageBox::Yes) {
|
||||
return;
|
||||
}
|
||||
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
|
||||
if (ui->history->isChecked()) {
|
||||
@ -167,7 +161,10 @@ void ClearPrivateData::dialogAccepted()
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
close();
|
||||
ui->clear->setEnabled(false);
|
||||
ui->clear->setText(tr("Done"));
|
||||
|
||||
QTimer::singleShot(1000, this, SLOT(close()));
|
||||
}
|
||||
|
||||
void ClearPrivateData::optimizeDb()
|
||||
@ -186,6 +183,29 @@ void ClearPrivateData::optimizeDb()
|
||||
QMessageBox::information(this, tr("Database Optimized"), tr("Database successfully optimized.<br/><br/><b>Database Size Before: </b>%1<br/><b>Database Size After: </b>%2").arg(sizeBefore, sizeAfter));
|
||||
}
|
||||
|
||||
void ClearPrivateData::showCookieManager()
|
||||
{
|
||||
CookieManager* m = mApp->cookieManager();
|
||||
m->refreshTable();
|
||||
|
||||
m->setWindowModality(Qt::WindowModal);
|
||||
m->show();
|
||||
m->raise();
|
||||
}
|
||||
|
||||
void ClearPrivateData::showNotifsPerms()
|
||||
{
|
||||
HTML5PermissionsDialog dialog(this);
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
void ClearPrivateData::showGeolocPerms()
|
||||
{
|
||||
HTML5PermissionsDialog dialog(this);
|
||||
dialog.setCurrentTab(1);
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
static const int stateDataVersion = 0x0001;
|
||||
|
||||
void ClearPrivateData::restoreState(const QByteArray &state)
|
||||
|
@ -42,6 +42,9 @@ private slots:
|
||||
void historyClicked(bool state);
|
||||
void dialogAccepted();
|
||||
void optimizeDb();
|
||||
void showCookieManager();
|
||||
void showNotifsPerms();
|
||||
void showGeolocPerms();
|
||||
|
||||
private:
|
||||
void closeEvent(QCloseEvent* e);
|
||||
|
@ -6,15 +6,55 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>246</width>
|
||||
<height>289</height>
|
||||
<width>377</width>
|
||||
<height>342</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Clear Recent History</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="1" colspan="2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string><b>Clear Recent History</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="icon">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../data/icons.qrc">:/icons/preferences/applications-system.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Checked items will be cleared upon clicking the Clear button.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="history">
|
||||
<property name="text">
|
||||
<string>Visited pages history from:</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" alignment="Qt::AlignRight">
|
||||
<widget class="QComboBox" name="historyLength">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -41,151 +81,140 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="localStorage">
|
||||
<property name="text">
|
||||
<string>Clear local storage</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="cookies">
|
||||
<property name="text">
|
||||
<string>Clear cookies</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Choose what you want to delete:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="icons">
|
||||
<property name="text">
|
||||
<string>Clear icons</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="cache">
|
||||
<property name="text">
|
||||
<string>Clear cache</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="databases">
|
||||
<property name="text">
|
||||
<string>Clear web databases</string>
|
||||
<string>Web databases</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="localStorage">
|
||||
<property name="text">
|
||||
<string><b>Clear Recent History</b></string>
|
||||
<string>Local storage</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="history">
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="cache">
|
||||
<property name="text">
|
||||
<string>Clear history</string>
|
||||
<string>Cache</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="cookies">
|
||||
<property name="text">
|
||||
<string>Cookies</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="icon">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item row="6" column="1" alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="editCookies">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../data/icons.qrc">:/icons/preferences/applications-system.png</pixmap>
|
||||
<string>Edit cookies</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="3">
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="icons">
|
||||
<property name="text">
|
||||
<string>Icons</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>HTML5 notifications data</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="editNotifs">
|
||||
<property name="text">
|
||||
<string>Edit permissions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>HTML5 geolocation data</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1" alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="editGeoloc">
|
||||
<property name="text">
|
||||
<string>Edit permissions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="optimizeDb">
|
||||
<property name="text">
|
||||
<string>Optimize database</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Database</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="3">
|
||||
<widget class="ClickableLabel" name="optimizeDb">
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
<item row="12" column="0" alignment="Qt::AlignLeft">
|
||||
<widget class="QPushButton" name="clear">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Optimize database</string>
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1" alignment="Qt::AlignRight">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="html-link-look" stdset="0">
|
||||
<bool>true</bool>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ClickableLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>clickablelabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../data/icons.qrc"/>
|
||||
</resources>
|
||||
|
@ -73,6 +73,11 @@ HTML5PermissionsDialog::HTML5PermissionsDialog(QWidget* parent) :
|
||||
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(saveSettings()));
|
||||
}
|
||||
|
||||
void HTML5PermissionsDialog::setCurrentTab(int index)
|
||||
{
|
||||
ui->tabWidget->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
void HTML5PermissionsDialog::removeNotifEntry()
|
||||
{
|
||||
QTreeWidgetItem* item = ui->notifTree->currentItem();
|
||||
|
@ -33,6 +33,7 @@ class HTML5PermissionsDialog : public QDialog
|
||||
public:
|
||||
explicit HTML5PermissionsDialog(QWidget* parent = 0);
|
||||
~HTML5PermissionsDialog();
|
||||
void setCurrentTab(int index);
|
||||
|
||||
private slots:
|
||||
void removeNotifEntry();
|
||||
|
Loading…
Reference in New Issue
Block a user