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
a845693c
Commit
a845693c
authored
Jun 16, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(Chat): deal with sip-uri in messages, on click the sip uri is used as chat room
parent
cb31880c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
118 additions
and
12 deletions
+118
-12
CMakeLists.txt
CMakeLists.txt
+2
-0
App.cpp
src/app/App.cpp
+1
-0
App.hpp
src/app/App.hpp
+2
-1
Components.hpp
src/components/Components.hpp
+1
-0
SipAddressesModel.cpp
src/components/sip-addresses/SipAddressesModel.cpp
+15
-9
SipAddressesModel.hpp
src/components/sip-addresses/SipAddressesModel.hpp
+4
-2
UrlHandlers.cpp
src/components/url-handlers/UrlHandlers.cpp
+37
-0
UrlHandlers.hpp
src/components/url-handlers/UrlHandlers.hpp
+44
-0
MainWindow.qml
ui/views/App/Main/MainWindow.qml
+12
-0
No files found.
CMakeLists.txt
View file @
a845693c
...
...
@@ -135,6 +135,7 @@ set(SOURCES
src/components/sound-player/SoundPlayer.cpp
src/components/telephone-numbers/TelephoneNumbersModel.cpp
src/components/timeline/TimelineModel.cpp
src/components/url-handlers/UrlHandlers.cpp
src/externals/single-application/SingleApplication.cpp
src/main.cpp
src/utils/LinphoneUtils.cpp
...
...
@@ -186,6 +187,7 @@ set(HEADERS
src/components/sound-player/SoundPlayer.hpp
src/components/telephone-numbers/TelephoneNumbersModel.hpp
src/components/timeline/TimelineModel.hpp
src/components/url-handlers/UrlHandlers.hpp
src/externals/single-application/SingleApplication.hpp
src/externals/single-application/SingleApplicationPrivate.hpp
src/utils/LinphoneUtils.hpp
...
...
src/app/App.cpp
View file @
a845693c
...
...
@@ -357,6 +357,7 @@ void App::registerTypes () {
registerSingletonType
<
OwnPresenceModel
>
(
"OwnPresenceModel"
);
registerSingletonType
<
Presence
>
(
"Presence"
);
registerSingletonType
<
TimelineModel
>
(
"TimelineModel"
);
registerSingletonType
<
UrlHandlers
>
(
"UrlHandlers"
);
registerSingletonType
<
VideoCodecsModel
>
(
"VideoCodecsModel"
);
registerMetaType
<
ChatModel
::
EntryType
>
(
"ChatModel::EntryType"
);
...
...
src/app/App.hpp
View file @
a845693c
...
...
@@ -33,9 +33,10 @@
// =============================================================================
class
QCommandLineParser
;
class
Cli
;
class
DefaultTranslator
;
class
QCommandLineParser
;
class
App
:
public
SingleApplication
{
Q_OBJECT
;
...
...
src/components/Components.hpp
View file @
a845693c
...
...
@@ -41,6 +41,7 @@
#include "sound-player/SoundPlayer.hpp"
#include "telephone-numbers/TelephoneNumbersModel.hpp"
#include "timeline/TimelineModel.hpp"
#include "url-handlers/UrlHandlers.hpp"
#include "other/clipboard/Clipboard.hpp"
#include "other/text-to-speech/TextToSpeech.hpp"
...
...
src/components/sip-addresses/SipAddressesModel.cpp
View file @
a845693c
...
...
@@ -140,14 +140,6 @@ SipAddressObserver *SipAddressesModel::getSipAddressObserver (const QString &sip
// -----------------------------------------------------------------------------
QString
SipAddressesModel
::
interpretUrl
(
const
QString
&
sipAddress
)
const
{
shared_ptr
<
linphone
::
Address
>
lAddress
=
CoreManager
::
getInstance
()
->
getCore
()
->
interpretUrl
(
::
Utils
::
appStringToCoreString
(
sipAddress
)
);
return
lAddress
?
::
Utils
::
coreStringToAppString
(
lAddress
->
asStringUriOnly
())
:
""
;
}
QString
SipAddressesModel
::
getTransportFromSipAddress
(
const
QString
&
sipAddress
)
const
{
const
shared_ptr
<
const
linphone
::
Address
>
address
=
linphone
::
Factory
::
get
()
->
createAddress
(
::
Utils
::
appStringToCoreString
(
sipAddress
)
...
...
@@ -176,13 +168,27 @@ QString SipAddressesModel::addTransportToSipAddress (const QString &sipAddress,
);
if
(
!
address
)
return
""
;
return
QString
(
""
)
;
address
->
setTransport
(
LinphoneUtils
::
stringToTransportType
(
transport
.
toUpper
()));
return
::
Utils
::
coreStringToAppString
(
address
->
asString
());
}
// -----------------------------------------------------------------------------
QString
SipAddressesModel
::
interpretUrl
(
const
QString
&
sipAddress
)
{
shared_ptr
<
linphone
::
Address
>
lAddress
=
CoreManager
::
getInstance
()
->
getCore
()
->
interpretUrl
(
::
Utils
::
appStringToCoreString
(
sipAddress
)
);
return
lAddress
?
::
Utils
::
coreStringToAppString
(
lAddress
->
asStringUriOnly
())
:
""
;
}
QString
SipAddressesModel
::
interpretUrl
(
const
QUrl
&
sipAddress
)
{
return
sipAddress
.
toString
();
}
bool
SipAddressesModel
::
sipAddressIsValid
(
const
QString
&
sipAddress
)
{
return
!!
linphone
::
Factory
::
get
()
->
createAddress
(
::
Utils
::
appStringToCoreString
(
sipAddress
)
...
...
src/components/sip-addresses/SipAddressesModel.hpp
View file @
a845693c
...
...
@@ -24,6 +24,7 @@
#define SIP_ADDRESSES_MODEL_H_
#include <QAbstractListModel>
#include <QUrl>
#include "../chat/ChatModel.hpp"
#include "../contact/ContactModel.hpp"
...
...
@@ -55,11 +56,12 @@ public:
// Sip addresses helpers.
// ---------------------------------------------------------------------------
Q_INVOKABLE
QString
interpretUrl
(
const
QString
&
sipAddress
)
const
;
Q_INVOKABLE
QString
getTransportFromSipAddress
(
const
QString
&
sipAddress
)
const
;
Q_INVOKABLE
QString
addTransportToSipAddress
(
const
QString
&
sipAddress
,
const
QString
&
transport
)
const
;
Q_INVOKABLE
static
QString
interpretUrl
(
const
QString
&
sipAddress
);
Q_INVOKABLE
static
QString
interpretUrl
(
const
QUrl
&
sipAddress
);
Q_INVOKABLE
static
bool
sipAddressIsValid
(
const
QString
&
sipAddress
);
// ---------------------------------------------------------------------------
...
...
src/components/url-handlers/UrlHandlers.cpp
0 → 100644
View file @
a845693c
/*
* UrlHandlers.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 16, 2017
* Author: Ronan Abhamon
*/
#include <QDesktopServices>
#include "../sip-addresses/SipAddressesModel.hpp"
#include "UrlHandlers.hpp"
// =============================================================================
UrlHandlers
::
UrlHandlers
(
QObject
*
parent
)
:
QObject
(
parent
)
{
QDesktopServices
::
setUrlHandler
(
"sip"
,
this
,
"handleSip"
);
}
void
UrlHandlers
::
handleSip
(
const
QUrl
&
url
)
{
emit
sip
(
SipAddressesModel
::
interpretUrl
(
url
));
}
src/components/url-handlers/UrlHandlers.hpp
0 → 100644
View file @
a845693c
/*
* UrlHandlers.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 16, 2017
* Author: Ronan Abhamon
*/
#ifndef URL_HANDLERS_H_
#define URL_HANDLERS_H_
#include <QObject>
// =============================================================================
class
UrlHandlers
:
public
QObject
{
Q_OBJECT
;
public:
UrlHandlers
(
QObject
*
parent
=
Q_NULLPTR
);
~
UrlHandlers
()
=
default
;
public
slots
:
void
handleSip
(
const
QUrl
&
url
);
signals:
void
sip
(
const
QString
&
sipAddress
);
};
#endif // URL_HANDLERS_H_
ui/views/App/Main/MainWindow.qml
View file @
a845693c
...
...
@@ -262,4 +262,16 @@ ApplicationWindow {
onClicked
:
CoreManager
.
forceRefreshRegisters
()
}
// ---------------------------------------------------------------------------
// Url handlers.
// ---------------------------------------------------------------------------
Connections
{
target
:
UrlHandlers
onSip
:
window
.
setView
(
'
Conversation
'
,
{
sipAddress
:
sipAddress
})
}
}
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