// Implementation of ClientJobUser
#include <clientapi.h>
#include <qcanvas.h>
#include "qtreeitem.h"
#include "changesorter.h"
#include "clientjobdescuser.h"
#include "qtreejobtext.h"
#include "qtreejobbar.h"
#include "clientjobuser.h"
ClientJobUser::ClientJobUser( Error* e, QTreeJobBar* bar, int pos )
:ClientUser(), myerr( e ), mybar( bar ), mypos( pos )
{
}
ClientJobUser::~ClientJobUser()
{
}
// Store two copies of the jobname: one purely numeric, one complete.
// EG: "job000408" and "408".
void ClientJobUser::OutputInfo( char, const_char* data )
{
StrBuf truename = StrBuf();
StrBuf jobname = StrBuf();
char* ptr = data;
// If it's a "job000NNN" type name, put the leading redundant
// characters into the "truename" but not the displayed "jobname"
if (*( ptr + 0 ) == 'j' &&
*( ptr + 1 ) == 'o' &&
*( ptr + 2 ) == 'b' &&
*( ptr + 3 ) )
{
truename.Append( ptr, 3 );
for ( ptr += 3 ; *ptr == '0' && *( ptr +1 ) ; ptr++ )
truename.Append( ptr, 1 );
}
for ( ; *ptr && *ptr != ' ' ; ptr++ ) jobname.Append( ptr, 1 );
truename.Append( jobname.Text() );
mybar->AddJob( jobname, mypos, truename );
}
// String all the errors together, since if there are 200 changelists,
// you don't want to see 200 dialogs popping up.
void ClientJobUser::HandleError( Error* err )
{
StrBuf* msg = new StrBuf(); //XXX - when is a good time to free this?
err->Fmt( msg );
myerr->Set( (ErrorSeverity)err->GetSeverity(), msg->Text() );
}