summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-07-15 23:50:12 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-07-15 23:50:12 +0200
commit962f44708ea40fe9a00fed17d8b2afba0deb2856 (patch)
tree08f78ebd7ae8a6507b94f5bc716c99fadd1f25be /src
parentGoing back to simpler QtWebKit. (diff)
downloadrekonq-962f44708ea40fe9a00fed17d8b2afba0deb2856.tar.xz
Some backports from KdeWebKit and rekonq 0.1 implementation
Diffstat (limited to 'src')
-rw-r--r--src/webpage.cpp39
-rw-r--r--src/webpage.h4
-rw-r--r--src/webview.cpp17
-rw-r--r--src/webview.h14
4 files changed, 26 insertions, 48 deletions
diff --git a/src/webpage.cpp b/src/webpage.cpp
index e8e956ed..d0dd39fb 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -48,9 +48,7 @@
#include <KDE/KFileDialog>
#include <KDE/KInputDialog>
#include <KDE/KMessageBox>
-
-#include <kdewebkit/kwebpage.h>
-#include <kdewebkit/kwebview.h>
+#include <KDE/KJobUiDelegate>
// Qt Includes
#include <QtGui/QContextMenuEvent>
@@ -179,12 +177,12 @@ void WebPage::viewErrorPage(QNetworkReply *reply)
frames.append(frame);
}
}
- if (m_loadingUrl == reply->url())
- {
- mainFrame()->setHtml(html, reply->url());
- // Don't put error pages to the history.
- Application::historyManager()->removeHistoryEntry(reply->url(), mainFrame()->title());
- }
+// if (m_loadingUrl == reply->url())
+// {
+// mainFrame()->setHtml(html, reply->url());
+// // Don't put error pages to the history.
+// Application::historyManager()->removeHistoryEntry(reply->url(), mainFrame()->title());
+// }
}
@@ -257,16 +255,25 @@ void WebPage::slotDownloadRequested(const QNetworkRequest &request)
// }
//
// if (downloadViaKIO) {
-// const QString destUrl = KFileDialog::getSaveFileName(url.fileName(), QString(), view());
-// if (destUrl.isEmpty()) return;
-// KIO::Job *job = KIO::file_copy(url, KUrl(destUrl), -1, KIO::Overwrite);
-// //job->setMetaData(metadata); //TODO: add metadata from request
-// job->addMetaData("MaxCacheSize", "0"); // Don't store in http cache.
-// job->addMetaData("cache", "cache"); // Use entry from cache if available.
-// job->uiDelegate()->setAutoErrorHandlingEnabled(true);
+ const QString destUrl = KFileDialog::getSaveFileName(url.fileName(), QString(), view());
+ if (destUrl.isEmpty()) return;
+ KIO::Job *job = KIO::file_copy(url, KUrl(destUrl), -1, KIO::Overwrite);
+ //job->setMetaData(metadata); //TODO: add metadata from request
+ job->addMetaData("MaxCacheSize", "0"); // Don't store in http cache.
+ job->addMetaData("cache", "cache"); // Use entry from cache if available.
+ job->uiDelegate()->setAutoErrorHandlingEnabled(true);
// }
+
+
}
+
+QString WebPage::chooseFile(QWebFrame *frame, const QString &suggestedFile)
+{
+ return KFileDialog::getOpenFileName(suggestedFile, QString(), frame->page()->view());
+}
+
+
WebPage *WebPage::newWindow(WebWindowType type)
{
Q_UNUSED(type);
diff --git a/src/webpage.h b/src/webpage.h
index 1e25958c..d8ffc787 100644
--- a/src/webpage.h
+++ b/src/webpage.h
@@ -51,7 +51,7 @@ protected:
QWebPage *createWindow(QWebPage::WebWindowType type);
virtual WebPage *newWindow(WebWindowType type);
-// QString chooseFile(QWebFrame *frame, const QString &suggestedFile);
+ QString chooseFile(QWebFrame *frame, const QString &suggestedFile);
void javaScriptAlert(QWebFrame *frame, const QString &msg);
bool javaScriptConfirm(QWebFrame *frame, const QString &msg);
@@ -66,7 +66,7 @@ protected Q_SLOTS:
private:
void viewErrorPage(QNetworkReply *);
- KUrl m_loadingUrl;
+// KUrl m_loadingUrl;
};
#endif
diff --git a/src/webview.cpp b/src/webview.cpp
index 114a1be4..43da9fb8 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -44,9 +44,6 @@
#include <KDebug>
#include <KToolInvocation>
-#include <kdewebkit/kwebpage.h>
-#include <kdewebkit/kwebview.h>
-
// Qt Includes
#include <QtGui/QContextMenuEvent>
#include <QtGui/QWheelEvent>
@@ -79,12 +76,6 @@ WebView::WebView(QWidget* parent)
}
-// void WebView::setNewPage()
-// {
-// setPage(new WebPage(this));
-// }
-
-
KUrl WebView::url() const
{
return KUrl(QWebView::url());
@@ -103,12 +94,6 @@ int WebView::progress() const
}
-// void WebView::load(const KUrl &url)
-// {
-// QWebView::load(url);
-// }
-
-
void WebView::setProgress(int progress)
{
m_progress = progress;
@@ -201,8 +186,6 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
{
menu.addSeparator();
QAction *addBookmarkAction = Application::bookmarkProvider()->actionByName("rekonq_add_bookmark");
-// addBookmarkAction->setData(result.linkUrl());
-// addBookmarkAction->setText(i18n("&Bookmark This Link"));
menu.addAction(addBookmarkAction);
}
diff --git a/src/webview.h b/src/webview.h
index c12582d4..30ff73af 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -3,9 +3,7 @@
* This file is a part of the rekonq project
*
* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
-* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net>
* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
*
*
* This program is free software; you can redistribute it
@@ -27,16 +25,11 @@
// KDE Includes
#include <KUrl>
-#include <kdewebkit/kwebpage.h>
-#include <kdewebkit/kwebview.h>
-
// Qt Includes
#include <QWebPage>
#include <QWebView>
// Forward Declarations
-
-
class WebPage;
@@ -51,9 +44,6 @@ public:
QString lastStatusBarText() const;
int progress() const;
-// public Q_SLOTS:
-// void load(const KUrl &url);
-
signals:
// switching tabs
void ctrlTabPressed();
@@ -68,9 +58,7 @@ protected:
*/
void keyPressEvent(QKeyEvent *event);
- // to reimplement from KWebView
-// virtual void setNewPage();
-
+
private slots:
void setProgress(int progress);
void loadFinished();