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
GitLab 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
494ba12a
Commit
494ba12a
authored
Jul 12, 2013
by
Emmanuel Lepage Vallee
Browse files
Options
Downloads
Patches
Plain Diff
[ #22321 ] Fix type (childs->children)
parent
0c4939e3
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/contactproxymodel.cpp
+19
-19
19 additions, 19 deletions
src/contactproxymodel.cpp
src/contactproxymodel.h
+1
-1
1 addition, 1 deletion
src/contactproxymodel.h
src/historymodel.cpp
+10
-10
10 additions, 10 deletions
src/historymodel.cpp
src/historymodel.h
+1
-1
1 addition, 1 deletion
src/historymodel.h
with
31 additions
and
31 deletions
src/contactproxymodel.cpp
+
19
−
19
View file @
494ba12a
...
...
@@ -96,7 +96,7 @@ void ContactProxyModel::reloadCategories()
TopLevelItem
*
item
=
m_hCategories
[
val
];
if
(
item
)
{
QModelIndex
parent
=
index
(
m_lCategoryCounter
.
indexOf
(
item
),
0
);
item
->
m_lChild
s
<<
cont
;
item
->
m_lChild
ren
<<
cont
;
}
else
qDebug
()
<<
"ERROR count"
;
...
...
@@ -136,34 +136,34 @@ QVariant ContactProxyModel::data( const QModelIndex& index, int role) const
case
ContactTreeBackend
::
Type
::
CONTACT
:
/* && (role == Qt::DisplayRole)) {*/
switch
(
role
)
{
case
Qt
::
DisplayRole
:
return
QVariant
(
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
s
[
index
.
row
()]
->
formattedName
());
return
QVariant
(
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
ren
[
index
.
row
()]
->
formattedName
());
case
AbstractContactBackend
::
Role
::
Organization
:
return
QVariant
(
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
s
[
index
.
row
()]
->
organization
());
return
QVariant
(
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
ren
[
index
.
row
()]
->
organization
());
case
AbstractContactBackend
::
Role
::
Group
:
return
QVariant
(
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
s
[
index
.
row
()]
->
group
());
return
QVariant
(
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
ren
[
index
.
row
()]
->
group
());
case
AbstractContactBackend
::
Role
::
Department
:
return
QVariant
(
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
s
[
index
.
row
()]
->
department
());
return
QVariant
(
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
ren
[
index
.
row
()]
->
department
());
case
AbstractContactBackend
::
Role
::
PreferredEmail
:
return
QVariant
(
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
s
[
index
.
row
()]
->
preferredEmail
());
return
QVariant
(
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
ren
[
index
.
row
()]
->
preferredEmail
());
case
AbstractContactBackend
::
Role
::
DropState
:
return
QVariant
(
modelItem
->
dropState
());
case
AbstractContactBackend
::
Role
::
FormattedLastUsed
:
{
if
(
!
m_isContactDateInit
)
((
ContactProxyModel
*
)
this
)
->
m_hContactByDate
=
getContactListByTime
();
return
QVariant
(
HistoryModel
::
timeToHistoryCategory
(
m_hContactByDate
[
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
s
[
index
.
row
()]]));
return
QVariant
(
HistoryModel
::
timeToHistoryCategory
(
m_hContactByDate
[
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
ren
[
index
.
row
()]]));
}
case
AbstractContactBackend
::
Role
::
IndexedLastUsed
:
{
if
(
!
m_isContactDateInit
)
((
ContactProxyModel
*
)
this
)
->
m_hContactByDate
=
getContactListByTime
();
return
QVariant
((
int
)
HistoryModel
::
timeToHistoryConst
(
m_hContactByDate
[
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
s
[
index
.
row
()]]));
return
QVariant
((
int
)
HistoryModel
::
timeToHistoryConst
(
m_hContactByDate
[
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
ren
[
index
.
row
()]]));
}
case
AbstractContactBackend
::
Role
::
DatedLastUsed
:
{
if
(
!
m_isContactDateInit
)
((
ContactProxyModel
*
)
this
)
->
m_hContactByDate
=
getContactListByTime
();
return
QVariant
(
QDateTime
::
fromTime_t
(
m_hContactByDate
[
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
s
[
index
.
row
()]]));
return
QVariant
(
QDateTime
::
fromTime_t
(
m_hContactByDate
[
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
ren
[
index
.
row
()]]));
}
case
AbstractContactBackend
::
Role
::
Filter
:
{
Contact
*
ct
=
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
s
[
index
.
row
()];
Contact
*
ct
=
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
ren
[
index
.
row
()];
QString
normStripppedC
;
foreach
(
QChar
char2
,
QString
(
ct
->
formattedName
()
+
'\n'
+
ct
->
organization
()
+
'\n'
+
ct
->
group
()
+
'\n'
+
ct
->
department
()
+
'\n'
+
ct
->
preferredEmail
()).
toLower
().
normalized
(
QString
::
NormalizationForm_KD
)
)
{
...
...
@@ -179,7 +179,7 @@ QVariant ContactProxyModel::data( const QModelIndex& index, int role) const
case
ContactTreeBackend
::
Type
::
NUMBER
:
/* && (role == Qt::DisplayRole)) {*/
switch
(
role
)
{
case
Qt
::
DisplayRole
:
return
QVariant
(
m_lCategoryCounter
[
index
.
parent
().
parent
().
row
()]
->
m_lChild
s
[
index
.
parent
().
row
()]
->
phoneNumbers
()[
index
.
row
()]
->
number
());
return
QVariant
(
m_lCategoryCounter
[
index
.
parent
().
parent
().
row
()]
->
m_lChild
ren
[
index
.
parent
().
row
()]
->
phoneNumbers
()[
index
.
row
()]
->
number
());
}
break
;
default
:
...
...
@@ -212,10 +212,10 @@ int ContactProxyModel::rowCount( const QModelIndex& parent ) const
if
(
!
parent
.
isValid
()
||
!
parent
.
internalPointer
())
return
m_lCategoryCounter
.
size
();
else
if
(
!
parent
.
parent
().
isValid
())
{
return
m_lCategoryCounter
[
parent
.
row
()]
->
m_lChild
s
.
size
();
return
m_lCategoryCounter
[
parent
.
row
()]
->
m_lChild
ren
.
size
();
}
else
if
(
parent
.
parent
().
isValid
()
&&
!
parent
.
parent
().
parent
().
isValid
())
{
return
m_lCategoryCounter
[
parent
.
parent
().
row
()]
->
m_lChild
s
[
parent
.
row
()]
->
phoneNumbers
().
size
();
return
m_lCategoryCounter
[
parent
.
parent
().
row
()]
->
m_lChild
ren
[
parent
.
row
()]
->
phoneNumbers
().
size
();
}
return
0
;
}
...
...
@@ -250,7 +250,7 @@ QModelIndex ContactProxyModel::parent( const QModelIndex& index) const
const
QString
val
=
category
(
ct
);
if
(
m_hCategories
[
val
])
{
return
ContactProxyModel
::
index
(
(
m_hCategories
[
val
]
->
m_lChild
s
.
indexOf
(
ct
)),
(
m_hCategories
[
val
]
->
m_lChild
ren
.
indexOf
(
ct
)),
0
,
ContactProxyModel
::
index
(
m_lCategoryCounter
.
indexOf
(
m_hCategories
[
val
]),
0
));
}
...
...
@@ -266,11 +266,11 @@ QModelIndex ContactProxyModel::index( int row, int column, const QModelIndex& pa
if
(
!
parent
.
isValid
())
{
return
createIndex
(
row
,
column
,
m_lCategoryCounter
[
row
]);
}
else
if
(
!
parent
.
parent
().
isValid
()
&&
column
<
m_lCategoryCounter
[
parent
.
row
()]
->
m_lChild
s
.
size
()
)
{
return
createIndex
(
row
,
column
,(
void
*
)
dynamic_cast
<
ContactTreeBackend
*>
(
m_lCategoryCounter
[
parent
.
row
()]
->
m_lChild
s
[
row
]));
else
if
(
!
parent
.
parent
().
isValid
()
&&
column
<
m_lCategoryCounter
[
parent
.
row
()]
->
m_lChild
ren
.
size
()
)
{
return
createIndex
(
row
,
column
,(
void
*
)
dynamic_cast
<
ContactTreeBackend
*>
(
m_lCategoryCounter
[
parent
.
row
()]
->
m_lChild
ren
[
row
]));
}
else
if
(
parent
.
parent
().
isValid
()
&&
m_lCategoryCounter
.
size
()
>
parent
.
parent
().
row
()
&&
m_lCategoryCounter
[
parent
.
parent
().
row
()]
->
m_lChild
s
.
size
()
>
parent
.
row
())
{
return
createIndex
(
row
,
column
,(
void
*
)
&
m_lCategoryCounter
[
parent
.
parent
().
row
()]
->
m_lChild
s
[
parent
.
row
()]
->
phoneNumbers
());
else
if
(
parent
.
parent
().
isValid
()
&&
m_lCategoryCounter
.
size
()
>
parent
.
parent
().
row
()
&&
m_lCategoryCounter
[
parent
.
parent
().
row
()]
->
m_lChild
ren
.
size
()
>
parent
.
row
())
{
return
createIndex
(
row
,
column
,(
void
*
)
&
m_lCategoryCounter
[
parent
.
parent
().
row
()]
->
m_lChild
ren
[
parent
.
row
()]
->
phoneNumbers
());
}
return
QModelIndex
();
}
...
...
@@ -294,7 +294,7 @@ QMimeData* ContactProxyModel::mimeData(const QModelIndexList &indexes) const
}
else
if
(
index
.
parent
().
isValid
())
{
//Contact
Contact
*
ct
=
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
s
[
index
.
row
()];
Contact
*
ct
=
m_lCategoryCounter
[
index
.
parent
().
row
()]
->
m_lChild
ren
[
index
.
row
()];
if
(
ct
)
{
if
(
ct
->
phoneNumbers
().
size
()
==
1
)
{
mimeData
->
setData
(
MIME_PHONENUMBER
,
ct
->
phoneNumbers
()[
0
]
->
number
().
toUtf8
());
...
...
This diff is collapsed.
Click to expand it.
src/contactproxymodel.h
+
1
−
1
View file @
494ba12a
...
...
@@ -61,7 +61,7 @@ private:
virtual
QObject
*
self
()
{
return
this
;}
private
:
explicit
TopLevelItem
(
QString
name
)
:
ContactTreeBackend
(
ContactTreeBackend
::
TOP_LEVEL
),
QObject
(
nullptr
),
m_Name
(
name
)
{}
QList
<
Contact
*>
m_lChild
s
;
QList
<
Contact
*>
m_lChild
ren
;
QString
m_Name
;
};
...
...
This diff is collapsed.
Click to expand it.
src/historymodel.cpp
+
10
−
10
View file @
494ba12a
...
...
@@ -188,7 +188,7 @@ void HistoryModel::add(Call* call)
m_lCategoryCounter
<<
item
;
emit
dataChanged
(
index
(
rowCount
()
-
1
,
0
),
index
(
rowCount
()
-
1
,
0
));
}
m_hCategories
[
cat
]
->
m_lChild
s
<<
call
;
m_hCategories
[
cat
]
->
m_lChild
ren
<<
call
;
emit
historyChanged
();
// emit layoutChanged();
}
...
...
@@ -265,7 +265,7 @@ void HistoryModel::reloadCategories()
}
TopLevelItem
*
item
=
m_hCategories
[
val
];
if
(
item
)
{
item
->
m_lChild
s
<<
call
;
item
->
m_lChild
ren
<<
call
;
}
else
qDebug
()
<<
"ERROR count"
;
...
...
@@ -310,8 +310,8 @@ QVariant HistoryModel::data( const QModelIndex& idx, int role) const
return
QVariant
(
modelItem
->
dropState
());
else
if
(
m_lCategoryCounter
.
size
()
>=
idx
.
parent
().
row
()
&&
idx
.
parent
().
row
()
>=
0
&&
m_lCategoryCounter
[
idx
.
parent
().
row
()]
&&
m_lCategoryCounter
[
idx
.
parent
().
row
()]
->
m_lChild
s
.
size
()
>=
idx
.
row
())
return
m_lCategoryCounter
[
idx
.
parent
().
row
()]
->
m_lChild
s
[
idx
.
row
()]
->
roleData
((
Call
::
Role
)
role
);
&&
m_lCategoryCounter
[
idx
.
parent
().
row
()]
->
m_lChild
ren
.
size
()
>=
idx
.
row
())
return
m_lCategoryCounter
[
idx
.
parent
().
row
()]
->
m_lChild
ren
[
idx
.
row
()]
->
roleData
((
Call
::
Role
)
role
);
break
;
case
HistoryTreeBackend
::
Type
::
NUMBER
:
case
HistoryTreeBackend
::
Type
::
BOOKMARK
:
...
...
@@ -337,10 +337,10 @@ int HistoryModel::rowCount( const QModelIndex& parentIdx ) const
return
m_lCategoryCounter
.
size
();
}
else
if
(
!
parentIdx
.
parent
().
isValid
())
{
return
m_lCategoryCounter
[
parentIdx
.
row
()]
->
m_lChild
s
.
size
();
return
m_lCategoryCounter
[
parentIdx
.
row
()]
->
m_lChild
ren
.
size
();
}
// else if (parent.parent().isValid() && !parent.parent().parent().isValid()) {
// return m_lCategoryCounter[parent.parent().row()]->m_lChild
s
[parent.row()]->getPhoneNumbers().size();
// return m_lCategoryCounter[parent.parent().row()]->m_lChild
ren
[parent.row()]->getPhoneNumbers().size();
// }
return
0
;
}
...
...
@@ -375,7 +375,7 @@ QModelIndex HistoryModel::parent( const QModelIndex& idx) const
// QString val = category(ct);
// if (m_hCategories[val]) {
// return HistoryModel::index(
// (m_hCategories[val]->m_lChild
s
.indexOf(ct)),
// (m_hCategories[val]->m_lChild
ren
.indexOf(ct)),
// 0,
// HistoryModel::index(m_lCategoryCounter.indexOf(m_hCategories[val]),0));
// }
...
...
@@ -391,11 +391,11 @@ QModelIndex HistoryModel::index( int row, int column, const QModelIndex& parentI
if
(
!
parentIdx
.
isValid
())
{
return
createIndex
(
row
,
column
,
m_lCategoryCounter
[
row
]);
}
else
if
(
!
parentIdx
.
parent
().
isValid
()
&&
column
<
m_lCategoryCounter
[
parentIdx
.
row
()]
->
m_lChild
s
.
size
()
)
{
return
createIndex
(
row
,
column
,(
void
*
)
dynamic_cast
<
HistoryTreeBackend
*>
(
m_lCategoryCounter
[
parentIdx
.
row
()]
->
m_lChild
s
[
row
]));
else
if
(
!
parentIdx
.
parent
().
isValid
()
&&
column
<
m_lCategoryCounter
[
parentIdx
.
row
()]
->
m_lChild
ren
.
size
()
)
{
return
createIndex
(
row
,
column
,(
void
*
)
dynamic_cast
<
HistoryTreeBackend
*>
(
m_lCategoryCounter
[
parentIdx
.
row
()]
->
m_lChild
ren
[
row
]));
}
// else if (parent.parent().isValid()) {
// return createIndex(row,column,(void*)&m_lCategoryCounter[parent.parent().row()]->m_lChild
s
[parent.row()]->getPhoneNumbers());
// return createIndex(row,column,(void*)&m_lCategoryCounter[parent.parent().row()]->m_lChild
ren
[parent.row()]->getPhoneNumbers());
// }
return
QModelIndex
();
}
...
...
This diff is collapsed.
Click to expand it.
src/historymodel.h
+
1
−
1
View file @
494ba12a
...
...
@@ -126,7 +126,7 @@ private:
}
private
:
TopLevelItem
(
int
name
);
CallList
m_lChild
s
;
CallList
m_lChild
ren
;
int
m_Name
;
//HistoryConst
QString
m_NameStr
;
};
...
...
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