From d52b0e2cea060d79c3f5773b8805c972bcc008e0 Mon Sep 17 00:00:00 2001 From: nowrep Date: Sat, 28 Dec 2013 16:55:08 +0100 Subject: [PATCH] [OptimizeDb] Move Optimize Database link to ClearPrivateData dialog. --- src/lib/bookmarks/bookmarksmanager.cpp | 11 -- src/lib/bookmarks/bookmarksmanager.h | 1 - src/lib/bookmarks/bookmarksmanager.ui | 13 -- src/lib/history/historymanager.cpp | 10 -- src/lib/history/historymanager.h | 1 - src/lib/history/historymanager.ui | 18 --- src/lib/other/browsinglibrary.cpp | 13 -- src/lib/other/clearprivatedata.cpp | 19 +++ src/lib/other/clearprivatedata.h | 1 + src/lib/other/clearprivatedata.ui | 160 +++++++++++++++---------- src/lib/rss/rssmanager.cpp | 12 +- src/lib/rss/rssmanager.h | 1 - src/lib/rss/rssmanager.ui | 20 ---- 13 files changed, 116 insertions(+), 164 deletions(-) diff --git a/src/lib/bookmarks/bookmarksmanager.cpp b/src/lib/bookmarks/bookmarksmanager.cpp index 71f6a1db3..8da7d4b80 100644 --- a/src/lib/bookmarks/bookmarksmanager.cpp +++ b/src/lib/bookmarks/bookmarksmanager.cpp @@ -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(parentWidget()->parentWidget()); - if (!b) { - return; - } - b->optimizeDatabase(); -} - - BookmarksManager::~BookmarksManager() { delete ui; diff --git a/src/lib/bookmarks/bookmarksmanager.h b/src/lib/bookmarks/bookmarksmanager.h index 0e7c76d53..1e7d6cf4a 100644 --- a/src/lib/bookmarks/bookmarksmanager.h +++ b/src/lib/bookmarks/bookmarksmanager.h @@ -52,7 +52,6 @@ public slots: void insertAllTabs(); private slots: - void optimizeDb(); void deleteItem(); void itemChanged(QTreeWidgetItem* item); void addSubfolder(); diff --git a/src/lib/bookmarks/bookmarksmanager.ui b/src/lib/bookmarks/bookmarksmanager.ui index 968a7aac5..98b1d2816 100644 --- a/src/lib/bookmarks/bookmarksmanager.ui +++ b/src/lib/bookmarks/bookmarksmanager.ui @@ -14,19 +14,6 @@ Bookmarks - - - - PointingHandCursor - - - Optimize Database - - - true - - - diff --git a/src/lib/history/historymanager.cpp b/src/lib/history/historymanager.cpp index f50ed511f..e7fcda3e1 100644 --- a/src/lib/history/historymanager.cpp +++ b/src/lib/history/historymanager.cpp @@ -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(parentWidget()->parentWidget()); - if (!b) { - return; - } - b->optimizeDatabase(); -} - HistoryManager::~HistoryManager() { delete ui; diff --git a/src/lib/history/historymanager.h b/src/lib/history/historymanager.h index 99b58fda0..73d904a5c 100644 --- a/src/lib/history/historymanager.h +++ b/src/lib/history/historymanager.h @@ -51,7 +51,6 @@ public slots: private slots: void openLink(const QUrl &url, HistoryView::OpenBehavior openIn); - void optimizeDb(); void clearHistory(); private: diff --git a/src/lib/history/historymanager.ui b/src/lib/history/historymanager.ui index f271ec892..b4214cf77 100644 --- a/src/lib/history/historymanager.ui +++ b/src/lib/history/historymanager.ui @@ -41,19 +41,6 @@ - - - - PointingHandCursor - - - Optimize Database - - - true - - - @@ -64,11 +51,6 @@ - - ClickableLabel - QLabel -
clickablelabel.h
-
HistoryView QTreeView diff --git a/src/lib/other/browsinglibrary.cpp b/src/lib/other/browsinglibrary.cpp index ad18e125f..f69e85a04 100644 --- a/src/lib/other/browsinglibrary.cpp +++ b/src/lib/other/browsinglibrary.cpp @@ -26,9 +26,7 @@ #include "settings.h" #include "history.h" -#include #include -#include 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.

Database Size Before: %1
Database Size After: %2").arg(sizeBefore, sizeAfter)); -} - void BrowsingLibrary::closeEvent(QCloseEvent* e) { Settings settings; diff --git a/src/lib/other/clearprivatedata.cpp b/src/lib/other/clearprivatedata.cpp index 50871791b..838af3b16 100644 --- a/src/lib/other/clearprivatedata.cpp +++ b/src/lib/other/clearprivatedata.cpp @@ -29,12 +29,14 @@ #include "qztools.h" #include +#include #include #include #include #include #include #include +#include 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.

Database Size Before: %1
Database Size After: %2").arg(sizeBefore, sizeAfter)); +} + static const int stateDataVersion = 0x0001; void ClearPrivateData::restoreState(const QByteArray &state) diff --git a/src/lib/other/clearprivatedata.h b/src/lib/other/clearprivatedata.h index 80d6a4290..9ad7802b0 100644 --- a/src/lib/other/clearprivatedata.h +++ b/src/lib/other/clearprivatedata.h @@ -42,6 +42,7 @@ public: private slots: void historyClicked(bool state); void dialogAccepted(); + void optimizeDb(); private: void closeEvent(QCloseEvent* e); diff --git a/src/lib/other/clearprivatedata.ui b/src/lib/other/clearprivatedata.ui index f9745d86e..1c4b428d9 100644 --- a/src/lib/other/clearprivatedata.ui +++ b/src/lib/other/clearprivatedata.ui @@ -6,14 +6,87 @@ 0 0 - 272 - 264 + 246 + 289 Clear Recent History + + + + false + + + + Earlier Today + + + + + Week + + + + + Month + + + + + All + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + Clear local storage + + + true + + + + + + + Clear cookies + + + false + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 25 + 20 + + + + @@ -81,81 +154,38 @@ - - + + Qt::Horizontal - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - Clear local storage + + + + PointingHandCursor - + + Optimize database + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + true - - - - Clear cookies - - - false - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - false - - - - Earlier Today - - - - - Week - - - - - Month - - - - - All - - - - + + + ClickableLabel + QLabel +
clickablelabel.h
+
+
diff --git a/src/lib/rss/rssmanager.cpp b/src/lib/rss/rssmanager.cpp index 69865d13d..ae0e4f841 100644 --- a/src/lib/rss/rssmanager.cpp +++ b/src/lib/rss/rssmanager.cpp @@ -29,6 +29,7 @@ #include "qzsettings.h" #include +#include #include #include #include @@ -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(parentWidget()->parentWidget()); - if (!b) { - return; - } - b->optimizeDatabase(); -} - RSSManager::~RSSManager() { delete ui; diff --git a/src/lib/rss/rssmanager.h b/src/lib/rss/rssmanager.h index ff2091175..763a15dcf 100644 --- a/src/lib/rss/rssmanager.h +++ b/src/lib/rss/rssmanager.h @@ -54,7 +54,6 @@ public slots: void refreshTable(); private slots: - void optimizeDb(); void beginToLoadSlot(const QUrl &url); void finished(); void loadFeed(QTreeWidgetItem* item); diff --git a/src/lib/rss/rssmanager.ui b/src/lib/rss/rssmanager.ui index d484b6262..48d564912 100644 --- a/src/lib/rss/rssmanager.ui +++ b/src/lib/rss/rssmanager.ui @@ -88,30 +88,10 @@ - - - - PointingHandCursor - - - Optimize Database - - - true - - - - - - ClickableLabel - QLabel -
clickablelabel.h
-
-