[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:48 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=38d518e
The following commit has been merged in the master branch:
commit 38d518ea9a6b01db65ee314b19e821fcc2699d72
Author: Marcin Ziemiński <zieminn at gmail.com>
Date: Wed Aug 13 18:36:59 2014 +0200
Add fingerprint management to the settings
---
config/otr-config.cpp | 128 ++++++++++++++-
config/otr-config.h | 10 ++
config/otr-config.ui | 352 ++++++++++++++++++++++++++++++------------
lib/chat-widget.cpp | 5 +
lib/otr-types.cpp | 64 ++++----
lib/otr-types.h | 42 ++---
lib/proxy-service-interface.h | 78 ++++++++++
lib/proxy-service.cpp | 41 ++++-
lib/proxy-service.h | 6 +-
9 files changed, 570 insertions(+), 156 deletions(-)
diff --git a/config/otr-config.cpp b/config/otr-config.cpp
index aa3080b..43b0ea8 100644
--- a/config/otr-config.cpp
+++ b/config/otr-config.cpp
@@ -20,12 +20,17 @@
#include "otr-config.h"
#include "ui_otr-config.h"
#include "ktp_otr.h"
+#include "otr-types.h"
+#include <QLatin1String>
#include <KDebug>
#include <KPluginFactory>
#include <KLocalizedString>
-#include <QtGui/QtEvents>
-#include <QtDBus/QDBusConnection>
+#include <QtEvents>
+#include <QDBusConnection>
+#include <QAction>
+#include <QMenu>
+#include <KMessageBox>
#include <TelepathyQt/AccountSet>
#include <TelepathyQt/PendingVariant>
@@ -37,7 +42,8 @@ OTRConfig::OTRConfig(QWidget *parent, const QVariantList& args)
: KCModule(KCMTelepathyChatOtrConfigFactory::componentData(), parent, args),
ui(new Ui::OTRConfigUi()),
am(Tp::AccountManager::create(QDBusConnection::sessionBus())),
- ps(NULL)
+ ps(NULL),
+ fpCtxMenu(new QMenu(this))
{
kDebug();
@@ -47,11 +53,26 @@ OTRConfig::OTRConfig(QWidget *parent, const QVariantList& args)
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()));
+ ui->tbFingerprints->setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(ui->tbFingerprints, SIGNAL(customContextMenuRequested(QPoint)), SLOT(onFpTableMenuRequested(QPoint)));
+ 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)));
+ connect(ui->tbFingerprints, SIGNAL(currentCellChanged(int,int,int,int)), SLOT(onCurrentFpCellChanged(int,int,int,int)));
+
+ QAction *verifyAction = new QAction(i18n("Verify"), this);
+ QAction *forgetAction = new QAction(i18n("Forget"), this);
+ verifyAction->setEnabled(false);
+ forgetAction->setEnabled(false);
+ fpCtxMenu->addAction(verifyAction);
+ fpCtxMenu->addAction(forgetAction);
+
+ connect(verifyAction, SIGNAL(triggered()), SLOT(onVerifyClicked()));
+ connect(forgetAction, SIGNAL(triggered()), SLOT(onForgetClicked()));
+ connect(ui->btForget, SIGNAL(clicked()), forgetAction, SLOT(trigger()));
+ connect(ui->btVerify, SIGNAL(clicked()), verifyAction, SLOT(trigger()));
}
OTRConfig::~OTRConfig()
@@ -90,6 +111,32 @@ void OTRConfig::load()
}
updatePolicy();
+ loadFingerprints();
+}
+
+void OTRConfig::loadFingerprints()
+{
+ if(accounts.isEmpty()) {
+ ui->tbFingerprints->setRowCount(0);
+ return;
+ }
+
+ const Tp::FingerprintInfoList fingerprints = ps->knownFingerprints(currentAccount());
+ kDebug() << fingerprints.size();
+ ui->tbFingerprints->setRowCount(fingerprints.size());
+ int i = 0;
+ Q_FOREACH(const Tp::FingerprintInfo &fp, fingerprints) {
+ ui->tbFingerprints->setItem(i, 0, new QTableWidgetItem(fp.contactName));
+ ui->tbFingerprints->setItem(i, 1, new QTableWidgetItem(fp.fingerprint));
+ ui->tbFingerprints->setItem(i, 2, new QTableWidgetItem(fp.isVerified ? i18n("Yes") : i18n("No")));
+ ui->tbFingerprints->setItem(i, 3, new QTableWidgetItem(fp.inUse ? i18n("Used") : i18n("Unused")));
+
+ i++;
+ }
+
+ ui->tbFingerprints->resizeColumnsToContents();
+ ui->tbFingerprints->resizeRowsToContents();
+ ui->tbFingerprints->horizontalHeader()->setStretchLastSection(true);
}
void OTRConfig::save()
@@ -121,8 +168,7 @@ void OTRConfig::onRadioSelected(int id)
void OTRConfig::onGenerateClicked()
{
kDebug();
- const int index = ui->cbAccounts->currentIndex();
- ps->generatePrivateKey(QDBusObjectPath(accounts.at(index)->objectPath()));
+ ps->generatePrivateKey(currentAccount());
}
void OTRConfig::onAccountChosen(int id)
@@ -134,6 +180,13 @@ void OTRConfig::onAccountChosen(int id)
} else {
ui->tlFingerprint->setText(fp);
}
+ loadFingerprints();
+}
+
+QDBusObjectPath OTRConfig::currentAccount() const
+{
+ const int index = ui->cbAccounts->currentIndex();
+ return QDBusObjectPath(accounts.at(index)->objectPath());
}
void OTRConfig::updatePolicy()
@@ -169,3 +222,64 @@ void OTRConfig::onKeyGenerationFinished()
{
onAccountChosen(ui->cbAccounts->currentIndex());
}
+
+void OTRConfig::onCurrentFpCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn)
+{
+ Q_UNUSED(currentColumn);
+ Q_UNUSED(previousRow);
+ Q_UNUSED(previousColumn);
+
+ if(currentRow != -1) {
+ ui->btVerify->setEnabled(true);
+ fpCtxMenu->actions().at(0)->setEnabled(true);
+ if(ui->tbFingerprints->item(ui->tbFingerprints->currentRow(), 3)->text() == i18n("Unused")) {
+ ui->btForget->setEnabled(true);
+ fpCtxMenu->actions().at(1)->setEnabled(true);
+ } else {
+ ui->btForget->setEnabled(false);
+ fpCtxMenu->actions().at(1)->setEnabled(false);
+ }
+ } else {
+ ui->btForget->setEnabled(false);
+ ui->btVerify->setEnabled(false);
+ fpCtxMenu->actions().at(0)->setEnabled(false);
+ fpCtxMenu->actions().at(1)->setEnabled(false);
+ }
+}
+
+void OTRConfig::onFpTableMenuRequested(QPoint pos)
+{
+ kDebug();
+
+ fpCtxMenu->popup(ui->tbFingerprints->viewport()->mapToGlobal(pos));
+}
+
+void OTRConfig::onVerifyClicked()
+{
+ const QString contact = ui->tbFingerprints->item(ui->tbFingerprints->currentRow(), 0)->text();
+ const QString fingerprint = ui->tbFingerprints->item(ui->tbFingerprints->currentRow(), 1)->text();
+ int trust = KMessageBox::questionYesNo(this,
+ i18n("Please contact %1 via another secure way and verify that the following fingerprint is correct:", contact) +
+ QLatin1String("
") +
+ fingerprint + QLatin1String("
") +
+ i18n("Are you sure you want to trust this fingerprint?"));
+
+ if(trust == KMessageBox::Yes) {
+ ps->trustFingerprint(currentAccount(), contact, fingerprint, true);
+ } else {
+ ps->trustFingerprint(currentAccount(), contact, fingerprint, false);
+ }
+ loadFingerprints();
+}
+
+void OTRConfig::onForgetClicked()
+{
+ kDebug();
+ ps->forgetFingerprint(
+ currentAccount(),
+ ui->tbFingerprints->item(ui->tbFingerprints->currentRow(), 0)->text(),
+ ui->tbFingerprints->item(ui->tbFingerprints->currentRow(), 1)->text());
+
+ loadFingerprints();
+ onCurrentFpCellChanged(ui->tbFingerprints->currentRow(), ui->tbFingerprints->currentColumn(), 0, 0);
+}
diff --git a/config/otr-config.h b/config/otr-config.h
index 2d30139..7424123 100644
--- a/config/otr-config.h
+++ b/config/otr-config.h
@@ -32,6 +32,7 @@
namespace Ui {
class OTRConfigUi;
}
+class QMenu;
class OTRConfig : public KCModule
{
@@ -59,6 +60,14 @@ private Q_SLOTS:
void onPolicyGet(Tp::PendingOperation *getOp);
void onPolicySet(Tp::PendingOperation *setOp);
void onKeyGenerationFinished();
+ void onCurrentFpCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn);
+ void onVerifyClicked();
+ void onForgetClicked();
+ void onFpTableMenuRequested(QPoint pos);
+
+private:
+ QDBusObjectPath currentAccount() const;
+ void loadFingerprints();
private:
Ui::OTRConfigUi *ui;
@@ -66,6 +75,7 @@ private:
QList<Tp::AccountPtr> accounts;
Tp::OTRPolicy policy;
ProxyService *ps;
+ QMenu *fpCtxMenu;
};
#endif // OTR_CONFIG_H
diff --git a/config/otr-config.ui b/config/otr-config.ui
index 0c1634f..68a425e 100644
--- a/config/otr-config.ui
+++ b/config/otr-config.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>548</width>
- <height>495</height>
+ <height>542</height>
</rect>
</property>
<property name="windowTitle">
@@ -19,7 +19,7 @@
<item row="3" column="0">
<widget class="QGroupBox" name="gbPolicy">
<property name="title">
- <string>Default OTR Policy</string>
+ <string>OTR policy</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
@@ -97,26 +97,7 @@
</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>
- </layout>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QGroupBox" name="gbFingerprints">
+ <widget class="QGroupBox" name="gbAccountManagement">
<property name="enabled">
<bool>true</bool>
</property>
@@ -127,7 +108,7 @@
</sizepolicy>
</property>
<property name="title">
- <string>Private Keys</string>
+ <string>Account management</string>
</property>
<layout class="QGridLayout">
<item row="0" column="6">
@@ -146,58 +127,122 @@
</property>
</spacer>
</item>
- <item row="0" column="3" colspan="3">
- <widget class="QComboBox" name="cbAccounts">
- <property name="enabled">
- <bool>false</bool>
- </property>
+ <item row="1" column="0" colspan="7">
+ <widget class="QGroupBox" name="gbPrivKey">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="maximumSize">
- <size>
- <width>400</width>
- <height>32767</height>
- </size>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="textLabel2">
- <property name="text">
- <string>Account:</string>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Fingerprint:</string>
- </property>
+ <property name="title">
+ <string>Private key</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <property name="leftMargin">
+ <number>3</number>
+ </property>
+ <property name="topMargin">
+ <number>3</number>
+ </property>
+ <property name="rightMargin">
+ <number>3</number>
+ </property>
+ <property name="bottomMargin">
+ <number>3</number>
+ </property>
+ <item row="0" column="1">
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Fingerprint:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="4">
+ <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="0" column="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>
+ <property name="text">
+ <string>No Fingerprint</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
</widget>
</item>
- <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">
@@ -214,65 +259,170 @@
</property>
</spacer>
</item>
- <item row="1" column="3" colspan="2">
- <widget class="QLabel" name="tlFingerprint">
- <property name="enabled">
- <bool>false</bool>
- </property>
+ <item row="2" column="0" colspan="7">
+ <widget class="QGroupBox" name="gbFingerprints">
+ <property name="title">
+ <string>Known fingerprints</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="3" column="2">
+ <widget class="QPushButton" name="btForget">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Forget</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QPushButton" name="btVerify">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Verify</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <spacer name="horizontalSpacer_5">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="3">
+ <spacer name="horizontalSpacer_6">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0" colspan="4">
+ <widget class="QTableWidget" name="tbFingerprints">
+ <property name="editTriggers">
+ <set>QAbstractItemView::NoEditTriggers</set>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::SingleSelection</enum>
+ </property>
+ <property name="selectionBehavior">
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ <property name="columnCount">
+ <number>4</number>
+ </property>
+ <attribute name="horizontalHeaderCascadingSectionResizes">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderShowSortIndicator" stdset="0">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ <attribute name="verticalHeaderCascadingSectionResizes">
+ <bool>false</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string>Contact ID</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Fingerprint</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Verified</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Status</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="textLabel2">
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
<property name="text">
- <string>No Fingerprint</string>
+ <string>Account:</string>
</property>
<property name="alignment">
- <set>Qt::AlignVCenter</set>
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
- </property>
</widget>
</item>
- <item row="2" column="3" colspan="3">
- <widget class="QPushButton" name="btGenFingerprint">
+ <item row="0" column="2" colspan="4">
+ <widget class="QComboBox" name="cbAccounts">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
+ <sizepolicy hsizetype="Expanding" 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">
+ <property name="maximumSize">
<size>
- <width>40</width>
- <height>20</height>
+ <width>400</width>
+ <height>32767</height>
</size>
</property>
- </spacer>
+ </widget>
</item>
</layout>
</widget>
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index 6f91762..bd6e67f 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -728,6 +728,11 @@ void ChatWidget::setupOTR()
void ChatWidget::onOTRTrustLevelChanged(Tp::OTRTrustLevel trustLevel, Tp::OTRTrustLevel previous)
{
kDebug();
+
+ if(trustLevel == previous) {
+ return;
+ }
+
d->newOTRstatus = true;
switch(trustLevel) {
case Tp::OTRTrustLevelUnverified:
diff --git a/lib/otr-types.cpp b/lib/otr-types.cpp
index 3d7ac6b..422e1d0 100644
--- a/lib/otr-types.cpp
+++ b/lib/otr-types.cpp
@@ -21,39 +21,47 @@
#include "otr-types.h"
+#include <QDBusArgument>
+#include <QDBusMetaType>
+
namespace Tp
{
-TP_QT_EXPORT bool operator==(const Fingerprint& v1, const Fingerprint& v2)
-{
- return ((v1.humanReadableFingerprint == v2.humanReadableFingerprint)
- && (v1.fingerprintRawData == v2.fingerprintRawData)
- );
-}
+ TP_QT_EXPORT bool operator==(const FingerprintInfo& v1, const FingerprintInfo& v2)
+ {
+ return ((v1.contactName == v2.contactName)
+ && (v1.fingerprint == v2.fingerprint)
+ && (v1.isVerified == v2.isVerified)
+ && (v1.inUse == v2.inUse)
+ );
+ }
-TP_QT_EXPORT QDBusArgument& operator<<(QDBusArgument& arg, const Fingerprint& val)
-{
- arg.beginStructure();
- arg << val.humanReadableFingerprint << val.fingerprintRawData;
- arg.endStructure();
- return arg;
-}
+ TP_QT_EXPORT QDBusArgument& operator<<(QDBusArgument& arg, const FingerprintInfo& val)
+ {
+ arg.beginStructure();
+ arg << val.contactName << val.fingerprint << val.isVerified << val.inUse;
+ arg.endStructure();
+ return arg;
+ }
-TP_QT_EXPORT const QDBusArgument& operator>>(const QDBusArgument& arg, Fingerprint& val)
-{
- arg.beginStructure();
- arg >> val.humanReadableFingerprint >> val.fingerprintRawData;
- arg.endStructure();
- return arg;
-}
+ TP_QT_EXPORT const QDBusArgument& operator>>(const QDBusArgument& arg, FingerprintInfo& val)
+ {
+ arg.beginStructure();
+ arg >> val.contactName >> val.fingerprint >> val.isVerified >> val.inUse;
+ arg.endStructure();
+ return arg;
+ }
-KDE_TELEPATHY_CHAT_EXPORT void registerOtrTypes() {
- static bool registered = false;
- if (registered)
- return;
- registered = true;
+ void registerOtrTypes()
+ {
+ static bool registered = false;
+ if(registered) {
+ return;
+ }
+ registered = true;
- qDBusRegisterMetaType<Tp::Fingerprint>();
-}
+ qDBusRegisterMetaType<Tp::FingerprintInfo>();
+ qDBusRegisterMetaType<Tp::FingerprintInfoList>();
+ }
-} // namespace Tp
+}
diff --git a/lib/otr-types.h b/lib/otr-types.h
index a21ded5..3d183ac 100644
--- a/lib/otr-types.h
+++ b/lib/otr-types.h
@@ -40,38 +40,44 @@ namespace Tp
{
/**
- * \struct Fingerprint
+ * \struct FingerprintInfo
* \ingroup struct
* \headerfile TelepathyQt/types.h <TelepathyQt/Types>
*
* Structure type generated from the specification.
- *
- * An OTR fingerprint.
+ *
+ * A struct (Contact_Name, Fingerprint, Is_Verified) representing remote
+ * contact's fingerprint, as returned by Get_Known_Fingerprints
*/
-struct TP_QT_EXPORT Fingerprint
+struct TP_QT_EXPORT FingerprintInfo
{
- /**
- * Human readable fingerprint
- */
- QString humanReadableFingerprint;
- /**
- * Raw data of fingerprint
- */
- QByteArray fingerprintRawData;
+ QString contactName;
+ QString fingerprint;
+ bool isVerified;
+ bool inUse;
};
-TP_QT_EXPORT bool operator==(const Fingerprint& v1, const Fingerprint& v2);
-inline bool operator!=(const Fingerprint& v1, const Fingerprint& v2)
+TP_QT_EXPORT bool operator==(const FingerprintInfo& v1, const FingerprintInfo& v2);
+inline bool operator!=(const FingerprintInfo& v1, const FingerprintInfo& v2)
{
return !operator==(v1, v2);
}
-TP_QT_EXPORT QDBusArgument& operator<<(QDBusArgument& arg, const Fingerprint& val);
-TP_QT_EXPORT const QDBusArgument& operator>>(const QDBusArgument& arg, Fingerprint& val);
+TP_QT_EXPORT QDBusArgument& operator<<(QDBusArgument& arg, const FingerprintInfo& val);
+TP_QT_EXPORT const QDBusArgument& operator>>(const QDBusArgument& arg, FingerprintInfo& val);
+
+/**
+ * \ingroup list
+ * \headerfile TelepathyQt/types.h <TelepathyQt/Types>
+ *
+ * Array of FingerprintInfo values.
+ */
+typedef QList<FingerprintInfo> FingerprintInfoList;
KDE_TELEPATHY_CHAT_EXPORT void registerOtrTypes();
-} // namespace Tp
+} /* namespace Tp */
-Q_DECLARE_METATYPE(Tp::Fingerprint)
+Q_DECLARE_METATYPE(Tp::FingerprintInfo)
+Q_DECLARE_METATYPE(Tp::FingerprintInfoList)
#endif
diff --git a/lib/proxy-service-interface.h b/lib/proxy-service-interface.h
index b218fb8..52ce287 100644
--- a/lib/proxy-service-interface.h
+++ b/lib/proxy-service-interface.h
@@ -8,6 +8,8 @@
#ifndef PROXY_SERVICE_INTERFACE_HEADER
#define PROXY_SERVICE_INTERFACE_HEADER
+#include "otr-types.h"
+
#include <TelepathyQt/Types>
#include <QtGlobal>
@@ -216,6 +218,82 @@ public Q_SLOTS:
return this->connection().asyncCall(callMessage, timeout);
}
+ /**
+ * Begins a call to the D-Bus method
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list