diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-07-17 15:58:50 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-07-17 16:15:49 +0200 |
commit | 678111bf5cd271f85668b02b8ac9e3bffa5eb321 (patch) | |
tree | 818b844bc2184a34b05cdf63652f4f607a4531f0 /src | |
parent | Some lines commented out (diff) | |
download | rekonq-678111bf5cd271f85668b02b8ac9e3bffa5eb321.tar.xz |
Cleaning a bit WebPage implementation to load faster rekonq
Diffstat (limited to 'src')
-rw-r--r-- | src/webpage.cpp | 44 | ||||
-rw-r--r-- | src/webview.cpp | 46 |
2 files changed, 36 insertions, 54 deletions
diff --git a/src/webpage.cpp b/src/webpage.cpp index ecf61715..220db907 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -79,51 +79,7 @@ WebPage::WebPage(QObject *parent) setNetworkAccessManager(Application::networkAccessManager()); connect(networkAccessManager(), SIGNAL(finished(QNetworkReply*)), this, SLOT(manageNetworkErrors(QNetworkReply*))); - action(Back)->setIcon(KIcon("go-previous")); - action(Back)->setShortcut(KStandardShortcut::back().primary()); - - action(Forward)->setIcon(KIcon("go-next")); - action(Forward)->setShortcut(KStandardShortcut::forward().primary()); - - action(Reload)->setIcon(KIcon("view-refresh")); - action(Reload)->setShortcut(KStandardShortcut::reload().primary()); - - action(Stop)->setIcon(KIcon("process-stop")); - action(Stop)->setShortcut(Qt::Key_Escape); - - action(Cut)->setIcon(KIcon("edit-cut")); - action(Cut)->setShortcut(KStandardShortcut::cut().primary()); - - action(Copy)->setIcon(KIcon("edit-copy")); - action(Copy)->setShortcut(KStandardShortcut::copy().primary()); - - action(Paste)->setIcon(KIcon("edit-paste")); - action(Paste)->setShortcut(KStandardShortcut::paste().primary()); - - action(Undo)->setIcon(KIcon("edit-undo")); - action(Undo)->setShortcut(KStandardShortcut::undo().primary()); - - action(Redo)->setIcon(KIcon("edit-redo")); - action(Redo)->setShortcut(KStandardShortcut::redo().primary()); - - action(InspectElement)->setIcon(KIcon("view-process-all")); - action(OpenLinkInNewWindow)->setIcon(KIcon("window-new")); - action(OpenFrameInNewWindow)->setIcon(KIcon("window-new")); - action(OpenImageInNewWindow)->setIcon(KIcon("window-new")); - action(CopyLinkToClipboard)->setIcon(KIcon("edit-copy")); - action(CopyImageToClipboard)->setIcon(KIcon("edit-copy")); - action(ToggleBold)->setIcon(KIcon("format-text-bold")); - action(ToggleItalic)->setIcon(KIcon("format-text-italic")); - action(ToggleUnderline)->setIcon(KIcon("format-text-underline")); - action(DownloadLinkToDisk)->setIcon(KIcon("document-save")); - action(DownloadImageToDisk)->setIcon(KIcon("document-save")); - - settings()->setWebGraphic(QWebSettings::MissingPluginGraphic, KIcon("preferences-plugin").pixmap(32, 32)); - settings()->setWebGraphic(QWebSettings::MissingImageGraphic, KIcon("image-missing").pixmap(32, 32)); - settings()->setWebGraphic(QWebSettings::DefaultFrameIconGraphic, KIcon("applications-internet").pixmap(32, 32)); - connect(this, SIGNAL(downloadRequested(const QNetworkRequest &)), this, SLOT(slotDownloadRequested(const QNetworkRequest &))); - connect(this, SIGNAL(unsupportedContent(QNetworkReply *)), this, SLOT(slotHandleUnsupportedContent(QNetworkReply *))); } diff --git a/src/webview.cpp b/src/webview.cpp index 417a78ba..4e308806 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -48,6 +48,7 @@ #include <QtGui/QMouseEvent> #include <QtGui/QClipboard> #include <QtGui/QKeyEvent> +#include <QtGui/QAction> #include <QtNetwork/QNetworkReply> #include <QtNetwork/QNetworkRequest> @@ -108,13 +109,15 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) MainWindow *mainwindow = Application::instance()->mainWindow(); KMenu menu(this); - + QAction *a; + // link actions bool linkIsEmpty = result.linkUrl().isEmpty(); if (!linkIsEmpty) { - QAction *a = pageAction(QWebPage::OpenLinkInNewWindow); + a = pageAction(QWebPage::OpenLinkInNewWindow); a->setText(i18n("Open Link in New &Tab")); + a->setIcon(KIcon("window-new")); menu.addAction(a); } else @@ -127,7 +130,9 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) // Developer Extras actions if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled)) { - menu.addAction(pageAction(QWebPage::InspectElement)); + a = pageAction(QWebPage::InspectElement); + a->setIcon(KIcon("view-process-all")); + menu.addAction(a); menu.addSeparator(); } @@ -136,19 +141,28 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) if (result.isContentSelected() && result.isContentEditable()) { - menu.addAction(pageAction(QWebPage::Cut)); + a = pageAction(QWebPage::Cut); + a->setIcon(KIcon("edit-cut")); + a->setShortcut(KStandardShortcut::cut().primary()); + menu.addAction(a); b = true; } if (result.isContentSelected()) { - menu.addAction(pageAction(QWebPage::Copy)); + a = pageAction(QWebPage::Copy); + a->setIcon(KIcon("edit-copy")); + a->setShortcut(KStandardShortcut::copy().primary()); + menu.addAction(a); b = true; } if (result.isContentEditable()) { - menu.addAction(pageAction(QWebPage::Paste)); + a = pageAction(QWebPage::Paste); + a->setIcon(KIcon("edit-paste")); + a->setShortcut(KStandardShortcut::paste().primary()); + menu.addAction(a); b = true; } @@ -160,15 +174,27 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) // save/copy link actions if (!linkIsEmpty) { - menu.addAction(pageAction(QWebPage::DownloadLinkToDisk)); - menu.addAction(pageAction(QWebPage::CopyLinkToClipboard)); + a = pageAction(QWebPage::DownloadLinkToDisk); + a->setIcon(KIcon("document-save")); + menu.addAction(a); + + a = pageAction(QWebPage::CopyLinkToClipboard); + a->setIcon(KIcon("edit-copy")); + menu.addAction(a); + menu.addSeparator(); if (!result.pixmap().isNull()) { // TODO Add "View Image" && remove copy_this_image action - menu.addAction(pageAction(QWebPage::DownloadImageToDisk)); - menu.addAction(pageAction(QWebPage::CopyImageToClipboard)); + a = pageAction(QWebPage::DownloadImageToDisk); + a->setIcon(KIcon("document-save")); + menu.addAction(a); + + a = pageAction(QWebPage::CopyImageToClipboard); + a->setIcon(KIcon("edit-copy")); + menu.addAction(a); + menu.addSeparator(); } } |