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

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

#include <kdatastream.h>


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

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

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

int KBibIface_stub::insertFile( QString arg0, int arg1, bool arg2 )
{
    int result = 0;
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return result;
    }
    QByteArray data, replyData;
    QCString replyType;
    QDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    arg << arg1;
    arg << arg2;
    if ( dcopClient()->call( app(), obj(), "insertFile(QString,int,bool)", data, replyType, replyData ) ) {
	if ( replyType == "int" ) {
	    QDataStream _reply_stream( replyData, IO_ReadOnly );
	    _reply_stream >> result;
	    setStatus( CallSucceeded );
	} else {
	    callFailed();
	}
    } else { 
	callFailed();
    }
    return result;
}

QString KBibIface_stub::cite()
{
    QString result;
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return result;
    }
    QByteArray data, replyData;
    QCString replyType;
    if ( dcopClient()->call( app(), obj(), "cite()", data, replyType, replyData ) ) {
	if ( replyType == "QString" ) {
	    QDataStream _reply_stream( replyData, IO_ReadOnly );
	    _reply_stream >> result;
	    setStatus( CallSucceeded );
	} else {
	    callFailed();
	}
    } else { 
	callFailed();
    }
    return result;
}

void KBibIface_stub::setActive()
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    QByteArray data, replyData;
    QCString replyType;
    if ( dcopClient()->call( app(), obj(), "setActive()", data, replyType, replyData ) ) {
	setStatus( CallSucceeded );
    } else { 
	callFailed();
    }
}


