summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt19
-rw-r--r--config-kactivities.h.cmake1
-rw-r--r--src/CMakeLists.txt7
-rw-r--r--src/mainview.cpp49
-rw-r--r--src/mainview.h12
-rw-r--r--src/tests/CMakeLists.txt11
6 files changed, 92 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 030f0fbd..37311a13 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,6 +56,15 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-nepomuk.h.cmake ${CMAKE_CURREN
# ==================================================================================
+# optional KActivities requirements
+
+MACRO_OPTIONAL_FIND_PACKAGE(KActivities 6.1.0)
+MACRO_BOOL_TO_01(KActivities_FOUND HAVE_KACTIVITIES)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-kactivities.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/config-kactivities.h )
+
+
+# ==================================================================================
# optional QCA2 & QtOAuth requirements
MACRO_OPTIONAL_FIND_PACKAGE(QCA2)
@@ -146,6 +155,16 @@ IF(REKONQ_CAN_BE_COMPILED)
MESSAGE(STATUS " Rekonq will be compiled WITHOUT support for bookmarks tagging")
ENDIF(HAVE_NEPOMUK)
+ # KActivities
+
+ IF(HAVE_KACTIVITIES)
+ MESSAGE(STATUS " KActivities Libraries................. YES")
+ MESSAGE(STATUS " Rekonq will be compiled with support for document event reporting")
+ ELSE(HAVE_KACTIVITIES)
+ MESSAGE(STATUS " KActivities Libraries................. NO")
+ MESSAGE(STATUS " Rekonq will be compiled WITHOUT support for document event reporting")
+ ENDIF(HAVE_KACTIVITIES)
+
MESSAGE(STATUS "")
# QCA2
diff --git a/config-kactivities.h.cmake b/config-kactivities.h.cmake
new file mode 100644
index 00000000..e136858c
--- /dev/null
+++ b/config-kactivities.h.cmake
@@ -0,0 +1 @@
+#cmakedefine HAVE_KACTIVITIES
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6c27376f..75c1b0eb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -239,6 +239,13 @@ IF(HAVE_NEPOMUK)
)
ENDIF(HAVE_NEPOMUK)
+# KActivities optional target link libraries
+IF(HAVE_KACTIVITIES)
+ TARGET_LINK_LIBRARIES( kdeinit_rekonq
+ ${KACTIVITIES_LIBRARY}
+ )
+ENDIF(HAVE_KACTIVITIES)
+
# Opera sync optional link libraries
IF(HAVE_QCA2 AND HAVE_QTOAUTH)
TARGET_LINK_LIBRARIES( kdeinit_rekonq
diff --git a/src/mainview.cpp b/src/mainview.cpp
index b71a81ea..aa6526e8 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -52,6 +52,11 @@
#include <KMessageBox>
#include <KStandardDirs>
+#include <config-kactivities.h>
+#ifdef HAVE_KACTIVITIES
+#include <KActivities/ResourceInstance>
+#endif
+
// Qt Includes
#include <QtGui/QLabel>
#include <QtGui/QMovie>
@@ -255,6 +260,23 @@ void MainView::currentChanged(int index)
// retrieve the old webview (that where we move from)
WebTab *oldTab = this->webTab(m_currentTabIndex);
+ WebView *view = tab->view();
+
+#ifdef HAVE_KACTIVITIES
+ if (!QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
+ if (oldTab) {
+ WebView *oldView = oldTab->view();
+ if (activityResourceInstance(oldView)) {
+ activityResourceInstance(oldView)->notifyFocusedOut();
+ }
+ }
+
+ if (activityResourceInstance(view)) {
+ activityResourceInstance(view)->notifyFocusedIn();
+ }
+ }
+#endif
+
// set current index
m_currentTabIndex = index;
@@ -272,7 +294,7 @@ void MainView::currentChanged(int index)
connect(tab->page(), SIGNAL(linkHovered(QString, QString, QString)),
this, SIGNAL(linkHovered(QString)));
- emit currentTitle(tab->view()->title());
+ emit currentTitle(view->title());
m_widgetBar->setCurrentIndex(index);
// clean up "status bar"
@@ -285,7 +307,7 @@ void MainView::currentChanged(int index)
if (tab->url().scheme() == QL1S("about"))
m_widgetBar->currentWidget()->setFocus();
else
- tab->view()->setFocus();
+ view->setFocus();
tabBar()->resetTabHighlighted(index);
}
@@ -641,6 +663,21 @@ void MainView::webViewUrlChanged(const QUrl &url)
if (!tab)
return;
+#ifdef HAVE_KACTIVITIES
+ if (
+ !QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled) &&
+ !url.isEmpty() &&
+ url.scheme() != "about"
+ )
+ {
+ if (!activityResourceInstance(view)) {
+ new KActivities::ResourceInstance(window()->winId(), view);
+ }
+
+ activityResourceInstance(view)->setUri(url);
+ }
+#endif
+
int index = indexOf(tab);
if (ReKonfig::hoveringTabOption() == 2)
tabBar()->setTabToolTip(index, url.toString());
@@ -801,3 +838,11 @@ void MainView::detachTab(int index, MainWindow *toWindow)
connect(tab->page(), SIGNAL(printRequested(QWebFrame*)), w->mainView(), SIGNAL(printRequested(QWebFrame*)));
}
}
+
+#ifdef HAVE_KACTIVITIES
+KActivities::ResourceInstance * MainView::activityResourceInstance(WebView * view)
+{
+ return view->findChild<KActivities::ResourceInstance*> ();
+}
+#endif
+
diff --git a/src/mainview.h b/src/mainview.h
index 89ee36ec..d8547530 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -38,18 +38,26 @@
// KDE Includes
#include <KTabWidget>
+// Config
+#include <config-kactivities.h>
+
// Forward Declarations
class MainWindow;
class StackedUrlBar;
class TabBar;
class UrlBar;
class WebTab;
+class WebView;
class QLabel;
class QToolButton;
class QUrl;
class QWebFrame;
+#ifdef HAVE_KACTIVITIES
+namespace KActivities { class ResourceInstance; }
+#endif
+
/**
* This class represent rekonq Main View.
@@ -194,6 +202,10 @@ private:
int m_currentTabIndex;
QList<TabHistory> m_recentlyClosedTabs;
+
+#ifdef HAVE_KACTIVITIES
+ KActivities::ResourceInstance * activityResourceInstance(WebView * view);
+#endif
};
#endif // MAINVIEW_H
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index 176d1e94..560e7755 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -3,6 +3,7 @@
SET( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}/..
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_SOURCE_DIR}/../adblock
${CMAKE_CURRENT_SOURCE_DIR}/../analyzer
@@ -30,7 +31,7 @@ target_link_libraries( findbar_test
##### ------------- mainwindow test
kde4_add_unit_test( mainwindow_test mainwindow_test.cpp )
-
+
target_link_libraries( mainwindow_test
kdeinit_rekonq
${KDE4_KDECORE_LIBS}
@@ -41,7 +42,7 @@ target_link_libraries( mainwindow_test
##### ------------- mainview test
kde4_add_unit_test( mainview_test mainview_test.cpp )
-
+
target_link_libraries( mainview_test
kdeinit_rekonq
${KDE4_KDECORE_LIBS}
@@ -52,7 +53,7 @@ target_link_libraries( mainview_test
##### ------------- networkaccessmanager test
kde4_add_unit_test( networkaccessmanager_test networkaccessmanager_test.cpp )
-
+
target_link_libraries( networkaccessmanager_test
kdeinit_rekonq
${KDE4_KDECORE_LIBS}
@@ -63,7 +64,7 @@ target_link_libraries( networkaccessmanager_test
##### ------------- protocolhandler test
kde4_add_unit_test( protocolhandler_test protocolhandler_test.cpp )
-
+
target_link_libraries( protocolhandler_test
kdeinit_rekonq
${KDE4_KDECORE_LIBS}
@@ -76,7 +77,7 @@ target_link_libraries( protocolhandler_test
##### ------------- sessionmanager test
kde4_add_unit_test( sessionmanager_test sessionmanager_test.cpp )
-
+
target_link_libraries( sessionmanager_test
kdeinit_rekonq
${KDE4_KDECORE_LIBS}