First commit

This commit is contained in:
Xavier Del Campo Romero 2023-06-12 23:47:17 +02:00
parent f25f3e8f6e
commit e8445d65d9
Signed by: xavi
GPG Key ID: 84FF3612A9BF43F2
33 changed files with 1976 additions and 0 deletions

74
.gitignore vendored Normal file
View File

@ -0,0 +1,74 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe
build*/

94
CMakeLists.txt Normal file
View File

@ -0,0 +1,94 @@
cmake_minimum_required(VERSION 3.13.5)
project(xxcc VERSION 0.1 LANGUAGES CXX)
add_compile_options(-fdata-sections -ffunction-sections)
set(QT_VERSION_MAJOR 5)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
# QXmpp requires C++17.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets Sql REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Sql REQUIRED)
set(PROJECT_SOURCES
account.cpp
account.ui
accounts.cpp
accounts.ui
contact.cpp
contact.ui
contacts.cpp
contacts.ui
conversation.cpp
conversation.ui
credentials.cpp
jiddb.cpp
login.cpp
login.ui
main.cpp
message.cpp
message.ui
xxcc.cpp
xxcc.ui
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(${PROJECT_NAME}
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(${PROJECT_NAME} SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else()
add_executable(${PROJECT_NAME}
${PROJECT_SOURCES}
)
endif()
endif()
find_package(PkgConfig REQUIRED)
pkg_check_modules(qca REQUIRED IMPORTED_TARGET qca2-qt${QT_VERSION_MAJOR})
target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::qca)
find_package(Qt5Keychain REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5Keychain::Qt5Keychain)
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Sql)
target_link_options(${PROJECT_NAME} PRIVATE -Wl,--gc-sections)
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(${PROJECT_NAME})
endif()
add_subdirectory(qxmpp)
#target_compile_definitions(${PROJECT_NAME} PUBLIC QT_NO_KEYWORDS)
target_compile_options(${PROJECT_NAME} PUBLIC -Wall)

3
README.md Normal file
View File

@ -0,0 +1,3 @@
```
# apt install qtkeychain-qt5-dev qttools5-dev-tools qtbase5-dev
```

23
account.cpp Normal file
View File

@ -0,0 +1,23 @@
#include "account.h"
Account::Account(QXmppClient *const c, QListWidget *const list)
{
const auto it = new QListWidgetItem(list);
const auto w = new QWidget;
ui.setupUi(w);
ui.jid->setText(c->configuration().jidBare());
ui.connected->setChecked(
c->state() == QXmppClient::State::ConnectedState);
connect(c, &QXmppClient::stateChanged,
[this] (const QXmppClient::State state)
{
ui.connected->setChecked(
state == QXmppClient::State::ConnectedState);
});
it->setSizeHint(w->sizeHint());
list->addItem(it);
list->setItemWidget(it, w);
}

18
account.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef ACCOUNT_H
#define ACCOUNT_H
#include "ui_account.h"
#include <QListWidget>
#include <QWidget>
#include <QXmppClient.h>
class Account : public QWidget
{
public:
Account(QXmppClient *c, QListWidget *list);
private:
Ui_account ui;
};
#endif

63
account.ui Normal file
View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>account</class>
<widget class="QWidget" name="account">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>139</width>
<height>36</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="jid">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="alias">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="connected">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Connected</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

39
accounts.cpp Normal file
View File

@ -0,0 +1,39 @@
#include "accounts.h"
#include "account.h"
#include "login.h"
#include <utility>
#include <QListWidgetItem>
#include <QScroller>
Accounts::Accounts(const QList<QXmppClient *> &accounts,
QWidget *const parent) :
QDialog(parent)
{
ui.setupUi(this);
/* TODO: try TouchGesture */
QScroller::grabGesture(ui.accounts_list,
QScroller::LeftMouseButtonGesture);
for (const auto &a : accounts)
add(a);
connect(ui.add, &QPushButton::released,
[this]
{
Login l(this);
l.connect(&l, &Login::auth_success,
[this] (QXmppClient *c)
{
add(c);
Q_EMIT new_account(c);
});
l.exec();
});
}
void Accounts::add(QXmppClient *c)
{
new Account(c, ui.accounts_list);
}

26
accounts.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef ACCOUNTS_H
#define ACCOUNTS_H
#include "ui_accounts.h"
#include <QDialog>
#include <QWidget>
#include <QVBoxLayout>
#include <QString>
#include <QXmppClient.h>
class Accounts : public QDialog
{
Q_OBJECT
public:
Accounts(const QList<QXmppClient *> &accounts, QWidget *parent = nullptr);
Q_SIGNALS:
void new_account(QXmppClient *c);
private:
void add(QXmppClient *c);
Ui_accounts ui;
};
#endif

98
accounts.ui Normal file
View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>accounts</class>
<widget class="QDialog" name="accounts">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>188</width>
<height>215</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>100</horstretch>
<verstretch>100</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>xxcc - Accounts</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPushButton" name="close">
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&lt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Accounts&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="accounts_list">
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="rm">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="add">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>close</sender>
<signal>released()</signal>
<receiver>accounts</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>48</x>
<y>147</y>
</hint>
<hint type="destinationlabel">
<x>138</x>
<y>86</y>
</hint>
</hints>
</connection>
</connections>
</ui>

16
contact.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "contact.h"
Contact::Contact(const QString &own, const QString &other,
QListWidget *const list, QWidget *const parent) :
QListWidgetItem(list),
QWidget(parent),
own(own),
other(other)
{
ui.setupUi(this);
ui.own_jid->setText(own);
ui.contact_jid->setText(other);
QListWidgetItem::setSizeHint(QWidget::sizeHint());
list->addItem(this);
list->setItemWidget(this, this);
}

20
contact.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef CONTACT_H
#define CONTACT_H
#include "ui_contact.h"
#include <QListWidgetItem>
#include <QString>
#include <QWidget>
class Contact : public QListWidgetItem, public QWidget
{
public:
Contact(const QString &own, const QString &other,
QListWidget *list, QWidget *parent = nullptr);
const QString own, other;
private:
Ui_contact ui;
};
#endif

58
contact.ui Normal file
View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>contact</class>
<widget class="QWidget" name="contact">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>117</width>
<height>60</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="picture">
<property name="text">
<string>Picture</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="contact_jid">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Contact</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="own_jid">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Own</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

49
contacts.cpp Normal file
View File

@ -0,0 +1,49 @@
#include "contacts.h"
#include "contact.h"
#include <QListWidgetItem>
#include <QScroller>
Contacts::Contacts(QList<JidDb *> &databases, QWidget *const parent) :
QDialog(parent),
databases(databases)
{
ui.setupUi(this);
QScroller::grabGesture(ui.contacts_list,
QScroller::LeftMouseButtonGesture);
for (const auto db : databases)
for (const auto &contact : db->roster())
add(db->jid, contact);
connect(ui.contacts_list, &QListWidget::itemActivated,
[this]
{
ui.chat->setEnabled(true);
});
connect(ui.chat, &QPushButton::released,
[this]
{
const auto items = ui.contacts_list->selectedItems();
if (items.isEmpty())
{
ui.chat->setEnabled(false);
return;
}
for (const auto it : items)
{
const auto c = static_cast<Contact *>(it);
Q_EMIT startChat(c->own, c->other);
}
close();
});
}
void Contacts::add(const QString &own, const QString &other)
{
new Contact(own, other, ui.contacts_list);
}

28
contacts.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef CONTACTS_H
#define CONTACTS_H
#include "ui_contacts.h"
#include "jiddb.h"
#include <QDialog>
#include <QList>
#include <QString>
#include <QWidget>
class Contacts : public QDialog
{
Q_OBJECT
public:
Contacts(QList<JidDb *> &databases, QWidget *parent = nullptr);
private:
Ui_contacts ui;
QList<JidDb *> &databases;
void add(const QString &own, const QString &other);
enum Role {From = Qt::UserRole, To};
Q_SIGNALS:
void startChat(QString from, QString to);
};
#endif

114
contacts.ui Normal file
View File

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>contacts</class>
<widget class="QDialog" name="contacts">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>278</width>
<height>215</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>100</horstretch>
<verstretch>100</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>xxcc - Contacts</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPushButton" name="close">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&lt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Contacts&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="contacts_list">
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="rm">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="add">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="chat">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Chat</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>close</sender>
<signal>released()</signal>
<receiver>contacts</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>48</x>
<y>147</y>
</hint>
<hint type="destinationlabel">
<x>183</x>
<y>86</y>
</hint>
</hints>
</connection>
</connections>
</ui>

14
conversation.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "conversation.h"
Conversation::Conversation(const QString &from, const QString &to,
QListWidget *const list, QWidget *const parent) :
QWidget(parent),
it(list)
{
ui.setupUi(this);
ui.account->setText(from);
ui.contact->setText(to);
it.setSizeHint(sizeHint());
list->addItem(&it);
list->setItemWidget(&it, this);
}

21
conversation.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef CONVERSATION_H
#define CONVERSATION_H
#include "ui_conversation.h"
#include <QListWidget>
#include <QListWidgetItem>
#include <QWidget>
class Conversation : public QWidget
{
public:
Conversation(const QString &from, const QString &to,
QListWidget *list, QWidget *parent = nullptr);
void setText(const QString &msg);
private:
Ui_conversation ui;
QListWidgetItem it;
};
#endif

81
conversation.ui Normal file
View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>conversation</class>
<widget class="QWidget" name="conversation">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>195</width>
<height>86</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="picture">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Picture</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="account">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="contact">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="message">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="time">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

103
credentials.cpp Normal file
View File

@ -0,0 +1,103 @@
#include "credentials.h"
#include <QEventLoop>
#include <qt5keychain/keychain.h>
#include <QXmppConfiguration.h>
#include <iostream>
static const QString service = "xxcc", sep = ";";
QList<Credentials::Pair> Credentials::load()
{
const QStringList users = storedUsers();
QList<Pair> ret;
for (const auto &user : users)
{
QKeychain::ReadPasswordJob job(service);
QEventLoop loop;
job.setKey(user);
job.connect(&job, &QKeychain::Job::finished, &loop, &QEventLoop::quit);
job.start();
loop.exec();
const QString pwd = job.textData();
if (job.error())
std::cerr << "Failed to retrieve password for " << qPrintable(user)
<< ": " << qPrintable(job.errorString()) << std::endl;
else
ret.append(Pair(user, pwd));
}
return ret;
}
void Credentials::store(QXmppClient *c)
{
QKeychain::WritePasswordJob job(service);
const QXmppConfiguration &cfg = c->configuration();
const QString user = cfg.jidBare();
QEventLoop loop;
job.setKey(user);
job.setTextData(cfg.password());
job.connect(&job, &QKeychain::Job::finished, &loop, &QEventLoop::quit);
job.start();
loop.exec();
if (job.error())
std::cerr << "Failed to store password: "
<< qPrintable(job.errorString()) << std::endl;
else
storeUser(user);
}
void Credentials::storeUser(const QString &user)
{
QString list = storedUsersList();
QKeychain::WritePasswordJob job(service);
QEventLoop loop;
if (!list.isEmpty())
list += sep;
list += user;
job.setKey("users");
job.setTextData(list);
job.connect(&job, &QKeychain::Job::finished, &loop, &QEventLoop::quit);
job.start();
loop.exec();
if (job.error())
std::cerr << "Failed to store user: "
<< qPrintable(job.errorString()) << std::endl;
}
QString Credentials::storedUsersList()
{
QKeychain::ReadPasswordJob job(service);
QString ret;
QEventLoop loop;
job.setKey("users");
job.connect(&job, &QKeychain::Job::finished, &loop, &QEventLoop::quit);
job.start();
loop.exec();
const QString users = job.textData();
if (job.error())
std::cerr << "Failed to retrieve users: "
<< qPrintable(job.errorString()) << std::endl;
else
ret = users;
return ret;
}
QStringList Credentials::storedUsers()
{
return storedUsersList().split(sep);
}

26
credentials.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef CREDENTIALS_H
#define CREDENTIALS_H
#include <QObject>
#include <QList>
#include <QPair>
#include <QStringList>
#include <QXmppClient.h>
class Credentials : public QObject
{
Q_OBJECT
public:
using Pair = QPair<QString, QString>;
QList<Pair> load();
public Q_SLOTS:
void store(QXmppClient *c);
private:
static void storeUser(const QString &user);
static QString storedUsersList();
static QStringList storedUsers();
};
#endif

54
jiddb.cpp Normal file
View File

@ -0,0 +1,54 @@
#include "jiddb.h"
#include <QDir>
#include <QSqlQuery>
#include <QStandardPaths>
#include <QVariant>
#include <iostream>
#include <stdexcept>
JidDb::JidDb(const QString &jid) :
jid(jid),
db(QSqlDatabase::addDatabase("QSQLITE"))
{
const auto path = QStandardPaths::writableLocation(
QStandardPaths::AppDataLocation);
QDir dir;
if (!dir.exists(path) && !dir.mkdir(path))
throw std::runtime_error("Failed to create app dir");
const auto abspath = path + "/" + jid + ".db";
db.setDatabaseName(abspath);
if (!db.open())
throw std::runtime_error(qPrintable("database" + abspath
+ "could not be created"));
QSqlQuery q(db);
if (!q.exec("create table if not exists roster (jid TEXT) strict;"))
std::cerr << "query exec failed" << std::endl;
}
void JidDb::addToRoster(const QString &jid) const
{
QSqlQuery q(db);
if (!q.exec("insert into if not exists roster (jid) values (" + jid +");"))
throw std::runtime_error("JidDb::addToRoster: query exec failed");
}
QStringList JidDb::roster() const
{
QStringList ret;
QSqlQuery q(db);
if (!q.exec("select jid from roster;"))
std::cerr << "query exec failed" << std::endl;
else
while (q.next())
ret.append(q.value("jid").toString());
return ret;
}

25
jiddb.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef JID_DB_H
#define JID_DB_H
#include <QObject>
#include <QString>
#include <QStringList>
#include <QSqlDatabase>
class JidDb : public QObject
{
Q_OBJECT
public:
JidDb(const QString &jid);
QStringList roster() const;
const QString jid;
public Q_SLOTS:
void addToRoster(const QString &jid) const;
private:
QSqlDatabase db;
};
#endif

150
login.cpp Normal file
View File

@ -0,0 +1,150 @@
#include "login.h"
#include "ui_login.h"
#include <QString>
#include "QXmppStanza.h"
#include <memory>
static QString error_to_str(const QXmppStanza::Error::Condition c)
{
switch (c)
{
case QXmppStanza::Error::BadRequest:
return "BadRequest";
case QXmppStanza::Error::Conflict:
return "Conflict";
case QXmppStanza::Error::FeatureNotImplemented:
return "FeatureNotImplemented";
case QXmppStanza::Error::Forbidden:
return "Forbidden";
case QXmppStanza::Error::Gone:
return "Gone";
case QXmppStanza::Error::InternalServerError:
return "internal server error";
case QXmppStanza::Error::ItemNotFound:
return "item not found";
case QXmppStanza::Error::JidMalformed:
return "JID Malformed";
case QXmppStanza::Error::NotAcceptable:
return "not acceptable";
case QXmppStanza::Error::NotAllowed:
return "not allowed";
case QXmppStanza::Error::NotAuthorized:
return "not authorized";
case QXmppStanza::Error::RecipientUnavailable:
return "recipient unavailable";
case QXmppStanza::Error::Redirect:
return "Redirect";
case QXmppStanza::Error::RegistrationRequired:
return "RegistrationRequired";
case QXmppStanza::Error::RemoteServerNotFound:
return "RemoteServerNotFound";
case QXmppStanza::Error::RemoteServerTimeout:
return "RemoteServerTimeout";
case QXmppStanza::Error::ResourceConstraint:
return "ResourceConstraint";
case QXmppStanza::Error::ServiceUnavailable:
return "ServiceUnavailable";
case QXmppStanza::Error::SubscriptionRequired:
return "SubscriptionRequired";
case QXmppStanza::Error::UndefinedCondition:
return "UndefinedCondition";
case QXmppStanza::Error::UnexpectedRequest:
return "UnexpectedRequest";
case QXmppStanza::Error::PolicyViolation:
return "PolicyViolation";
default:
break;
}
return "UnknownError";
}
Login::Login(QDialog *const parent) :
QDialog(parent)
{
ui.setupUi(this);
ui.error->setVisible(false);
connect(ui.next, &QPushButton::released,
[sw = ui.sw]
{
sw->setCurrentIndex(sw->currentIndex() + 1);
});
connect(ui.back, &QPushButton::released,
[sw = ui.sw]
{
const int i = sw->currentIndex();
if (i)
sw->setCurrentIndex(i - 1);
});
connect(ui.login_b, &QPushButton::released,
[this]
{
const QString jid = ui.username->text(), pwd = ui.password->text();
QString domain, error;
if (!jid_is_valid(jid, domain))
error = tr("Invalid username");
else if (pwd.isEmpty())
error = tr("Invalid password");
else
setup(jid, pwd, domain);
ui.error->setText(error);
ui.error->setVisible(!error.isEmpty());
});
}
bool Login::jid_is_valid(const QString &jid, QString &domain)
{
if (jid.isEmpty() || jid.count('@') != 1)
return false;
else if ((domain = jid.mid(jid.indexOf('@') + 1)).isEmpty())
return false;
return true;
}
void Login::setup(const QString &jid, const QString pwd, const QString &domain)
{
QXmppConfiguration cfg;
cfg.setStreamSecurityMode(QXmppConfiguration::TLSRequired);
cfg.setJid(jid);
cfg.setPassword(pwd);
cfg.setAutoReconnectionEnabled(false);
auto client = new QXmppClient;
connect(client, &QXmppClient::stateChanged,
[d = domain, e = ui.error] (const QXmppClient::State state)
{
if (state == QXmppClient::ConnectingState)
{
e->setVisible(true);
e->setText(tr("Connecting to ") + d + "...");
}
});
connect(client, &QXmppClient::connected,
[this, client]
{
Q_EMIT auth_success(client);
close();
});
connect(client, &QXmppClient::disconnected,
[client, e = ui.error]
{
e->setText("Disconnected from server: "
+ error_to_str(client->xmppStreamError()));
e->setVisible(true);
delete client;
});
client->connectToServer(cfg);
}

26
login.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef LOGIN_H
#define LOGIN_H
#include "ui_login.h"
#include <QDialog>
#include <QString>
#include <QXmppClient.h>
class Login : public QDialog
{
Q_OBJECT
public:
Login(QDialog *parent = nullptr);
Q_SIGNALS:
void auth_success(QXmppClient *c);
private:
void setup(const QString &jid, const QString pwd, const QString &domain);
static bool jid_is_valid(const QString &jid, QString &domain);
Ui_login ui;
};
#endif

214
login.ui Normal file
View File

@ -0,0 +1,214 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>login</class>
<widget class="QDialog" name="login">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>323</width>
<height>129</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>Log into a XMPP server</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QStackedWidget" name="sw">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="username_tab">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLineEdit" name="username">
<property name="inputMethodHints">
<set>Qt::ImhEmailCharactersOnly|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText</set>
</property>
<property name="placeholderText">
<string>Enter JID</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="close">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="next">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Next</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="password_tab">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLineEdit" name="password">
<property name="inputMethodHints">
<set>Qt::ImhHiddenText|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhSensitiveData</set>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="placeholderText">
<string>Enter password</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="error">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="back">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Back</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Create account</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="login_b">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Login</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>cancel</sender>
<signal>released()</signal>
<receiver>login</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>86</x>
<y>71</y>
</hint>
<hint type="destinationlabel">
<x>161</x>
<y>51</y>
</hint>
</hints>
</connection>
<connection>
<sender>close</sender>
<signal>released()</signal>
<receiver>login</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>60</x>
<y>83</y>
</hint>
<hint type="destinationlabel">
<x>161</x>
<y>64</y>
</hint>
</hints>
</connection>
</connections>
</ui>

11
main.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "xxcc.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
xxcc x;
x.show();
return a.exec();
}

28
message.cpp Normal file
View File

@ -0,0 +1,28 @@
#include "message.h"
Message::Message(const QString &msg, QListWidget *const list,
QWidget *const parent) :
QWidget(parent),
it(list)
{
ui.setupUi(this);
ui.edit->setVisible(false);
ui.quote->setVisible(false);
ui.retry->setVisible(false);
ui.text->setText(msg);
it.setSizeHint(sizeHint());
connect(list, &QListWidget::itemActivated,
[this] (QListWidgetItem *const item)
{
const bool visible = item == &it;
ui.edit->setVisible(visible);
ui.quote->setVisible(visible);
ui.retry->setVisible(visible);
it.setSizeHint(sizeHint());
});
list->addItem(&it);
list->setItemWidget(&it, this);
}

19
message.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef MESSAGE_H
#define MESSAGE_H
#include "ui_message.h"
#include <QListWidgetItem>
#include <QListWidget>
#include <QWidget>
class Message : public QWidget
{
public:
Message(const QString &msg, QListWidget *list, QWidget *parent = nullptr);
private:
Ui_message ui;
QListWidgetItem it;
};
#endif

78
message.ui Normal file
View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>message</class>
<widget class="QWidget" name="message">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>278</width>
<height>76</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="quote">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Quote</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="edit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="retry">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Retry</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="time">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="text">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

15
qxmpp/CMakeLists.txt Normal file
View File

@ -0,0 +1,15 @@
set(BUILD_SHARED OFF)
set(BUILD_OMEMO ON)
set(BUILD_TESTS OFF)
add_subdirectory(qxmpp)
target_link_libraries(xxcc PRIVATE
QXmppQt${QT_VERSION_MAJOR}
QXmppOmemoQt${QT_VERSION_MAJOR})
target_include_directories(QXmppQt${QT_VERSION_MAJOR} PRIVATE
${CMAKE_BINARY_DIR}/qxmpp/qxmpp/src)
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_BINARY_DIR}/qxmpp/qxmpp/src)
target_include_directories(QXmppOmemoQt${QT_VERSION_MAJOR} PRIVATE
${CMAKE_BINARY_DIR}/qxmpp/qxmpp/src/omemo)
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_BINARY_DIR}/qxmpp/qxmpp/src/omemo)

125
xxcc.cpp Normal file
View File

@ -0,0 +1,125 @@
#include "xxcc.h"
#include "accounts.h"
#include "contacts.h"
#include "conversation.h"
#include "message.h"
#include <QPushButton>
#include <QScroller>
#include <utility>
xxcc::xxcc(QWidget *const parent) :
QWidget(parent)
{
const auto pairs = creds.load();
ui.setupUi(this);
QScroller::grabGesture(ui.conversations_list,
QScroller::LeftMouseButtonGesture);
QScroller::grabGesture(ui.messages, QScroller::LeftMouseButtonGesture);
setupDatabases(pairs);
connectAccounts(pairs);
connect(ui.accounts, &QPushButton::released,
[this]
{
Accounts a(clients, this);
a.connect(&a, &Accounts::new_account, this, &xxcc::addAccount);
a.connect(&a, &Accounts::new_account, &creds, &Credentials::store);
a.exec();
});
connect(ui.contacts, &QPushButton::released,
[this]
{
Contacts c(databases, this);
connect(&c, &Contacts::startChat, this, &xxcc::startChat);
c.exec();
});
connect(ui.back, &QPushButton::released,
[this]
{
ui.sw->setCurrentIndex(static_cast<int>(Tab::Conversations));
});
connect(ui.conversations_list, &QListWidget::itemActivated,
[this]
{
ui.sw->setCurrentIndex(static_cast<int>(Tab::Chat));
});
/* TODO: remove */
startChat("test-from", "test-to");
startChat("2-test-from", "2-test-to");
for (int i = 0; i < 20; i++)
addMessage("Test message " + QString::number(i));
}
xxcc::~xxcc()
{
for (const auto c : clients)
delete c;
for (const auto db : databases)
delete db;
}
void xxcc::connectAccounts(const QList<Credentials::Pair> &pairs)
{
for (const auto &p : pairs)
{
QXmppConfiguration cfg;
cfg.setStreamSecurityMode(QXmppConfiguration::TLSRequired);
cfg.setJid(p.first);
cfg.setPassword(p.second);
cfg.setAutoReconnectionEnabled(true);
const auto client = new QXmppClient;
connect(client, &QXmppClient::connected, this,
[this, client]
{
addAccount(client);
});
connect(client, &QXmppClient::disconnected,
[client]
{
delete client;
});
client->connectToServer(cfg);
}
}
void xxcc::setupDatabases(const QList<Credentials::Pair> &pairs)
{
for (const auto &p : pairs)
databases.append(new JidDb(p.first));
}
void xxcc::startChat(const QString from, const QString to)
{
new Conversation(from, to, ui.conversations_list);
ui.sw->setCurrentIndex(static_cast<int>(Tab::Chat));
ui.jid->setText(to);
}
void xxcc::addMessage(const QString msg)
{
new Message(msg, ui.messages);
}
void xxcc::addAccount(QXmppClient *const c)
{
c->configuration().setAutoReconnectionEnabled(true);
clients.append(c);
c->connect(c, &QXmppClient::messageReceived,
[this]
{
});
}

36
xxcc.h Normal file
View File

@ -0,0 +1,36 @@
#ifndef XXCC_H
#define XXCC_H
#include "ui_xxcc.h"
#include "credentials.h"
#include "jiddb.h"
#include <QList>
#include <QWidget>
#include <QSqlDatabase>
#include <QString>
#include <QXmppClient.h>
class xxcc : public QWidget
{
Q_OBJECT
public:
xxcc(QWidget *parent = nullptr);
~xxcc();
private:
enum Tab {Conversations, Chat};
Ui_main ui;
QList<QXmppClient *> clients;
QList<JidDb *> databases;
Credentials creds;
void setupDatabases(const QList<Credentials::Pair> &pairs);
void connectAccounts(const QList<Credentials::Pair> &pairs);
private Q_SLOTS:
void startChat(QString from, QString to);
void addMessage(QString msg);
void addAccount(QXmppClient *c);
};
#endif

227
xxcc.ui Normal file
View File

@ -0,0 +1,227 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>main</class>
<widget class="QWidget" name="main">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>290</width>
<height>278</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>100</horstretch>
<verstretch>100</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>xxcc</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QStackedWidget" name="sw">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeIncrement">
<size>
<width>13767</width>
<height>13767</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="conversations">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;xxcc&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="conversations_list">
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="accounts">
<property name="text">
<string>Accounts</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="contacts">
<property name="text">
<string>Contacts</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="rooms">
<property name="text">
<string>Rooms</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="chat_tab">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QPushButton" name="back">
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&lt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="jid">
<property name="text">
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Contact name&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="messages">
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="chatinput_hbox">
<property name="spacing">
<number>8</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QPlainTextEdit" name="chatinput">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="midLineWidth">
<number>0</number>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
<property name="backgroundVisible">
<bool>false</bool>
</property>
<property name="placeholderText">
<string>Write a message...</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QPushButton" name="send">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Send</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<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="text">
<string>OMEMO</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>