[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [ktp-common-internals/mklapetek/SpaceBar] KTp/Declarative: [declarative] Ensure all channels are clo
From:       Martin Klapetek <mklapetek () kde ! org>
Date:       2016-03-09 23:36:12
Message-ID: E1adneG-0001cJ-Bt () scm ! kde ! org
[Download RAW message or body]

Git commit 5a6b3f733d6f2f606c9f082ee05dda5b5ec8ffdc by Martin Klapetek.
Committed on 09/03/2016 at 23:35.
Pushed by mklapetek into branch 'mklapetek/SpaceBar'.

[declarative] Ensure all channels are closed when quitting the app

M  +8    -0    KTp/Declarative/mainlogmodel.cpp

http://commits.kde.org/telepathy-common-internals/5a6b3f733d6f2f606c9f082ee05dda5b5ec8ffdc


diff --git a/KTp/Declarative/mainlogmodel.cpp b/KTp/Declarative/mainlogmodel.cpp
index d8fdac0..9fd4628 100644
--- a/KTp/Declarative/mainlogmodel.cpp
+++ b/KTp/Declarative/mainlogmodel.cpp
@@ -50,6 +50,14 @@ MainLogModel::MainLogModel(QObject *parent)
 {
     const QString dbLocation = \
QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + \
QStringLiteral("/ktp-mobile-logger/");  
+    connect(qApp, &QCoreApplication::aboutToQuit, this, [=]() {
+        Q_FOREACH (Conversation *c, m_conversations.values()) {
+            if (!c->textChannel().isNull()) {
+                c->textChannel()->requestClose();
+            }
+        }
+    });
+
     m_db = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"), \
QStringLiteral("logger-db"));  m_db.setDatabaseName(dbLocation + \
QStringLiteral("history.db3"));  qDebug() << dbLocation << m_db.open();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic