mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Use a webview for account creation
# Conflicts: # linphone-app/src/components/settings/AccountSettingsModel.cpp # linphone-app/src/components/settings/SettingsModel.cpp # linphone-app/src/components/settings/SettingsModel.hpp # linphone-app/ui/views/App/Main/Assistant/UseOtherSipAccount.qml
This commit is contained in:
parent
5b2b0d334f
commit
8675b4debf
17 changed files with 469 additions and 320 deletions
|
|
@ -28,8 +28,8 @@
|
|||
// =============================================================================
|
||||
|
||||
int main (int argc, char *argv[]) {
|
||||
QtWebView::initialize();
|
||||
AppController controller(argc, argv);
|
||||
QtWebView::initialize();
|
||||
#ifdef QT_QML_DEBUG
|
||||
QQmlDebuggingEnabler enabler;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -330,13 +330,28 @@ bool AccountSettingsModel::addOrUpdateProxyConfig (
|
|||
return addOrUpdateProxyConfig(proxyConfig);
|
||||
}
|
||||
|
||||
bool AccountSettingsModel::addOrUpdateProxyConfig (
|
||||
const QVariantMap &data
|
||||
) {
|
||||
shared_ptr<linphone::ProxyConfig> proxyConfig;
|
||||
QString sipAddress = data["sipAddress"].toString();
|
||||
shared_ptr<linphone::Address> address = CoreManager::getInstance()->getCore()->interpretUrl(sipAddress.toStdString());
|
||||
|
||||
for (const auto &databaseProxyConfig : CoreManager::getInstance()->getCore()->getProxyConfigList())
|
||||
if (databaseProxyConfig->getIdentityAddress()->weakEqual(address)) {
|
||||
proxyConfig = databaseProxyConfig;
|
||||
}
|
||||
if(!proxyConfig)
|
||||
proxyConfig = createProxyConfig();
|
||||
return addOrUpdateProxyConfig(proxyConfig, data);
|
||||
}
|
||||
|
||||
shared_ptr<linphone::ProxyConfig> AccountSettingsModel::createProxyConfig () {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
|
||||
core->getConfig()->loadFromXmlFile(
|
||||
Paths::getAssistantConfigDirPath() + "create-app-sip-account.rc"
|
||||
);
|
||||
|
||||
return core->createProxyConfig();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ public:
|
|||
Q_INVOKABLE void setDefaultProxyConfigFromSipAddress (const QString &sipAddress);
|
||||
|
||||
Q_INVOKABLE bool addOrUpdateProxyConfig (const std::shared_ptr<linphone::ProxyConfig> &proxyConfig, const QVariantMap &data);
|
||||
Q_INVOKABLE bool addOrUpdateProxyConfig (const QVariantMap &data);// Create default proxy config and apply data
|
||||
Q_INVOKABLE void removeProxyConfig (const std::shared_ptr<linphone::ProxyConfig> &proxyConfig);
|
||||
|
||||
Q_INVOKABLE std::shared_ptr<linphone::ProxyConfig> createProxyConfig ();
|
||||
|
|
|
|||
|
|
@ -161,6 +161,24 @@ void SettingsModel::setAssistantSupportsPhoneNumbers (bool status) {
|
|||
emit assistantSupportsPhoneNumbersChanged(status);
|
||||
}
|
||||
|
||||
QString SettingsModel::getAssistantRegistrationUrl () const {
|
||||
return Utils::coreStringToAppString(mConfig->getString(UiSection, "assistant_registration_url", Constants::DefaultAssistantRegistrationUrl));
|
||||
}
|
||||
|
||||
void SettingsModel::setAssistantRegistrationUrl (QString url) {
|
||||
mConfig->setString(UiSection, "assistant_registration_url", Utils::appStringToCoreString(url));
|
||||
emit assistantRegistrationUrlChanged(url);
|
||||
}
|
||||
|
||||
QString SettingsModel::getAssistantLoginUrl () const {
|
||||
return Utils::coreStringToAppString(mConfig->getString(UiSection, "assistant_login_url", Constants::DefaultAssistantLoginUrl));
|
||||
}
|
||||
|
||||
void SettingsModel::setAssistantLoginUrl (QString url) {
|
||||
mConfig->setString(UiSection, "assistant_login_url", Utils::appStringToCoreString(url));
|
||||
emit assistantLoginUrlChanged(url);
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Audio.
|
||||
// =============================================================================
|
||||
|
|
|
|||
|
|
@ -40,14 +40,16 @@ class SettingsModel : public QObject {
|
|||
// ===========================================================================
|
||||
|
||||
// Assistant. ----------------------------------------------------------------
|
||||
|
||||
|
||||
Q_PROPERTY(bool createAppSipAccountEnabled READ getCreateAppSipAccountEnabled WRITE setCreateAppSipAccountEnabled NOTIFY createAppSipAccountEnabledChanged)
|
||||
Q_PROPERTY(bool fetchRemoteConfigurationEnabled READ getFetchRemoteConfigurationEnabled WRITE setFetchRemoteConfigurationEnabled NOTIFY fetchRemoteConfigurationEnabledChanged)
|
||||
Q_PROPERTY(bool useAppSipAccountEnabled READ getUseAppSipAccountEnabled WRITE setUseAppSipAccountEnabled NOTIFY useAppSipAccountEnabledChanged)
|
||||
Q_PROPERTY(bool useOtherSipAccountEnabled READ getUseOtherSipAccountEnabled WRITE setUseOtherSipAccountEnabled NOTIFY useOtherSipAccountEnabledChanged)
|
||||
|
||||
Q_PROPERTY(bool assistantSupportsPhoneNumbers READ getAssistantSupportsPhoneNumbers WRITE setAssistantSupportsPhoneNumbers NOTIFY assistantSupportsPhoneNumbersChanged)
|
||||
|
||||
Q_PROPERTY(QString assistantRegistrationUrl READ getAssistantRegistrationUrl WRITE setAssistantRegistrationUrl NOTIFY assistantRegistrationUrlChanged)
|
||||
Q_PROPERTY(QString assistantLoginUrl READ getAssistantLoginUrl WRITE setAssistantLoginUrl NOTIFY assistantLoginUrlChanged)
|
||||
|
||||
// Audio. --------------------------------------------------------------------
|
||||
|
||||
Q_PROPERTY(bool captureGraphRunning READ getCaptureGraphRunning NOTIFY captureGraphRunningChanged)
|
||||
|
|
@ -228,7 +230,13 @@ public:
|
|||
|
||||
bool getAssistantSupportsPhoneNumbers () const;
|
||||
void setAssistantSupportsPhoneNumbers (bool status);
|
||||
|
||||
|
||||
QString getAssistantRegistrationUrl () const;
|
||||
void setAssistantRegistrationUrl (QString url);
|
||||
|
||||
QString getAssistantLoginUrl () const;
|
||||
void setAssistantLoginUrl (QString url);
|
||||
|
||||
// Audio. --------------------------------------------------------------------
|
||||
|
||||
void createCaptureGraph();
|
||||
|
|
@ -502,7 +510,10 @@ signals:
|
|||
void useOtherSipAccountEnabledChanged (bool status);
|
||||
|
||||
void assistantSupportsPhoneNumbersChanged (bool status);
|
||||
|
||||
|
||||
void assistantRegistrationUrlChanged (QString url);
|
||||
void assistantLoginUrlChanged (QString url);
|
||||
|
||||
// Audio. --------------------------------------------------------------------
|
||||
|
||||
void captureGraphRunningChanged(bool running);
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ constexpr qint64 Constants::FileSizeLimit;
|
|||
constexpr char Constants::DefaultXmlrpcUri[];
|
||||
constexpr char Constants::DefaultConferenceURI[];
|
||||
constexpr char Constants::DefaultLimeServerURL[];
|
||||
constexpr char Constants::DefaultAssistantRegistrationUrl[];
|
||||
constexpr char Constants::DefaultAssistantLoginUrl[];
|
||||
|
||||
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_WIN)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ public:
|
|||
static constexpr char DefaultLogsEmail[] = "linphone-desktop@belledonne-communications.com";
|
||||
static constexpr char DefaultConferenceURI[] = "sip:conference-factory@sip.linphone.org";
|
||||
static constexpr char DefaultLimeServerURL[] = "https://lime.linphone.org/lime-server/lime-server.php";
|
||||
|
||||
static constexpr char DefaultAssistantRegistrationUrl[] = "https://subscribe.linphone.org/register";
|
||||
static constexpr char DefaultAssistantLoginUrl[] = "https://subscribe.linphone.org/login";
|
||||
|
||||
// Max image size in bytes. (100Kb)
|
||||
static constexpr qint64 MaxImageSize = 102400;// In Bytes.
|
||||
|
|
|
|||
|
|
@ -42,14 +42,10 @@ Item {
|
|||
|
||||
StackView {
|
||||
id: stack
|
||||
clip:true
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
|
||||
bottomMargin: AssistantStyle.bottomMargin
|
||||
leftMargin: AssistantStyle.leftMargin
|
||||
rightMargin: AssistantStyle.rightMargin
|
||||
topMargin: AssistantStyle.topMargin
|
||||
fill: parent
|
||||
}
|
||||
|
||||
initialItem: assistant.viewsPath + 'AssistantHome.qml'
|
||||
|
|
|
|||
|
|
@ -8,107 +8,112 @@ import App.Styles 1.0
|
|||
// =============================================================================
|
||||
|
||||
Item {
|
||||
id: view
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
property alias mainActionEnabled: mainActionButton.enabled
|
||||
property alias mainActionLabel: mainActionButton.text
|
||||
property var mainAction
|
||||
|
||||
property alias description: description.text
|
||||
property alias title: title.text
|
||||
|
||||
property bool backEnabled: true
|
||||
property bool maximized: false // Used to stretch content to fit all the view (the title will be set to top)
|
||||
|
||||
default property alias _content: content.data
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
height: stack.height
|
||||
width: stack.width
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Info.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Column {
|
||||
id:titleBar
|
||||
anchors.centerIn: parent
|
||||
|
||||
spacing: AssistantAbstractViewStyle.info.spacing
|
||||
width: parent.width
|
||||
|
||||
Text {
|
||||
id: title
|
||||
|
||||
color: AssistantAbstractViewStyle.info.title.color
|
||||
elide: Text.ElideRight
|
||||
|
||||
font {
|
||||
pointSize: AssistantAbstractViewStyle.info.title.pointSize
|
||||
bold: true
|
||||
}
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
Text {
|
||||
id: description
|
||||
|
||||
color: AssistantAbstractViewStyle.info.description.color
|
||||
elide: Text.ElideRight
|
||||
|
||||
font.pointSize: AssistantAbstractViewStyle.info.description.pointSize
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
width: parent.width
|
||||
|
||||
visible: text.length > 0
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Content.
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Item {
|
||||
id: content
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
height: (maximized?view.height - description.height - title.height - buttons.height -titleBar.spacing*3 : AssistantAbstractViewStyle.content.height)
|
||||
width: AssistantAbstractViewStyle.content.width
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Nav buttons.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Row {
|
||||
id: buttons
|
||||
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
spacing: AssistantAbstractViewStyle.buttons.spacing
|
||||
|
||||
TextButtonA {
|
||||
text: qsTr('back')
|
||||
visible: view.backEnabled
|
||||
|
||||
onClicked: assistant.popView()
|
||||
}
|
||||
|
||||
TextButtonB {
|
||||
id: mainActionButton
|
||||
|
||||
visible: !!view.mainAction
|
||||
|
||||
onClicked: view.mainAction()
|
||||
}
|
||||
}
|
||||
id: view
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
property alias mainActionEnabled: mainActionButton.enabled
|
||||
property alias mainActionLabel: mainActionButton.text
|
||||
property var mainAction
|
||||
|
||||
property alias description: description.text
|
||||
property alias title: title.text
|
||||
|
||||
property bool backEnabled: true
|
||||
property bool maximized: false // Used to stretch content to fit all the view (the title will be set to top)
|
||||
|
||||
default property alias _content: content.data
|
||||
property alias contentItem: content
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
height: (maximized?stack.height:AssistantAbstractViewStyle.content.height)
|
||||
width: (maximized?stack.width:AssistantAbstractViewStyle.content.width)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Info.
|
||||
// ---------------------------------------------------------------------------
|
||||
Text {
|
||||
id: title
|
||||
anchors.top:parent.top
|
||||
anchors.topMargin:(visible?AssistantAbstractViewStyle.info.spacing:0)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: AssistantAbstractViewStyle.info.title.color
|
||||
elide: Text.ElideRight
|
||||
|
||||
font {
|
||||
pointSize: AssistantAbstractViewStyle.info.title.pointSize
|
||||
bold: true
|
||||
}
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
width: parent.width
|
||||
visible: text.length > 0
|
||||
height:(visible?contentHeight:0)
|
||||
}
|
||||
|
||||
Text {
|
||||
id: description
|
||||
anchors.top:title.bottom
|
||||
anchors.topMargin:(visible?AssistantAbstractViewStyle.info.spacing:0)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
color: AssistantAbstractViewStyle.info.description.color
|
||||
elide: Text.ElideRight
|
||||
|
||||
font.pointSize: AssistantAbstractViewStyle.info.description.pointSize
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
width: parent.width
|
||||
|
||||
visible: text.length > 0
|
||||
height:(visible?contentHeight:0)
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Content.
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Item {
|
||||
id: content
|
||||
anchors.top:description.bottom
|
||||
anchors.topMargin:(description.visible || title.visible?AssistantAbstractViewStyle.info.spacing:0)
|
||||
anchors.bottom:buttons.top
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Nav buttons.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Row {
|
||||
id: buttons
|
||||
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
bottomMargin:AssistantAbstractViewStyle.info.spacing
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
|
||||
}
|
||||
|
||||
spacing: AssistantAbstractViewStyle.buttons.spacing
|
||||
|
||||
TextButtonA {
|
||||
text: qsTr('back')
|
||||
visible: view.backEnabled
|
||||
|
||||
onClicked: assistant.popView()
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
TextButtonB {
|
||||
id: mainActionButton
|
||||
|
||||
visible: !!view.mainAction
|
||||
|
||||
onClicked: view.mainAction()
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import App.Styles 1.0
|
|||
|
||||
ColumnLayout {
|
||||
spacing: 0
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Info.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -79,6 +79,12 @@ ColumnLayout {
|
|||
|
||||
cellHeight: height / 2
|
||||
cellWidth: width / 2
|
||||
anchors.bottom:parent.bottom
|
||||
anchors.bottomMargin: AssistantStyle.bottomMargin
|
||||
anchors.left:parent.left
|
||||
anchors.leftMargin: AssistantStyle.leftMargin
|
||||
anchors.right:parent.right
|
||||
anchors.rightMargin: AssistantStyle.rightMargin
|
||||
|
||||
delegate: Item {
|
||||
height: buttons.cellHeight
|
||||
|
|
@ -93,7 +99,7 @@ ColumnLayout {
|
|||
enabled: SettingsModel[$viewType.charAt(0).toLowerCase() + $viewType.slice(1) + "Enabled"]
|
||||
text: $text.replace('%1', Qt.application.name.toUpperCase())
|
||||
|
||||
onClicked: assistant.pushView($view)
|
||||
onClicked:{ assistant.pushView($view, $props) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -101,43 +107,29 @@ ColumnLayout {
|
|||
Component.onCompleted: {
|
||||
insert(0, {
|
||||
$text: qsTr('createAppSipAccount'),
|
||||
$view: SettingsModel.assistantSupportsPhoneNumbers
|
||||
? 'CreateAppSipAccount'
|
||||
: 'CreateAppSipAccountWithEmail',
|
||||
$viewType: 'CreateAppSipAccount'
|
||||
$view: 'CreateAppSipAccount',
|
||||
$viewType: 'CreateAppSipAccount',
|
||||
$props:{url: SettingsModel.assistantRegistrationUrl}
|
||||
})
|
||||
append({
|
||||
$text: qsTr('useAppSipAccount'),
|
||||
$view: 'CreateAppSipAccount',
|
||||
$viewType: 'UseAppSipAccount',
|
||||
$props:{url: SettingsModel.assistantLoginUrl}
|
||||
})
|
||||
append({
|
||||
$text: qsTr('useOtherSipAccount'),
|
||||
$view: 'UseOtherSipAccount',
|
||||
$viewType: 'UseOtherSipAccount'
|
||||
})
|
||||
append( {
|
||||
$text: qsTr('fetchRemoteConfiguration'),
|
||||
$view: 'FetchRemoteConfiguration',
|
||||
$viewType: 'FetchRemoteConfiguration'
|
||||
})
|
||||
}
|
||||
|
||||
ListElement {
|
||||
$text: qsTr('useAppSipAccount')
|
||||
$view: 'UseAppSipAccount'
|
||||
$viewType: 'UseAppSipAccount'
|
||||
}
|
||||
|
||||
ListElement {
|
||||
$text: qsTr('useOtherSipAccount')
|
||||
$view: 'UseOtherSipAccount'
|
||||
$viewType: 'UseOtherSipAccount'
|
||||
}
|
||||
|
||||
ListElement {
|
||||
$text: qsTr('fetchRemoteConfiguration')
|
||||
$view: 'FetchRemoteConfiguration'
|
||||
$viewType: 'FetchRemoteConfiguration'
|
||||
}
|
||||
}
|
||||
|
||||
interactive: false
|
||||
|
||||
Connections {
|
||||
target: SettingsModel
|
||||
onAssistantSupportsPhoneNumbersChanged: buttons.model.setProperty(
|
||||
0,
|
||||
'$view',
|
||||
SettingsModel.assistantSupportsPhoneNumbers ?
|
||||
'CreateAppSipAccount' :
|
||||
'CreateAppSipAccountWithEmail'
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,53 +1,112 @@
|
|||
import QtQuick 2.7
|
||||
import QtWebView 1.15
|
||||
import QtWebView 1.1
|
||||
import QtQuick.Controls 1.3 // Busy indicator
|
||||
|
||||
import Common 1.0
|
||||
import Linphone 1.0 as Linphone
|
||||
|
||||
import App.Styles 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
AssistantAbstractView {
|
||||
description: qsTr('createAppSipAccountDescription')
|
||||
title: qsTr('createAppSipAccountTitle').replace('%1', Qt.application.name.toUpperCase())
|
||||
maximized:true
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Menu.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
maximized:true
|
||||
height: (parent?parent.height:0)
|
||||
width: (parent?parent.width:0)
|
||||
property alias url : webview.url
|
||||
// ---------------------------------------------------------------------------
|
||||
// Menu.
|
||||
// ---------------------------------------------------------------------------
|
||||
// Note : Use opcity and not visibility to allow smooth updating (when moving visibility to true, we could show the old page)
|
||||
WebView{
|
||||
id:webview
|
||||
property int status : 0 // 0:nothing, -1:error, 1:ok
|
||||
property bool newPage : true
|
||||
anchors.fill:parent
|
||||
httpUserAgent: 'Linphone Desktop'
|
||||
//url:'https://www.whatismybrowser.com/detect/what-is-my-user-agent'
|
||||
url: 'https://subscribe.linphone.org/register'
|
||||
Component.onCompleted: if(httpUserAgent) httpUserAgent = Linphone.App.getUserAgent() // only available on Qt 5.15 (QtWebView 1.15)
|
||||
function getData(){// Check if account_infos exists in the page and retrieve data to make/update an account
|
||||
if(webview.loading){
|
||||
webview.status = 0
|
||||
}else {
|
||||
var js = "(typeof account_infos !== 'undefined'?account_infos:'')";
|
||||
webview.runJavaScript(js, function(result) {
|
||||
if( result == ''){
|
||||
webview.status = 0
|
||||
}else{
|
||||
webview.opacity=0
|
||||
reloadTimer.stop();
|
||||
console.log(result);
|
||||
console.log("[CreateAccount] SIP : " +result.sip);
|
||||
console.log("[CreateAccount] Username : " +result.username);
|
||||
console.log("[CreateAccount] Registrar : " +result.registrar_address);
|
||||
console.log("[CreateAccount] Domain : " +result.domain);
|
||||
if (Linphone.AccountSettingsModel.addOrUpdateProxyConfig( {
|
||||
sipAddress: result.sip,
|
||||
serverAddress: result.registrar_address
|
||||
})) {
|
||||
|
||||
console.log("[CreateAccount] Account created")
|
||||
webview.status = 1
|
||||
Linphone.AccountSettingsModel.setDefaultProxyConfigFromSipAddress("sip:"+result.sip)
|
||||
} else {
|
||||
console.error("[CreateAccount] Cannot create account. Check logs.")
|
||||
webview.status = -1
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Timer {// Check data
|
||||
id:reloadTimer
|
||||
interval: 1000;
|
||||
running: true; repeat: true
|
||||
onTriggered: {webview.getData();}
|
||||
}
|
||||
|
||||
onLoadingChanged: {
|
||||
if (loadRequest.errorString)
|
||||
console.error(loadRequest.errorString);
|
||||
if (loadRequest.errorString)
|
||||
console.error("[CreateAccount] error on loading page : " +loadRequest.errorString);
|
||||
if(loading)
|
||||
newPage = true;
|
||||
else if(newPage) {
|
||||
newPage = false;
|
||||
webview.runJavaScript("document.querySelector('nav').remove(); document.querySelector('footer').remove();");
|
||||
}
|
||||
webview.opacity= (loading?0:1)
|
||||
if(!loading){
|
||||
reloadTimer.stop();
|
||||
webview.getData();
|
||||
if(webview.status == 0)
|
||||
reloadTimer.start();
|
||||
}else
|
||||
reloadTimer.stop();
|
||||
}
|
||||
}
|
||||
/*
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: CreateAppSipAccountStyle.buttons.spacing
|
||||
width: CreateAppSipAccountStyle.buttons.button.width
|
||||
|
||||
TextButtonA {
|
||||
text: qsTr('withPhoneNumber')
|
||||
Rectangle{
|
||||
id:statusPage
|
||||
anchors.fill:parent
|
||||
visible: webview.loading || webview.opacity==0
|
||||
BusyIndicator{
|
||||
id:busy
|
||||
anchors.centerIn : parent
|
||||
running:true
|
||||
width:CreateAppSipAccountStyle.busy.size
|
||||
height:CreateAppSipAccountStyle.busy.size
|
||||
}
|
||||
|
||||
height: CreateAppSipAccountStyle.buttons.button.height
|
||||
width: parent.width
|
||||
|
||||
onClicked: assistant.pushView('CreateAppSipAccountWithPhoneNumber')
|
||||
}
|
||||
|
||||
TextButtonA {
|
||||
text: qsTr('withEmailAddress')
|
||||
|
||||
height: CreateAppSipAccountStyle.buttons.button.height
|
||||
width: parent.width
|
||||
|
||||
onClicked: assistant.pushView('CreateAppSipAccountWithEmail')
|
||||
}
|
||||
}*/
|
||||
Icon{
|
||||
visible: webview.status != 0
|
||||
icon: (webview.status>0?"chat_read":"chat_error")
|
||||
iconSize:busy.width
|
||||
anchors.fill:busy
|
||||
onVisibleChanged:if(visible)webview.visible=false
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked:assistant.popView()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,66 +4,73 @@ import Common 1.0
|
|||
import Linphone 1.0
|
||||
import Utils 1.0
|
||||
|
||||
import App.Styles 1.0
|
||||
// =============================================================================
|
||||
Item{
|
||||
AssistantAbstractView {
|
||||
mainAction: requestBlock.execute
|
||||
mainActionEnabled: url.text.length > 0
|
||||
mainActionLabel: qsTr('confirmAction')
|
||||
|
||||
AssistantAbstractView {
|
||||
mainAction: requestBlock.execute
|
||||
mainActionEnabled: url.text.length > 0
|
||||
mainActionLabel: qsTr('confirmAction')
|
||||
title: qsTr('fetchRemoteConfigurationTitle')
|
||||
width: AssistantAbstractViewStyle.content.width
|
||||
height: AssistantAbstractViewStyle.content.height
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
title: qsTr('fetchRemoteConfigurationTitle')
|
||||
Connections {
|
||||
target: SettingsModel
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
onRemoteProvisioningChanged: {
|
||||
requestBlock.stop('')
|
||||
window.detachVirtualWindow()
|
||||
window.attachVirtualWindow(Utils.buildDialogUri('ConfirmDialog'), {
|
||||
descriptionText: qsTr('remoteProvisioningUpdateDescription'),
|
||||
}, function (status) {
|
||||
if (status) {
|
||||
App.restart()
|
||||
} else {
|
||||
window.setView('Home')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SettingsModel
|
||||
onRemoteProvisioningNotChanged: requestBlock.stop(qsTr('remoteProvisioningError'))
|
||||
}
|
||||
|
||||
onRemoteProvisioningChanged: {
|
||||
requestBlock.stop('')
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
window.detachVirtualWindow()
|
||||
window.attachVirtualWindow(Utils.buildDialogUri('ConfirmDialog'), {
|
||||
descriptionText: qsTr('remoteProvisioningUpdateDescription'),
|
||||
}, function (status) {
|
||||
if (status) {
|
||||
App.restart()
|
||||
} else {
|
||||
window.setView('Home')
|
||||
}
|
||||
})
|
||||
}
|
||||
Column {
|
||||
anchors.fill: parent.contentItem
|
||||
anchors.topMargin: AssistantAbstractViewStyle.info.spacing
|
||||
width: AssistantAbstractViewStyle.content.width
|
||||
height: AssistantAbstractViewStyle.content.height
|
||||
|
||||
onRemoteProvisioningNotChanged: requestBlock.stop(qsTr('remoteProvisioningError'))
|
||||
}
|
||||
Form {
|
||||
orientation: Qt.Vertical
|
||||
width: parent.width
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('urlLabel')
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
TextField {
|
||||
id: url
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Form {
|
||||
orientation: Qt.Vertical
|
||||
width: parent.width
|
||||
RequestBlock {
|
||||
id: requestBlock
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('urlLabel')
|
||||
action: (function () {
|
||||
SettingsModel.remoteProvisioning = url.text
|
||||
})
|
||||
|
||||
TextField {
|
||||
id: url
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RequestBlock {
|
||||
id: requestBlock
|
||||
|
||||
action: (function () {
|
||||
SettingsModel.remoteProvisioning = url.text
|
||||
})
|
||||
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,102 +3,113 @@ import QtQuick 2.7
|
|||
import Common 1.0
|
||||
import Linphone 1.0
|
||||
|
||||
import App.Styles 1.0
|
||||
|
||||
// =============================================================================
|
||||
Item{
|
||||
|
||||
AssistantAbstractView {
|
||||
mainAction: requestBlock.execute
|
||||
|
||||
mainActionEnabled: username.text.length &&
|
||||
sipDomain.text.length &&
|
||||
password.text.length
|
||||
|
||||
AssistantAbstractView {
|
||||
mainAction: requestBlock.execute
|
||||
mainActionLabel: qsTr('confirmAction')
|
||||
|
||||
mainActionEnabled: username.text.length &&
|
||||
sipDomain.text.length &&
|
||||
password.text.length
|
||||
title: qsTr('useOtherSipAccountTitle')
|
||||
|
||||
mainActionLabel: qsTr('confirmAction')
|
||||
width: AssistantAbstractViewStyle.content.width
|
||||
height: AssistantAbstractViewStyle.content.height
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
title: qsTr('useOtherSipAccountTitle')
|
||||
// ---------------------------------------------------------------------------
|
||||
//anchors.centerIn: parent
|
||||
//anchors.horizontalCenter:parent.horizontalCenter
|
||||
Column {
|
||||
anchors.fill: parent.contentItem
|
||||
width: AssistantAbstractViewStyle.content.width
|
||||
height: AssistantAbstractViewStyle.content.height
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
Form {
|
||||
dealWithErrors: true
|
||||
orientation: Qt.Vertical
|
||||
width: parent.width
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('usernameLabel')
|
||||
|
||||
Form {
|
||||
orientation: Qt.Vertical
|
||||
width: parent.width
|
||||
TextField {
|
||||
id: username
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('usernameLabel')
|
||||
FormGroup {
|
||||
label: qsTr('displayNameLabel')
|
||||
|
||||
TextField {
|
||||
id: username
|
||||
}
|
||||
}
|
||||
TextField {
|
||||
id: displayName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormGroup {
|
||||
label: qsTr('displayNameLabel')
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('sipDomainLabel')
|
||||
|
||||
TextField {
|
||||
id: displayName
|
||||
}
|
||||
}
|
||||
}
|
||||
TextField {
|
||||
id: sipDomain
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('sipDomainLabel')
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('passwordLabel')
|
||||
|
||||
TextField {
|
||||
id: sipDomain
|
||||
}
|
||||
}
|
||||
}
|
||||
PasswordField {
|
||||
id: password
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('passwordLabel')
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('transportLabel')
|
||||
|
||||
PasswordField {
|
||||
id: password
|
||||
}
|
||||
}
|
||||
}
|
||||
ComboBox {
|
||||
id: transport
|
||||
model: [ 'UDP', 'TCP', 'TLS']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('transportLabel')
|
||||
RequestBlock {
|
||||
id: requestBlock
|
||||
width: parent.width
|
||||
|
||||
ComboBox {
|
||||
id: transport
|
||||
model: [ 'UDP', 'TCP', 'TLS']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RequestBlock {
|
||||
id: requestBlock
|
||||
|
||||
action: (function () {
|
||||
if (!assistantModel.addOtherSipAccount({
|
||||
username: username.text,
|
||||
displayName: displayName.text,
|
||||
sipDomain: sipDomain.text,
|
||||
password: password.text,
|
||||
transport: transport.model[transport.currentIndex]
|
||||
})) {
|
||||
requestBlock.stop(qsTr('addOtherSipAccountError'))
|
||||
} else {
|
||||
requestBlock.stop('')
|
||||
window.setView('Home')
|
||||
}
|
||||
})
|
||||
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
AssistantModel {
|
||||
id: assistantModel
|
||||
configFilename: 'use-other-sip-account.rc'
|
||||
}
|
||||
action: (function () {
|
||||
if (!assistantModel.addOtherSipAccount({
|
||||
username: username.text,
|
||||
displayName: displayName.text,
|
||||
sipDomain: sipDomain.text,
|
||||
password: password.text,
|
||||
transport: transport.model[transport.currentIndex]
|
||||
})) {
|
||||
requestBlock.stop(qsTr('addOtherSipAccountError'))
|
||||
} else {
|
||||
requestBlock.stop('')
|
||||
window.setView('Home')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
AssistantModel {
|
||||
id: assistantModel
|
||||
configFilename: 'use-other-sip-account.rc'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ TabContainer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Proxy accounts.
|
||||
// -------------------------------------------------------------------------
|
||||
|
|
@ -129,10 +129,35 @@ TabContainer {
|
|||
|
||||
Form {
|
||||
title: qsTr('assistantTitle')
|
||||
visible: SettingsModel.developerSettingsEnabled
|
||||
|
||||
width: parent.width
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: 'Registration URL'
|
||||
|
||||
TextField {
|
||||
text: SettingsModel.assistantRegistrationUrl
|
||||
|
||||
onEditingFinished: SettingsModel.assistantRegistrationUrl = text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: 'Login URL'
|
||||
|
||||
TextField {
|
||||
text: SettingsModel.assistantLoginUrl
|
||||
|
||||
onEditingFinished: SettingsModel.assistantLoginUrl = text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
visible: SettingsModel.developerSettingsEnabled
|
||||
FormGroup {
|
||||
label: qsTr('createAppSipAccountEnabledLabel')
|
||||
|
||||
|
|
@ -155,6 +180,7 @@ TabContainer {
|
|||
}
|
||||
|
||||
FormLine {
|
||||
visible: SettingsModel.developerSettingsEnabled
|
||||
FormGroup {
|
||||
label: qsTr('useOtherSipAccountEnabledLabel')
|
||||
|
||||
|
|
@ -177,6 +203,7 @@ TabContainer {
|
|||
}
|
||||
|
||||
FormLine {
|
||||
visible: SettingsModel.developerSettingsEnabled
|
||||
FormGroup {
|
||||
label: qsTr('assistantSupportsPhoneNumbersLabel')
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ QtObject {
|
|||
}
|
||||
|
||||
property QtObject content: QtObject {
|
||||
property int height: 375
|
||||
property int height: 375+60//+button bar
|
||||
property int width: 400
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,4 +12,8 @@ QtObject {
|
|||
property int width: 258
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject busy: QtObject {
|
||||
property int size: 40
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 2a087c0f73e2658a5efa7357725e1d009a5c51a7
|
||||
Subproject commit 16f9b6cb075ada944e58f6d6e66521aed9b33940
|
||||
Loading…
Add table
Reference in a new issue