Add option to call only when registered or not in Settings. Deactivated by default.

This commit is contained in:
Julien Wadel 2021-08-09 11:15:51 +02:00
parent f0ec8daed0
commit 79703ea51b
21 changed files with 188 additions and 5 deletions

View file

@ -1693,6 +1693,16 @@ Klik her: <a href="%1">%1</a>
<source>encryptionMandatoryLabel</source>
<translation>Krydning er obligatorisk</translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -1693,6 +1693,16 @@ Klicken Sie hier: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>encryptionMandatoryLabel</source>
<translation>Verschlüsselung ist obligatorisch</translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -1698,6 +1698,16 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>encryptionMandatoryLabel</source>
<translation>Encryption is mandatory</translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation>Hide empty chat rooms</translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation>Call when registered</translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -1693,6 +1693,16 @@ Haga clic aquí: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<source>encryptionMandatoryLabel</source>
<translation>El cifrado es obligatorio</translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -1693,6 +1693,16 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>encryptionMandatoryLabel</source>
<translation>Chiffrement obligatoire</translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -1687,6 +1687,16 @@ Kattintson ide: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>encryptionMandatoryLabel</source>
<translation>A titkosítás kötelező</translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -1693,6 +1693,16 @@ Clicca: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>encryptionMandatoryLabel</source>
<translation>La crittografia è obbligatoria</translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -1687,6 +1687,16 @@ Ephemeral message is only supported in conference based chat room!&apos;</extrac
<source>encryptionMandatoryLabel</source>
<translation></translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -1699,6 +1699,16 @@ Spustelėkite čia: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>encryptionMandatoryLabel</source>
<translation>Šifravimas yra privalomas</translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -1693,6 +1693,16 @@ Clique aqui: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<source>encryptionMandatoryLabel</source>
<translation>A criptografia é obrigatória</translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -1699,6 +1699,16 @@ Ephemeral message is only supported in conference based chat room!&apos;</extrac
<source>encryptionMandatoryLabel</source>
<translation>Регистрация обязательна</translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -1693,6 +1693,16 @@ Klicka här: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>encryptionMandatoryLabel</source>
<translation>Kryptering är obligatorisk</translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -1687,6 +1687,16 @@ Buraya tıklayın: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>encryptionMandatoryLabel</source>
<translation>Şifreleme zorunludur</translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -1699,6 +1699,16 @@ Ephemeral message is only supported in conference based chat room!&apos;</extrac
<source>encryptionMandatoryLabel</source>
<translation>Обов&apos;язковий заселення</translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -1687,6 +1687,16 @@ Ephemeral message is only supported in conference based chat room!&apos;</extrac
<source>encryptionMandatoryLabel</source>
<translation></translation>
</message>
<message>
<source>hideEmptyChatRoomsLabel</source>
<extracomment>&apos;Hide empty chat rooms&apos; : Label for a switch to choose if Linphone hide empty chat rooms</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>waitRegistrationForCallLabel</source>
<extracomment>&apos;Call when registered&apos; : Label on switch to choose if calls are make when the current proxy is registered</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsLdap</name>

View file

@ -120,7 +120,7 @@ void CallsListModel::launchAudioCall (const QString &sipAddress, const QHash<QSt
CallModel::setRecordFile(params, Utils::coreStringToAppString(address->getUsername()));
shared_ptr<linphone::ProxyConfig> currentProxyConfig = core->getDefaultProxyConfig();
if(currentProxyConfig){
if(currentProxyConfig->getState() == linphone::RegistrationState::Ok)
if(!CoreManager::getInstance()->getSettingsModel()->getWaitRegistrationForCall() || currentProxyConfig->getState() == linphone::RegistrationState::Ok)
core->inviteAddressWithParams(address, params);
else{
QObject * context = new QObject();
@ -157,7 +157,7 @@ void CallsListModel::launchSecureAudioCall (const QString &sipAddress, LinphoneE
shared_ptr<linphone::ProxyConfig> currentProxyConfig = core->getDefaultProxyConfig();
params->setMediaEncryption(LinphoneEnums::toLinphone(encryption));
if(currentProxyConfig){
if(currentProxyConfig->getState() == linphone::RegistrationState::Ok)
if(!CoreManager::getInstance()->getSettingsModel()->getWaitRegistrationForCall() || currentProxyConfig->getState() == linphone::RegistrationState::Ok)
core->inviteAddressWithParams(address, params);
else{
QObject * context = new QObject();

View file

@ -622,6 +622,17 @@ void SettingsModel::setHideEmptyChatRooms(const bool& status){
mConfig->setInt("misc", "hide_empty_chat_rooms", status);
emit hideEmptyChatRoomsChanged(status);
}
// -----------------------------------------------------------------------------
bool SettingsModel::getWaitRegistrationForCall() const{
return !!mConfig->getInt(UiSection, "call_wait_registration", 0);
}
void SettingsModel::setWaitRegistrationForCall(const bool& status){
mConfig->setInt(UiSection, "call_wait_registration", status);
emit waitRegistrationForCallChanged(status);
}
// -----------------------------------------------------------------------------

View file

@ -105,7 +105,8 @@ class SettingsModel : public QObject {
Q_PROPERTY(bool chatEnabled READ getChatEnabled WRITE setChatEnabled NOTIFY chatEnabledChanged)
Q_PROPERTY(bool hideEmptyChatRooms READ getHideEmptyChatRooms WRITE setHideEmptyChatRooms NOTIFY hideEmptyChatRoomsChanged)
Q_PROPERTY(bool waitRegistrationForCall READ getWaitRegistrationForCall WRITE setWaitRegistrationForCall NOTIFY waitRegistrationForCallChanged)// Allow call only if the current proxy has been registered
Q_PROPERTY(bool conferenceEnabled READ getConferenceEnabled WRITE setConferenceEnabled NOTIFY conferenceEnabledChanged)
Q_PROPERTY(bool chatNotificationSoundEnabled READ getChatNotificationSoundEnabled WRITE setChatNotificationSoundEnabled NOTIFY chatNotificationSoundEnabledChanged)
@ -325,6 +326,9 @@ public:
bool getHideEmptyChatRooms() const;
void setHideEmptyChatRooms(const bool& data);
bool getWaitRegistrationForCall() const;
void setWaitRegistrationForCall(const bool& data);
bool getConferenceEnabled () const;
void setConferenceEnabled (bool status);
@ -542,6 +546,7 @@ signals:
void chatEnabledChanged (bool status);
void hideEmptyChatRoomsChanged (bool status);
void waitRegistrationForCallChanged (bool status);
void conferenceEnabledChanged (bool status);

View file

@ -17,6 +17,7 @@ Controls.TextField {
property string error: ''
property var tools
property QtObject textFieldStyle : TextFieldStyle.normal
onTextFieldStyleChanged: if( !textFieldStyle) textFieldStyle = TextFieldStyle.normal
// ---------------------------------------------------------------------------

View file

@ -13,6 +13,7 @@ Controls.Switch {
property bool enabled: true
property QtObject indicatorStyle : SwitchStyle.normal
onIndicatorStyleChanged: if( !indicatorStyle) indicatorStyle = SwitchStyle.normal
// ---------------------------------------------------------------------------

View file

@ -187,9 +187,21 @@ TabContainer {
}
FormLine {
visible: SettingsModel.callRecorderEnabled || SettingsModel.developerSettingsEnabled
FormGroup {
//: 'Call when registered' : Label on switch to choose if calls are make when the current proxy is registered
label: qsTr('waitRegistrationForCallLabel')
Switch {
id: waitRegistrationForCall
checked: SettingsModel.waitRegistrationForCall
onClicked: SettingsModel.waitRegistrationForCall = !checked
}
}
FormGroup {
visible: SettingsModel.callRecorderEnabled || SettingsModel.developerSettingsEnabled
label: qsTr('automaticallyRecordCallsLabel')
Switch {
@ -198,6 +210,7 @@ TabContainer {
onClicked: SettingsModel.automaticallyRecordCalls = !checked
}
}
}
}
@ -268,7 +281,8 @@ TabContainer {
}
FormLine {
FormGroup {
label: 'Hide empty chat rooms'
//: 'Hide empty chat rooms' : Label for a switch to choose if Linphone hide empty chat rooms
label: qsTr('hideEmptyChatRoomsLabel')
Switch {
id: hideEmptyChatRooms
@ -278,6 +292,7 @@ TabContainer {
onClicked: SettingsModel.hideEmptyChatRooms = !checked
}
}
}
FormLine {