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 __KPIM_PROGRESSDIALOG_H__
34 #define __KPIM_PROGRESSDIALOG_H__
37 #include <q3listview.h>
41 #include <QCloseEvent>
42 #include "overlaywidget.h"
43 #include <kdepim_export.h>
45 #include <QScrollArea>
53 class TransactionItemListView
;
54 class TransactionItem
;
57 class TransactionItemView
: public QScrollArea
{
60 TransactionItemView( QWidget
* parent
= 0,
61 const char * name
= 0,
64 virtual ~TransactionItemView()
66 TransactionItem
* addTransactionItem( ProgressItem
*item
, bool first
);
69 QSize
sizeHint() const;
70 QSize
minimumSizeHint() const;
72 void slotLayoutFirstItem();
75 virtual void resizeContents ( int w
, int h
);
81 class TransactionItem
: public KVBox
{
86 TransactionItem( QWidget
* parent
,
87 ProgressItem
* item
, bool first
);
93 void setProgress( int progress
);
94 void setLabel( const QString
& );
95 void setStatus( const QString
& );
96 void setCrypto( bool );
98 ProgressItem
* item() const { return mItem
; }
100 void addSubTransaction( ProgressItem
*item
);
102 // The progressitem is deleted immediately, we take 5s to go out,
103 // so better not use mItem during this time.
104 void setItemComplete() { mItem
= 0; }
107 void slotItemCanceled();
110 QProgressBar
* mProgress
;
111 QPushButton
* mCancelButton
;
119 class KDEPIM_EXPORT ProgressDialog
: public OverlayWidget
124 ProgressDialog( QWidget
* alignWidget
, QWidget
* parent
, const char* name
= 0 );
126 void setVisible( bool b
);
129 void slotToggleVisibility();
132 void slotTransactionAdded( KPIM::ProgressItem
*item
);
133 void slotTransactionCompleted( KPIM::ProgressItem
*item
);
134 void slotTransactionCanceled( KPIM::ProgressItem
*item
);
135 void slotTransactionProgress( KPIM::ProgressItem
*item
, unsigned int progress
);
136 void slotTransactionStatus( KPIM::ProgressItem
*item
, const QString
& );
137 void slotTransactionLabel( KPIM::ProgressItem
*item
, const QString
& );
138 void slotTransactionUsesCrypto( KPIM::ProgressItem
*item
, bool );
145 void visibilityChanged( bool );
148 virtual void closeEvent( QCloseEvent
* );
150 TransactionItemView
* mScrollView
;
151 TransactionItem
* mPreviousItem
;
152 QMap
< const ProgressItem
*, TransactionItem
* > mTransactionsToListviewItems
;
159 #endif // __KPIM_PROGRESSDIALOG_H__