diff --git a/src/core/toxid.h b/src/core/toxid.h index b107f6762..ae4ab21a4 100644 --- a/src/core/toxid.h +++ b/src/core/toxid.h @@ -41,9 +41,9 @@ class ToxId public: ToxId(); ///< The default constructor. Creates an empty Tox ID. ToxId(const ToxId& other); ///< The copy constructor. - ToxId(const QString& id); ///< Create a Tox ID from QString. - /// If the given id is not a valid Tox ID, then: - /// publicKey == id and noSpam == "" == checkSum. + explicit ToxId(const QString& id); ///< Create a Tox ID from QString. + /// If the given id is not a valid Tox ID, then: + /// publicKey == id and noSpam == "" == checkSum. bool operator==(const ToxId& other) const; ///< Compares only publicKey. bool operator!=(const ToxId& other) const; ///< Compares only publicKey. diff --git a/src/widget/about/aboutuser.cpp b/src/widget/about/aboutuser.cpp index 267ed6788..8a2856dbf 100644 --- a/src/widget/about/aboutuser.cpp +++ b/src/widget/about/aboutuser.cpp @@ -94,7 +94,8 @@ void AboutUser::onSelectDirClicked() */ void AboutUser::onAcceptedClicked() { - Settings::getInstance().setContactNote(ui->publicKey->text(), ui->note->toPlainText()); + ToxId toxId = ToxId(ui->publicKey->text()); + Settings::getInstance().setContactNote(toxId, ui->note->toPlainText()); Settings::getInstance().saveGlobal(); } diff --git a/src/widget/form/profileform.cpp b/src/widget/form/profileform.cpp index 8d9156c94..e9c3b0f53 100644 --- a/src/widget/form/profileform.cpp +++ b/src/widget/form/profileform.cpp @@ -523,7 +523,7 @@ void ProfileForm::onRegisterButtonClicked() Core* oldCore = Core::getInstance(); Toxme::ExecCode code = Toxme::ExecCode::Ok; - QString response = Toxme::createAddress(code, server, id, name, privacy, bio); + QString response = Toxme::createAddress(code, server, ToxId(id), name, privacy, bio); Core* newCore = Core::getInstance(); // Make sure the user didn't logout (or logout and login) diff --git a/src/widget/form/tabcompleter.cpp b/src/widget/form/tabcompleter.cpp index 6252010af..38f5a13a2 100644 --- a/src/widget/form/tabcompleter.cpp +++ b/src/widget/form/tabcompleter.cpp @@ -62,7 +62,10 @@ void TabCompleter::buildCompletionList() for (auto name : group->getPeerList()) { if (regex.indexIn(name) > -1) - completionMap[name.toLower()] = name; + { + SortableString lower = SortableString(name.toLower()); + completionMap[lower] = name; + } } nextCompletion = completionMap.begin(); diff --git a/src/widget/form/tabcompleter.h b/src/widget/form/tabcompleter.h index 919fdf57b..fe447853d 100644 --- a/src/widget/form/tabcompleter.h +++ b/src/widget/form/tabcompleter.h @@ -45,7 +45,7 @@ public slots: private: struct SortableString { - inline SortableString(const QString &n) : contents{n} {} + explicit SortableString(const QString &n) : contents{n} {} bool operator<(const SortableString &other) const; QString contents; }; diff --git a/src/widget/passwordedit.h b/src/widget/passwordedit.h index 724506e99..72f62be7e 100644 --- a/src/widget/passwordedit.h +++ b/src/widget/passwordedit.h @@ -7,7 +7,7 @@ class PasswordEdit : public QLineEdit { public: - PasswordEdit(QWidget *parent); + explicit PasswordEdit(QWidget *parent); ~PasswordEdit(); protected: