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
43d98ae0
Commit
43d98ae0
authored
10 years ago
by
Emmanuel Lepage Vallee
Browse files
Options
Downloads
Patches
Plain Diff
autocompletion: Add option to show the most used contact methods
This option is disabled by default Refs #72109
parent
2b811730
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/numbercompletionmodel.cpp
+26
-3
26 additions, 3 deletions
src/numbercompletionmodel.cpp
src/numbercompletionmodel.h
+3
-0
3 additions, 0 deletions
src/numbercompletionmodel.h
with
29 additions
and
3 deletions
src/numbercompletionmodel.cpp
+
26
−
3
View file @
43d98ae0
...
@@ -72,6 +72,7 @@ public:
...
@@ -72,6 +72,7 @@ public:
Call
*
m_pCall
;
Call
*
m_pCall
;
bool
m_Enabled
;
bool
m_Enabled
;
bool
m_UseUnregisteredAccount
;
bool
m_UseUnregisteredAccount
;
bool
m_DisplayMostUsedNumbers
;
QHash
<
Account
*
,
TemporaryContactMethod
*>
m_hSipIaxTemporaryNumbers
;
QHash
<
Account
*
,
TemporaryContactMethod
*>
m_hSipIaxTemporaryNumbers
;
QHash
<
Account
*
,
TemporaryContactMethod
*>
m_hRingTemporaryNumbers
;
QHash
<
Account
*
,
TemporaryContactMethod
*>
m_hRingTemporaryNumbers
;
...
@@ -88,7 +89,7 @@ private:
...
@@ -88,7 +89,7 @@ private:
NumberCompletionModelPrivate
::
NumberCompletionModelPrivate
(
NumberCompletionModel
*
parent
)
:
QObject
(
parent
),
q_ptr
(
parent
),
NumberCompletionModelPrivate
::
NumberCompletionModelPrivate
(
NumberCompletionModel
*
parent
)
:
QObject
(
parent
),
q_ptr
(
parent
),
m_pCall
(
nullptr
),
m_Enabled
(
false
),
m_UseUnregisteredAccount
(
true
),
m_Prefix
(
QString
())
m_pCall
(
nullptr
),
m_Enabled
(
false
),
m_UseUnregisteredAccount
(
true
),
m_Prefix
(
QString
())
,
m_DisplayMostUsedNumbers
(
false
)
{
{
//Create the temporary number list
//Create the temporary number list
bool
hasNonIp2Ip
=
false
;
bool
hasNonIp2Ip
=
false
;
...
@@ -163,7 +164,7 @@ QVariant NumberCompletionModel::data(const QModelIndex& index, int role ) const
...
@@ -163,7 +164,7 @@ QVariant NumberCompletionModel::data(const QModelIndex& index, int role ) const
const
ContactMethod
*
n
=
i
.
value
();
const
ContactMethod
*
n
=
i
.
value
();
const
int
weight
=
i
.
key
();
const
int
weight
=
i
.
key
();
bool
needAcc
=
(
role
>=
100
||
role
==
Qt
::
UserRole
)
&&
n
->
account
()
&&
n
->
account
()
!=
AvailableAccountModel
::
currentDefaultAccount
()
bool
needAcc
=
(
role
>=
100
||
role
==
Qt
::
UserRole
)
&&
n
->
account
()
/*
&& n->account() != AvailableAccountModel::currentDefaultAccount()
*/
&&
n
->
account
()
->
alias
()
!=
DRing
::
Account
::
ProtocolNames
::
IP2IP
;
&&
n
->
account
()
->
alias
()
!=
DRing
::
Account
::
ProtocolNames
::
IP2IP
;
switch
(
static_cast
<
NumberCompletionModelPrivate
::
Columns
>
(
index
.
column
()))
{
switch
(
static_cast
<
NumberCompletionModelPrivate
::
Columns
>
(
index
.
column
()))
{
...
@@ -280,7 +281,7 @@ void NumberCompletionModel::setCall(Call* call)
...
@@ -280,7 +281,7 @@ void NumberCompletionModel::setCall(Call* call)
void
NumberCompletionModelPrivate
::
setPrefix
(
const
QString
&
str
)
void
NumberCompletionModelPrivate
::
setPrefix
(
const
QString
&
str
)
{
{
m_Prefix
=
str
;
m_Prefix
=
str
;
const
bool
e
=
((
m_pCall
&&
m_pCall
->
lifeCycleState
()
==
Call
::
LifeCycleState
::
CREATION
)
||
(
!
m_pCall
))
&&
(
!
str
.
isEmpty
());
const
bool
e
=
((
m_pCall
&&
m_pCall
->
lifeCycleState
()
==
Call
::
LifeCycleState
::
CREATION
)
||
(
!
m_pCall
))
&&
(
(
m_DisplayMostUsedNumbers
||
!
str
.
isEmpty
())
)
;
if
(
m_Enabled
!=
e
)
{
if
(
m_Enabled
!=
e
)
{
m_Enabled
=
e
;
m_Enabled
=
e
;
...
@@ -364,6 +365,17 @@ void NumberCompletionModelPrivate::updateModel()
...
@@ -364,6 +365,17 @@ void NumberCompletionModelPrivate::updateModel()
}
}
}
}
}
}
else
if
(
m_DisplayMostUsedNumbers
)
{
//If enabled, display the most probable entries
const
QVector
<
ContactMethod
*>
cl
=
PhoneDirectoryModel
::
instance
()
->
getNumbersByPopularity
();
for
(
int
i
=
0
;
i
<
((
cl
.
size
()
>=
10
)
?
10
:
cl
.
size
());
i
++
)
{
ContactMethod
*
n
=
cl
[
i
];
q_ptr
->
beginInsertRows
(
QModelIndex
(),
m_hNumbers
.
size
(),
m_hNumbers
.
size
());
m_hNumbers
.
insert
(
getWeight
(
n
),
n
);
q_ptr
->
endInsertRows
();
}
}
}
}
void
NumberCompletionModelPrivate
::
getRange
(
QMap
<
QString
,
NumberWrapper
*>
map
,
const
QString
&
prefix
,
QSet
<
ContactMethod
*>&
set
)
const
void
NumberCompletionModelPrivate
::
getRange
(
QMap
<
QString
,
NumberWrapper
*>
map
,
const
QString
&
prefix
,
QSet
<
ContactMethod
*>&
set
)
const
...
@@ -494,6 +506,17 @@ bool NumberCompletionModel::isUsingUnregisteredAccounts()
...
@@ -494,6 +506,17 @@ bool NumberCompletionModel::isUsingUnregisteredAccounts()
return
d_ptr
->
m_UseUnregisteredAccount
;
return
d_ptr
->
m_UseUnregisteredAccount
;
}
}
void
NumberCompletionModel
::
setDisplayMostUsedNumbers
(
bool
value
)
{
d_ptr
->
m_DisplayMostUsedNumbers
=
value
;
}
bool
NumberCompletionModel
::
displayMostUsedNumbers
()
const
{
return
d_ptr
->
m_DisplayMostUsedNumbers
;
}
bool
NumberCompletionModelPrivate
::
accountAdded
(
Account
*
a
)
bool
NumberCompletionModelPrivate
::
accountAdded
(
Account
*
a
)
{
{
bool
hasNonIp2Ip
=
false
;
bool
hasNonIp2Ip
=
false
;
...
...
This diff is collapsed.
Click to expand it.
src/numbercompletionmodel.h
+
3
−
0
View file @
43d98ae0
...
@@ -36,6 +36,7 @@ public:
...
@@ -36,6 +36,7 @@ public:
//Properties
//Properties
Q_PROPERTY
(
QString
prefix
READ
prefix
)
Q_PROPERTY
(
QString
prefix
READ
prefix
)
Q_PROPERTY
(
bool
displayMostUsedNumbers
READ
displayMostUsedNumbers
WRITE
setDisplayMostUsedNumbers
)
enum
Role
{
enum
Role
{
ALTERNATE_ACCOUNT
=
100
,
ALTERNATE_ACCOUNT
=
100
,
...
@@ -59,12 +60,14 @@ public:
...
@@ -59,12 +60,14 @@ public:
//Setters
//Setters
void
setCall
(
Call
*
call
);
void
setCall
(
Call
*
call
);
void
setUseUnregisteredAccounts
(
bool
value
);
void
setUseUnregisteredAccounts
(
bool
value
);
void
setDisplayMostUsedNumbers
(
bool
value
);
//Getters
//Getters
Call
*
call
()
const
;
Call
*
call
()
const
;
ContactMethod
*
number
(
const
QModelIndex
&
idx
)
const
;
ContactMethod
*
number
(
const
QModelIndex
&
idx
)
const
;
bool
isUsingUnregisteredAccounts
();
bool
isUsingUnregisteredAccounts
();
QString
prefix
()
const
;
QString
prefix
()
const
;
bool
displayMostUsedNumbers
()
const
;
private
:
private
:
NumberCompletionModelPrivate
*
d_ptr
;
NumberCompletionModelPrivate
*
d_ptr
;
...
...
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