Sorry but I have to run and I ran into compatibility problems with the
repo (have no clue why). This is the patch with the corrections made.
diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 288d5f3..496b70b 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -444,11 +444,13 @@ void ChatWindow::showSettingsDialog()
KSettings::Dialog *dialog = new KSettings::Dialog(this);
- dialog->addModule(QLatin1String("kcm_telepathy_chat_appearance_config"));
- dialog->addModule(QLatin1String("kcm_telepathy_chat_behavior_config"));
+ dialog->addModule(QLatin1String("kcm_ktp_chat_appearance_config"));
+ dialog->addModule(QLatin1String("kcm_ktp_chat_behavior_config"));
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
+
+ connect(dialog, SIGNAL(finished()), this, SLOT(updateShowImTyping()));
}
void ChatWindow::showNotificationsDialog()
@@ -682,5 +684,25 @@ void ChatWindow::setTabSpellDictionary(const QString &dict)
currentChatTab->setSpellDictionary(dict);
}
+void ChatWindow::updateShowImTyping()
+{
+ // get config
+ KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
+ KConfigGroup behaviorConfig = config->group("Behavior");
+
+ bool showTyping = behaviorConfig.readEntry("showImTyping", false);
+
+ // update all active chats
+ for (int i = 0; i < m_tabWidget->count(); i++) {
+ ChatTab* chatTab = qobject_cast<ChatTab*>(m_tabWidget->widget(i));
+
+ // security check
+ if (chatTab) {
+ chatTab->setShowImTyping(showTyping);
+ }
+ }
+}
+
+
#include "chat-window.moc"
diff --git a/app/chat-window.h b/app/chat-window.h
index 4afa8a1..cffce16 100644
--- a/app/chat-window.h
+++ b/app/chat-window.h
@@ -95,6 +95,7 @@ private Q_SLOTS:
void onUserTypingChanged();
void onShareDesktopTriggered(); /** start a desktop share */
void setTabSpellDictionary(const QString &dict); /** set the spelling language for the current chat tab*/
+ void updateShowImTyping();
protected Q_SLOTS:
void showSettingsDialog();
diff --git a/config/behavior-config.cpp b/config/behavior-config.cpp
index 6e78168..6cf9e3e 100644
--- a/config/behavior-config.cpp
+++ b/config/behavior-config.cpp
@@ -29,21 +29,23 @@ K_EXPORT_PLUGIN(KCMTelepathyChatBehaviorConfigFactory("ktp_chat_behavior", "kcm_
BehaviorConfig::BehaviorConfig(QWidget *parent, const QVariantList& args)
- : KCModule(KCMTelepathyChatBehaviorConfigFactory::componentData(), parent, args),
- ui(new Ui::BehaviorConfigUi())
+ : KCModule(KCMTelepathyChatBehaviorConfigFactory::componentData(), parent, args)
+ , ui(new Ui::BehaviorConfigUi())
{
kDebug();
- load();
-
ui->setupUi(this);
ui->newTabButtonGroup->setId(ui->radioLast, TelepathyChatUi::LastWindow);
ui->newTabButtonGroup->setId(ui->radioNew, TelepathyChatUi::NewWindow);
ui->newTabButtonGroup->setId(ui->radioZero, TelepathyChatUi::FirstWindow);
+ load();
+
ui->newTabButtonGroup->button(m_openMode)->setChecked(true);
+
connect(ui->newTabButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(onRadioSelected(int)));
+ connect(ui->showImTypingCheckbox, SIGNAL(clicked()), this, SLOT(onShowImTypingChecked()));
}
BehaviorConfig::~BehaviorConfig()
@@ -51,12 +53,17 @@ BehaviorConfig::~BehaviorConfig()
delete ui;
}
+bool BehaviorConfig::showImTyping() const
+{
+ return m_showImTyping;
+}
+
void BehaviorConfig::load()
{
KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
- KConfigGroup tabConfig = config->group("Behavior");
+ KConfigGroup behaviorConfig = config->group("Behavior");
- QString mode = tabConfig.readEntry("tabOpenMode", "NewWindow");
+ QString mode = behaviorConfig.readEntry("tabOpenMode", "NewWindow");
if(mode == QLatin1String("NewWindow")) {
m_openMode = TelepathyChatUi::NewWindow;
} else if (mode == QLatin1String("FirstWindow")) {
@@ -64,13 +71,18 @@ void BehaviorConfig::load()
} else if (mode == QLatin1String("LastWindow")) {
m_openMode = TelepathyChatUi::LastWindow;
}
+
+ m_showImTyping = behaviorConfig.readEntry("showImTyping", false);
+
+ ui->showImTypingCheckbox->setChecked(m_showImTyping);
}
void BehaviorConfig::save()
{
KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
- KConfigGroup tabConfig = config->group("Behavior");
+ KConfigGroup behaviorConfig = config->group("Behavior");
+ // save new chats config
QString mode;
switch (m_openMode) {
case TelepathyChatUi::NewWindow :
@@ -84,8 +96,16 @@ void BehaviorConfig::save()
break;
}
- tabConfig.writeEntry("tabOpenMode", mode);
- tabConfig.sync();
+ behaviorConfig.writeEntry("tabOpenMode", mode);
+
+ // save user typing setting
+ if (m_showImTyping) {
+ behaviorConfig.writeEntry("showImTyping", true);
+ } else {
+ behaviorConfig.writeEntry("showImTyping", false);
+ }
+
+ behaviorConfig.sync();
}
void BehaviorConfig::changeEvent(QEvent* e)
@@ -107,3 +127,9 @@ void BehaviorConfig::onRadioSelected(int id)
kDebug() << "emitting changed(true)";
Q_EMIT changed(true);
}
+
+void BehaviorConfig::onShowImTypingChecked()
+{
+ m_showImTyping = ui->showImTypingCheckbox->isChecked();
+ Q_EMIT changed(true);
+}
diff --git a/config/behavior-config.h b/config/behavior-config.h
index 55d2fea..e620c57 100644
--- a/config/behavior-config.h
+++ b/config/behavior-config.h
@@ -38,6 +38,8 @@ public:
explicit BehaviorConfig(QWidget *parent = 0, const QVariantList &args = QVariantList());
virtual ~BehaviorConfig();
+ bool showImTyping() const;
+
public Q_SLOTS:
virtual void load();
virtual void save();
@@ -47,9 +49,11 @@ protected:
private Q_SLOTS:
void onRadioSelected(int id);
+ void onShowImTypingChecked();
private:
int m_openMode;
+ bool m_showImTyping;
Ui::BehaviorConfigUi *ui;
};
diff --git a/config/behavior-config.ui b/config/behavior-config.ui
index 7b8e304..bb0d718 100644
--- a/config/behavior-config.ui
+++ b/config/behavior-config.ui
@@ -6,58 +6,110 @@
<rect>
<x>0</x>
<y>0</y>
- <width>357</width>
- <height>296</height>
+ <width>489</width>
+ <height>475</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="KButtonGroup" name="newTabGroup">
- <property name="title">
- <string>Tabs</string>
+ <widget class="QLabel" name="label_3">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>On new incoming message:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QRadioButton" name="radioNew">
+ <property name="text">
+ <string>Open in new window</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="radioZero">
+ <property name="text">
+ <string>Open in first window</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="radioLast">
+ <property name="text">
+ <string>Open in last window</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Show others when i'm typing:</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Open new conversations in :</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioNew">
- <property name="text">
- <string>A new window</string>
- </property>
- <attribute name="buttonGroup">
- <string>newTabButtonGroup</string>
- </attribute>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioZero">
- <property name="text">
- <string>A new tab in the first window</string>
- </property>
- <attribute name="buttonGroup">
- <string>newTabButtonGroup</string>
- </attribute>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioLast">
- <property name="text">
- <string>A new tab in the last focused window</string>
- </property>
- <attribute name="buttonGroup">
- <string>newTabButtonGroup</string>
- </attribute>
- </widget>
- </item>
- </layout>
</widget>
</item>
<item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="showImTypingCheckbox">
+ <property name="text">
+ <string>Enabled</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -72,14 +124,6 @@
</item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>KButtonGroup</class>
- <extends>QGroupBox</extends>
- <header>kbuttongroup.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
<resources/>
<connections/>
<buttongroups>
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index 9313c03..3a44af8 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -58,6 +58,7 @@ public:
/** Stores whether the channel is ready with all contacts upgraded*/
bool chatviewlInitialised;
bool remoteContactIsTyping;
+ bool showImTyping; /** flag to show/hide notification to other contacts when typing */
QAction *showFormatToolbarAction;
bool isGroupChat;
QString title;
@@ -94,6 +95,12 @@ ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, const Tp::AccountPtr
d->showFormatToolbarAction = new QAction(i18n("Show format options"), this);
d->isGroupChat = (channel->targetHandleType() == Tp::HandleTypeContact ? false : true);
+ // load config option for showing to others when typing
+ KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
+ KConfigGroup behaviorConfig = config->group("Behavior");
+
+ d->showImTyping = behaviorConfig.readEntry("showUserTyping", false);
+
d->ui.setupUi(this);
d->ui.formatToolbar->show();
d->ui.formatColor->setText(QString());
@@ -755,7 +762,7 @@ void ChatWidget::onContactPresenceChange(const Tp::ContactPtr & contact, const K
presence.statusMessage());
}
}
-
+
if (!message.isNull()) {
AdiumThemeStatusInfo statusMessage;
statusMessage.setMessage(message);
@@ -818,7 +825,9 @@ void ChatWidget::onInputBoxChanged()
//FIXME buffer what we've sent to telepathy, make this more efficient.
//FIXME check spec (with olly) as to whether we have to handle idle state etc.
- if(currentlyTyping) {
+ qDebug() << "SHOW USER TYPING IS: " << d->showImTyping;
+
+ if(currentlyTyping && d->showImTyping) {
d->channel->requestChatState(Tp::ChannelChatStateComposing);
} else {
d->channel->requestChatState(Tp::ChannelChatStateActive);
@@ -871,5 +880,11 @@ QString ChatWidget::spellDictionary() const
return d->ui.sendMessageBox->spellCheckingLanguage();
}
+void ChatWidget::setShowImTyping(bool showTyping)
+{
+ d->showImTyping = showTyping;
+}
+
+
#include "chat-widget.moc"
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index 30afa31..150e2af 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -86,6 +86,8 @@ public:
void setSpellDictionary(const QString &dict);
+ void setShowImTyping(bool showTyping);
+
public Q_SLOTS:
/** toggle the search bar visibility */
void toggleSearchBar() const;
_______________________________________________
KDE-Telepathy mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-telepathy