[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:24:33 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=a41707d
The following commit has been merged in the master branch:
commit a41707d1c28279340eb473884b82778c4202ff3b
Author: Daniele E. Domenichelli <daniele.domenichelli at iit.it>
Date: Sun Apr 13 18:33:12 2014 +0200
Fix %sender% replacement for status messages
REVIEW: 117546
Reviewed-by: David Edmundson <kde at davidedmundson.co.uk>
---
config/appearance-config-tab.cpp | 4 ++++
lib/adium-theme-content-info.cpp | 15 +++++----------
lib/adium-theme-content-info.h | 3 ---
lib/adium-theme-message-info.cpp | 11 +++++++++++
lib/adium-theme-message-info.h | 4 ++++
lib/adium-theme-view.cpp | 9 +++++++--
lib/adium-theme-view.h | 4 +++-
lib/chat-widget.cpp | 10 +++++-----
8 files changed, 39 insertions(+), 21 deletions(-)
diff --git a/config/appearance-config-tab.cpp b/config/appearance-config-tab.cpp
index c1c4ab4..0d9c6c5 100644
--- a/config/appearance-config-tab.cpp
+++ b/config/appearance-config-tab.cpp
@@ -203,6 +203,7 @@ void AppearanceConfigTab::sendDemoMessages()
AdiumThemeStatusInfo statusMessage(true);
statusMessage.setMessage(i18nc("Example message", "Ted Example waves."));
+ statusMessage.setSender(i18nc("Example name", "Ted Example"));
statusMessage.setTime(QDateTime::currentDateTime());
statusMessage.setService(i18n("Jabber"));
ui->chatView->addAdiumStatusMessage(statusMessage);
@@ -210,6 +211,7 @@ void AppearanceConfigTab::sendDemoMessages()
if (ui->chatView->showLeaveChanges()) {
statusMessage = AdiumThemeStatusInfo(true);
statusMessage.setMessage(i18nc("Example message in preview conversation","Ted Example has left the chat.")); //FIXME sync this with chat text logic.
+ statusMessage.setSender(i18nc("Example name", "Ted Example"));
statusMessage.setTime(QDateTime::currentDateTime());
statusMessage.setService(i18n("Jabber"));
statusMessage.setStatus(QLatin1String("away"));
@@ -264,6 +266,7 @@ void AppearanceConfigTab::sendDemoMessages()
if (ui->chatView->showPresenceChanges()) {
statusMessage = AdiumThemeStatusInfo();
statusMessage.setMessage(i18nc("Example message in preview conversation","Ted Example is now Away.")); //FIXME sync this with chat text logic.
+ statusMessage.setSender(i18nc("Example name", "Ted Example"));
statusMessage.setTime(QDateTime::currentDateTime());
statusMessage.setService(i18n("Jabber"));
statusMessage.setStatus(QLatin1String("away"));
@@ -271,6 +274,7 @@ void AppearanceConfigTab::sendDemoMessages()
statusMessage = AdiumThemeStatusInfo();
statusMessage.setMessage(i18nc("Example message in preview conversations","Ted Example has left the chat.")); //FIXME sync this with chat text logic.
+ statusMessage.setSender(i18nc("Example name", "Ted Example"));
statusMessage.setTime(QDateTime::currentDateTime());
statusMessage.setService(i18n("Jabber"));
statusMessage.setStatus(QLatin1String("away"));
diff --git a/lib/adium-theme-content-info.cpp b/lib/adium-theme-content-info.cpp
index 6db9f9a..06b1d3c 100644
--- a/lib/adium-theme-content-info.cpp
+++ b/lib/adium-theme-content-info.cpp
@@ -49,11 +49,9 @@ class AdiumThemeContentInfoPrivate
{
public:
QString userIconPath;
- QString senderScreenName;
- QString sender;
QString senderColor;
QString senderStatusIcon;
- QString senderDisplayName;
+ QString senderScreenName;
QString textbackgroundcolor;
};
@@ -109,11 +107,6 @@ void AdiumThemeContentInfo::setSenderScreenName(const QString & senderScreenName
d->senderScreenName = senderScreenName;
}
-QString AdiumThemeContentInfo::sender() const
-{
- return d->senderDisplayName;
-}
-
QString AdiumThemeContentInfo::senderColor() const
{
return d->senderColor;
@@ -136,12 +129,14 @@ void AdiumThemeContentInfo::setSenderStatusIcon(const QString &senderStatusIcon)
QString AdiumThemeContentInfo::senderDisplayName() const
{
- return d->senderDisplayName;
+ return sender();
+
}
void AdiumThemeContentInfo::setSenderDisplayName(const QString &senderDisplayName)
{
- d->senderDisplayName = senderDisplayName;
+ setSender(senderDisplayName);
+
// FIXME Themes can have a SenderColors.txt file to specify which colors to
// use instead of the default ones.
d->senderColor = defaultColorList.at(qHash(senderDisplayName) % defaultColorList.size());
diff --git a/lib/adium-theme-content-info.h b/lib/adium-theme-content-info.h
index e339c91..50177e1 100644
--- a/lib/adium-theme-content-info.h
+++ b/lib/adium-theme-content-info.h
@@ -46,9 +46,6 @@ public:
QString senderScreenName() const;
void setSenderScreenName(const QString & senderScreenName);
- /** The name of the sender of this message as the user's preferences request it.*/
- QString sender() const;
-
/** A color derived from the user's name.*/
QString senderColor() const;
void setSenderColor(const QString& senderColor);
diff --git a/lib/adium-theme-message-info.cpp b/lib/adium-theme-message-info.cpp
index 7726fd2..6f85285 100644
--- a/lib/adium-theme-message-info.cpp
+++ b/lib/adium-theme-message-info.cpp
@@ -28,6 +28,7 @@ class AdiumThemeMessageInfoPrivate
public:
QString message;
QDateTime time;
+ QString sender;
QString service;
QStringList messageClasses;
AdiumThemeMessageInfo::MessageType type;
@@ -89,6 +90,16 @@ void AdiumThemeMessageInfo::setTime(const QDateTime& time)
d->time = time;
}
+QString AdiumThemeMessageInfo::sender() const
+{
+ return d->sender;
+}
+
+void AdiumThemeMessageInfo::setSender(const QString& sender)
+{
+ d->sender = sender;
+}
+
QString AdiumThemeMessageInfo::service() const
{
return d->service;
diff --git a/lib/adium-theme-message-info.h b/lib/adium-theme-message-info.h
index 35ead23..64341ef 100644
--- a/lib/adium-theme-message-info.h
+++ b/lib/adium-theme-message-info.h
@@ -55,6 +55,10 @@ public:
QDateTime time() const;
void setTime(const QDateTime& time);
+ /** The sender of the message */
+ QString sender() const;
+ void setSender(const QString& sender);
+
QString service() const;
void setService(const QString& service);
diff --git a/lib/adium-theme-view.cpp b/lib/adium-theme-view.cpp
index 72306a6..7e2595e 100644
--- a/lib/adium-theme-view.cpp
+++ b/lib/adium-theme-view.cpp
@@ -415,7 +415,7 @@ void AdiumThemeView::clear()
void AdiumThemeView::addMessage(const KTp::Message &message)
{
if (message.type() == Tp::ChannelTextMessageTypeAction) {
- addStatusMessage(QString::fromLatin1("%1 %2").arg(message.senderAlias(), message.mainMessagePart()));
+ addStatusMessage(QString::fromLatin1("%1 %2").arg(message.senderAlias(), message.mainMessagePart()), message.senderAlias());
} else {
AdiumThemeContentInfo messageInfo;
if (message.direction() == KTp::Message::RemoteToLocal) {
@@ -450,11 +450,12 @@ void AdiumThemeView::addMessage(const KTp::Message &message)
}
}
-void AdiumThemeView::addStatusMessage(const QString &text, const QDateTime &time)
+void AdiumThemeView::addStatusMessage(const QString &text, const QString &sender, const QDateTime &time)
{
AdiumThemeStatusInfo messageInfo;
messageInfo.setMessage(text);
messageInfo.setTime(time);
+ messageInfo.setSender(sender);
// messageInfo.setStatus(QLatin1String("error")); //port this?
addAdiumStatusMessage(messageInfo);
}
@@ -713,7 +714,11 @@ QString AdiumThemeView::replaceContentKeywords(QString& htmlTemplate, const Adiu
QString AdiumThemeView::replaceStatusKeywords(QString &htmlTemplate, const AdiumThemeStatusInfo& info)
{
+ // status
htmlTemplate.replace(QLatin1String("%status%"), info.status());
+ // sender
+ htmlTemplate.replace(QLatin1String("%sender%"), info.sender());
+
return replaceMessageKeywords(htmlTemplate, info);
}
diff --git a/lib/adium-theme-view.h b/lib/adium-theme-view.h
index 2628ba8..100df9d 100644
--- a/lib/adium-theme-view.h
+++ b/lib/adium-theme-view.h
@@ -104,7 +104,9 @@ public:
public Q_SLOTS:
void addMessage(const KTp::Message &message);
- void addStatusMessage(const QString &text, const QDateTime &time=QDateTime::currentDateTime());
+ void addStatusMessage(const QString &text,
+ const QString &sender=QString(),
+ const QDateTime &time=QDateTime::currentDateTime());
void onOpenLinkActionTriggered();
virtual void onLinkClicked(const QUrl &);
void injectProxyIntoJavascript();
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index 3682742..1b511ca 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -655,7 +655,7 @@ void ChatWidget::handleIncomingMessage(const Tp::ReceivedMessage &message, bool
return;
}
- d->ui.chatArea->addStatusMessage(text, message.received());
+ d->ui.chatArea->addStatusMessage(text, message.sender()->alias(), message.received());
} else {
KTp::Message processedMessage(KTp::MessageProcessor::instance()->processIncomingMessage(message, d->account, d->channel));
@@ -730,7 +730,7 @@ void ChatWidget::onChatStatusChanged(const Tp::ContactPtr & contact, Tp::Channel
if (state == Tp::ChannelChatStateGone) {
if (d->ui.chatArea->showLeaveChanges()) {
- d->ui.chatArea->addStatusMessage(i18n("%1 has left the chat", contact->alias()));
+ d->ui.chatArea->addStatusMessage(i18n("%1 has left the chat", contact->alias()), contact->alias());
}
}
@@ -792,7 +792,7 @@ void ChatWidget::onContactPresenceChange(const Tp::ContactPtr & contact, const K
if (!message.isNull()) {
if (d->ui.chatArea->showPresenceChanges()) {
- d->ui.chatArea->addStatusMessage(message);
+ d->ui.chatArea->addStatusMessage(message, contact->alias());
}
}
@@ -825,7 +825,7 @@ void ChatWidget::onContactAliasChanged(const Tp::ContactPtr & contact, const QSt
}
if (!message.isEmpty()) {
- d->ui.chatArea->addStatusMessage(i18n("%1 has left the chat", contact->alias()));
+ d->ui.chatArea->addStatusMessage(i18n("%1 has left the chat", contact->alias()), contact->alias());
}
//if in a non-group chat situation, and the other contact has changed alias...
@@ -1054,7 +1054,7 @@ void ChatWidget::onChatPausedTimerExpired()
void ChatWidget::currentPresenceChanged(const Tp::Presence &presence)
{
if (presence == Tp::Presence::offline()) {
- d->ui.chatArea->addStatusMessage(i18n("You are now offline"));
+ d->ui.chatArea->addStatusMessage(i18n("You are now offline"), d->yourName);
if(!d->isGroupChat) {
Q_EMIT iconChanged(KTp::Presence(Tp::Presence::offline()).icon());
} else {
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list