[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:16:20 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=9ebf817

The following commit has been merged in the master branch:
commit 9ebf81780efeafc6114b3aff70e9740c5c82f669
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Tue Sep 14 12:38:38 2010 +0000

    Improved chat style support.
    
    
    svn path=/trunk/playground/network/telepathy-chat-handler/; revision=1175186
---
 lib/chatview.cpp               | 35 ++++++++++++++++++-----------------
 lib/telepathychatmessageinfo.h | 26 +++++++++++++++++++++++++-
 2 files changed, 43 insertions(+), 18 deletions(-)

diff --git a/lib/chatview.cpp b/lib/chatview.cpp
index eeb08f7..dc8045b 100644
--- a/lib/chatview.cpp
+++ b/lib/chatview.cpp
@@ -191,14 +191,15 @@ void ChatView::addMessage(const TelepathyChatMessageInfo &message)
     styleHtml.replace("%sender%", message.senderDisplayName()); // FIXME sender is complex: not always this
     styleHtml.replace("%time%", KGlobal::locale()->formatTime(message.time().time(), true));
     styleHtml.replace("%userIconPath%", "Outgoing/buddy_icon.png");// this fallback should be done in the messageinfo
+    styleHtml.replace("%messageClasses%", message.messageClasses());
+
 
     // Look for %time{X}%
     QRegExp timeRegExp("%time\{([^}]*)\}%");
-    int pos=0;
-    while( (pos=timeRegExp.indexIn(styleHtml , pos) ) != -1 )
-    {
-            QString timeKeyword = formatTime( timeRegExp.cap(1), message.time() );
-            styleHtml.replace( pos , timeRegExp.cap(0).length() , timeKeyword );
+    int pos = 0;
+    while ((pos = timeRegExp.indexIn(styleHtml , pos)) != -1) {
+        QString timeKeyword = formatTime(timeRegExp.cap(1), message.time());
+        styleHtml.replace(pos , timeRegExp.cap(0).length() , timeKeyword);
     }
 
     if (consecutiveMessage) {
@@ -242,20 +243,20 @@ void ChatView::appendNextMessage(QString &html)
 //taken from Kopete code
 QString ChatView::formatTime(const QString &_timeFormat, const QDateTime &dateTime)
 {
-        char buffer[256];
+    char buffer[256];
 #ifdef Q_WS_WIN
-        QString timeFormat = _timeFormat;
-        // some formats are not supported on windows (gnu extension?)
-        timeFormat = timeFormat.replace(QLatin1String("%e"), QLatin1String("%d"));
-        timeFormat = timeFormat.replace(QLatin1String("%T"), QLatin1String("%H:%M:%S"));
+    QString timeFormat = _timeFormat;
+    // some formats are not supported on windows (gnu extension?)
+    timeFormat = timeFormat.replace(QLatin1String("%e"), QLatin1String("%d"));
+    timeFormat = timeFormat.replace(QLatin1String("%T"), QLatin1String("%H:%M:%S"));
 #else
-        const QString timeFormat = _timeFormat;
+    const QString timeFormat = _timeFormat;
 #endif
-        // Get current time
-        time_t timeT = dateTime.toTime_t();
-        // Convert it to local time representation.
-        struct tm* loctime = localtime (&timeT);
-        strftime (buffer, 256, timeFormat.toAscii(), loctime);
+    // Get current time
+    time_t timeT = dateTime.toTime_t();
+    // Convert it to local time representation.
+    struct tm* loctime = localtime(&timeT);
+    strftime(buffer, 256, timeFormat.toAscii(), loctime);
 
-        return QString(buffer);
+    return QString(buffer);
 }
diff --git a/lib/telepathychatmessageinfo.h b/lib/telepathychatmessageinfo.h
index 6cde909..5e10572 100644
--- a/lib/telepathychatmessageinfo.h
+++ b/lib/telepathychatmessageinfo.h
@@ -22,7 +22,7 @@
 #include <QString>
 #include <QDateTime>
 #include <QUrl>
-
+#include <QStringList>
 
 /** This class contains all the information that is needed for a message or status message*/
 
@@ -99,10 +99,34 @@ public:
     QString senderDisplayName() const {
         return m_senderDisplayName;
     }
+
     void setSenderDisplayName(const QString senderDisplayName) {
         m_senderDisplayName = senderDisplayName;
     }
 
+    QString messageClasses() const {
+        //in the future this will also contain history, consecutive, autoreply, status, event
+        //these will be stored internally as flags
+
+        QStringList classes;
+
+        if (m_type == RemoteToLocal) {
+            classes.append("incoming");
+            classes.append("message");
+        }
+
+        if (m_type == LocalToRemote) {
+            classes.append("outgoing");
+            classes.append("message");
+        }
+
+        if (m_type == Status) {
+            classes.append("status");
+        }
+
+        return classes.join(" ");
+    }
+
 
 
 private:

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list