mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
cppcheck stuff (#1200)
* cppcheck stuff * Update src/ui/RoomSettings.cpp Co-authored-by: DeepBlueV7.X <nicolas.werner@hotmail.de> * Update src/ui/RoomSettings.cpp Co-authored-by: DeepBlueV7.X <nicolas.werner@hotmail.de> * Fix linting Co-authored-by: DeepBlueV7.X <nicolas.werner@hotmail.de>
This commit is contained in:
parent
5e9eb845ab
commit
8ecbb39dc6
33 changed files with 162 additions and 146 deletions
|
@ -74,7 +74,7 @@ CompletionProxyModel::CompletionProxyModel(QAbstractItemModel *model,
|
||||||
this,
|
this,
|
||||||
&CompletionProxyModel::newSearchString,
|
&CompletionProxyModel::newSearchString,
|
||||||
this,
|
this,
|
||||||
[this](QString s) {
|
[this](const QString &s) {
|
||||||
searchString_ = s.toLower();
|
searchString_ = s.toLower();
|
||||||
invalidate();
|
invalidate();
|
||||||
},
|
},
|
||||||
|
@ -167,7 +167,7 @@ CompletionProxyModel::completionAt(int i) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CompletionProxyModel::setSearchString(QString s)
|
CompletionProxyModel::setSearchString(const QString &s)
|
||||||
{
|
{
|
||||||
emit newSearchString(s);
|
emit newSearchString(s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
QVariant completionAt(int i) const;
|
QVariant completionAt(int i) const;
|
||||||
|
|
||||||
void setSearchString(QString s);
|
void setSearchString(const QString &s);
|
||||||
QString searchString() const { return searchString_; }
|
QString searchString() const { return searchString_; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -60,7 +60,7 @@ LoginPage::showError(const QString &msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LoginPage::setHomeserver(QString hs)
|
LoginPage::setHomeserver(const QString &hs)
|
||||||
{
|
{
|
||||||
if (hs != homeserver_) {
|
if (hs != homeserver_) {
|
||||||
homeserver_ = hs;
|
homeserver_ = hs;
|
||||||
|
@ -261,9 +261,9 @@ LoginPage::versionOk(bool passwordSupported, bool ssoSupported, QVariantList idp
|
||||||
|
|
||||||
void
|
void
|
||||||
LoginPage::onLoginButtonClicked(LoginMethod loginMethod,
|
LoginPage::onLoginButtonClicked(LoginMethod loginMethod,
|
||||||
QString userid,
|
const QString &userid,
|
||||||
QString password,
|
const QString &password,
|
||||||
QString deviceName)
|
const QString &deviceName)
|
||||||
{
|
{
|
||||||
clearErrors();
|
clearErrors();
|
||||||
|
|
||||||
|
@ -305,13 +305,16 @@ LoginPage::onLoginButtonClicked(LoginMethod loginMethod,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
auto sso = new SSOHandler();
|
auto sso = new SSOHandler();
|
||||||
connect(
|
connect(sso,
|
||||||
sso, &SSOHandler::ssoSuccess, this, [this, sso, userid, deviceName](std::string token) {
|
&SSOHandler::ssoSuccess,
|
||||||
|
this,
|
||||||
|
[this, sso, userid, deviceName](const std::string &token) {
|
||||||
mtx::requests::Login req{};
|
mtx::requests::Login req{};
|
||||||
req.token = token;
|
req.token = token;
|
||||||
req.type = mtx::user_interactive::auth_types::token;
|
req.type = mtx::user_interactive::auth_types::token;
|
||||||
req.initial_device_display_name =
|
req.initial_device_display_name = deviceName.trimmed().isEmpty()
|
||||||
deviceName.trimmed().isEmpty() ? initialDeviceName_() : deviceName.toStdString();
|
? initialDeviceName_()
|
||||||
|
: deviceName.toStdString();
|
||||||
http::client()->login(
|
http::client()->login(
|
||||||
req, [this](const mtx::responses::Login &res, mtx::http::RequestErr err) {
|
req, [this](const mtx::responses::Login &res, mtx::http::RequestErr err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
QString error() { return error_; }
|
QString error() { return error_; }
|
||||||
QString mxidError() { return mxidError_; }
|
QString mxidError() { return mxidError_; }
|
||||||
|
|
||||||
void setHomeserver(QString hs);
|
void setHomeserver(const QString &hs);
|
||||||
void setMxid(QString id)
|
void setMxid(QString id)
|
||||||
{
|
{
|
||||||
if (id != mxid_) {
|
if (id != mxid_) {
|
||||||
|
@ -130,9 +130,9 @@ public slots:
|
||||||
|
|
||||||
// Callback for the login button.
|
// Callback for the login button.
|
||||||
void onLoginButtonClicked(LoginMethod loginMethod,
|
void onLoginButtonClicked(LoginMethod loginMethod,
|
||||||
QString userid,
|
const QString &userid,
|
||||||
QString password,
|
const QString &password,
|
||||||
QString deviceName);
|
const QString &deviceName);
|
||||||
|
|
||||||
// Callback for errors produced during server probing
|
// Callback for errors produced during server probing
|
||||||
void versionError(const QString &error_message);
|
void versionError(const QString &error_message);
|
||||||
|
|
|
@ -27,7 +27,7 @@ RegisterPage::RegisterPage(QObject *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RegisterPage::setError(QString err)
|
RegisterPage::setError(const QString &err)
|
||||||
{
|
{
|
||||||
registrationError_ = err;
|
registrationError_ = err;
|
||||||
emit errorChanged();
|
emit errorChanged();
|
||||||
|
@ -35,7 +35,7 @@ RegisterPage::setError(QString err)
|
||||||
emit registeringChanged();
|
emit registeringChanged();
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
RegisterPage::setHsError(QString err)
|
RegisterPage::setHsError(const QString &err)
|
||||||
{
|
{
|
||||||
hsError_ = err;
|
hsError_ = err;
|
||||||
emit hsErrorChanged();
|
emit hsErrorChanged();
|
||||||
|
@ -50,7 +50,7 @@ RegisterPage::initialDeviceName() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RegisterPage::setServer(QString server)
|
RegisterPage::setServer(const QString &server)
|
||||||
{
|
{
|
||||||
if (server == lastServer)
|
if (server == lastServer)
|
||||||
return;
|
return;
|
||||||
|
@ -165,7 +165,7 @@ RegisterPage::versionsCheck()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RegisterPage::checkUsername(QString name)
|
RegisterPage::checkUsername(const QString &name)
|
||||||
{
|
{
|
||||||
usernameAvailable_ = usernameUnavailable_ = false;
|
usernameAvailable_ = usernameUnavailable_ = false;
|
||||||
usernameError_.clear();
|
usernameError_.clear();
|
||||||
|
@ -197,7 +197,9 @@ RegisterPage::checkUsername(QString name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RegisterPage::startRegistration(QString username, QString password, QString devicename)
|
RegisterPage::startRegistration(const QString &username,
|
||||||
|
const QString &password,
|
||||||
|
const QString &devicename)
|
||||||
{
|
{
|
||||||
// These inputs should still be alright, but check just in case
|
// These inputs should still be alright, but check just in case
|
||||||
if (!username.isEmpty() && !password.isEmpty() && usernameAvailable_ && supported_) {
|
if (!username.isEmpty() && !password.isEmpty() && usernameAvailable_ && supported_) {
|
||||||
|
@ -206,7 +208,7 @@ RegisterPage::startRegistration(QString username, QString password, QString devi
|
||||||
registering_ = true;
|
registering_ = true;
|
||||||
emit registeringChanged();
|
emit registeringChanged();
|
||||||
|
|
||||||
connect(UIA::instance(), &UIA::error, this, [this](QString msg) {
|
connect(UIA::instance(), &UIA::error, this, [this](const QString &msg) {
|
||||||
setError(msg);
|
setError(msg);
|
||||||
disconnect(UIA::instance(), &UIA::error, this, nullptr);
|
disconnect(UIA::instance(), &UIA::error, this, nullptr);
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,9 +29,10 @@ class RegisterPage : public QObject
|
||||||
public:
|
public:
|
||||||
RegisterPage(QObject *parent = nullptr);
|
RegisterPage(QObject *parent = nullptr);
|
||||||
|
|
||||||
Q_INVOKABLE void setServer(QString server);
|
Q_INVOKABLE void setServer(const QString &server);
|
||||||
Q_INVOKABLE void checkUsername(QString name);
|
Q_INVOKABLE void checkUsername(const QString &name);
|
||||||
Q_INVOKABLE void startRegistration(QString username, QString password, QString deviceName);
|
Q_INVOKABLE void
|
||||||
|
startRegistration(const QString &username, const QString &password, const QString &deviceName);
|
||||||
Q_INVOKABLE QString initialDeviceName() const;
|
Q_INVOKABLE QString initialDeviceName() const;
|
||||||
|
|
||||||
bool registering() const { return registering_; }
|
bool registering() const { return registering_; }
|
||||||
|
@ -58,8 +59,8 @@ signals:
|
||||||
private:
|
private:
|
||||||
void versionsCheck();
|
void versionsCheck();
|
||||||
|
|
||||||
void setHsError(QString err);
|
void setHsError(const QString &err);
|
||||||
void setError(QString err);
|
void setError(const QString &err);
|
||||||
|
|
||||||
QString registrationError_, hsError_, usernameError_;
|
QString registrationError_, hsError_, usernameError_;
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
MsgCountComposedIcon::MsgCountComposedIcon(const QString &filename)
|
MsgCountComposedIcon::MsgCountComposedIcon(const QString &filename)
|
||||||
: QIconEngine()
|
: QIconEngine()
|
||||||
|
, icon_{QIcon{filename}}
|
||||||
{
|
{
|
||||||
icon_ = QIcon(filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -31,8 +31,8 @@ key_verification_mac(mtx::crypto::SAS *sas,
|
||||||
DeviceVerificationFlow::DeviceVerificationFlow(QObject *,
|
DeviceVerificationFlow::DeviceVerificationFlow(QObject *,
|
||||||
DeviceVerificationFlow::Type flow_type,
|
DeviceVerificationFlow::Type flow_type,
|
||||||
TimelineModel *model,
|
TimelineModel *model,
|
||||||
QString userID,
|
const QString &userID,
|
||||||
std::vector<QString> deviceIds_)
|
const std::vector<QString> &deviceIds_)
|
||||||
: sender(false)
|
: sender(false)
|
||||||
, type(flow_type)
|
, type(flow_type)
|
||||||
, deviceIds(std::move(deviceIds_))
|
, deviceIds(std::move(deviceIds_))
|
||||||
|
@ -86,8 +86,10 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (model) {
|
if (model) {
|
||||||
connect(
|
connect(this->model_,
|
||||||
this->model_, &TimelineModel::updateFlowEventId, this, [this](std::string event_id_) {
|
&TimelineModel::updateFlowEventId,
|
||||||
|
this,
|
||||||
|
[this](const std::string &event_id_) {
|
||||||
this->relation.rel_type = mtx::common::RelationType::Reference;
|
this->relation.rel_type = mtx::common::RelationType::Reference;
|
||||||
this->relation.event_id = event_id_;
|
this->relation.event_id = event_id_;
|
||||||
this->transaction_id = event_id_;
|
this->transaction_id = event_id_;
|
||||||
|
@ -548,7 +550,7 @@ DeviceVerificationFlow::isSelfVerification() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DeviceVerificationFlow::setEventId(std::string event_id_)
|
DeviceVerificationFlow::setEventId(const std::string &event_id_)
|
||||||
{
|
{
|
||||||
this->relation.rel_type = mtx::common::RelationType::Reference;
|
this->relation.rel_type = mtx::common::RelationType::Reference;
|
||||||
this->relation.event_id = event_id_;
|
this->relation.event_id = event_id_;
|
||||||
|
@ -864,8 +866,8 @@ QSharedPointer<DeviceVerificationFlow>
|
||||||
DeviceVerificationFlow::NewInRoomVerification(QObject *parent_,
|
DeviceVerificationFlow::NewInRoomVerification(QObject *parent_,
|
||||||
TimelineModel *timelineModel_,
|
TimelineModel *timelineModel_,
|
||||||
const mtx::events::msg::KeyVerificationRequest &msg,
|
const mtx::events::msg::KeyVerificationRequest &msg,
|
||||||
QString other_user_,
|
const QString &other_user_,
|
||||||
QString event_id_)
|
const QString &event_id_)
|
||||||
{
|
{
|
||||||
QSharedPointer<DeviceVerificationFlow> flow(
|
QSharedPointer<DeviceVerificationFlow> flow(
|
||||||
new DeviceVerificationFlow(parent_,
|
new DeviceVerificationFlow(parent_,
|
||||||
|
@ -887,8 +889,8 @@ DeviceVerificationFlow::NewInRoomVerification(QObject *parent_,
|
||||||
QSharedPointer<DeviceVerificationFlow>
|
QSharedPointer<DeviceVerificationFlow>
|
||||||
DeviceVerificationFlow::NewToDeviceVerification(QObject *parent_,
|
DeviceVerificationFlow::NewToDeviceVerification(QObject *parent_,
|
||||||
const mtx::events::msg::KeyVerificationRequest &msg,
|
const mtx::events::msg::KeyVerificationRequest &msg,
|
||||||
QString other_user_,
|
const QString &other_user_,
|
||||||
QString txn_id_)
|
const QString &txn_id_)
|
||||||
{
|
{
|
||||||
QSharedPointer<DeviceVerificationFlow> flow(new DeviceVerificationFlow(
|
QSharedPointer<DeviceVerificationFlow> flow(new DeviceVerificationFlow(
|
||||||
parent_, Type::ToDevice, nullptr, other_user_, {QString::fromStdString(msg.from_device)}));
|
parent_, Type::ToDevice, nullptr, other_user_, {QString::fromStdString(msg.from_device)}));
|
||||||
|
@ -905,8 +907,8 @@ DeviceVerificationFlow::NewToDeviceVerification(QObject *parent_,
|
||||||
QSharedPointer<DeviceVerificationFlow>
|
QSharedPointer<DeviceVerificationFlow>
|
||||||
DeviceVerificationFlow::NewToDeviceVerification(QObject *parent_,
|
DeviceVerificationFlow::NewToDeviceVerification(QObject *parent_,
|
||||||
const mtx::events::msg::KeyVerificationStart &msg,
|
const mtx::events::msg::KeyVerificationStart &msg,
|
||||||
QString other_user_,
|
const QString &other_user_,
|
||||||
QString txn_id_)
|
const QString &txn_id_)
|
||||||
{
|
{
|
||||||
QSharedPointer<DeviceVerificationFlow> flow(new DeviceVerificationFlow(
|
QSharedPointer<DeviceVerificationFlow> flow(new DeviceVerificationFlow(
|
||||||
parent_, Type::ToDevice, nullptr, other_user_, {QString::fromStdString(msg.from_device)}));
|
parent_, Type::ToDevice, nullptr, other_user_, {QString::fromStdString(msg.from_device)}));
|
||||||
|
@ -919,7 +921,7 @@ DeviceVerificationFlow::NewToDeviceVerification(QObject *parent_,
|
||||||
QSharedPointer<DeviceVerificationFlow>
|
QSharedPointer<DeviceVerificationFlow>
|
||||||
DeviceVerificationFlow::InitiateUserVerification(QObject *parent_,
|
DeviceVerificationFlow::InitiateUserVerification(QObject *parent_,
|
||||||
TimelineModel *timelineModel_,
|
TimelineModel *timelineModel_,
|
||||||
QString userid)
|
const QString &userid)
|
||||||
{
|
{
|
||||||
QSharedPointer<DeviceVerificationFlow> flow(
|
QSharedPointer<DeviceVerificationFlow> flow(
|
||||||
new DeviceVerificationFlow(parent_, Type::RoomMsg, timelineModel_, userid, {}));
|
new DeviceVerificationFlow(parent_, Type::RoomMsg, timelineModel_, userid, {}));
|
||||||
|
@ -928,8 +930,8 @@ DeviceVerificationFlow::InitiateUserVerification(QObject *parent_,
|
||||||
}
|
}
|
||||||
QSharedPointer<DeviceVerificationFlow>
|
QSharedPointer<DeviceVerificationFlow>
|
||||||
DeviceVerificationFlow::InitiateDeviceVerification(QObject *parent_,
|
DeviceVerificationFlow::InitiateDeviceVerification(QObject *parent_,
|
||||||
QString userid,
|
const QString &userid,
|
||||||
std::vector<QString> devices)
|
const std::vector<QString> &devices)
|
||||||
{
|
{
|
||||||
assert(!devices.empty());
|
assert(!devices.empty());
|
||||||
|
|
||||||
|
|
|
@ -110,22 +110,26 @@ public:
|
||||||
NewInRoomVerification(QObject *parent_,
|
NewInRoomVerification(QObject *parent_,
|
||||||
TimelineModel *timelineModel_,
|
TimelineModel *timelineModel_,
|
||||||
const mtx::events::msg::KeyVerificationRequest &msg,
|
const mtx::events::msg::KeyVerificationRequest &msg,
|
||||||
QString other_user_,
|
const QString &other_user_,
|
||||||
QString event_id_);
|
const QString &event_id_);
|
||||||
static QSharedPointer<DeviceVerificationFlow>
|
static QSharedPointer<DeviceVerificationFlow>
|
||||||
NewToDeviceVerification(QObject *parent_,
|
NewToDeviceVerification(QObject *parent_,
|
||||||
const mtx::events::msg::KeyVerificationRequest &msg,
|
const mtx::events::msg::KeyVerificationRequest &msg,
|
||||||
QString other_user_,
|
const QString &other_user_,
|
||||||
QString txn_id_);
|
const QString &txn_id_);
|
||||||
static QSharedPointer<DeviceVerificationFlow>
|
static QSharedPointer<DeviceVerificationFlow>
|
||||||
NewToDeviceVerification(QObject *parent_,
|
NewToDeviceVerification(QObject *parent_,
|
||||||
const mtx::events::msg::KeyVerificationStart &msg,
|
const mtx::events::msg::KeyVerificationStart &msg,
|
||||||
QString other_user_,
|
const QString &other_user_,
|
||||||
QString txn_id_);
|
const QString &txn_id_);
|
||||||
static QSharedPointer<DeviceVerificationFlow>
|
static QSharedPointer<DeviceVerificationFlow>
|
||||||
InitiateUserVerification(QObject *parent_, TimelineModel *timelineModel_, QString userid);
|
InitiateUserVerification(QObject *parent_,
|
||||||
|
TimelineModel *timelineModel_,
|
||||||
|
const QString &userid);
|
||||||
static QSharedPointer<DeviceVerificationFlow>
|
static QSharedPointer<DeviceVerificationFlow>
|
||||||
InitiateDeviceVerification(QObject *parent, QString userid, std::vector<QString> devices);
|
InitiateDeviceVerification(QObject *parent,
|
||||||
|
const QString &userid,
|
||||||
|
const std::vector<QString> &devices);
|
||||||
|
|
||||||
// getters
|
// getters
|
||||||
QString state();
|
QString state();
|
||||||
|
@ -137,7 +141,7 @@ public:
|
||||||
QString transactionId() { return QString::fromStdString(this->transaction_id); }
|
QString transactionId() { return QString::fromStdString(this->transaction_id); }
|
||||||
// setters
|
// setters
|
||||||
void setDeviceId(QString deviceID);
|
void setDeviceId(QString deviceID);
|
||||||
void setEventId(std::string event_id);
|
void setEventId(const std::string &event_id);
|
||||||
bool isDeviceVerification() const
|
bool isDeviceVerification() const
|
||||||
{
|
{
|
||||||
return this->type == DeviceVerificationFlow::Type::ToDevice;
|
return this->type == DeviceVerificationFlow::Type::ToDevice;
|
||||||
|
@ -164,8 +168,8 @@ private:
|
||||||
DeviceVerificationFlow(QObject *,
|
DeviceVerificationFlow(QObject *,
|
||||||
DeviceVerificationFlow::Type flow_type,
|
DeviceVerificationFlow::Type flow_type,
|
||||||
TimelineModel *model,
|
TimelineModel *model,
|
||||||
QString userID,
|
const QString &userID,
|
||||||
std::vector<QString> deviceIds_);
|
const std::vector<QString> &deviceIds_);
|
||||||
void setState(State state)
|
void setState(State state)
|
||||||
{
|
{
|
||||||
if (state != state_) {
|
if (state != state_) {
|
||||||
|
|
|
@ -951,7 +951,7 @@ download_full_keybackup()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
lookup_keybackup(const std::string room, const std::string session_id)
|
lookup_keybackup(const std::string &room, const std::string &session_id)
|
||||||
{
|
{
|
||||||
if (!UserSettings::instance()->useOnlineKeyBackup()) {
|
if (!UserSettings::instance()->useOnlineKeyBackup()) {
|
||||||
// Online key backup disabled
|
// Online key backup disabled
|
||||||
|
@ -1283,7 +1283,7 @@ calculate_trust(const std::string &user_id, const MegolmSessionIndex &index)
|
||||||
//! Send encrypted to device messages, targets is a map from userid to device ids or {} for all
|
//! Send encrypted to device messages, targets is a map from userid to device ids or {} for all
|
||||||
//! devices
|
//! devices
|
||||||
void
|
void
|
||||||
send_encrypted_to_device_messages(const std::map<std::string, std::vector<std::string>> targets,
|
send_encrypted_to_device_messages(const std::map<std::string, std::vector<std::string>> &targets,
|
||||||
const mtx::events::collections::DeviceEvents &event,
|
const mtx::events::collections::DeviceEvents &event,
|
||||||
bool force_new_session)
|
bool force_new_session)
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,7 +72,7 @@ void
|
||||||
import_inbound_megolm_session(
|
import_inbound_megolm_session(
|
||||||
const mtx::events::DeviceEvent<mtx::events::msg::ForwardedRoomKey> &roomKey);
|
const mtx::events::DeviceEvent<mtx::events::msg::ForwardedRoomKey> &roomKey);
|
||||||
void
|
void
|
||||||
lookup_keybackup(const std::string room, const std::string session_id);
|
lookup_keybackup(const std::string &room, const std::string &session_id);
|
||||||
void
|
void
|
||||||
download_full_keybackup();
|
download_full_keybackup();
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ send_megolm_key_to_device(const std::string &user_id,
|
||||||
//! Send encrypted to device messages, targets is a map from userid to device ids or {} for all
|
//! Send encrypted to device messages, targets is a map from userid to device ids or {} for all
|
||||||
//! devices
|
//! devices
|
||||||
void
|
void
|
||||||
send_encrypted_to_device_messages(const std::map<std::string, std::vector<std::string>> targets,
|
send_encrypted_to_device_messages(const std::map<std::string, std::vector<std::string>> &targets,
|
||||||
const mtx::events::collections::DeviceEvents &event,
|
const mtx::events::collections::DeviceEvents &event,
|
||||||
bool force_new_session = false);
|
bool force_new_session = false);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,9 @@ SelfVerificationStatus::SelfVerificationStatus(QObject *o)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SelfVerificationStatus::setupCrosssigning(bool useSSSS, QString password, bool useOnlineKeyBackup)
|
SelfVerificationStatus::setupCrosssigning(bool useSSSS,
|
||||||
|
const QString &password,
|
||||||
|
bool useOnlineKeyBackup)
|
||||||
{
|
{
|
||||||
nhlog::db()->info("Clicked setup crossigning");
|
nhlog::db()->info("Clicked setup crossigning");
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@ public:
|
||||||
};
|
};
|
||||||
Q_ENUM(Status)
|
Q_ENUM(Status)
|
||||||
|
|
||||||
Q_INVOKABLE void setupCrosssigning(bool useSSSS, QString password, bool useOnlineKeyBackup);
|
Q_INVOKABLE void
|
||||||
|
setupCrosssigning(bool useSSSS, const QString &password, bool useOnlineKeyBackup);
|
||||||
Q_INVOKABLE void verifyMasterKey();
|
Q_INVOKABLE void verifyMasterKey();
|
||||||
Q_INVOKABLE void verifyMasterKeyWithPassphrase();
|
Q_INVOKABLE void verifyMasterKeyWithPassphrase();
|
||||||
Q_INVOKABLE void verifyUnverifiedDevices();
|
Q_INVOKABLE void verifyUnverifiedDevices();
|
||||||
|
|
|
@ -693,7 +693,7 @@ enum Categories
|
||||||
};
|
};
|
||||||
|
|
||||||
Categories
|
Categories
|
||||||
tagIdToCat(QString tagId)
|
tagIdToCat(const QString &tagId)
|
||||||
{
|
{
|
||||||
if (tagId.isEmpty())
|
if (tagId.isEmpty())
|
||||||
return World;
|
return World;
|
||||||
|
@ -757,7 +757,7 @@ FilteredCommunitiesModel::filterAcceptsRow(int sourceRow, const QModelIndex &) c
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantList
|
QVariantList
|
||||||
CommunitiesModel::spaceChildrenListFromIndex(QString room, int idx) const
|
CommunitiesModel::spaceChildrenListFromIndex(const QString &room, int idx) const
|
||||||
{
|
{
|
||||||
if (idx < -1)
|
if (idx < -1)
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -167,7 +167,7 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_INVOKABLE QVariantList spaceChildrenListFromIndex(QString room, int idx = -1) const;
|
Q_INVOKABLE QVariantList spaceChildrenListFromIndex(const QString &room, int idx = -1) const;
|
||||||
Q_INVOKABLE void updateSpaceStatus(QString space,
|
Q_INVOKABLE void updateSpaceStatus(QString space,
|
||||||
QString room,
|
QString room,
|
||||||
bool setParent,
|
bool setParent,
|
||||||
|
|
|
@ -43,8 +43,9 @@ EventStore::EventStore(std::string room_id, QObject *)
|
||||||
this,
|
this,
|
||||||
&EventStore::eventFetched,
|
&EventStore::eventFetched,
|
||||||
this,
|
this,
|
||||||
[this](
|
[this](const std::string &id,
|
||||||
std::string id, std::string relatedTo, mtx::events::collections::TimelineEvents timeline) {
|
const std::string &relatedTo,
|
||||||
|
mtx::events::collections::TimelineEvents timeline) {
|
||||||
cache::client()->storeEvent(room_id_, id, {timeline});
|
cache::client()->storeEvent(room_id_, id, {timeline});
|
||||||
|
|
||||||
if (!relatedTo.empty()) {
|
if (!relatedTo.empty()) {
|
||||||
|
|
|
@ -803,8 +803,8 @@ InputBar::command(const QString &command, QString args)
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
|
MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
|
||||||
QString mimetype,
|
const QString &mimetype,
|
||||||
QString originalFilename,
|
const QString &originalFilename,
|
||||||
bool encrypt,
|
bool encrypt,
|
||||||
QObject *parent)
|
QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
|
@ -911,7 +911,7 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
|
||||||
connect(mediaPlayer,
|
connect(mediaPlayer,
|
||||||
qOverload<const QString &, const QVariant &>(&QMediaPlayer::metaDataChanged),
|
qOverload<const QString &, const QVariant &>(&QMediaPlayer::metaDataChanged),
|
||||||
this,
|
this,
|
||||||
[this, mediaPlayer](QString t, QVariant) {
|
[this, mediaPlayer](const QString &t, const QVariant &) {
|
||||||
nhlog::ui()->debug("Got metadata {}", t.toStdString());
|
nhlog::ui()->debug("Got metadata {}", t.toStdString());
|
||||||
|
|
||||||
if (mediaPlayer->duration() > 0)
|
if (mediaPlayer->duration() > 0)
|
||||||
|
@ -1029,7 +1029,7 @@ MediaUpload::startUpload()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InputBar::finalizeUpload(MediaUpload *upload, QString url)
|
InputBar::finalizeUpload(MediaUpload *upload, const QString &url)
|
||||||
{
|
{
|
||||||
auto mime = upload->mimetype();
|
auto mime = upload->mimetype();
|
||||||
auto filename = upload->filename();
|
auto filename = upload->filename();
|
||||||
|
|
|
@ -83,8 +83,8 @@ public:
|
||||||
Q_ENUM(MediaType)
|
Q_ENUM(MediaType)
|
||||||
|
|
||||||
explicit MediaUpload(std::unique_ptr<QIODevice> data,
|
explicit MediaUpload(std::unique_ptr<QIODevice> data,
|
||||||
QString mimetype,
|
const QString &mimetype,
|
||||||
QString originalFilename,
|
const QString &originalFilename,
|
||||||
bool encrypt,
|
bool encrypt,
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ private slots:
|
||||||
void startTyping();
|
void startTyping();
|
||||||
void stopTyping();
|
void stopTyping();
|
||||||
|
|
||||||
void finalizeUpload(MediaUpload *upload, QString url);
|
void finalizeUpload(MediaUpload *upload, const QString &url);
|
||||||
void removeRunUpload(MediaUpload *upload);
|
void removeRunUpload(MediaUpload *upload);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -249,7 +249,7 @@ RoomlistModel::data(const QModelIndex &index, int role) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RoomlistModel::updateReadStatus(const std::map<QString, bool> roomReadStatus_)
|
RoomlistModel::updateReadStatus(const std::map<QString, bool> &roomReadStatus_)
|
||||||
{
|
{
|
||||||
std::vector<int> roomsToUpdate;
|
std::vector<int> roomsToUpdate;
|
||||||
roomsToUpdate.resize(roomReadStatus_.size());
|
roomsToUpdate.resize(roomReadStatus_.size());
|
||||||
|
@ -657,7 +657,7 @@ RoomlistModel::clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RoomlistModel::joinPreview(QString roomid)
|
RoomlistModel::joinPreview(const QString &roomid)
|
||||||
{
|
{
|
||||||
if (previewedRooms.contains(roomid)) {
|
if (previewedRooms.contains(roomid)) {
|
||||||
ChatPage::instance()->joinRoomVia(
|
ChatPage::instance()->joinRoomVia(
|
||||||
|
@ -742,7 +742,7 @@ RoomlistModel::getRoomPreviewById(QString roomid) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RoomlistModel::setCurrentRoom(QString roomid)
|
RoomlistModel::setCurrentRoom(const QString &roomid)
|
||||||
{
|
{
|
||||||
if ((currentRoom_ && currentRoom_->roomId() == roomid) ||
|
if ((currentRoom_ && currentRoom_->roomId() == roomid) ||
|
||||||
(currentRoomPreview_ && currentRoomPreview_->roomid() == roomid))
|
(currentRoomPreview_ && currentRoomPreview_->roomid() == roomid))
|
||||||
|
@ -1078,7 +1078,7 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FilteredRoomlistModel::toggleTag(QString roomid, QString tag, bool on)
|
FilteredRoomlistModel::toggleTag(const QString &roomid, const QString &tag, bool on)
|
||||||
{
|
{
|
||||||
if (on) {
|
if (on) {
|
||||||
http::client()->put_tag(
|
http::client()->put_tag(
|
||||||
|
|
|
@ -96,7 +96,7 @@ public slots:
|
||||||
void initializeRooms();
|
void initializeRooms();
|
||||||
void sync(const mtx::responses::Sync &sync_);
|
void sync(const mtx::responses::Sync &sync_);
|
||||||
void clear();
|
void clear();
|
||||||
int roomidToIndex(QString roomid)
|
int roomidToIndex(const QString &roomid)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (int)roomids.size(); i++) {
|
for (int i = 0; i < (int)roomids.size(); i++) {
|
||||||
if (roomids[i] == roomid)
|
if (roomids[i] == roomid)
|
||||||
|
@ -105,13 +105,13 @@ public slots:
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
void joinPreview(QString roomid);
|
void joinPreview(const QString &roomid);
|
||||||
void acceptInvite(QString roomid);
|
void acceptInvite(QString roomid);
|
||||||
void declineInvite(QString roomid);
|
void declineInvite(QString roomid);
|
||||||
void leave(QString roomid, QString reason = "");
|
void leave(QString roomid, QString reason = "");
|
||||||
TimelineModel *currentRoom() const { return currentRoom_.get(); }
|
TimelineModel *currentRoom() const { return currentRoom_.get(); }
|
||||||
RoomPreview currentRoomPreview() const { return currentRoomPreview_.value_or(RoomPreview{}); }
|
RoomPreview currentRoomPreview() const { return currentRoomPreview_.value_or(RoomPreview{}); }
|
||||||
void setCurrentRoom(QString roomid);
|
void setCurrentRoom(const QString &roomid);
|
||||||
void resetCurrentRoom()
|
void resetCurrentRoom()
|
||||||
{
|
{
|
||||||
currentRoom_ = nullptr;
|
currentRoom_ = nullptr;
|
||||||
|
@ -120,7 +120,7 @@ public slots:
|
||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateReadStatus(const std::map<QString, bool> roomReadStatus_);
|
void updateReadStatus(const std::map<QString, bool> &roomReadStatus_);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void totalUnreadMessageCountUpdated(int unreadMessages);
|
void totalUnreadMessageCountUpdated(int unreadMessages);
|
||||||
|
@ -173,7 +173,7 @@ public slots:
|
||||||
void acceptInvite(QString roomid) { roomlistmodel->acceptInvite(roomid); }
|
void acceptInvite(QString roomid) { roomlistmodel->acceptInvite(roomid); }
|
||||||
void declineInvite(QString roomid) { roomlistmodel->declineInvite(roomid); }
|
void declineInvite(QString roomid) { roomlistmodel->declineInvite(roomid); }
|
||||||
void leave(QString roomid, QString reason = "") { roomlistmodel->leave(roomid, reason); }
|
void leave(QString roomid, QString reason = "") { roomlistmodel->leave(roomid, reason); }
|
||||||
void toggleTag(QString roomid, QString tag, bool on);
|
void toggleTag(const QString &roomid, const QString &tag, bool on);
|
||||||
void copyLink(QString roomid);
|
void copyLink(QString roomid);
|
||||||
|
|
||||||
TimelineModel *currentRoom() const { return roomlistmodel->currentRoom(); }
|
TimelineModel *currentRoom() const { return roomlistmodel->currentRoom(); }
|
||||||
|
|
|
@ -1269,7 +1269,7 @@ TimelineModel::relatedInfo(const QString &id)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineModel::showReadReceipts(QString id)
|
TimelineModel::showReadReceipts(const QString &id)
|
||||||
{
|
{
|
||||||
emit openReadReceiptsDialog(new ReadReceiptsProxy{id, roomId(), this});
|
emit openReadReceiptsDialog(new ReadReceiptsProxy{id, roomId(), this});
|
||||||
}
|
}
|
||||||
|
@ -1372,7 +1372,7 @@ TimelineModel::markEventsAsRead(const std::vector<QString> &event_ids)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineModel::updateLastReadId(QString currentRoomId)
|
TimelineModel::updateLastReadId(const QString ¤tRoomId)
|
||||||
{
|
{
|
||||||
if (currentRoomId == room_id_) {
|
if (currentRoomId == room_id_) {
|
||||||
last_event_id = cache::getFullyReadEventId(room_id_.toStdString());
|
last_event_id = cache::getFullyReadEventId(room_id_.toStdString());
|
||||||
|
|
|
@ -285,7 +285,7 @@ public:
|
||||||
Q_INVOKABLE void openUserProfile(QString userid);
|
Q_INVOKABLE void openUserProfile(QString userid);
|
||||||
Q_INVOKABLE void unpin(const QString &id);
|
Q_INVOKABLE void unpin(const QString &id);
|
||||||
Q_INVOKABLE void pin(const QString &id);
|
Q_INVOKABLE void pin(const QString &id);
|
||||||
Q_INVOKABLE void showReadReceipts(QString id);
|
Q_INVOKABLE void showReadReceipts(const QString &id);
|
||||||
Q_INVOKABLE void redactEvent(const QString &id, const QString &reason = "");
|
Q_INVOKABLE void redactEvent(const QString &id, const QString &reason = "");
|
||||||
Q_INVOKABLE void redactAllFromUser(const QString &userid, const QString &reason = "");
|
Q_INVOKABLE void redactAllFromUser(const QString &userid, const QString &reason = "");
|
||||||
Q_INVOKABLE int idToIndex(const QString &id) const;
|
Q_INVOKABLE int idToIndex(const QString &id) const;
|
||||||
|
@ -349,7 +349,7 @@ public slots:
|
||||||
int currentIndex() const { return idToIndex(currentId); }
|
int currentIndex() const { return idToIndex(currentId); }
|
||||||
void eventShown();
|
void eventShown();
|
||||||
void markEventsAsRead(const std::vector<QString> &event_ids);
|
void markEventsAsRead(const std::vector<QString> &event_ids);
|
||||||
void updateLastReadId(QString currentRoomId);
|
void updateLastReadId(const QString ¤tRoomId);
|
||||||
void lastReadIdOnWindowFocus();
|
void lastReadIdOnWindowFocus();
|
||||||
void checkAfterFetch();
|
void checkAfterFetch();
|
||||||
QVariantMap getDump(const QString &eventId, const QString &relatedTo) const;
|
QVariantMap getDump(const QString &eventId, const QString &relatedTo) const;
|
||||||
|
|
|
@ -246,8 +246,8 @@ TimelineViewManager::escapeEmoji(QString str) const
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineViewManager::openImageOverlay(TimelineModel *room,
|
TimelineViewManager::openImageOverlay(TimelineModel *room,
|
||||||
QString mxcUrl,
|
const QString &mxcUrl,
|
||||||
QString eventId,
|
const QString &eventId,
|
||||||
double originalWidth,
|
double originalWidth,
|
||||||
double proportionalHeight)
|
double proportionalHeight)
|
||||||
{
|
{
|
||||||
|
@ -384,7 +384,7 @@ TimelineViewManager::focusMessageInput()
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject *
|
QObject *
|
||||||
TimelineViewManager::completerFor(QString completerName, QString roomId)
|
TimelineViewManager::completerFor(const QString &completerName, const QString &roomId)
|
||||||
{
|
{
|
||||||
if (completerName == QLatin1String("user")) {
|
if (completerName == QLatin1String("user")) {
|
||||||
auto userModel = new UsersModel(roomId.toStdString());
|
auto userModel = new UsersModel(roomId.toStdString());
|
||||||
|
|
|
@ -54,8 +54,8 @@ public:
|
||||||
Q_INVOKABLE bool isInitialSync() const { return isInitialSync_; }
|
Q_INVOKABLE bool isInitialSync() const { return isInitialSync_; }
|
||||||
bool isConnected() const { return isConnected_; }
|
bool isConnected() const { return isConnected_; }
|
||||||
Q_INVOKABLE void openImageOverlay(TimelineModel *room,
|
Q_INVOKABLE void openImageOverlay(TimelineModel *room,
|
||||||
QString mxcUrl,
|
const QString &mxcUrl,
|
||||||
QString eventId,
|
const QString &eventId,
|
||||||
double originalWidth,
|
double originalWidth,
|
||||||
double proportionalHeight);
|
double proportionalHeight);
|
||||||
Q_INVOKABLE void openImagePackSettings(QString roomid);
|
Q_INVOKABLE void openImagePackSettings(QString roomid);
|
||||||
|
@ -112,7 +112,8 @@ public slots:
|
||||||
|
|
||||||
void setVideoCallItem();
|
void setVideoCallItem();
|
||||||
|
|
||||||
QObject *completerFor(QString completerName, QString roomId = QLatin1String(QLatin1String("")));
|
QObject *completerFor(const QString &completerName,
|
||||||
|
const QString &roomId = QLatin1String(QLatin1String("")));
|
||||||
void forwardMessageToRoom(mtx::events::collections::TimelineEvents *e, QString roomId);
|
void forwardMessageToRoom(mtx::events::collections::TimelineEvents *e, QString roomId);
|
||||||
|
|
||||||
RoomlistModel *rooms() { return rooms_; }
|
RoomlistModel *rooms() { return rooms_; }
|
||||||
|
|
|
@ -42,7 +42,7 @@ MxcMediaProxy::MxcMediaProxy(QObject *parent)
|
||||||
});
|
});
|
||||||
connect(this,
|
connect(this,
|
||||||
qOverload<const QString &, const QVariant &>(&MxcMediaProxy::metaDataChanged),
|
qOverload<const QString &, const QVariant &>(&MxcMediaProxy::metaDataChanged),
|
||||||
[this](QString t, QVariant) {
|
[this](const QString &t, const QVariant &) {
|
||||||
if (t == QMediaMetaData::Orientation)
|
if (t == QMediaMetaData::Orientation)
|
||||||
emit orientationChanged();
|
emit orientationChanged();
|
||||||
});
|
});
|
||||||
|
|
|
@ -137,9 +137,9 @@ Nheko::setTransientParent(QWindow *window, QWindow *parentWindow) const
|
||||||
|
|
||||||
void
|
void
|
||||||
Nheko::createRoom(bool space,
|
Nheko::createRoom(bool space,
|
||||||
QString name,
|
const QString &name,
|
||||||
QString topic,
|
const QString &topic,
|
||||||
QString aliasLocalpart,
|
const QString &aliasLocalpart,
|
||||||
bool isEncrypted,
|
bool isEncrypted,
|
||||||
int preset)
|
int preset)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,9 +57,9 @@ public:
|
||||||
Q_INVOKABLE void showUserSettingsPage() const;
|
Q_INVOKABLE void showUserSettingsPage() const;
|
||||||
Q_INVOKABLE void logout() const;
|
Q_INVOKABLE void logout() const;
|
||||||
Q_INVOKABLE void createRoom(bool space,
|
Q_INVOKABLE void createRoom(bool space,
|
||||||
QString name,
|
const QString &name,
|
||||||
QString topic,
|
const QString &topic,
|
||||||
QString aliasLocalpart,
|
const QString &aliasLocalpart,
|
||||||
bool isEncrypted,
|
bool isEncrypted,
|
||||||
int preset);
|
int preset);
|
||||||
Q_INVOKABLE PowerlevelEditingModels *editPowerlevels(QString room_id_) const
|
Q_INVOKABLE PowerlevelEditingModels *editPowerlevels(QString room_id_) const
|
||||||
|
|
|
@ -35,14 +35,14 @@ RoomSettings::RoomSettings(QString roomid, QObject *parent)
|
||||||
"global",
|
"global",
|
||||||
"override",
|
"override",
|
||||||
roomid_.toStdString(),
|
roomid_.toStdString(),
|
||||||
[this](const mtx::pushrules::PushRule &rule, mtx::http::RequestErr &err) {
|
[this](const mtx::pushrules::PushRule &rule, mtx::http::RequestErr err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err->status_code == 404)
|
if (err->status_code == 404)
|
||||||
http::client()->get_pushrules(
|
http::client()->get_pushrules(
|
||||||
"global",
|
"global",
|
||||||
"room",
|
"room",
|
||||||
roomid_.toStdString(),
|
roomid_.toStdString(),
|
||||||
[this](const mtx::pushrules::PushRule &rule, mtx::http::RequestErr &err) {
|
[this](const mtx::pushrules::PushRule &rule, mtx::http::RequestErr err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
notifications_ = 2; // all messages
|
notifications_ = 2; // all messages
|
||||||
emit notificationsChanged();
|
emit notificationsChanged();
|
||||||
|
@ -424,7 +424,7 @@ RoomSettings::changeAccessRules(bool private_,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RoomSettings::changeName(QString name)
|
RoomSettings::changeName(const QString &name)
|
||||||
{
|
{
|
||||||
// Check if the values are changed from the originals.
|
// Check if the values are changed from the originals.
|
||||||
auto newName = name.trimmed().toStdString();
|
auto newName = name.trimmed().toStdString();
|
||||||
|
@ -435,7 +435,7 @@ RoomSettings::changeName(QString name)
|
||||||
|
|
||||||
using namespace mtx::events;
|
using namespace mtx::events;
|
||||||
auto proxy = std::make_shared<ThreadProxy>();
|
auto proxy = std::make_shared<ThreadProxy>();
|
||||||
connect(proxy.get(), &ThreadProxy::nameEventSent, this, [this](QString newRoomName) {
|
connect(proxy.get(), &ThreadProxy::nameEventSent, this, [this](const QString &newRoomName) {
|
||||||
this->info_.name = newRoomName.toStdString();
|
this->info_.name = newRoomName.toStdString();
|
||||||
emit roomNameChanged();
|
emit roomNameChanged();
|
||||||
});
|
});
|
||||||
|
@ -458,7 +458,7 @@ RoomSettings::changeName(QString name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RoomSettings::changeTopic(QString topic)
|
RoomSettings::changeTopic(const QString &topic)
|
||||||
{
|
{
|
||||||
// Check if the values are changed from the originals.
|
// Check if the values are changed from the originals.
|
||||||
auto newTopic = topic.trimmed().toStdString();
|
auto newTopic = topic.trimmed().toStdString();
|
||||||
|
@ -469,7 +469,7 @@ RoomSettings::changeTopic(QString topic)
|
||||||
|
|
||||||
using namespace mtx::events;
|
using namespace mtx::events;
|
||||||
auto proxy = std::make_shared<ThreadProxy>();
|
auto proxy = std::make_shared<ThreadProxy>();
|
||||||
connect(proxy.get(), &ThreadProxy::topicEventSent, this, [this](QString newRoomTopic) {
|
connect(proxy.get(), &ThreadProxy::topicEventSent, this, [this](const QString &newRoomTopic) {
|
||||||
this->info_.topic = newRoomTopic.toStdString();
|
this->info_.topic = newRoomTopic.toStdString();
|
||||||
emit roomTopicChanged();
|
emit roomTopicChanged();
|
||||||
});
|
});
|
||||||
|
|
|
@ -138,8 +138,8 @@ public:
|
||||||
bool knockingAllowed,
|
bool knockingAllowed,
|
||||||
bool restrictedAllowed);
|
bool restrictedAllowed);
|
||||||
Q_INVOKABLE void changeNotifications(int currentIndex);
|
Q_INVOKABLE void changeNotifications(int currentIndex);
|
||||||
Q_INVOKABLE void changeTopic(QString topic);
|
Q_INVOKABLE void changeTopic(const QString &topic);
|
||||||
Q_INVOKABLE void changeName(QString name);
|
Q_INVOKABLE void changeName(const QString &name);
|
||||||
|
|
||||||
Q_INVOKABLE void applyAllowedFromModel();
|
Q_INVOKABLE void applyAllowedFromModel();
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ UIA::genericHandler(QString context)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UIA::continuePassword(QString password)
|
UIA::continuePassword(const QString &password)
|
||||||
{
|
{
|
||||||
mtx::user_interactive::auth::Password p{};
|
mtx::user_interactive::auth::Password p{};
|
||||||
p.identifier_type = mtx::user_interactive::auth::Password::UserId;
|
p.identifier_type = mtx::user_interactive::auth::Password::UserId;
|
||||||
|
@ -176,7 +176,7 @@ UIA::continuePassword(QString password)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UIA::continueEmail(QString email)
|
UIA::continueEmail(const QString &email)
|
||||||
{
|
{
|
||||||
mtx::requests::RequestEmailToken r{};
|
mtx::requests::RequestEmailToken r{};
|
||||||
r.client_secret = this->client_secret = mtx::client::utils::random_token(128, false);
|
r.client_secret = this->client_secret = mtx::client::utils::random_token(128, false);
|
||||||
|
@ -207,7 +207,7 @@ UIA::continueEmail(QString email)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
UIA::continuePhoneNumber(QString countryCode, QString phoneNumber)
|
UIA::continuePhoneNumber(const QString &countryCode, const QString &phoneNumber)
|
||||||
{
|
{
|
||||||
mtx::requests::RequestMSISDNToken r{};
|
mtx::requests::RequestMSISDNToken r{};
|
||||||
r.client_secret = this->client_secret = mtx::client::utils::random_token(128, false);
|
r.client_secret = this->client_secret = mtx::client::utils::random_token(128, false);
|
||||||
|
@ -257,7 +257,7 @@ UIA::continue3pidReceived()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UIA::submit3pidToken(QString token)
|
UIA::submit3pidToken(const QString &token)
|
||||||
{
|
{
|
||||||
mtx::requests::IdentitySubmitToken t{};
|
mtx::requests::IdentitySubmitToken t{};
|
||||||
t.client_secret = this->client_secret;
|
t.client_secret = this->client_secret;
|
||||||
|
|
|
@ -28,10 +28,10 @@ public:
|
||||||
QString title() const { return title_; }
|
QString title() const { return title_; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void continuePassword(QString password);
|
void continuePassword(const QString &password);
|
||||||
void continueEmail(QString email);
|
void continueEmail(const QString &email);
|
||||||
void continuePhoneNumber(QString countryCode, QString phoneNumber);
|
void continuePhoneNumber(const QString &countryCode, const QString &phoneNumber);
|
||||||
void submit3pidToken(QString token);
|
void submit3pidToken(const QString &token);
|
||||||
void continue3pidReceived();
|
void continue3pidReceived();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -21,18 +21,17 @@
|
||||||
#include "timeline/TimelineViewManager.h"
|
#include "timeline/TimelineViewManager.h"
|
||||||
#include "ui/UIA.h"
|
#include "ui/UIA.h"
|
||||||
|
|
||||||
UserProfile::UserProfile(QString roomid,
|
UserProfile::UserProfile(const QString &roomid,
|
||||||
QString userid,
|
const QString &userid,
|
||||||
TimelineViewManager *manager_,
|
TimelineViewManager *manager_,
|
||||||
TimelineModel *parent)
|
TimelineModel *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, roomid_(roomid)
|
, roomid_(roomid)
|
||||||
, userid_(userid)
|
, userid_(userid)
|
||||||
|
, globalAvatarUrl{QLatin1String("")}
|
||||||
, manager(manager_)
|
, manager(manager_)
|
||||||
, model(parent)
|
, model(parent)
|
||||||
{
|
{
|
||||||
globalAvatarUrl = QLatin1String("");
|
|
||||||
|
|
||||||
connect(this,
|
connect(this,
|
||||||
&UserProfile::globalUsernameRetrieved,
|
&UserProfile::globalUsernameRetrieved,
|
||||||
this,
|
this,
|
||||||
|
@ -325,7 +324,7 @@ UserProfile::startChat()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UserProfile::changeUsername(QString username)
|
UserProfile::changeUsername(const QString &username)
|
||||||
{
|
{
|
||||||
if (isGlobalUserProfile()) {
|
if (isGlobalUserProfile()) {
|
||||||
// change global
|
// change global
|
||||||
|
@ -349,7 +348,7 @@ UserProfile::changeUsername(QString username)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UserProfile::changeDeviceName(QString deviceID, QString deviceName)
|
UserProfile::changeDeviceName(const QString &deviceID, const QString &deviceName)
|
||||||
{
|
{
|
||||||
http::client()->set_device_name(
|
http::client()->set_device_name(
|
||||||
deviceID.toStdString(), deviceName.toStdString(), [this](mtx::http::RequestErr err) {
|
deviceID.toStdString(), deviceName.toStdString(), [this](mtx::http::RequestErr err) {
|
||||||
|
@ -372,7 +371,7 @@ UserProfile::verify(QString device)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UserProfile::unverify(QString device)
|
UserProfile::unverify(const QString &device)
|
||||||
{
|
{
|
||||||
cache::markDeviceUnverified(userid_.toStdString(), device.toStdString());
|
cache::markDeviceUnverified(userid_.toStdString(), device.toStdString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,8 +134,8 @@ class UserProfile : public QObject
|
||||||
Q_PROPERTY(bool isSelf READ isSelf CONSTANT)
|
Q_PROPERTY(bool isSelf READ isSelf CONSTANT)
|
||||||
Q_PROPERTY(TimelineModel *room READ room CONSTANT)
|
Q_PROPERTY(TimelineModel *room READ room CONSTANT)
|
||||||
public:
|
public:
|
||||||
UserProfile(QString roomid,
|
UserProfile(const QString &roomid,
|
||||||
QString userid,
|
const QString &userid,
|
||||||
TimelineViewManager *manager_,
|
TimelineViewManager *manager_,
|
||||||
TimelineModel *parent = nullptr);
|
TimelineModel *parent = nullptr);
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ public:
|
||||||
TimelineModel *room() const { return model; }
|
TimelineModel *room() const { return model; }
|
||||||
|
|
||||||
Q_INVOKABLE void verify(QString device = QLatin1String(""));
|
Q_INVOKABLE void verify(QString device = QLatin1String(""));
|
||||||
Q_INVOKABLE void unverify(QString device = QLatin1String(""));
|
Q_INVOKABLE void unverify(const QString &device = QLatin1String(""));
|
||||||
Q_INVOKABLE void fetchDeviceList(const QString &userID);
|
Q_INVOKABLE void fetchDeviceList(const QString &userID);
|
||||||
Q_INVOKABLE void refreshDevices();
|
Q_INVOKABLE void refreshDevices();
|
||||||
Q_INVOKABLE void banUser();
|
Q_INVOKABLE void banUser();
|
||||||
|
@ -161,8 +161,8 @@ public:
|
||||||
Q_INVOKABLE void kickUser();
|
Q_INVOKABLE void kickUser();
|
||||||
Q_INVOKABLE void startChat();
|
Q_INVOKABLE void startChat();
|
||||||
Q_INVOKABLE void startChat(bool encryptionEnabled);
|
Q_INVOKABLE void startChat(bool encryptionEnabled);
|
||||||
Q_INVOKABLE void changeUsername(QString username);
|
Q_INVOKABLE void changeUsername(const QString &username);
|
||||||
Q_INVOKABLE void changeDeviceName(QString deviceID, QString deviceName);
|
Q_INVOKABLE void changeDeviceName(const QString &deviceID, const QString &deviceName);
|
||||||
Q_INVOKABLE void changeAvatar();
|
Q_INVOKABLE void changeAvatar();
|
||||||
Q_INVOKABLE void openGlobalProfile();
|
Q_INVOKABLE void openGlobalProfile();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue