4 * Copyright (c) 2004 Till Adam <adam@kde.org>
5 * based on imapprogressdialog.cpp ,which is
6 * Copyright (c) 2002-2003 Klar�vdalens Datakonsult AB
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * In addition, as a special exception, the copyright holders give
22 * permission to link the code of this program with any edition of
23 * the Qt library by Trolltech AS, Norway (or with modified versions
24 * of Qt that use the same license as Qt), and distribute linked
25 * combinations including the two. You must obey the GNU General
26 * Public License in all respects for all of the code used other than
27 * Qt. If you modify this file, you may extend this exception to
28 * your version of the file, but you are not obligated to do so. If
29 * you do not wish to do so, delete this exception statement from
33 #ifndef KDEPIM_PROGRESSDIALOG_H
34 #define KDEPIM_PROGRESSDIALOG_H
36 #include "overlaywidget.h"
37 #include "kdepim_export.h"
39 #include <QScrollArea>
50 class TransactionItem
;
53 class TransactionItemView
: public QScrollArea
57 explicit TransactionItemView( QWidget
* parent
= 0, const char * name
= 0 );
59 virtual ~TransactionItemView() {}
60 TransactionItem
*addTransactionItem( ProgressItem
*item
, bool first
);
62 QSize
sizeHint() const;
63 QSize
minimumSizeHint() const;
66 void slotLayoutFirstItem();
69 virtual void resizeEvent ( QResizeEvent
*event
);
75 class TransactionItem
: public KVBox
79 TransactionItem( QWidget
*parent
, ProgressItem
*item
, bool first
);
85 void setProgress( int progress
);
86 void setLabel( const QString
& );
88 // the given text is interpreted as RichText, so you might need to
89 // Qt::escape() it before passing
90 void setStatus( const QString
& );
92 void setCrypto( bool );
93 void setTotalSteps( int totalSteps
);
95 ProgressItem
*item() const { return mItem
; }
97 void addSubTransaction( ProgressItem
*item
);
99 // The progressitem is deleted immediately, we take 5s to go out,
100 // so better not use mItem during this time.
101 void setItemComplete() { mItem
= 0; }
104 void slotItemCanceled();
107 QProgressBar
*mProgress
;
108 QPushButton
*mCancelButton
;
116 class KDEPIM_EXPORT ProgressDialog
: public OverlayWidget
120 ProgressDialog( QWidget
*alignWidget
, QWidget
*parent
, const char *name
= 0 );
122 void setVisible( bool b
);
125 void slotToggleVisibility();
128 void slotTransactionAdded( KPIM::ProgressItem
*item
);
129 void slotTransactionCompleted( KPIM::ProgressItem
*item
);
130 void slotTransactionCanceled( KPIM::ProgressItem
*item
);
131 void slotTransactionProgress( KPIM::ProgressItem
*item
, unsigned int progress
);
132 void slotTransactionStatus( KPIM::ProgressItem
*item
, const QString
& );
133 void slotTransactionLabel( KPIM::ProgressItem
*item
, const QString
& );
134 void slotTransactionUsesCrypto( KPIM::ProgressItem
*item
, bool );
135 void slotTransactionUsesBusyIndicator( KPIM::ProgressItem
*, bool );
142 void visibilityChanged( bool );
145 virtual void closeEvent( QCloseEvent
* );
147 TransactionItemView
*mScrollView
;
148 TransactionItem
*mPreviousItem
;
149 QMap
<const ProgressItem
*, TransactionItem
*> mTransactionsToListviewItems
;
155 #endif // __KPIM_PROGRESSDIALOG_H__