summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/application.cpp74
-rw-r--r--src/application.h7
-rw-r--r--src/bookmarks.cpp5
-rw-r--r--src/cookiedialog.cpp211
-rw-r--r--src/cookiedialog.h79
-rw-r--r--src/cookieexceptiondialog.cpp270
-rw-r--r--src/cookieexceptiondialog.h94
-rw-r--r--src/cookiejar.cpp581
-rw-r--r--src/cookiejar.h107
-rw-r--r--src/cookies.ui86
-rw-r--r--src/cookiesexceptions.ui203
-rw-r--r--src/download.cpp2
-rw-r--r--src/download.h141
-rw-r--r--src/edittableview.cpp1
-rw-r--r--src/edittreeview.cpp1
-rw-r--r--src/history.cpp140
-rw-r--r--src/history.h57
-rw-r--r--src/history.ui90
-rw-r--r--src/historydialog.cpp129
-rw-r--r--src/historydialog.h57
-rw-r--r--src/historymenu.cpp95
-rw-r--r--src/historymenu.h65
-rw-r--r--src/lineedit.cpp3
-rw-r--r--src/main.cpp4
-rw-r--r--src/mainview.cpp6
-rw-r--r--src/mainwindow.cpp66
-rw-r--r--src/mainwindow.h1
-rw-r--r--src/modelmenu.cpp1
-rw-r--r--src/panelhistory.cpp9
-rw-r--r--src/panelhistory.h6
-rw-r--r--src/searchbar.cpp1
-rw-r--r--src/settings.cpp8
-rw-r--r--src/settings_fonts.ui6
-rw-r--r--src/settings_general.ui4
-rw-r--r--src/settings_privacy.ui2
-rw-r--r--src/settings_webkit.ui16
-rw-r--r--src/stackedurlbar.cpp6
-rw-r--r--src/webpage.cpp1
-rw-r--r--src/webview.cpp1
40 files changed, 1337 insertions, 1304 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 064fc0e6..2ddf1117 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -8,7 +8,8 @@ SET( rekonq_SRCS
edittableview.cpp
edittreeview.cpp
history.cpp
- download.cpp
+ historydialog.cpp
+ historymenu.cpp
bookmarks.cpp
modelmenu.cpp
networkaccessmanager.cpp
@@ -23,6 +24,8 @@ SET( rekonq_SRCS
lineedit.cpp
stackedurlbar.cpp
webpage.cpp
+ cookiedialog.cpp
+ cookieexceptiondialog.cpp
)
KDE4_ADD_UI_FILES( rekonq_SRCS
diff --git a/src/application.cpp b/src/application.cpp
index 5f7892c4..09a8a087 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -34,7 +34,6 @@
#include "networkaccessmanager.h"
#include "mainview.h"
#include "webview.h"
-#include "download.h"
// KDE Includes
#include <KCmdLineArgs>
@@ -52,7 +51,6 @@
QPointer<HistoryManager> Application::s_historyManager;
QPointer<NetworkAccessManager> Application::s_networkAccessManager;
-QPointer<DownloadManager> Application::s_downloadManager;
QPointer<BookmarkProvider> Application::s_bookmarkProvider;
@@ -93,7 +91,7 @@ int Application::newInstance()
{
for (int i = 0; i < args->count(); ++i)
{
- KUrl url = MainWindow::guessUrlFromString(args->arg(i));
+ KUrl url = guessUrlFromString(args->arg(i));
newWebView();
mainWindow()->loadUrl(url);
}
@@ -150,7 +148,7 @@ WebView *Application::newWebView(Rekonq::OpenType type)
CookieJar *Application::cookieJar()
{
- return (CookieJar*)networkAccessManager()->cookieJar();
+ return (CookieJar *)networkAccessManager()->cookieJar();
}
@@ -176,16 +174,6 @@ HistoryManager *Application::historyManager()
}
-DownloadManager *Application::downloadManager()
-{
- if (!s_downloadManager)
- {
- s_downloadManager = new DownloadManager();
- }
- return s_downloadManager;
-}
-
-
BookmarkProvider *Application::bookmarkProvider()
{
if (!s_bookmarkProvider)
@@ -206,3 +194,61 @@ KIcon Application::icon(const KUrl &url) const
return icon;
}
+
+KUrl Application::guessUrlFromString(const QString &string)
+{
+ QString urlStr = string.trimmed();
+ QRegExp test(QLatin1String("^[a-zA-Z]+\\:.*"));
+
+ // Check if it looks like a qualified URL. Try parsing it and see.
+ bool hasSchema = test.exactMatch(urlStr);
+
+ if (hasSchema)
+ {
+ QUrl qurl(urlStr, QUrl::TolerantMode);
+ KUrl url(qurl);
+
+ if (url.isValid())
+ {
+ return url;
+ }
+ }
+
+ // Might be a file.
+ if (QFile::exists(urlStr))
+ {
+ QFileInfo info(urlStr);
+ return KUrl::fromPath(info.absoluteFilePath());
+ }
+
+ // Might be a shorturl - try to detect the schema.
+ if (!hasSchema)
+ {
+ int dotIndex = urlStr.indexOf(QLatin1Char('.'));
+
+ if (dotIndex != -1)
+ {
+ QString prefix = urlStr.left(dotIndex).toLower();
+ QString schema = (prefix == QLatin1String("ftp")) ? prefix : QLatin1String("http");
+ QUrl qurl(schema + QLatin1String("://") + urlStr, QUrl::TolerantMode);
+ KUrl url(qurl);
+
+ if (url.isValid())
+ {
+ return url;
+ }
+ }
+ }
+
+ // Fall back to QUrl's own tolerant parser.
+ QUrl qurl = QUrl(string, QUrl::TolerantMode);
+ KUrl url(qurl);
+
+ // finally for cases where the user just types in a hostname add http
+ if (qurl.scheme().isEmpty())
+ {
+ qurl = QUrl(QLatin1String("http://") + string, QUrl::TolerantMode);
+ url = KUrl(qurl);
+ }
+ return url;
+}
diff --git a/src/application.h b/src/application.h
index e0c7a21c..e61b2a31 100644
--- a/src/application.h
+++ b/src/application.h
@@ -40,7 +40,6 @@ class KIcon;
class KUrl;
class BookmarkProvider;
class CookieJar;
-class DownloadManager;
class HistoryManager;
class MainWindow;
class NetworkAccessManager;
@@ -76,14 +75,15 @@ public:
static Application *instance();
MainWindow *mainWindow();
- WebView* newWebView(Rekonq::OpenType type = Rekonq::Default);
+ WebView *newWebView(Rekonq::OpenType type = Rekonq::Default);
KIcon icon(const KUrl &url) const;
+ static KUrl guessUrlFromString(const QString &url);
+
static HistoryManager *historyManager();
static CookieJar *cookieJar();
static NetworkAccessManager *networkAccessManager();
- static DownloadManager *downloadManager();
static BookmarkProvider *bookmarkProvider();
public slots:
@@ -105,7 +105,6 @@ private slots:
private:
static QPointer<HistoryManager> s_historyManager;
static QPointer<NetworkAccessManager> s_networkAccessManager;
- static QPointer<DownloadManager> s_downloadManager;
static QPointer<BookmarkProvider> s_bookmarkProvider;
QPointer<MainWindow> m_mainWindow;
diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp
index 9490ed0f..bddacab4 100644
--- a/src/bookmarks.cpp
+++ b/src/bookmarks.cpp
@@ -44,8 +44,9 @@
#include <KUrl>
// Qt Includes
-#include <QActionGroup>
-#include <QFile>
+#include <QtCore/QFile>
+#include <QtGui/QActionGroup>
+
BookmarkOwner::BookmarkOwner(QObject *parent)
diff --git a/src/cookiedialog.cpp b/src/cookiedialog.cpp
new file mode 100644
index 00000000..e48d9c02
--- /dev/null
+++ b/src/cookiedialog.cpp
@@ -0,0 +1,211 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 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, or (at your option) any later version.
+*
+* 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.
+*
+* ============================================================ */
+
+
+// Self Includes
+#include "cookiedialog.h"
+#include "cookiedialog.moc"
+
+// Local Includes
+#include "cookiejar.h"
+
+// KDE Includes
+#include <KLocalizedString>
+
+
+CookieModel::CookieModel(CookieJar *cookieJar, QObject *parent)
+ : QAbstractTableModel(parent)
+ , m_cookieJar(cookieJar)
+{
+ connect(m_cookieJar, SIGNAL(cookiesChanged()), this, SLOT(cookiesChanged()));
+}
+
+
+QVariant CookieModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (role == Qt::SizeHintRole)
+ {
+ QFont font;
+ font.setPointSize(10);
+ QFontMetrics fm(font);
+ int height = fm.height() + fm.height() / 3;
+ int width = fm.width(headerData(section, orientation, Qt::DisplayRole).toString());
+ return QSize(width, height);
+ }
+
+ if (orientation == Qt::Horizontal)
+ {
+ if (role != Qt::DisplayRole)
+ return QVariant();
+
+ switch (section)
+ {
+ case 0:
+ return i18n("Website");
+ case 1:
+ return i18n("Name");
+ case 2:
+ return i18n("Path");
+ case 3:
+ return i18n("Secure");
+ case 4:
+ return i18n("Expires");
+ case 5:
+ return i18n("Contents");
+ default:
+ return QVariant();
+ }
+ }
+ return QAbstractTableModel::headerData(section, orientation, role);
+}
+
+
+QVariant CookieModel::data(const QModelIndex &index, int role) const
+{
+ QList<QNetworkCookie> lst;
+ if (m_cookieJar)
+ lst = m_cookieJar->allCookies();
+ if (index.row() < 0 || index.row() >= lst.size())
+ return QVariant();
+
+ switch (role)
+ {
+ case Qt::DisplayRole:
+ case Qt::EditRole:
+ {
+ QNetworkCookie cookie = lst.at(index.row());
+ switch (index.column())
+ {
+ case 0:
+ return cookie.domain();
+ case 1:
+ return cookie.name();
+ case 2:
+ return cookie.path();
+ case 3:
+ return cookie.isSecure();
+ case 4:
+ return cookie.expirationDate();
+ case 5:
+ return cookie.value();
+ }
+ }
+ case Qt::FontRole:
+ {
+ QFont font;
+ font.setPointSize(10);
+ return font;
+ }
+ }
+
+ return QVariant();
+}
+
+
+int CookieModel::columnCount(const QModelIndex &parent) const
+{
+ return (parent.isValid()) ? 0 : 6;
+}
+
+
+int CookieModel::rowCount(const QModelIndex &parent) const
+{
+ return (parent.isValid() || !m_cookieJar) ? 0 : m_cookieJar->allCookies().count();
+}
+
+
+bool CookieModel::removeRows(int row, int count, const QModelIndex &parent)
+{
+ if (parent.isValid() || !m_cookieJar)
+ return false;
+ int lastRow = row + count - 1;
+ beginRemoveRows(parent, row, lastRow);
+ QList<QNetworkCookie> lst = m_cookieJar->allCookies();
+ for (int i = lastRow; i >= row; --i)
+ {
+ lst.removeAt(i);
+ }
+ m_cookieJar->setAllCookies(lst);
+ endRemoveRows();
+ return true;
+}
+
+
+void CookieModel::cookiesChanged()
+{
+ reset();
+}
+
+
+// ---------------------------------------------------------------------------------------
+
+
+// Ui Includes
+#include "ui_cookies.h"
+
+// Qt Includes
+#include <QtCore/QRect>
+#include <QtCore/QSize>
+
+#include <QtGui/QDesktopWidget>
+
+
+CookiesDialog::CookiesDialog(CookieJar *cookieJar, QWidget *parent)
+ : KDialog(parent)
+{
+ setWindowFlags(Qt::Sheet);
+ setCaption("Cookies");
+ setButtons( KDialog::Close );
+
+ Ui::CookiesWidget *cookieWidget = new Ui::CookiesWidget;
+ QWidget *widget = new QWidget(this);
+ cookieWidget->setupUi(widget);
+ setMainWidget(widget);
+
+ CookieModel *model = new CookieModel(cookieJar, this);
+ m_proxyModel = new QSortFilterProxyModel(this);
+
+ // connecting signals and slots
+ connect(cookieWidget->search, SIGNAL(textChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString)));
+ connect(cookieWidget->removeButton, SIGNAL(clicked()), cookieWidget->cookiesTable, SLOT(removeOne()));
+ connect(cookieWidget->removeAllButton, SIGNAL(clicked()), cookieWidget->cookiesTable, SLOT(removeAll()));
+
+ m_proxyModel->setSourceModel(model);
+
+ cookieWidget->cookiesTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ cookieWidget->cookiesTable->verticalHeader()->hide();
+ cookieWidget->cookiesTable->setSelectionBehavior(QAbstractItemView::SelectRows);
+ cookieWidget->cookiesTable->setModel(m_proxyModel);
+ cookieWidget->cookiesTable->setAlternatingRowColors(true);
+ cookieWidget->cookiesTable->setTextElideMode(Qt::ElideMiddle);
+ cookieWidget->cookiesTable->setShowGrid(false);
+ cookieWidget->cookiesTable->setSortingEnabled(true);
+
+ // Fixing header dimension
+ QHeaderView *headerView = cookieWidget->cookiesTable->horizontalHeader();
+ headerView->setResizeMode(QHeaderView::Stretch);
+}
+
+
+QSize CookiesDialog::sizeHint() const
+{
+ QRect desktopRect = QApplication::desktop()->screenGeometry();
+ QSize size = desktopRect.size() * 0.8;
+ return size;
+}
diff --git a/src/cookiedialog.h b/src/cookiedialog.h
new file mode 100644
index 00000000..e1b17356
--- /dev/null
+++ b/src/cookiedialog.h
@@ -0,0 +1,79 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 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, or (at your option) any later version.
+*
+* 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.
+*
+* ============================================================ */
+
+
+
+#ifndef COOKIEDIALOG_H
+#define COOKIEDIALOG_H
+
+// Local Includes
+#include "cookiejar.h"
+
+// KDE Includes
+#include <KDialog>
+
+// Qt Includes
+#include <QtCore/QStringList>
+#include <QtCore/QAbstractItemModel>
+
+#include <QtGui/QTableView>
+#include <QtGui/QSortFilterProxyModel>
+
+#include <QtNetwork/QNetworkCookieJar>
+
+
+class CookieModel : public QAbstractTableModel
+{
+ Q_OBJECT
+
+public:
+ explicit CookieModel(CookieJar *jar, QObject *parent = 0);
+
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
+
+private slots:
+ void cookiesChanged();
+
+private:
+ CookieJar *m_cookieJar;
+};
+
+
+
+// -----------------------------------------------------------------------------------------------------------------
+
+
+class CookiesDialog : public KDialog
+{
+ Q_OBJECT
+
+public:
+ explicit CookiesDialog(CookieJar *cookieJar, QWidget *parent = 0);
+
+ QSize sizeHint() const;
+
+private:
+ QSortFilterProxyModel *m_proxyModel;
+};
+
+#endif
diff --git a/src/cookieexceptiondialog.cpp b/src/cookieexceptiondialog.cpp
new file mode 100644
index 00000000..b4ad555f
--- /dev/null
+++ b/src/cookieexceptiondialog.cpp
@@ -0,0 +1,270 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 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, or (at your option) any later version.
+*
+* 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.
+*
+* ============================================================ */
+
+
+// Self Includes
+#include "cookieexceptiondialog.h"
+#include "cookieexceptiondialog.moc"
+
+// Local Includes
+
+// Qt Includes
+#include <QtGui/QSortFilterProxyModel>
+
+
+CookieExceptionsModel::CookieExceptionsModel(CookieJar *cookiejar, QObject *parent)
+ : QAbstractTableModel(parent)
+ , m_cookieJar(cookiejar)
+{
+ m_allowedCookies = m_cookieJar->allowedCookies();
+ m_blockedCookies = m_cookieJar->blockedCookies();
+ m_sessionCookies = m_cookieJar->allowForSessionCookies();
+}
+
+
+QVariant CookieExceptionsModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (role == Qt::SizeHintRole)
+ {
+ QFont font;
+ font.setPointSize(10);
+ QFontMetrics fm(font);
+ int height = fm.height() + fm.height() / 3;
+ int width = fm.width(headerData(section, orientation, Qt::DisplayRole).toString());
+ return QSize(width, height);
+ }
+
+ if (orientation == Qt::Horizontal
+ && role == Qt::DisplayRole)
+ {
+ switch (section)
+ {
+ case 0:
+ return i18n("Website");
+ case 1:
+ return i18n("Status");
+ }
+ }
+ return QAbstractTableModel::headerData(section, orientation, role);
+}
+
+
+QVariant CookieExceptionsModel::data(const QModelIndex &index, int role) const
+{
+ if (index.row() < 0 || index.row() >= rowCount())
+ return QVariant();
+
+ switch (role)
+ {
+ case Qt::DisplayRole:
+ case Qt::EditRole:
+ {
+ int row = index.row();
+ if (row < m_allowedCookies.count())
+ {
+ switch (index.column())
+ {
+ case 0:
+ return m_allowedCookies.at(row);
+ case 1:
+ return i18n("Allow");
+ }
+ }
+ row = row - m_allowedCookies.count();
+ if (row < m_blockedCookies.count())
+ {
+ switch (index.column())
+ {
+ case 0:
+ return m_blockedCookies.at(row);
+ case 1:
+ return i18n("Block");
+ }
+ }
+ row = row - m_blockedCookies.count();
+ if (row < m_sessionCookies.count())
+ {
+ switch (index.column())
+ {
+ case 0:
+ return m_sessionCookies.at(row);
+ case 1:
+ return i18n("Allow For Session");
+ }
+ }
+ }
+ case Qt::FontRole:
+ {
+ QFont font;
+ font.setPointSize(10);
+ return font;
+ }
+ }
+ return QVariant();
+}
+
+
+int CookieExceptionsModel::columnCount(const QModelIndex &parent) const
+{
+ return (parent.isValid()) ? 0 : 2;
+}
+
+
+int CookieExceptionsModel::rowCount(const QModelIndex &parent) const
+{
+ return (parent.isValid() || !m_cookieJar) ? 0 : m_allowedCookies.count() + m_blockedCookies.count() + m_sessionCookies.count();
+}
+
+
+bool CookieExceptionsModel::removeRows(int row, int count, const QModelIndex &parent)
+{
+ if (parent.isValid() || !m_cookieJar)
+ return false;
+
+ int lastRow = row + count - 1;
+ beginRemoveRows(parent, row, lastRow);
+ for (int i = lastRow; i >= row; --i)
+ {
+ if (i < m_allowedCookies.count())
+ {
+ m_allowedCookies.removeAt(row);
+ continue;
+ }
+ i = i - m_allowedCookies.count();
+ if (i < m_blockedCookies.count())
+ {
+ m_blockedCookies.removeAt(row);
+ continue;
+ }
+ i = i - m_blockedCookies.count();
+ if (i < m_sessionCookies.count())
+ {
+ m_sessionCookies.removeAt(row);
+ continue;
+ }
+ }
+ m_cookieJar->setAllowedCookies(m_allowedCookies);
+ m_cookieJar->setBlockedCookies(m_blockedCookies);
+ m_cookieJar->setAllowForSessionCookies(m_sessionCookies);
+ endRemoveRows();
+ return true;
+}
+
+
+
+
+// ----------------------------------------------------------------------------------------------------------------
+
+
+// Qt Includes
+#include <QtCore/QRect>
+#include <QtCore/QSize>
+
+#include <QtGui/QDesktopWidget>
+#include <QtGui/QHeaderView>
+
+
+CookiesExceptionsDialog::CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *parent)
+ : KDialog(parent)
+ , m_cookieJar(cookieJar)
+ , m_exceptionsWidget(new Ui::CookiesExceptionsWidget)
+{
+ setWindowFlags(Qt::Sheet);
+ setCaption("Cookies Exceptions");
+ setButtons( KDialog::Close );
+
+ QWidget *widget = new QWidget(this);
+ m_exceptionsWidget->setupUi(widget);
+ setMainWidget(widget);
+
+ connect(m_exceptionsWidget->removeButton, SIGNAL(clicked()), m_exceptionsWidget->exceptionTable, SLOT(removeOne()));
+ connect(m_exceptionsWidget->removeAllButton, SIGNAL(clicked()), m_exceptionsWidget->exceptionTable, SLOT(removeAll()));
+
+ m_exceptionsWidget->exceptionTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_exceptionsWidget->exceptionTable->verticalHeader()->hide();
+ m_exceptionsWidget->exceptionTable->setSelectionBehavior(QAbstractItemView::SelectRows);
+ m_exceptionsWidget->exceptionTable->setAlternatingRowColors(true);
+ m_exceptionsWidget->exceptionTable->setTextElideMode(Qt::ElideMiddle);
+ m_exceptionsWidget->exceptionTable->setShowGrid(false);
+ m_exceptionsWidget->exceptionTable->setSortingEnabled(true);
+ m_exceptionsModel = new CookieExceptionsModel(cookieJar, this);
+ m_proxyModel = new QSortFilterProxyModel(this);
+ m_proxyModel->setSourceModel(m_exceptionsModel);
+
+ connect(m_exceptionsWidget->search, SIGNAL(textChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString)));
+
+ m_exceptionsWidget->exceptionTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_exceptionsWidget->exceptionTable->setModel(m_proxyModel);
+
+ connect(m_exceptionsWidget->domainLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &)));
+ connect(m_exceptionsWidget->blockButton, SIGNAL(clicked()), this, SLOT(block()));
+ connect(m_exceptionsWidget->allowButton, SIGNAL(clicked()), this, SLOT(allow()));
+ connect(m_exceptionsWidget->allowForSessionButton, SIGNAL(clicked()), this, SLOT(allowForSession()));
+
+ // Fixing header dimension
+ QHeaderView *headerView = m_exceptionsWidget->exceptionTable->horizontalHeader();
+ headerView->setResizeMode(QHeaderView::Stretch);
+}
+
+
+void CookiesExceptionsDialog::textChanged(const QString &text)
+{
+ bool enabled = !text.isEmpty();
+ m_exceptionsWidget->blockButton->setEnabled(enabled);
+ m_exceptionsWidget->allowButton->setEnabled(enabled);
+ m_exceptionsWidget->allowForSessionButton->setEnabled(enabled);
+}
+
+
+void CookiesExceptionsDialog::block()
+{
+ if (m_exceptionsWidget->domainLineEdit->text().isEmpty())
+ return;
+ m_exceptionsModel->m_blockedCookies.append(m_exceptionsWidget->domainLineEdit->text());
+ m_cookieJar->setBlockedCookies(m_exceptionsModel->m_blockedCookies);
+ m_exceptionsModel->reset();
+}
+
+
+void CookiesExceptionsDialog::allow()
+{
+ if (m_exceptionsWidget->domainLineEdit->text().isEmpty())
+ return;
+ m_exceptionsModel->m_allowedCookies.append(m_exceptionsWidget->domainLineEdit->text());
+ m_cookieJar->setAllowedCookies(m_exceptionsModel->m_allowedCookies);
+ m_exceptionsModel->reset();
+}
+
+
+void CookiesExceptionsDialog::allowForSession()
+{
+ if (m_exceptionsWidget->domainLineEdit->text().isEmpty())
+ return;
+ m_exceptionsModel->m_sessionCookies.append(m_exceptionsWidget->domainLineEdit->text());
+ m_cookieJar->setAllowForSessionCookies(m_exceptionsModel->m_sessionCookies);
+ m_exceptionsModel->reset();
+}
+
+
+QSize CookiesExceptionsDialog::sizeHint() const
+{
+ QRect desktopRect = QApplication::desktop()->screenGeometry();
+ QSize size = desktopRect.size() * 0.6;
+ return size;
+}
diff --git a/src/cookieexceptiondialog.h b/src/cookieexceptiondialog.h
new file mode 100644
index 00000000..eb0608d1
--- /dev/null
+++ b/src/cookieexceptiondialog.h
@@ -0,0 +1,94 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 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, or (at your option) any later version.
+*
+* 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.
+*
+* ============================================================ */
+
+
+#ifndef COOKIEEXCEPTIONDIALOG_H
+#define COOKIEEXCEPTIONDIALOG_H
+
+
+// Local Includes
+#include "cookiejar.h"
+
+// Qt Includes
+#include <QtCore/QAbstractTableModel>
+
+// Forward Declarations
+class QString;
+class QStringList;
+class QModelIndex;
+class QVariant;
+
+class CookieExceptionsModel : public QAbstractTableModel
+{
+ Q_OBJECT
+ friend class CookiesExceptionsDialog;
+
+public:
+ explicit CookieExceptionsModel(CookieJar *cookieJar, QObject *parent = 0);
+
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
+
+private:
+ CookieJar *m_cookieJar;
+
+ // Domains we allow, Domains we block, Domains we allow for this session
+ QStringList m_allowedCookies;
+ QStringList m_blockedCookies;
+ QStringList m_sessionCookies;
+};
+
+
+// -----------------------------------------------------------------------------------------------
+
+
+// Ui Includes
+#include "ui_cookiesexceptions.h"
+
+//Forward Declarations
+class QSortFilterProxyModel;
+
+
+class CookiesExceptionsDialog : public KDialog
+{
+ Q_OBJECT
+
+public:
+ explicit CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *parent = 0);
+
+ QSize sizeHint() const;
+
+private slots:
+ void block();
+ void allow();
+ void allowForSession();
+ void textChanged(const QString &text);
+
+private:
+ CookieExceptionsModel *m_exceptionsModel;
+ QSortFilterProxyModel *m_proxyModel;
+ CookieJar *m_cookieJar;
+
+ Ui::CookiesExceptionsWidget *m_exceptionsWidget;
+};
+
+#endif
diff --git a/src/cookiejar.cpp b/src/cookiejar.cpp
index fd823553..4e4ef2c2 100644
--- a/src/cookiejar.cpp
+++ b/src/cookiejar.cpp
@@ -49,54 +49,37 @@
static const unsigned int JAR_VERSION = 23;
+static const char cookieFileName[] = "cookies";
-QDataStream &operator<<(QDataStream &stream, const QList<QNetworkCookie> &list)
-{
- stream << JAR_VERSION;
- stream << quint32(list.size());
- for (int i = 0; i < list.size(); ++i)
- stream << list.at(i).toRawForm();
- return stream;
-}
-
-QDataStream &operator>>(QDataStream &stream, QList<QNetworkCookie> &list)
+CookieJar::CookieJar(QObject *parent)
+ : QNetworkCookieJar(parent)
+ , m_acceptCookies(AcceptOnlyFromSitesNavigatedTo)
{
- list.clear();
-
- quint32 version;
- stream >> version;
+ // load cookies and exceptions
+ QString filepath = KStandardDirs::locateLocal("appdata", cookieFileName);
+ KConfig iniconfig(filepath);
- if (version != JAR_VERSION)
- return stream;
+ KConfigGroup inigroup1 = iniconfig.group("cookielist");
- quint32 count;
- stream >> count;
- for (quint32 i = 0; i < count; ++i)
+ QStringList cookieStringList = inigroup1.readEntry( QString("cookies"), QStringList() );
+ QList<QNetworkCookie> cookieNetworkList;
+ foreach( QString str, cookieStringList )
{
- QByteArray value;
- stream >> value;
- QList<QNetworkCookie> newCookies = QNetworkCookie::parseCookies(value);
- if (newCookies.count() == 0 && value.length() != 0)
- {
- kWarning() << "CookieJar: Unable to parse saved cookie:" << value;
- }
- for (int j = 0; j < newCookies.count(); ++j)
- list.append(newCookies.at(j));
- if (stream.atEnd())
- break;
+ cookieNetworkList << QNetworkCookie( str.toLocal8Bit() );
}
- return stream;
-}
+ setAllCookies( cookieNetworkList );
+ KConfigGroup inigroup2 = iniconfig.group("exceptions");
+ m_exceptions_block = inigroup2.readEntry( QString("block") , QStringList() );
+ m_exceptions_allow = inigroup2.readEntry( QString("allow"), QStringList() );
+ m_exceptions_allowForSession = inigroup2.readEntry( QString("allowForSession"), QStringList() );
-CookieJar::CookieJar(QObject *parent)
- : QNetworkCookieJar(parent)
- , m_loaded(false)
- , m_saveTimer(new AutoSaver(this))
- , m_acceptCookies(AcceptOnlyFromSitesNavigatedTo)
-{
- load();
+ qSort( m_exceptions_block.begin(), m_exceptions_block.end() );
+ qSort( m_exceptions_allow.begin(), m_exceptions_allow.end() );
+ qSort( m_exceptions_allowForSession.begin(), m_exceptions_allowForSession.end() );
+
+ loadSettings();
}
@@ -104,39 +87,18 @@ CookieJar::~CookieJar()
{
if (m_keepCookies == KeepUntilExit)
clear();
- m_saveTimer->saveIfNeccessary();
+
+ save();
}
void CookieJar::clear()
{
setAllCookies(QList<QNetworkCookie>());
- m_saveTimer->changeOccurred();
- emit cookiesChanged();
-}
-
-
-void CookieJar::load()
-{
- if (m_loaded)
- return;
-
- // load cookies and exceptions
- QString filepath = KStandardDirs::locateLocal("appdata", "cookies.ini");
- qRegisterMetaTypeStreamOperators<QList<QNetworkCookie> >("QList<QNetworkCookie>");
- QSettings cookieSettings(filepath, QSettings::IniFormat);
- setAllCookies(qvariant_cast<QList<QNetworkCookie> >(cookieSettings.value(QLatin1String("cookies"))));
- cookieSettings.beginGroup(QLatin1String("Exceptions"));
- m_exceptions_block = cookieSettings.value(QLatin1String("block")).toStringList();
- m_exceptions_allow = cookieSettings.value(QLatin1String("allow")).toStringList();
- m_exceptions_allowForSession = cookieSettings.value(QLatin1String("allowForSession")).toStringList();
- qSort(m_exceptions_block.begin(), m_exceptions_block.end());
- qSort(m_exceptions_allow.begin(), m_exceptions_allow.end());
- qSort(m_exceptions_allowForSession.begin(), m_exceptions_allowForSession.end());
-
- loadSettings();
save();
+
+ emit cookiesChanged();
}
@@ -175,19 +137,18 @@ void CookieJar::loadSettings()
break;
}
- m_loaded = true;
emit cookiesChanged();
}
void CookieJar::save()
{
- if (!m_loaded)
- return;
purgeOldCookies();
- QString filepath = KStandardDirs::locateLocal("appdata", "cookies.ini");
- QSettings cookieSettings(filepath, QSettings::IniFormat);
+ QString filepath = KStandardDirs::locateLocal("appdata", cookieFileName);
+ KConfig iniconfig( filepath );
+
+ KConfigGroup inigroup1 = iniconfig.group("cookielist");
QList<QNetworkCookie> cookies = allCookies();
for (int i = cookies.count() - 1; i >= 0; --i)
{
@@ -195,11 +156,17 @@ void CookieJar::save()
cookies.removeAt(i);
}
- cookieSettings.setValue(QLatin1String("cookies"), qVariantFromValue<QList<QNetworkCookie> >(cookies));
- cookieSettings.beginGroup(QLatin1String("Exceptions"));
- cookieSettings.setValue(QLatin1String("block"), m_exceptions_block);
- cookieSettings.setValue(QLatin1String("allow"), m_exceptions_allow);
- cookieSettings.setValue(QLatin1String("allowForSession"), m_exceptions_allowForSession);
+ QStringList cookieStringList;
+ foreach( QNetworkCookie cookie, cookies )
+ {
+ cookieStringList << QString( cookie.toRawForm() );
+ }
+ inigroup1.writeEntry( QString("cookies"), cookieStringList );
+
+ KConfigGroup inigroup2 = iniconfig.group("exceptions");
+ inigroup2.writeEntry( QString("block"), m_exceptions_block );
+ inigroup2.writeEntry( QString("allow"), m_exceptions_allow );
+ inigroup2.writeEntry( QString("allowForSession"), m_exceptions_allowForSession );
// save cookie settings
int n;
@@ -251,16 +218,13 @@ void CookieJar::purgeOldCookies()
if (oldCount == cookies.count())
return;
setAllCookies(cookies);
+
emit cookiesChanged();
}
QList<QNetworkCookie> CookieJar::cookiesForUrl(const QUrl &url) const
{
- CookieJar *that = const_cast<CookieJar*>(this);
- if (!m_loaded)
- that->load();
-
QWebSettings *globalSettings = QWebSettings::globalSettings();
if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
{
@@ -274,9 +238,6 @@ QList<QNetworkCookie> CookieJar::cookiesForUrl(const QUrl &url) const
bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url)
{
- if (!m_loaded)
- load();
-
QWebSettings *globalSettings = QWebSettings::globalSettings();
if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
return false;
@@ -318,17 +279,13 @@ bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const
setAllCookies(cookies);
addedCookies = true;
}
-#if 0
- else
- kWarning() << "setCookiesFromUrl failed" << url << cookieList.value(0).toRawForm();
-#endif
}
}
}
if (addedCookies)
{
- m_saveTimer->changeOccurred();
+ save();
emit cookiesChanged();
}
return addedCookies;
@@ -337,510 +294,76 @@ bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const
CookieJar::AcceptPolicy CookieJar::acceptPolicy() const
{
- if (!m_loaded)
- (const_cast<CookieJar*>(this))->load();
return m_acceptCookies;
}
void CookieJar::setAcceptPolicy(AcceptPolicy policy)
{
- if (!m_loaded)
- load();
if (policy == m_acceptCookies)
return;
m_acceptCookies = policy;
- m_saveTimer->changeOccurred();
+
+ save();
}
CookieJar::KeepPolicy CookieJar::keepPolicy() const
{
- if (!m_loaded)
- (const_cast<CookieJar*>(this))->load();
return m_keepCookies;
}
void CookieJar::setKeepPolicy(KeepPolicy policy)
{
- if (!m_loaded)
- load();
if (policy == m_keepCookies)
return;
m_keepCookies = policy;
- m_saveTimer->changeOccurred();
+
+ save();
}
QStringList CookieJar::blockedCookies() const
{
- if (!m_loaded)
- (const_cast<CookieJar*>(this))->load();
return m_exceptions_block;
}
QStringList CookieJar::allowedCookies() const
{
- if (!m_loaded)
- (const_cast<CookieJar*>(this))->load();
return m_exceptions_allow;
}
QStringList CookieJar::allowForSessionCookies() const
{
- if (!m_loaded)
- (const_cast<CookieJar*>(this))->load();
return m_exceptions_allowForSession;
}
void CookieJar::setBlockedCookies(const QStringList &list)
{
- if (!m_loaded)
- load();
m_exceptions_block = list;
qSort(m_exceptions_block.begin(), m_exceptions_block.end());
- m_saveTimer->changeOccurred();
+
+ save();
}
void CookieJar::setAllowedCookies(const QStringList &list)
{
- if (!m_loaded)
- load();
m_exceptions_allow = list;
qSort(m_exceptions_allow.begin(), m_exceptions_allow.end());
- m_saveTimer->changeOccurred();
+
+ save();
}
void CookieJar::setAllowForSessionCookies(const QStringList &list)
{
- if (!m_loaded)
- load();
m_exceptions_allowForSession = list;
qSort(m_exceptions_allowForSession.begin(), m_exceptions_allowForSession.end());
- m_saveTimer->changeOccurred();
-}
-
-
-// -------------------------------------------------------------------------------------------
-
-
-CookieModel::CookieModel(CookieJar *cookieJar, QObject *parent)
- : QAbstractTableModel(parent)
- , m_cookieJar(cookieJar)
-{
- connect(m_cookieJar, SIGNAL(cookiesChanged()), this, SLOT(cookiesChanged()));
- m_cookieJar->load();
-}
-
-
-QVariant CookieModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- if (role == Qt::SizeHintRole)
- {
- QFont font;
- font.setPointSize(10);
- QFontMetrics fm(font);
- int height = fm.height() + fm.height() / 3;
- int width = fm.width(headerData(section, orientation, Qt::DisplayRole).toString());
- return QSize(width, height);
- }
-
- if (orientation == Qt::Horizontal)
- {
- if (role != Qt::DisplayRole)
- return QVariant();
-
- switch (section)
- {
- case 0:
- return i18n("Website");
- case 1:
- return i18n("Name");
- case 2:
- return i18n("Path");
- case 3:
- return i18n("Secure");
- case 4:
- return i18n("Expires");
- case 5:
- return i18n("Contents");
- default:
- return QVariant();
- }
- }
- return QAbstractTableModel::headerData(section, orientation, role);
-}
-
-
-QVariant CookieModel::data(const QModelIndex &index, int role) const
-{
- QList<QNetworkCookie> lst;
- if (m_cookieJar)
- lst = m_cookieJar->allCookies();
- if (index.row() < 0 || index.row() >= lst.size())
- return QVariant();
-
- switch (role)
- {
- case Qt::DisplayRole:
- case Qt::EditRole:
- {
- QNetworkCookie cookie = lst.at(index.row());
- switch (index.column())
- {
- case 0:
- return cookie.domain();
- case 1:
- return cookie.name();
- case 2:
- return cookie.path();
- case 3:
- return cookie.isSecure();
- case 4:
- return cookie.expirationDate();
- case 5:
- return cookie.value();
- }
- }
- case Qt::FontRole:
- {
- QFont font;
- font.setPointSize(10);
- return font;
- }
- }
-
- return QVariant();
-}
-
-
-int CookieModel::columnCount(const QModelIndex &parent) const
-{
- return (parent.isValid()) ? 0 : 6;
-}
-
-
-int CookieModel::rowCount(const QModelIndex &parent) const
-{
- return (parent.isValid() || !m_cookieJar) ? 0 : m_cookieJar->allCookies().count();
-}
-
-
-bool CookieModel::removeRows(int row, int count, const QModelIndex &parent)
-{
- if (parent.isValid() || !m_cookieJar)
- return false;
- int lastRow = row + count - 1;
- beginRemoveRows(parent, row, lastRow);
- QList<QNetworkCookie> lst = m_cookieJar->allCookies();
- for (int i = lastRow; i >= row; --i)
- {
- lst.removeAt(i);
- }
- m_cookieJar->setAllCookies(lst);
- endRemoveRows();
- return true;
-}
-
-
-void CookieModel::cookiesChanged()
-{
- reset();
-}
-
-
-// ------------------------------------------------------------------------------------------------
-
-
-CookiesDialog::CookiesDialog(CookieJar *cookieJar, QWidget *parent)
- : QDialog(parent)
-{
- setupUi(this);
- setWindowFlags(Qt::Sheet);
- CookieModel *model = new CookieModel(cookieJar, this);
- m_proxyModel = new QSortFilterProxyModel(this);
- connect(search, SIGNAL(textChanged(QString)),
- m_proxyModel, SLOT(setFilterFixedString(QString)));
- connect(removeButton, SIGNAL(clicked()), cookiesTable, SLOT(removeOne()));
- connect(removeAllButton, SIGNAL(clicked()), cookiesTable, SLOT(removeAll()));
- m_proxyModel->setSourceModel(model);
- cookiesTable->verticalHeader()->hide();
- cookiesTable->setSelectionBehavior(QAbstractItemView::SelectRows);
- cookiesTable->setModel(m_proxyModel);
- cookiesTable->setAlternatingRowColors(true);
- cookiesTable->setTextElideMode(Qt::ElideMiddle);
- cookiesTable->setShowGrid(false);
- cookiesTable->setSortingEnabled(true);
- QFont f = font();
- f.setPointSize(10);
- QFontMetrics fm(f);
- int height = fm.height() + fm.height() / 3;
- cookiesTable->verticalHeader()->setDefaultSectionSize(height);
- cookiesTable->verticalHeader()->setMinimumSectionSize(-1);
- for (int i = 0; i < model->columnCount(); ++i)
- {
- int header = cookiesTable->horizontalHeader()->sectionSizeHint(i);
- switch (i)
- {
- case 0:
- header = fm.width(QLatin1String("averagehost.domain.com"));
- break;
- case 1:
- header = fm.width(QLatin1String("_session_id"));
- break;
- case 4:
- header = fm.width(QDateTime::currentDateTime().toString(Qt::LocalDate));
- break;
- }
- int buffer = fm.width(QLatin1String("xx"));
- header += buffer;
- cookiesTable->horizontalHeader()->resizeSection(i, header);
- }
- cookiesTable->horizontalHeader()->setStretchLastSection(true);
-}
-
-
-// ---------------------------------------------------------------------------------------------------
-
-
-CookieExceptionsModel::CookieExceptionsModel(CookieJar *cookiejar, QObject *parent)
- : QAbstractTableModel(parent)
- , m_cookieJar(cookiejar)
-{
- m_allowedCookies = m_cookieJar->allowedCookies();
- m_blockedCookies = m_cookieJar->blockedCookies();
- m_sessionCookies = m_cookieJar->allowForSessionCookies();
-}
-
-
-QVariant CookieExceptionsModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- if (role == Qt::SizeHintRole)
- {
- QFont font;
- font.setPointSize(10);
- QFontMetrics fm(font);
- int height = fm.height() + fm.height() / 3;
- int width = fm.width(headerData(section, orientation, Qt::DisplayRole).toString());
- return QSize(width, height);
- }
-
- if (orientation == Qt::Horizontal
- && role == Qt::DisplayRole)
- {
- switch (section)
- {
- case 0:
- return i18n("Website");
- case 1:
- return i18n("Status");
- }
- }
- return QAbstractTableModel::headerData(section, orientation, role);
-}
-
-
-QVariant CookieExceptionsModel::data(const QModelIndex &index, int role) const
-{
- if (index.row() < 0 || index.row() >= rowCount())
- return QVariant();
-
- switch (role)
- {
- case Qt::DisplayRole:
- case Qt::EditRole:
- {
- int row = index.row();
- if (row < m_allowedCookies.count())
- {
- switch (index.column())
- {
- case 0:
- return m_allowedCookies.at(row);
- case 1:
- return i18n("Allow");
- }
- }
- row = row - m_allowedCookies.count();
- if (row < m_blockedCookies.count())
- {
- switch (index.column())
- {
- case 0:
- return m_blockedCookies.at(row);
- case 1:
- return i18n("Block");
- }
- }
- row = row - m_blockedCookies.count();
- if (row < m_sessionCookies.count())
- {
- switch (index.column())
- {
- case 0:
- return m_sessionCookies.at(row);
- case 1:
- return i18n("Allow For Session");
- }
- }
- }
- case Qt::FontRole:
- {
- QFont font;
- font.setPointSize(10);
- return font;
- }
- }
- return QVariant();
-}
-
-
-int CookieExceptionsModel::columnCount(const QModelIndex &parent) const
-{
- return (parent.isValid()) ? 0 : 2;
-}
-
-
-int CookieExceptionsModel::rowCount(const QModelIndex &parent) const
-{
- return (parent.isValid() || !m_cookieJar) ? 0 : m_allowedCookies.count() + m_blockedCookies.count() + m_sessionCookies.count();
-}
-
-
-bool CookieExceptionsModel::removeRows(int row, int count, const QModelIndex &parent)
-{
- if (parent.isValid() || !m_cookieJar)
- return false;
-
- int lastRow = row + count - 1;
- beginRemoveRows(parent, row, lastRow);
- for (int i = lastRow; i >= row; --i)
- {
- if (i < m_allowedCookies.count())
- {
- m_allowedCookies.removeAt(row);
- continue;
- }
- i = i - m_allowedCookies.count();
- if (i < m_blockedCookies.count())
- {
- m_blockedCookies.removeAt(row);
- continue;
- }
- i = i - m_blockedCookies.count();
- if (i < m_sessionCookies.count())
- {
- m_sessionCookies.removeAt(row);
- continue;
- }
- }
- m_cookieJar->setAllowedCookies(m_allowedCookies);
- m_cookieJar->setBlockedCookies(m_blockedCookies);
- m_cookieJar->setAllowForSessionCookies(m_sessionCookies);
- endRemoveRows();
- return true;
-}
-
-
-// ----------------------------------------------------------------------------------------------------------------
-
-
-CookiesExceptionsDialog::CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *parent)
- : QDialog(parent)
- , m_cookieJar(cookieJar)
-{
- setupUi(this);
- setWindowFlags(Qt::Sheet);
- connect(removeButton, SIGNAL(clicked()), exceptionTable, SLOT(removeOne()));
- connect(removeAllButton, SIGNAL(clicked()), exceptionTable, SLOT(removeAll()));
- exceptionTable->verticalHeader()->hide();
- exceptionTable->setSelectionBehavior(QAbstractItemView::SelectRows);
- exceptionTable->setAlternatingRowColors(true);
- exceptionTable->setTextElideMode(Qt::ElideMiddle);
- exceptionTable->setShowGrid(false);
- exceptionTable->setSortingEnabled(true);
- m_exceptionsModel = new CookieExceptionsModel(cookieJar, this);
- m_proxyModel = new QSortFilterProxyModel(this);
- m_proxyModel->setSourceModel(m_exceptionsModel);
- connect(search, SIGNAL(textChanged(QString)),
- m_proxyModel, SLOT(setFilterFixedString(QString)));
- exceptionTable->setModel(m_proxyModel);
-
- CookieModel *cookieModel = new CookieModel(cookieJar, this);
- domainLineEdit->setCompleter(new QCompleter(cookieModel, domainLineEdit));
-
- connect(domainLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(textChanged(const QString &)));
- connect(blockButton, SIGNAL(clicked()), this, SLOT(block()));
- connect(allowButton, SIGNAL(clicked()), this, SLOT(allow()));
- connect(allowForSessionButton, SIGNAL(clicked()), this, SLOT(allowForSession()));
-
- QFont f = font();
- f.setPointSize(10);
- QFontMetrics fm(f);
- int height = fm.height() + fm.height() / 3;
- exceptionTable->verticalHeader()->setDefaultSectionSize(height);
- exceptionTable->verticalHeader()->setMinimumSectionSize(-1);
- for (int i = 0; i < m_exceptionsModel->columnCount(); ++i)
- {
- int header = exceptionTable->horizontalHeader()->sectionSizeHint(i);
- switch (i)
- {
- case 0:
- header = fm.width(QLatin1String("averagebiglonghost.domain.com"));
- break;
- case 1:
- header = fm.width(QLatin1String("Allow For Session"));
- break;
- }
- int buffer = fm.width(QLatin1String("xx"));
- header += buffer;
- exceptionTable->horizontalHeader()->resizeSection(i, header);
- }
-}
-
-
-void CookiesExceptionsDialog::textChanged(const QString &text)
-{
- bool enabled = !text.isEmpty();
- blockButton->setEnabled(enabled);
- allowButton->setEnabled(enabled);
- allowForSessionButton->setEnabled(enabled);
-}
-
-
-void CookiesExceptionsDialog::block()
-{
- if (domainLineEdit->text().isEmpty())
- return;
- m_exceptionsModel->m_blockedCookies.append(domainLineEdit->text());
- m_cookieJar->setBlockedCookies(m_exceptionsModel->m_blockedCookies);
- m_exceptionsModel->reset();
-}
-
-
-void CookiesExceptionsDialog::allow()
-{
- if (domainLineEdit->text().isEmpty())
- return;
- m_exceptionsModel->m_allowedCookies.append(domainLineEdit->text());
- m_cookieJar->setAllowedCookies(m_exceptionsModel->m_allowedCookies);
- m_exceptionsModel->reset();
-}
-
-
-void CookiesExceptionsDialog::allowForSession()
-{
- if (domainLineEdit->text().isEmpty())
- return;
- m_exceptionsModel->m_sessionCookies.append(domainLineEdit->text());
- m_cookieJar->setAllowForSessionCookies(m_exceptionsModel->m_sessionCookies);
- m_exceptionsModel->reset();
+ save();
}
diff --git a/src/cookiejar.h b/src/cookiejar.h
index 03802df1..08c65218 100644
--- a/src/cookiejar.h
+++ b/src/cookiejar.h
@@ -25,14 +25,10 @@
// Qt Includes
-#include <QNetworkCookieJar>
-#include <QAbstractItemModel>
-#include <QStringList>
-#include <QTableView>
+#include <QtCore/QStringList>
+#include <QtNetwork/QNetworkCookieJar>
// Forward Declarations
-class QSortFilterProxyModel;
-class QKeyEvent;
class AutoSaver;
class QUrl;
@@ -41,11 +37,13 @@ class CookieJar : public QNetworkCookieJar
{
friend class CookieModel;
Q_OBJECT
+
Q_PROPERTY(AcceptPolicy acceptPolicy READ acceptPolicy WRITE setAcceptPolicy)
Q_PROPERTY(KeepPolicy keepPolicy READ keepPolicy WRITE setKeepPolicy)
Q_PROPERTY(QStringList blockedCookies READ blockedCookies WRITE setBlockedCookies)
Q_PROPERTY(QStringList allowedCookies READ allowedCookies WRITE setAllowedCookies)
Q_PROPERTY(QStringList allowForSessionCookies READ allowForSessionCookies WRITE setAllowForSessionCookies)
+
Q_ENUMS(KeepPolicy)
Q_ENUMS(AcceptPolicy)
@@ -96,9 +94,6 @@ private slots:
private:
void purgeOldCookies();
- void load();
- bool m_loaded;
- AutoSaver *m_saveTimer;
AcceptPolicy m_acceptCookies;
KeepPolicy m_keepCookies;
@@ -108,98 +103,4 @@ private:
QStringList m_exceptions_allowForSession;
};
-
-// -------------------------------------------------------------------------------------------------------------
-
-
-class CookieModel : public QAbstractTableModel
-{
- Q_OBJECT
-
-public:
- explicit CookieModel(CookieJar *jar, QObject *parent = 0);
-
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
-
-private slots:
- void cookiesChanged();
-
-private:
- CookieJar *m_cookieJar;
-};
-
-
-// ----------------------------------------------------------------------------------------------------------------------
-
-
-#include "ui_cookies.h"
-
-class CookiesDialog : public QDialog, public Ui_CookiesDialog
-{
- Q_OBJECT
-
-public:
- explicit CookiesDialog(CookieJar *cookieJar, QWidget *parent = 0);
-
-private:
- QSortFilterProxyModel *m_proxyModel;
-};
-
-
-// ----------------------------------------------------------------------------------------------------------------------
-
-
-class CookieExceptionsModel : public QAbstractTableModel
-{
- Q_OBJECT
- friend class CookiesExceptionsDialog;
-
-public:
- explicit CookieExceptionsModel(CookieJar *cookieJar, QObject *parent = 0);
-
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
-
-private:
- CookieJar *m_cookieJar;
-
- // Domains we allow, Domains we block, Domains we allow for this session
- QStringList m_allowedCookies;
- QStringList m_blockedCookies;
- QStringList m_sessionCookies;
-};
-
-
-// -----------------------------------------------------------------------------------------------------------------
-
-
-#include "ui_cookiesexceptions.h"
-
-class CookiesExceptionsDialog : public QDialog, public Ui_CookiesExceptionsDialog
-{
- Q_OBJECT
-
-public:
- explicit CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *parent = 0);
-
-private slots:
- void block();
- void allow();
- void allowForSession();
- void textChanged(const QString &text);
-
-private:
- CookieExceptionsModel *m_exceptionsModel;
- QSortFilterProxyModel *m_proxyModel;
- CookieJar *m_cookieJar;
-};
-
#endif // COOKIEJAR_H
-
diff --git a/src/cookies.ui b/src/cookies.ui
index 49ad3a96..ae1c4a2b 100644
--- a/src/cookies.ui
+++ b/src/cookies.ui
@@ -1,39 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>CookiesDialog</class>
- <widget class="QDialog" name="CookiesDialog">
+ <class>CookiesWidget</class>
+ <widget class="QWidget" name="CookiesWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>550</width>
- <height>370</height>
+ <width>859</width>
+ <height>478</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="windowTitle">
- <string>Cookies</string>
+ <string>Form</string>
</property>
- <layout class="QGridLayout">
- <item row="0" column="0">
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>252</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="1">
- <widget class="KLineEdit" name="search"/>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Search:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KLineEdit" name="search">
+ <property name="showClearButton" stdset="0">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="1" column="0" colspan="2">
+ <item>
<widget class="EditTableView" name="cookiesTable"/>
</item>
- <item row="2" column="0" colspan="2">
+ <item>
<layout class="QHBoxLayout">
<item>
<widget class="QPushButton" name="removeButton">
@@ -62,13 +76,6 @@
</property>
</spacer>
</item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
</layout>
</item>
</layout>
@@ -86,22 +93,5 @@
</customwidget>
</customwidgets>
<resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>CookiesDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>472</x>
- <y>329</y>
- </hint>
- <hint type="destinationlabel">
- <x>461</x>
- <y>356</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ <connections/>
</ui>
diff --git a/src/cookiesexceptions.ui b/src/cookiesexceptions.ui
index de59eee0..3e28b42a 100644
--- a/src/cookiesexceptions.ui
+++ b/src/cookiesexceptions.ui
@@ -1,46 +1,51 @@
-<ui version="4.0" >
- <class>CookiesExceptionsDialog</class>
- <widget class="QDialog" name="CookiesExceptionsDialog" >
- <property name="geometry" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CookiesExceptionsWidget</class>
+ <widget class="QWidget" name="CookiesExceptionsWidget">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>466</width>
- <height>446</height>
+ <width>1000</width>
+ <height>400</height>
</rect>
</property>
- <property name="windowTitle" >
- <string>Cookie Exceptions</string>
+ <property name="windowTitle">
+ <string>Form</string>
</property>
- <layout class="QVBoxLayout" >
+ <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QGroupBox" name="newExceptionGroupBox" >
- <property name="title" >
+ <widget class="QGroupBox" name="CookiesExceptionWidget">
+ <property name="title">
<string>New Exception</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <layout class="QHBoxLayout" >
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="_2">
<item>
- <widget class="QLabel" name="label" >
- <property name="text" >
+ <widget class="QLabel" name="label">
+ <property name="text">
<string>Domain:</string>
</property>
</widget>
</item>
<item>
- <widget class="KLineEdit" name="domainLineEdit" />
+ <widget class="KLineEdit" name="domainLineEdit">
+ <property name="showClearButton" stdset="0">
+ <bool>true</bool>
+ </property>
+ </widget>
</item>
</layout>
</item>
- <item row="1" column="0" >
- <layout class="QHBoxLayout" >
+ <item row="1" column="0">
+ <layout class="QHBoxLayout" name="_3">
<item>
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" stdset="0">
<size>
<width>81</width>
<height>25</height>
@@ -49,31 +54,31 @@
</spacer>
</item>
<item>
- <widget class="QPushButton" name="blockButton" >
- <property name="enabled" >
+ <widget class="QPushButton" name="blockButton">
+ <property name="enabled">
<bool>false</bool>
</property>
- <property name="text" >
+ <property name="text">
<string>Block</string>
</property>
</widget>
</item>
<item>
- <widget class="QPushButton" name="allowForSessionButton" >
- <property name="enabled" >
+ <widget class="QPushButton" name="allowForSessionButton">
+ <property name="enabled">
<bool>false</bool>
</property>
- <property name="text" >
+ <property name="text">
<string>Allow For Session</string>
</property>
</widget>
</item>
<item>
- <widget class="QPushButton" name="allowButton" >
- <property name="enabled" >
+ <widget class="QPushButton" name="allowButton">
+ <property name="enabled">
<bool>false</bool>
</property>
- <property name="text" >
+ <property name="text">
<string>Allow</string>
</property>
</widget>
@@ -84,96 +89,86 @@
</widget>
</item>
<item>
- <widget class="QGroupBox" name="ExceptionsGroupBox" >
- <property name="title" >
+ <widget class="QGroupBox" name="ExceptionsGroupBox">
+ <property name="title">
<string>Exceptions</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" colspan="3" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>252</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="3" >
- <widget class="KLineEdit" name="search" />
- </item>
- <item row="1" column="0" colspan="4" >
- <widget class="EditTableView" name="exceptionTable" />
- </item>
- <item row="2" column="0" >
- <widget class="QPushButton" name="removeButton" >
- <property name="text" >
- <string>&amp;Remove</string>
- </property>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Search:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KLineEdit" name="search">
+ <property name="showClearButton" stdset="0">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="2" column="1" >
- <widget class="QPushButton" name="removeAllButton" >
- <property name="text" >
- <string>Remove &amp;All</string>
- </property>
- </widget>
+ <item>
+ <widget class="EditTableView" name="exceptionTable"/>
</item>
- <item row="2" column="2" colspan="2" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QPushButton" name="removeButton">
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="removeAllButton">
+ <property name="text">
+ <string>Remove &amp;All</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
</item>
</layout>
</widget>
</item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons" >
- <set>QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
</layout>
</widget>
<customwidgets>
<customwidget>
+ <class>KLineEdit</class>
+ <extends>QLineEdit</extends>
+ <header>klineedit.h</header>
+ </customwidget>
+ <customwidget>
<class>EditTableView</class>
<extends>QTableView</extends>
<header>edittableview.h</header>
</customwidget>
</customwidgets>
<resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>CookiesExceptionsDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>381</x>
- <y>428</y>
- </hint>
- <hint type="destinationlabel" >
- <x>336</x>
- <y>443</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ <connections/>
</ui>
diff --git a/src/download.cpp b/src/download.cpp
index c365d3c5..2f98d5a4 100644
--- a/src/download.cpp
+++ b/src/download.cpp
@@ -21,7 +21,7 @@
* ============================================================ */
-// local Includes
+// Self Includes
#include "download.h"
#include "download.moc"
diff --git a/src/download.h b/src/download.h
deleted file mode 100644
index 0502d500..00000000
--- a/src/download.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2007 Lukas Appelhans <l.appelhans@gmx.de>
-* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009 by Domrachev Alexandr <alexandr.domrachev@gmail.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, or (at your option) any later version.
-*
-* 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.
-*
-* ============================================================ */
-
-
-#ifndef DOWNLOAD_H
-#define DOWNLOAD_H
-
-// Auto Includes
-#include "rekonq.h"
-
-// KDE Includes
-#include <KIO/FileCopyJob>
-
-// Qt Includes
-#include <QtCore/QObject>
-
-// Forward Declarations
-class KJob;
-
-namespace KIO
-{
-class Job;
-}
-
-
-/**
- * This class lets rekonq to download an object from the network.
- * Creating a new object, you can continue downloading a file also
- * when rekonq is closed.
- *
- */
-class Download : public QObject
-{
- Q_OBJECT
-
-public:
- enum DownloadType { Save, Open };
-
- /**
- * Class constructor. This is the unique method we need to
- * use this class. In fact Download class needs to know just
- * "where" catch the file to download and where it has to put it
- *
- * @param srcUrl the source url
- * @param destUrl the destination url
- *
- */
- Download(const KUrl &srcUrl, const KUrl &destUrl, DownloadType type);
-
- /**
- * class destructor
- */
- ~Download();
-
- KUrl srcUrl() const
- {
- return m_srcUrl;
- }
- KUrl destUrl() const
- {
- return m_destUrl;
- }
- DownloadType type() const
- {
- return m_type;
- }
- void cancel();
-
-signals:
- void downloadFinished(int errorCode);
-
-private slots:
- void slotResult(KJob *job);
-
-private:
- KIO::FileCopyJob *m_copyJob;
- KUrl m_srcUrl;
- KUrl m_destUrl;
- KUrl m_destFile;
- QByteArray m_data;
- DownloadType m_type;
-};
-
-
-// ----------------------
-
-
-class DownloadManager : public QObject
-{
- Q_OBJECT
-
-public:
- DownloadManager();
- ~DownloadManager();
-
- /**
- * @short Creates new download job.
- * This method lets you to download a file from a remote source url
- * to a local destination url.
- *
- * @param srcUrl the source url
- * @param destUrl the destination url (default value is your default download destination setting)
- *
- */
- void newDownload(const KUrl &srcUrl, const KUrl &destUrl = KUrl());
-
- const QList<Download *> &downloads() const;
-
-public slots:
- void slotDownloadFinished(int errorCode);
-
-private:
- KUrl downloadDestination(const QString &filename);
-
- QList<Download *> m_downloads;
-};
-
-
-//--
-
-
-#endif
diff --git a/src/edittableview.cpp b/src/edittableview.cpp
index 8b9bb12d..9ecf8958 100644
--- a/src/edittableview.cpp
+++ b/src/edittableview.cpp
@@ -21,6 +21,7 @@
// Self Includes
#include "edittableview.h"
+#include "edittableview.moc"
// Qt Includes
#include <QtGui/QKeyEvent>
diff --git a/src/edittreeview.cpp b/src/edittreeview.cpp
index 5547cdb0..8ca18d13 100644
--- a/src/edittreeview.cpp
+++ b/src/edittreeview.cpp
@@ -21,6 +21,7 @@
// Self Includes
#include "edittreeview.h"
+#include "edittreeview.moc"
// Qt includes
#include <QtGui/QKeyEvent>
diff --git a/src/history.cpp b/src/history.cpp
index fac13b48..795bc14e 100644
--- a/src/history.cpp
+++ b/src/history.cpp
@@ -669,74 +669,6 @@ QModelIndex HistoryMenuModel::parent(const QModelIndex &index) const
}
-// -------------------------------------------------------------------------------------------------------------
-
-
-HistoryMenu::HistoryMenu(QWidget *parent)
- : ModelMenu(parent)
- , m_history(0)
-{
- connect(this, SIGNAL(activated(const QModelIndex &)), this, SLOT(activated(const QModelIndex &)));
- setHoverRole(HistoryModel::UrlStringRole);
-}
-
-
-void HistoryMenu::activated(const QModelIndex &index)
-{
- emit openUrl(index.data(HistoryModel::UrlRole).toUrl());
-}
-
-
-bool HistoryMenu::prePopulated()
-{
- if (!m_history)
- {
- m_history = Application::historyManager();
- m_historyMenuModel = new HistoryMenuModel(m_history->historyTreeModel(), this);
- setModel(m_historyMenuModel);
- }
- // initial actions
- for (int i = 0; i < m_initialActions.count(); ++i)
- addAction(m_initialActions.at(i));
- if (!m_initialActions.isEmpty())
- addSeparator();
- setFirstSeparator(m_historyMenuModel->bumpedRows());
-
- return false;
-}
-
-
-void HistoryMenu::postPopulated()
-{
- if (m_history->history().count() > 0)
- addSeparator();
-
- KAction *showAllAction = new KAction(i18n("Show All History"), this);
- connect(showAllAction, SIGNAL(triggered()), this, SLOT(showHistoryDialog()));
- addAction(showAllAction);
-
- KAction *clearAction = new KAction(i18n("Clear History"), this);
- connect(clearAction, SIGNAL(triggered()), m_history, SLOT(clear()));
- addAction(clearAction);
-}
-
-
-void HistoryMenu::showHistoryDialog()
-{
- HistoryDialog *dialog = new HistoryDialog(this);
- connect(dialog, SIGNAL(openUrl(const KUrl&)), this, SIGNAL(openUrl(const KUrl&)));
- dialog->show();
-}
-
-
-void HistoryMenu::setInitialActions(QList<QAction*> actions)
-{
- m_initialActions = actions;
- for (int i = 0; i < m_initialActions.count(); ++i)
- addAction(m_initialActions.at(i));
-}
-
-
// --------------------------------------------------------------------------------------------------------------
@@ -755,78 +687,8 @@ bool TreeProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_
}
-// -----------------------------------------------------------------------------------------------------
-
-
-HistoryDialog::HistoryDialog(QWidget *parent, HistoryManager *setHistory) : QDialog(parent)
-{
- HistoryManager *history = setHistory;
- if (!history)
- history = Application::historyManager();
- setupUi(this);
- tree->setUniformRowHeights(true);
- tree->setSelectionBehavior(QAbstractItemView::SelectRows);
- tree->setTextElideMode(Qt::ElideMiddle);
- QAbstractItemModel *model = history->historyTreeModel();
- TreeProxyModel *proxyModel = new TreeProxyModel(this);
- connect(search, SIGNAL(textChanged(QString)),
- proxyModel, SLOT(setFilterFixedString(QString)));
- connect(removeButton, SIGNAL(clicked()), tree, SLOT(removeOne()));
- connect(removeAllButton, SIGNAL(clicked()), history, SLOT(clear()));
- proxyModel->setSourceModel(model);
- tree->setModel(proxyModel);
- tree->setExpanded(proxyModel->index(0, 0), true);
- tree->setAlternatingRowColors(true);
- QFontMetrics fm(font());
- int header = fm.width(QLatin1Char('m')) * 40;
- tree->header()->resizeSection(0, header);
- tree->header()->setStretchLastSection(true);
- connect(tree, SIGNAL(activated(const QModelIndex&)),
- this, SLOT(open()));
- tree->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(tree, SIGNAL(customContextMenuRequested(const QPoint &)),
- this, SLOT(customContextMenuRequested(const QPoint &)));
-}
-
-
-void HistoryDialog::customContextMenuRequested(const QPoint &pos)
-{
- QMenu menu;
- QModelIndex index = tree->indexAt(pos);
- index = index.sibling(index.row(), 0);
- if (index.isValid() && !tree->model()->hasChildren(index))
- {
- menu.addAction(i18n("Open"), this, SLOT(open()));
- menu.addSeparator();
- menu.addAction(i18n("Copy"), this, SLOT(copy()));
- }
- menu.addAction(i18n("Delete"), tree, SLOT(removeOne()));
- menu.exec(QCursor::pos());
-}
-
-
-void HistoryDialog::open()
-{
- QModelIndex index = tree->currentIndex();
- if (!index.parent().isValid())
- return;
- emit openUrl(index.data(HistoryModel::UrlRole).toUrl());
-}
-
-
-void HistoryDialog::copy()
-{
- QModelIndex index = tree->currentIndex();
- if (!index.parent().isValid())
- return;
- QString url = index.data(HistoryModel::UrlStringRole).toString();
-
- QClipboard *clipboard = QApplication::clipboard();
- clipboard->setText(url);
-}
-
+// -------------------------------------------------------------------------------------------------------------
-// ---------------------------------------------------------------------------------------------------------------
HistoryFilterModel::HistoryFilterModel(QAbstractItemModel *sourceModel, QObject *parent)
: QAbstractProxyModel(parent),
diff --git a/src/history.h b/src/history.h
index 7b3cbec9..7586ff9d 100644
--- a/src/history.h
+++ b/src/history.h
@@ -27,7 +27,6 @@
#include "modelmenu.h"
// KDE Includes
-#include <KAction>
#include <KUrl>
// Qt Includes
@@ -256,39 +255,6 @@ private:
};
-// ---------------------------------------------------------------------------------------------
-
-/**
- * Menu that is dynamically populated from the history
- *
- */
-
-class HistoryMenu : public ModelMenu
-{
- Q_OBJECT
-
-signals:
- void openUrl(const KUrl &url);
-
-public:
- HistoryMenu(QWidget *parent = 0);
- void setInitialActions(QList<QAction*> actions);
-
-protected:
- bool prePopulated();
- void postPopulated();
-
-private slots:
- void activated(const QModelIndex &index);
- void showHistoryDialog();
-
-private:
- HistoryManager *m_history;
- HistoryMenuModel *m_historyMenuModel;
- QList<QAction*> m_initialActions;
-};
-
-
// ----------------------------------------------------------------------------------------
/**
@@ -383,27 +349,4 @@ protected:
};
-// ------------------------------------------------------------------------------------------
-
-
-// Ui includes
-#include "ui_history.h"
-
-class HistoryDialog : public QDialog, public Ui_HistoryDialog
-{
- Q_OBJECT
-
-signals:
- void openUrl(const KUrl &url);
-
-public:
- explicit HistoryDialog(QWidget *parent = 0, HistoryManager *history = 0);
-
-private slots:
- void customContextMenuRequested(const QPoint &pos);
- void open();
- void copy();
-
-};
-
#endif // HISTORY_H
diff --git a/src/history.ui b/src/history.ui
index 806bc9ad..fb694f8f 100644
--- a/src/history.ui
+++ b/src/history.ui
@@ -1,59 +1,41 @@
-<ui version="4.0" >
- <class>HistoryDialog</class>
- <widget class="QDialog" name="HistoryDialog" >
- <property name="geometry" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>historyWidget</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>758</width>
- <height>450</height>
+ <width>584</width>
+ <height>381</height>
</rect>
</property>
- <property name="windowTitle" >
- <string>History</string>
+ <property name="windowTitle">
+ <string>Form</string>
</property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>252</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="1" >
- <widget class="KLineEdit" name="search" />
- </item>
- <item row="1" column="0" colspan="2" >
- <widget class="EditTreeView" name="tree" />
- </item>
- <item row="2" column="0" colspan="2" >
- <layout class="QHBoxLayout" >
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout">
<item>
- <widget class="QPushButton" name="removeButton" >
- <property name="text" >
+ <widget class="QPushButton" name="removeButton">
+ <property name="text">
<string>&amp;Remove</string>
</property>
</widget>
</item>
<item>
- <widget class="QPushButton" name="removeAllButton" >
- <property name="text" >
+ <widget class="QPushButton" name="removeAllButton">
+ <property name="text">
<string>Remove &amp;All</string>
</property>
</widget>
</item>
<item>
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
@@ -62,40 +44,34 @@
</spacer>
</item>
<item>
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="standardButtons" >
- <set>QDialogButtonBox::Ok</set>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Search:</string>
</property>
</widget>
</item>
+ <item>
+ <widget class="KLineEdit" name="search"/>
+ </item>
</layout>
</item>
+ <item>
+ <widget class="EditTreeView" name="tree"/>
+ </item>
</layout>
</widget>
<customwidgets>
<customwidget>
+ <class>KLineEdit</class>
+ <extends>QLineEdit</extends>
+ <header>klineedit.h</header>
+ </customwidget>
+ <customwidget>
<class>EditTreeView</class>
<extends>QTreeView</extends>
<header>edittreeview.h</header>
</customwidget>
</customwidgets>
<resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>HistoryDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>472</x>
- <y>329</y>
- </hint>
- <hint type="destinationlabel" >
- <x>461</x>
- <y>356</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ <connections/>
</ui>
diff --git a/src/historydialog.cpp b/src/historydialog.cpp
new file mode 100644
index 00000000..7b0d6bc0
--- /dev/null
+++ b/src/historydialog.cpp
@@ -0,0 +1,129 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 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, or (at your option) any later version.
+*
+* 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.
+*
+* ============================================================ */
+
+
+// Auto Includes
+#include "historydialog.h"
+#include "historydialog.moc"
+
+// Local Includes
+#include "history.h"
+#include "application.h"
+
+// KDE Includes
+#include <KAction>
+#include <KUrl>
+
+// Qt Includes
+#include <QtCore/QPoint>
+
+#include <QtGui/QWidget>
+#include <QtGui/QClipboard>
+#include <QtGui/QDesktopWidget>
+
+
+HistoryDialog::HistoryDialog(QWidget *parent, HistoryManager *setHistory)
+ : KDialog(parent)
+ , m_historyWidg(new Ui::historyWidget)
+{
+ HistoryManager *history = setHistory;
+ if (!history)
+ history = Application::historyManager();
+
+ setCaption( i18n("History") );
+ setButtons( KDialog::Close );
+
+ QWidget *widget = new QWidget;
+ m_historyWidg->setupUi(widget);
+ setMainWidget(widget);
+
+ m_historyWidg->search->setClearButtonShown(true);
+
+ m_historyWidg->tree->setUniformRowHeights(true);
+ m_historyWidg->tree->setSelectionBehavior(QAbstractItemView::SelectRows);
+ m_historyWidg->tree->setTextElideMode(Qt::ElideMiddle);
+
+ QAbstractItemModel *model = history->historyTreeModel();
+ TreeProxyModel *proxyModel = new TreeProxyModel(this);
+
+ connect(m_historyWidg->search, SIGNAL(textChanged(QString)), proxyModel, SLOT(setFilterFixedString(QString)));
+ connect(m_historyWidg->removeButton, SIGNAL(clicked()), m_historyWidg->tree, SLOT(removeOne()));
+ connect(m_historyWidg->removeAllButton, SIGNAL(clicked()), history, SLOT(clear()));
+
+ proxyModel->setSourceModel(model);
+ m_historyWidg->tree->setModel(proxyModel);
+ m_historyWidg->tree->setExpanded(proxyModel->index(0, 0), true);
+ m_historyWidg->tree->setAlternatingRowColors(true);
+
+ QFontMetrics fm(font());
+ int header = fm.width(QLatin1Char('m')) * 25;
+ m_historyWidg->tree->header()->resizeSection(0, header);
+ m_historyWidg->tree->header()->setStretchLastSection(true);
+
+ m_historyWidg->tree->setContextMenuPolicy(Qt::CustomContextMenu);
+
+ connect(m_historyWidg->tree, SIGNAL(customContextMenuRequested(const QPoint &)),
+ this, SLOT(customContextMenuRequested(const QPoint &)));
+
+ connect(m_historyWidg->tree, SIGNAL(activated(const QModelIndex&)), this, SLOT(open()));
+}
+
+
+void HistoryDialog::customContextMenuRequested(const QPoint &pos)
+{
+ KMenu menu;
+ QModelIndex index = m_historyWidg->tree->indexAt(pos);
+ index = index.sibling(index.row(), 0);
+ if (index.isValid() && !m_historyWidg->tree->model()->hasChildren(index))
+ {
+ menu.addAction(i18n("Open"), this, SLOT(open()));
+ menu.addSeparator();
+ menu.addAction(i18n("Copy"), this, SLOT(copy()));
+ }
+ menu.addAction(i18n("Delete"), m_historyWidg->tree, SLOT(removeOne()));
+ menu.exec(QCursor::pos());
+}
+
+
+void HistoryDialog::open()
+{
+ QModelIndex index = m_historyWidg->tree->currentIndex();
+ if (!index.parent().isValid())
+ return;
+ emit openUrl(index.data(HistoryModel::UrlRole).toUrl());
+}
+
+
+void HistoryDialog::copy()
+{
+ QModelIndex index = m_historyWidg->tree->currentIndex();
+ if (!index.parent().isValid())
+ return;
+ QString url = index.data(HistoryModel::UrlStringRole).toString();
+
+ QClipboard *clipboard = QApplication::clipboard();
+ clipboard->setText(url);
+}
+
+QSize HistoryDialog::sizeHint() const
+{
+ QRect desktopRect = Application::desktop()->screenGeometry();
+ QSize size = desktopRect.size() * 0.7;
+ return size;
+}
diff --git a/src/historydialog.h b/src/historydialog.h
new file mode 100644
index 00000000..6436eda3
--- /dev/null
+++ b/src/historydialog.h
@@ -0,0 +1,57 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 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, or (at your option) any later version.
+*
+* 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.
+*
+* ============================================================ */
+
+
+
+#ifndef HISTORYDIALOG_H
+#define HISTORYDIALOG_H
+
+
+// Ui includes
+#include "ui_history.h"
+
+// KDE Includes
+#include <KDialog>
+
+class KUrl;
+class QPoint;
+class QWidget;
+class HistoryManager;
+
+class HistoryDialog : public KDialog
+{
+ Q_OBJECT
+
+signals:
+ void openUrl(const KUrl &url);
+
+public:
+ explicit HistoryDialog(QWidget *parent = 0, HistoryManager *history = 0);
+ QSize sizeHint() const;
+
+private slots:
+ void customContextMenuRequested(const QPoint &pos);
+ void open();
+ void copy();
+
+private:
+ Ui::historyWidget *m_historyWidg;
+};
+
+#endif
diff --git a/src/historymenu.cpp b/src/historymenu.cpp
new file mode 100644
index 00000000..74b37db0
--- /dev/null
+++ b/src/historymenu.cpp
@@ -0,0 +1,95 @@
+/* ============================================================
+*
+* 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, or (at your option) any later version.
+*
+* 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.
+*
+* ============================================================ */
+
+
+#include "historymenu.h"
+#include "historymenu.moc"
+
+#include "application.h"
+#include "historydialog.h"
+
+#include <QtGui/QWidget>
+#include <QtCore/QModelIndex>
+
+#include <KUrl>
+
+HistoryMenu::HistoryMenu(QWidget *parent)
+ : ModelMenu(parent)
+ , m_history(0)
+{
+ connect(this, SIGNAL(activated(const QModelIndex &)), this, SLOT(activated(const QModelIndex &)));
+ setHoverRole(HistoryModel::UrlStringRole);
+}
+
+
+void HistoryMenu::activated(const QModelIndex &index)
+{
+ emit openUrl(index.data(HistoryModel::UrlRole).toUrl());
+}
+
+
+bool HistoryMenu::prePopulated()
+{
+ if (!m_history)
+ {
+ m_history = Application::historyManager();
+ m_historyMenuModel = new HistoryMenuModel(m_history->historyTreeModel(), this);
+ setModel(m_historyMenuModel);
+ }
+ // initial actions
+ for (int i = 0; i < m_initialActions.count(); ++i)
+ addAction(m_initialActions.at(i));
+ if (!m_initialActions.isEmpty())
+ addSeparator();
+ setFirstSeparator(m_historyMenuModel->bumpedRows());
+
+ return false;
+}
+
+
+void HistoryMenu::postPopulated()
+{
+ if (m_history->history().count() > 0)
+ addSeparator();
+
+ KAction *showAllAction = new KAction(i18n("Show All History"), this);
+ connect(showAllAction, SIGNAL(triggered()), this, SLOT(showHistoryDialog()));
+ addAction(showAllAction);
+
+ KAction *clearAction = new KAction(i18n("Clear History"), this);
+ connect(clearAction, SIGNAL(triggered()), m_history, SLOT(clear()));
+ addAction(clearAction);
+}
+
+
+void HistoryMenu::showHistoryDialog()
+{
+ HistoryDialog *dialog = new HistoryDialog(this);
+ connect(dialog, SIGNAL(openUrl(const KUrl&)), this, SIGNAL(openUrl(const KUrl&)));
+ dialog->show();
+}
+
+
+void HistoryMenu::setInitialActions(QList<QAction*> actions)
+{
+ m_initialActions = actions;
+ for (int i = 0; i < m_initialActions.count(); ++i)
+ addAction(m_initialActions.at(i));
+}
diff --git a/src/historymenu.h b/src/historymenu.h
new file mode 100644
index 00000000..06d85ffa
--- /dev/null
+++ b/src/historymenu.h
@@ -0,0 +1,65 @@
+/* ============================================================
+*
+* 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, or (at your option) any later version.
+*
+* 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.
+*
+* ============================================================ */
+
+
+#ifndef HISTORYMENU_H
+#define HISTORYMENU_H
+
+#include "history.h"
+
+#include <QtCore/QList>
+#include <QtGui/QAction>
+
+class ModelMenu;
+class QWidget;
+class QModelIndex;
+class KUrl;
+
+/**
+ * Menu that is dynamically populated from the history
+ *
+ */
+
+class HistoryMenu : public ModelMenu
+{
+ Q_OBJECT
+
+signals:
+ void openUrl(const KUrl &url);
+
+public:
+ HistoryMenu(QWidget *parent = 0);
+ void setInitialActions(QList<QAction*> actions);
+
+protected:
+ bool prePopulated();
+ void postPopulated();
+
+private slots:
+ void activated(const QModelIndex &index);
+ void showHistoryDialog();
+
+private:
+ HistoryManager *m_history;
+ HistoryMenuModel *m_historyMenuModel;
+ QList<QAction*> m_initialActions;
+};
+
+#endif
diff --git a/src/lineedit.cpp b/src/lineedit.cpp
index dd90ce5a..e3185fc2 100644
--- a/src/lineedit.cpp
+++ b/src/lineedit.cpp
@@ -79,6 +79,3 @@ void LineEdit::focusOutEvent(QFocusEvent *event)
setCursorPosition(0);
deselect();
}
-
-
-
diff --git a/src/main.cpp b/src/main.cpp
index 38c30b53..009fc4b3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -18,15 +18,17 @@
* ============================================================ */
+// Local Includes
#include "application.h"
+// KDE Includes
#include <KAboutData>
#include <KCmdLineArgs>
#include <KDebug>
static const char description[] =
- I18N_NOOP("Webkit Based Browser for KDE");
+ I18N_NOOP("WebKit-based Web Browser for KDE");
static const char version[] = "0.1.1";
diff --git a/src/mainview.cpp b/src/mainview.cpp
index d8d1c2b5..ea56527d 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -362,10 +362,8 @@ WebView *MainView::newWebView(Rekonq::OpenType type)
connect(webView, SIGNAL(shiftCtrlTabPressed()), this, SLOT(previousTab()));
// connecting webPage signals with mainview
- connect(webView->page(), SIGNAL(windowCloseRequested()),
- this, SLOT(windowCloseRequested()));
- connect(webView->page(), SIGNAL(printRequested(QWebFrame *)),
- this, SIGNAL(printRequested(QWebFrame *)));
+ connect(webView->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested()));
+ connect(webView->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *)));
addTab(webView, i18n("(Untitled)"));
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 73ec3d6d..26ffbc11 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -30,14 +30,13 @@
// Local Includes
#include "application.h"
#include "settings.h"
-#include "history.h"
+#include "historymenu.h"
#include "cookiejar.h"
#include "networkaccessmanager.h"
#include "bookmarks.h"
#include "webview.h"
#include "mainview.h"
#include "bookmarks.h"
-#include "download.h"
#include "findbar.h"
#include "sidepanel.h"
#include "urlbar.h"
@@ -410,65 +409,6 @@ void MainWindow::slotUpdateBrowser()
}
-KUrl MainWindow::guessUrlFromString(const QString &string)
-{
- QString urlStr = string.trimmed();
- QRegExp test(QLatin1String("^[a-zA-Z]+\\:.*"));
-
- // Check if it looks like a qualified URL. Try parsing it and see.
- bool hasSchema = test.exactMatch(urlStr);
-
- if (hasSchema)
- {
- QUrl qurl(urlStr, QUrl::TolerantMode);
- KUrl url(qurl);
-
- if (url.isValid())
- {
- return url;
- }
- }
-
- // Might be a file.
- if (QFile::exists(urlStr))
- {
- QFileInfo info(urlStr);
- return KUrl::fromPath(info.absoluteFilePath());
- }
-
- // Might be a shorturl - try to detect the schema.
- if (!hasSchema)
- {
- int dotIndex = urlStr.indexOf(QLatin1Char('.'));
-
- if (dotIndex != -1)
- {
- QString prefix = urlStr.left(dotIndex).toLower();
- QString schema = (prefix == QLatin1String("ftp")) ? prefix : QLatin1String("http");
- QUrl qurl(schema + QLatin1String("://") + urlStr, QUrl::TolerantMode);
- KUrl url(qurl);
-
- if (url.isValid())
- {
- return url;
- }
- }
- }
-
- // Fall back to QUrl's own tolerant parser.
- QUrl qurl = QUrl(string, QUrl::TolerantMode);
- KUrl url(qurl);
-
- // finally for cases where the user just types in a hostname add http
- if (qurl.scheme().isEmpty())
- {
- qurl = QUrl(QLatin1String("http://") + string, QUrl::TolerantMode);
- url = KUrl(qurl);
- }
- return url;
-}
-
-
void MainWindow::loadUrl(const KUrl &url)
{
m_view->loadUrl(url);
@@ -485,7 +425,7 @@ void MainWindow::slotOpenLocation()
void MainWindow::slotFileSaveAs()
{
KUrl srcUrl = currentTab()->url();
- Application::downloadManager()->newDownload(srcUrl);
+ // FIXME implement download file
}
@@ -544,7 +484,7 @@ void MainWindow::slotFileOpen()
if (filePath.isEmpty())
return;
- loadUrl(guessUrlFromString(filePath));
+ loadUrl(Application::guessUrlFromString(filePath));
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 7d0b2e5c..cc0aa2e8 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -62,7 +62,6 @@ public:
MainWindow();
~MainWindow();
- static KUrl guessUrlFromString(const QString &url);
MainView *mainView() const;
WebView *currentTab() const;
QAction *actionByName(const QString name);
diff --git a/src/modelmenu.cpp b/src/modelmenu.cpp
index 57b094ab..9ac9c512 100644
--- a/src/modelmenu.cpp
+++ b/src/modelmenu.cpp
@@ -21,6 +21,7 @@
// Self Includes
#include "modelmenu.h"
+#include "modelmenu.moc"
ModelMenu::ModelMenu(QWidget * parent)
diff --git a/src/panelhistory.cpp b/src/panelhistory.cpp
index 72507663..1282454a 100644
--- a/src/panelhistory.cpp
+++ b/src/panelhistory.cpp
@@ -22,17 +22,16 @@
#include "panelhistory.h"
#include "panelhistory.moc"
-// QT Includes
-#include <QLabel>
+// Qt Includes
+#include <QtGui/QLabel>
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QHeaderView>
// KDE Includes
#include <KLocalizedString>
#include <KLineEdit>
#include <KUrl>
-// Local Includes
-#include "history.h"
-
PanelHistory::PanelHistory(QWidget *parent)
: QWidget(parent)
diff --git a/src/panelhistory.h b/src/panelhistory.h
index c6fe1380..20152c64 100644
--- a/src/panelhistory.h
+++ b/src/panelhistory.h
@@ -22,14 +22,14 @@
// Local Includes
#include "application.h"
+#include "history.h"
// Qt Includes
-#include <QWidget>
+#include <QtGui/QWidget>
+#include <QtGui/QTreeView>
// Forward Declarations
-class QTreeView;
class KUrl;
-class TreeProxyModel;
class PanelHistory : public QWidget
diff --git a/src/searchbar.cpp b/src/searchbar.cpp
index 48e9290a..6d118a7d 100644
--- a/src/searchbar.cpp
+++ b/src/searchbar.cpp
@@ -129,4 +129,3 @@ void SearchBar::handleNetworkData(QNetworkReply *networkReply)
networkReply->deleteLater();
}
-
diff --git a/src/settings.cpp b/src/settings.cpp
index 198ab3e0..f6e73412 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -30,7 +30,8 @@
// Local Includes
#include "application.h"
#include "mainwindow.h"
-#include "cookiejar.h"
+#include "cookiedialog.h"
+#include "cookieexceptiondialog.h"
#include "history.h"
#include "networkaccessmanager.h"
#include "webview.h"
@@ -102,7 +103,7 @@ Private::Private(SettingsDialog *parent)
widget = new QWidget;
webkitUi.setupUi(widget);
widget->layout()->setMargin(0);
- pageItem = parent->addPage(widget , i18n("Webkit"));
+ pageItem = parent->addPage(widget , i18n("WebKit"));
QString webkitIconPath = KStandardDirs::locate("appdata", "pics/webkit-icon.png");
kWarning() << webkitIconPath;
KIcon webkitIcon = KIcon(QIcon(webkitIconPath));
@@ -120,7 +121,7 @@ SettingsDialog::SettingsDialog(QWidget *parent)
setFaceType(KPageDialog::List);
showButtonSeparator(true);
- setWindowTitle(i18n("rekonfig.."));
+ setWindowTitle(i18n("rekonfig..."));
setModal(true);
readConfig();
@@ -214,4 +215,3 @@ void SettingsDialog::setHomeToCurrentPage()
d->generalUi.kcfg_homePage->setText(webView->url().prettyUrl());
}
}
-
diff --git a/src/settings_fonts.ui b/src/settings_fonts.ui
index de258cad..3a00358d 100644
--- a/src/settings_fonts.ui
+++ b/src/settings_fonts.ui
@@ -25,14 +25,14 @@
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
- <string>Standard Font</string>
+ <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>
+ <string>Fixed font</string>
</property>
</widget>
</item>
@@ -58,7 +58,7 @@
<item>
<widget class="QLabel" name="label_3">
<property name="text">
- <string>Font Size</string>
+ <string>Font size</string>
</property>
</widget>
</item>
diff --git a/src/settings_general.ui b/src/settings_general.ui
index f9d272c6..95723e78 100644
--- a/src/settings_general.ui
+++ b/src/settings_general.ui
@@ -45,7 +45,7 @@
<item>
<widget class="QPushButton" name="setHomeToCurrentPageButton">
<property name="text">
- <string>Set to current page</string>
+ <string>Set to Current Page</string>
</property>
</widget>
</item>
@@ -80,7 +80,7 @@
<item row="3" column="1">
<widget class="QCheckBox" name="kcfg_downloadToDefaultDir">
<property name="text">
- <string>ask where to save downloads</string>
+ <string>Ask where to save downloads</string>
</property>
</widget>
</item>
diff --git a/src/settings_privacy.ui b/src/settings_privacy.ui
index 78202688..114743dd 100644
--- a/src/settings_privacy.ui
+++ b/src/settings_privacy.ui
@@ -76,7 +76,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
- <string>Accept Cookies:</string>
+ <string>Accept cookies:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
diff --git a/src/settings_webkit.ui b/src/settings_webkit.ui
index 32a9c0c9..a28ce915 100644
--- a/src/settings_webkit.ui
+++ b/src/settings_webkit.ui
@@ -20,7 +20,7 @@
<item row="0" column="0">
<widget class="QCheckBox" name="kcfg_autoLoadImages">
<property name="text">
- <string>Autoload Images</string>
+ <string>Autoload images</string>
</property>
</widget>
</item>
@@ -41,14 +41,14 @@
<item row="1" column="0">
<widget class="QCheckBox" name="kcfg_javascriptEnabled">
<property name="text">
- <string>Javascript support</string>
+ <string>JavaScript support</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="kcfg_zoomTextOnly">
<property name="text">
- <string>Zoom Text Only</string>
+ <string>Zoom text only</string>
</property>
</widget>
</item>
@@ -62,7 +62,7 @@
<item row="2" column="2">
<widget class="QCheckBox" name="kcfg_printElementBackgrounds">
<property name="text">
- <string>Print element Backgrounds</string>
+ <string>Print element backgrounds</string>
</property>
</widget>
</item>
@@ -76,28 +76,28 @@
<item row="3" column="2">
<widget class="QCheckBox" name="kcfg_offlineStorageDatabaseEnabled">
<property name="text">
- <string>Offline storage Database</string>
+ <string>Offline storage database</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="kcfg_javascriptCanOpenWindows">
<property name="text">
- <string>Javascript can open windows</string>
+ <string>JavaScript can open windows</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QCheckBox" name="kcfg_offlineWebApplicationCacheEnabled">
<property name="text">
- <string>Offline Web Application Cache </string>
+ <string>Offline web application cache</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="kcfg_javascriptCanAccessClipboard">
<property name="text">
- <string>Javascript can access clipboard</string>
+ <string>JavaScript can access clipboard</string>
</property>
</widget>
</item>
diff --git a/src/stackedurlbar.cpp b/src/stackedurlbar.cpp
index 113c8769..53a974fe 100644
--- a/src/stackedurlbar.cpp
+++ b/src/stackedurlbar.cpp
@@ -22,14 +22,14 @@
#include "stackedurlbar.h"
#include "stackedurlbar.moc"
-// KDE Includes
-#include "kdebug.h"
-
// Local Includes
#include "application.h"
#include "history.h"
#include "urlbar.h"
+// KDE Includes
+#include <KDebug>
+
StackedUrlBar::StackedUrlBar(QWidget *parent)
: QStackedWidget(parent)
diff --git a/src/webpage.cpp b/src/webpage.cpp
index cfbc32cf..193f2a82 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -32,7 +32,6 @@
#include "mainview.h"
#include "cookiejar.h"
#include "networkaccessmanager.h"
-#include "download.h"
#include "history.h"
#include "webview.h"
diff --git a/src/webview.cpp b/src/webview.cpp
index 216c2bd1..0ba33682 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -34,7 +34,6 @@
#include "mainview.h"
#include "cookiejar.h"
#include "networkaccessmanager.h"
-#include "download.h"
#include "history.h"
#include "webpage.h"