summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/application.cpp98
-rw-r--r--src/application.h6
-rw-r--r--src/cleardata.ui129
-rw-r--r--src/webwindow/webwindow.cpp58
-rw-r--r--src/webwindow/webwindow.h3
6 files changed, 282 insertions, 14 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1310ae0e..9cdccb5d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -144,6 +144,8 @@ KDE4_ADD_UI_FILES( rekonq_KDEINIT_SRCS
useragent/useragentsettings.ui
# ----------------------------------------
webtab/sslinfo.ui
+ # ----------------------------------------
+ cleardata.ui
)
diff --git a/src/application.cpp b/src/application.cpp
index a3825f2c..57aaa0f8 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -39,12 +39,21 @@
// Local Manager(s) Includes
#include "adblockmanager.h"
+#include "downloadmanager.h"
#include "historymanager.h"
+#include "iconmanager.h"
#include "sessionmanager.h"
-// // KDE Includes
+// Ui Includes
+#include "ui_cleardata.h"
+
+// KDE Includes
#include <KCmdLineArgs>
+#include <KDialog>
+#include <KProcess>
+#include <KPushButton>
+#include <KStandardDirs>
#include <KWindowSystem>
#include <KWindowInfo>
#include <KStartupInfo>
@@ -58,11 +67,11 @@
// #include <KCharsets>
// #include <KPushButton>
// #include <KMimeType>
-//
-// // Qt Includes
-// #include <QVBoxLayout>
-// #include <QDir>
-// #include <QTimer>
+//
+
+// Qt Includes
+#include <QDBusInterface>
+#include <QDBusReply>
Application::Application()
@@ -534,3 +543,80 @@ void Application::queryQuit()
// in case of just one window...
quit();
}
+
+
+void Application::clearPrivateData()
+{
+ QPointer<KDialog> dialog = new KDialog(tabWindow());
+ dialog->setCaption(i18nc("@title:window", "Clear Private Data"));
+ dialog->setButtons(KDialog::Ok | KDialog::Cancel);
+
+ dialog->button(KDialog::Ok)->setIcon(KIcon("edit-clear"));
+ dialog->button(KDialog::Ok)->setText(i18n("Clear"));
+
+ Ui::ClearDataWidget clearWidget;
+ QWidget widget;
+ clearWidget.setupUi(&widget);
+ clearWidget.clearHistory->setChecked(ReKonfig::clearHistory());
+ clearWidget.clearDownloads->setChecked(ReKonfig::clearDownloads());
+ clearWidget.clearCookies->setChecked(ReKonfig::clearCookies());
+ clearWidget.clearCachedPages->setChecked(ReKonfig::clearCachedPages());
+ clearWidget.clearWebIcons->setChecked(ReKonfig::clearWebIcons());
+ clearWidget.homePageThumbs->setChecked(ReKonfig::clearHomePageThumbs());
+
+ dialog->setMainWidget(&widget);
+ dialog->exec();
+
+ if (dialog->result() == QDialog::Accepted)
+ {
+ //Save current state
+ ReKonfig::setClearHistory(clearWidget.clearHistory->isChecked());
+ ReKonfig::setClearDownloads(clearWidget.clearDownloads->isChecked());
+ ReKonfig::setClearCookies(clearWidget.clearDownloads->isChecked());
+ ReKonfig::setClearCachedPages(clearWidget.clearCachedPages->isChecked());
+ ReKonfig::setClearWebIcons(clearWidget.clearWebIcons->isChecked());
+ ReKonfig::setClearHomePageThumbs(clearWidget.homePageThumbs->isChecked());
+
+ if (clearWidget.clearHistory->isChecked())
+ {
+ HistoryManager::self()->clear();
+ }
+
+ if (clearWidget.clearDownloads->isChecked())
+ {
+ DownloadManager::self()->clearDownloadsHistory();
+ }
+
+ if (clearWidget.clearCookies->isChecked())
+ {
+ QDBusInterface kcookiejar("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer");
+ QDBusReply<void> reply = kcookiejar.call("deleteAllCookies");
+ }
+
+ if (clearWidget.clearCachedPages->isChecked())
+ {
+ KProcess::startDetached(KStandardDirs::findExe("kio_http_cache_cleaner"),
+ QStringList(QL1S("--clear-all")));
+ }
+
+ if (clearWidget.clearWebIcons->isChecked())
+ {
+ IconManager::self()->clearIconCache();
+ }
+
+ if (clearWidget.homePageThumbs->isChecked())
+ {
+ QString path = KStandardDirs::locateLocal("cache", QString("thumbs/rekonq"), true);
+ path.remove("rekonq");
+ QDir cacheDir(path);
+ QStringList fileList = cacheDir.entryList();
+ Q_FOREACH(const QString & str, fileList)
+ {
+ QFile file(path + str);
+ file.remove();
+ }
+ }
+ }
+
+ dialog->deleteLater();
+}
diff --git a/src/application.h b/src/application.h
index 112de168..760854b4 100644
--- a/src/application.h
+++ b/src/application.h
@@ -66,7 +66,6 @@ public:
static Application *instance();
TabWindow *tabWindow();
- TabWindow *newTabWindow();
TabWindowList tabWindowList();
public Q_SLOTS:
@@ -87,6 +86,8 @@ public Q_SLOTS:
const Rekonq::OpenType& type = Rekonq::CurrentTab
);
+ TabWindow *newTabWindow();
+
void removeTabWindow(TabWindow *window);
protected:
@@ -96,6 +97,9 @@ protected:
private Q_SLOTS:
void updateConfiguration();
+ // clear private data
+ void clearPrivateData();
+
void queryQuit();
private:
diff --git a/src/cleardata.ui b/src/cleardata.ui
new file mode 100644
index 00000000..2ceb3354
--- /dev/null
+++ b/src/cleardata.ui
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ClearDataWidget</class>
+ <widget class="QWidget" name="ClearDataWidget">
+ <property name="windowModality">
+ <enum>Qt::WindowModal</enum>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>245</width>
+ <height>226</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string comment="@title:window">Clear Private Data</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;h3&gt;Clear the following items:&lt;/h3&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>10</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="clearHistory">
+ <property name="text">
+ <string>Visited pages history</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="clearDownloads">
+ <property name="text">
+ <string>Downloads history</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="clearCookies">
+ <property name="text">
+ <string>Cookies</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="clearCachedPages">
+ <property name="text">
+ <string>Cached web pages</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="clearWebIcons">
+ <property name="text">
+ <string>Website icons</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </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>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>15</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp
index 8d6ca22c..dc023ff6 100644
--- a/src/webwindow/webwindow.cpp
+++ b/src/webwindow/webwindow.cpp
@@ -46,6 +46,8 @@
#include <KIO/Job>
#include <KFileDialog>
#include <KJobUiDelegate>
+#include <KMimeTypeTrader>
+#include <KTemporaryFile>
#include <KUrl>
#include <KToggleFullScreenAction>
#include <KToolBar>
@@ -175,7 +177,7 @@ void WebWindow::setupActions()
// Standard Actions
KStandardAction::open(this, SLOT(fileOpen()), actionCollection());
KStandardAction::saveAs(this, SLOT(fileSaveAs()), actionCollection());
- KStandardAction::print(this, SLOT(printRequested()), actionCollection());
+ KStandardAction::print(_tab, SLOT(printFrame()), actionCollection());
KStandardAction::quit(rApp, SLOT(queryQuit()), actionCollection());
a = KStandardAction::fullScreen(this, SLOT(viewFullScreen(bool)), this, actionCollection());
@@ -218,10 +220,15 @@ void WebWindow::setupActions()
a = new KAction(KIcon("edit-clear"), i18n("Clear Private Data..."), this);
a->setShortcut(Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Delete);
actionCollection()->addAction(QL1S("clear_private_data"), a);
- connect(a, SIGNAL(triggered(bool)), this, SLOT(clearPrivateData()));
+ connect(a, SIGNAL(triggered(bool)), rApp, SLOT(clearPrivateData()));
+
+ // Bookmark ==========
+ a = KStandardAction::addBookmark(_bar, SLOT(manageBookmarks()), actionCollection());
+ KShortcut bkShortcut(Qt::CTRL + Qt::Key_D);
+ a->setShortcut(bkShortcut);
// <Menu name="rekonqMenu" noMerge="1">
-// <Action name="new_tab" />
+// <Action name="new_tab" /> ---
// <Action name="new_window" /> +
// <Action name="private_browsing" /> +
// <Separator/>
@@ -236,11 +243,11 @@ void WebWindow::setupActions()
// <text>&amp;Tools</text>
// <Action name="clear_private_data" /> +
// <Separator/>
-// <Action name="webapp_shortcut" />
-// <Action name="web_inspector" />
+// <Action name="webapp_shortcut" /> -------
+// <Action name="web_inspector" /> ---------
// <Action name="page_source" /> +
-// <Action name="net_analyzer" />
-// <Action name="set_editable" /> +
+// <Action name="net_analyzer" /> xxxxxxxxxxx
+// <Action name="set_editable" /> -------
// <Separator/>
// <Action name="useragent" />
// <Action name="sync" />
@@ -693,3 +700,40 @@ void WebWindow::openLocation()
_bar->selectAll();
_bar->setFocus();
}
+
+
+void WebWindow::viewPageSource()
+{
+ QString code = _tab->page()->mainFrame()->toHtml();
+
+ KTemporaryFile tmpFile;
+ tmpFile.setAutoRemove(false);
+ if (!tmpFile.open())
+ return;
+
+ QTextStream out(&tmpFile);
+ out << code;
+ tmpFile.close();
+ KUrl tmpUrl(tmpFile.fileName());
+
+ KParts::ReadOnlyPart *pa = KMimeTypeTrader::createPartInstanceFromQuery<KParts::ReadOnlyPart>(QL1S("text/plain"), _tab, this, QString());
+ if (pa)
+ {
+ // FIXME DO SOMETHING...
+// WebTab *srcTab = m_view->newWebTab(true);
+// srcTab->page()->setIsOnRekonqPage(true);
+// srcTab->setPart(pa, tmpUrl);
+// srcTab->urlBar()->setQUrl(url.pathOrUrl());
+// m_view->setTabText(m_view->currentIndex(), i18n("Source of: ") + url.prettyUrl());
+// updateHistoryActions();
+ }
+ else
+ KRun::runUrl(tmpUrl, QL1S("text/plain"), this, false);
+}
+
+
+void WebWindow::viewFullScreen(bool makeFullScreen)
+{
+// FIXME setWidgetsVisible(!makeFullScreen);
+ KToggleFullScreenAction::setFullScreen(this, makeFullScreen);
+}
diff --git a/src/webwindow/webwindow.h b/src/webwindow/webwindow.h
index b618ab42..cd7235b3 100644
--- a/src/webwindow/webwindow.h
+++ b/src/webwindow/webwindow.h
@@ -108,6 +108,9 @@ private Q_SLOTS:
void fileOpen();
void fileSaveAs();
+ void viewPageSource();
+ void viewFullScreen(bool enable);
+
Q_SIGNALS:
void titleChanged(QString);