summaryrefslogtreecommitdiff
path: root/src/webtab
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-03-13 18:57:24 +0100
committerAndrea Diamantini <adjam7@gmail.com>2013-03-13 18:57:24 +0100
commitd387448a61c3c220484b3cc08aac04058c35a645 (patch)
tree0827a2ae92dcee48e0e4f1012f05b3fdb78ed91b /src/webtab
parentSupport Activities (diff)
downloadrekonq-d387448a61c3c220484b3cc08aac04058c35a645.tar.xz
Restore activity daemon support
BUG: 315694
Diffstat (limited to 'src/webtab')
-rw-r--r--src/webtab/webtab.cpp35
-rw-r--r--src/webtab/webtab.h14
2 files changed, 49 insertions, 0 deletions
diff --git a/src/webtab/webtab.cpp b/src/webtab/webtab.cpp
index 00a3c819..7a3213b0 100644
--- a/src/webtab/webtab.cpp
+++ b/src/webtab/webtab.cpp
@@ -58,6 +58,10 @@
#include <KParts/Part>
#include <KParts/BrowserExtension>
+#ifdef HAVE_KACTIVITIES
+#include <KActivities/ResourceInstance>
+#endif
+
// Qt Includes
#include <QVBoxLayout>
#include <QPrintDialog>
@@ -75,6 +79,9 @@ WebTab::WebTab(QWidget *parent, bool isPrivateBrowsing)
, m_zoomFactor(10)
, m_isPrivateBrowsing(isPrivateBrowsing)
, m_splitter(new QSplitter(this))
+#ifdef HAVE_KACTIVITIES
+ , m_activityResourceInstance(0)
+#endif
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
@@ -122,6 +129,16 @@ WebTab::WebTab(QWidget *parent, bool isPrivateBrowsing)
// Session Manager
connect(view(), SIGNAL(loadFinished(bool)), SessionManager::self(), SLOT(saveSession()));
+
+#ifdef HAVE_KACTIVITIES
+ if (m_isPrivateBrowsing)
+ return;
+
+ m_activityResourceInstance = new KActivities::ResourceInstance(window()->winId(), this);
+
+ connect(this, SIGNAL(urlChanged(const QUrl &)), m_activityResourceInstance, SLOT(setUri(const QUrl &)));
+ connect(this, SIGNAL(titleChanged(const QString &)), m_activityResourceInstance, SLOT(setTitle(const QString &)));
+#endif
}
@@ -482,3 +499,21 @@ void WebTab::toggleInspector(bool on)
page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, on);
}
+
+
+void WebTab::focusIn()
+{
+ if (m_isPrivateBrowsing || !m_activityResourceInstance)
+ return;
+
+ m_activityResourceInstance->notifyFocusedIn();
+}
+
+
+void WebTab::focusOut()
+{
+ if (m_isPrivateBrowsing || !m_activityResourceInstance)
+ return;
+
+ m_activityResourceInstance->notifyFocusedOut();
+}
diff --git a/src/webtab/webtab.h b/src/webtab/webtab.h
index 5fc06994..1f501323 100644
--- a/src/webtab/webtab.h
+++ b/src/webtab/webtab.h
@@ -43,6 +43,9 @@
#include <QWebInspector>
#include <QSplitter>
+// Config
+#include <config-kactivities.h>
+
// Forward Declarations
class NotificationBar;
class PreviewSelectorBar;
@@ -52,6 +55,10 @@ class WebPage;
class WebWindow;
+#ifdef HAVE_KACTIVITIES
+namespace KActivities { class ResourceInstance; }
+#endif
+
class REKONQ_TESTS_EXPORT WebTab : public QWidget
{
@@ -84,6 +91,9 @@ public:
KParts::ReadOnlyPart *part();
void setPart(KParts::ReadOnlyPart *p, const KUrl &u);
+
+ void focusIn();
+ void focusOut();
private Q_SLOTS:
void updateProgress(int progress);
@@ -140,6 +150,10 @@ private:
bool m_isPrivateBrowsing;
QSplitter *m_splitter;
+
+#ifdef HAVE_KACTIVITIES
+ KActivities::ResourceInstance *m_activityResourceInstance;
+#endif
};
#endif