[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim
From:       Volker Krause <vkrause () kde ! org>
Date:       2010-11-29 15:16:20
Message-ID: 20101129151620.795DFAC8A4 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1202074 by vkrause:

Allow to optionally build korgac as an Akonadi agent that runs inside
the Akonadi agent server. Mostly needed for WinCE, to reduce the number
of processes there.


 M  +24 -1     korganizer/korgac/CMakeLists.txt  
 M  +19 -10    korganizer/korgac/koalarmclient.cpp  
 A             korganizer/korgac/korgacagent.cpp   [License: LGPL (v2+)]
 A             korganizer/korgac/korgacagent.desktop  
 A             korganizer/korgac/korgacagent.h   [License: LGPL (v2+)]
 M  +1 -0      runtime/resources/agentserver/CMakeLists.txt  
 M  +1 -0      runtime/resources/agentserver/dummy_main.cpp  


--- trunk/KDE/kdepim/korganizer/korgac/CMakeLists.txt #1202073:1202074
@@ -1,6 +1,11 @@
 remove_definitions(-DKDE_DEFAULT_DEBUG_AREA=5850) #remove korganizer debug area
 add_definitions(-DKDE_DEFAULT_DEBUG_AREA=5890)
 
+option(KORGAC_AKONADI_AGENT FALSE "Build Korgac as Akonadi agent instead of a stand-alone process")
+if (KORGAC_AKONADI_AGENT)
+  add_definitions( -DKORGAC_AKONADI_AGENT )
+endif ()
+
 add_subdirectory(pixmaps) 
 add_subdirectory(tests) 
 include_directories(
@@ -11,9 +16,14 @@
 ########### next target ###############
 
 set(korgac_SRCS 
-   korgacmain.cpp 
    koalarmclient.cpp)
 
+if(KORGAC_AKONADI_AGENT)
+  set(korgac_SRCS ${korgac_SRCS} korgacagent.cpp)
+else()
+  set(korgac_SRCS ${korgac_SRCS} korgacmain.cpp)
+endif()
+
 if(NOT WINCE)   
 set(korgac_SRCS
    ${korgac_SRCS}
@@ -35,7 +45,15 @@
 
 kde4_add_app_icon(korgac_SRCS "${KDE4_ICON_DIR}/oxygen/*/apps/korgac.png")
 
+if(KORGAC_AKONADI_AGENT)
+  if(NOT WINCE)
+    kde4_add_plugin(korgac ${korgac_SRCS})
+  else()
+    kde4_add_plugin(korgac STATIC ${korgac_SRCS})
+  endif()
+else()
 kde4_add_executable(korgac ${korgac_SRCS})
+endif()
 
 target_link_libraries(korgac
   calendarsupport
@@ -64,7 +82,12 @@
   target_link_libraries( korgac ${QT_QMAEMO5_LIBRARY} )
 endif ()
 
+if(KORGAC_AKONADI_AGENT)
+  install(TARGETS korgac DESTINATION ${PLUGIN_INSTALL_DIR})
+  install(FILES korgacagent.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/akonadi/agents)
+else()
 install(TARGETS korgac ${INSTALL_TARGETS_DEFAULT_ARGS})
+endif()
 
 
 ########### install files ###############
--- trunk/KDE/kdepim/korganizer/korgac/koalarmclient.cpp #1202073:1202074
@@ -26,7 +26,7 @@
 //krazy:excludeall=kdebug because we use the korgac(check) debug area in here
 
 #include "koalarmclient.h"
-#ifndef _WIN32_WCE
+#ifndef KORGAC_AKONADI_AGENT
 #include "alarmdialog.h"
 #include "alarmdockwindow.h"
 #else
@@ -38,6 +38,7 @@
 #include <Akonadi/ChangeRecorder>
 #include <Akonadi/Session>
 #include <Akonadi/ItemFetchScope>
+#include <akonadi/dbusconnectionpool.h>
 
 #include <calendarsupport/calendar.h>
 #include <calendarsupport/calendarmodel.h>
@@ -63,14 +64,14 @@
   : QObject( parent ), mDocker( 0 ), mDialog( 0 )
 {
   new KOrgacAdaptor( this );
-  QDBusConnection::sessionBus().registerObject( "/ac", this );
+  Akonadi::DBusConnectionPool::threadConnection().registerObject( "/ac", this );
   kDebug();
 
+#ifndef KORGAC_AKONADI_AGENT
   KConfig korgConfig( KStandardDirs::locate( "config", "korganizerrc" ) );
   KConfigGroup generalGroup( &korgConfig, "General" );
   bool showDock = generalGroup.readEntry( "ShowReminderDaemon", true );
 
-#ifndef _WIN32_WCE
   if ( showDock ) {
     mDocker = new AlarmDockWindow;
 
@@ -145,10 +146,10 @@
 KOAlarmClient::~KOAlarmClient()
 {
   delete mCalendar;
-#ifndef _WIN32_WCE
+#ifndef KORGAC_AKONADI_AGENT
   delete mDocker;
+  delete mDialog;
 #endif
-  delete mDialog;
 }
 
 void KOAlarmClient::checkAlarms()
@@ -186,7 +187,7 @@
     return;
   }
 
-#if !defined(Q_WS_MAEMO_5) && !defined(_WIN32_WCE)
+#if !defined(Q_WS_MAEMO_5) && !defined(_WIN32_WCE) && !defined(KORGAC_AKONADI_AGENT)
   if ( !mDialog ) {
     mDialog = new AlarmDialog( calendar );
     connect( this, SIGNAL(saveAllSignal()), mDialog, SLOT(slotSave()) );
@@ -202,15 +203,21 @@
 
   mDialog->addIncidence( aitem, dt, displayText );
   mDialog->wakeUp();
-#elif defined(Q_WS_MAEMO_5)
+#else
   const Incidence::Ptr incidence = CalendarSupport::incidence( aitem );
+  Q_UNUSED( calendar );
+  Q_UNUSED( dt );
+  Q_UNUSED( displayText );
+
+#if defined(Q_WS_MAEMO_5)
   QMaemo5InformationBox::information( 0, incidence->summary(), QMaemo5InformationBox::NoTimeout );
 #else
-  const Incidence::Ptr incidence = CalendarSupport::incidence( aitem );
   KNotification *notify = new KNotification( "reminder", 0L, KNotification::Persistent );
   notify->setText( incidence->summary() );
   notify->sendEvent(); 
 #endif
+
+#endif
   saveLastCheckTime();
 }
 
@@ -231,7 +238,9 @@
 void KOAlarmClient::quit()
 {
   kDebug();
+#ifndef KORGAC_AKONADI_AGENT
   kapp->quit();
+#endif
 }
 
 #ifndef _WIN32_WCE
@@ -286,7 +295,7 @@
 
 void KOAlarmClient::hide()
 {
-#ifndef _WIN32_WCE
+#ifndef KORGAC_AKONADI_AGENT
   delete mDocker;
   mDocker = 0;
 #endif
@@ -294,7 +303,7 @@
 
 void KOAlarmClient::show()
 {
-#ifndef _WIN32_WCE
+#ifndef KORGAC_AKONADI_AGENT
   if ( !mDocker ) {
     mDocker = new AlarmDockWindow;
 
--- trunk/KDE/kdepim/runtime/resources/agentserver/CMakeLists.txt #1202073:1202074
@@ -15,6 +15,7 @@
   akonadi_maildir_resource
   akonadi_akonotes_resource
   akonadi_contacts_resource
+  korgac
 
   akonadi_serializer_mail
   akonadi_serializer_kcalcore
--- trunk/KDE/kdepim/runtime/resources/agentserver/dummy_main.cpp #1202073:1202074
@@ -24,6 +24,7 @@
 Q_IMPORT_PLUGIN(akonadi_maildir_resource)
 Q_IMPORT_PLUGIN(akonadi_akonotes_resource)
 Q_IMPORT_PLUGIN(akonadi_contacts_resource)
+Q_IMPORT_PLUGIN(korgac)
 
 Q_IMPORT_PLUGIN(akonadi_serializer_mail)
 Q_IMPORT_PLUGIN(akonadi_serializer_addressee)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic