FEATURE: (contracted in prokde35)
[kdepim.git] / libkdepim / progressdialog.h
blob125ddd5bd74df5823e1877d1c98996d169675f34
1 /* -*- c++ -*-
2 * progressdialog.h
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
30 * your version.
33 #ifndef __KPIM_PROGRESSDIALOG_H__
34 #define __KPIM_PROGRESSDIALOG_H__
36 #include <QDialog>
37 #include <q3listview.h>
38 #include <QLabel>
39 #include <kvbox.h>
40 //Added by qt3to4:
41 #include <QCloseEvent>
42 #include "overlaywidget.h"
43 #include <kdepim_export.h>
45 #include <QScrollArea>
47 class QProgressBar;
48 class Q3ScrollView;
49 class QFrame;
51 namespace KPIM {
52 class ProgressItem;
53 class TransactionItemListView;
54 class TransactionItem;
55 class SSLLabel;
57 class TransactionItemView : public QScrollArea {
58 Q_OBJECT
59 public:
60 TransactionItemView( QWidget * parent = 0,
61 const char * name = 0,
62 Qt::WFlags f = 0 );
64 virtual ~TransactionItemView()
66 TransactionItem* addTransactionItem( ProgressItem *item, bool first );
69 QSize sizeHint() const;
70 QSize minimumSizeHint() const;
71 public slots:
72 void slotLayoutFirstItem();
74 protected:
75 virtual void resizeContents ( int w, int h );
77 private:
78 KVBox * mBigBox;
81 class TransactionItem : public KVBox {
83 Q_OBJECT
85 public:
86 TransactionItem( QWidget * parent,
87 ProgressItem* item, bool first );
89 ~TransactionItem();
91 void hideHLine();
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; }
106 public slots:
107 void slotItemCanceled();
109 protected:
110 QProgressBar* mProgress;
111 QPushButton* mCancelButton;
112 QLabel* mItemLabel;
113 QLabel* mItemStatus;
114 QFrame* mFrame;
115 SSLLabel* mSSLLabel;
116 ProgressItem* mItem;
119 class KDEPIM_EXPORT ProgressDialog : public OverlayWidget
121 Q_OBJECT
123 public:
124 ProgressDialog( QWidget* alignWidget, QWidget* parent, const char* name = 0 );
125 ~ProgressDialog();
126 void setVisible( bool b );
128 public slots:
129 void slotToggleVisibility();
131 protected slots:
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 );
140 void slotClose();
141 void slotShow();
142 void slotHide();
144 signals:
145 void visibilityChanged( bool );
147 protected:
148 virtual void closeEvent( QCloseEvent* );
150 TransactionItemView* mScrollView;
151 TransactionItem* mPreviousItem;
152 QMap< const ProgressItem*, TransactionItem* > mTransactionsToListviewItems;
153 bool mWasLastShown;
157 } // namespace KPIM
159 #endif // __KPIM_PROGRESSDIALOG_H__