diff --git a/ui/omemo/CMakeLists.txt b/ui/omemo/CMakeLists.txt index 41afa04..b775e83 100644 --- a/ui/omemo/CMakeLists.txt +++ b/ui/omemo/CMakeLists.txt @@ -1,5 +1,8 @@ target_sources(squawk PRIVATE - omemodevices.cpp - omemodevices.h - omemodevices.ui - ) \ No newline at end of file + contactsettings.cpp + contactsettings.h + contactsettings.ui + omemodevices.cpp + omemodevices.h + omemodevices.ui + ) \ No newline at end of file diff --git a/ui/omemo/contactsettings.cpp b/ui/omemo/contactsettings.cpp new file mode 100644 index 0000000..c4d20b9 --- /dev/null +++ b/ui/omemo/contactsettings.cpp @@ -0,0 +1,23 @@ +/* + * Created by victoria on 2021-05-15. +*/ + +#include "contactsettings.h" +#include "ui_contactsettings.h" +#include "omemodevices.h" + +ContactSettings::ContactSettings(QWidget *parent) + : QDialog(parent), m_ui(new Ui::ContactSettings()) { + m_ui->setupUi(this); + + connect(m_ui->devicesButton, &QPushButton::clicked, this, &ContactSettings::openDeviceList); +} + +ContactSettings::~ContactSettings() {} + +void ContactSettings::openDeviceList() { + auto devices = new OMEMODevices(this); + + devices->setAttribute(Qt::WA_DeleteOnClose); + devices->show(); +} diff --git a/ui/omemo/contactsettings.h b/ui/omemo/contactsettings.h new file mode 100644 index 0000000..4720c1f --- /dev/null +++ b/ui/omemo/contactsettings.h @@ -0,0 +1,24 @@ +/* + * Created by victoria on 2021-05-15. +*/ + +#pragma once + +#include + +namespace Ui { + class ContactSettings; +} + +class ContactSettings : public QDialog { + Q_OBJECT +public: + explicit ContactSettings(QWidget *parent = nullptr); + ~ContactSettings() override; + +private slots: + void openDeviceList(); + +private: + QScopedPointer m_ui; +}; diff --git a/ui/omemo/contactsettings.ui b/ui/omemo/contactsettings.ui new file mode 100644 index 0000000..5f7e77a --- /dev/null +++ b/ui/omemo/contactsettings.ui @@ -0,0 +1,144 @@ + + + ContactSettings + + + + 0 + 0 + 400 + 300 + + + + Contact Settings + + + + + + Settings for foo@example.com + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Use OMEMO + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Devices... + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + ContactSettings + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + ContactSettings + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/ui/omemo/omemodevices.cpp b/ui/omemo/omemodevices.cpp index e746f5b..877ff27 100644 --- a/ui/omemo/omemodevices.cpp +++ b/ui/omemo/omemodevices.cpp @@ -6,8 +6,8 @@ #include "ui_omemodevices.h" OMEMODevices::OMEMODevices(QWidget *parent) - : QDialog(parent), m_ui(new Ui::OMEMODevices()) { - m_ui->setupUi(this); + : QDialog(parent), m_ui(new Ui::OMEMODevices()) { + m_ui->setupUi(this); } OMEMODevices::~OMEMODevices() {} diff --git a/ui/omemo/omemodevices.h b/ui/omemo/omemodevices.h index b107baa..70dbb0f 100644 --- a/ui/omemo/omemodevices.h +++ b/ui/omemo/omemodevices.h @@ -7,15 +7,15 @@ #include namespace Ui { -class OMEMODevices; + class OMEMODevices; } class OMEMODevices : public QDialog { - Q_OBJECT + Q_OBJECT public: - explicit OMEMODevices(QWidget *parent = nullptr); - ~OMEMODevices() override; + explicit OMEMODevices(QWidget *parent = nullptr); + ~OMEMODevices() override; private: - QScopedPointer m_ui; + QScopedPointer m_ui; }; diff --git a/ui/widgets/conversation.cpp b/ui/widgets/conversation.cpp index 45ce2c5..2b2547b 100644 --- a/ui/widgets/conversation.cpp +++ b/ui/widgets/conversation.cpp @@ -27,6 +27,7 @@ #include #include #include +#include Conversation::Conversation(bool muc, Models::Account* acc, Models::Element* el, const QString pJid, const QString pRes, QWidget* parent): QWidget(parent), @@ -80,7 +81,8 @@ Conversation::Conversation(bool muc, Models::Account* acc, Models::Element* el, connect(m_ui->clearButton, &QPushButton::clicked, this, &Conversation::onClearButton); connect(m_ui->messageEditor->document()->documentLayout(), &QAbstractTextDocumentLayout::documentSizeChanged, this, &Conversation::onTextEditDocSizeChanged); - + connect(m_ui->encryptionButton, &QToolButton::clicked, this, &Conversation::openEncryptionSettings); + m_ui->messageEditor->installEventFilter(&ker); @@ -433,3 +435,10 @@ void Conversation::onFeedContext(const QPoint& pos) } } } + +void Conversation::openEncryptionSettings() { + auto cs = new ContactSettings(this); + + cs->setAttribute(Qt::WA_DeleteOnClose); + cs->show(); +} diff --git a/ui/widgets/conversation.h b/ui/widgets/conversation.h index 0b0dcb2..5ec7acc 100644 --- a/ui/widgets/conversation.h +++ b/ui/widgets/conversation.h @@ -107,6 +107,7 @@ protected slots: void onFeedMessage(const Shared::Message& msg); void positionShadow(); void onFeedContext(const QPoint &pos); + void openEncryptionSettings(); public: const bool isMuc; diff --git a/ui/widgets/conversation.ui b/ui/widgets/conversation.ui index 36b74a4..e9bcbf8 100644 --- a/ui/widgets/conversation.ui +++ b/ui/widgets/conversation.ui @@ -293,14 +293,15 @@ - + - + + .. - + true