Am Mittwoch, 28. Dezember 2011, 18:59:07 schrieb Francesco Nwokeka: > 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.
I modified it to leave KButtonGroup. It crashed everytime because you removed it from the view, but not adapted the code. Not sure if it can be included in this state. It's Martin's desicion.
diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 288d5f3..be02aa9 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"));
+ dialog->addModule(QLatin1String("kcm_ktp_chat_behavior"));
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..b01a65e 100644
--- a/config/behavior-config.ui
+++ b/config/behavior-config.ui
@@ -12,6 +12,30 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Show others when i'm typing:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QCheckBox" name="showImTypingCheckbox">
+ <property name="text">
+ <string>Enabled</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
<widget class="KButtonGroup" name="newTabGroup">
<property name="title">
<string>Tabs</string>
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index 9313c03..7b06b1f 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) {
+ kDebug() << "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;
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ KDE-Telepathy mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-telepathy
