/****************************************************************************
**
** 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 TQCString& app, const TQCString& obj )
  : DCOPStub( app, obj )
{
}

Observer_stub::Observer_stub( DCOPClient* client, const TQCString& app, const TQCString& 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;
    }
    TQByteArray data, replyData;
    TQCString replyType;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    if ( dcopClient()->call( app(), obj(), "killJob(int)", data, replyType, replyData ) ) {
	setStatus( CallSucceeded );
    } else { 
	callFailed();
    }
}

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


