diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/analyzer/analyzerpanel.cpp | 103 | ||||
-rw-r--r-- | src/analyzer/analyzerpanel.h | 69 | ||||
-rw-r--r-- | src/analyzer/networkanalyzer.cpp | 199 | ||||
-rw-r--r-- | src/analyzer/networkanalyzer.h | 77 | ||||
-rw-r--r-- | src/mainview.cpp | 31 | ||||
-rw-r--r-- | src/mainview.h | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 56 | ||||
-rw-r--r-- | src/mainwindow.h | 6 | ||||
-rw-r--r-- | src/networkaccessmanager.cpp | 15 | ||||
-rw-r--r-- | src/networkaccessmanager.h | 5 | ||||
-rw-r--r-- | src/sessionmanager.cpp | 33 | ||||
-rw-r--r-- | src/sessionmanager.h | 2 | ||||
-rw-r--r-- | src/settings/settings_adblock.ui | 2 | ||||
-rw-r--r-- | src/settings/settings_fonts.ui | 178 | ||||
-rw-r--r-- | src/settings/settings_general.ui | 47 | ||||
-rw-r--r-- | src/settings/settings_tabs.ui | 36 | ||||
-rw-r--r-- | src/settings/settings_webkit.ui | 36 | ||||
-rw-r--r-- | src/tabbar.cpp | 5 | ||||
-rw-r--r-- | src/urlbar/completionwidget.cpp | 2 | ||||
-rw-r--r-- | src/webpage.cpp | 27 | ||||
-rw-r--r-- | src/webpage.h | 5 |
23 files changed, 806 insertions, 136 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d194c1e..41be2608 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ PROJECT( rekonq ) # Informations to update before to release this package. # rekonq info -SET(REKONQ_VERSION "0.4.67" ) +SET(REKONQ_VERSION "0.4.68" ) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a6055ce7..6926630e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -54,6 +54,9 @@ SET( rekonq_KDEINIT_SRCS urlbar/urlresolver.cpp urlbar/listitem.cpp urlbar/rsswidget.cpp + #---------------------------------------- + analyzer/analyzerpanel.cpp + analyzer/networkanalyzer.cpp ) @@ -78,6 +81,7 @@ INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/history ${CMAKE_CURRENT_SOURCE_DIR}/rekonqpage ${CMAKE_CURRENT_SOURCE_DIR}/settings + ${CMAKE_CURRENT_SOURCE_DIR}/analyzer ${CMAKE_CURRENT_BINARY_DIR} ${KDE4_INCLUDES} ${QT4_INCLUDES} diff --git a/src/analyzer/analyzerpanel.cpp b/src/analyzer/analyzerpanel.cpp new file mode 100644 index 00000000..be346300 --- /dev/null +++ b/src/analyzer/analyzerpanel.cpp @@ -0,0 +1,103 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Matthieu Gicquel <matgic78 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 "analyzerpanel.h" +#include "analyzerpanel.moc" + +// Local Includes +#include "networkanalyzer.h" +#include "networkaccessmanager.h" +#include "webtab.h" +#include "webview.h" +#include "webpage.h" + +// KDE Includes +#include "KAction" + + +NetworkAnalyzerPanel::NetworkAnalyzerPanel(const QString &title, QWidget *parent) + : QDockWidget(title, parent) + , _viewer(new NetworkAnalyzer(this)) +{ + setObjectName("networkAnalyzerDock"); + setWidget(_viewer); +} + + +NetworkAnalyzerPanel::~NetworkAnalyzerPanel() +{ + delete _viewer; +} + + +void NetworkAnalyzerPanel::closeEvent(QCloseEvent *event) +{ + Q_UNUSED(event); + toggle(false); +} + + +MainWindow* NetworkAnalyzerPanel::mainWindow() +{ + return qobject_cast< MainWindow* >(parentWidget()); +} + + +void NetworkAnalyzerPanel::toggle(bool enable) +{ + mainWindow()->actionByName("net_analyzer")->setChecked(enable); + WebPage *page = mainWindow()->currentTab()->page(); + NetworkAccessManager *manager = qobject_cast<NetworkAccessManager *>(page->networkAccessManager()); + + if (enable) + { + connect(page, SIGNAL(loadStarted()), _viewer, SLOT(clear())); + connect(manager, SIGNAL(networkData(QNetworkAccessManager::Operation, const QNetworkRequest &, QNetworkReply *)), + _viewer, SLOT(addRequest(QNetworkAccessManager::Operation, const QNetworkRequest &, QNetworkReply *) ) ); + + +// mainWindow()->currentTab()->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); +// findChild<QWebInspector *>()->setPage(mainWindow()->currentTab()->page()); + show(); + } + else + { + disconnect(page, SIGNAL(loadStarted()), _viewer, SLOT(clear())); + disconnect(manager, SIGNAL(networkData(QNetworkAccessManager::Operation, const QNetworkRequest &, QNetworkReply *)), + _viewer, SLOT(addRequest(QNetworkAccessManager::Operation, const QNetworkRequest &, QNetworkReply *) ) ); + + hide(); +// mainWindow()->currentTab()->view()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false); + } +} + + +void NetworkAnalyzerPanel::changeCurrentPage() +{ + bool enable = mainWindow()->currentTab()->view()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled); + toggle(enable); +} diff --git a/src/analyzer/analyzerpanel.h b/src/analyzer/analyzerpanel.h new file mode 100644 index 00000000..d98206f1 --- /dev/null +++ b/src/analyzer/analyzerpanel.h @@ -0,0 +1,69 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 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 ANALYZER_PANEL_H +#define ANALYZER_PANEL_H + + +// Rekonq Includes +#include "rekonq_defines.h" + +// Local Includes +#include "mainwindow.h" + +// Qt Includes +#include <QDockWidget> + +// Forward Declarations +class NetworkAnalyzer; + + +/** + Docked network analyzer + behaviour : hide/show by tab, not globally +*/ +class REKONQ_TESTS_EXPORT NetworkAnalyzerPanel : public QDockWidget +{ + Q_OBJECT +public: + NetworkAnalyzerPanel(const QString &title, QWidget *parent); + ~NetworkAnalyzerPanel(); + + +public slots: + void toggle(bool enable); + void changeCurrentPage(); + +protected: + virtual void closeEvent(QCloseEvent *event); + + MainWindow *mainWindow(); + +private: + NetworkAnalyzer *_viewer; +}; + +#endif // NET_ANALYZER_PANEL_H diff --git a/src/analyzer/networkanalyzer.cpp b/src/analyzer/networkanalyzer.cpp new file mode 100644 index 00000000..53972a9c --- /dev/null +++ b/src/analyzer/networkanalyzer.cpp @@ -0,0 +1,199 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2009, 2010 by Richard J. Moore <rich@kde.org> +* Copyright (C) 2010 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 "networkanalyzer.h" +#include "networkanalyzer.moc" + +// KDE Includes +#include <klocalizedstring.h> +#include <KPassivePopup> + +// Qt Includes +#include <QtGui/QTreeWidget> +#include <QtGui/QVBoxLayout> +#include <QtGui/QHeaderView> +#include <QtGui/QLabel> + +#include <QSignalMapper> + + +NetworkAnalyzer::NetworkAnalyzer(QWidget *parent) + : QWidget(parent) + , _mapper(new QSignalMapper(this)) + , _requestList(new QTreeWidget(this)) +{ + QStringList headers; + headers << i18n("Method") << i18n("Url") << i18n("Response") << i18n("Length") << i18n("Content Type") << i18n("Info"); + _requestList->setHeaderLabels( headers ); + + _requestList->header()->setResizeMode(0, QHeaderView::ResizeToContents); + _requestList->header()->setResizeMode(1, QHeaderView::Stretch); + _requestList->header()->setResizeMode(2, QHeaderView::ResizeToContents); + _requestList->header()->setResizeMode(3, QHeaderView::ResizeToContents); + _requestList->header()->setResizeMode(4, QHeaderView::ResizeToContents); + + _requestList->setAlternatingRowColors(true); + + QVBoxLayout *lay = new QVBoxLayout(this); + lay->addWidget( _requestList ); + + connect( _mapper, SIGNAL(mapped(QObject *)), this, SLOT(requestFinished(QObject *)) ); + + connect( _requestList, SIGNAL(itemDoubleClicked( QTreeWidgetItem*, int ) ), this, SLOT( showItemDetails( QTreeWidgetItem *) ) ); +} + + +NetworkAnalyzer::~NetworkAnalyzer() +{ +} + + +void NetworkAnalyzer::addRequest( QNetworkAccessManager::Operation op, const QNetworkRequest &req, QNetworkReply *reply ) +{ + // Add to list of requests + QStringList cols; + switch( op ) + { + case QNetworkAccessManager::HeadOperation: + cols << QL1S("HEAD"); + break; + case QNetworkAccessManager::GetOperation: + cols << QL1S("GET"); + break; + case QNetworkAccessManager::PutOperation: + cols << QL1S("PUT"); + break; + case QNetworkAccessManager::PostOperation: + cols << QL1S("POST"); + break; + default: + kDebug() << "Unknown network operation"; + } + cols << req.url().toString(); + cols << i18n("Pending"); + + QTreeWidgetItem *item = new QTreeWidgetItem( cols ); + _requestList->addTopLevelItem( item ); + + // Add to maps + _requestMap.insert( reply, req ); + _itemMap.insert( reply, item ); + _itemRequestMap.insert( item, req ); + + _mapper->setMapping( reply, reply ); + connect( reply, SIGNAL( finished() ), _mapper, SLOT( map() ) ); +} + + +void NetworkAnalyzer::clear() +{ + _requestMap.clear(); + _itemMap.clear(); + _itemReplyMap.clear(); + _itemRequestMap.clear(); + _requestList->clear(); +} + + +void NetworkAnalyzer::requestFinished( QObject *replyObject ) +{ + QNetworkReply *reply = qobject_cast<QNetworkReply *>( replyObject ); + if ( !reply ) { + kDebug() << "Failed to downcast reply"; + return; + } + + QTreeWidgetItem *item = _itemMap[reply]; + + // Record the reply headers + QList<QByteArray> headerValues; + foreach(const QByteArray &header, reply->rawHeaderList() ) + { + headerValues += reply->rawHeader( header ); + } + + QPair< QList<QByteArray>, QList<QByteArray> > replyHeaders; + replyHeaders.first = reply->rawHeaderList(); + replyHeaders.second = headerValues; + _itemReplyMap[item] = replyHeaders; + + // Display the request + int status = reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ).toInt(); + QString reason = reply->attribute( QNetworkRequest::HttpReasonPhraseAttribute ).toString(); + item->setText( 2, i18n("%1 %2", status, reason) ); + + QString length = reply->header( QNetworkRequest::ContentLengthHeader ).toString(); + item->setText( 3, length ); + + QString contentType = reply->header( QNetworkRequest::ContentTypeHeader ).toString(); + item->setText( 4, contentType ); + + if ( status == 302 ) { + QUrl target = reply->attribute( QNetworkRequest::RedirectionTargetAttribute ).toUrl(); + item->setText( 5, i18n("Redirect: %1", target.toString() ) ); + } +} + + +void NetworkAnalyzer::showItemDetails( QTreeWidgetItem *item ) +{ + // Show request details + QString details; + + QNetworkRequest req = _itemRequestMap[item]; + details += QL1S("<h3>Request Details</h3>"); + details += QL1S("<ul>"); + foreach(const QByteArray &header, req.rawHeaderList() ) + { + details += QL1S("<li>"); + details += QL1S( header ); + details += QL1S(": "); + details += QL1S( req.rawHeader( header ) ); + details += QL1S("</li>"); + } + details += QL1S("</ul>"); + + QPair< QList<QByteArray>, QList<QByteArray> > replyHeaders = _itemReplyMap[item]; + details += QL1S("<h3>Response Details</h3>"); + details += QL1S("<ul>"); + for ( int i = 0; i < replyHeaders.first.count(); i++ ) + { + details += QL1S("<li>"); + details += QL1S( replyHeaders.first[i] ); + details += QL1S(": "); + details += QL1S( replyHeaders.second[i] ); + details += QL1S("</li>"); + } + details += QL1S("</ul>"); + +// QLabel *label = new QLabel(details, this); +// KPassivePopup *popup = new KPassivePopup(this); +// popup->setView(label); +// popup->show(_requestList->mapToGlobal(_requestList->pos())); + KPassivePopup::message(details,this); +} diff --git a/src/analyzer/networkanalyzer.h b/src/analyzer/networkanalyzer.h new file mode 100644 index 00000000..9e38663f --- /dev/null +++ b/src/analyzer/networkanalyzer.h @@ -0,0 +1,77 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2009, 2010 by Richard J. Moore <rich@kde.org> +* Copyright (C) 2010 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 NETWORK_ANALYZER_H +#define NETWORK_ANALYZER_H + + +// Rekonq Includes +#include "rekonq_defines.h" + +// Qt Includes +#include <QtCore/QMap> +#include <QtCore/QList> + +#include <QtGui/QWidget> + +#include <QtNetwork/QNetworkAccessManager> +#include <QtNetwork/QNetworkReply> +#include <QtNetwork/QNetworkRequest> + +// Forward Declarations +class QTreeWidgetItem; +class QSignalMapper; +class QTreeWidget; + + +class NetworkAnalyzer : public QWidget +{ + Q_OBJECT + +public: + NetworkAnalyzer(QWidget *parent = 0); + ~NetworkAnalyzer(); + +private slots: + void addRequest( QNetworkAccessManager::Operation op, const QNetworkRequest &req, QNetworkReply *reply ); + + void clear(); + void requestFinished( QObject *replyObject ); + void showItemDetails( QTreeWidgetItem *item ); + +private: + QMap<QNetworkReply *, QNetworkRequest> _requestMap; + QMap<QTreeWidgetItem *, QNetworkRequest> _itemRequestMap; + QMap<QNetworkReply *, QTreeWidgetItem *> _itemMap; + QMap<QTreeWidgetItem *, QPair< QList<QByteArray>, QList<QByteArray> > > _itemReplyMap; + + QSignalMapper *_mapper; + QTreeWidget *_requestList; +}; + +#endif // NETWORK_ANALYZER_H diff --git a/src/mainview.cpp b/src/mainview.cpp index 6179af80..84b87956 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -109,6 +109,18 @@ MainView::~MainView() void MainView::postLaunch() { + QStringList list = Application::sessionManager()->closedSites(); + foreach(const QString &line, list) + { + if(line.startsWith( QL1S("about") )) + break; + QString title = line; + QString url = title; + HistoryItem item(url, QDateTime::currentDateTime(), title); + m_recentlyClosedTabs.removeAll(item); + m_recentlyClosedTabs.prepend(item); + } + // Session Manager connect(this, SIGNAL(tabsChanged()), Application::sessionManager(), SLOT(saveSession())); @@ -493,8 +505,7 @@ void MainView::closeTab(int index, bool del) return; } - // store close tab except homepage - if (!tab->url().prettyUrl().startsWith(QL1S("about:")) && !tab->url().isEmpty()) + if (!tab->url().isEmpty()) { QString title = tab->view()->title(); QString url = tab->url().prettyUrl(); @@ -637,6 +648,22 @@ void MainView::previousTab() setCurrentIndex(next); } +void MainView::openClosedTabs() +{ + foreach (const HistoryItem &item, recentlyClosedTabs()) + { + Application::instance()->loadUrl( KUrl(item.url), Rekonq::SettingOpenTab); + } +} + +void MainView::openClosedTab() +{ + KAction *action = qobject_cast<KAction *>(sender()); + if (action) + { + Application::instance()->loadUrl(action->data().toUrl(), Rekonq::SettingOpenTab); + } +} QLabel *MainView::animatedLoading(int index, bool addMovie) { diff --git a/src/mainview.h b/src/mainview.h index eb5b3e02..6edccc15 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -132,6 +132,8 @@ public slots: void nextTab(); void previousTab(); void detachTab(int index = -1); + void openClosedTabs(); + void openClosedTab(); // WEB slot actions void webReload(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a598128b..128648bf 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -47,6 +47,7 @@ #include "urlbar.h" #include "tabbar.h" #include "adblockmanager.h" +#include "analyzerpanel.h" // Ui Includes #include "ui_cleardata.h" @@ -99,6 +100,7 @@ MainWindow::MainWindow() , m_historyPanel(0) , m_bookmarksPanel(0) , m_webInspectorPanel(0) + , m_analyzerPanel(0) , m_historyBackMenu(0) , m_encodingMenu(new KMenu(this)) , m_mainBar(new KToolBar(QString("MainToolBar"), this, Qt::TopToolBarArea, true, true, true)) @@ -391,6 +393,16 @@ void MainWindow::setupActions() a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev()); actionCollection()->addAction(QL1S("show_prev_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab())); + + a = new KAction(KIcon("tab-new"), i18n("Open Closed Tabs"), this); + a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_T)); + actionCollection()->addAction(QL1S("open_closed_tabs"), a); + connect(a, SIGNAL(triggered(bool)), m_view, SLOT(openClosedTabs())); + + // Closed Tabs Menu + KActionMenu *closedTabsMenu = new KActionMenu(KIcon("tab-new"), i18n("Closed Tabs"), this); + closedTabsMenu->setDelayed(false); + actionCollection()->addAction(QL1S("closed_tab_menu"), closedTabsMenu); // ============================== Indexed Tab Actions ==================================== a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); @@ -494,9 +506,10 @@ void MainWindow::setupTools() toolsMenu->addSeparator(); - KActionMenu *webMenu = new KActionMenu(KIcon("applications-development-web"), i18n("Web Development"), this); + KActionMenu *webMenu = new KActionMenu(KIcon("applications-development-web"), i18n("Development"), this); webMenu->addAction(actionByName(QL1S("web_inspector"))); webMenu->addAction(actionByName(QL1S("page_source"))); + webMenu->addAction(actionByName(QL1S("net_analyzer"))); toolsMenu->addAction(webMenu); toolsMenu->addSeparator(); @@ -565,6 +578,19 @@ void MainWindow::setupPanels() addDockWidget(Qt::BottomDockWidgetArea, m_webInspectorPanel); m_webInspectorPanel->hide(); + + // STEP 4 + // Setup Network analyzer panel + m_analyzerPanel = new NetworkAnalyzerPanel( i18n("Network Analyzer"), this); + connect(mainView(), SIGNAL(currentChanged(int)), m_analyzerPanel, SLOT(changeCurrentPage())); + + a = new KAction(KIcon("document-edit-decrypt-verify"), i18n("Network Analyzer"), this); + a->setCheckable(true); + actionCollection()->addAction(QL1S("net_analyzer"), a); + connect(a, SIGNAL(triggered(bool)), this, SLOT(enableNetworkAnalysis(bool))); + + addDockWidget(Qt::BottomDockWidgetArea, m_analyzerPanel); + m_analyzerPanel->hide(); } @@ -618,6 +644,27 @@ void MainWindow::updateActions() QAction *historyForwardAction = actionByName(KStandardAction::name(KStandardAction::Forward)); historyForwardAction->setEnabled(currentTab()->view()->history()->canGoForward()); + + QAction *openClosedTabsAction = actionByName(QLatin1String("open_closed_tabs")); + openClosedTabsAction->setEnabled(mainView()->recentlyClosedTabs().size() > 0); + + // update closed tabs menu + KActionMenu *am = dynamic_cast<KActionMenu *>(actionByName(QLatin1String("closed_tab_menu"))); + if (!am) + return; + + am->setEnabled(mainView()->recentlyClosedTabs().size() > 0); + + if (am->menu()) + am->menu()->clear(); + + foreach (HistoryItem item, mainView()->recentlyClosedTabs()) + { + KAction *a = new KAction(Application::icon(item.url), item.title, this); + a->setData(item.url); + connect(a, SIGNAL(triggered()), m_view, SLOT(openClosedTab())); + am->addAction(a); + } } @@ -1262,3 +1309,10 @@ void MainWindow::populateEncodingMenu() action->setChecked(true); } } + + +void MainWindow::enableNetworkAnalysis(bool b) +{ + currentTab()->page()->enableNetworkAnalyzer(b); + m_analyzerPanel->toggle(b); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 6ca4cbfb..55e3f8cf 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -47,6 +47,7 @@ class BookmarksPanel; class WebInspectorPanel; class WebTab; class MainView; +class NetworkAnalyzerPanel; class KAction; class KPassivePopup; @@ -159,6 +160,8 @@ private slots: void setEncoding(QAction *); void populateEncodingMenu(); + void enableNetworkAnalysis(bool); + private: MainView *m_view; FindBar *m_findBar; @@ -166,7 +169,8 @@ private: HistoryPanel *m_historyPanel; BookmarksPanel *m_bookmarksPanel; WebInspectorPanel *m_webInspectorPanel; - + NetworkAnalyzerPanel *m_analyzerPanel; + KAction *m_stopReloadAction; KMenu *m_historyBackMenu; KMenu *m_encodingMenu; diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp index 765604dc..e1d2e6eb 100644 --- a/src/networkaccessmanager.cpp +++ b/src/networkaccessmanager.cpp @@ -39,6 +39,9 @@ #include <KLocale> #include <KProtocolManager> +// Qt Includes +#include <QtNetwork/QNetworkReply> + NetworkAccessManager::NetworkAccessManager(QObject *parent) : AccessManager(parent) @@ -53,7 +56,7 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent) } -QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData) +QNetworkReply *NetworkAccessManager::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData) { WebPage *parentPage = qobject_cast<WebPage *>(parent()); @@ -89,9 +92,13 @@ QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkR if (op == QNetworkAccessManager::GetOperation) { reply = Application::adblockManager()->block(req, parentPage); - if (reply) - return reply; } - return AccessManager::createRequest(op, req, outgoingData); + if(!reply) + reply = AccessManager::createRequest(op, req, outgoingData); + + if(parentPage->hasNetworkAnalyzerEnabled()) + emit networkData( op, req, reply ); + + return reply; } diff --git a/src/networkaccessmanager.h b/src/networkaccessmanager.h index aefd1a25..a012f0d5 100644 --- a/src/networkaccessmanager.h +++ b/src/networkaccessmanager.h @@ -50,7 +50,10 @@ public: NetworkAccessManager(QObject *parent); protected: - virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData = 0); + virtual QNetworkReply *createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData = 0); + +signals: + void networkData(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QNetworkReply *reply); private: QByteArray _acceptLanguage; diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp index 0b50791d..6aada509 100644 --- a/src/sessionmanager.cpp +++ b/src/sessionmanager.cpp @@ -106,15 +106,44 @@ bool SessionManager::restoreSession() { line = in.readLine(); kDebug() << "New Window line: " << line; - Application::instance()->loadUrl(line, Rekonq::NewWindow); + Application::instance()->loadUrl( KUrl(line), Rekonq::NewWindow); } else { kDebug() << "New Current Tab line: " << line; - Application::instance()->loadUrl(line, Rekonq::NewCurrentTab); + Application::instance()->loadUrl( KUrl(line), Rekonq::NewCurrentTab); } } while (!line.isEmpty()); return true; } + + +QStringList SessionManager::closedSites() +{ + QStringList list; + + QFile sessionFile(m_sessionFilePath); + if (!sessionFile.exists()) + return list; + if (!sessionFile.open(QFile::ReadOnly)) + { + kDebug() << "Unable to open session file" << sessionFile.fileName(); + return list; + } + + QTextStream in(&sessionFile); + QString line; + do + { + line = in.readLine(); + if (line != QString("window")) + { + list << QString(line); + } + } + while (!line.isEmpty()); + + return list; +} diff --git a/src/sessionmanager.h b/src/sessionmanager.h index 7960fc3e..a446b530 100644 --- a/src/sessionmanager.h +++ b/src/sessionmanager.h @@ -49,6 +49,8 @@ public: ~SessionManager(); bool restoreSession(); + QStringList closedSites(); + private slots: void saveSession(); diff --git a/src/settings/settings_adblock.ui b/src/settings/settings_adblock.ui index 445431c5..bb0b6156 100644 --- a/src/settings/settings_adblock.ui +++ b/src/settings/settings_adblock.ui @@ -55,7 +55,7 @@ <item> <widget class="QLabel" name="label_3"> <property name="text"> - <string>Automatic update interval:</string> + <string>Automatic update interval (days):</string> </property> </widget> </item> diff --git a/src/settings/settings_fonts.ui b/src/settings/settings_fonts.ui index 3f9aa9ef..52c7872e 100644 --- a/src/settings/settings_fonts.ui +++ b/src/settings/settings_fonts.ui @@ -19,30 +19,70 @@ <property name="title"> <string>Fonts</string> </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Standard font:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Fixed font:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="KFontComboBox" name="kcfg_fixedFont"/> - </item> - <item row="0" column="1"> - <widget class="KFontComboBox" name="kcfg_standardFont"/> - </item> - </layout> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Standard font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="KFontComboBox" name="kcfg_standardFont"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Fixed font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="KFontComboBox" name="kcfg_fixedFont"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> </item> </layout> </widget> @@ -52,34 +92,70 @@ <property name="title"> <string>Dimension</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Font size:</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="kcfg_fontSize"/> - </item> - </layout> + <layout class="QFormLayout" name="formLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Font size:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="kcfg_fontSize"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Minimal font size:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout2"> - <item> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Minimal font size:</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="kcfg_minFontSize"/> - </item> - </layout> + <item row="1" column="1"> + <widget class="QSpinBox" name="kcfg_minFontSize"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> </item> </layout> </widget> diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui index eaa91859..ccc3fa20 100644 --- a/src/settings/settings_general.ui +++ b/src/settings/settings_general.ui @@ -19,8 +19,8 @@ <property name="title"> <string>Startup</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> <widget class="QLabel" name="label"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> @@ -30,13 +30,7 @@ </property> <property name="minimumSize"> <size> - <width>120</width> - <height>0</height> - </size> - </property> - <property name="baseSize"> - <size> - <width>0</width> + <width>150</width> <height>0</height> </size> </property> @@ -46,9 +40,12 @@ <property name="text"> <string>When starting rekonq:</string> </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> </widget> </item> - <item> + <item row="0" column="1"> <widget class="KComboBox" name="kcfg_startupBehaviour"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> @@ -81,7 +78,7 @@ <property name="title"> <string>Home Page</string> </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QFormLayout" name="formLayout_2"> <item row="0" column="0"> <widget class="QLabel" name="label_2"> <property name="sizePolicy"> @@ -92,19 +89,16 @@ </property> <property name="minimumSize"> <size> - <width>120</width> - <height>0</height> - </size> - </property> - <property name="baseSize"> - <size> - <width>120</width> + <width>150</width> <height>0</height> </size> </property> <property name="text"> <string>Home page URL:</string> </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> </widget> </item> <item row="0" column="1"> @@ -152,8 +146,8 @@ <property name="title"> <string>Search Engine</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> + <layout class="QFormLayout" name="formLayout_3"> + <item row="0" column="0"> <widget class="QLabel" name="label_3"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> @@ -163,13 +157,7 @@ </property> <property name="minimumSize"> <size> - <width>120</width> - <height>0</height> - </size> - </property> - <property name="baseSize"> - <size> - <width>0</width> + <width>150</width> <height>0</height> </size> </property> @@ -179,9 +167,12 @@ <property name="text"> <string>Default search engine:</string> </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> </widget> </item> - <item> + <item row="0" column="1"> <widget class="KComboBox" name="kcfg_searchEngine"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> diff --git a/src/settings/settings_tabs.ui b/src/settings/settings_tabs.ui index 45579e90..8bc3ae70 100644 --- a/src/settings/settings_tabs.ui +++ b/src/settings/settings_tabs.ui @@ -19,30 +19,21 @@ <property name="title"> <string>New Tabs Behaviour</string> </property> - <layout class="QGridLayout" name="gridLayout_2"> + <layout class="QFormLayout" name="formLayout"> <item row="0" column="0"> <widget class="QLabel" name="label_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="minimumSize"> <size> - <width>120</width> - <height>0</height> - </size> - </property> - <property name="baseSize"> - <size> - <width>120</width> + <width>150</width> <height>0</height> </size> </property> <property name="text"> <string>New tab opens:</string> </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> </widget> </item> <item row="0" column="1"> @@ -75,27 +66,18 @@ </item> <item row="1" column="0"> <widget class="QLabel" name="label_5"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="minimumSize"> <size> - <width>120</width> - <height>0</height> - </size> - </property> - <property name="baseSize"> - <size> - <width>120</width> + <width>150</width> <height>0</height> </size> </property> <property name="text"> <string>New tab page starts with:</string> </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> </widget> </item> <item row="1" column="1"> diff --git a/src/settings/settings_webkit.ui b/src/settings/settings_webkit.ui index 55f34ab3..e87e3fec 100644 --- a/src/settings/settings_webkit.ui +++ b/src/settings/settings_webkit.ui @@ -137,8 +137,8 @@ <property name="title"> <string>Plugin Settings</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> <widget class="QLabel" name="label_2"> <property name="enabled"> <bool>true</bool> @@ -149,13 +149,28 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> <property name="text"> <string>When loading web pages:</string> </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> </widget> </item> - <item> + <item row="0" column="1"> <widget class="KComboBox" name="kcfg_pluginsEnabled"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <item> <property name="text"> <string>Autoload Plugins</string> @@ -181,15 +196,24 @@ <property name="title"> <string>User Style Sheet</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> + <layout class="QFormLayout" name="formLayout_2"> + <item row="0" column="0"> <widget class="QLabel" name="label"> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> <property name="text"> <string>User CSS path:</string> </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> </widget> </item> - <item> + <item row="0" column="1"> <widget class="KUrlRequester" name="kcfg_userCSS"> <property name="filter"> <string>*.css</string> diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 27835892..1274d813 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -279,9 +279,10 @@ void TabBar::contextMenu(int tab, const QPoint &pos) menu.addAction(mainWindow->actionByName( QL1S("new_tab") )); menu.addAction(mainWindow->actionByName( QL1S("clone_tab") )); - if (count() > 1) menu.addAction(mainWindow->actionByName( QL1S("detach_tab") )); + menu.addAction(mainWindow->actionByName( QL1S("open_closed_tabs") )); + menu.addAction(mainWindow->actionByName( QL1S("closed_tab_menu") )); menu.addSeparator(); menu.addAction(mainWindow->actionByName( QL1S("close_tab") )); menu.addAction(mainWindow->actionByName( QL1S("close_other_tabs") )); @@ -299,6 +300,8 @@ void TabBar::emptyAreaContextMenu(const QPoint &pos) MainWindow *mainWindow = Application::instance()->mainWindow(); menu.addAction(mainWindow->actionByName( QL1S("new_tab") )); + menu.addAction(mainWindow->actionByName( QL1S("open_closed_tabs") )); + menu.addAction(mainWindow->actionByName( QL1S("closed_tab_menu") )); menu.addSeparator(); menu.addAction(mainWindow->actionByName( QL1S("reload_all_tabs") )); diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp index 6dae6285..1bb01785 100644 --- a/src/urlbar/completionwidget.cpp +++ b/src/urlbar/completionwidget.cpp @@ -278,5 +278,3 @@ void CompletionWidget::suggestUrls(const QString &text) popup(); } } - - diff --git a/src/webpage.cpp b/src/webpage.cpp index 99a1a6d2..d266b257 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -101,6 +101,7 @@ static bool domainSchemeMatch(const QUrl& u1, const QUrl& u2) WebPage::WebPage(QWidget *parent) : KWebPage(parent, KWalletIntegration) + , _networkAnalyzer(false) { // ----- handling unsupported content... setForwardUnsupportedContent(true); @@ -236,7 +237,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) // NOTE // This is probably needed just in ONE stupid case.. if (_protHandler.postHandling(reply->request(), mainFrame())) - return reply->deleteLater(); + return; // FIXME RE-ENABLE ME reply->deleteLater(); if (reply->error() == QNetworkReply::NoError) { @@ -255,7 +256,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) ? KMessageBox::sorry(view(), i18n("No service can handle this :(")) : downloadRequest(reply->request()); - return reply->deleteLater(); + return; // FIXME RE-ENABLE ME reply->deleteLater(); } if (!isLocal) @@ -267,10 +268,10 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) case KParts::BrowserOpenOrSaveQuestion::Save: kDebug() << "service handling: download!"; downloadRequest(reply->request()); - return reply->deleteLater(); + return; // FIXME RE-ENABLE ME reply->deleteLater(); case KParts::BrowserOpenOrSaveQuestion::Cancel: - return reply->deleteLater(); + return; // FIXME RE-ENABLE ME reply->deleteLater(); default: // non extant case break; @@ -306,7 +307,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) KRun::run(*appService, url, 0); } - return; // FIXME: crash reply->deleteLater(); + return ; // FIXME RE-ENABLE ME reply->deleteLater(); } } @@ -386,7 +387,7 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply) break; } - reply->deleteLater(); + // FIXME RE-ENABLE ME reply->deleteLater(); } @@ -576,8 +577,6 @@ void WebPage::showSSLInfo(QPoint) } - - void WebPage::updateImage(bool ok) { if (ok) @@ -586,3 +585,15 @@ void WebPage::updateImage(bool ok) p.snapFinished(); } } + + +bool WebPage::hasNetworkAnalyzerEnabled() const +{ + return _networkAnalyzer; +} + + +void WebPage::enableNetworkAnalyzer(bool b) +{ + _networkAnalyzer = b; +} diff --git a/src/webpage.h b/src/webpage.h index c729a883..74695f35 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -60,6 +60,9 @@ public: explicit WebPage(QWidget *parent = 0); ~WebPage(); + bool hasNetworkAnalyzerEnabled() const; + void enableNetworkAnalyzer(bool); + public slots: virtual void downloadRequest(const QNetworkRequest &request); void downloadAllContentsWithKGet(QPoint); @@ -84,6 +87,8 @@ private: ProtocolHandler _protHandler; WebSslInfo _sslInfo; + + bool _networkAnalyzer; }; #endif |