[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:24 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=f76f63d
The following commit has been merged in the master branch:
commit f76f63d22bcbbc8b7f7dd3924dd1e005653e1480
Author: Leon Handreke <leonh at ndreke.de>
Date: Wed Dec 18 17:07:19 2013 +0100
Make nick completion style configurable
---
config/behavior-config.cpp | 23 +++++++++++++++++++++++
config/behavior-config.h | 4 ++++
config/behavior-config.ui | 43 +++++++++++++++++++++++++++++++++++++++++--
lib/chat-text-edit.cpp | 4 +++-
lib/text-chat-config.cpp | 15 +++++++++++++++
lib/text-chat-config.h | 3 +++
6 files changed, 89 insertions(+), 3 deletions(-)
diff --git a/config/behavior-config.cpp b/config/behavior-config.cpp
index 9f863dc..eeb3597 100644
--- a/config/behavior-config.cpp
+++ b/config/behavior-config.cpp
@@ -55,8 +55,22 @@ BehaviorConfig::BehaviorConfig(QWidget *parent, const QVariantList& args)
ui->checkBoxShowOthersTyping->setChecked(m_showOthersTyping);
connect(ui->checkBoxShowOthersTyping, SIGNAL(toggled(bool)), this, SLOT(onShowOthersTypingChanged(bool)));
+
+ QStringList nicknameCompletionStyles;
+ const QString namePlaceholder = ki18nc("Placeholder for contact name in completion suffix selector", "Nickname").toString();
+ Q_FOREACH(const QString &suffix, BehaviorConfig::nicknameCompletionSuffixes) {
+ nicknameCompletionStyles.append(namePlaceholder + suffix);
+ }
+ ui->nicknameCompletionStyle->addItems(nicknameCompletionStyles);
+ ui->nicknameCompletionStyle->setCurrentIndex(BehaviorConfig::nicknameCompletionSuffixes.indexOf(m_nicknameCompletionSuffix));
+ connect(ui->nicknameCompletionStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(onNicknameCompletionStyleChanged(int)));
}
+const QStringList BehaviorConfig::nicknameCompletionSuffixes = QStringList()
+ << QLatin1String(", ")
+ << QLatin1String(": ")
+ << QLatin1String(" ");
+
BehaviorConfig::~BehaviorConfig()
{
delete ui;
@@ -68,6 +82,7 @@ void BehaviorConfig::load()
m_scrollbackLength = TextChatConfig::instance()->scrollbackLength();
m_showMeTyping = TextChatConfig::instance()->showMeTyping();
m_showOthersTyping = TextChatConfig::instance()->showOthersTyping();
+ m_nicknameCompletionSuffix = TextChatConfig::instance()->nicknameCompletionSuffix();
}
void BehaviorConfig::save()
@@ -76,6 +91,7 @@ void BehaviorConfig::save()
TextChatConfig::instance()->setScrollbackLength(m_scrollbackLength);
TextChatConfig::instance()->setShowMeTyping(m_showMeTyping);
TextChatConfig::instance()->setShowOthersTyping(m_showOthersTyping);
+ TextChatConfig::instance()->setNicknameCompletionSuffix(m_nicknameCompletionSuffix);
TextChatConfig::instance()->sync();
}
@@ -116,3 +132,10 @@ void BehaviorConfig::onShowOthersTypingChanged(bool state)
m_showOthersTyping = state;
Q_EMIT changed(true);
}
+
+
+void BehaviorConfig::onNicknameCompletionStyleChanged(int index)
+{
+ m_nicknameCompletionSuffix = BehaviorConfig::nicknameCompletionSuffixes[index];
+ Q_EMIT changed(true);
+}
diff --git a/config/behavior-config.h b/config/behavior-config.h
index fcbdd7f..d57fd90 100644
--- a/config/behavior-config.h
+++ b/config/behavior-config.h
@@ -50,13 +50,17 @@ private Q_SLOTS:
void onScrollbackLengthChanged();
void onShowMeTypingChanged(bool state);
void onShowOthersTypingChanged(bool state);
+ void onNicknameCompletionStyleChanged(int index);
private:
TextChatConfig::TabOpenMode m_openMode;
int m_scrollbackLength;
bool m_showMeTyping; // show others I am typing
bool m_showOthersTyping; // show me others are typing
+ QString m_nicknameCompletionSuffix;
Ui::BehaviorConfigUi *ui;
+
+ static const QStringList nicknameCompletionSuffixes;
};
#endif // BEHAVIOR_CONFIG_H
diff --git a/config/behavior-config.ui b/config/behavior-config.ui
index 200f6ee..c8e731c 100644
--- a/config/behavior-config.ui
+++ b/config/behavior-config.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>357</width>
- <height>296</height>
+ <width>385</width>
+ <height>350</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@@ -103,6 +103,45 @@
</widget>
</item>
<item>
+ <widget class="KButtonGroup" name="nicknameCompletionGroup">
+ <property name="title">
+ <string>Nickname Completion</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="1">
+ <widget class="QComboBox" name="nicknameCompletionStyle"/>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Complete nicknames to</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>when I press Tab</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
diff --git a/lib/chat-text-edit.cpp b/lib/chat-text-edit.cpp
index 4e0f030..517e3e1 100644
--- a/lib/chat-text-edit.cpp
+++ b/lib/chat-text-edit.cpp
@@ -19,6 +19,7 @@
#include "chat-text-edit.h"
#include "channel-contact-model.h"
+#include "text-chat-config.h"
#include <QtGui/QMenu>
#include <QtGui/QContextMenuEvent>
@@ -357,7 +358,8 @@ void ChatTextEdit::completeNick()
} else if ((pos == 0) && complete) {
// no, it was at the beginning
m_lastCompletion = foundNick;
- newLine.insert(pos, foundNick + QLatin1String(", "));
+ const QString &nicknameCompletionSuffix = TextChatConfig::instance()->nicknameCompletionSuffix();
+ newLine.insert(pos, foundNick + nicknameCompletionSuffix);
pos = pos + foundNick.length() + 2; /* 2 = strlen(", ") */
} else {
// the nick wasn't complete
diff --git a/lib/text-chat-config.cpp b/lib/text-chat-config.cpp
index 7425d5e..57c7c0c 100644
--- a/lib/text-chat-config.cpp
+++ b/lib/text-chat-config.cpp
@@ -36,6 +36,7 @@ public:
int m_scrollbackLength;
bool m_showMeTyping;
bool m_showOthersTyping;
+ QString m_nicknameCompletionSuffix;
};
@@ -80,6 +81,8 @@ void TextChatConfig::sync()
behaviorConfig.writeEntry("showOthersTyping", d->m_showOthersTyping);
+ behaviorConfig.writeEntry("nicknameCompletionSuffix", d->m_nicknameCompletionSuffix);
+
behaviorConfig.sync();
mutex.unlock();
@@ -166,6 +169,16 @@ void TextChatConfig::setShowOthersTyping(bool showTyping)
}
+QString TextChatConfig::nicknameCompletionSuffix() const {
+ return d->m_nicknameCompletionSuffix;
+}
+
+void TextChatConfig::setNicknameCompletionSuffix(const QString &suffix) {
+ mutex.lock();
+ d->m_nicknameCompletionSuffix = suffix;
+ mutex.unlock();
+}
+
TextChatConfig::TextChatConfig() :
d(new TextChatConfigPrivate())
{
@@ -187,6 +200,8 @@ TextChatConfig::TextChatConfig() :
d->m_showMeTyping = behaviorConfig.readEntry("showMeTyping", true);
d->m_showOthersTyping = behaviorConfig.readEntry("showOthersTyping", true);
+
+ d->m_nicknameCompletionSuffix = behaviorConfig.readEntry("nicknameCompletionSuffix", ", ");
}
diff --git a/lib/text-chat-config.h b/lib/text-chat-config.h
index 603c006..e0ba24f 100644
--- a/lib/text-chat-config.h
+++ b/lib/text-chat-config.h
@@ -55,6 +55,9 @@ class KDE_TELEPATHY_CHAT_EXPORT TextChatConfig : QObject
bool showOthersTyping();
void setShowOthersTyping(bool showTyping);
+ QString nicknameCompletionSuffix() const;
+ void setNicknameCompletionSuffix(const QString &suffix);
+
private:
TextChatConfig();
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list