[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:00 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=51c8260
The following commit has been merged in the master branch:
commit 51c8260c97aec62f60c7e331e50269da04258da4
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Thu Sep 23 23:40:07 2010 +0000
Context menu to show/hide the format toolbar
svn path=/trunk/playground/network/telepathy-chat-handler/; revision=1178815
---
lib/chattextedit.cpp | 17 +++++++++++++++++
lib/chattextedit.h | 4 ++++
lib/chatwindow.cpp | 39 +++++++++++++++++++++++++++++++++++----
lib/chatwindow.h | 1 +
4 files changed, 57 insertions(+), 4 deletions(-)
diff --git a/lib/chattextedit.cpp b/lib/chattextedit.cpp
index f65a153..a733001 100644
--- a/lib/chattextedit.cpp
+++ b/lib/chattextedit.cpp
@@ -1,4 +1,12 @@
#include "chattextedit.h"
+#include <QMenu>
+#include <QContextMenuEvent>
+#include <QAction>
+
+class ChatTextEditPrivate
+{
+ QWidget* formatToolbar;
+};
ChatTextEdit::ChatTextEdit(QWidget *parent) :
QTextEdit(parent)
@@ -16,3 +24,12 @@ void ChatTextEdit::setFontBold(bool isBold)
setFontWeight(QFont::Normal);
}
}
+
+void ChatTextEdit::contextMenuEvent(QContextMenuEvent *event)
+{
+ QMenu *menu = createStandardContextMenu();
+ menu->addActions(actions());
+ menu->addAction("asdlfkjasdflkj");
+ menu->exec(event->globalPos());
+ delete menu;
+}
diff --git a/lib/chattextedit.h b/lib/chattextedit.h
index 2f1a1c5..e43e8e0 100644
--- a/lib/chattextedit.h
+++ b/lib/chattextedit.h
@@ -11,6 +11,10 @@ public:
signals:
+
+protected:
+ void contextMenuEvent(QContextMenuEvent *e);
+
public slots:
/** wraps setFontWeight to a simple on/off bold) */
void setFontBold(bool);
diff --git a/lib/chatwindow.cpp b/lib/chatwindow.cpp
index eaf60fa..89c71c7 100644
--- a/lib/chatwindow.cpp
+++ b/lib/chatwindow.cpp
@@ -24,6 +24,14 @@
#include "channelcontactlist.h"
#include <QKeyEvent>
+#include <QAction>
+#include <QWidget>
+
+
+#include <TelepathyQt4/Message>
+#include <TelepathyQt4/Types>
+
+
//FIXME once TP::Factory stuff is in, remove all of ChatConnection, replace this with
//ChatWindow::ChatWindow(ConnectionPtr,TextChannelPtr, QWidget* parent) :...
@@ -31,7 +39,8 @@ ChatWindow::ChatWindow(ChatConnection* chat, QWidget *parent) :
QWidget(parent),
ui(new Ui::ChatWindow),
m_chatConnection(chat),
- m_chatviewlInitialised(false)
+ m_chatviewlInitialised(false),
+ m_showFormatToolbarAction(new QAction(i18n("Show format options"), this))
{
ui->setupUi(this);
ui->statusLabel->setText("");
@@ -48,13 +57,23 @@ ChatWindow::ChatWindow(ChatConnection* chat, QWidget *parent) :
ui->insertEmoticon->setText("");
ui->insertEmoticon->setIcon(KIcon("face-smile"));
+ updateEnabledState(false);
+
+ //format toolbar visibility
+ m_showFormatToolbarAction->setCheckable(true);
+ connect(m_showFormatToolbarAction, SIGNAL(toggled(bool)), ui->formatToolbar, SLOT(setVisible(bool)));
+ ui->sendMessageBox->addAction(m_showFormatToolbarAction);
+
+ //FIXME load whether to show/hide by default from config file (do per account)
+ bool formatToolbarIsVisible = false;
+ ui->formatToolbar->setVisible(formatToolbarIsVisible);
+ m_showFormatToolbarAction->setChecked(formatToolbarIsVisible);
+
+ //connect signals/slots from format toolbar
connect(ui->formatBold, SIGNAL(toggled(bool)), ui->sendMessageBox, SLOT(setFontBold(bool)));
connect(ui->formatItalic, SIGNAL(toggled(bool)), ui->sendMessageBox, SLOT(setFontItalic(bool)));
connect(ui->formatUnderline, SIGNAL(toggled(bool)), ui->sendMessageBox, SLOT(setFontUnderline(bool)));
-
- updateEnabledState(false);
-
//chat connection lifespan should be same as the chatwindow
m_chatConnection->setParent(this);
@@ -100,6 +119,18 @@ void ChatWindow::handleIncomingMessage(const Tp::ReceivedMessage &message)
{
if (m_chatviewlInitialised) {
TelepathyChatMessageInfo messageInfo(TelepathyChatMessageInfo::RemoteToLocal);
+
+ //debug the message parts (looking for HTML etc)
+// foreach(Tp::MessagePart part, message.parts())
+// {
+// qDebug() << "***";
+// foreach(QString key, part.keys())
+// {
+// qDebug() << key << part.value(key).variant();
+// }
+// }
+
+
messageInfo.setMessage(message.text());
messageInfo.setTime(message.received());
messageInfo.setSenderDisplayName(message.sender()->alias());
diff --git a/lib/chatwindow.h b/lib/chatwindow.h
index 6bdbaed..9f5764b 100644
--- a/lib/chatwindow.h
+++ b/lib/chatwindow.h
@@ -99,6 +99,7 @@ private:
MessageBoxEventFilter* messageBoxEventFilter;
ChannelChatState lastRequestedChannelChatState;
+ QAction* m_showFormatToolbarAction;
};
#endif // CHATWINDOW_H
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list