[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:18:05 UTC 2016


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

The following commit has been merged in the master branch:
commit 187aa90a038bde08ab4f24375548f09a3be29a4c
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Mon Sep 27 11:12:18 2010 +0000

    Remove all references to deprecated telepathychatmessage.cpp.
    Fix Html escaping and emoticon support.
    
    svn path=/trunk/playground/network/telepathy-chat-handler/; revision=1180207
---
 lib/CMakeLists.txt               |   1 -
 lib/adiumthememessageinfo.cpp    |   7 +-
 lib/adiumthemeview.cpp           |  72 +---------------
 lib/adiumthemeview.h             |   2 -
 lib/chatwindow.cpp               |   7 +-
 lib/chatwindow.h                 |   9 +-
 lib/telepathychatmessageinfo.cpp |  33 -------
 lib/telepathychatmessageinfo.h   | 181 ---------------------------------------
 8 files changed, 22 insertions(+), 290 deletions(-)

diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index c3bd48d..f277278 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -4,7 +4,6 @@ set(telepathy_chat_handler_lib_SRCS
         chatwindowstyle.cpp
         chatwindowstylemanager.cpp
         adiumthemeview.cpp
-        telepathychatmessageinfo.cpp
         adiumthemeheaderinfo.cpp
         adiumthememessageinfo.cpp
         adiumthemecontentinfo.cpp
diff --git a/lib/adiumthememessageinfo.cpp b/lib/adiumthememessageinfo.cpp
index cf891d5..c1e8e10 100644
--- a/lib/adiumthememessageinfo.cpp
+++ b/lib/adiumthememessageinfo.cpp
@@ -2,6 +2,8 @@
 #include <QString>
 #include <QStringList>
 #include <QDateTime>
+#include <QTextDocument> //needed for Qt::escape
+
 
 class AdiumThemeMessageInfoPrivate
 {
@@ -26,7 +28,10 @@ AdiumThemeMessageInfo::MessageType AdiumThemeMessageInfo::type() const
 
 QString AdiumThemeMessageInfo::message() const
 {
-    return d->message;
+    QString htmlMessage= Qt::escape(d->message);
+    htmlMessage.replace('
', "<br/>");
+
+    return htmlMessage;
 }
 
 void AdiumThemeMessageInfo::setMessage(const QString& message)
diff --git a/lib/adiumthemeview.cpp b/lib/adiumthemeview.cpp
index 2403f9d..795fdc9 100644
--- a/lib/adiumthemeview.cpp
+++ b/lib/adiumthemeview.cpp
@@ -31,7 +31,6 @@
 #include <QWebElement>
 #include <QFile>
 #include <QTextCodec>
-#include <QTextDocument> //needed for Qt::escape
 #include <QWebInspector>
 #include <QWebSettings>
 
@@ -208,14 +207,14 @@ void AdiumThemeView::addContentMessage(const AdiumThemeContentInfo &contentMessa
     }
 
     switch (contentMessage.type()) {
-    case TelepathyChatMessageInfo::RemoteToLocal:
+    case AdiumThemeMessageInfo::RemoteToLocal:
         if (consecutiveMessage) {
             styleHtml = m_chatStyle->getNextIncomingHtml();
         } else {
             styleHtml = m_chatStyle->getIncomingHtml();
         }
         break;
-    case TelepathyChatMessageInfo::LocalToRemote:
+    case AdiumThemeMessageInfo::LocalToRemote:
         if (consecutiveMessage) {
             styleHtml = m_chatStyle->getNextOutgoingHtml();
         } else {
@@ -243,71 +242,8 @@ void AdiumThemeView::addStatusMessage(const AdiumThemeStatusInfo& statusMessage)
     appendNewMessage(styleHtml);
 }
 
-void AdiumThemeView::addMessage(const TelepathyChatMessageInfo &message)
-{
-    QString styleHtml;
-    bool consecutiveMessage = false;
-
-    qDebug() << m_lastSender;
-
-    //FIXME "if group consecutive messages....{
-    if (m_lastSender == message.senderScreenName()) {
-        consecutiveMessage = true;
-    } else {
-        m_lastSender = message.senderScreenName();
-    }
-
-    switch (message.type()) {
-    case TelepathyChatMessageInfo::RemoteToLocal:
-        if (consecutiveMessage) {
-            styleHtml = m_chatStyle->getNextIncomingHtml();
-        } else {
-            styleHtml = m_chatStyle->getIncomingHtml();
-        }
-        break;
-    case TelepathyChatMessageInfo::LocalToRemote:
-        if (consecutiveMessage) {
-            styleHtml = m_chatStyle->getNextOutgoingHtml();
-        } else {
-            styleHtml = m_chatStyle->getOutgoingHtml();
-        }
-        break;
-    case TelepathyChatMessageInfo::Status:
-        styleHtml = m_chatStyle->getStatusHtml();
-        consecutiveMessage = false;
-        break;
-    }
-
-    QString messageHtml = m_emoticons.theme().parseEmoticons(Qt::escape(message.message()));
-
-    styleHtml.replace("%message%", messageHtml);
-    styleHtml.replace("%messageDirection%", message.messageDirection());
-    styleHtml.replace("%sender%", message.senderDisplayName()); // FIXME sender is complex: not always this
-    styleHtml.replace("%senderScreenName%", message.senderScreenName());
-    styleHtml.replace("%time%", KGlobal::locale()->formatTime(message.time().time(), true));
-    styleHtml.replace("%shortTime%", KGlobal::locale()->formatTime(message.time().time(), false));
-    styleHtml.replace("%userIconPath%", "outgoing_icon.png");// this fallback should be done in the messageinfo
-    styleHtml.replace("%messageClasses%", message.messageClasses());
-    styleHtml.replace("%service%", message.service());
-    styleHtml.replace("%userIcons%", message.userIcons());
-    styleHtml.replace("%status%", "idle");
-
-
-    // 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);
-    }
-
-    if (consecutiveMessage) {
-        appendNextMessage(styleHtml);
-    } else {
-        appendNewMessage(styleHtml);
-    }
-}
 
+/** Private */
 
 QString AdiumThemeView::replaceHeaderKeywords(QString htmlTemplate, const AdiumThemeHeaderInfo & info)
 {
@@ -360,7 +296,7 @@ QString AdiumThemeView::replaceStatusKeywords(QString &htmlTemplate, const Adium
 QString AdiumThemeView::replaceMessageKeywords(QString &htmlTemplate, const AdiumThemeMessageInfo& info)
 {
     //message
-    htmlTemplate.replace("%message%", info.message());
+    htmlTemplate.replace("%message%", m_emoticons.theme().parseEmoticons(info.message()));
     //time
     htmlTemplate.replace("%time%", KGlobal::locale()->formatTime(info.time().time(), true));
     //shortTime
diff --git a/lib/adiumthemeview.h b/lib/adiumthemeview.h
index b86543e..0d876d2 100644
--- a/lib/adiumthemeview.h
+++ b/lib/adiumthemeview.h
@@ -22,7 +22,6 @@
 
 #include <QWebView>
 #include "chatwindowstyle.h"
-#include "telepathychatmessageinfo.h"
 #include "adiumthemeheaderinfo.h"
 #include <KEmoticons>
 
@@ -54,7 +53,6 @@ public:
     /* .. font, backgrounds, everything else.*/
 
 public slots:
-    void addMessage(const TelepathyChatMessageInfo &message);
     void addContentMessage(const AdiumThemeContentInfo&);
     void addStatusMessage(const AdiumThemeStatusInfo&);
 
diff --git a/lib/chatwindow.cpp b/lib/chatwindow.cpp
index 1bece77..de174bb 100644
--- a/lib/chatwindow.cpp
+++ b/lib/chatwindow.cpp
@@ -19,7 +19,6 @@
 
 #include "chatwindow.h"
 #include "ui_chatwindow.h"
-#include "telepathychatmessageinfo.h"
 #include "adiumthemeheaderinfo.h"
 #include "adiumthemecontentinfo.h"
 #include "adiumthememessageinfo.h"
@@ -251,10 +250,12 @@ void ChatWindow::onContactPresenceChange(Tp::ContactPtr contact, uint type)
     }
 
     if (!message.isNull()) {
-        TelepathyChatMessageInfo statusMessage(TelepathyChatMessageInfo::Status);
+        AdiumThemeStatusInfo statusMessage;
         statusMessage.setMessage(message);
+        statusMessage.setStatus("");
+        statusMessage.setService(m_chatConnection->connection()->protocolName());
         statusMessage.setTime(QDateTime::currentDateTime());
-        ui->chatArea->addMessage(statusMessage);
+        ui->chatArea->addStatusMessage(statusMessage);
     }
 
 }
diff --git a/lib/chatwindow.h b/lib/chatwindow.h
index 9f5764b..7a33948 100644
--- a/lib/chatwindow.h
+++ b/lib/chatwindow.h
@@ -21,8 +21,11 @@
 #define CHATWINDOW_H
 
 #include <QWidget>
+#include <QString>
+#include <KIcon>
+
 #include <TelepathyQt4/ReceivedMessage>
-#include <chatconnection.h>
+#include "chatconnection.h"
 
 
 namespace Ui
@@ -84,12 +87,16 @@ signals:
     /** Emitted whenever the title for the chat changes, normally the name of the contact or a topic*/
     void titleChanged(QString title);
 
+    /** Emmitted if the icon for this channel changes*/
+    void iconChanged(KIcon icon);
+
     /** Emmited whenever a message is received in this channel*/
     void messageReceived();
 
     /** Emitted when another contact in the channel starts/stops typing (if supported by the protocol)*/
     void userTypingChanged(bool);
 
+
 private:
     Ui::ChatWindow *ui;
     ChatConnection* m_chatConnection;
diff --git a/lib/telepathychatmessageinfo.cpp b/lib/telepathychatmessageinfo.cpp
deleted file mode 100644
index 5d7217b..0000000
--- a/lib/telepathychatmessageinfo.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2010 by David Edmundson <kde at davidedmundson.co.uk>      *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
- ***************************************************************************/
-
-#include "telepathychatmessageinfo.h"
-
-//can probably delete this file. I put it all in the header.
-
-TelepathyChatMessageInfo::TelepathyChatMessageInfo(MessageType type)
-{
-    m_type = type;
-}
-
-QString TelepathyChatMessageInfo::userIcons() const
-{
-    //FIXME read config, return correct value.
-    return QString("showIcons");
-}
diff --git a/lib/telepathychatmessageinfo.h b/lib/telepathychatmessageinfo.h
deleted file mode 100644
index d90962e..0000000
--- a/lib/telepathychatmessageinfo.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2010 by David Edmundson <kde at davidedmundson.co.uk>      *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
- ***************************************************************************/
-
-#ifndef TELEPATHYCHATMESSAGEINFO_H
-#define TELEPATHYCHATMESSAGEINFO_H
-#include <QString>
-#include <QDateTime>
-#include <QUrl>
-#include <QStringList>
-
-/** This class contains all the information that is needed for a message or status message*/
-
-//no value handling to be done in this class.
-
-//rules for this class
-//anything relating to telepathy should be set by whoever fills in this class
-//anything relating to style only (i.e to show 12 or 24 hour time) should be handled by the chatview.
-
-class TelepathyChatMessageInfo
-{
-
-
-public:
-    enum MessageType {
-        RemoteToLocal,
-        LocalToRemote,
-        Status
-    };
-
-    TelepathyChatMessageInfo(MessageType);
-
-
-    //FIXME HTML escape all QString returns.
-
-    //bother. I've documented the private stuff. I meant to do the getters + setters. Can't be bothered to move it now. I'm too sleepy.
-
-    MessageType type() const {
-        return m_type;
-    }
-
-    QString message() const {
-        return m_message;
-    }
-    void setMessage(const QString message) {
-        m_message = message;
-    }
-
-    QDateTime time() const {
-        return m_time;
-    }
-    void setTime(const QDateTime time) {
-        m_time = time;
-    }
-
-    QString service() const {
-        return m_service;
-    }
-    void setService(const QString service) {
-        m_service = service;
-    }
-
-
-
-    //FIXME add the rest..
-    QString senderScreenName() const {
-        return m_senderScreenName;
-    }
-    void setSenderScreenName(const QString senderScreenName) {
-        m_senderScreenName = senderScreenName;
-    }
-
-    /** The text direction of the message (either rtl or ltr)  */
-    QString messageDirection() const {
-        if (m_type == LocalToRemote) {
-            return "ltr";
-        } else {
-            return "rtl";
-        }
-    }
-
-    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;
-
-        classes.append("action");
-
-        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(" ");
-    }
-
-    /** Will be replaced with "showIcons" if the "Show user icons" checkbox is selected, and will be replaced with "hideIcons" if the checkbox is deselected.*/
-    //This is pure style - do in the chat view instead?
-    QString userIcons() const;
-
-private:
-    //descriptions come from the data we need for Adium theme templates
-    //http://trac.adium.im/wiki/CreatingMessageStyles
-
-    //both status messages and regular messages
-
-    MessageType m_type;
-
-    /** The message itself of the message/status*/
-    QString m_message;
-
-    /** The time at which message/status occurred*/
-    QDateTime m_time;
-
-    /** A human readable description for the messaging service associated with this message, such as "AIM" or "MSN". */
-    QString m_service;
-
-
-    QString m_userIcons;
-
-    /** A space separated list of type information for messages, suitable for use as a class attribute. Currently available types are listed below. */
-    QString m_messageClasses;
-
-    /** A description of the status event. This is neither in the user's local language nor expected to be displayed; it may be useful to use a different div class to present different types of status messages. The following is a list of some of the more important status messages; your message style should be able to handle being shown a status message not in this list, as even at present the list is incomplete and is certain to become out of date in the future: */
-    QString m_status;
-
-    /** main message Path to the user icon associated with this message. If the user does not have an icon available, a path to the buddy_icon.png file in the Incoming or Outgoing directory (whichever is appropriate for the message) will be substituted instead, so if your message style uses this tag those files should be supplied as defaults. */
-    QUrl m_userIconPath;
-
-    /** The screen name (UID, ID, member name, etc.) of the sender of this message. See %sender%. */
-    QString m_senderScreenName;
-
-    /** The name of the sender of this message as the user's preferences request it. This is the recommended keyword to use for displaying the sender of a message, as it allows proper user customization within Adium. */
-    //FIXME this shouldn't be here maybe? only create in filter code and set to senderScreenName or senderDisplayName appropriately
-    QString m_sender;
-
-    /** The path to the status icon of the sender (available, away, etc...) */
-    QUrl m_senderStatusIcon;
-
-    /** The serverside (remotely set) name of the sender, such as an MSN display name.*/
-    QString m_senderDisplayName;
-
-    //FUTURE. This looks more confusing.
-    //textbackgroundcolor{X}
-
-};
-
-#endif // TELEPATHYCHATMESSAGEINFO_H

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list