[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:20:11 UTC 2016


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

The following commit has been merged in the master branch:
commit b6fef6a2d5eef2907149a767b367479c72d27168
Author: Dominik Schmidt <dev at dominik-schmidt.de>
Date:   Sun Sep 18 07:18:02 2011 +0200

    Add history display capability in the chatview and show demo messages in the config
---
 config/appearance-config.cpp     | 17 +++++++++++-
 lib/adium-theme-message-info.cpp | 11 ++++++++
 lib/adium-theme-message-info.h   |  4 ++-
 lib/adium-theme-view.cpp         | 14 ++++++++++
 lib/chat-window-style.cpp        | 60 +++++++++++++++++++++++++++++-----------
 lib/chat-window-style.h          | 10 +++++++
 6 files changed, 98 insertions(+), 18 deletions(-)

diff --git a/config/appearance-config.cpp b/config/appearance-config.cpp
index 895040b..5d6bf1c 100644
--- a/config/appearance-config.cpp
+++ b/config/appearance-config.cpp
@@ -176,8 +176,23 @@ void AppearanceConfig::onFontSizeChanged(int fontSize)
 void AppearanceConfig::sendDemoMessages()
 {
     //add a fake message
+    AdiumThemeContentInfo message(AdiumThemeMessageInfo::HistoryRemoteToLocal);
+    message.setMessage(i18n("Bye Bye"));
+    message.setSenderDisplayName(i18n("larry at example.com"));
+    message.setSenderScreenName(i18n("Larry Demo"));
+    message.setService(i18n("Jabber"));
+    message.setTime(QDateTime::currentDateTime());
+    ui->chatView->addContentMessage(message);
+
+    message = AdiumThemeContentInfo(AdiumThemeMessageInfo::HistoryLocalToRemote);
+    message.setMessage(i18n("cya"));
+    message.setSenderDisplayName(i18n("ted at example.com"));
+    message.setSenderScreenName(i18n("Ted Example"));
+    message.setService(i18n("Jabber"));
+    message.setTime(QDateTime::currentDateTime());
+    ui->chatView->addContentMessage(message);
 
-    AdiumThemeContentInfo message(AdiumThemeMessageInfo::RemoteToLocal);
+    message = AdiumThemeContentInfo(AdiumThemeMessageInfo::RemoteToLocal);
     message.setMessage(i18n("Hello"));
     message.setSenderDisplayName(i18n("larry at example.com"));
     message.setSenderScreenName(i18n("Larry Demo"));
diff --git a/lib/adium-theme-message-info.cpp b/lib/adium-theme-message-info.cpp
index 545444d..c2bc216 100644
--- a/lib/adium-theme-message-info.cpp
+++ b/lib/adium-theme-message-info.cpp
@@ -125,6 +125,17 @@ QString AdiumThemeMessageInfo::messageClasses() const {
         classes.append(QLatin1String("status"));
     }
 
+    if (d->type == HistoryLocalToRemote) {
+        //classes.append("outgoing");
+        //classes.append("message");
+        classes.append(QLatin1String("history"));
+    }
+
+    if (d->type == HistoryRemoteToLocal) {
+        //classes.append("incoming");
+        classes.append(QLatin1String("history"));
+    }
+
     return classes.join(QLatin1String(" "));
 }
 
diff --git a/lib/adium-theme-message-info.h b/lib/adium-theme-message-info.h
index d90112c..9ce5d67 100644
--- a/lib/adium-theme-message-info.h
+++ b/lib/adium-theme-message-info.h
@@ -32,7 +32,9 @@ public:
     enum MessageType {
         RemoteToLocal,
         LocalToRemote,
-        Status
+        Status,
+        HistoryRemoteToLocal,
+        HistoryLocalToRemote
     };
 
     explicit AdiumThemeMessageInfo(MessageType);
diff --git a/lib/adium-theme-view.cpp b/lib/adium-theme-view.cpp
index 89879c8..fb9a1ee 100644
--- a/lib/adium-theme-view.cpp
+++ b/lib/adium-theme-view.cpp
@@ -315,6 +315,20 @@ void AdiumThemeView::addContentMessage(const AdiumThemeContentInfo &contentMessa
             styleHtml = m_chatStyle->getOutgoingHtml();
         }
         break;
+    case AdiumThemeMessageInfo::HistoryRemoteToLocal:
+        if (consecutiveMessage) {
+            styleHtml = m_chatStyle->getHistoryNextIncomingHtml();
+        } else {
+            styleHtml = m_chatStyle->getHistoryIncomingHtml();
+        }
+        break;
+    case AdiumThemeMessageInfo::HistoryLocalToRemote:
+        if (consecutiveMessage) {
+            styleHtml = m_chatStyle->getHistoryNextOutgoingHtml();
+        } else {
+            styleHtml = m_chatStyle->getHistoryOutgoingHtml();
+        }
+        break;
     default:
         qWarning() << "Unexpected message type to addContentMessage";
     }
diff --git a/lib/chat-window-style.cpp b/lib/chat-window-style.cpp
index a017b2c..f7b60d0 100644
--- a/lib/chat-window-style.cpp
+++ b/lib/chat-window-style.cpp
@@ -184,6 +184,26 @@ QString ChatWindowStyle::getStatusHtml() const
     return content(Status);
 }
 
+QString ChatWindowStyle::getHistoryIncomingHtml() const
+{
+    return content(HistoryIncoming);
+}
+
+QString ChatWindowStyle::getHistoryNextIncomingHtml() const
+{
+    return content(HistoryIncomingNext);
+}
+
+QString ChatWindowStyle::getHistoryOutgoingHtml() const
+{
+    return content(HistoryOutgoing);
+}
+
+QString ChatWindowStyle::getHistoryNextOutgoingHtml() const
+{
+    return content(HistoryOutgoingNext);
+}
+
 QString ChatWindowStyle::getActionIncomingHtml() const
 {
     return content(ActionIncoming);
@@ -285,7 +305,7 @@ void ChatWindowStyle::readStyleFiles()
     d->defaultFontFamily  = plistReader.defaultFontFamily();
     d->defaultFontSize    = plistReader.defaultFontSize();
 
-
+    // specify the files for the identifiers
     QHash<InternalIdentifier, QLatin1String> templateFiles;
     templateFiles.insert(Template, QLatin1String("Template.html"));
     templateFiles.insert(Status, QLatin1String("Status.html"));
@@ -313,10 +333,9 @@ void ChatWindowStyle::readStyleFiles()
     templateFiles.insert(OutgoingStateSending, QLatin1String("Outgoing/StateSending.html"));
     templateFiles.insert(OutgoingStateSent, QLatin1String("Outgoing/StateSent.html"));
     templateFiles.insert(OutgoingStateError, QLatin1String("Outgoing/StateError.html"));
-    //templateFiles.insert(InfoPlist, "../Info.plist");
 
 
-    // load all files first and then do all sorts of bloody workarounds
+    // load all files
     QFile fileAccess;
     Q_FOREACH(const QLatin1String &fileName, templateFiles)
     {
@@ -327,12 +346,30 @@ void ChatWindowStyle::readStyleFiles()
             fileAccess.open(QIODevice::ReadOnly);
             QTextStream headerStream(&fileAccess);
             headerStream.setCodec(QTextCodec::codecForName("UTF-8"));
-            setContent( templateFiles.key(fileName), headerStream.readAll());
+            QString data = headerStream.readAll();
+            if(!data.isEmpty()) {
+                //kDebug() << fileName << "was found!";
+                setContent( templateFiles.key(fileName), data);
+            } else {
+                kDebug() << fileName << "was not found!";
+            }
             //kDebug() << fileName << content(templateFiles.key(fileName));
             fileAccess.close();
         }
     }
 
+    // basic fallbacks
+    inheritContent(IncomingNext, Incoming);
+
+    inheritContent(Outgoing, Incoming);
+    inheritContent(OutgoingNext, Outgoing);
+
+    inheritContent(HistoryIncoming, Incoming);
+    inheritContent(HistoryIncomingNext, HistoryIncoming);
+
+    inheritContent(HistoryOutgoing, HistoryIncoming);
+    inheritContent(HistoryOutgoingNext, HistoryIncomingNext);
+
     // Load template file fallback
     if (content(Template).isEmpty())
     {
@@ -348,19 +385,9 @@ void ChatWindowStyle::readStyleFiles()
         }
     }
 
-    if (content(IncomingNext).isEmpty()) {
-        setContent(IncomingNext, content(Incoming));
-    }
-
-    if (content(Outgoing).isEmpty()) {
-        setContent(Outgoing, content(Incoming));
-    }
-
-    if (content(OutgoingNext).isEmpty()) {
-        setContent(OutgoingNext, content(Outgoing));
-    }
-
+    //FIXME: do we have anything like this in telepathy?!
 
+    // make sure file transfers are displayed correctly
     if (content(FileTransferIncoming).isEmpty() ||
             (!content(FileTransferIncoming).contains(QLatin1String("saveFileHandlerId")) &&
              !content(FileTransferIncoming).contains(QLatin1String("saveFileAsHandlerId")))) {   // Create default html
@@ -382,6 +409,7 @@ void ChatWindowStyle::readStyleFiles()
         setContent(FileTransferIncoming, incoming.replace(QLatin1String("%message%"), message));
     }
 
+    // make sure VoiceClip is displayed correctly
     if (content(VoiceClipIncoming).isEmpty() ||
             (!content(VoiceClipIncoming).contains("playVoiceHandlerId") &&
              !content(VoiceClipIncoming).contains("saveAsVoiceHandlerId"))) {   // Create default html
diff --git a/lib/chat-window-style.h b/lib/chat-window-style.h
index a706d13..b435382 100644
--- a/lib/chat-window-style.h
+++ b/lib/chat-window-style.h
@@ -105,6 +105,11 @@ public:
     QString getNextOutgoingHtml() const;
     QString getStatusHtml() const;
 
+    QString getHistoryIncomingHtml() const;
+    QString getHistoryNextIncomingHtml() const;
+    QString getHistoryOutgoingHtml() const;
+    QString getHistoryNextOutgoingHtml() const;
+
     QString getActionIncomingHtml() const;
     QString getActionOutgoingHtml() const;
 
@@ -170,6 +175,11 @@ private:
         Outgoing,
         OutgoingNext,
 
+        HistoryIncoming,
+        HistoryIncomingNext,
+        HistoryOutgoing,
+        HistoryOutgoingNext,
+
         ActionIncoming,
         ActionOutgoing,
 

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list