libtdepim

progressdialog.h
1 /*
2  * progressdialog.h
3  *
4  * Copyright (c) 2004 Till Adam <adam@kde.org>
5  * based on imapprogressdialog.cpp ,which is
6  * Copyright (c) 2002-2003 Klarälvdalens Datakonsult AB
7  *
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
11  *
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.
16  *
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.
20  *
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 TQt library by Trolltech AS, Norway (or with modified versions
24  * of TQt that use the same license as TQt), 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  * TQt. 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.
31  */
32 
33 #ifndef __KPIM_PROGRESSDIALOG_H__
34 #define __KPIM_PROGRESSDIALOG_H__
35 
36 #include <tqdialog.h>
37 #include <tqlistview.h>
38 #include <tqlabel.h>
39 #include <tqvbox.h>
40 #include "overlaywidget.h"
41 #include <tdemacros.h>
42 
43 class TQProgressBar;
44 class TQScrollView;
45 class TQFrame;
46 
47 namespace KPIM {
48 class ProgressItem;
49 class TransactionItemListView;
50 class TransactionItem;
51 class SSLLabel;
52 
53 class TransactionItemView : public TQScrollView {
54  TQ_OBJECT
55 
56 public:
57  TransactionItemView( TQWidget * parent = 0,
58  const char * name = 0,
59  WFlags f = 0 );
60 
61  virtual ~TransactionItemView()
62  {}
63  TransactionItem* addTransactionItem( ProgressItem *item, bool first );
64 
65 
66  TQSize sizeHint() const;
67  TQSize minimumSizeHint() const;
68 public slots:
69  void slotLayoutFirstItem();
70 
71 protected:
72  virtual void resizeContents ( int w, int h );
73 
74 private:
75  TQVBox * mBigBox;
76 };
77 
78 class TransactionItem : public TQVBox {
79 
80  TQ_OBJECT
81 
82 
83 public:
84  TransactionItem( TQWidget * parent,
85  ProgressItem* item, bool first );
86 
87  ~TransactionItem();
88 
89  void hideHLine();
90 
91  void setProgress( int progress );
92  void setLabel( const TQString& );
93  void setStatus( const TQString& );
94  void setCrypto( bool );
95  void setTotalSteps( int totalSteps );
96 
97  ProgressItem* item() const { return mItem; }
98 
99  void addSubTransaction( ProgressItem *item);
100 
101  // The progressitem is deleted immediately, we take 5s to go out,
102  // so better not use mItem during this time.
103  void setItemComplete() { mItem = 0; }
104 
105 public slots:
106  void slotItemCanceled();
107 
108 protected:
109  TQProgressBar* mProgress;
110  TQPushButton* mCancelButton;
111  TQLabel* mItemLabel;
112  TQLabel* mItemStatus;
113  TQFrame* mFrame;
114  SSLLabel* mSSLLabel;
115  ProgressItem* mItem;
116 };
117 
118 class TDE_EXPORT ProgressDialog : public OverlayWidget
119 {
120  TQ_OBJECT
121 
122 
123 public:
124  ProgressDialog( TQWidget* alignWidget, TQWidget* parent, const char* name = 0 );
125  ~ProgressDialog();
126  void setVisible( bool b );
127 
128 public slots:
129  void slotToggleVisibility();
130 
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 TQString& );
137  void slotTransactionLabel( KPIM::ProgressItem *item, const TQString& );
138  void slotTransactionUsesCrypto( KPIM::ProgressItem *item, bool );
139  void slotTransactionUsesBusyIndicator( KPIM::ProgressItem*, bool );
140 
141  void slotClose();
142  void slotShow();
143  void slotHide();
144 
145 signals:
146  void visibilityChanged( bool );
147 
148 protected:
149  virtual void closeEvent( TQCloseEvent* );
150 
151  TransactionItemView* mScrollView;
152  TransactionItem* mPreviousItem;
153  TQMap< const ProgressItem*, TransactionItem* > mTransactionsToListviewItems;
154  bool mWasLastShown;
155 };
156 
157 
158 } // namespace KPIM
159 
160 #endif // __KPIM_PROGRESSDIALOG_H__
TDEPIM classes for drag and drop of mails.