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
6da5936f
Commit
6da5936f
authored
10 years ago
by
Stepan Salenikovich
Browse files
Options
Downloads
Patches
Plain Diff
lrc: fix invalid idices in NumberCompletionModel
Refs #71148
parent
560a47a8
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
+13
-6
13 additions, 6 deletions
src/numbercompletionmodel.cpp
src/numbercompletionmodel.h
+2
-0
2 additions, 0 deletions
src/numbercompletionmodel.h
with
15 additions
and
6 deletions
src/numbercompletionmodel.cpp
+
13
−
6
View file @
6da5936f
...
...
@@ -105,7 +105,9 @@ QHash<int,QByteArray> NumberCompletionModel::roleNames() const
QVariant
NumberCompletionModel
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
if
(
!
index
.
isValid
())
return
QVariant
();
if
(
!
index
.
isValid
())
return
QVariant
();
const
QMap
<
int
,
ContactMethod
*>::
iterator
i
=
d_ptr
->
m_hNumbers
.
end
()
-
1
-
index
.
row
();
const
ContactMethod
*
n
=
i
.
value
();
const
int
weight
=
i
.
key
();
...
...
@@ -220,8 +222,9 @@ void NumberCompletionModel::setPrefix(const QString& str)
if
(
d_ptr
->
m_Enabled
)
d_ptr
->
updateModel
();
else
{
beginRemoveRows
(
QModelIndex
(),
0
,
d_ptr
->
m_hNumbers
.
size
()
-
1
);
d_ptr
->
m_hNumbers
.
clear
();
e
mit
layoutChanged
();
e
ndRemoveRows
();
}
}
...
...
@@ -241,20 +244,24 @@ ContactMethod* NumberCompletionModel::number(const QModelIndex& idx) const
void
NumberCompletionModelPrivate
::
updateModel
()
{
QSet
<
ContactMethod
*>
numbers
;
q_ptr
->
beginRe
setModel
(
);
q_ptr
->
beginRe
moveRows
(
QModelIndex
(),
0
,
m_hNumbers
.
size
()
-
1
);
m_hNumbers
.
clear
();
q_ptr
->
endRemoveRows
();
if
(
!
m_Prefix
.
isEmpty
())
{
locateNameRange
(
m_Prefix
,
numbers
);
locateNumberRange
(
m_Prefix
,
numbers
);
foreach
(
ContactMethod
*
n
,
numbers
)
{
if
(
m_UseUnregisteredAccount
||
((
n
->
account
()
&&
n
->
account
()
->
registrationState
()
==
Account
::
RegistrationState
::
READY
)
||
!
n
->
account
()))
||
!
n
->
account
()))
{
q_ptr
->
beginInsertRows
(
QModelIndex
(),
m_hNumbers
.
size
(),
m_hNumbers
.
size
());
m_hNumbers
.
insert
(
getWeight
(
n
),
n
);
q_ptr
->
endInsertRows
();
qDebug
()
<<
"inserting at"
<<
getWeight
(
n
)
<<
n
->
primaryName
();
qDebug
()
<<
"rows: "
<<
m_hNumbers
.
size
();
}
}
}
q_ptr
->
endResetModel
();
emit
q_ptr
->
layoutChanged
();
}
void
NumberCompletionModelPrivate
::
getRange
(
QMap
<
QString
,
NumberWrapper
*>
map
,
const
QString
&
prefix
,
QSet
<
ContactMethod
*>&
set
)
const
...
...
This diff is collapsed.
Click to expand it.
src/numbercompletionmodel.h
+
2
−
0
View file @
6da5936f
...
...
@@ -53,6 +53,8 @@ public:
virtual
bool
setData
(
const
QModelIndex
&
index
,
const
QVariant
&
value
,
int
role
)
override
;
virtual
int
columnCount
(
const
QModelIndex
&
parent
=
QModelIndex
()
)
const
override
;
virtual
QVariant
headerData
(
int
section
,
Qt
::
Orientation
orientation
,
int
role
=
Qt
::
DisplayRole
)
const
override
;
// virtual QModelIndex index ( int row, int column, const QModelIndex& parent=QModelIndex()) const override;
virtual
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
//Setters
...
...
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