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
4cd7f5af
Commit
4cd7f5af
authored
Jun 01, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(app:) provide a `TelephoneNumbers` component
parent
95b2e768
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
331 additions
and
0 deletions
+331
-0
CMakeLists.txt
linphone-desktop/CMakeLists.txt
+2
-0
App.cpp
linphone-desktop/src/app/App.cpp
+1
-0
Components.hpp
linphone-desktop/src/components/Components.hpp
+1
-0
TelephoneNumbers.cpp
...top/src/components/telephone-numbers/TelephoneNumbers.cpp
+282
-0
TelephoneNumbers.hpp
...top/src/components/telephone-numbers/TelephoneNumbers.hpp
+45
-0
No files found.
linphone-desktop/CMakeLists.txt
View file @
4cd7f5af
...
...
@@ -128,6 +128,7 @@ set(SOURCES
src/components/sip-addresses/SipAddressesProxyModel.cpp
src/components/sip-addresses/SipAddressObserver.cpp
src/components/sound-player/SoundPlayer.cpp
src/components/telephone-numbers/TelephoneNumbers.cpp
src/components/text-to-speech/TextToSpeech.cpp
src/components/timeline/TimelineModel.cpp
src/externals/single-application/SingleApplication.cpp
...
...
@@ -175,6 +176,7 @@ set(HEADERS
src/components/sip-addresses/SipAddressesProxyModel.hpp
src/components/sip-addresses/SipAddressObserver.hpp
src/components/sound-player/SoundPlayer.hpp
src/components/telephone-numbers/TelephoneNumbers.hpp
src/components/text-to-speech/TextToSpeech.hpp
src/components/timeline/TimelineModel.hpp
src/externals/single-application/SingleApplication.hpp
...
...
linphone-desktop/src/app/App.cpp
View file @
4cd7f5af
...
...
@@ -353,6 +353,7 @@ void App::registerTypes () {
registerType
<
ContactsListProxyModel
>
(
"ContactsListProxyModel"
);
registerType
<
SipAddressesProxyModel
>
(
"SipAddressesProxyModel"
);
registerType
<
SoundPlayer
>
(
"SoundPlayer"
);
registerType
<
TelephoneNumbers
>
(
"TelephoneNumbers"
);
registerSingletonType
<
AudioCodecsModel
>
(
"AudioCodecsModel"
);
registerSingletonType
<
Clipboard
>
(
"Clipboard"
);
...
...
linphone-desktop/src/components/Components.hpp
View file @
4cd7f5af
...
...
@@ -40,6 +40,7 @@
#include "settings/AccountSettingsModel.hpp"
#include "sip-addresses/SipAddressesProxyModel.hpp"
#include "sound-player/SoundPlayer.hpp"
#include "telephone-numbers/TelephoneNumbers.hpp"
#include "text-to-speech/TextToSpeech.hpp"
#include "timeline/TimelineModel.hpp"
...
...
linphone-desktop/src/components/telephone-numbers/TelephoneNumbers.cpp
0 → 100644
View file @
4cd7f5af
/*
* TelephoneNumbers.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: May 31, 2017
* Author: Ronan Abhamon
*/
#include "TelephoneNumbers.hpp"
// =============================================================================
const
QList
<
QPair
<
QLocale
::
Country
,
QString
>
>
TelephoneNumbers
::
mCountryCodes
=
{
{
QLocale
::
Afghanistan
,
"93"
},
{
QLocale
::
Albania
,
"355"
},
{
QLocale
::
Algeria
,
"213"
},
{
QLocale
::
AmericanSamoa
,
"1"
},
{
QLocale
::
Andorra
,
"376"
},
{
QLocale
::
Angola
,
"244"
},
{
QLocale
::
Anguilla
,
"1"
},
{
QLocale
::
AntiguaAndBarbuda
,
"1"
},
{
QLocale
::
Argentina
,
"54"
},
{
QLocale
::
Armenia
,
"374"
},
{
QLocale
::
Aruba
,
"297"
},
{
QLocale
::
Australia
,
"61"
},
{
QLocale
::
Austria
,
"43"
},
{
QLocale
::
Azerbaijan
,
"994"
},
{
QLocale
::
Bahamas
,
"1"
},
{
QLocale
::
Bahrain
,
"973"
},
{
QLocale
::
Bangladesh
,
"880"
},
{
QLocale
::
Barbados
,
"1"
},
{
QLocale
::
Belarus
,
"375"
},
{
QLocale
::
Belgium
,
"32"
},
{
QLocale
::
Belize
,
"501"
},
{
QLocale
::
Benin
,
"229"
},
{
QLocale
::
Bermuda
,
"1"
},
{
QLocale
::
Bhutan
,
"975"
},
{
QLocale
::
Bolivia
,
"591"
},
{
QLocale
::
BosniaAndHerzegowina
,
"387"
},
{
QLocale
::
Botswana
,
"267"
},
{
QLocale
::
Brazil
,
"55"
},
{
QLocale
::
Brunei
,
"673"
},
{
QLocale
::
Bulgaria
,
"359"
},
{
QLocale
::
BurkinaFaso
,
"226"
},
{
QLocale
::
Burundi
,
"257"
},
{
QLocale
::
Cambodia
,
"855"
},
{
QLocale
::
Cameroon
,
"237"
},
{
QLocale
::
Canada
,
"1"
},
{
QLocale
::
CapeVerde
,
"238"
},
{
QLocale
::
CaymanIslands
,
"1"
},
{
QLocale
::
CentralAfricanRepublic
,
"236"
},
{
QLocale
::
Chad
,
"235"
},
{
QLocale
::
Chile
,
"56"
},
{
QLocale
::
China
,
"86"
},
{
QLocale
::
Colombia
,
"57"
},
{
QLocale
::
Comoros
,
"269"
},
{
QLocale
::
PeoplesRepublicOfCongo
,
"242"
},
{
QLocale
::
DemocraticRepublicOfCongo
,
"243"
},
{
QLocale
::
CookIslands
,
"682"
},
{
QLocale
::
CostaRica
,
"506"
},
{
QLocale
::
IvoryCoast
,
"225"
},
{
QLocale
::
Croatia
,
"385"
},
{
QLocale
::
Cuba
,
"53"
},
{
QLocale
::
Cyprus
,
"357"
},
{
QLocale
::
CzechRepublic
,
"420"
},
{
QLocale
::
Denmark
,
"45"
},
{
QLocale
::
Djibouti
,
"253"
},
{
QLocale
::
Dominica
,
"1"
},
{
QLocale
::
DominicanRepublic
,
"1"
},
{
QLocale
::
Ecuador
,
"593"
},
{
QLocale
::
Egypt
,
"20"
},
{
QLocale
::
ElSalvador
,
"503"
},
{
QLocale
::
EquatorialGuinea
,
"240"
},
{
QLocale
::
Eritrea
,
"291"
},
{
QLocale
::
Estonia
,
"372"
},
{
QLocale
::
Ethiopia
,
"251"
},
{
QLocale
::
FalklandIslands
,
"500"
},
{
QLocale
::
FaroeIslands
,
"298"
},
{
QLocale
::
Fiji
,
"679"
},
{
QLocale
::
Finland
,
"358"
},
{
QLocale
::
France
,
"33"
},
{
QLocale
::
FrenchGuiana
,
"594"
},
{
QLocale
::
FrenchPolynesia
,
"689"
},
{
QLocale
::
Gabon
,
"241"
},
{
QLocale
::
Gambia
,
"220"
},
{
QLocale
::
Georgia
,
"995"
},
{
QLocale
::
Germany
,
"49"
},
{
QLocale
::
Ghana
,
"233"
},
{
QLocale
::
Gibraltar
,
"350"
},
{
QLocale
::
Greece
,
"30"
},
{
QLocale
::
Greenland
,
"299"
},
{
QLocale
::
Grenada
,
"1"
},
{
QLocale
::
Guadeloupe
,
"590"
},
{
QLocale
::
Guam
,
"1"
},
{
QLocale
::
Guatemala
,
"502"
},
{
QLocale
::
Guinea
,
"224"
},
{
QLocale
::
GuineaBissau
,
"245"
},
{
QLocale
::
Guyana
,
"592"
},
{
QLocale
::
Haiti
,
"509"
},
{
QLocale
::
Honduras
,
"504"
},
{
QLocale
::
HongKong
,
"852"
},
{
QLocale
::
Hungary
,
"36"
},
{
QLocale
::
Iceland
,
"354"
},
{
QLocale
::
India
,
"91"
},
{
QLocale
::
Indonesia
,
"62"
},
{
QLocale
::
Iran
,
"98"
},
{
QLocale
::
Iraq
,
"964"
},
{
QLocale
::
Ireland
,
"353"
},
{
QLocale
::
Israel
,
"972"
},
{
QLocale
::
Italy
,
"39"
},
{
QLocale
::
Jamaica
,
"1"
},
{
QLocale
::
Japan
,
"81"
},
{
QLocale
::
Jordan
,
"962"
},
{
QLocale
::
Kazakhstan
,
"7"
},
{
QLocale
::
Kenya
,
"254"
},
{
QLocale
::
Kiribati
,
"686"
},
{
QLocale
::
DemocraticRepublicOfKorea
,
"850"
},
{
QLocale
::
RepublicOfKorea
,
"82"
},
{
QLocale
::
Kuwait
,
"965"
},
{
QLocale
::
Kyrgyzstan
,
"996"
},
{
QLocale
::
Laos
,
"856"
},
{
QLocale
::
Latvia
,
"371"
},
{
QLocale
::
Lebanon
,
"961"
},
{
QLocale
::
Lesotho
,
"266"
},
{
QLocale
::
Liberia
,
"231"
},
{
QLocale
::
Libya
,
"218"
},
{
QLocale
::
Liechtenstein
,
"423"
},
{
QLocale
::
Lithuania
,
"370"
},
{
QLocale
::
Luxembourg
,
"352"
},
{
QLocale
::
Macau
,
"853"
},
{
QLocale
::
Macedonia
,
"389"
},
{
QLocale
::
Madagascar
,
"261"
},
{
QLocale
::
Malawi
,
"265"
},
{
QLocale
::
Malaysia
,
"60"
},
{
QLocale
::
Maldives
,
"960"
},
{
QLocale
::
Mali
,
"223"
},
{
QLocale
::
Malta
,
"356"
},
{
QLocale
::
MarshallIslands
,
"692"
},
{
QLocale
::
Martinique
,
"596"
},
{
QLocale
::
Mauritania
,
"222"
},
{
QLocale
::
Mauritius
,
"230"
},
{
QLocale
::
Mayotte
,
"262"
},
{
QLocale
::
Mexico
,
"52"
},
{
QLocale
::
Micronesia
,
"691"
},
{
QLocale
::
Moldova
,
"373"
},
{
QLocale
::
Monaco
,
"377"
},
{
QLocale
::
Mongolia
,
"976"
},
{
QLocale
::
Montenegro
,
"382"
},
{
QLocale
::
Montserrat
,
"664"
},
{
QLocale
::
Morocco
,
"212"
},
{
QLocale
::
Mozambique
,
"258"
},
{
QLocale
::
Myanmar
,
"95"
},
{
QLocale
::
Namibia
,
"264"
},
{
QLocale
::
NauruCountry
,
"674"
},
{
QLocale
::
Nepal
,
"43"
},
{
QLocale
::
Netherlands
,
"31"
},
{
QLocale
::
NewCaledonia
,
"687"
},
{
QLocale
::
NewZealand
,
"64"
},
{
QLocale
::
Nicaragua
,
"505"
},
{
QLocale
::
Niger
,
"227"
},
{
QLocale
::
Nigeria
,
"234"
},
{
QLocale
::
Niue
,
"683"
},
{
QLocale
::
NorfolkIsland
,
"672"
},
{
QLocale
::
NorthernMarianaIslands
,
"1"
},
{
QLocale
::
Norway
,
"47"
},
{
QLocale
::
Oman
,
"968"
},
{
QLocale
::
Pakistan
,
"92"
},
{
QLocale
::
Palau
,
"680"
},
{
QLocale
::
PalestinianTerritories
,
"970"
},
{
QLocale
::
Panama
,
"507"
},
{
QLocale
::
PapuaNewGuinea
,
"675"
},
{
QLocale
::
Paraguay
,
"595"
},
{
QLocale
::
Peru
,
"51"
},
{
QLocale
::
Philippines
,
"63"
},
{
QLocale
::
Poland
,
"48"
},
{
QLocale
::
Portugal
,
"351"
},
{
QLocale
::
PuertoRico
,
"1"
},
{
QLocale
::
Qatar
,
"974"
},
{
QLocale
::
Reunion
,
"262"
},
{
QLocale
::
Romania
,
"40"
},
{
QLocale
::
RussianFederation
,
"7"
},
{
QLocale
::
Rwanda
,
"250"
},
{
QLocale
::
SaintHelena
,
"290"
},
{
QLocale
::
SaintKittsAndNevis
,
"1"
},
{
QLocale
::
SaintLucia
,
"1"
},
{
QLocale
::
SaintPierreAndMiquelon
,
"508"
},
{
QLocale
::
SaintVincentAndTheGrenadines
,
"1"
},
{
QLocale
::
Samoa
,
"685"
},
{
QLocale
::
SanMarino
,
"378"
},
{
QLocale
::
SaoTomeAndPrincipe
,
"239"
},
{
QLocale
::
SaudiArabia
,
"966"
},
{
QLocale
::
Senegal
,
"221"
},
{
QLocale
::
Serbia
,
"381"
},
{
QLocale
::
Seychelles
,
"248"
},
{
QLocale
::
SierraLeone
,
"232"
},
{
QLocale
::
Singapore
,
"65"
},
{
QLocale
::
Slovakia
,
"421"
},
{
QLocale
::
Slovenia
,
"386"
},
{
QLocale
::
SolomonIslands
,
"677"
},
{
QLocale
::
Somalia
,
"252"
},
{
QLocale
::
SouthAfrica
,
"27"
},
{
QLocale
::
Spain
,
"34"
},
{
QLocale
::
SriLanka
,
"94"
},
{
QLocale
::
Sudan
,
"249"
},
{
QLocale
::
Suriname
,
"597"
},
{
QLocale
::
Swaziland
,
"268"
},
{
QLocale
::
Sweden
,
"46"
},
{
QLocale
::
Switzerland
,
"41"
},
{
QLocale
::
Syria
,
"963"
},
{
QLocale
::
Taiwan
,
"886"
},
{
QLocale
::
Tajikistan
,
"992"
},
{
QLocale
::
Tanzania
,
"255"
},
{
QLocale
::
Thailand
,
"66"
},
{
QLocale
::
Togo
,
"228"
},
{
QLocale
::
Tokelau
,
"690"
},
{
QLocale
::
Tonga
,
"676"
},
{
QLocale
::
TrinidadAndTobago
,
"1"
},
{
QLocale
::
Tunisia
,
"216"
},
{
QLocale
::
Turkey
,
"90"
},
{
QLocale
::
Turkmenistan
,
"993"
},
{
QLocale
::
TurksAndCaicosIslands
,
"1"
},
{
QLocale
::
Tuvalu
,
"688"
},
{
QLocale
::
Uganda
,
"256"
},
{
QLocale
::
Ukraine
,
"380"
},
{
QLocale
::
UnitedArabEmirates
,
"971"
},
{
QLocale
::
UnitedKingdom
,
"44"
},
{
QLocale
::
UnitedStates
,
"1"
},
{
QLocale
::
Uruguay
,
"598"
},
{
QLocale
::
Uzbekistan
,
"998"
},
{
QLocale
::
Vanuatu
,
"678"
},
{
QLocale
::
Venezuela
,
"58"
},
{
QLocale
::
Vietnam
,
"84"
},
{
QLocale
::
WallisAndFutunaIslands
,
"681"
},
{
QLocale
::
Yemen
,
"967"
},
{
QLocale
::
Zambia
,
"260"
},
{
QLocale
::
Zimbabwe
,
"263"
}
};
// -----------------------------------------------------------------------------
TelephoneNumbers
::
TelephoneNumbers
(
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
{}
int
TelephoneNumbers
::
rowCount
(
const
QModelIndex
&
)
const
{
return
mCountryCodes
.
count
();
}
QHash
<
int
,
QByteArray
>
TelephoneNumbers
::
roleNames
()
const
{
QHash
<
int
,
QByteArray
>
roles
;
roles
[
Qt
::
DisplayRole
]
=
"$phoneNumber"
;
return
roles
;
}
QVariant
TelephoneNumbers
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
int
row
=
index
.
row
();
if
(
!
index
.
isValid
()
||
row
<
0
||
row
>=
mCountryCodes
.
count
())
return
QVariant
();
if
(
role
==
Qt
::
DisplayRole
)
{
const
QPair
<
QLocale
::
Country
,
QString
>
&
countryCode
=
mCountryCodes
[
row
];
QVariantMap
map
;
map
[
"countryCode"
]
=
countryCode
.
second
;
map
[
"countryName"
]
=
QLocale
::
countryToString
(
countryCode
.
first
);
}
return
QVariant
();
}
linphone-desktop/src/components/telephone-numbers/TelephoneNumbers.hpp
0 → 100644
View file @
4cd7f5af
/*
* TelephoneNumbers.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: May 31, 2017
* Author: Ronan Abhamon
*/
#ifndef TELEPHONE_NUMBERS_H_
#define TELEPHONE_NUMBERS_H_
#include <QAbstractListModel>
#include <QLocale>
// =============================================================================
class
TelephoneNumbers
:
public
QAbstractListModel
{
public:
TelephoneNumbers
(
QObject
*
parent
=
Q_NULLPTR
);
~
TelephoneNumbers
()
=
default
;
int
rowCount
(
const
QModelIndex
&
index
=
QModelIndex
())
const
override
;
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
override
;
private:
static
const
QList
<
QPair
<
QLocale
::
Country
,
QString
>
>
mCountryCodes
;
};
#endif // ifndef TELEPHONE_NUMBERS_H_
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