krop's commit fixes my problem in a better way, reverting
[kdepim.git] / libkdepim / progressdialog.h
blob8ebcc39636a081cd6e355ac5671cf6b586e268da
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 KDEPIM_PROGRESSDIALOG_H
34 #define KDEPIM_PROGRESSDIALOG_H
36 #include "overlaywidget.h"
37 #include "kdepim_export.h"
39 #include <QScrollArea>
40 #include <QMap>
41 #include <KVBox>
43 class QProgressBar;
44 class QFrame;
45 class QLabel;
46 class QPushButton;
48 namespace KPIM {
49 class ProgressItem;
50 class TransactionItem;
51 class SSLLabel;
53 class TransactionItemView : public QScrollArea {
54 Q_OBJECT
55 public:
56 explicit TransactionItemView( QWidget * parent = 0, const char * name = 0 );
58 virtual ~TransactionItemView() {}
59 TransactionItem* addTransactionItem( ProgressItem *item, bool first );
62 QSize sizeHint() const;
63 QSize minimumSizeHint() const;
64 public Q_SLOTS:
65 void slotLayoutFirstItem();
67 protected:
68 virtual void resizeEvent ( QResizeEvent *event );
70 private:
71 KVBox *mBigBox;
74 class TransactionItem : public KVBox {
76 Q_OBJECT
78 public:
79 TransactionItem( QWidget * parent,
80 ProgressItem* item, bool first );
82 ~TransactionItem();
84 void hideHLine();
86 void setProgress( int progress );
87 void setLabel( const QString& );
89 // the given text is interpreted as RichText, so you might need to
90 // Qt::escape() it before passing
91 void setStatus( const QString& );
93 void setCrypto( bool );
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; }
103 public Q_SLOTS:
104 void slotItemCanceled();
106 protected:
107 QProgressBar* mProgress;
108 QPushButton* mCancelButton;
109 QLabel* mItemLabel;
110 QLabel* mItemStatus;
111 QFrame* mFrame;
112 SSLLabel* mSSLLabel;
113 ProgressItem* mItem;
116 class KDEPIM_EXPORT ProgressDialog : public OverlayWidget
118 Q_OBJECT
120 public:
121 ProgressDialog( QWidget* alignWidget, QWidget* parent, const char* name = 0 );
122 ~ProgressDialog();
123 void setVisible( bool b );
125 public Q_SLOTS:
126 void slotToggleVisibility();
128 protected Q_SLOTS:
129 void slotTransactionAdded( KPIM::ProgressItem *item );
130 void slotTransactionCompleted( KPIM::ProgressItem *item );
131 void slotTransactionCanceled( KPIM::ProgressItem *item );
132 void slotTransactionProgress( KPIM::ProgressItem *item, unsigned int progress );
133 void slotTransactionStatus( KPIM::ProgressItem *item, const QString& );
134 void slotTransactionLabel( KPIM::ProgressItem *item, const QString& );
135 void slotTransactionUsesCrypto( KPIM::ProgressItem *item, bool );
137 void slotClose();
138 void slotShow();
139 void slotHide();
141 Q_SIGNALS:
142 void visibilityChanged( bool );
144 protected:
145 virtual void closeEvent( QCloseEvent* );
147 TransactionItemView* mScrollView;
148 TransactionItem* mPreviousItem;
149 QMap< const ProgressItem*, TransactionItem* > mTransactionsToListviewItems;
150 bool mWasLastShown;
154 } // namespace KPIM
156 #endif // __KPIM_PROGRESSDIALOG_H__