Changeset 1616

Show
Ignore:
Timestamp:
01/19/07 20:56:29 (23 months ago)
Author:
mjahn
Message:

apply fix based one XMPM changes against OpenSync?? kdepim plugin 0440-error_app_running.patch

Location:
plugins/kdepim/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • plugins/kdepim/src/kaddrbook.cpp

    r1213 r1616  
    2727 
    2828#include "kaddrbook.h" 
     29#include <kapplication.h> 
     30#include <dcopclient.h> 
    2931#include <qdeepcopy.h> 
    3032 
     
    5961        osync_trace(TRACE_ENTRY, "%s(%p)", __func__, ctx); 
    6062         
     63        DCOPClient *dcopc = KApplication::kApplication()->dcopClient(); 
     64        if (!dcopc) { 
     65                osync_context_report_error(ctx, OSYNC_ERROR_INITIALIZATION, "Unable to initialize dcop client"); 
     66                osync_trace(TRACE_EXIT_ERROR, "%s: Unable to initialize dcop client", __func__); 
     67                return false; 
     68        } 
     69 
     70        QString appId = dcopc->registerAs("opensync-kaddrbook"); 
     71 
     72        //check if kaddressbook is running, and return an error if it 
     73        //is running 
     74        if (dcopc->isApplicationRegistered("kaddressbook")) { 
     75                osync_context_report_error(ctx, OSYNC_ERROR_APP_RUNNING, "KAddressBook is running. Please finish it"); 
     76                osync_trace(TRACE_EXIT_ERROR, "%s: KAddressBook is running", __func__); 
     77                return false; 
     78        } 
     79 
    6180        //get a handle to the standard KDE addressbook 
    6281        addressbookptr = KABC::StdAddressBook::self(); 
  • plugins/kdepim/src/kcal.cpp

    r1472 r1616  
    2626#include "kcal.h" 
    2727 
     28#include <kapplication.h> 
     29#include <dcopclient.h> 
     30 
    2831KCalDataSource::KCalDataSource(OSyncMember *member, OSyncHashTable *hashtable) 
    2932    : hashtable(hashtable), member(member) 
     
    3437bool KCalDataSource::connect(OSyncContext *ctx) 
    3538{ 
     39 
     40        DCOPClient *dcopc = KApplication::kApplication()->dcopClient(); 
     41        if (!dcopc) { 
     42                osync_context_report_error(ctx, OSYNC_ERROR_INITIALIZATION, "Unable to initialize dcop client"); 
     43                osync_trace(TRACE_EXIT_ERROR, "%s: Unable to initialize dcop client", __func__); 
     44                return false; 
     45        } 
     46 
     47        QString appId = dcopc->registerAs("opensync-kcal"); 
     48 
     49        //check if korganizer running, and return an error if it 
     50        //is running 
     51        if (dcopc->isApplicationRegistered("korganizer")) { 
     52                osync_context_report_error(ctx, OSYNC_ERROR_APP_RUNNING, "KOrganizer is running. Please finish it"); 
     53                osync_trace(TRACE_EXIT_ERROR, "%s: KOrganizer is running", __func__); 
     54                return false; 
     55        } 
     56 
    3657    calendar = new KCal::CalendarResources(QString::fromLatin1( "UTC" )); 
    3758    if (!calendar) { 
  • plugins/kdepim/src/knotes.cpp

    r1544 r1616  
    6060        QString appId = kn_dcop->registerAs("opensync"); 
    6161         
     62        //check if kontact is running, and return an error if it 
     63        //is running 
     64        if (kn_dcop->isApplicationRegistered("kontact")) { 
     65                osync_context_report_error(ctx, OSYNC_ERROR_APP_RUNNING, "Kontact is running. Please finish it"); 
     66                osync_trace(TRACE_EXIT_ERROR, "%s: Kontact is running", __func__); 
     67                return false; 
     68        } 
     69 
    6270        //check knotes running 
    6371        QCStringList apps = kn_dcop->registeredApplications();