Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
d00b77d5
Commit
d00b77d5
authored
Jun 02, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(src/components/assistant/AssistantModel): supports non-linphone account
parent
a76b0089
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
207 additions
and
45 deletions
+207
-45
CMakeLists.txt
linphone-desktop/CMakeLists.txt
+2
-0
en.ts
linphone-desktop/assets/languages/en.ts
+4
-0
fr.ts
linphone-desktop/assets/languages/fr.ts
+4
-0
LinphoneUtils.cpp
linphone-desktop/src/LinphoneUtils.cpp
+36
-0
LinphoneUtils.hpp
linphone-desktop/src/LinphoneUtils.hpp
+35
-0
AssistantModel.cpp
linphone-desktop/src/components/assistant/AssistantModel.cpp
+54
-0
AssistantModel.hpp
linphone-desktop/src/components/assistant/AssistantModel.hpp
+2
-0
SipAddressesModel.cpp
...esktop/src/components/sip-addresses/SipAddressesModel.cpp
+3
-11
UseOtherSipAccount.qml
...esktop/ui/views/App/Main/Assistant/UseOtherSipAccount.qml
+67
-34
No files found.
linphone-desktop/CMakeLists.txt
View file @
d00b77d5
...
...
@@ -133,6 +133,7 @@ set(SOURCES
src/components/timeline/TimelineModel.cpp
src/externals/single-application/SingleApplication.cpp
src/main.cpp
src/LinphoneUtils.cpp
src/Utils.cpp
)
...
...
@@ -181,6 +182,7 @@ set(HEADERS
src/components/timeline/TimelineModel.hpp
src/externals/single-application/SingleApplication.hpp
src/externals/single-application/SingleApplicationPrivate.hpp
src/LinphoneUtils.hpp
src/Utils.hpp
)
...
...
linphone-desktop/assets/languages/en.ts
View file @
d00b77d5
...
...
@@ -1402,6 +1402,10 @@ your friend's SIP address or username.</translation>
<
source
>
transportLabel
<
/source
>
<
translation
>
Transport
<
/translation
>
<
/message
>
<
message
>
<
source
>
addOtherSipAccountError
<
/source
>
<
translation
>
Unable
to
add
this
account
.
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
ZrtpTokenAuthentication
<
/name
>
...
...
linphone-desktop/assets/languages/fr.ts
View file @
d00b77d5
...
...
@@ -1401,6 +1401,10 @@ un chat ou ajouter un contact.</translation>
<
source
>
transportLabel
<
/source
>
<
translation
>
Transport
<
/translation
>
<
/message
>
<
message
>
<
source
>
addOtherSipAccountError
<
/source
>
<
translation
>
Impossible
d
&
apos
;
ajouter
ce
compte
.
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
ZrtpTokenAuthentication
<
/name
>
...
...
linphone-desktop/src/LinphoneUtils.cpp
0 → 100644
View file @
d00b77d5
/*
* LinphoneUtils.cpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: June 2, 2017
* Author: Ronan Abhamon
*/
#include "LinphoneUtils.hpp"
// =============================================================================
linphone
::
TransportType
LinphoneUtils
::
stringToTransportType
(
const
QString
&
transport
)
{
if
(
transport
==
"TCP"
)
return
linphone
::
TransportType
::
TransportTypeTcp
;
if
(
transport
==
"UDP"
)
return
linphone
::
TransportType
::
TransportTypeUdp
;
if
(
transport
==
"TLS"
)
return
linphone
::
TransportType
::
TransportTypeTls
;
return
linphone
::
TransportType
::
TransportTypeDtls
;
}
linphone-desktop/src/LinphoneUtils.hpp
0 → 100644
View file @
d00b77d5
/*
* LinphoneUtils.hpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: June 2, 2017
* Author: Ronan Abhamon
*/
#ifndef LINPHONE_UTILS_H_
#define LINPHONE_UTILS_H_
#include <linphone++/linphone.hh>
#include <QString>
// =============================================================================
namespace
LinphoneUtils
{
linphone
::
TransportType
stringToTransportType
(
const
QString
&
transport
);
}
#endif // ifndef LINPHONE_UTILS_H_
linphone-desktop/src/components/assistant/AssistantModel.cpp
View file @
d00b77d5
...
...
@@ -21,6 +21,7 @@
*/
#include "../../app/paths/Paths.hpp"
#include "../../LinphoneUtils.hpp"
#include "../../Utils.hpp"
#include "../core/CoreManager.hpp"
...
...
@@ -184,6 +185,59 @@ void AssistantModel::reset () {
// -----------------------------------------------------------------------------
bool
AssistantModel
::
addOtherSipAccount
(
const
QVariantMap
&
map
)
{
CoreManager
*
coreManager
=
CoreManager
::
getInstance
();
shared_ptr
<
linphone
::
Factory
>
factory
=
linphone
::
Factory
::
get
();
shared_ptr
<
linphone
::
Core
>
core
=
coreManager
->
getCore
();
shared_ptr
<
linphone
::
ProxyConfig
>
proxyConfig
=
core
->
createProxyConfig
();
const
QString
&
domain
=
map
[
"sipDomain"
].
toString
();
QString
sipAddress
=
QStringLiteral
(
"sip:%1@%2"
)
.
arg
(
map
[
"username"
].
toString
()).
arg
(
domain
);
// Server address.
{
shared_ptr
<
linphone
::
Address
>
address
=
factory
->
createAddress
(
::
Utils
::
appStringToCoreString
(
QStringLiteral
(
"sip:%1"
).
arg
(
domain
))
);
address
->
setTransport
(
LinphoneUtils
::
stringToTransportType
(
map
[
"transport"
].
toString
()));
if
(
proxyConfig
->
setServerAddr
(
address
->
asString
()))
{
qWarning
()
<<
QStringLiteral
(
"Unable to add server address: `%1`."
)
.
arg
(
::
Utils
::
coreStringToAppString
(
address
->
asString
()));
return
false
;
}
}
// Sip Address.
shared_ptr
<
linphone
::
Address
>
address
=
factory
->
createAddress
(
::
Utils
::
appStringToCoreString
(
sipAddress
));
if
(
!
address
)
{
qWarning
()
<<
QStringLiteral
(
"Unable to create sip address object from: `%1`."
).
arg
(
sipAddress
);
return
false
;
}
address
->
setDisplayName
(
::
Utils
::
appStringToCoreString
(
map
[
"displayName"
].
toString
()));
proxyConfig
->
setIdentityAddress
(
address
);
// AuthInfo.
core
->
addAuthInfo
(
factory
->
createAuthInfo
(
address
->
getUsername
(),
// Username.
""
,
// User ID.
::
Utils
::
appStringToCoreString
(
map
[
"password"
].
toString
()),
// Password.
""
,
// HA1.
""
,
// Realm.
address
->
getDomain
()
// Domain.
)
);
return
coreManager
->
getAccountSettingsModel
()
->
addOrUpdateProxyConfig
(
proxyConfig
);
}
// -----------------------------------------------------------------------------
QString
AssistantModel
::
getEmail
()
const
{
return
::
Utils
::
coreStringToAppString
(
mAccountCreator
->
getEmail
());
}
...
...
linphone-desktop/src/components/assistant/AssistantModel.hpp
View file @
d00b77d5
...
...
@@ -51,6 +51,8 @@ public:
Q_INVOKABLE
void
reset
();
Q_INVOKABLE
bool
addOtherSipAccount
(
const
QVariantMap
&
map
);
signals:
void
emailChanged
(
const
QString
&
email
,
const
QString
&
error
);
void
passwordChanged
(
const
QString
&
password
,
const
QString
&
error
);
...
...
linphone-desktop/src/components/sip-addresses/SipAddressesModel.cpp
View file @
d00b77d5
...
...
@@ -24,6 +24,7 @@
#include <QSet>
#include <QtDebug>
#include "../../LinphoneUtils.hpp"
#include "../../Utils.hpp"
#include "../chat/ChatModel.hpp"
#include "../core/CoreManager.hpp"
...
...
@@ -132,8 +133,7 @@ SipAddressObserver *SipAddressesModel::getSipAddressObserver (const QString &sip
const
QString
&
sipAddress
=
model
->
getSipAddress
();
if
(
mObservers
.
remove
(
sipAddress
,
model
)
==
0
)
qWarning
()
<<
QStringLiteral
(
"Unable to remove sip address `%1` from observers."
).
arg
(
sipAddress
);
}
);
});
return
model
;
}
...
...
@@ -178,15 +178,7 @@ QString SipAddressesModel::addTransportToSipAddress (const QString &sipAddress,
if
(
!
address
)
return
""
;
QString
transportStr
=
transport
.
toUpper
();
if
(
transportStr
==
"TCP"
)
address
->
setTransport
(
linphone
::
TransportType
::
TransportTypeTcp
);
else
if
(
transportStr
==
"UDP"
)
address
->
setTransport
(
linphone
::
TransportType
::
TransportTypeUdp
);
else
if
(
transportStr
==
"TLS"
)
address
->
setTransport
(
linphone
::
TransportType
::
TransportTypeTls
);
else
address
->
setTransport
(
linphone
::
TransportType
::
TransportTypeDtls
);
address
->
setTransport
(
LinphoneUtils
::
stringToTransportType
(
transport
.
toUpper
()));
return
::
Utils
::
coreStringToAppString
(
address
->
asString
());
}
...
...
linphone-desktop/ui/views/App/Main/Assistant/UseOtherSipAccount.qml
View file @
d00b77d5
import
QtQuick
2.7
import
Common
1.0
import
Linphone
1.0
// =============================================================================
AssistantAbstractView
{
mainAction
:
(
function
()
{
console
.
log
(
'
TODO
'
)
})
mainAction
:
requestBlock
.
execute
mainActionEnabled
:
username
.
text
.
length
&&
sipDomain
.
text
.
length
&&
...
...
@@ -17,56 +18,88 @@ AssistantAbstractView {
// ---------------------------------------------------------------------------
Form
{
Column
{
anchors.fill
:
parent
orientation
:
Qt
.
Vertical
FormLine
{
FormGroup
{
label
:
qsTr
(
'
usernameLabel
'
)
Form
{
dealWithErrors
:
true
orientation
:
Qt
.
Vertical
width
:
parent
.
width
FormLine
{
FormGroup
{
label
:
qsTr
(
'
usernameLabel
'
)
TextField
{
id
:
username
TextField
{
id
:
username
}
}
}
}
FormLine
{
FormGroup
{
label
:
qsTr
(
'
displayNameLabel
'
)
FormGroup
{
label
:
qsTr
(
'
displayNameLabel
'
)
TextField
{}
TextField
{
id
:
displayName
}
}
}
}
FormLine
{
FormGroup
{
label
:
qsTr
(
'
sipDomainLabel
'
)
FormLine
{
FormGroup
{
label
:
qsTr
(
'
sipDomainLabel
'
)
TextField
{
id
:
sipDomain
TextField
{
id
:
sipDomain
}
}
}
}
FormLine
{
FormGroup
{
label
:
qsTr
(
'
passwordLabel
'
)
FormLine
{
FormGroup
{
label
:
qsTr
(
'
passwordLabel
'
)
PasswordField
{
id
:
password
PasswordField
{
id
:
password
}
}
}
}
FormLine
{
FormGroup
{
label
:
qsTr
(
'
transportLabel
'
)
FormLine
{
FormGroup
{
label
:
qsTr
(
'
transportLabel
'
)
ExclusiveButtons
{
texts
:
[
'
UDP
'
,
'
TCP
'
,
'
TLS
'
]
ComboBox
{
id
:
transport
model
:
[
'
UDP
'
,
'
TCP
'
,
'
TLS
'
,
'
DTLS
'
]
}
}
}
}
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
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment