compile
[kdepim.git] / libkdepim / broadcaststatus.h
blobc4455226f00d3c53cc7233dfb5a178adc6ee07a4
1 /*
2 broadcaststatus.h
4 This file is part of libkdepim.
6 Copyright (C) 2000 Don Sanders <sanders@kde.org>
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; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #ifndef KDEPIM_BROADCASTSTATUS_H
24 #define KDEPIM_BROADCASTSTATUS_H
26 #include "kdepim_export.h"
27 #include <QObject>
29 #undef None
31 namespace KPIM {
33 class ProgressItem;
35 /**
36 Provides a singleton which broadcasts status messages by emitting
37 signals. Interested mainwindows can connect to the statusMsg()
38 signal and update statusBars or whatever they use for showing status.
40 class KDEPIM_EXPORT BroadcastStatus : public QObject
43 Q_OBJECT
45 public:
46 virtual ~BroadcastStatus();
48 /** Return the instance of the singleton object for this class */
49 static BroadcastStatus *instance();
51 /** Return the last status message from setStatusMsg() */
52 QString statusMsg() const { return mStatusMsg; }
54 /** Sets a status bar message with timestamp */
55 void setStatusMsgWithTimestamp( const QString &message );
57 /** Sets a transmission completed status bar message */
58 void setStatusMsgTransmissionCompleted( int numMessages,
59 int numBytes = -1,
60 int numBytesRead = -1,
61 int numBytesToRead = -1,
62 bool mLeaveOnServer = false,
63 KPIM::ProgressItem *progressItem = 0 );
64 void setStatusMsgTransmissionCompleted( const QString &account,
65 int numMessages,
66 int numBytes = -1,
67 int numBytesRead = -1,
68 int numBytesToRead = -1,
69 bool mLeaveOnServer = false,
70 KPIM::ProgressItem *progressItem = 0 );
72 public Q_SLOTS:
73 /**
74 Emit an update status bar signal. It's a slot so it can be hooked up
75 to other signals.
77 void setStatusMsg( const QString &message );
79 /**
80 Set a status message that will go away again with the next call of
81 reset().
83 void setTransientStatusMsg( const QString &msg );
85 /**
86 Reset the status message to what ever non-transient message was last
87 active or has since been set.
89 void reset();
91 Q_SIGNALS:
92 /** Emitted when setStatusMsg is called. */
93 void statusMsg( const QString & );
95 protected:
96 BroadcastStatus();
97 QString mStatusMsg;
98 bool mTransientActive;
103 #endif