summaryrefslogtreecommitdiff
path: root/kde/daemon
diff options
context:
space:
mode:
Diffstat (limited to 'kde/daemon')
-rw-r--r--kde/daemon/.cvsignore7
-rw-r--r--kde/daemon/Makefile.am9
-rw-r--r--kde/daemon/handler.cpp633
-rw-r--r--kde/daemon/handler.h111
-rw-r--r--kde/daemon/kabchandler.cpp159
-rw-r--r--kde/daemon/kabchandler.h77
-rw-r--r--kde/daemon/main.cpp14
7 files changed, 0 insertions, 1010 deletions
diff --git a/kde/daemon/.cvsignore b/kde/daemon/.cvsignore
deleted file mode 100644
index f8b3a51..0000000
--- a/kde/daemon/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-dapi_kde
-*.moc
-
diff --git a/kde/daemon/Makefile.am b/kde/daemon/Makefile.am
deleted file mode 100644
index bbdc52c..0000000
--- a/kde/daemon/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-bin_PROGRAMS = dapi_kde
-
-dapi_kde_SOURCES = main.cpp handler.cpp kabchandler.cpp
-dapi_kde_LDADD = $(LIB_KABC) $(LIB_KIO) $(LIB_DAPI)
-dapi_kde_LDFLAGS = $(all_libraries)
-
-METASOURCES = AUTO
-
-INCLUDES = $(all_includes)
diff --git a/kde/daemon/handler.cpp b/kde/daemon/handler.cpp
deleted file mode 100644
index cd8c564..0000000
--- a/kde/daemon/handler.cpp
+++ /dev/null
@@ -1,633 +0,0 @@
-#include <config.h>
-
-#include "handler.h"
-#include "handler.moc"
-
-#include "kabchandler.h"
-
-#include <dcopref.h>
-#include <qsocketnotifier.h>
-#include <kapplication.h>
-#include <kdebug.h>
-#include <kglobalsettings.h>
-#include <kio/netaccess.h>
-#include <kprocess.h>
-#include <krun.h>
-#include <stdlib.h>
-#include <ktempfile.h>
-
-#include <X11/Xlib.h>
-#ifdef HAVE_DPMS
-#include <X11/extensions/dpms.h>
-#endif
-
-KDapiHandler::KDapiHandler()
- {
- setupSocket();
- kabchandler = new KABCHandler(this);
- }
-
-KDapiHandler::~KDapiHandler()
- {
- while( !connections.isEmpty())
- closeSocket( *connections.begin());
- }
-
-void KDapiHandler::setupSocket()
- {
- mainsocket = dapi_bindSocket();
- if( mainsocket < 0 )
- return;
- QSocketNotifier* notif = new QSocketNotifier( mainsocket, QSocketNotifier::Read, this );
- connect( notif, SIGNAL( activated( int )), SLOT( processMainSocketData()));
- }
-
-void KDapiHandler::processMainSocketData()
- {
- DapiConnection* conn = dapi_acceptSocket( mainsocket );
- if( conn == NULL )
- return;
- ConnectionData data;
- data.conn = conn;
- data.notifier = new QSocketNotifier( dapi_socket( data.conn ), QSocketNotifier::Read, this );
- connect( data.notifier, SIGNAL( activated( int )), SLOT( processSocketData( int )));
- data.screensaver_suspend = false;
- connections.append( data );
- }
-
-void KDapiHandler::processSocketData( int sock )
- {
- for( ConnectionList::Iterator it = connections.begin();
- it != connections.end();
- ++it )
- if( dapi_socket((*it).conn ) == sock )
- {
- processCommand( *it );
- break;
- }
- }
-
-void KDapiHandler::processCommand( ConnectionData& conn )
- {
- int command;
- int seq;
- if( !dapi_readCommand( conn.conn, &command, &seq ))
- {
- closeSocket( conn );
- return;
- }
- switch( command )
- {
- case DAPI_COMMAND_INIT:
- processCommandInit( conn, seq );
- return;
- case DAPI_COMMAND_CAPABILITIES:
- processCommandCapabilities( conn, seq );
- return;
- case DAPI_COMMAND_OPENURL:
- processCommandOpenUrl( conn, seq );
- return;
- case DAPI_COMMAND_EXECUTEURL:
- processCommandExecuteUrl( conn, seq );
- return;
- case DAPI_COMMAND_BUTTONORDER:
- processCommandButtonOrder( conn, seq );
- return;
- case DAPI_COMMAND_RUNASUSER:
- processCommandRunAsUser( conn, seq );
- return;
- case DAPI_COMMAND_SUSPENDSCREENSAVING:
- processCommandSuspendScreensaving( conn, seq );
- return;
- case DAPI_COMMAND_MAILTO:
- processCommandMailTo( conn, seq );
- return;
- case DAPI_COMMAND_LOCALFILE:
- processCommandLocalFile( conn, seq );
- return;
- case DAPI_COMMAND_UPLOADFILE:
- processCommandUploadFile( conn, seq );
- return;
- case DAPI_COMMAND_REMOVETEMPORARYLOCALFILE:
- processCommandRemoveTemporaryLocalFile( conn, seq );
- return;
- case DAPI_COMMAND_ADDRESSBOOKLIST:
- processCommandAddressBookList( conn, seq );
- return;
- case DAPI_COMMAND_ADDRESSBOOKGETNAME:
- processCommandAddressBookGetName( conn, seq );
- return;
- case DAPI_COMMAND_ADDRESSBOOKGETEMAILS:
- processCommandAddressBookGetEmails( conn, seq );
- return;
- case DAPI_COMMAND_ADDRESSBOOKFINDBYNAME:
- processCommandAddressBookFindByName( conn, seq );
- return;
- case DAPI_COMMAND_ADDRESSBOOKOWNER:
- processCommandAddressBookOwner( conn, seq );
- return;
- case DAPI_COMMAND_ADDRESSBOOKGETVCARD30:
- processCommandAddressBookGetVCard30( conn, seq );
- return;
- }
- }
-
-void KDapiHandler::closeSocket( ConnectionData& conn )
- {
- dapi_close( conn.conn );
- delete conn.notifier;
- for( ConnectionList::Iterator it = connections.begin();
- it != connections.end();
- ++it )
- if( (*it).conn == conn.conn )
- {
- connections.remove( it );
- break;
- }
- updateScreensaving();
- }
-
-void KDapiHandler::processCommandInit( ConnectionData& conn, int seq )
- {
- if( !dapi_readCommandInit( conn.conn ))
- {
- closeSocket( conn );
- return;
- }
- dapi_writeReplyInit( conn.conn, seq, 1 );
- }
-
-/* TODO */
-static int caps[] =
- {
- DAPI_COMMAND_INIT,
- DAPI_COMMAND_CAPABILITIES,
- DAPI_COMMAND_OPENURL,
- DAPI_COMMAND_EXECUTEURL,
- DAPI_COMMAND_BUTTONORDER,
- DAPI_COMMAND_RUNASUSER,
- DAPI_COMMAND_SUSPENDSCREENSAVING,
- DAPI_COMMAND_MAILTO,
- DAPI_COMMAND_LOCALFILE,
- DAPI_COMMAND_UPLOADFILE,
- DAPI_COMMAND_REMOVETEMPORARYLOCALFILE
- };
-
-void KDapiHandler::processCommandCapabilities( ConnectionData& conn, int seq )
- {
- intarr capabilities;
- if( !dapi_readCommandInit( conn.conn ))
- {
- closeSocket( conn );
- return;
- }
- capabilities.count = sizeof( caps ) / sizeof( caps[ 0 ] );
- capabilities.data = caps;
- dapi_writeReplyCapabilities( conn.conn, seq, capabilities, 1 );
- }
-
-void KDapiHandler::processCommandOpenUrl( ConnectionData& conn, int seq )
- {
- char* url;
- DapiWindowInfo winfo;
- if( !dapi_readCommandOpenUrl( conn.conn, &url, &winfo ))
- {
- closeSocket( conn );
- return;
- }
- kapp->invokeBrowser( url, makeStartupInfo( winfo ));
- dapi_writeReplyOpenUrl( conn.conn, seq, 1 );
- free( url );
- dapi_freeWindowInfo( winfo );
- }
-
-void KDapiHandler::processCommandExecuteUrl( ConnectionData& conn, int seq )
- {
- char* url;
- DapiWindowInfo winfo;
- if( !dapi_readCommandExecuteUrl( conn.conn, &url, &winfo ))
- {
- closeSocket( conn );
- return;
- }
- new KRun( url ); // TODO startup info
- dapi_writeReplyExecuteUrl( conn.conn, seq, 1 );
- free( url );
- dapi_freeWindowInfo( winfo );
- }
-
-void KDapiHandler::processCommandButtonOrder( ConnectionData& conn, int seq )
- {
- if( !dapi_readCommandButtonOrder( conn.conn ))
- {
- closeSocket( conn );
- return;
- }
- int order = KGlobalSettings::buttonLayout();
- // TODO KDE has actually more layouts, but I have no idea what they're supposed to mean
- dapi_writeReplyButtonOrder( conn.conn, seq, order == 1 ? 2 : 1 );
- }
-
-void KDapiHandler::processCommandRunAsUser( ConnectionData& conn, int seq )
- {
- char* user;
- char* command;
- DapiWindowInfo winfo;
- if( !dapi_readCommandRunAsUser( conn.conn, &user, &command, &winfo ))
- {
- closeSocket( conn );
- return;
- }
- KProcess proc; // TODO startup info
- proc.setUseShell( true ); // TODO quoting
- proc << "kdesu";
- if( user[ 0 ] != '\0' )
- proc << "-u" << user;
- proc << "--" << command;
- bool ret = proc.start( KProcess::DontCare );
- dapi_writeReplyRunAsUser( conn.conn, seq, ret ? 1 : 0 );
- free( user );
- free( command );
- dapi_freeWindowInfo( winfo );
- }
-
-void KDapiHandler::processCommandSuspendScreensaving( ConnectionData& conn, int seq )
- {
- int suspend;
- if( !dapi_readCommandSuspendScreensaving( conn.conn, &suspend ))
- {
- closeSocket( conn );
- return;
- }
- conn.screensaver_suspend = suspend;
- updateScreensaving();
- dapi_writeReplySuspendScreensaving( conn.conn, seq, 1 );
- }
-
-void KDapiHandler::updateScreensaving()
- {
- bool suspend = false;
- for( ConnectionList::ConstIterator it = connections.begin();
- it != connections.end();
- ++it )
- {
- if( (*it).screensaver_suspend )
- {
- suspend = true;
- break;
- }
- }
-#ifdef HAVE_DPMS
- if( suspend )
- DPMSDisable( qt_xdisplay());
- else
- DPMSEnable( qt_xdisplay());
-#endif
- DCOPRef ref( "kdesktop", "KScreensaverIface" );
- ref.call( "enable", !suspend );
- }
-
-void KDapiHandler::processCommandMailTo( ConnectionData& conn, int seq )
- {
- char* subject;
- char* body;
- char* to;
- char* cc;
- char* bcc;
- stringarr attachments;
- DapiWindowInfo winfo;
- if( !dapi_readCommandMailTo( conn.conn, &subject, &body, &to, &cc, &bcc, &attachments, &winfo ))
- {
- closeSocket( conn );
- return;
- }
- QStringList attachurls;
- for( int i = 0;
- i < attachments.count;
- ++i )
- attachurls.append( QString::fromUtf8( attachments.data[ i ] ));
- kapp->invokeMailer( QString::fromUtf8( to ), QString::fromUtf8( cc ), QString::fromUtf8( bcc ),
- QString::fromUtf8( subject ), QString::fromUtf8( body ), QString(), attachurls, makeStartupInfo( winfo ));
- dapi_writeReplyMailTo( conn.conn, seq, 1 );
- free( subject );
- free( body );
- free( to );
- free( cc );
- free( bcc );
- dapi_freestringarr( attachments );
- dapi_freeWindowInfo( winfo );
- }
-
-static QValueList< KTempFile* > tempfiles;
-
-static void removeTempFile( const QString file )
- {
- for( QValueList< KTempFile* >::Iterator it = tempfiles.begin();
- it != tempfiles.end();
- ++it )
- if( (*it)->name() == file )
- {
- delete *it;
- tempfiles.remove( it );
- return;
- }
- }
-
-void KDapiHandler::processCommandLocalFile( ConnectionData& conn, int seq )
- {
- char* file;
- char* local;
- int allow_download;
- DapiWindowInfo winfo;
- if( !dapi_readCommandLocalFile( conn.conn, &file, &local, &allow_download, &winfo ))
- {
- closeSocket( conn );
- return;
- }
- KURL url = KURL::fromPathOrURL( QString::fromUtf8( file ));
- free( file );
- QString result;
- if( !url.isValid())
- ; // result is empty
- else if( url.isLocalFile())
- result = url.path();
- else if( allow_download )
- {
- QString target = QString::fromUtf8( local );
- KTempFile* tmp = NULL;
- KURL dest;
- if( !target.isEmpty())
- dest.setPath( target );
- else
- {
- tmp = new KTempFile;
- dest.setPath( tmp->name());
- tempfiles.append( tmp );
- }
- KIO::FileCopyJob* job = KIO::file_copy( url, dest, -1, true, false );
- KDapiFakeWidget* widget = winfo.window != 0 ? new KDapiFakeWidget( winfo.window ) : NULL;
- job->setWindow( widget );
- KDapiDownloadJob* upload = new KDapiDownloadJob( job, conn.conn, seq, widget );
- connect( job, SIGNAL( result( KIO::Job* )), upload, SLOT( done()));
- dapi_freeWindowInfo( winfo );
- // will write reply asynchronously
- return;
- }
- dapi_writeReplyLocalFile( conn.conn, seq, result.utf8());
- dapi_freeWindowInfo( winfo );
- }
-
-void KDapiDownloadJob::done()
- {
- if( job->error() == 0 )
- dapi_writeReplyLocalFile( conn, seq, job->destURL().path().utf8());
- else
- dapi_writeReplyLocalFile( conn, seq, NULL );
- delete widget;
- deleteLater();
- }
-
-void KDapiHandler::processCommandUploadFile( ConnectionData& conn, int seq )
- {
- char* local;
- char* file;
- int remove_local;
- DapiWindowInfo winfo;
- if( !dapi_readCommandUploadFile( conn.conn, &local, &file, &remove_local, &winfo ))
- {
- closeSocket( conn );
- return;
- }
- KURL url = KURL::fromPathOrURL( QString::fromUtf8( file ));
- QString localfile = QString::fromUtf8( local );
- free( local );
- free( file );
- int ok = 0;
- if( !url.isValid())
- ok = 0;
- else if( url.isLocalFile() && url.path() == localfile )
- ok = 1; // no-op
- else
- {
- KURL src;
- src.setPath( localfile );
- KIO::FileCopyJob* job = KIO::file_copy( src, url, -1, true, false );
- KDapiFakeWidget* widget = winfo.window != 0 ? new KDapiFakeWidget( winfo.window ) : NULL;
- job->setWindow( widget );
- KDapiUploadJob* upload = new KDapiUploadJob( job, conn.conn, seq, remove_local, widget );
- connect( job, SIGNAL( result( KIO::Job* )), upload, SLOT( done()));
- dapi_freeWindowInfo( winfo );
- // will write reply asynchronously
- return;
- }
- dapi_writeReplyUploadFile( conn.conn, seq, ok );
- dapi_freeWindowInfo( winfo );
- }
-
-void KDapiUploadJob::done()
- {
- // TODO this apparently returns success even with e.g. http - check somehow
- dapi_writeReplyUploadFile( conn, seq, job->error() == 0 );
- if( job->error() == 0 && remove_local )
- removeTempFile( job->srcURL().path());
- delete widget;
- }
-
-void KDapiHandler::processCommandRemoveTemporaryLocalFile( ConnectionData& conn, int seq )
- {
- char* file;
- if( !dapi_readCommandRemoveTemporaryLocalFile( conn.conn, &file ))
- {
- closeSocket( conn );
- return;
- }
- removeTempFile( QString::fromUtf8( file ));
- dapi_writeReplyRemoveTemporaryLocalFile( conn.conn, seq, 1 );
- free( file );
- }
-
-void KDapiHandler::processCommandAddressBookList( ConnectionData& conn, int seq )
- {
- if( !dapi_readCommandAddressBookList( conn.conn ) )
- {
- closeSocket( conn );
- return;
- }
-
- QStringList kabcUIDs = kabchandler->listUIDs();
-
- stringarr idList;
- idList.data = 0;
- idList.count = 0;
- if (kabcUIDs.count() > 0)
- {
- idList.data = (char**) malloc( sizeof( char* ) * (kabcUIDs.count() + 1 ) );
- QStringList::const_iterator it = kabcUIDs.begin();
- QStringList::const_iterator endIt = kabcUIDs.end();
- for ( uint i = 0; it != endIt; ++it, ++i )
- {
- QCString string = (*it).utf8();
- idList.data[i] = strndup( string.data(), string.count() );
- }
- idList.data[kabcUIDs.count()] = NULL;
- idList.count = kabcUIDs.count();
- }
-
- dapi_writeReplyAddressBookList( conn.conn, seq, idList, kabcUIDs.count() );
-
- dapi_freestringarr( idList );
- }
-
-void KDapiHandler::processCommandAddressBookGetName( ConnectionData& conn, int seq )
- {
- char* id;
- if( !dapi_readCommandAddressBookGetName( conn.conn, &id ) )
- {
- closeSocket( conn );
- return;
- }
-
- QCString firstname;
- QCString lastname;
- QCString fullname;
-
- bool ok = kabchandler->getNames( QString::fromUtf8( id ),
- firstname, lastname, fullname );
- free( id );
-
- dapi_writeReplyAddressBookGetName( conn.conn, seq, firstname.data(), lastname.data(),
- fullname.data(), ok );
-
- }
-
-void KDapiHandler::processCommandAddressBookGetEmails( ConnectionData& conn, int seq )
- {
- char* id;
- if( !dapi_readCommandAddressBookGetEmails( conn.conn, &id ) )
- {
- closeSocket( conn );
- return;
- }
-
- QStringList emails;
- bool ok = kabchandler->getEmails( QString::fromUtf8( id ), emails );
-
- free( id );
-
- stringarr emailList;
- emailList.data = 0;
- emailList.count = 0;
- if (emails.count() > 0)
- {
- emailList.data = (char**) malloc( sizeof( char* ) * ( emails.count() + 1 ) );
- QStringList::const_iterator it = emails.begin();
- QStringList::const_iterator endIt = emails.end();
- for ( uint i = 0; it != endIt; ++it, ++i )
- {
- QCString string = (*it).utf8();
- emailList.data[i] = strdup( string.data() );
- }
- emailList.data[emails.count()] = NULL;
- emailList.count = emails.count();
- }
-
- dapi_writeReplyAddressBookGetEmails( conn.conn, seq, emailList, ok );
-
- dapi_freestringarr( emailList );
- }
-
-void KDapiHandler::processCommandAddressBookFindByName( ConnectionData& conn, int seq )
- {
- char* id;
- if( !dapi_readCommandAddressBookFindByName( conn.conn, &id ) )
- {
- closeSocket( conn );
- return;
- }
-
- QStringList kabcUIDs = kabchandler->findByName( QString::fromUtf8( id ) );
-
- free( id );
-
- stringarr idList;
- idList.data = 0;
- idList.count = 0;
- if (kabcUIDs.count() > 0)
- {
- idList.data = (char**) malloc( sizeof( char* ) * (kabcUIDs.count() + 1 ) );
- QStringList::const_iterator it = kabcUIDs.begin();
- QStringList::const_iterator endIt = kabcUIDs.end();
- for ( uint i = 0; it != endIt; ++it, ++i )
- {
- QCString string = (*it).utf8();
- idList.data[i] = strndup( string.data(), string.count() );
- }
- idList.data[kabcUIDs.count()] = NULL;
- idList.count = kabcUIDs.count();
- }
-
- dapi_writeReplyAddressBookFindByName( conn.conn, seq, idList, kabcUIDs.count() );
-
- dapi_freestringarr( idList );
- }
-
-void KDapiHandler::processCommandAddressBookOwner( ConnectionData& conn, int seq )
- {
- if( !dapi_readCommandAddressBookOwner( conn.conn ) )
- {
- closeSocket( conn );
- return;
- }
-
- QString ownerUID = kabchandler->owner();
-
- bool ok = !ownerUID.isEmpty();
-
- dapi_writeReplyAddressBookOwner( conn.conn, seq, (ok ? ownerUID.utf8().data() : 0), ok );
- }
-
-void KDapiHandler::processCommandAddressBookGetVCard30( ConnectionData& conn, int seq )
- {
- char* id;
- if( !dapi_readCommandAddressBookGetVCard30( conn.conn, &id ) )
- {
- closeSocket( conn );
- return;
- }
-
- QString vcard = kabchandler->vcard30( QString::fromUtf8( id ) );
-
- free( id );
-
- bool ok = !vcard.isEmpty();
-
- dapi_writeReplyAddressBookGetVCard30( conn.conn, seq, (ok ? vcard.utf8().data() : 0), ok );
-
- }
-
-QCString KDapiHandler::makeStartupInfo( const DapiWindowInfo& winfo )
- {
- WId window = winfo.window;
- if( window != 0 )
- {
- // TODO for the window !=0 case KStartupInfo API needs to be extended to accept
- // external timestamp for creating new startup info
- kapp->updateUserTimestamp();
- }
- else
- {
- kapp->updateUserTimestamp();
- }
- return KStartupInfo::createNewStartupId();
- }
-
-// some KDE APIs accept only QWidget* instead of WId
-KDapiFakeWidget::KDapiFakeWidget( WId window )
- {
- create( window, false ); // don't init
- }
-
-KDapiFakeWidget::~KDapiFakeWidget()
- {
- destroy( false ); // no cleanup
- }
diff --git a/kde/daemon/handler.h b/kde/daemon/handler.h
deleted file mode 100644
index 516b517..0000000
--- a/kde/daemon/handler.h
+++ /dev/null
@@ -1,111 +0,0 @@
-#ifndef HANDLER_H
-#define HANDLER_H
-
-#include <qobject.h>
-#include <qmap.h>
-#include <kio/job.h>
-#include <qwidget.h>
-
-#include <dapi/comm.h>
-
-class KABCHandler;
-class QSocketNotifier;
-
-class KDapiHandler
- : public QObject
- {
- Q_OBJECT
- public:
- KDapiHandler();
- virtual ~KDapiHandler();
- private slots:
- void processMainSocketData();
- void processSocketData( int sock );
- private:
- struct ConnectionData
- {
- DapiConnection* conn;
- QSocketNotifier* notifier;
- bool screensaver_suspend;
- };
- void setupSocket();
- void closeSocket( ConnectionData& conn );
- void processCommand( ConnectionData& conn );
- void processCommandInit( ConnectionData& conn, int seq );
- void processCommandCapabilities( ConnectionData& conn, int seq );
- void processCommandOpenUrl( ConnectionData& conn, int seq );
- void processCommandExecuteUrl( ConnectionData& conn, int seq );
- void processCommandButtonOrder( ConnectionData& conn, int seq );
- void processCommandRunAsUser( ConnectionData& conn, int seq );
- void processCommandSuspendScreensaving( ConnectionData& conn, int seq );
- void processCommandMailTo( ConnectionData& conn, int seq );
- void processCommandLocalFile( ConnectionData& conn, int seq );
- void processCommandUploadFile( ConnectionData& conn, int seq );
- void processCommandRemoveTemporaryLocalFile( ConnectionData& conn, int seq );
- void processCommandAddressBookList( ConnectionData& conn, int seq );
- void processCommandAddressBookGetName( ConnectionData& conn, int seq );
- void processCommandAddressBookGetEmails( ConnectionData& conn, int seq );
- void processCommandAddressBookFindByName( ConnectionData& conn, int seq );
- void processCommandAddressBookOwner( ConnectionData& conn, int seq );
- void processCommandAddressBookGetVCard30( ConnectionData& conn, int seq );
- void updateScreensaving();
- static QCString makeStartupInfo( const DapiWindowInfo& winfo );
- int mainsocket;
- typedef QValueList< ConnectionData > ConnectionList;
- ConnectionList connections;
- KABCHandler* kabchandler;
- };
-
-class KDapiFakeWidget
- : public QWidget
- {
- Q_OBJECT
- public:
- KDapiFakeWidget( WId window );
- virtual ~KDapiFakeWidget();
- };
-
-class KDapiDownloadJob
- : public QObject
- {
- Q_OBJECT
- public:
- KDapiDownloadJob( KIO::FileCopyJob* j, DapiConnection* c, int s, QWidget* w );
- private slots:
- void done();
- private:
- KIO::FileCopyJob* job;
- DapiConnection* conn;
- int seq;
- QWidget* widget;
- };
-
-class KDapiUploadJob
- : public QObject
- {
- Q_OBJECT
- public:
- KDapiUploadJob( KIO::FileCopyJob* j, DapiConnection* c, int s, bool r, QWidget* w );
- private slots:
- void done();
- private:
- KIO::FileCopyJob* job;
- DapiConnection* conn;
- int seq;
- bool remove_local;
- QWidget* widget;
- };
-
-inline
-KDapiDownloadJob::KDapiDownloadJob( KIO::FileCopyJob* j, DapiConnection* c, int s, QWidget* w )
- : job( j ), conn( c ), seq( s ), widget( w )
- {
- }
-
-inline
-KDapiUploadJob::KDapiUploadJob( KIO::FileCopyJob* j, DapiConnection* c, int s, bool r, QWidget* w )
- : job( j ), conn( c ), seq( s ), remove_local( r ), widget( w )
- {
- }
-
-#endif
diff --git a/kde/daemon/kabchandler.cpp b/kde/daemon/kabchandler.cpp
deleted file mode 100644
index 2016c53..0000000
--- a/kde/daemon/kabchandler.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/******************************************************************************
- Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
- All Rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-// local includes
-#include "kabchandler.h"
-
-// KABC includes
-#include <kabc/addressee.h>
-#include <kabc/addresseelist.h>
-#include <kabc/stdaddressbook.h>
-#include <kabc/vcardconverter.h>
-
-using namespace KABC;
-
-///////////////////////////////////////////////////////////////////////////////
-
-KABCHandler::KABCHandler(QObject* parent, const char* name)
- : QObject(parent, name),
- m_addressBook(0),
- m_vcardConverter(0)
-{
- m_addressBook = StdAddressBook::self(true);
- QObject::connect(m_addressBook, SIGNAL(addressBookChanged(AddressBook*)),
- this, SLOT(slotAddressBookChanged()));
-
- m_vcardConverter = new VCardConverter();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-KABCHandler::~KABCHandler()
-{
- delete m_vcardConverter;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-QStringList KABCHandler::listUIDs() const
-{
- AddressBook::ConstIterator it = m_addressBook->begin();
- AddressBook::ConstIterator endIt = m_addressBook->end();
-
- QStringList uids;
- for (; it != endIt; ++it)
- {
- uids << (*it).uid();
- }
-
- return uids;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-bool KABCHandler::getNames(const QString& uid, QCString& givenName,
- QCString& familyName, QCString& fullName) const
-{
- Addressee contact = m_addressBook->findByUid(uid);
-
- if (contact.isEmpty()) return false;
-
- givenName = contact.givenName().utf8();
- familyName = contact.familyName().utf8();
- fullName = contact.assembledName().utf8();
-
- return true;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-bool KABCHandler::getEmails(const QString& uid, QStringList& emails) const
-{
- Addressee contact = m_addressBook->findByUid(uid);
-
- if (contact.isEmpty()) return false;
-
- emails = contact.emails();
-
- return true;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-QStringList KABCHandler::findByName(const QString& name) const
-{
- AddressBook::ConstIterator it = m_addressBook->begin();
- AddressBook::ConstIterator endIt = m_addressBook->end();
-
- QStringList uids;
- for (; it != endIt; ++it)
- {
- if (hasNameMatch(*it, name.lower()))
- uids << (*it).uid();
- }
-
- return uids;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-QString KABCHandler::owner() const
-{
- return m_addressBook->whoAmI().uid();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-QString KABCHandler::vcard30(const QString& uid) const
-{
- Addressee contact = m_addressBook->findByUid(uid);
-
- if (contact.isEmpty()) return QString::null;
-
- return m_vcardConverter->createVCard(contact, VCardConverter::v3_0);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-bool KABCHandler::hasNameMatch(const KABC::Addressee& contact, const QString& name)
-{
- if (contact.assembledName().lower().find(name) != -1) return true;
-
- if (contact.formattedName().lower().find(name) != -1) return true;
-
- return false;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-void KABCHandler::slotAddressBookChanged()
-{
- qDebug("AddressBook changed");
-}
-
-#include "kabchandler.moc"
-
-// End of File
diff --git a/kde/daemon/kabchandler.h b/kde/daemon/kabchandler.h
deleted file mode 100644
index edd9f68..0000000
--- a/kde/daemon/kabchandler.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/******************************************************************************
- Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
- All Rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef KABCHANDLER_H
-#define KABCHANDLER_H
-
-// Qt includes
-#include <qobject.h>
-
-// forward declarations
-namespace KABC
-{
- class Addressee;
- class StdAddressBook;
- class VCardConverter;
-};
-class QStringList;
-
-class KABCHandler : public QObject
-{
- Q_OBJECT
-
-public:
- KABCHandler(QObject* parent = 0, const char* name = 0);
- virtual ~KABCHandler();
-
- QStringList listUIDs() const;
-
- bool getNames(const QString& uid, QCString& givenName, QCString& familyName,
- QCString& fullName) const;
-
- bool getEmails(const QString& uid, QStringList& emails) const;
-
- QStringList findByName(const QString& uid) const;
-
- QString owner() const;
-
- QString vcard30(const QString& uid) const;
-
-private:
- KABC::StdAddressBook* m_addressBook;
-
- KABC::VCardConverter* m_vcardConverter;
-
-private:
- static bool hasNameMatch(const KABC::Addressee& contact, const QString& name);
-
-private slots:
- void slotAddressBookChanged();
-};
-
-#endif
-
-// End of File
diff --git a/kde/daemon/main.cpp b/kde/daemon/main.cpp
deleted file mode 100644
index 89e8c4a..0000000
--- a/kde/daemon/main.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <kapplication.h>
-#include <kcmdlineargs.h>
-#include <kdebug.h>
-#include <klocale.h>
-
-#include "handler.h"
-
-int main( int argc, char* argv[] )
- {
- KCmdLineArgs::init( argc, argv, "dapi_kde", I18N_NOOP( "dapi_kde" ), I18N_NOOP( "dapi_kde" ), "0.1" );
- KApplication app;
- KDapiHandler handler;
- return app.exec();
- }