diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2012-10-20 12:01:27 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2012-12-10 02:48:05 +0100 |
commit | b204e6254bd0c2227bbbb81519a0ddcf174d2ad4 (patch) | |
tree | 0badb3885331b2d700388e96ac59532d6b7dd867 /src/webtab | |
parent | Enable incognito mode by calling "rekonq --incognito URL" :) (diff) | |
download | rekonq-b204e6254bd0c2227bbbb81519a0ddcf174d2ad4.tar.xz |
enable webapp mode by calling "rekonq --webapp URL" :D
NOTE: in my opinion, this is a great feature that needs a lot of
attention and testing. But it's really cool to see how it works... ;)
Diffstat (limited to 'src/webtab')
-rw-r--r-- | src/webtab/webtab.cpp | 28 | ||||
-rw-r--r-- | src/webtab/webtab.h | 4 | ||||
-rw-r--r-- | src/webtab/webview.cpp | 59 |
3 files changed, 70 insertions, 21 deletions
diff --git a/src/webtab/webtab.cpp b/src/webtab/webtab.cpp index 036f62c0..bb616770 100644 --- a/src/webtab/webtab.cpp +++ b/src/webtab/webtab.cpp @@ -34,6 +34,7 @@ // Local Includes #include "historymanager.h" +#include "iconmanager.h" #include "sessionmanager.h" #include "syncmanager.h" @@ -92,9 +93,18 @@ WebTab::WebTab(QWidget *parent) connect(view(), SIGNAL(loadProgress(int)), this, SLOT(updateProgress(int))); connect(view(), SIGNAL(loadStarted()), this, SLOT(resetProgress())); - connect(view(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); connect(view(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); + if (parent) + { + connect(view(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); + } + else + { + connect(view(), SIGNAL(titleChanged(QString)), this, SLOT(webAppTitleChanged(QString))); + connect(view(), SIGNAL(iconChanged()), this, SLOT(webAppIconChanged())); + } + // Session Manager connect(view(), SIGNAL(loadFinished(bool)), SessionManager::self(), SLOT(saveSession())); } @@ -394,3 +404,19 @@ void WebTab::zoomDefault() emit infoToShow(i18n("Default zoom: ") + QString::number(m_zoomFactor * 10) + QL1S("%")); } + + +void WebTab::webAppTitleChanged(QString title) +{ + + if (title.isEmpty()) + setWindowTitle(i18n("rekonq")); + else + setWindowTitle(title); +} + + +void WebTab::webAppIconChanged() +{ + setWindowIcon(IconManager::self()->iconForUrl(url())); +} diff --git a/src/webtab/webtab.h b/src/webtab/webtab.h index 6a9e844f..361da2c4 100644 --- a/src/webtab/webtab.h +++ b/src/webtab/webtab.h @@ -98,6 +98,10 @@ private Q_SLOTS: void zoomOut(); void zoomDefault(); + // webapp slots per title & icon + void webAppTitleChanged(QString); + void webAppIconChanged(); + Q_SIGNALS: void loadProgressing(); void titleChanged(const QString &); diff --git a/src/webtab/webview.cpp b/src/webtab/webview.cpp index e8b629ec..df4af0b3 100644 --- a/src/webtab/webview.cpp +++ b/src/webtab/webview.cpp @@ -314,7 +314,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) menu.addAction(pageAction(KWebPage::Forward)); } - menu.addAction(webwin->actionByName("view_redisplay")); + menu.addAction(pageAction(KWebPage::Reload)); menu.addSeparator(); @@ -333,7 +333,8 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) // Page Actions menu.addAction(pageAction(KWebPage::SelectAll)); - menu.addAction(webwin->actionByName(KStandardAction::name(KStandardAction::SaveAs))); + if (webwin) + menu.addAction(webwin->actionByName(KStandardAction::name(KStandardAction::SaveAs))); if (!KStandardDirs::findExe("kget").isNull() && ReKonfig::kgetList()) { @@ -342,13 +343,19 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) menu.addAction(a); } - menu.addAction(webwin->actionByName("page_source")); - menu.addAction(inspectAction); - + if (webwin) + { + menu.addAction(webwin->actionByName("page_source")); + menu.addAction(inspectAction); + } + // we need to show everytime this because we cannot communicate with the tabwindow. // We are NOT sure it exists.. - menu.addSeparator(); - menu.addAction(webwin->actionByName(KStandardAction::name(KStandardAction::FullScreen))); + if (webwin) + { + menu.addSeparator(); + menu.addAction(webwin->actionByName(KStandardAction::name(KStandardAction::FullScreen))); + } } // LINK ACTIONS ------------------------------------------------------------------- @@ -358,21 +365,27 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) sendByMailAction->setData(m_contextMenuHitResult.linkUrl()); sendByMailAction->setText(i18n("Share link")); - a = new KAction(KIcon("tab-new"), i18n("Open in New &Tab"), this); - a->setData(m_contextMenuHitResult.linkUrl()); - connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewTab())); - menu.addAction(a); - + if (webwin) + { + a = new KAction(KIcon("tab-new"), i18n("Open in New &Tab"), this); + a->setData(m_contextMenuHitResult.linkUrl()); + connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewTab())); + menu.addAction(a); + } + a = new KAction(KIcon("window-new"), i18n("Open in New &Window"), this); a->setData(m_contextMenuHitResult.linkUrl()); connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewWindow())); menu.addAction(a); - a = new KAction(KIcon("view-media-artist"), i18n("Open in Private &Window"), this); - a->setData(m_contextMenuHitResult.linkUrl()); - connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInPrivateWindow())); - menu.addAction(a); - + if (webwin) + { + a = new KAction(KIcon("view-media-artist"), i18n("Open in Private &Window"), this); + a->setData(m_contextMenuHitResult.linkUrl()); + connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInPrivateWindow())); + menu.addAction(a); + } + menu.addSeparator(); // Don't show dots if we are NOT going to ask for download path @@ -517,11 +530,17 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) } else { - a = webwin->actionByName(KStandardAction::name(KStandardAction::AddBookmark)); - menu.addAction(a); + if (webwin) + { + a = webwin->actionByName(KStandardAction::name(KStandardAction::AddBookmark)); + menu.addAction(a); + } } + menu.addAction(sendByMailAction); - menu.addAction(inspectAction); + + if (webwin) + menu.addAction(inspectAction); // SPELL CHECK Actions if (m_contextMenuHitResult.isContentEditable()) |