// Implementation of ClientJobDescUser. Very straightforward.
#include <clientapi.h>
#include <qapplication.h>
#include <qmessagebox.h>
#include "clientjobdescuser.h"
ClientJobDescUser::ClientJobDescUser()
: desc( StrBuf() ), comment( true )
{
}
ClientJobDescUser::~ClientJobDescUser()
{
}
void ClientJobDescUser::HandleError( Error* err )
{
StrBuf msg;
err->Fmt( &msg );
QMessageBox::warning
(
qApp->activeWindow(),
"P4QTree Warning",
msg.Text(),
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton
);
}
// The only special thing this does is figure out when we've reached
// the first non-comment, and put an anchor called "jobtext" there.
void ClientJobDescUser::OutputInfo( char level, const_char* data )
{
desc.Append( "<p>" );
for ( char* ptr = data ; *ptr ; ptr++ )
{
if ( comment && *ptr == '\n' && *( ptr + 1 ) != '#' )
{
comment = false;
ptr++;
desc.Append( "<br>\n<p><a name=\"jobtext\">" );
}
else if ( *ptr == '\n' ) desc.Append( "<br>\n" );
else desc.Append( ptr, 1 );
}
}