From 473540ed565ce6c2f5767e29b956aad0dadf458d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 28 Mar 2009 15:46:46 +0100 Subject: Added QNetworkDiskCache. Thanks to Ben Meyer's Qt Blog post --- TODO | 12 ++++++++---- src/Messages.sh | 4 ---- src/history.cpp | 32 ++++++++++++++++++++++---------- src/mainwindow.cpp | 1 + src/networkaccessmanager.cpp | 12 ++++++++++++ 5 files changed, 43 insertions(+), 18 deletions(-) delete mode 100755 src/Messages.sh diff --git a/TODO b/TODO index ba905862..c9d47122 100644 --- a/TODO +++ b/TODO @@ -1,17 +1,21 @@ To 0.0.5 -DONE(?) definitely fix fonts! -- fix crash on example sites.. DONE tabbar: fixed dimension DONE tabbar: hide if just one DONE bookmarks tabbar update DONE loading right bookmark file DONE Added Google Suggestions +DONE notfound.html shown if rekonq doesn't load connection +DONE improve fullscreen +DONE QNetworkDiskCache +- QWebFrame +DONE(?) definitely fix fonts! +- fix crash on example sites.. - load just ONE site at start - loading right sites as "external browser" - provide translations -DONE notfound.html shown if rekonq doesn't load connection - disable BACK button when history is NULL -DONE improve fullscreen +- improve DOCUMENTATION + To 0.0.4 - improve DOCUMENTATION diff --git a/src/Messages.sh b/src/Messages.sh deleted file mode 100755 index 76d48b4b..00000000 --- a/src/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env bash -$EXTRACTRC `find . -name \*.ui -o -name \*.rc -o -name \*.kcfg` >> rc.cpp -$XGETTEXT `find . -name \*.cpp` -o $podir/rekonq.pot - diff --git a/src/history.cpp b/src/history.cpp index 5023bfd3..5c545b10 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -177,7 +177,6 @@ void HistoryManager::addHistoryItem(const HistoryItem &item) } - void HistoryManager::updateHistoryItem(const KUrl &url, const QString &title) { for (int i = 0; i < m_history.count(); ++i) @@ -493,9 +492,11 @@ bool HistoryModel::removeRows(int row, int count, const QModelIndex &parent) -// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +// ----------------------------------------------------------------------------------------------- + + +#define MOVEDROWS 10 -#define MOVEDROWS 15 /* Maps the first bunch of items of the source model to the root @@ -507,6 +508,7 @@ HistoryMenuModel::HistoryMenuModel(HistoryTreeModel *sourceModel, QObject *paren setSourceModel(sourceModel); } + int HistoryMenuModel::bumpedRows() const { QModelIndex first = m_treeModel->index(0, 0); @@ -515,11 +517,13 @@ int HistoryMenuModel::bumpedRows() const return qMin(m_treeModel->rowCount(first), MOVEDROWS); } + int HistoryMenuModel::columnCount(const QModelIndex &parent) const { return m_treeModel->columnCount(mapToSource(parent)); } + int HistoryMenuModel::rowCount(const QModelIndex &parent) const { if (parent.column() > 0) @@ -546,6 +550,7 @@ int HistoryMenuModel::rowCount(const QModelIndex &parent) const return defaultCount; } + QModelIndex HistoryMenuModel::mapFromSource(const QModelIndex &sourceIndex) const { // currently not used or autotested @@ -554,6 +559,7 @@ QModelIndex HistoryMenuModel::mapFromSource(const QModelIndex &sourceIndex) cons return createIndex(sourceIndex.row(), sourceIndex.column(), sr); } + QModelIndex HistoryMenuModel::mapToSource(const QModelIndex &proxyIndex) const { if (!proxyIndex.isValid()) @@ -573,6 +579,7 @@ QModelIndex HistoryMenuModel::mapToSource(const QModelIndex &proxyIndex) const return treeIndex; } + QModelIndex HistoryMenuModel::index(int row, int column, const QModelIndex &parent) const { if (row < 0 @@ -595,6 +602,7 @@ QModelIndex HistoryMenuModel::index(int row, int column, const QModelIndex &pare return createIndex(row, column, historyRow); } + QModelIndex HistoryMenuModel::parent(const QModelIndex &index) const { int offset = index.internalId(); @@ -613,7 +621,8 @@ QModelIndex HistoryMenuModel::parent(const QModelIndex &index) const } -// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------------------- + HistoryMenu::HistoryMenu(QWidget *parent) : ModelMenu(parent) @@ -680,7 +689,8 @@ void HistoryMenu::setInitialActions(QList actions) } -// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +// -------------------------------------------------------------------------------------------------------------- + TreeProxyModel::TreeProxyModel(QObject *parent) : QSortFilterProxyModel(parent) { @@ -697,7 +707,8 @@ bool TreeProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_ } -// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +// ----------------------------------------------------------------------------------------------------- + HistoryDialog::HistoryDialog(QWidget *parent, HistoryManager *setHistory) : QDialog(parent) { @@ -766,7 +777,7 @@ void HistoryDialog::copy() } -// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +// --------------------------------------------------------------------------------------------------------------- HistoryFilterModel::HistoryFilterModel(QAbstractItemModel *sourceModel, QObject *parent) : QAbstractProxyModel(parent), @@ -954,8 +965,6 @@ void HistoryFilterModel::sourceRowsRemoved(const QModelIndex &, int start, int e } - -// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ /* Removing a continuous block of rows will remove filtered rows too as this is the users intention. @@ -982,6 +991,9 @@ bool HistoryFilterModel::removeRows(int row, int count, const QModelIndex &paren } +// ------------------------------------------------------------------------------------------------------ + + HistoryCompletionModel::HistoryCompletionModel(QObject *parent) : QAbstractProxyModel(parent) { @@ -1082,8 +1094,8 @@ void HistoryCompletionModel::sourceReset() } +// ------------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ HistoryTreeModel::HistoryTreeModel(QAbstractItemModel *sourceModel, QObject *parent) : QAbstractProxyModel(parent) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 54516e78..6f12220f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -236,6 +236,7 @@ void MainWindow::setupActions() m_historyBackMenu = new KMenu(this); historyBack->setMenu(m_historyBackMenu); connect(historyBack, SIGNAL( triggered(bool) ), this, SLOT( slotOpenPrevious() ) ); +// FIXME < --------------------------------------------------------------------------------------------------------------------------------------| connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowBackMenu())); connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); actionCollection()->addAction( QLatin1String("history back"), historyBack); diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp index 882ae4e1..1c426c61 100644 --- a/src/networkaccessmanager.cpp +++ b/src/networkaccessmanager.cpp @@ -55,11 +55,23 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent) SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); connect(this, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)), SLOT(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*))); + #ifndef QT_NO_OPENSSL connect(this, SIGNAL(sslErrors(QNetworkReply*, const QList&)), SLOT(sslErrors(QNetworkReply*, const QList&))); #endif + loadSettings(); + +#if QT_VERSION >= 0x040500 + + QNetworkDiskCache *diskCache = new QNetworkDiskCache(this); + QString location = KStandardDirs::locateLocal("cache","",true); + diskCache->setCacheDirectory(location); + setCache(diskCache); + +#endif + } -- cgit v1.2.1