[Pkg-owncloud-commits] [owncloud-client] 41/470: Utility: Make the timeAgoInWords method a bit more verbose

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu May 12 16:24:42 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 7f18d087e6f196106e259860925bbaf5c0235832
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Mon Feb 15 17:58:32 2016 +0100

    Utility: Make the timeAgoInWords method a bit more verbose
---
 src/libsync/utility.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/libsync/utility.cpp b/src/libsync/utility.cpp
index e511d80..85e42c4 100644
--- a/src/libsync/utility.cpp
+++ b/src/libsync/utility.cpp
@@ -445,14 +445,20 @@ QString Utility::timeAgoInWords(const QDateTime& dt, const QDateTime& from)
         return QObject::tr("%1 day(s) ago", "", dtn).arg(dtn);
     } else {
         qint64 secs = dt.secsTo(now);
-
+        if( secs < 0 ) {
+            return QObject::tr("in the future");
+        }
         if( floor(secs / 3600.0) > 0 ) {
             int hours = floor(secs/3600.0);
             return( QObject::tr("%1 hour(s) ago", "", hours).arg(hours));
         } else {
             int minutes = qRound(secs/60.0);
             if( minutes == 0 ) {
-                return QObject::tr("Less than a minute ago");
+                if(secs < 5) {
+                    return QObject::tr("now");
+                } else {
+                    return QObject::tr("Less than a minute ago");
+                }
             }
             return( QObject::tr("%1 minute(s) ago", "", minutes).arg(minutes));
         }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list