summaryrefslogtreecommitdiffstats
path: root/libtdepim/broadcaststatus.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:57:02 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:57:02 -0600
commit2c2fbd828ca474671bb9e03681b30b115d8d6035 (patch)
tree526a9da418f8d3d7ccf515c37048d3dfc80f2843 /libtdepim/broadcaststatus.cpp
parentf0610eece3676b6fe99f42cf4ef2b19a39a5c4e8 (diff)
downloadtdepim-2c2fbd828ca474671bb9e03681b30b115d8d6035.tar.gz
tdepim-2c2fbd828ca474671bb9e03681b30b115d8d6035.zip
Actually move the kde files that were renamed in the last commit
Diffstat (limited to 'libtdepim/broadcaststatus.cpp')
-rw-r--r--libtdepim/broadcaststatus.cpp165
1 files changed, 165 insertions, 0 deletions
diff --git a/libtdepim/broadcaststatus.cpp b/libtdepim/broadcaststatus.cpp
new file mode 100644
index 000000000..a50479195
--- /dev/null
+++ b/libtdepim/broadcaststatus.cpp
@@ -0,0 +1,165 @@
+/*
+ broadcaststatus.cpp
+
+ This file is part of KDEPIM.
+
+ Author: Don Sanders <sanders@kde.org>
+
+ Copyright (C) 2000 Don Sanders <sanders@kde.org>
+
+ License GPL
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tqdatetime.h>
+
+#include <klocale.h>
+#include <kglobal.h>
+#include <kstaticdeleter.h>
+
+#include "broadcaststatus.h"
+#include "progressmanager.h"
+
+KPIM::BroadcastStatus* KPIM::BroadcastStatus::instance_ = 0;
+static KStaticDeleter<KPIM::BroadcastStatus> broadcasStatusDeleter;
+
+namespace KPIM {
+
+BroadcastStatus* BroadcastStatus::instance()
+{
+ if (!instance_)
+ broadcasStatusDeleter.setObject( instance_, new BroadcastStatus() );
+
+ return instance_;
+}
+
+BroadcastStatus::BroadcastStatus()
+ :mTransientActive( false )
+{
+}
+
+BroadcastStatus::~BroadcastStatus()
+{
+ instance_ = 0;
+}
+
+void BroadcastStatus::seStatusMsg( const TQString& message )
+{
+ mStatusMsg = message;
+ if( !mTransientActive )
+ emit statusMsg( message );
+}
+
+void BroadcastStatus::seStatusMsgWithTimestamp( const TQString& message )
+{
+ KLocale* locale = KGlobal::locale();
+ seStatusMsg( i18n( "%1 is a time, %2 is a status message", "[%1] %2" )
+ .tqarg( locale->formatTime( TQTime::currentTime(),
+ true /* with seconds */ ) )
+ .tqarg( message ) );
+}
+
+void BroadcastStatus::seStatusMsgTransmissionCompleted( int numMessages,
+ int numBytes,
+ int numBytesRead,
+ int numBytesToRead,
+ bool mLeaveOnServer,
+ KPIM::ProgressItem* item )
+{
+ TQString statusMsg;
+ if( numMessages > 0 ) {
+ if( numBytes != -1 ) {
+ if( ( numBytesToRead != numBytes ) && mLeaveOnServer )
+ statusMsg = i18n( "Transmission complete. %n new message in %1 KB "
+ "(%2 KB remaining on the server).",
+ "Transmission complete. %n new messages in %1 KB "
+ "(%2 KB remaining on the server).",
+ numMessages )
+ .tqarg( numBytesRead / 1024 )
+ .tqarg( numBytes / 1024 );
+ else
+ statusMsg = i18n( "Transmission complete. %n message in %1 KB.",
+ "Transmission complete. %n messages in %1 KB.",
+ numMessages )
+ .tqarg( numBytesRead / 1024 );
+ }
+ else
+ statusMsg = i18n( "Transmission complete. %n new message.",
+ "Transmission complete. %n new messages.",
+ numMessages );
+ }
+ else
+ statusMsg = i18n( "Transmission complete. No new messages." );
+
+ seStatusMsgWithTimestamp( statusMsg );
+ if ( item )
+ item->setqStatus( statusMsg );
+}
+
+void BroadcastStatus::seStatusMsgTransmissionCompleted( const TQString& account,
+ int numMessages,
+ int numBytes,
+ int numBytesRead,
+ int numBytesToRead,
+ bool mLeaveOnServer,
+ KPIM::ProgressItem* item )
+{
+ TQString statusMsg;
+ if( numMessages > 0 ) {
+ if( numBytes != -1 ) {
+ if( ( numBytesToRead != numBytes ) && mLeaveOnServer )
+ statusMsg = i18n( "Transmission for account %3 complete. "
+ "%n new message in %1 KB "
+ "(%2 KB remaining on the server).",
+ "Transmission for account %3 complete. "
+ "%n new messages in %1 KB "
+ "(%2 KB remaining on the server).",
+ numMessages )
+ .tqarg( numBytesRead / 1024 )
+ .tqarg( numBytes / 1024 )
+ .tqarg( account );
+ else
+ statusMsg = i18n( "Transmission for account %2 complete. "
+ "%n message in %1 KB.",
+ "Transmission for account %2 complete. "
+ "%n messages in %1 KB.",
+ numMessages )
+ .tqarg( numBytesRead / 1024 )
+ .tqarg( account );
+ }
+ else
+ statusMsg = i18n( "Transmission for account %1 complete. "
+ "%n new message.",
+ "Transmission for account %1 complete. "
+ "%n new messages.",
+ numMessages )
+ .tqarg( account );
+ }
+ else
+ statusMsg = i18n( "Transmission for account %1 complete. No new messages.")
+ .tqarg( account );
+
+ seStatusMsgWithTimestamp( statusMsg );
+ if ( item )
+ item->setqStatus( statusMsg );
+}
+
+void BroadcastStatus::setTransienStatusMsg( const TQString& msg )
+{
+ mTransientActive = true;
+ emit statusMsg( msg );
+}
+
+void BroadcastStatus::reset()
+{
+ mTransientActive = false;
+ // restore
+ emit statusMsg( mStatusMsg );
+}
+
+}
+
+#include "broadcaststatus.moc"