[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:20:30 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=36f8068
The following commit has been merged in the master branch:
commit 36f8068ca749749ae55ae9f3ac4d4fbb94bc490e
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date: Wed Nov 30 20:39:41 2011 +0100
Add spell dictionary combobox
Reviewed-by: David Edmundson
REVIEW: 103296
FEATURE: 283787
---
app/chat-window.cpp | 28 +++++++++++++++++++++++++++-
app/chat-window.h | 9 ++++++++-
app/chatwindow.rc | 2 ++
lib/chat-widget.cpp | 14 +++++++++++++-
lib/chat-widget.h | 5 ++++-
5 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index d423965..e213912 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -22,6 +22,7 @@
#include "chat-search-bar.h"
#include "chat-tab.h"
+#include "chat-widget.h"
#include <KStandardAction>
#include <KIcon>
@@ -42,12 +43,15 @@
#include <KMenu>
#include <QEvent>
+#include <QWidgetAction>
#include <TelepathyQt4/Account>
#include <TelepathyQt4/ContactCapabilities>
#include <TelepathyQt4/PendingChannelRequest>
#include <TelepathyQt4/TextChannel>
+#include <Sonnet/DictionaryComboBox>
+
#define PREFERRED_TEXTCHAT_HANDLER "org.freedesktop.Telepathy.Client.KDE.TextUi"
#define PREFERRED_FILETRANSFER_HANDLER "org.freedesktop.Telepathy.Client.KDE.FileTransfer"
#define PREFERRED_AUDIO_VIDEO_HANDLER "org.freedesktop.Telepathy.Client.KDE.CallUi"
@@ -64,7 +68,7 @@ ChatWindow::ChatWindow()
// keyboard shortcuts for the search bar
KStandardAction::find(this, SLOT(onSearchActionToggled()), actionCollection());
-
+
// start disabled
KStandardAction::findNext(this, SLOT(onFindNextText()), actionCollection())->setEnabled(false);
KStandardAction::findPrev(this, SLOT(onFindPreviousText()), actionCollection())->setEnabled(false);
@@ -259,6 +263,9 @@ void ChatWindow::onCurrentIndexChanged(int index)
//call this to update the "Typing.." in window title
onUserTypingChanged();
+ kDebug() << "Current spell dictionary is" << currentChatTab->spellDictionary();
+ m_spellDictCombo->setCurrentByDictionary(currentChatTab->spellDictionary());
+
// when the tab changes I need to "refresh" the window's findNext and findPrev actions
if (currentChatTab->chatSearchBar()->searchBar()->text().isEmpty()) {
onEnableSearchActions(false);
@@ -514,6 +521,16 @@ void ChatWindow::setupCustomActions()
KAction *shareDesktopAction = new KAction(KIcon(QLatin1String("krfb")), i18n("Share My &Desktop"), this);
connect(shareDesktopAction, SIGNAL(triggered()), this, SLOT(onShareDesktopTriggered()));
+ m_spellDictCombo = new Sonnet::DictionaryComboBox();
+ connect(m_spellDictCombo, SIGNAL(dictionaryChanged(QString)),
+ this, SLOT(setTabSpellDictionary(QString)));
+
+ QWidgetAction *spellDictComboAction = new QWidgetAction(this);
+ spellDictComboAction->setDefaultWidget(m_spellDictCombo);
+ spellDictComboAction->defaultWidget()->setFocusPolicy(Qt::ClickFocus);
+ spellDictComboAction->setIcon(KIcon(QLatin1String("tools-check-spelling")));
+ spellDictComboAction->setIconText(i18n("Choose Spelling Language"));
+
// add custom actions to the collection
actionCollection()->addAction(QLatin1String("separator"), separator);
actionCollection()->addAction(QLatin1String("next-tab"), nextTabAction);
@@ -523,6 +540,7 @@ void ChatWindow::setupCustomActions()
actionCollection()->addAction(QLatin1String("video-call"), videoCallAction);
actionCollection()->addAction(QLatin1String("invite-to-chat"), inviteToChat);
actionCollection()->addAction(QLatin1String("share-desktop"), shareDesktopAction);
+ actionCollection()->addAction(QLatin1String("language"), spellDictComboAction);
}
void ChatWindow::setAudioCallEnabled(bool enable)
@@ -656,4 +674,12 @@ bool ChatWindow::event(QEvent *e)
return KXmlGuiWindow::event(e);
}
+void ChatWindow::setTabSpellDictionary(const QString &dict)
+{
+ int index = m_tabWidget->currentIndex();
+ ChatTab* currentChatTab=qobject_cast<ChatTab*>(m_tabWidget->widget(index));
+ currentChatTab->setSpellDictionary(dict);
+}
+
+
#include "chat-window.moc"
diff --git a/app/chat-window.h b/app/chat-window.h
index 6cbc425..4afa8a1 100644
--- a/app/chat-window.h
+++ b/app/chat-window.h
@@ -26,6 +26,10 @@
#include <KXmlGuiWindow>
#include <KTabWidget>
+namespace Sonnet {
+ class DictionaryComboBox;
+}
+
class KIcon;
class ChatTab;
@@ -89,7 +93,8 @@ private Q_SLOTS:
void onTabIconChanged(const KIcon &newIcon);
void onVideoCallTriggered(); /** start a video call */
void onUserTypingChanged();
- void onShareDesktopTriggered(); /** start a desktop share */
+ void onShareDesktopTriggered(); /** start a desktop share */
+ void setTabSpellDictionary(const QString &dict); /** set the spelling language for the current chat tab*/
protected Q_SLOTS:
void showSettingsDialog();
@@ -147,6 +152,8 @@ private:
void startShareDesktop(const Tp::AccountPtr &account, const Tp::ContactPtr &contact);
KTabWidget *m_tabWidget;
+
+ Sonnet::DictionaryComboBox *m_spellDictCombo;
};
#endif // CHATWINDOW_H
diff --git a/app/chatwindow.rc b/app/chatwindow.rc
index c24ddcc..1edb7d1 100644
--- a/app/chatwindow.rc
+++ b/app/chatwindow.rc
@@ -20,6 +20,8 @@
<Separator name="separator_1"/>
<Action name="send-file"/>
<Action name="share-desktop"/>
+ <Separator name="separator_2"/>
+ <Action name="language"/>
</ToolBar>
</gui>
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index 2971b67..8b336f8 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -161,6 +161,8 @@ ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, const Tp::AccountPtr
d->ui.formatToolbar->setVisible(formatToolbarIsVisible);
d->showFormatToolbarAction->setChecked(formatToolbarIsVisible);
+ d->ui.sendMessageBox->setSpellCheckingLanguage(KGlobal::locale()->language());
+
//connect signals/slots from format toolbar
connect(d->ui.formatColor, SIGNAL(released()), SLOT(onFormatColorReleased()));
connect(d->ui.formatBold, SIGNAL(toggled(bool)), d->ui.sendMessageBox, SLOT(setFontBold(bool)));
@@ -169,7 +171,6 @@ ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, const Tp::AccountPtr
// make the sendMessageBox a focus proxy for the chatview
d->ui.chatArea->setFocusProxy(d->ui.sendMessageBox);
-
connect(d->ui.sendMessageBox, SIGNAL(returnKeyPressed()), SLOT(sendMessage()));
connect(d->ui.sendButton, SIGNAL(clicked()), SLOT(sendMessage()));
@@ -890,4 +891,15 @@ bool ChatWidget::isUserTyping() const
return d->remoteContactIsTyping;
}
+void ChatWidget::setSpellDictionary(const QString &dict)
+{
+ d->ui.sendMessageBox->setSpellCheckingLanguage(dict);
+}
+
+QString ChatWidget::spellDictionary() const
+{
+ return d->ui.sendMessageBox->spellCheckingLanguage();
+}
+
+
#include "chat-widget.moc"
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index 31f13d6..7ea41eb 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -80,6 +80,10 @@ public:
/** Returns true if the user is currently typing or not */
bool isUserTyping() const;
+ QString spellDictionary() const;
+
+ void setSpellDictionary(const QString &dict);
+
public Q_SLOTS:
/** toggle the search bar visibility */
void toggleSearchBar() const;
@@ -89,7 +93,6 @@ public Q_SLOTS:
*/
void resetUnreadMessageCount();
-
protected:
void changeEvent(QEvent *e);
void resizeEvent(QResizeEvent *);
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list