Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
ee5ee3dc
Commit
ee5ee3dc
authored
10 years ago
by
Emmanuel Lepage Vallee
Browse files
Options
Downloads
Patches
Plain Diff
autocompletion: Better handle copy-pasted ring hashes
Refs #71751
parent
012a2b17
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/numbercompletionmodel.cpp
+39
-4
39 additions, 4 deletions
src/numbercompletionmodel.cpp
with
39 additions
and
4 deletions
src/numbercompletionmodel.cpp
+
39
−
4
View file @
ee5ee3dc
...
...
@@ -68,12 +68,13 @@ public:
//Attributes
QMultiMap
<
int
,
ContactMethod
*>
m_hNumbers
;
QString
m_Prefix
;
URI
m_Prefix
;
Call
*
m_pCall
;
bool
m_Enabled
;
bool
m_UseUnregisteredAccount
;
QHash
<
Account
*
,
TemporaryContactMethod
*>
m_hSipIaxTemporaryNumbers
;
QHash
<
Account
*
,
TemporaryContactMethod
*>
m_hRingTemporaryNumbers
;
public
Q_SLOTS
:
void
setPrefix
(
const
QString
&
str
);
...
...
@@ -87,7 +88,7 @@ private:
NumberCompletionModelPrivate
::
NumberCompletionModelPrivate
(
NumberCompletionModel
*
parent
)
:
QObject
(
parent
),
q_ptr
(
parent
),
m_pCall
(
nullptr
),
m_Enabled
(
false
),
m_UseUnregisteredAccount
(
true
)
m_pCall
(
nullptr
),
m_Enabled
(
false
),
m_UseUnregisteredAccount
(
true
)
,
m_Prefix
(
QString
())
{
//Create the temporary number list
bool
hasNonIp2Ip
=
false
;
...
...
@@ -127,6 +128,14 @@ NumberCompletionModel::~NumberCompletionModel()
delete
cm
;
}
l
=
d_ptr
->
m_hRingTemporaryNumbers
.
values
();
d_ptr
->
m_hRingTemporaryNumbers
.
clear
();
while
(
l
.
size
())
{
TemporaryContactMethod
*
cm
=
l
.
takeAt
(
0
);
delete
cm
;
}
delete
d_ptr
;
}
...
...
@@ -287,7 +296,13 @@ void NumberCompletionModelPrivate::setPrefix(const QString& str)
}
for
(
TemporaryContactMethod
*
cm
:
m_hSipIaxTemporaryNumbers
)
{
cm
->
setUri
(
str
);
cm
->
setUri
(
m_Prefix
);
}
if
(
m_Prefix
.
protocolHint
()
==
URI
::
ProtocolHint
::
RING
)
{
for
(
TemporaryContactMethod
*
cm
:
m_hRingTemporaryNumbers
)
{
cm
->
setUri
(
m_Prefix
);
}
}
}
...
...
@@ -329,6 +344,17 @@ void NumberCompletionModelPrivate::updateModel()
}
}
if
(
m_Prefix
.
protocolHint
()
==
URI
::
ProtocolHint
::
RING
)
{
for
(
TemporaryContactMethod
*
cm
:
m_hRingTemporaryNumbers
)
{
const
int
weight
=
getWeight
(
cm
->
account
());
if
(
weight
)
{
q_ptr
->
beginInsertRows
(
QModelIndex
(),
m_hNumbers
.
size
(),
m_hNumbers
.
size
());
m_hNumbers
.
insert
(
weight
,
cm
);
q_ptr
->
endInsertRows
();
}
}
}
for
(
ContactMethod
*
n
:
numbers
)
{
if
(
m_UseUnregisteredAccount
||
((
n
->
account
()
&&
n
->
account
()
->
registrationState
()
==
Account
::
RegistrationState
::
READY
)
||
!
n
->
account
()))
{
...
...
@@ -482,7 +508,12 @@ bool NumberCompletionModelPrivate::accountAdded(Account* a)
m_hSipIaxTemporaryNumbers
[
a
]
=
cm
;
}
break
;
case
Account
::
Protocol
::
RING
:
case
Account
::
Protocol
::
RING
:
{
TemporaryContactMethod
*
cm
=
new
TemporaryContactMethod
();
cm
->
setAccount
(
a
);
m_hRingTemporaryNumbers
[
a
]
=
cm
;
}
break
;
case
Account
::
Protocol
::
COUNT__
:
break
;
}
...
...
@@ -494,7 +525,11 @@ void NumberCompletionModelPrivate::accountRemoved(Account* a)
{
TemporaryContactMethod
*
cm
=
m_hSipIaxTemporaryNumbers
[
a
];
if
(
!
cm
)
cm
=
m_hRingTemporaryNumbers
[
a
];
m_hSipIaxTemporaryNumbers
[
a
]
=
nullptr
;
m_hRingTemporaryNumbers
[
a
]
=
nullptr
;
setPrefix
(
q_ptr
->
prefix
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment