summaryrefslogtreecommitdiffstats
path: root/karm/karmutility.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /karm/karmutility.cpp
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'karm/karmutility.cpp')
-rw-r--r--karm/karmutility.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/karm/karmutility.cpp b/karm/karmutility.cpp
new file mode 100644
index 000000000..1663b178c
--- /dev/null
+++ b/karm/karmutility.cpp
@@ -0,0 +1,23 @@
+#ifndef KARM_UTILITY_H
+#define KARM_UTILITY_H
+
+#include <stdlib.h>
+
+#include <kglobal.h>
+#include <klocale.h>
+#include "karmutility.h"
+
+QString formatTime( long minutes, bool decimal )
+{
+ QString time;
+ if ( decimal ) {
+ time.sprintf("%.2f", minutes / 60.0);
+ time.replace( '.', KGlobal::locale()->decimalSymbol() );
+ }
+ else time.sprintf("%s%ld:%02ld",
+ (minutes < 0) ? KGlobal::locale()->negativeSign().utf8().data() : "",
+ labs(minutes / 60), labs(minutes % 60));
+ return time;
+}
+
+#endif // KARM_UTILITY_H