[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:24:43 UTC 2016


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

The following commit has been merged in the master branch:
commit 05c985d5df1aafd5e527e7729fe4c4b7fb31668c
Author: Marcin Ziemiński <zieminn at gmail.com>
Date:   Fri Aug 1 15:08:44 2014 +0200

    Removed starting proxy service. Updated OTR settings.
---
 app/chat-window.cpp                                |  10 -
 config/CMakeLists.txt                              |   7 +-
 config/ktp_otr.kcfg                                |  25 ---
 config/ktp_otr.kcfgc                               |   7 -
 config/otr-config.cpp                              |  56 +++++-
 config/otr-config.h                                |  16 ++
 config/otr-config.ui                               | 219 +++++++++++++++------
 lib/CMakeLists.txt                                 |   2 +-
 lib/channel-adapter.h                              |   4 +-
 lib/otr-constants.h                                |  23 ++-
 lib/{proxy-service.h => proxy-service-interface.h} |  36 ++--
 lib/proxy-service.cpp                              |   2 +-
 12 files changed, 267 insertions(+), 140 deletions(-)

diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 91a8cfd..41c38d5 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -893,16 +893,6 @@ void ChatWindow::setupCustomActions()
 
 void ChatWindow::setupOTR()
 {
-    // start otr proxy service
-    QDBusConnection dbusConnection = QDBusConnection::sessionBus();
-    if(!dbusConnection.interface()->isServiceRegistered(KTP_PROXY_BUS_NAME)) {
-        const QDBusReply<void> regRep = dbusConnection.interface()->startService(KTP_PROXY_BUS_NAME);
-        if(!regRep.isValid()) {
-            kDebug() << KTP_PROXY_BUS_NAME << " service unavailable";
-            return;
-        }
-    }
-
     otrActionMenu = new KActionMenu(KIcon(QLatin1String("object-unlocked")), i18n("&OTR"), this);
     otrActionMenu->setDelayed(false);
 
diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt
index 8a0aab0..3c42887 100644
--- a/config/CMakeLists.txt
+++ b/config/CMakeLists.txt
@@ -10,8 +10,6 @@ set(kcm_ktp_chat_appearance_UI appearance-config.ui)
 set(kcm_ktp_chat_behavior_UI behavior-config.ui)
 set(kcm_ktp_chat_otr_UI otr-config.ui)
 
-kde4_add_kcfg_files(kcm_ktp_chat_otr_SRCS ktp_otr.kcfgc)
-
 kde4_add_ui_files(kcm_ktp_chat_appearance_SRCS ${kcm_ktp_chat_appearance_UI})
 kde4_add_ui_files(kcm_ktp_chat_behavior_SRCS ${kcm_ktp_chat_behavior_UI})
 kde4_add_ui_files(kcm_ktp_chat_behavior_SRCS ${kcm_ktp_chat_behavior_UI})
@@ -49,6 +47,7 @@ target_link_libraries(kcm_ktp_chat_otr
     ${KDE4_KDEUI_LIBS}
     ${KDE4_KUTILS_LIBS}
     ${KTP_LIBRARIES}
+    ${TELEPATHY_QT4_LIBRARIES}
     ktpchat
 )
 
@@ -66,7 +65,3 @@ install(FILES
         kcm_ktp_chat_otr.desktop
     DESTINATION ${SERVICES_INSTALL_DIR}
 )
-
-install(FILES 
-        ktp_otr.kcfg 
-    DESTINATION ${KCFG_INSTALL_DIR})
diff --git a/config/ktp_otr.kcfg b/config/ktp_otr.kcfg
deleted file mode 100644
index 64b984b..0000000
--- a/config/ktp_otr.kcfg
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd">
-<kcfg>
-<kcfgfile name="ktp_otr"/> 
-	<group name="Policy">
-		<entry name="rbAlways" type="Bool">
-			<label>Always encrypt outgoing messages</label>
-			<default>false</default>			
-		</entry>
-		<entry name="rbManual" type="Bool">
-			<label>Encrypt messages if the other side requests an OTR connection</label>
-			<default>true</default>
-		</entry>
-		<entry name="rbNever" type="Bool">
-			<label>Never encrypt outgoing messages</label>
-			<default>false</default>
-		</entry>
-	</group> 
-    <group name="Logging">
-        <entry name="cbLogEncrypted" type="Bool">
-			<label>Log messages during encrypted conversation</label>
-			<default>true</default>
-        </entry>
-    </group>
-</kcfg>
diff --git a/config/ktp_otr.kcfgc b/config/ktp_otr.kcfgc
deleted file mode 100644
index d5d71d8..0000000
--- a/config/ktp_otr.kcfgc
+++ /dev/null
@@ -1,7 +0,0 @@
-File=ktp_otr.kcfg
-ClassName=KtpOtrKcfg
-Singleton=true
-Mutators=true
-MemberVariables=private
-ItemAccessors=true
-GlobalEnums=true
diff --git a/config/otr-config.cpp b/config/otr-config.cpp
index c6eb3c4..63a9967 100644
--- a/config/otr-config.cpp
+++ b/config/otr-config.cpp
@@ -25,27 +25,58 @@
 #include <KPluginFactory>
 #include <KLocalizedString>
 #include <QtGui/QtEvents>
+#include <QtDBus/QDBusConnection>
+
+#include <TelepathyQt/AccountSet>
 
 K_PLUGIN_FACTORY(KCMTelepathyChatOtrConfigFactory, registerPlugin<OTRConfig>();)
 K_EXPORT_PLUGIN(KCMTelepathyChatOtrConfigFactory("ktp_chat_otr", "kcm_ktp_chat_otr"))
 
 OTRConfig::OTRConfig(QWidget *parent, const QVariantList& args)
     : KCModule(KCMTelepathyChatOtrConfigFactory::componentData(), parent, args),
-      ui(new Ui::OTRConfigUi())
+      ui(new Ui::OTRConfigUi()),
+      am(Tp::AccountManager::create(QDBusConnection::sessionBus()))
 {
     kDebug();
 
     ui->setupUi(this);
 
-	addConfig(KtpOtrKcfg::self(), this);
-	KtpOtrKcfg::self()->readConfig();
+    ui->policyGroupButtons->setId(ui->rbAlways, Tp::OTRPolicyAlways);
+    ui->policyGroupButtons->setId(ui->rbOpportunistic, Tp::OTRPolicyOpportunistic);
+    ui->policyGroupButtons->setId(ui->rbManual, Tp::OTRPolicyManual);
+    ui->policyGroupButtons->setId(ui->rbNever, Tp::OTRPolicyNever);
+    connect(ui->policyGroupButtons, SIGNAL(buttonClicked(int)), SLOT(onRadioSelected(int)));
+
+    connect(ui->btGenFingerprint, SIGNAL(clicked()), SLOT(onGenerateClicked()));
+
+    connect(ui->cbAccounts, SIGNAL(activated(int)), SLOT(onAccountChosen(int)));
 }
 
-OTRConfig::~OTRConfig() 
+OTRConfig::~OTRConfig()
 {
     delete ui;
 }
 
+void OTRConfig::load()
+{
+    kDebug();
+    accounts = am->validAccounts()->accounts();
+    QStringList items;
+    Q_FOREACH(const Tp::AccountPtr ac, accounts) {
+        items << ac->normalizedName();
+    }
+    ui->cbAccounts->addItems(items);
+
+    if(!items.isEmpty()) {
+        ui->cbAccounts->setEnabled(true);
+        ui->btGenFingerprint->setEnabled(true);
+    }
+}
+
+void OTRConfig::save()
+{
+    kDebug();
+}
 
 void OTRConfig::changeEvent(QEvent* e)
 {
@@ -59,3 +90,20 @@ void OTRConfig::changeEvent(QEvent* e)
     }
 }
 
+void OTRConfig::onRadioSelected(int id)
+{
+    kDebug();
+    policy = static_cast<Tp::OTRPolicy>(id);
+    Q_EMIT changed(true);
+}
+
+void OTRConfig::onGenerateClicked()
+{
+    kDebug();
+}
+
+void OTRConfig::onAccountChosen(int id)
+{
+    kDebug();
+}
+
diff --git a/config/otr-config.h b/config/otr-config.h
index 9ecb0ff..b2c92b4 100644
--- a/config/otr-config.h
+++ b/config/otr-config.h
@@ -21,7 +21,12 @@
 #ifndef OTR_CONFIG_H
 #define OTR_CONFIG_H
 
+#include "otr-constants.h"
+
 #include <KCModule>
+#include <QList>
+
+#include <TelepathyQt/AccountManager>
 
 namespace Ui {
 class OTRConfigUi;
@@ -38,10 +43,21 @@ public:
 protected:
     virtual void changeEvent(QEvent *e);
 
+public Q_SLOTS:
+    virtual void load();
+    virtual void save();
+
 private Q_SLOTS:
+    void onRadioSelected(int id);
+    void onGenerateClicked();
+    void onAccountChosen(int id);
 
 private:
     Ui::OTRConfigUi *ui;
+    Tp::AccountManagerPtr am;
+    QList<Tp::AccountPtr> accounts;
+    QMap<int, QString> fpCache;
+    Tp::OTRPolicy policy;
 };
 
 #endif // OTR_CONFIG_H
diff --git a/config/otr-config.ui b/config/otr-config.ui
index a696cde..0c1634f 100644
--- a/config/otr-config.ui
+++ b/config/otr-config.ui
@@ -16,45 +16,99 @@
   <layout class="QGridLayout">
    <item row="0" column="0">
     <layout class="QGridLayout" name="mainLayout">
-     <item row="1" column="0">
+     <item row="3" column="0">
       <widget class="QGroupBox" name="gbPolicy">
        <property name="title">
         <string>Default OTR Policy</string>
        </property>
        <layout class="QGridLayout">
         <item row="0" column="0">
-         <widget class="QRadioButton" name="kcfg_rbAlways">
+         <widget class="QRadioButton" name="rbAlways">
           <property name="toolTip">
            <string>Always encrypt messages</string>
           </property>
           <property name="text">
-           <string>Al&ways</string>
+           <string>Always</string>
           </property>
           <property name="checked">
            <bool>false</bool>
           </property>
+          <attribute name="buttonGroup">
+           <string notr="true">policyGroupButtons</string>
+          </attribute>
+         </widget>
+        </item>
+        <item row="1" column="0">
+         <widget class="QRadioButton" name="rbOpportunistic">
+          <property name="toolTip">
+           <string>Automatically encrypt messages if the other side supports OTR</string>
+          </property>
+          <property name="text">
+           <string>Opportunistic</string>
+          </property>
+          <attribute name="buttonGroup">
+           <string notr="true">policyGroupButtons</string>
+          </attribute>
          </widget>
         </item>
         <item row="0" column="1">
-         <widget class="QRadioButton" name="kcfg_rbManual">
+         <widget class="QRadioButton" name="rbManual">
           <property name="toolTip">
            <string>Encrypt messages if the other side requests an OTR connection</string>
           </property>
           <property name="text">
-           <string>&Manual</string>
+           <string>Manual</string>
           </property>
           <property name="checked">
            <bool>false</bool>
           </property>
+          <attribute name="buttonGroup">
+           <string notr="true">policyGroupButtons</string>
+          </attribute>
          </widget>
         </item>
-        <item row="0" column="2">
-         <widget class="QRadioButton" name="kcfg_rbNever">
+        <item row="1" column="1">
+         <widget class="QRadioButton" name="rbNever">
           <property name="toolTip">
            <string>Never encrypt messages</string>
           </property>
           <property name="text">
-           <string>Ne&ver</string>
+           <string>Never</string>
+          </property>
+          <attribute name="buttonGroup">
+           <string notr="true">policyGroupButtons</string>
+          </attribute>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item row="5" column="0">
+      <spacer>
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>161</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item row="4" column="0">
+      <widget class="QGroupBox" name="gbLogging">
+       <property name="title">
+        <string>Logging</string>
+       </property>
+       <layout class="QGridLayout" name="gridLayout3">
+        <item row="0" column="0">
+         <widget class="QCheckBox" name="kcfg_cbLogEncrypted">
+          <property name="toolTip">
+           <string>Log messages during encrypted conversation</string>
+          </property>
+          <property name="text">
+           <string>Log encrypted conversations</string>
           </property>
          </widget>
         </item>
@@ -64,7 +118,7 @@
      <item row="0" column="0">
       <widget class="QGroupBox" name="gbFingerprints">
        <property name="enabled">
-        <bool>false</bool>
+        <bool>true</bool>
        </property>
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -76,18 +130,33 @@
         <string>Private Keys</string>
        </property>
        <layout class="QGridLayout">
-        <item row="0" column="0">
-         <widget class="QLabel" name="textLabel2">
-          <property name="text">
-           <string>Account:</string>
+        <item row="0" column="6">
+         <spacer name="horizontalSpacer">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
           </property>
-          <property name="wordWrap">
-           <bool>false</bool>
+          <property name="sizeType">
+           <enum>QSizePolicy::Minimum</enum>
           </property>
-         </widget>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
         </item>
-        <item row="0" column="1">
-         <widget class="QComboBox" name="cbKeys">
+        <item row="0" column="3" colspan="3">
+         <widget class="QComboBox" name="cbAccounts">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
           <property name="maximumSize">
            <size>
             <width>400</width>
@@ -96,22 +165,66 @@
           </property>
          </widget>
         </item>
-        <item row="0" column="2">
-         <widget class="QPushButton" name="btGenFingerprint">
+        <item row="0" column="1">
+         <widget class="QLabel" name="textLabel2">
           <property name="text">
-           <string>&Generate</string>
+           <string>Account:</string>
+          </property>
+          <property name="wordWrap">
+           <bool>false</bool>
           </property>
          </widget>
         </item>
-        <item row="1" column="0">
+        <item row="1" column="1">
          <widget class="QLabel" name="label">
           <property name="text">
            <string>Fingerprint:</string>
           </property>
          </widget>
         </item>
-        <item row="1" column="1">
+        <item row="1" column="6">
+         <spacer name="horizontalSpacer_2">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeType">
+           <enum>QSizePolicy::Minimum</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="0" column="0">
+         <spacer name="horizontalSpacer_3">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeType">
+           <enum>QSizePolicy::Minimum</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="1" column="3" colspan="2">
          <widget class="QLabel" name="tlFingerprint">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
           <property name="frameShape">
            <enum>QFrame::NoFrame</enum>
           </property>
@@ -129,14 +242,33 @@
           </property>
          </widget>
         </item>
-        <item row="1" column="2">
-         <spacer>
+        <item row="2" column="3" colspan="3">
+         <widget class="QPushButton" name="btGenFingerprint">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="text">
+           <string>&Generate</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="6">
+         <spacer name="horizontalSpacer_4">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
+          <property name="sizeType">
+           <enum>QSizePolicy::Minimum</enum>
+          </property>
           <property name="sizeHint" stdset="0">
            <size>
-            <width>71</width>
+            <width>40</width>
             <height>20</height>
            </size>
           </property>
@@ -145,42 +277,13 @@
        </layout>
       </widget>
      </item>
-     <item row="3" column="0">
-      <spacer>
-       <property name="orientation">
-        <enum>Qt::Vertical</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>20</width>
-         <height>161</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item row="2" column="0">
-      <widget class="QGroupBox" name="gbLogging">
-       <property name="title">
-        <string>Logging</string>
-       </property>
-       <layout class="QGridLayout" name="gridLayout3">
-        <item row="0" column="0">
-         <widget class="QCheckBox" name="kcfg_cbLogEncrypted">
-          <property name="toolTip">
-           <string>Log messages during encrypted conversation</string>
-          </property>
-          <property name="text">
-           <string>Log encrypted conversations</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </widget>
-     </item>
     </layout>
    </item>
   </layout>
  </widget>
  <resources/>
  <connections/>
+ <buttongroups>
+  <buttongroup name="policyGroupButtons"/>
+ </buttongroups>
 </ui>
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index f9964f1..124dbf0 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -20,7 +20,7 @@ set(ktpchat_SRCS
         otr-types.cpp
         channel-adapter.cpp
         otr-channel-proxy.cpp
-        proxy-service.cpp
+        proxy-service-interface.cpp
         otr-utils.cpp
         )
 
diff --git a/lib/channel-adapter.h b/lib/channel-adapter.h
index 8b8d53a..89d2fda 100644
--- a/lib/channel-adapter.h
+++ b/lib/channel-adapter.h
@@ -15,8 +15,8 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef OTR_MANAGER_HEADER
-#define OTR_MANAGER_HEADER
+#ifndef CHANNEL_ADAPTER_HEADER
+#define CHANNEL_ADAPTER_HEADER
 
 #include "otr-types.h"
 #include "otr-utils.h"
diff --git a/lib/otr-constants.h b/lib/otr-constants.h
index 05c3c1a..26d86ab 100644
--- a/lib/otr-constants.h
+++ b/lib/otr-constants.h
@@ -27,15 +27,15 @@
 
 namespace Tp
 {
-    
+
 /**
  * \enum OTRTrustLevel
  * \ingroup enumtypeconsts
  *
  * Enumerated type generated from the specification.
- * 
- * Enumeration describing trust level of this conversation. The trust level 
- * can only increase unless Initialize/Stop are called or TrustFingerprint is 
+ *
+ * Enumeration describing trust level of this conversation. The trust level
+ * can only increase unless Initialize/Stop are called or TrustFingerprint is
  * called with trust=false.
  */
 enum OTRTrustLevel
@@ -46,7 +46,7 @@ enum OTRTrustLevel
     OTRTrustLevelNotPrivate = 0,
 
     /**
-     * The conversation is currently encrypted but the remote end is not 
+     * The conversation is currently encrypted but the remote end is not
      * verified
      */
     OTRTrustLevelUnverified = 1,
@@ -57,8 +57,8 @@ enum OTRTrustLevel
     OTRTrustLevelPrivate = 2,
 
     /**
-     * Remote end closed the OTR session, messages cannot be sent anymore. 
-     * Either call Stop to continue unencrypted or Initialize to send 
+     * Remote end closed the OTR session, messages cannot be sent anymore.
+     * Either call Stop to continue unencrypted or Initialize to send
      * encrypted messages again.
      */
     OTRTrustLevelFinished = 3,
@@ -73,11 +73,18 @@ enum OTRTrustLevel
  */
 const int NUM_OTR_TRUST_LEVELS = (3+1);
 
+enum OTRPolicy {
+    OTRPolicyAlways = 0,
+    OTRPolicyOpportunistic = 1,
+    OTRPolicyManual = 2,
+    OTRPolicyNever = 3
+};
+
 
 /**
  * OTR message event enum type - the same as OtrlMessageEvent in libotr
  */
-enum OTRMessageEvent 
+enum OTRMessageEvent
 {
     OTRL_MSGEVENT_NONE,
     OTRL_MSGEVENT_ENCRYPTION_REQUIRED,
diff --git a/lib/proxy-service.h b/lib/proxy-service-interface.h
similarity index 97%
rename from lib/proxy-service.h
rename to lib/proxy-service-interface.h
index b447ce0..b218fb8 100644
--- a/lib/proxy-service.h
+++ b/lib/proxy-service-interface.h
@@ -5,8 +5,8 @@
  * which it was generated.
  */
 
-#ifndef OTR_PROXY_SERVICE_HEADER
-#define OTR_PROXY_SERVICE_HEADER
+#ifndef PROXY_SERVICE_INTERFACE_HEADER
+#define PROXY_SERVICE_INTERFACE_HEADER
 
 #include <TelepathyQt/Types>
 
@@ -114,7 +114,7 @@ public:
     /**
      * Asynchronous getter for the remote object property 
-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list