1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

[OptimizeDb] Move Optimize Database link to ClearPrivateData dialog.

This commit is contained in:
nowrep 2013-12-28 16:55:08 +01:00
parent 271e78a6c9
commit d52b0e2cea
13 changed files with 116 additions and 164 deletions

View File

@ -70,7 +70,6 @@ BookmarksManager::BookmarksManager(QupZilla* mainClass, QWidget* parent)
connect(m_bookmarksModel, SIGNAL(folderParentChanged(QString,bool)), this, SLOT(changeFolderParent(QString,bool)));
connect(m_bookmarksModel, SIGNAL(bookmarkParentChanged(QString,QByteArray,int,QUrl,QString,QString)), this, SLOT(changeBookmarkParent(QString,QByteArray,int,QUrl,QString,QString)));
connect(ui->optimizeDb, SIGNAL(clicked(QPoint)), this, SLOT(optimizeDb()));
connect(ui->importBookmarks, SIGNAL(clicked(QPoint)), this, SLOT(importBookmarks()));
QShortcut* deleteAction = new QShortcut(QKeySequence("Del"), ui->bookmarksTree);
@ -753,16 +752,6 @@ void BookmarksManager::insertAllTabs()
delete dialog;
}
void BookmarksManager::optimizeDb()
{
BrowsingLibrary* b = qobject_cast<BrowsingLibrary*>(parentWidget()->parentWidget());
if (!b) {
return;
}
b->optimizeDatabase();
}
BookmarksManager::~BookmarksManager()
{
delete ui;

View File

@ -52,7 +52,6 @@ public slots:
void insertAllTabs();
private slots:
void optimizeDb();
void deleteItem();
void itemChanged(QTreeWidgetItem* item);
void addSubfolder();

View File

@ -14,19 +14,6 @@
<string>Bookmarks</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="8">
<widget class="ClickableLabel" name="optimizeDb">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>Optimize Database</string>
</property>
<property name="html-link-look" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="7">
<widget class="ClickableLabel" name="importBookmarks">
<property name="cursor">

View File

@ -40,7 +40,6 @@ HistoryManager::HistoryManager(QupZilla* mainClass, QWidget* parent)
connect(ui->deleteB, SIGNAL(clicked()), ui->historyTree, SLOT(removeItems()));
connect(ui->clearAll, SIGNAL(clicked()), this, SLOT(clearHistory()));
connect(ui->optimizeDb, SIGNAL(clicked(QPoint)), this, SLOT(optimizeDb()));
ui->historyTree->setFocus();
}
@ -97,15 +96,6 @@ void HistoryManager::openLink(const QUrl &url, HistoryView::OpenBehavior openIn)
}
}
void HistoryManager::optimizeDb()
{
BrowsingLibrary* b = qobject_cast<BrowsingLibrary*>(parentWidget()->parentWidget());
if (!b) {
return;
}
b->optimizeDatabase();
}
HistoryManager::~HistoryManager()
{
delete ui;

View File

@ -51,7 +51,6 @@ public slots:
private slots:
void openLink(const QUrl &url, HistoryView::OpenBehavior openIn);
void optimizeDb();
void clearHistory();
private:

View File

@ -41,19 +41,6 @@
</property>
</spacer>
</item>
<item row="1" column="3">
<widget class="ClickableLabel" name="optimizeDb">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>Optimize Database</string>
</property>
<property name="html-link-look" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4">
<widget class="HistoryView" name="historyTree">
<property name="alternatingRowColors">
@ -64,11 +51,6 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ClickableLabel</class>
<extends>QLabel</extends>
<header>clickablelabel.h</header>
</customwidget>
<customwidget>
<class>HistoryView</class>
<extends>QTreeView</extends>

View File

@ -26,9 +26,7 @@
#include "settings.h"
#include "history.h"
#include <QMessageBox>
#include <QCloseEvent>
#include <QFileInfo>
BrowsingLibrary::BrowsingLibrary(QupZilla* mainClass, QWidget* parent)
: QWidget(parent)
@ -142,17 +140,6 @@ void BrowsingLibrary::showRSS(QupZilla* mainClass)
activateWindow();
}
void BrowsingLibrary::optimizeDatabase()
{
mApp->setOverrideCursor(Qt::WaitCursor);
QString profilePath = mApp->currentProfilePath();
QString sizeBefore = QzTools::fileSizeToString(QFileInfo(profilePath + "browsedata.db").size());
mApp->history()->optimizeHistory();
QString sizeAfter = QzTools::fileSizeToString(QFileInfo(profilePath + "browsedata.db").size());
mApp->restoreOverrideCursor();
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 BrowsingLibrary::closeEvent(QCloseEvent* e)
{
Settings settings;

View File

@ -29,12 +29,14 @@
#include "qztools.h"
#include <QNetworkCookie>
#include <QMessageBox>
#include <QWebDatabase>
#include <QWebSettings>
#include <QNetworkDiskCache>
#include <QDateTime>
#include <QSqlQuery>
#include <QCloseEvent>
#include <QFileInfo>
ClearPrivateData::ClearPrivateData(QupZilla* mainClass, QWidget* parent)
: QDialog(parent)
@ -45,6 +47,7 @@ ClearPrivateData::ClearPrivateData(QupZilla* mainClass, QWidget* parent)
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);
@ -159,6 +162,22 @@ void ClearPrivateData::dialogAccepted()
close();
}
void ClearPrivateData::optimizeDb()
{
mApp->setOverrideCursor(Qt::WaitCursor);
QString profilePath = mApp->currentProfilePath();
QString sizeBefore = QzTools::fileSizeToString(QFileInfo(profilePath + "browsedata.db").size());
mApp->history()->optimizeHistory();
QString sizeAfter = QzTools::fileSizeToString(QFileInfo(profilePath + "browsedata.db").size());
mApp->restoreOverrideCursor();
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));
}
static const int stateDataVersion = 0x0001;
void ClearPrivateData::restoreState(const QByteArray &state)

View File

@ -42,6 +42,7 @@ public:
private slots:
void historyClicked(bool state);
void dialogAccepted();
void optimizeDb();
private:
void closeEvent(QCloseEvent* e);

View File

@ -6,14 +6,87 @@
<rect>
<x>0</x>
<y>0</y>
<width>272</width>
<height>264</height>
<width>246</width>
<height>289</height>
</rect>
</property>
<property name="windowTitle">
<string>Clear Recent History</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="1" colspan="2">
<widget class="QComboBox" name="historyLength">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>Earlier Today</string>
</property>
</item>
<item>
<property name="text">
<string>Week</string>
</property>
</item>
<item>
<property name="text">
<string>Month</string>
</property>
</item>
<item>
<property name="text">
<string>All</string>
</property>
</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">
@ -81,81 +154,38 @@
</property>
</widget>
</item>
<item row="11" column="1" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<item row="10" column="0" colspan="3">
<widget class="Line" name="line">
<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>
<item row="11" column="0" colspan="3">
<widget class="ClickableLabel" name="optimizeDb">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="checked">
<property name="text">
<string>Optimize database</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="html-link-look" stdset="0">
<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>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1" colspan="2">
<widget class="QComboBox" name="historyLength">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>Earlier Today</string>
</property>
</item>
<item>
<property name="text">
<string>Week</string>
</property>
</item>
<item>
<property name="text">
<string>Month</string>
</property>
</item>
<item>
<property name="text">
<string>All</string>
</property>
</item>
</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>

View File

@ -29,6 +29,7 @@
#include "qzsettings.h"
#include <QMenu>
#include <QLabel>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
#include <QWebSettings>
@ -60,8 +61,6 @@ RSSManager::RSSManager(QupZilla* mainClass, QWidget* parent)
connect(ui->add, SIGNAL(clicked()), this, SLOT(addFeed()));
connect(ui->deletebutton, SIGNAL(clicked()), this, SLOT(deleteFeed()));
connect(ui->edit, SIGNAL(clicked()), this, SLOT(editFeed()));
connect(ui->optimizeDb, SIGNAL(clicked(QPoint)), this, SLOT(optimizeDb()));
}
QupZilla* RSSManager::getQupZilla()
@ -419,15 +418,6 @@ bool RSSManager::addRssFeed(const QUrl &url, const QString &title, const QIcon &
return false;
}
void RSSManager::optimizeDb()
{
BrowsingLibrary* b = qobject_cast<BrowsingLibrary*>(parentWidget()->parentWidget());
if (!b) {
return;
}
b->optimizeDatabase();
}
RSSManager::~RSSManager()
{
delete ui;

View File

@ -54,7 +54,6 @@ public slots:
void refreshTable();
private slots:
void optimizeDb();
void beginToLoadSlot(const QUrl &url);
void finished();
void loadFeed(QTreeWidgetItem* item);

View File

@ -88,30 +88,10 @@
</property>
</spacer>
</item>
<item>
<widget class="ClickableLabel" name="optimizeDb">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>Optimize Database</string>
</property>
<property name="html-link-look" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ClickableLabel</class>
<extends>QLabel</extends>
<header>clickablelabel.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>