From cff529dc82e77b2b3d7242c5cc5a72107827f647 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Fri, 23 Mar 2012 10:42:43 +0100 Subject: [PATCH] added code to generate gnome zeitgeist events (disabled by default) --- src/configure | 35 ++++++++++++++++++++++++++++++++++- src/configure.ac | 26 +++++++++++++++++++++++++- src/qtgui/rclmain_w.cpp | 8 ++++++++ src/qtgui/recoll.pro.in | 6 +++++- 4 files changed, 72 insertions(+), 3 deletions(-) diff --git a/src/configure b/src/configure index 754e8716..751b750b 100755 --- a/src/configure +++ b/src/configure @@ -603,6 +603,9 @@ ac_subst_vars='LTLIBOBJS LIBOBJS RCLVERSION NOPIC +LIBQZEITGEIST +QMAKE_DISABLE_ZEITGEIST +QMAKE_ENABLE_ZEITGEIST QMAKE_DISABLE_WEBKIT QMAKE_ENABLE_WEBKIT NOCMDLINE @@ -692,6 +695,7 @@ enable_camelcase enable_pic enable_qtgui enable_webkit +with_qzeitgeist enable_x11mon with_x ' @@ -1358,6 +1362,8 @@ Optional Packages: indexing of modified files. Give the fam/gamin library as argument (ie: /usr/lib/libfam.so) if configure does not find the right one. + --with-qzeitgeist Enable the use of the qzeitgeist library to send + zeitgeist events. --with-x use the X Window System Some influential environment variables: @@ -4731,10 +4737,34 @@ fi QMAKE_DISABLE_WEBKIT="" fi + ##### Using QZeitGeist lib ? Default no for now + +# Check whether --with-qzeitgeist was given. +if test "${with_qzeitgeist+set}" = set; then : + withval=$with_qzeitgeist; withQZeitgeist=$withval +else + withQZeitgeist="no" +fi + + + case "$withQZeitgeist" in + no) LIBQZEITGEIST=;; + yes) LIBQZEITGEIST=-lqzeitgeist;; + *) LIBQZEITGEIST=$withQZeitgeist;; + esac + + if test "$withQZeitgeist" != "no" ; then + QMAKE_ENABLE_ZEITGEIST="" + QMAKE_DISABLE_ZEITGEIST="#" + else + QMAKE_ENABLE_ZEITGEIST="#" + QMAKE_DISABLE_ZEITGEIST="" + fi + ac_config_files="$ac_config_files $QTGUI/recoll.pro" - ##################### End QT detection + ##################### End QT stuff fi @@ -5609,6 +5639,9 @@ RCLVERSION='1.17.0' + + + diff --git a/src/configure.ac b/src/configure.ac index b4d49ad3..87a7f309 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -419,8 +419,29 @@ else QMAKE_DISABLE_WEBKIT="" fi + ##### Using QZeitGeist lib ? Default no for now + AC_ARG_WITH(qzeitgeist, + AC_HELP_STRING([--with-qzeitgeist], + [Enable the use of the qzeitgeist library to send zeitgeist events.]), + withQZeitgeist=$withval, withQZeitgeist="no") + + case "$withQZeitgeist" in + no) LIBQZEITGEIST=;; + yes) LIBQZEITGEIST=-lqzeitgeist;; + *) LIBQZEITGEIST=$withQZeitgeist;; + esac + + if test "$withQZeitgeist" != "no" ; then + QMAKE_ENABLE_ZEITGEIST="" + QMAKE_DISABLE_ZEITGEIST="#" + else + QMAKE_ENABLE_ZEITGEIST="#" + QMAKE_DISABLE_ZEITGEIST="" + fi + AC_CONFIG_FILES($QTGUI/recoll.pro) - ##################### End QT detection + + ##################### End QT stuff fi @@ -475,6 +496,9 @@ AC_SUBST(NOQTMAKE) AC_SUBST(NOCMDLINE) AC_SUBST(QMAKE_ENABLE_WEBKIT) AC_SUBST(QMAKE_DISABLE_WEBKIT) +AC_SUBST(QMAKE_ENABLE_ZEITGEIST) +AC_SUBST(QMAKE_DISABLE_ZEITGEIST) +AC_SUBST(LIBQZEITGEIST) AC_SUBST(NOPIC) AC_SUBST(RCLVERSION) diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp index 3307ed6d..307bf104 100644 --- a/src/qtgui/rclmain_w.cpp +++ b/src/qtgui/rclmain_w.cpp @@ -77,6 +77,7 @@ using std::pair; #include "crontool.h" #include "rtitool.h" #include "indexer.h" +#include "rclzg.h" using namespace confgui; @@ -1149,6 +1150,8 @@ void RclMain::startPreview(int docnum, Rcl::Doc doc, int mod) } } } + // Do the zeitgeist thing + zg_send_event(ZGSEND_PREVIEW, doc); if (mod & Qt::ShiftModifier) { // User wants new preview window @@ -1231,6 +1234,8 @@ void RclMain::startPreview(Rcl::Doc doc) this, SLOT (fileExit())); connect(preview, SIGNAL(wordSelect(QString)), sSearch, SLOT(addTerm(QString))); + // Do the zeitgeist thing + zg_send_event(ZGSEND_PREVIEW, doc); preview->show(); preview->makeDocCurrent(doc, 0); } @@ -1621,6 +1626,9 @@ void RclMain::startNativeViewer(Rcl::Doc doc) if (!istempfile) historyEnterDoc(g_dynconf, doc.meta[Rcl::Doc::keyudi]); + + // Do the zeitgeist thing + zg_send_event(ZGSEND_OPEN, doc); // We keep pushing back and never deleting. This can't be good... ExecCmd *ecmd = new ExecCmd; diff --git a/src/qtgui/recoll.pro.in b/src/qtgui/recoll.pro.in index 8fa6556e..abdbb2d0 100644 --- a/src/qtgui/recoll.pro.in +++ b/src/qtgui/recoll.pro.in @@ -4,6 +4,9 @@ LANGUAGE = C++ @QMAKE_ENABLE_WEBKIT@QT += webkit @QMAKE_DISABLE_WEBKIT@QMAKE_CXXFLAGS += -DRESLIST_TEXTBROWSER +@QMAKE_ENABLE_ZEITGEIST@QT += dbus +@QMAKE_ENABLE_ZEITGEIST@QMAKE_CXXFLAGS += -DUSE_ZEITGEIST + CONFIG += qt warn_on thread release HEADERS += \ @@ -38,6 +41,7 @@ SOURCES += \ preview_w.cpp \ rclhelp.cpp \ rclmain_w.cpp \ + rclzg.cpp \ reslist.cpp \ restable.cpp \ rtitool.cpp \ @@ -73,7 +77,7 @@ unix { LIBS += ../lib/librcl.a \ $(BSTATIC) @LIBXAPIAN@ $(LIBXAPIANSTATICEXTRA) @LIBICONV@ $(BDYNAMIC) \ - -lz + @LIBQZEITGEIST@ -lz INCLUDEPATH += ../common ../index ../internfile ../query ../unac \ ../utils ../aspell ../rcldb ../qtgui \