printprogress.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <qlayout.h>
00025 #include <qprogressbar.h>
00026 #include <qtextbrowser.h>
00027
00028 #include <kapplication.h>
00029 #include <kdebug.h>
00030 #include <kdialog.h>
00031 #include <klocale.h>
00032
00033 #include "printprogress.h"
00034
00035 using namespace KABPrinting;
00036
00037 PrintProgress::PrintProgress( QWidget *parent, const char *name )
00038 : QWidget( parent, name )
00039 {
00040 setCaption( i18n( "Printing: Progress" ) );
00041
00042 QGridLayout *topLayout = new QGridLayout( this, 1, 1, KDialog::marginHint(),
00043 KDialog::spacingHint() );
00044
00045 mLogBrowser = new QTextBrowser( this );
00046 topLayout->addWidget( mLogBrowser, 0, 0 );
00047
00048 mProgressBar = new QProgressBar( this );
00049 mProgressBar->setProgress( 0 );
00050 topLayout->addWidget( mProgressBar, 1, 0 );
00051
00052 resize( QSize( 370, 220 ).expandedTo( minimumSizeHint() ) );
00053 }
00054
00055 PrintProgress::~PrintProgress()
00056 {
00057 }
00058
00059 void PrintProgress::addMessage( const QString &msg )
00060 {
00061 mMessages.append( msg );
00062
00063 QString head = QString( "<qt><b>" ) + i18n( "Progress" ) +
00064 QString( ":</b><ul>" );
00065
00066 QString foot = QString( "</ul></qt>" );
00067
00068 QString body;
00069 QStringList::Iterator it;
00070 for ( it = mMessages.begin(); it != mMessages.end(); ++it )
00071 body.append( QString( "<li>" ) + (*it) + QString( "</li>" ) );
00072
00073 mLogBrowser->setText( head + body + foot );
00074 kapp->processEvents();
00075 }
00076
00077 void PrintProgress::setProgress( int step )
00078 {
00079 mProgressBar->setProgress( step );
00080 kapp->processEvents();
00081 }
00082
00083 #include "printprogress.moc"
This file is part of the documentation for kaddressbook Library Version 3.2.2.