summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tabwindow/tabwidget.cpp20
-rw-r--r--src/tabwindow/tabwidget.h2
-rw-r--r--src/webtab/webtab.cpp35
-rw-r--r--src/webtab/webtab.h14
4 files changed, 70 insertions, 1 deletions
diff --git a/src/tabwindow/tabwidget.cpp b/src/tabwindow/tabwidget.cpp
index bdc7a47a..9494fad4 100644
--- a/src/tabwindow/tabwidget.cpp
+++ b/src/tabwindow/tabwidget.cpp
@@ -35,9 +35,11 @@
#include "application.h"
#include "rekonqwindow.h"
+#include "tabbar.h"
+
#include "webpage.h"
+#include "webtab.h"
#include "webwindow.h"
-#include "tabbar.h"
#include "tabhistory.h"
@@ -78,6 +80,7 @@ TabWidget::TabWidget(bool withTab, bool PrivateBrowsingMode, QWidget *parent)
, _openedTabsCounter(0)
, _isPrivateBrowsing(PrivateBrowsingMode)
, _ac(new KActionCollection(this))
+ , _lastCurrentTabIndex(-1)
{
init();
@@ -98,6 +101,7 @@ TabWidget::TabWidget(WebPage *pg, QWidget *parent)
, _openedTabsCounter(0)
, _isPrivateBrowsing(false)
, _ac(new KActionCollection(this))
+ , _lastCurrentTabIndex(-1)
{
init();
@@ -394,6 +398,8 @@ void TabWidget::pageCreated(WebPage *page)
void TabWidget::currentChanged(int newIndex)
{
+ _lastCurrentTabIndex = newIndex;
+
_openedTabsCounter = 0;
tabBar()->setTabHighlighted(newIndex, false);
@@ -403,6 +409,8 @@ void TabWidget::currentChanged(int newIndex)
if (!tab)
return;
+ tab->tabView()->focusIn();
+
QString t = tab->title();
(t.isEmpty() || t == QL1S("rekonq"))
@@ -410,6 +418,16 @@ void TabWidget::currentChanged(int newIndex)
: setWindowTitle(t + QL1S(" - rekonq"));
tab->checkFocus();
+
+ // ----------------------------------------------------
+
+ WebWindow *oldTab = webWindow(_lastCurrentTabIndex);
+ if (!oldTab)
+ return;
+
+ oldTab->tabView()->focusOut();
+
+ _lastCurrentTabIndex = newIndex;
}
diff --git a/src/tabwindow/tabwidget.h b/src/tabwindow/tabwidget.h
index 2718904c..a6b36e33 100644
--- a/src/tabwindow/tabwidget.h
+++ b/src/tabwindow/tabwidget.h
@@ -144,6 +144,8 @@ private:
bool _isPrivateBrowsing;
KActionCollection *_ac;
+
+ int _lastCurrentTabIndex;
};
#endif // TAB_WIDGET
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