17 #include <tqdatetime.h>
19 #include <tdelocale.h>
20 #include <tdeglobal.h>
21 #include <kstaticdeleter.h>
23 #include "broadcaststatus.h"
24 #include "progressmanager.h"
27 static KStaticDeleter<KPIM::BroadcastStatus> broadcasStatusDeleter;
39 BroadcastStatus::BroadcastStatus()
40 :mTransientActive( false )
44 BroadcastStatus::~BroadcastStatus()
52 if( !mTransientActive )
58 TDELocale* locale = TDEGlobal::locale();
59 setStatusMsg( i18n(
"%1 is a time, %2 is a status message",
"[%1] %2" )
60 .arg( locale->formatTime( TQTime::currentTime(),
70 KPIM::ProgressItem* item )
73 if( numMessages > 0 ) {
74 if( numBytes != -1 ) {
75 if( ( numBytesToRead != numBytes ) && mLeaveOnServer )
76 statusMsg = i18n(
"Transmission complete. %n new message in %1 KB "
77 "(%2 KB remaining on the server).",
78 "Transmission complete. %n new messages in %1 KB "
79 "(%2 KB remaining on the server).",
81 .arg( numBytesRead / 1024 )
82 .arg( numBytes / 1024 );
84 statusMsg = i18n(
"Transmission complete. %n message in %1 KB.",
85 "Transmission complete. %n messages in %1 KB.",
87 .arg( numBytesRead / 1024 );
90 statusMsg = i18n(
"Transmission complete. %n new message.",
91 "Transmission complete. %n new messages.",
95 statusMsg = i18n(
"Transmission complete. No new messages." );
108 KPIM::ProgressItem* item )
111 if( numMessages > 0 ) {
112 if( numBytes != -1 ) {
113 if( ( numBytesToRead != numBytes ) && mLeaveOnServer )
114 statusMsg = i18n(
"Transmission for account %3 complete. "
115 "%n new message in %1 KB "
116 "(%2 KB remaining on the server).",
117 "Transmission for account %3 complete. "
118 "%n new messages in %1 KB "
119 "(%2 KB remaining on the server).",
121 .arg( numBytesRead / 1024 )
122 .arg( numBytes / 1024 )
125 statusMsg = i18n(
"Transmission for account %2 complete. "
126 "%n message in %1 KB.",
127 "Transmission for account %2 complete. "
128 "%n messages in %1 KB.",
130 .arg( numBytesRead / 1024 )
134 statusMsg = i18n(
"Transmission for account %1 complete. "
136 "Transmission for account %1 complete. "
142 statusMsg = i18n(
"Transmission for account %1 complete. No new messages.")
152 mTransientActive =
true;
158 mTransientActive =
false;
165 #include "broadcaststatus.moc"
Provides a singleton which broadcasts status messages by emitting signals.
void setStatusMsgWithTimestamp(const TQString &message)
Sets a status bar message with timestamp.
void setTransienStatusMsg(const TQString &msg)
Set a status message that will go away again with the next call of reset().
void reset()
Reset the status message to what ever non-transient message was last active or has since been set.
void setStatusMsg(const TQString &message)
Emit an update status bar signal.
void setStatusMsgTransmissionCompleted(int numMessages, int numBytes=-1, int numBytesRead=-1, int numBytesToRead=-1, bool mLeaveOnServer=false, KPIM::ProgressItem *progressItem=0)
Sets a transmission completed status bar message.
TQString statusMsg() const
Return the last status message from setStatusMsg()
static BroadcastStatus * instance()
Return the instance of the singleton object for this class.
TDEPIM classes for drag and drop of mails.