[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:22:46 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=0e7a48a

The following commit has been merged in the master branch:
commit 0e7a48a466f93e3e1732b10e136fc044eecec201
Author: Nick Lou <nicklkde at ymail.com>
Date:   Fri Sep 28 00:20:56 2012 +0100

    Save and restore spell check language used.
    
    Save and restore the spell check language for a particular contact if different to the system default
    
    BUG: 291764
    REVIEW: 106575
    
    DIGEST
---
 lib/chat-widget.cpp | 35 +++++++++++++++++++++++++++++++++--
 lib/chat-widget.h   |  6 ++++++
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index b407095..cb5dc79 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -183,8 +183,7 @@ ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, const Tp::AccountPtr
     bool formatToolbarIsVisible = false;
     d->ui.formatToolbar->setVisible(formatToolbarIsVisible);
     d->showFormatToolbarAction->setChecked(formatToolbarIsVisible);
-
-    d->ui.sendMessageBox->setSpellCheckingLanguage(KGlobal::locale()->language());
+    loadSpellCheckingOption();
 
     d->pausedStateTimer = new QTimer(this);
     d->pausedStateTimer->setSingleShot(true);
@@ -220,6 +219,7 @@ ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, const Tp::AccountPtr
 
 ChatWidget::~ChatWidget()
 {
+    saveSpellCheckingOption();
     d->channel->requestClose(); // ensure closing; does nothing, if already closed
     delete d;
 }
@@ -1028,6 +1028,37 @@ void ChatWidget::setSpellDictionary(const QString &dict)
     d->ui.sendMessageBox->setSpellCheckingLanguage(dict);
 }
 
+void ChatWidget::saveSpellCheckingOption()
+{
+    QString spellCheckingLanguage = spellDictionary();
+    KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktp-text-uirc"));
+    KConfigGroup configGroup = config->group(d->channel->targetId());
+    if (spellCheckingLanguage != KGlobal::locale()->language()) {
+        configGroup.writeEntry("language", spellCheckingLanguage);
+    } else {
+        if (configGroup.exists()) {
+            configGroup.deleteEntry("language");
+            configGroup.deleteGroup();
+        } else {
+            return;
+        }
+    }
+    configGroup.sync();
+}
+
+void ChatWidget::loadSpellCheckingOption()
+{
+    KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktp-text-uirc"));
+    KConfigGroup configGroup = config->group(d->channel->targetId());
+    QString spellCheckingLanguage;
+    if (configGroup.exists()) {
+        spellCheckingLanguage = configGroup.readEntry("language");
+    } else {
+	spellCheckingLanguage = KGlobal::locale()->language();
+    }
+    d->ui.sendMessageBox->setSpellCheckingLanguage(spellCheckingLanguage);
+}
+
 QString ChatWidget::spellDictionary() const
 {
     return d->ui.sendMessageBox->spellCheckingLanguage();
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index fd1d660..2370e31 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -181,6 +181,12 @@ private:
     /** connects necessary signals for the contactModel */
     void setupContactModelSignals();
 
+    /** Saves pair <target Id,language option selected> in a file */
+    void saveSpellCheckingOption();
+
+    /** Loads language option for specified target Id */
+    void loadSpellCheckingOption();
+
     virtual bool isOnTop() const;
     bool m_previousConversationAvailable;
 

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list