summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-09-30 12:14:28 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-09-30 12:14:28 +0200
commit3c427654281e06e745ba5c4f62781469be991ac6 (patch)
treea197815e872d7ecd1ff908f0213a1e12edb6f3c6
parentTurned "Add bookmark" action to KDE one and implemented an "add to preferred" (diff)
downloadrekonq-3c427654281e06e745ba5c4f62781469be991ac6.tar.xz
Cleaning thumbs cache
-rw-r--r--src/cleardata.ui10
-rw-r--r--src/mainwindow.cpp18
-rw-r--r--src/previewimage.cpp11
3 files changed, 37 insertions, 2 deletions
diff --git a/src/cleardata.ui b/src/cleardata.ui
index b27a8f63..56a6f04f 100644
--- a/src/cleardata.ui
+++ b/src/cleardata.ui
@@ -62,6 +62,16 @@
</widget>
</item>
<item>
+ <widget class="QCheckBox" name="homePageThumbs">
+ <property name="text">
+ <string>home page thumbs</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index c5f3c556..53527a4f 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -67,6 +67,7 @@
#include <KJobUiDelegate>
#include <kdeprintdialog.h>
#include <KToggleAction>
+#include <KStandardDirs>
// Qt Includes
#include <QtCore/QTimer>
@@ -990,6 +991,21 @@ void MainWindow::clearPrivateData()
{
QWebSettings::clearIconDatabase();
}
+
+ if(clearWidget.homePageThumbs->isChecked())
+ {
+ QString path = KStandardDirs::locateLocal("cache", QString("thumbs/rekonq"), true);
+ path.remove("rekonq");
+ kDebug() << path;
+ QDir cacheDir(path);
+ QStringList fileList = cacheDir.entryList();
+ foreach(QString str, fileList)
+ {
+ kDebug() << str;
+ QFile file(path + str);
+ file.remove();
+ }
+ }
}
}
@@ -1035,7 +1051,7 @@ void MainWindow::slotOpenActionUrl(QAction *action)
void MainWindow::addPreferredLink()
{
QString name = currentTab()->title();
- QString url = currentTab()->url().path();
+ QString url = currentTab()->url().pathOrUrl();
QStringList names = ReKonfig::previewNames();
QStringList urls = ReKonfig::previewUrls();
diff --git a/src/previewimage.cpp b/src/previewimage.cpp
index 9cd1fdaa..af6e4361 100644
--- a/src/previewimage.cpp
+++ b/src/previewimage.cpp
@@ -90,5 +90,14 @@ void PreviewImage::mousePressEvent(QMouseEvent *event)
QString PreviewImage::guessNameFromUrl(QString url)
{
- return QUrl(url).toString( QUrl::RemoveScheme | QUrl::RemoveUserInfo | QUrl::StripTrailingSlash );
+ QString name = QUrl(url).toString( QUrl::RemoveScheme | QUrl::RemoveUserInfo | QUrl::StripTrailingSlash );
+
+ // TODO learn Regular Expressions :)
+ name.remove('/');
+ name.remove('&');
+ name.remove('.');
+ name.remove('-');
+ name.remove('_');
+
+ return name;
}