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
c5ad9251
Commit
c5ad9251
authored
May 04, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(src/components/contact/VcardModel): `removeBelcardPhoto` handle all linphone desktop photos
parent
4f16551b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
VcardModel.cpp
linphone-desktop/src/components/contact/VcardModel.cpp
+14
-10
No files found.
linphone-desktop/src/components/contact/VcardModel.cpp
View file @
c5ad9251
...
...
@@ -58,14 +58,13 @@ inline shared_ptr<T> findBelCardValue (const list<shared_ptr<T> > &list, const Q
return
nullptr
;
}
inline
bool
isLinphoneDesktopPhoto
(
const
shared_ptr
<
belcard
::
BelCardPhoto
>
&
photo
)
{
return
!
photo
->
getValue
().
compare
(
0
,
sizeof
(
VCARD_SCHEME
)
-
1
,
VCARD_SCHEME
);
}
inline
shared_ptr
<
belcard
::
BelCardPhoto
>
findBelcardPhoto
(
const
shared_ptr
<
belcard
::
BelCard
>
&
belcard
)
{
const
list
<
shared_ptr
<
belcard
::
BelCardPhoto
>
>
&
photos
=
belcard
->
getPhotos
();
auto
it
=
find_if
(
photos
.
cbegin
(),
photos
.
cend
(),
[](
const
shared_ptr
<
belcard
::
BelCardPhoto
>
&
photo
)
{
return
!
photo
->
getValue
().
compare
(
0
,
sizeof
(
VCARD_SCHEME
)
-
1
,
VCARD_SCHEME
);
}
);
auto
it
=
find_if
(
photos
.
cbegin
(),
photos
.
cend
(),
isLinphoneDesktopPhoto
);
if
(
it
!=
photos
.
cend
())
return
*
it
;
...
...
@@ -73,17 +72,22 @@ inline shared_ptr<belcard::BelCardPhoto> findBelcardPhoto (const shared_ptr<belc
}
inline
void
removeBelcardPhoto
(
const
shared_ptr
<
belcard
::
BelCard
>
&
belcard
)
{
shared_ptr
<
belcard
::
BelCardPhoto
>
oldPhoto
=
findBelcardPhoto
(
belcard
);
if
(
oldPhoto
)
{
list
<
shared_ptr
<
belcard
::
BelCardPhoto
>
>
photos
;
for
(
const
auto
photo
:
belcard
->
getPhotos
())
{
if
(
isLinphoneDesktopPhoto
(
photo
))
photos
.
push_back
(
photo
);
}
for
(
const
auto
photo
:
photos
)
{
QString
imagePath
(
::
Utils
::
linphoneStringToQString
(
Paths
::
getAvatarsDirPath
()
+
oldP
hoto
->
getValue
().
substr
(
sizeof
(
VCARD_SCHEME
)
-
1
)
Paths
::
getAvatarsDirPath
()
+
p
hoto
->
getValue
().
substr
(
sizeof
(
VCARD_SCHEME
)
-
1
)
)
);
if
(
!
QFile
::
remove
(
imagePath
))
qWarning
()
<<
QStringLiteral
(
"Unable to remove `%1`."
).
arg
(
imagePath
);
belcard
->
removePhoto
(
oldP
hoto
);
belcard
->
removePhoto
(
p
hoto
);
}
}
...
...
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