/****************************************************************************
**
** DCOP Stub Implementation created by dcopidl2cpp from observer.kidl
**
** WARNING! All changes made in this file will be lost!
**
*****************************************************************************/

#include "observer_stub.h"
#include <dcopclient.h>

#include <kdatastream.h>


Observer_stub::Observer_stub( const QCString& app, const QCString& obj )
  : DCOPStub( app, obj )
{
}

Observer_stub::Observer_stub( DCOPClient* client, const QCString& app, const QCString& obj )
  : DCOPStub( client, app, obj )
{
}

Observer_stub::Observer_stub( const DCOPRef& ref )
  : DCOPStub( ref )
{
}

void Observer_stub::killJob( int arg0 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    QByteArray data, replyData;
    QCString replyType;
    QDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    if ( dcopClient()->call( app(), obj(), "killJob(int)", data, replyType, replyData ) ) {
	setStatus( CallSucceeded );
    } else { 
	callFailed();
    }
}

KIO::MetaData Observer_stub::metadata( int arg0 )
{
    KIO::MetaData result;
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return result;
    }
    QByteArray data, replyData;
    QCString replyType;
    QDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    if ( dcopClient()->call( app(), obj(), "metadata(int)", data, replyType, replyData ) ) {
	if ( replyType == "KIO::MetaData" ) {
	    QDataStream _reply_stream( replyData, IO_ReadOnly );
	    _reply_stream >> result;
	    setStatus( CallSucceeded );
	} else {
	    callFailed();
	}
    } else { 
	callFailed();
    }
    return result;
}


