summaryrefslogtreecommitdiff
path: root/src/mainview.cpp
diff options
context:
space:
mode:
authorIvan Čukić <ivan.cukic@kde.org>2012-10-23 19:40:34 +0200
committerIvan Čukić <ivan.cukic@kde.org>2012-10-23 19:40:34 +0200
commit3011d175e9c116d7448cd1b00db59e6be35c9501 (patch)
tree0226cc2615d6a4b3b28dbccfeb41b8636c842a1b /src/mainview.cpp
parentSVN_SILENT made messages (.desktop file) (diff)
downloadrekonq-3011d175e9c116d7448cd1b00db59e6be35c9501.tar.xz
Rekonq reports the open/close document events to activity manager daemon.
By knowing which window contains which documents and which one is in focus, we can do the following: - collect the statistics about visited pages. Further, this provides a score for each document visited, that depends on the number of times it was open, the time the user spent on that location, and the time passed since the last visit. - availability of a global/workspace applet that allows sharing the current document via e-mail, social networks; bookmarking and rating the link, or connecting it to the current activity. (advantage of this is a unified UI for sharing/rating/linking that works with any application) - jump-lists (not impl. yet in plasma) to list top rated documents on a launcher icon or in the task manager applet - krunner can sort the documents based on the score - more things that I haven't thought of yet There is no need to *use* ativities to have these benefits. Activities just serve as manual data clustering to provide more useful scores compared to the one-activity approach. REVIEW:106912
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r--src/mainview.cpp49
1 files changed, 47 insertions, 2 deletions
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
+