• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kaddressbook

  • sources
  • kde-4.12
  • kdepim
  • kaddressbook
  • printing
printprogress.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KAddressBook.
3  Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org>
4 
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.
9 
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.
14 
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.
18 
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.
22 */
23 
24 #include "printprogress.h"
25 
26 #include <KApplication>
27 #include <KDebug>
28 #include <KDialog>
29 #include <KLocale>
30 #include <KTextBrowser>
31 
32 #include <QGridLayout>
33 #include <QProgressBar>
34 
35 using namespace KABPrinting;
36 
37 PrintProgress::PrintProgress( QWidget *parent, const char *name )
38  : QWidget( parent )
39 {
40  setObjectName( QLatin1String(name) );
41  setWindowTitle( i18n( "Printing: Progress" ) );
42 
43  QGridLayout *topLayout = new QGridLayout( this );
44  topLayout->setSpacing( KDialog::spacingHint() );
45  topLayout->setMargin( KDialog::marginHint() );
46 
47  mLogBrowser = new KTextBrowser( this );
48  topLayout->addWidget( mLogBrowser, 0, 0 );
49 
50  mProgressBar = new QProgressBar( this );
51  mProgressBar->setValue( 0 );
52  topLayout->addWidget( mProgressBar, 1, 0 );
53 
54  resize( QSize( 370, 220 ).expandedTo( minimumSizeHint() ) );
55 }
56 
57 PrintProgress::~PrintProgress()
58 {
59 }
60 
61 void PrintProgress::addMessage( const QString &msg )
62 {
63  mMessages.append( msg );
64 
65  QString head = QLatin1String( "<qt><b>" ) + i18n( "Progress" ) +
66  QLatin1String( ":</b><ul>" );
67 
68  QString foot = QLatin1String( "</ul></qt>" );
69 
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>" ) );
75  }
76 
77  mLogBrowser->setText( head + body + foot );
78  kapp->processEvents();
79 }
80 
81 void PrintProgress::setProgress( int step )
82 {
83  mProgressBar->setValue( step );
84  kapp->processEvents();
85 }
86 
87 #include "printprogress.moc"
printprogress.h
KABPrinting::PrintProgress::PrintProgress
PrintProgress(QWidget *parent, const char *name=0)
Definition: printprogress.cpp:37
KABPrinting::PrintProgress::~PrintProgress
~PrintProgress()
Definition: printprogress.cpp:57
KABPrinting::PrintProgress::addMessage
void addMessage(const QString &)
Add a message to the message log.
Definition: printprogress.cpp:61
KABPrinting::PrintProgress::setProgress
void setProgress(int)
Set the progress to a certain amount.
Definition: printprogress.cpp:81
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kaddressbook

Skip menu "kaddressbook"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal