diff options
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/CMakeLists.txt | 56 | ||||
-rw-r--r-- | src/application.cpp | 21 | ||||
-rw-r--r-- | src/application.h | 5 | ||||
-rw-r--r-- | src/cookiejar.cpp | 110 | ||||
-rw-r--r-- | src/cookiejar.h | 56 | ||||
-rw-r--r-- | src/data/CMakeLists.txt (renamed from data/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | src/data/bg.png (renamed from data/bg.png) | bin | 15218 -> 15218 bytes | |||
-rw-r--r-- | src/data/bg2.png (renamed from data/bg2.png) | bin | 1898 -> 1898 bytes | |||
-rw-r--r-- | src/data/bot.gif (renamed from data/bot.gif) | bin | 644 -> 644 bytes | |||
-rw-r--r-- | src/data/busywidget.gif (renamed from data/busywidget.gif) | bin | 11611 -> 11611 bytes | |||
-rw-r--r-- | src/data/button.png (renamed from data/button.png) | bin | 740 -> 740 bytes | |||
-rw-r--r-- | src/data/category.png (renamed from data/category.png) | bin | 334 -> 334 bytes | |||
-rw-r--r-- | src/data/closed.png (renamed from data/closed.png) | bin | 118 -> 118 bytes | |||
-rw-r--r-- | src/data/defaultbookmarks.xbel (renamed from data/defaultbookmarks.xbel) | 0 | ||||
-rw-r--r-- | src/data/home.html (renamed from data/home.html) | 0 | ||||
-rw-r--r-- | src/data/loading.mng (renamed from data/loading.mng) | bin | 3332 -> 3332 bytes | |||
-rw-r--r-- | src/data/notfound.html (renamed from data/notfound.html) | 0 | ||||
-rw-r--r-- | src/data/open.png (renamed from data/open.png) | bin | 120 -> 120 bytes | |||
-rw-r--r-- | src/data/rekonq.desktop (renamed from data/rekonq.desktop) | 0 | ||||
-rw-r--r-- | src/data/tile.gif (renamed from data/tile.gif) | bin | 304 -> 304 bytes | |||
-rw-r--r-- | src/data/top.png (renamed from data/top.png) | bin | 786 -> 786 bytes | |||
-rw-r--r-- | src/data/webkit-icon.png (renamed from data/webkit-icon.png) | bin | 25694 -> 25694 bytes | |||
-rw-r--r-- | src/mainwindow.cpp | 12 | ||||
-rw-r--r-- | src/mainwindow.h | 1 | ||||
-rw-r--r-- | src/networkaccessmanager.cpp | 64 | ||||
-rw-r--r-- | src/networkaccessmanager.h | 47 | ||||
-rw-r--r-- | src/rekonqpage/newtabpage.cpp (renamed from src/newtabpage.cpp) | 0 | ||||
-rw-r--r-- | src/rekonqpage/newtabpage.h (renamed from src/newtabpage.h) | 0 | ||||
-rw-r--r-- | src/settings/settings_fonts.ui (renamed from src/settings_fonts.ui) | 0 | ||||
-rw-r--r-- | src/settings/settings_general.ui (renamed from src/settings_general.ui) | 0 | ||||
-rw-r--r-- | src/settings/settings_tabs.ui (renamed from src/settings_tabs.ui) | 0 | ||||
-rw-r--r-- | src/settings/settings_webkit.ui (renamed from src/settings_webkit.ui) | 0 | ||||
-rw-r--r-- | src/settings/settingsdialog.cpp (renamed from src/settings.cpp) | 17 | ||||
-rw-r--r-- | src/settings/settingsdialog.h (renamed from src/settings.h) | 6 | ||||
-rw-r--r-- | src/webpage.cpp | 85 | ||||
-rw-r--r-- | src/webpage.h | 19 | ||||
-rw-r--r-- | src/webpluginfactory.cpp | 9 | ||||
-rw-r--r-- | src/webpluginfactory.h | 6 | ||||
-rw-r--r-- | src/webview.cpp | 113 | ||||
-rw-r--r-- | src/webview.h | 12 |
41 files changed, 149 insertions, 495 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8454c2f6..a9e9c2b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,9 +21,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.2) # ================================================================================== -SET(QT_MIN_VERSION 4.5.0) +SET(QT_MIN_VERSION 4.6.0) FIND_PACKAGE(Qt4 REQUIRED) -SET(KDE_MIN_VERSION 4.3.1) +SET(KDE_MIN_VERSION 4.3.74) FIND_PACKAGE(KDE4 REQUIRED) INCLUDE(MacroOptionalFindPackage) @@ -96,7 +96,6 @@ IF(REKONQ_CAN_BE_COMPILED) ADD_SUBDIRECTORY( src ) ADD_SUBDIRECTORY( icons ) - ADD_SUBDIRECTORY( data ) ADD_SUBDIRECTORY( docs ) ENDIF(REKONQ_CAN_BE_COMPILED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4452df54..296e91fd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,36 +1,34 @@ -### ------- tests sub dir ------- +### ------- sub dirs ------- +ADD_SUBDIRECTORY( data ) ADD_SUBDIRECTORY( tests ) ### ------- SETTING REKONQ FILES.. SET( rekonq_KDEINIT_SRCS - newtabpage.cpp - previewimage.cpp - websnap.cpp - networkaccessmanager.cpp - autosaver.cpp - application.cpp - mainwindow.cpp - mainview.cpp - tabbar.cpp - cookiejar.cpp - history.cpp - historymodels.cpp + application.cpp + autosaver.cpp bookmarks.cpp - modelmenu.cpp - urlbar.cpp findbar.cpp - settings.cpp - webview.cpp - sidepanel.cpp - panelhistory.cpp + history.cpp + historymodels.cpp lineedit.cpp - webpage.cpp + mainview.cpp + mainwindow.cpp + modelmenu.cpp + panelhistory.cpp + previewimage.cpp sessionmanager.cpp + sidepanel.cpp + tabbar.cpp + urlbar.cpp + webpage.cpp webpluginfactory.cpp - + websnap.cpp + webview.cpp + rekonqpage/newtabpage.cpp + settings/settingsdialog.cpp bookmarkspanel/bookmarkspanel.cpp bookmarkspanel/bookmarkstreemodel.cpp bookmarkspanel/bookmarksproxy.cpp @@ -38,10 +36,10 @@ SET( rekonq_KDEINIT_SRCS KDE4_ADD_UI_FILES( rekonq_KDEINIT_SRCS - settings_general.ui - settings_tabs.ui - settings_fonts.ui - settings_webkit.ui + settings/settings_general.ui + settings/settings_tabs.ui + settings/settings_fonts.ui + settings/settings_webkit.ui cleardata.ui ) @@ -51,6 +49,8 @@ KDE4_ADD_KCFG_FILES( rekonq_KDEINIT_SRCS rekonq.kcfgc ) ### ------------- INCLUDING DIRECTORIES... INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/rekonqpage + ${CMAKE_CURRENT_SOURCE_DIR}/settings ${CMAKE_CURRENT_BINARY_DIR} ${KDE4_INCLUDES} ${QT4_INCLUDES} @@ -69,9 +69,9 @@ KDE4_ADD_KDEINIT_EXECUTABLE( rekonq ${rekonq_KDEINIT_SRCS} main.cpp ) ### --------------- TARGETTING LINK LIBRARIES... TARGET_LINK_LIBRARIES ( kdeinit_rekonq - ${QT_LIBRARIES} - ${QT_QTNETWORK_LIBRARY} - ${QT_QTWEBKIT_LIBRARY} + ${QT_LIBRARIES} + ${QT_QTWEBKIT_LIBRARY} + ${KDE4_KDEWEBKIT_LIBS} ${KDE4_KUTILS_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} diff --git a/src/application.cpp b/src/application.cpp index 66a7d3e5..d02e44c9 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -35,9 +35,7 @@ // Local Includes #include "mainwindow.h" -#include "cookiejar.h" #include "history.h" -#include "networkaccessmanager.h" #include "mainview.h" #include "webview.h" #include "urlbar.h" @@ -61,7 +59,6 @@ QPointer<HistoryManager> Application::s_historyManager; -QPointer<NetworkAccessManager> Application::s_networkAccessManager; QPointer<BookmarkProvider> Application::s_bookmarkProvider; QPointer<SessionManager> Application::s_sessionManager; @@ -77,7 +74,6 @@ Application::~Application() { qDeleteAll(m_mainWindows); delete s_bookmarkProvider; - delete s_networkAccessManager; delete s_historyManager; } @@ -209,23 +205,6 @@ MainWindow *Application::mainWindow() } -CookieJar *Application::cookieJar() -{ - return (CookieJar *)networkAccessManager()->cookieJar(); -} - - -NetworkAccessManager *Application::networkAccessManager() -{ - if (!s_networkAccessManager) - { - s_networkAccessManager = new NetworkAccessManager(); - s_networkAccessManager->setCookieJar(new CookieJar); - } - return s_networkAccessManager; -} - - HistoryManager *Application::historyManager() { if (!s_historyManager) diff --git a/src/application.h b/src/application.h index 0f256a45..786e5173 100644 --- a/src/application.h +++ b/src/application.h @@ -45,10 +45,8 @@ class KIcon; class KUrl; class BookmarkProvider; -class CookieJar; class HistoryManager; class MainWindow; -class NetworkAccessManager; class SessionManager; @@ -105,8 +103,6 @@ public: static KIcon icon(const KUrl &url); static HistoryManager *historyManager(); - static CookieJar *cookieJar(); - static NetworkAccessManager *networkAccessManager(); static BookmarkProvider *bookmarkProvider(); static SessionManager *sessionManager(); @@ -141,7 +137,6 @@ private: KUrl guessUrlFromString(const QString &url); static QPointer<HistoryManager> s_historyManager; - static QPointer<NetworkAccessManager> s_networkAccessManager; static QPointer<BookmarkProvider> s_bookmarkProvider; static QPointer<SessionManager> s_sessionManager; diff --git a/src/cookiejar.cpp b/src/cookiejar.cpp deleted file mode 100644 index 05ffb987..00000000 --- a/src/cookiejar.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot com> -* Copyright (C) 2009 by Lionel Chauvin <megabigbug@yahoo.fr> -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see <http://www.gnu.org/licenses/>. -* -* ============================================================ */ - - -// Self Includes -#include "cookiejar.h" -#include "cookiejar.moc" - -// Auto Includes -#include "rekonq.h" - -// Local Includes -#include "application.h" -#include "mainwindow.h" - -// KDE Includes -#include <KConfig> -#include <KStandardDirs> -#include <KDebug> - -// Qt Includes -#include <QtCore/QDataStream> -#include <QtCore/QDateTime> -#include <QtCore/QString> - -#include <QtDBus/QDBusInterface> -#include <QtDBus/QDBusReply> - - -CookieJar::CookieJar(QObject* parent) - : QNetworkCookieJar(parent) - , m_windowId(-1) -{ -} - - -CookieJar::~CookieJar() -{ -} - - -QList<QNetworkCookie> CookieJar::cookiesForUrl(const QUrl & url) const -{ - - QDBusInterface kcookiejar("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer"); - QList<QNetworkCookie> cookieList; - QDBusReply<QString> reply = kcookiejar.call("findDOMCookies", url.toString() ); - - if (reply.isValid()) - { - cookieList << reply.value().toUtf8(); - } - else - { - kWarning() << "Unable to communicate with the cookiejar!"; - } - - return cookieList; -} - - -bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie> & cookieList, const QUrl & url) -{ - QDBusInterface kcookiejar("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer"); - QByteArray cookieHeader; - Q_FOREACH(const QNetworkCookie& cookie, cookieList) - { - cookieHeader = "Set-Cookie: "; - cookieHeader += cookie.toRawForm(); - kcookiejar.call("addCookies", url.toString(), cookieHeader, m_windowId ); - } - - return !kcookiejar.lastError().isValid(); -} - - -void CookieJar::clear() -{ - QDBusInterface kcookiejar("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer"); - - QDBusReply<void> reply = kcookiejar.call( "deleteAllCookies" ); - if (!reply.isValid()) - { - kWarning() << "Unable to delete all the cookies as requested."; - } - return; -} diff --git a/src/cookiejar.h b/src/cookiejar.h deleted file mode 100644 index 9ae24409..00000000 --- a/src/cookiejar.h +++ /dev/null @@ -1,56 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot com> -* Copyright (C) 2009 by Lionel Chauvin <megabigbug@yahoo.fr> -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see <http://www.gnu.org/licenses/>. -* -* ============================================================ */ - - -#ifndef RECOOKIEJAR_H -#define RECOOKIEJAR_H - - -// Qt Includes -#include <QtNetwork/QNetworkCookieJar> - -// Forward Declarations -class QUrl; - - -class CookieJar : public QNetworkCookieJar -{ - Q_OBJECT - -public: - CookieJar(QObject* parent = 0); - virtual ~CookieJar(); - - virtual QList<QNetworkCookie> cookiesForUrl(const QUrl & url) const; - virtual bool setCookiesFromUrl(const QList<QNetworkCookie> & cookieList, const QUrl & url); - - void clear(); - -private: - qlonglong m_windowId; -}; - -#endif // RECOOKIEJAR_H diff --git a/data/CMakeLists.txt b/src/data/CMakeLists.txt index bf01a44d..bf01a44d 100644 --- a/data/CMakeLists.txt +++ b/src/data/CMakeLists.txt diff --git a/data/bg.png b/src/data/bg.png Binary files differindex 5ec669ac..5ec669ac 100644 --- a/data/bg.png +++ b/src/data/bg.png diff --git a/data/bg2.png b/src/data/bg2.png Binary files differindex 1ded2690..1ded2690 100644 --- a/data/bg2.png +++ b/src/data/bg2.png diff --git a/data/bot.gif b/src/data/bot.gif Binary files differindex 2f9abde4..2f9abde4 100644 --- a/data/bot.gif +++ b/src/data/bot.gif diff --git a/data/busywidget.gif b/src/data/busywidget.gif Binary files differindex 600b9d44..600b9d44 100644 --- a/data/busywidget.gif +++ b/src/data/busywidget.gif diff --git a/data/button.png b/src/data/button.png Binary files differindex 22ef7643..22ef7643 100644 --- a/data/button.png +++ b/src/data/button.png diff --git a/data/category.png b/src/data/category.png Binary files differindex 796875d4..796875d4 100644 --- a/data/category.png +++ b/src/data/category.png diff --git a/data/closed.png b/src/data/closed.png Binary files differindex 2b1bf01e..2b1bf01e 100644 --- a/data/closed.png +++ b/src/data/closed.png diff --git a/data/defaultbookmarks.xbel b/src/data/defaultbookmarks.xbel index b4919c5c..b4919c5c 100644 --- a/data/defaultbookmarks.xbel +++ b/src/data/defaultbookmarks.xbel diff --git a/data/home.html b/src/data/home.html index f99d0df1..f99d0df1 100644 --- a/data/home.html +++ b/src/data/home.html diff --git a/data/loading.mng b/src/data/loading.mng Binary files differindex 0e490c4b..0e490c4b 100644 --- a/data/loading.mng +++ b/src/data/loading.mng diff --git a/data/notfound.html b/src/data/notfound.html index e34bfc6d..e34bfc6d 100644 --- a/data/notfound.html +++ b/src/data/notfound.html diff --git a/data/open.png b/src/data/open.png Binary files differindex fee6f3fb..fee6f3fb 100644 --- a/data/open.png +++ b/src/data/open.png diff --git a/data/rekonq.desktop b/src/data/rekonq.desktop index 62998336..62998336 100644 --- a/data/rekonq.desktop +++ b/src/data/rekonq.desktop diff --git a/data/tile.gif b/src/data/tile.gif Binary files differindex 32e06fff..32e06fff 100644 --- a/data/tile.gif +++ b/src/data/tile.gif diff --git a/data/top.png b/src/data/top.png Binary files differindex 9ebf0234..9ebf0234 100644 --- a/data/top.png +++ b/src/data/top.png diff --git a/data/webkit-icon.png b/src/data/webkit-icon.png Binary files differindex b3ec677a..b3ec677a 100644 --- a/data/webkit-icon.png +++ b/src/data/webkit-icon.png diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 52ea6068..9b95f052 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -35,10 +35,8 @@ // Local Includes #include "application.h" -#include "settings.h" +#include "settingsdialog.h" #include "history.h" -#include "cookiejar.h" -#include "networkaccessmanager.h" #include "bookmarks.h" #include "webview.h" #include "mainview.h" @@ -90,6 +88,9 @@ #include <QtGui/QPrintPreviewDialog> #include <QtGui/QFontMetrics> +#include <QtDBus/QDBusInterface> +#include <QtDBus/QDBusReply> + #include <QtWebKit/QWebHistory> @@ -1067,12 +1068,13 @@ void MainWindow::clearPrivateData() if(clearWidget.clearCookies->isChecked()) { - Application::cookieJar()->clear(); + QDBusInterface kcookiejar("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer"); + QDBusReply<void> reply = kcookiejar.call( "deleteAllCookies" ); } if(clearWidget.clearCachedPages->isChecked()) { - Application::networkAccessManager()->resetDiskCache(); + // TODO implement me! } if(clearWidget.clearWebIcons->isChecked()) diff --git a/src/mainwindow.h b/src/mainwindow.h index af052c1b..64ce6967 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -32,7 +32,6 @@ // Local Includes #include "bookmarks.h" -// #include "mainview.h" #include "webview.h" // KDE Includes diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp deleted file mode 100644 index 38f4c8c4..00000000 --- a/src/networkaccessmanager.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved -* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com>* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see <http://www.gnu.org/licenses/>. -* -* ============================================================ */ - - -// Self Includes -#include "networkaccessmanager.h" -#include "networkaccessmanager.moc" - -// Local Includes -#include "application.h" -#include "mainwindow.h" - -// Auto Includes -#include "rekonq.h" - -// KDE Includes -#include <KStandardDirs> - -// Qt Includes -#include <QtNetwork/QNetworkDiskCache> - - -NetworkAccessManager::NetworkAccessManager(QObject *parent) - : AccessManager(parent) -{ - // resetting disk cache - resetDiskCache(); -} - - -void NetworkAccessManager::resetDiskCache() -{ - if(!cache()) - { - QNetworkDiskCache *diskCache = new QNetworkDiskCache(this); - setCache(diskCache); - } - else - { - cache()->clear(); - } -} diff --git a/src/networkaccessmanager.h b/src/networkaccessmanager.h deleted file mode 100644 index 6cade7fe..00000000 --- a/src/networkaccessmanager.h +++ /dev/null @@ -1,47 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved -* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com>* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see <http://www.gnu.org/licenses/>. -* -* ============================================================ */ - - -#ifndef NETWORKACCESSMANAGER_H -#define NETWORKACCESSMANAGER_H - - -// KDE Includes -#include <kio/accessmanager.h> - - -using namespace KIO; - - -class NetworkAccessManager : public AccessManager -{ - Q_OBJECT - -public: - NetworkAccessManager(QObject *parent = 0); - void resetDiskCache(); -}; - -#endif // NETWORKACCESSMANAGER_H diff --git a/src/newtabpage.cpp b/src/rekonqpage/newtabpage.cpp index b34990fc..b34990fc 100644 --- a/src/newtabpage.cpp +++ b/src/rekonqpage/newtabpage.cpp diff --git a/src/newtabpage.h b/src/rekonqpage/newtabpage.h index 2d8d50bd..2d8d50bd 100644 --- a/src/newtabpage.h +++ b/src/rekonqpage/newtabpage.h diff --git a/src/settings_fonts.ui b/src/settings/settings_fonts.ui index 98efce16..98efce16 100644 --- a/src/settings_fonts.ui +++ b/src/settings/settings_fonts.ui diff --git a/src/settings_general.ui b/src/settings/settings_general.ui index 57d293e6..57d293e6 100644 --- a/src/settings_general.ui +++ b/src/settings/settings_general.ui diff --git a/src/settings_tabs.ui b/src/settings/settings_tabs.ui index ba903ff4..ba903ff4 100644 --- a/src/settings_tabs.ui +++ b/src/settings/settings_tabs.ui diff --git a/src/settings_webkit.ui b/src/settings/settings_webkit.ui index 129bcf03..129bcf03 100644 --- a/src/settings_webkit.ui +++ b/src/settings/settings_webkit.ui diff --git a/src/settings.cpp b/src/settings/settingsdialog.cpp index 5696995c..1db38b96 100644 --- a/src/settings.cpp +++ b/src/settings/settingsdialog.cpp @@ -27,8 +27,8 @@ // Self Includes -#include "settings.h" -#include "settings.moc" +#include "settingsdialog.h" +#include "settingsdialog.moc" // Auto Includes #include "rekonq.h" @@ -36,7 +36,6 @@ // Local Includes #include "application.h" #include "mainwindow.h" -#include "networkaccessmanager.h" #include "webview.h" //Ui Includes @@ -70,6 +69,7 @@ private: KCModuleProxy *proxyModule; KCModuleProxy *ebrowsingModule; KCModuleProxy *cookiesModule; + KCModuleProxy *cacheModule; KShortcutsEditor *shortcutsEditor; Private(SettingsDialog *parent); @@ -110,7 +110,12 @@ Private::Private(SettingsDialog *parent) proxyModule = new KCModuleProxy(proxyInfo,parent); pageItem = parent->addPage(proxyModule, i18n(proxyInfo.moduleName().toLocal8Bit())); pageItem->setIcon(KIcon(proxyInfo.icon())); - + + KCModuleInfo cacheInfo("cache.desktop"); + cacheModule = new KCModuleProxy(cacheInfo,parent); + pageItem = parent->addPage(cacheModule, i18n(cacheInfo.moduleName().toLocal8Bit())); + pageItem->setIcon(KIcon(cacheInfo.icon())); + widget = new QWidget; webkitUi.setupUi(widget); widget->layout()->setMargin(0); @@ -153,6 +158,8 @@ SettingsDialog::SettingsDialog(QWidget *parent) connect(d->ebrowsingModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); connect(d->cookiesModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); connect(d->proxyModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->cacheModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->shortcutsEditor, SIGNAL(keyChange()), this, SLOT(updateButtons())); connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings())); @@ -200,6 +207,7 @@ void SettingsDialog::saveSettings() d->ebrowsingModule->save(); d->cookiesModule->save(); d->proxyModule->save(); + d->cacheModule->save(); d->shortcutsEditor->save(); } @@ -210,6 +218,7 @@ bool SettingsDialog::hasChanged() || d->ebrowsingModule->changed() || d->cookiesModule->changed() || d->proxyModule->changed() + || d->cacheModule->changed() || d->shortcutsEditor->isModified(); ; } diff --git a/src/settings.h b/src/settings/settingsdialog.h index 3aa943c7..360fe246 100644 --- a/src/settings.h +++ b/src/settings/settingsdialog.h @@ -26,8 +26,8 @@ * ============================================================ */ -#ifndef SETTINGS_H -#define SETTINGS_H +#ifndef SETTINGS_DIALOG_H +#define SETTINGS_DIALOG_H // KDE Includes @@ -59,4 +59,4 @@ private slots: void setHomeToCurrentPage(); }; -#endif // SETTINGS_H +#endif // SETTINGS_DIALOG_H diff --git a/src/webpage.cpp b/src/webpage.cpp index 56865eb7..94ecbe09 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -39,8 +39,6 @@ #include "application.h" #include "mainwindow.h" #include "mainview.h" -#include "cookiejar.h" -#include "networkaccessmanager.h" #include "webview.h" #include "webpluginfactory.h" @@ -51,7 +49,8 @@ #include <KToolInvocation> #include <KProtocolManager> -#include <KDE/KParts/BrowserRun> +#include <kparts/browseropenorsavequestion.h> + #include <KDE/KMimeTypeTrader> #include <KDE/KRun> #include <KDE/KFileDialog> @@ -66,8 +65,8 @@ #include <QtGui/QKeyEvent> -WebPage::WebPage(QObject *parent) - : QWebPage(parent) +WebPage::WebPage(QObject *parent, qlonglong windowId) + : KWebPage(parent, windowId) , m_keyboardModifiers(Qt::NoModifier) , m_pressedButtons(Qt::NoButton) { @@ -75,10 +74,8 @@ WebPage::WebPage(QObject *parent) setForwardUnsupportedContent(true); - setNetworkAccessManager(Application::networkAccessManager()); connect(networkAccessManager(), SIGNAL(finished(QNetworkReply*)), this, SLOT(manageNetworkErrors(QNetworkReply*))); - connect(this, SIGNAL(downloadRequested(const QNetworkRequest &)), this, SLOT(downloadRequested(const QNetworkRequest &))); connect(this, SIGNAL(unsupportedContent(QNetworkReply *)), this, SLOT(handleUnsupportedContent(QNetworkReply *))); } @@ -122,19 +119,14 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r m_requestedUrl = request.url(); - return QWebPage::acceptNavigationRequest(frame, request, type); + return KWebPage::acceptNavigationRequest(frame, request, type); } WebPage *WebPage::createWindow(QWebPage::WebWindowType type) { kDebug() << "WebPage createWindow slot"; - return newWindow(type); -} - -WebPage *WebPage::newWindow(WebWindowType type) -{ // added to manage web modal dialogs if (type == QWebPage::WebModalDialog) kDebug() << "Modal Dialog"; @@ -157,34 +149,32 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) if (reply->error() == QNetworkReply::NoError) { const KUrl url(reply->request().url()); - QString filename = url.fileName(); - QString mimetype = reply->header(QNetworkRequest::ContentTypeHeader).toString(); - KService::Ptr offer = KMimeTypeTrader::self()->preferredService(mimetype); + + QString mimeType = reply->header(QNetworkRequest::ContentTypeHeader).toString(); + KService::Ptr offer = KMimeTypeTrader::self()->preferredService(mimeType); if( offer.isNull() ) // no service can handle this. We can just download it.. { - downloadRequested(reply->request()); + downloadRequest(reply->request()); + return; } - else + + KParts::BrowserOpenOrSaveQuestion dlg(Application::instance()->mainWindow(), url, mimeType); + switch ( dlg.askEmbedOrSave() ) { - // WARNING switch to BrowserOpenOrSaveQuestion for 4.4 - switch ( KParts::BrowserRun::askSave( url, offer, mimetype, filename ) ) - { - case KParts::BrowserRun::Save: - downloadRequested(reply->request()); - return; - case KParts::BrowserRun::Cancel: - return; - default: // non extant case - break; - } - // case KParts::BrowserRun::Open - KUrl::List list; - list.append(url); - KRun::run(*offer,url,0); + case KParts::BrowserOpenOrSaveQuestion::Save: + downloadRequested(reply->request()); + return; + case KParts::BrowserOpenOrSaveQuestion::Cancel: + return; + default: // non extant case + break; } + // case KParts::BrowserRun::Embed + KUrl::List list; + list.append(url); + KRun::run(*offer,url,0); } - return; } @@ -260,28 +250,9 @@ QString WebPage::errorPage(QNetworkReply *reply) } -// TODO FIXME: sometimes url.fileName() fails to retrieve url file name -void WebPage::downloadRequested(const QNetworkRequest &request) -{ - const KUrl url(request.url()); - - const QString destUrl = KFileDialog::getSaveFileName(url.fileName(), QString(), view()); - if (destUrl.isEmpty()) return; - KIO::Job *job = KIO::file_copy(url, KUrl(destUrl), -1, KIO::Overwrite); - //job->setMetaData(metadata); //TODO: add metadata from request - job->addMetaData( QLatin1String("MaxCacheSize"), QLatin1String("0") ); // Don't store in http cache. - job->addMetaData( QLatin1String("cache"), QLatin1String("cache") ); // Use entry from cache if available. - job->uiDelegate()->setAutoErrorHandlingEnabled(true); -} - - -QString WebPage::userAgentForUrl(const QUrl& _url) const +bool WebPage::authorizedRequest(const QUrl &url) const { - const KUrl url(_url); - QString userAgent = KProtocolManager::userAgentForHost((url.isLocalFile() ? "localhost" : url.host())); - - if (userAgent == KProtocolManager::defaultUserAgent()) - return QWebPage::userAgentForUrl(_url); - - return userAgent; + Q_UNUSED(url) + // TODO implement ad-block here + return true; } diff --git a/src/webpage.h b/src/webpage.h index 45fc0c51..eb558220 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -32,40 +32,39 @@ #define WEBPAGE_H +// KDE Includes +#include <KWebPage> + // Qt Includes -#include <QWebPage> #include <QUrl> // Forward Declarations class QWebFrame; class QNetworkReply; -class QUrl; -class WebPage : public QWebPage +class WebPage : public KWebPage { Q_OBJECT public: - explicit WebPage(QObject *parent = 0); + explicit WebPage(QObject *parent = 0, qlonglong windowId = 0); ~WebPage(); - + + virtual bool authorizedRequest(const QUrl &url) const; + public slots: - void manageNetworkErrors(QNetworkReply* reply); + void manageNetworkErrors(QNetworkReply *reply); protected: WebPage *createWindow(WebWindowType type); - virtual WebPage *newWindow(WebWindowType type); virtual bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type); - - virtual QString userAgentForUrl(const QUrl& url) const; protected Q_SLOTS: virtual void handleUnsupportedContent(QNetworkReply *reply); - virtual void downloadRequested(const QNetworkRequest &request); private: friend class WebView; diff --git a/src/webpluginfactory.cpp b/src/webpluginfactory.cpp index 3daffbb6..af799905 100644 --- a/src/webpluginfactory.cpp +++ b/src/webpluginfactory.cpp @@ -38,7 +38,7 @@ WebPluginFactory::WebPluginFactory(QObject *parent) - : QWebPluginFactory(parent) + : KWebPluginFactory(parent) { } @@ -75,16 +75,13 @@ QObject *WebPluginFactory::create(const QString &mimeType, return new PreviewImage(url, title, number, isFavorite); } - // this let QtWebKit using builtin plugins - // to load in example flash contents and so on.. - kDebug() << "No plugins found for" << mimeType << ". Falling back to QtWebKit ones..."; - return 0; + return KWebPluginFactory::create(mimeType, url, argumentNames, argumentValues); } QList<QWebPluginFactory::Plugin> WebPluginFactory::plugins() const { - QList<QWebPluginFactory::Plugin> plugins; + QList<KWebPluginFactory::Plugin> plugins = KWebPluginFactory::plugins(); QWebPluginFactory::Plugin p; p.name = "application/image-preview"; diff --git a/src/webpluginfactory.h b/src/webpluginfactory.h index 738605db..30a366d4 100644 --- a/src/webpluginfactory.h +++ b/src/webpluginfactory.h @@ -28,13 +28,15 @@ #define WEB_PLUGIN_FACTORY_H +// KDE Includes +#include <KWebPluginFactory> + // Qt Includes -#include <QtWebKit/QWebPluginFactory> #include <QtCore/QList> #include <QtGui/QWidget> -class WebPluginFactory : public QWebPluginFactory +class WebPluginFactory : public KWebPluginFactory { Q_OBJECT diff --git a/src/webview.cpp b/src/webview.cpp index 1dd5ad6a..f38d363e 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -53,7 +53,7 @@ WebView::WebView(QWidget* parent) - : QWebView(parent) + : KWebView(parent, false) , m_page(new WebPage(this)) , m_progress(0) , m_mousePos(QPoint(0,0)) @@ -64,6 +64,11 @@ WebView::WebView(QWidget* parent) connect(page(), SIGNAL(statusBarMessage(const QString&)), this, SLOT(setStatusBarText(const QString&))); connect(this, SIGNAL(loadProgress(int)), this, SLOT(updateProgress(int))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); + + connect(this, SIGNAL(linkMiddleOrCtrlClicked(const KUrl &)), this, SLOT(loadInNewTab(const KUrl &)) ); + + connect(this, SIGNAL(linkShiftClicked(const KUrl &)), this, SLOT(downloadRequest(const KUrl &))); + connect(page(), SIGNAL(downloadRequested(const QNetworkRequest &)), this, SLOT(downloadRequest(const QNetworkRequest &r))); } @@ -76,7 +81,7 @@ WebPage *WebView::page() { if(!m_page) { - m_page = new WebPage(); + m_page = new WebPage(this); setPage(m_page); } return m_page; @@ -129,14 +134,8 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewWindow())); menu.addAction(a); - a = pageAction(QWebPage::DownloadLinkToDisk); - a->setIcon(KIcon("document-save")); - menu.addAction(a); - - a = pageAction(QWebPage::CopyLinkToClipboard); - a->setIcon(KIcon("edit-copy")); - menu.addAction(a); - + menu.addAction(pageAction(KWebPage::DownloadLinkToDisk)); + menu.addAction(pageAction(KWebPage::CopyLinkToClipboard)); menu.addSeparator(); } @@ -144,33 +143,24 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) if (result.isContentEditable() && result.isContentSelected()) { // actions for text selected in field - a = pageAction(QWebPage::Cut); - a->setIcon(KIcon("edit-cut")); - a->setShortcut(KStandardShortcut::cut().primary()); - menu.addAction(a); + menu.addAction(pageAction(KWebPage::Cut)); } // is content selected) Add COPY if(result.isContentSelected()) { - a = pageAction(QWebPage::Copy); - a->setIcon(KIcon("edit-copy")); - a->setShortcut(KStandardShortcut::copy().primary()); - a->setText(i18n("Copy")); + a = pageAction(KWebPage::Copy); if(!result.linkUrl().isEmpty()) - a->setText(i18n("Copy Text")); //for link + a->setText(i18n("Copy Text")); //for link else - a->setText(i18n("Copy")); + a->setText(i18n("Copy")); menu.addAction(a); } // is content editable? Add PASTE if(result.isContentEditable()) { - a = pageAction(QWebPage::Paste); - a->setIcon(KIcon("edit-paste")); - a->setShortcut(KStandardShortcut::paste().primary()); - menu.addAction(a); + menu.addAction(pageAction(KWebPage::Paste)); } // is content selected? Add SEARCH actions @@ -225,14 +215,8 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(viewImage(Qt::MouseButtons, Qt::KeyboardModifiers))); menu.addAction(a); - a = pageAction(QWebPage::DownloadImageToDisk); - a->setIcon(KIcon("document-save")); - menu.addAction(a); - - a = pageAction(QWebPage::CopyImageToClipboard); - a->setIcon(KIcon("edit-copy")); - menu.addAction(a); - + menu.addAction(pageAction(KWebPage::DownloadImageToDisk)); + menu.addAction(pageAction(KWebPage::CopyImageToClipboard)); menu.addSeparator(); } @@ -278,16 +262,12 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) QWebHistory *history = page()->history(); if(history->canGoBack()) { - a = pageAction(QWebPage::Back); - a->setIcon(KIcon("go-previous")); - menu.addAction(a); + menu.addAction(pageAction(KWebPage::Back)); } if(history->canGoForward()) { - a = pageAction(QWebPage::Forward); - a->setIcon(KIcon("go-next")); - menu.addAction(a); + menu.addAction(pageAction(KWebPage::Forward)); } menu.addAction(mainwindow->actionByName("view_redisplay")); @@ -302,10 +282,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) //Frame KActionMenu *frameMenu = new KActionMenu(i18n("Current Frame"), this); - a = pageAction(QWebPage::OpenFrameInNewWindow); - a->setText(i18n("Open Frame in New Tab")); - a->setIcon(KIcon("view-right-new")); - frameMenu->addAction(a); + frameMenu->addAction(pageAction(KWebPage::OpenFrameInNewWindow)); a = new KAction( KIcon("document-print-frame"), i18n("Print Frame"), this); connect(a, SIGNAL(triggered()), this, SLOT(printFrame())); @@ -315,12 +292,8 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) menu.addSeparator(); - //Page - a = pageAction(QWebPage::SelectAll); - a->setIcon(KIcon("edit-select-all")); - a->setShortcut(KStandardShortcut::selectAll().primary()); - a->setText(i18n("Select All")); - menu.addAction(a); + // Page Actions + menu.addAction(pageAction(KWebPage::SelectAll)); menu.addAction(mainwindow->actionByName(KStandardAction::name(KStandardAction::SaveAs))); menu.addAction(mainwindow->actionByName("page_source")); @@ -331,9 +304,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled)) { // Developer Extras actions - a = pageAction(QWebPage::InspectElement); - a->setIcon(KIcon("view-process-all")); - menu.addAction(a); + menu.addAction(pageAction(KWebPage::InspectElement)); } if(mainwindow->isFullScreen()) @@ -354,10 +325,10 @@ void WebView::mousePressEvent(QMouseEvent *event) switch(event->button()) { case Qt::XButton1: - triggerPageAction(QWebPage::Back); + triggerPageAction(KWebPage::Back); break; case Qt::XButton2: - triggerPageAction(QWebPage::Forward); + triggerPageAction(KWebPage::Forward); break; default: QWebView::mousePressEvent(event); @@ -378,20 +349,6 @@ QPoint WebView::mousePos() } -void WebView::wheelEvent(QWheelEvent *event) -{ - if (QApplication::keyboardModifiers() & Qt::ControlModifier) - { - int numDegrees = event->delta() / 8; - int numSteps = numDegrees / 15; - setTextSizeMultiplier(textSizeMultiplier() + numSteps * 0.1); - event->accept(); - return; - } - QWebView::wheelEvent(event); -} - - void WebView::search() { KAction *a = qobject_cast<KAction*>(sender()); @@ -455,15 +412,33 @@ void WebView::keyPressEvent(QKeyEvent *event) { if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_C)) { - triggerPageAction(QWebPage::Copy); + triggerPageAction(KWebPage::Copy); return; } if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_A)) { - triggerPageAction(QWebPage::SelectAll); + triggerPageAction(KWebPage::SelectAll); return; } QWebView::keyPressEvent(event); } + + +void WebView::loadInNewTab(const KUrl &url) +{ + Application::instance()->loadUrl(url, Rekonq::NewCurrentTab); +} + + +void WebView::downloadRequest(const KUrl &url) +{ + m_page->downloadRequest(QNetworkRequest(url)); +} + + +void WebView::downloadRequest(const QNetworkRequest &request) +{ + m_page->downloadRequest(request); +} diff --git a/src/webview.h b/src/webview.h index e860b8c8..4fa87978 100644 --- a/src/webview.h +++ b/src/webview.h @@ -33,13 +33,13 @@ #include <KUrl> // Qt Includes -#include <QWebView> +#include <KWebView> // Forward Declarations class WebPage; -class WebView : public QWebView +class WebView : public KWebView { Q_OBJECT @@ -55,9 +55,8 @@ public: protected: void contextMenuEvent(QContextMenuEvent *event); - void mousePressEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent *event);// need to be ported void mouseMoveEvent(QMouseEvent *event); - void wheelEvent(QWheelEvent *event); void keyPressEvent(QKeyEvent *event); private slots: @@ -72,6 +71,11 @@ private slots: void openLinkInNewWindow(); void openLinkInNewTab(); + void loadInNewTab(const KUrl &url); + + void downloadRequest(const KUrl &url); + void downloadRequest(const QNetworkRequest &request); + private: WebPage *m_page; int m_progress; |