[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:19 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=d52bac3
The following commit has been merged in the master branch:
commit d52bac31fd9c0edbb2240b58fd4099bf3aea348b
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Mon Aug 23 22:08:13 2010 +0000
Added support for showing/hiding header in main chat view.
Added configuration of this in the configuration dialog
svn path=/trunk/playground/network/telepathy-chat-handler/; revision=1167181
---
config/chatwindowconfig.ui | 4 ++--
config/mainwindow.cpp | 17 +++++++++++++----
config/mainwindow.h | 1 +
lib/chatview.cpp | 23 +++++++++++++++++------
lib/chatview.h | 13 ++++++-------
5 files changed, 39 insertions(+), 19 deletions(-)
diff --git a/config/chatwindowconfig.ui b/config/chatwindowconfig.ui
index b852a13..1d80b9e 100644
--- a/config/chatwindowconfig.ui
+++ b/config/chatwindowconfig.ui
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>Dialog</string>
+ <string>Telepathy Chat Window Config</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@@ -68,7 +68,7 @@
</widget>
</item>
<item row="3" column="1">
- <widget class="QCheckBox" name="checkBox_2">
+ <widget class="QCheckBox" name="showHeader">
<property name="text">
<string>Show Header</string>
</property>
diff --git a/config/mainwindow.cpp b/config/mainwindow.cpp
index ae78fb5..d31e952 100644
--- a/config/mainwindow.cpp
+++ b/config/mainwindow.cpp
@@ -18,8 +18,6 @@ MainWindow::MainWindow(QWidget *parent) :
manager->loadStyles();
connect(manager, SIGNAL(loadStylesFinished()), SLOT(onStylesLoaded()));
- //FIXME move all the demo chat code into a different file, as it will be quite long and in the way.
-
//set up a pretend config chat.
TelepathyChatInfo info;
@@ -31,9 +29,12 @@ MainWindow::MainWindow(QWidget *parent) :
ui->chatView->initialise(info);
+ ui->showHeader->setChecked(ui->chatView->isHeaderDisplayed());
+
connect(ui->chatView, SIGNAL(loadFinished(bool)), SLOT(sendDemoMessages()));
- connect(ui->styleComboBox, SIGNAL(activated(const QString&)), SLOT(onStyleSelected(QString)));
- connect(ui->variantComboBox, SIGNAL(activated(const QString&)), SLOT(onVariantSelected(const QString&)));
+ connect(ui->styleComboBox, SIGNAL(activated(QString)), SLOT(onStyleSelected(QString)));
+ connect(ui->variantComboBox, SIGNAL(activated(QString)), SLOT(onVariantSelected(QString)));
+ connect(ui->showHeader,SIGNAL(clicked(bool)), SLOT(onShowHeaderChanged(bool)));
}
MainWindow::~MainWindow()
@@ -96,6 +97,12 @@ void MainWindow::onVariantSelected(const QString &variant)
}
+void MainWindow::onShowHeaderChanged(bool showHeader)
+{
+ ui->chatView->setHeaderDisplayed(showHeader);
+}
+
+
void MainWindow::sendDemoMessages()
{
//add a fake message
@@ -133,8 +140,10 @@ void MainWindow::accept()
appearanceConfig.writeEntry("styleName", ui->styleComboBox->currentText());
appearanceConfig.writeEntry("styleVariant", ui->variantComboBox->currentText());
+ appearanceConfig.writeEntry("displayHeader", ui->showHeader->isChecked());
appearanceConfig.sync();
config->sync();
+
QDialog::accept();
}
diff --git a/config/mainwindow.h b/config/mainwindow.h
index 9ba68fd..253fdbe 100644
--- a/config/mainwindow.h
+++ b/config/mainwindow.h
@@ -30,6 +30,7 @@ private slots:
void onStyleSelected(const QString&);
void onVariantSelected(const QString&);
+ void onShowHeaderChanged(bool);
};
#endif // MAINWINDOW_H
diff --git a/lib/chatview.cpp b/lib/chatview.cpp
index 01f79d6..eeb08f7 100644
--- a/lib/chatview.cpp
+++ b/lib/chatview.cpp
@@ -40,7 +40,7 @@
ChatView::ChatView(QWidget *parent) :
QWebView(parent),
- m_showHeader(true)
+ m_displayHeader(true)
{
//determine the chat window style to use (from the Kopete config file).
//FIXME use our own config file. I think we probably want everything from the appearance config group in ours, so it's a simple change.
@@ -50,13 +50,13 @@ ChatView::ChatView(QWidget *parent) :
QString chatStyleName = appearanceConfig.readEntry("styleName", "Renkoo.AdiumMessageStyle");
m_chatStyle = ChatWindowStyleManager::self()->getValidStyleFromPool(chatStyleName);
-
if (m_chatStyle == 0 || !m_chatStyle->isValid()) {
KMessageBox::error(this, "Failed to load a valid Kopete theme. Please make sure you run the chat window configuration program first.");
}
QString variant = appearanceConfig.readEntry("styleVariant");
m_variantPath = QString("Variants/%1.css").arg(variant);
+ m_displayHeader = appearanceConfig.readEntry("displayHeader", false);
//special HTML debug mode. Debugging/Profiling only (or theme creating) should have no visible way to turn this flag on.
@@ -82,7 +82,7 @@ void ChatView::initialise(const TelepathyChatInfo &chatInfo)
}
QString headerHtml;
- if (m_showHeader) {
+ if (m_displayHeader) {
headerHtml = replaceHeaderKeywords(m_chatStyle->getHeaderHtml(), chatInfo);
} //otherwise leave as blank.
@@ -139,7 +139,18 @@ void ChatView::setChatStyle(ChatWindowStyle *chatStyle)
}
-void ChatView::addMessage(TelepathyChatMessageInfo & message)
+bool ChatView::isHeaderDisplayed() const
+{
+ return m_displayHeader;
+}
+
+void ChatView::setHeaderDisplayed(bool displayHeader)
+{
+ m_displayHeader = displayHeader;
+ initialise(m_chatInfo);
+}
+
+void ChatView::addMessage(const TelepathyChatMessageInfo &message)
{
QString styleHtml;
bool consecutiveMessage = false;
@@ -213,7 +224,7 @@ QString ChatView::replaceHeaderKeywords(QString htmlTemplate, const TelepathyCha
return htmlTemplate;
}
-void ChatView::appendNewMessage(QString html)
+void ChatView::appendNewMessage(QString &html)
{
//by making the JS return false evaluateJavaScript is a _lot_ faster, as it has nothing to convert to QVariant.
//escape quotes, and merge HTML onto one line.
@@ -221,7 +232,7 @@ void ChatView::appendNewMessage(QString html)
page()->mainFrame()->evaluateJavaScript(js);
}
-void ChatView::appendNextMessage(QString html)
+void ChatView::appendNextMessage(QString &html)
{
QString js = QString("appendNextMessage(\"%1\");false;").arg(html.replace('"', "\\"").replace('
', ""));
page()->mainFrame()->evaluateJavaScript(js);
diff --git a/lib/chatview.h b/lib/chatview.h
index 7100e12..5d52ff2 100644
--- a/lib/chatview.h
+++ b/lib/chatview.h
@@ -44,18 +44,17 @@ public:
ChatWindowStyle *chatStyle() const;
void setChatStyle(ChatWindowStyle* chatStyle);
- /* bool displayHeader()*/
+ bool isHeaderDisplayed() const;
+ void setHeaderDisplayed(bool);
/* .. font, backgrounds, everything else.*/
public slots:
- void addMessage(TelepathyChatMessageInfo & message);
+ void addMessage(const TelepathyChatMessageInfo &message);
private:
ChatWindowStyle* m_chatStyle;
QString m_variantPath;
-
-
KEmoticons m_emoticons;
QString replaceHeaderKeywords(QString htmlTemplate, const TelepathyChatInfo&);
//QString replaceMessageKeywords(QString htmlTemplate, const TelepathyChatMessageInfo&);
@@ -65,10 +64,10 @@ private:
TelepathyChatInfo m_chatInfo;
QString lastSender;
- bool m_showHeader;
+ bool m_displayHeader;
- void appendNewMessage(QString);
- void appendNextMessage(QString);
+ void appendNewMessage(QString&);
+ void appendNextMessage(QString&);
bool m_webInspector;
};
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list