Konqueror 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:106908
This commit is contained in:
Ivan Čukić 2012-10-18 12:53:50 +02:00
parent 47901c38e8
commit ff21d2c529
3 changed files with 39 additions and 0 deletions

View file

@ -96,6 +96,9 @@ if (UNIX)
target_link_libraries(kdeinit_konqueror ${X11_LIBRARIES})
endif (UNIX)
if (KActivities_FOUND)
target_link_libraries(kdeinit_konqueror ${KACTIVITIES_LIBRARY})
endif (KActivities_FOUND)
if (NOT WIN32)
install(TARGETS kdeinit_konqueror ${INSTALL_TARGETS_DEFAULT_ARGS} )

View file

@ -53,6 +53,9 @@
#include <QtCore/QFile>
#include <QScrollArea>
#ifdef KActivities_FOUND
#include <KActivities/ResourceInstance>
#endif
//#define DEBUG_HISTORY
@ -103,6 +106,10 @@ KonqView::KonqView( KonqViewFactory &viewFactory,
m_bURLDropHandling = false;
m_bErrorURL = false;
#ifdef KActivities_FOUND
m_activityResourceInstance = new KActivities::ResourceInstance(mainWindow->winId(), this);
#endif
switchView( viewFactory );
}
@ -213,6 +220,14 @@ void KonqView::openUrl( const KUrl &url, const QString & locationBarURL,
#ifdef DEBUG_HISTORY
kDebug() << "Current position:" << historyIndex();
#endif
#ifdef KActivities_FOUND
m_activityResourceInstance->setUri( url );
if ( m_pPart->widget()->hasFocus() ) {
m_activityResourceInstance->notifyFocusedIn();
}
#endif
}
void KonqView::switchView( KonqViewFactory &viewFactory )
@ -1190,6 +1205,13 @@ bool KonqView::eventFilter( QObject *obj, QEvent *e )
{
setActiveComponent();
}
#ifdef KActivities_FOUND
if ( e->type() == QEvent::FocusOut ) {
m_activityResourceInstance->notifyFocusedOut();
}
#endif
return false;
}
@ -1199,6 +1221,10 @@ void KonqView::setActiveComponent()
KGlobal::setActiveComponent( KGlobal::mainComponent() );
else
KGlobal::setActiveComponent( m_pPart->componentData() );
#ifdef KActivities_FOUND
m_activityResourceInstance->notifyFocusedIn();
#endif
}
bool KonqView::prepareReload( KParts::OpenUrlArguments& args, KParts::BrowserArguments& browserArgs, bool softReload )

View file

@ -34,6 +34,8 @@
#include <QtCore/QPointer>
#include <QtCore/QEvent>
#include <config-apps.h>
class KonqRun;
class KonqFrame;
class KonqBrowserInterface;
@ -43,6 +45,10 @@ namespace KParts
class StatusBarExtension;
}
#ifdef KActivities_FOUND
namespace KActivities { class ResourceInstance; }
#endif
// TODO: make the history-handling code reuseable (e.g. in kparts) for people who want to use a
// khtml-based browser in some apps. Back/forward support is all in here currently.
struct HistoryEntry
@ -558,6 +564,10 @@ private:
QString m_dbusObjectPath;
KonqBrowserInterface *m_browserIface;
int m_randID;
#ifdef KActivities_FOUND
KActivities::ResourceInstance *m_activityResourceInstance;
#endif
};
#endif