Change username, prepare privacy setting rules
This commit is contained in:
parent
3a59ec54ba
commit
f0d14bc440
14 changed files with 207 additions and 47 deletions
|
@ -33,6 +33,7 @@ Page {
|
|||
onOwnUserUpdated: {
|
||||
firstNameEditArea.text = userInformation.first_name;
|
||||
lastNameEditArea.text = userInformation.last_name;
|
||||
userNameEditArea.text = userInformation.username;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,15 +54,22 @@ Page {
|
|||
text: qsTr("User Profile")
|
||||
}
|
||||
|
||||
Grid {
|
||||
width: parent.width - ( 2 * Theme.horizontalPageMargin )
|
||||
columns: landscapeLayout ? 2 : 1
|
||||
columnSpacing: Theme.horizontalPageMargin
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
readonly property real columnWidth: width/columns
|
||||
|
||||
InformationEditArea {
|
||||
id: firstNameEditArea
|
||||
visible: true
|
||||
canEdit: true
|
||||
headerText: qsTr("First Name", "first name of the logged-in profile - header")
|
||||
text: tdLibWrapper.getUserInformation().first_name
|
||||
width: parent.width - ( 2 * Theme.horizontalPageMargin )
|
||||
width: parent.columnWidth
|
||||
headerLeftAligned: true
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
onSaveButtonClicked: {
|
||||
if(!editItem.errorHighlight) {
|
||||
|
@ -90,9 +98,8 @@ Page {
|
|||
canEdit: true
|
||||
headerText: qsTr("Last Name", "last name of the logged-in profile - header")
|
||||
text: tdLibWrapper.getUserInformation().last_name
|
||||
width: parent.width - ( 2 * Theme.horizontalPageMargin )
|
||||
width: parent.columnWidth
|
||||
headerLeftAligned: true
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
onSaveButtonClicked: {
|
||||
if(!editItem.errorHighlight) {
|
||||
|
@ -115,6 +122,22 @@ Page {
|
|||
}
|
||||
}
|
||||
|
||||
InformationEditArea {
|
||||
id: userNameEditArea
|
||||
visible: true
|
||||
canEdit: true
|
||||
headerText: qsTr("Username", "user name of the logged-in profile - header")
|
||||
text: tdLibWrapper.getUserInformation().username
|
||||
width: parent.columnWidth
|
||||
headerLeftAligned: true
|
||||
|
||||
onSaveButtonClicked: {
|
||||
tdLibWrapper.setUsername(textValue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SectionHeader {
|
||||
text: qsTr("Behavior")
|
||||
}
|
||||
|
|
|
@ -1188,6 +1188,68 @@ void TDLibWrapper::setName(const QString &firstName, const QString &lastName)
|
|||
this->sendRequest(requestObject);
|
||||
}
|
||||
|
||||
void TDLibWrapper::setUsername(const QString &userName)
|
||||
{
|
||||
LOG("Set username of current user" << userName);
|
||||
QVariantMap requestObject;
|
||||
requestObject.insert(_TYPE, "setUsername");
|
||||
requestObject.insert("username", userName);
|
||||
|
||||
this->sendRequest(requestObject);
|
||||
}
|
||||
|
||||
void TDLibWrapper::setUserPrivacySettingRule(TDLibWrapper::UserPrivacySetting setting, TDLibWrapper::UserPrivacySettingRule rule)
|
||||
{
|
||||
LOG("Set user privecy setting rule of current user" << setting << rule);
|
||||
QVariantMap requestObject;
|
||||
requestObject.insert(_TYPE, "setUserPrivacySettingRules");
|
||||
|
||||
QVariantMap settingMap;
|
||||
switch (setting) {
|
||||
case SettingShowStatus:
|
||||
settingMap.insert(_TYPE, "userPrivacySettingShowStatus");
|
||||
break;
|
||||
case SettingShowPhoneNumber:
|
||||
settingMap.insert(_TYPE, "userPrivacySettingShowPhoneNumber");
|
||||
break;
|
||||
case SettingAllowChatInvites:
|
||||
settingMap.insert(_TYPE, "userPrivacySettingAllowChatInvites");
|
||||
break;
|
||||
case SettingShowProfilePhoto:
|
||||
settingMap.insert(_TYPE, "userPrivacySettingShowProfilePhoto");
|
||||
break;
|
||||
case SettingAllowFindingByPhoneNumber:
|
||||
settingMap.insert(_TYPE, "userPrivacySettingAllowFindingByPhoneNumber");
|
||||
break;
|
||||
case SettingShowLinkInForwardedMessages:
|
||||
settingMap.insert(_TYPE, "userPrivacySettingShowLinkInForwardedMessages");
|
||||
break;
|
||||
}
|
||||
requestObject.insert("setting", settingMap);
|
||||
|
||||
|
||||
QVariantMap ruleMap;
|
||||
switch (rule) {
|
||||
case RuleAllowAll:
|
||||
ruleMap.insert(_TYPE, "userPrivacySettingRuleAllowAll");
|
||||
break;
|
||||
case RuleAllowContacts:
|
||||
ruleMap.insert(_TYPE, "userPrivacySettingRuleAllowContacts");
|
||||
break;
|
||||
case RuleRestrictAll:
|
||||
ruleMap.insert(_TYPE, "userPrivacySettingRuleRestrictAll");
|
||||
break;
|
||||
case RuleRestrictContacts:
|
||||
ruleMap.insert(_TYPE, "userPrivacySettingRuleRestrictContacts");
|
||||
break;
|
||||
}
|
||||
QVariantList ruleMaps;
|
||||
ruleMaps.append(ruleMap);
|
||||
requestObject.insert("rules", ruleMaps);
|
||||
|
||||
this->sendRequest(requestObject);
|
||||
}
|
||||
|
||||
void TDLibWrapper::searchEmoji(const QString &queryString)
|
||||
{
|
||||
LOG("Searching emoji" << queryString);
|
||||
|
|
|
@ -89,6 +89,24 @@ public:
|
|||
};
|
||||
Q_ENUM(SecretChatState)
|
||||
|
||||
enum UserPrivacySetting {
|
||||
SettingAllowChatInvites,
|
||||
SettingAllowFindingByPhoneNumber,
|
||||
SettingShowLinkInForwardedMessages,
|
||||
SettingShowPhoneNumber,
|
||||
SettingShowProfilePhoto,
|
||||
SettingShowStatus
|
||||
};
|
||||
Q_ENUM(UserPrivacySetting)
|
||||
|
||||
enum UserPrivacySettingRule {
|
||||
RuleAllowAll,
|
||||
RuleAllowContacts,
|
||||
RuleRestrictAll,
|
||||
RuleRestrictContacts
|
||||
};
|
||||
Q_ENUM(UserPrivacySettingRule)
|
||||
|
||||
class Group {
|
||||
public:
|
||||
Group(qlonglong id) : groupId(id) { }
|
||||
|
@ -197,6 +215,8 @@ public:
|
|||
Q_INVOKABLE void cancelUploadFile(int fileId);
|
||||
Q_INVOKABLE void deleteFile(int fileId);
|
||||
Q_INVOKABLE void setName(const QString &firstName, const QString &lastName);
|
||||
Q_INVOKABLE void setUsername(const QString &userName);
|
||||
Q_INVOKABLE void setUserPrivacySettingRule(UserPrivacySetting setting, UserPrivacySettingRule rule);
|
||||
|
||||
// Others (candidates for extraction ;))
|
||||
Q_INVOKABLE void searchEmoji(const QString &queryString);
|
||||
|
|
|
@ -1530,6 +1530,11 @@
|
|||
<source>Enter 0-64 characters</source>
|
||||
<translation type="unfinished">Geben Sie 1-128 Zeichen ein {0-64 ?}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Username</source>
|
||||
<comment>user name of the logged-in profile - header</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
|
|
|
@ -1530,6 +1530,11 @@
|
|||
<source>Enter 0-64 characters</source>
|
||||
<translation type="unfinished">Enter 1-128 characters {0-64 ?}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Username</source>
|
||||
<comment>user name of the logged-in profile - header</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
|
|
|
@ -1530,6 +1530,11 @@
|
|||
<source>Enter 0-64 characters</source>
|
||||
<translation type="unfinished">Marcar caracteres 1-128 {0-64 ?}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Username</source>
|
||||
<comment>user name of the logged-in profile - header</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
|
|
|
@ -1531,6 +1531,11 @@
|
|||
<source>Enter 0-64 characters</source>
|
||||
<translation type="unfinished">Syötä 1-128 merkkiä {0-64 ?}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Username</source>
|
||||
<comment>user name of the logged-in profile - header</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
|
|
|
@ -1505,6 +1505,11 @@
|
|||
<source>Enter 0-64 characters</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Username</source>
|
||||
<comment>user name of the logged-in profile - header</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
|
|
|
@ -1530,6 +1530,11 @@
|
|||
<source>Enter 0-64 characters</source>
|
||||
<translation type="unfinished">Inserisci da 1 a 128 caratteri {0-64 ?}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Username</source>
|
||||
<comment>user name of the logged-in profile - header</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
|
|
|
@ -1555,6 +1555,11 @@
|
|||
<source>Enter 0-64 characters</source>
|
||||
<translation type="unfinished">Wprowadź znaki 1-128 {0-64 ?}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Username</source>
|
||||
<comment>user name of the logged-in profile - header</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
|
|
|
@ -1555,6 +1555,11 @@
|
|||
<source>Enter 0-64 characters</source>
|
||||
<translation type="unfinished">Введите 1-128 символов {0-64 ?}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Username</source>
|
||||
<comment>user name of the logged-in profile - header</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
|
|
|
@ -1530,6 +1530,11 @@
|
|||
<source>Enter 0-64 characters</source>
|
||||
<translation type="unfinished">Ange 1-128 tecken {0-64 ?}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Username</source>
|
||||
<comment>user name of the logged-in profile - header</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
|
|
|
@ -1505,6 +1505,11 @@
|
|||
<source>Enter 0-64 characters</source>
|
||||
<translation type="unfinished">输入 1-128 个字符 {0-64 ?}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Username</source>
|
||||
<comment>user name of the logged-in profile - header</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
|
|
|
@ -1530,6 +1530,11 @@
|
|||
<source>Enter 0-64 characters</source>
|
||||
<translation type="unfinished">Enter 1-128 characters {0-64 ?}</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Username</source>
|
||||
<comment>user name of the logged-in profile - header</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
|
|
Loading…
Reference in a new issue