SVN_SILENT made messages (.desktop file)
[kdepim.git] / kaddressbook / printing / printprogress.cpp
blobc4af79fc691e8bde2814459b20e509872b500376
1 /*
2 This file is part of KAddressBook.
3 Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
24 #include "printprogress.h"
26 #include <KApplication>
27 #include <KDebug>
28 #include <KDialog>
29 #include <KLocalizedString>
30 #include <KTextBrowser>
32 #include <QGridLayout>
33 #include <QProgressBar>
35 using namespace KABPrinting;
37 PrintProgress::PrintProgress( QWidget *parent, const char *name )
38 : QWidget( parent )
40 setObjectName( QLatin1String(name) );
41 setWindowTitle( i18n( "Printing: Progress" ) );
43 QGridLayout *topLayout = new QGridLayout( this );
44 topLayout->setSpacing( KDialog::spacingHint() );
45 topLayout->setMargin( KDialog::marginHint() );
47 mLogBrowser = new KTextBrowser( this );
48 topLayout->addWidget( mLogBrowser, 0, 0 );
50 mProgressBar = new QProgressBar( this );
51 mProgressBar->setValue( 0 );
52 topLayout->addWidget( mProgressBar, 1, 0 );
54 resize( QSize( 370, 220 ).expandedTo( minimumSizeHint() ) );
57 PrintProgress::~PrintProgress()
61 void PrintProgress::addMessage( const QString &msg )
63 mMessages.append( msg );
65 QString head = QLatin1String( "<qt><b>" ) + i18n( "Progress" ) +
66 QLatin1String( ":</b><ul>" );
68 QString foot = QLatin1String( "</ul></qt>" );
70 QString body;
71 QStringList::ConstIterator it;
72 QStringList::ConstIterator end(mMessages.constEnd());
73 for ( it = mMessages.constBegin(); it != end; ++it ) {
74 body.append( QLatin1String( "<li>" ) + (*it) + QLatin1String( "</li>" ) );
77 mLogBrowser->setText( head + body + foot );
78 kapp->processEvents();
81 void PrintProgress::setProgress( int step )
83 mProgressBar->setValue( step );
84 kapp->processEvents();