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
74be0201
Commit
74be0201
authored
Nov 25, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(components/chat): supports a button to remove all history
parent
40236491
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
14 deletions
+71
-14
en.ts
tests/assets/languages/en.ts
+8
-0
fr.ts
tests/assets/languages/fr.ts
+8
-0
ChatModel.cpp
tests/src/components/chat/ChatModel.cpp
+32
-12
ChatModel.hpp
tests/src/components/chat/ChatModel.hpp
+6
-1
Conversation.qml
tests/ui/views/App/MainWindow/Conversation.qml
+17
-1
No files found.
tests/assets/languages/en.ts
View file @
74be0201
...
...
@@ -141,6 +141,14 @@
<
source
>
newMessagePlaceholder
<
/source
>
<
translation
type
=
"
vanished
"
>
Enter
your
message
<
/translation
>
<
/message
>
<
message
>
<
source
>
removeAllEntriesDescription
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
removeAllEntriesTitle
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
DropZone
<
/name
>
...
...
tests/assets/languages/fr.ts
View file @
74be0201
...
...
@@ -141,6 +141,14 @@
<
source
>
newMessagePlaceholder
<
/source
>
<
translation
type
=
"
vanished
"
>
Entrer
votre
message
.
<
/translation
>
<
/message
>
<
message
>
<
source
>
removeAllEntriesDescription
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
removeAllEntriesTitle
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
DropZone
<
/name
>
...
...
tests/src/components/chat/ChatModel.cpp
View file @
74be0201
...
...
@@ -46,18 +46,8 @@ bool ChatModel::removeRows (int row, int count, const QModelIndex &parent) {
beginRemoveRows
(
parent
,
row
,
limit
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
QPair
<
QVariantMap
,
shared_ptr
<
void
>
>
pair
=
m_entries
.
takeAt
(
row
);
switch
(
pair
.
first
[
"type"
].
toInt
())
{
case
ChatModel
:
:
MessageEntry
:
m_chat_room
->
deleteMessage
(
static_pointer_cast
<
linphone
::
ChatMessage
>
(
pair
.
second
)
);
break
;
case
ChatModel
:
:
CallEntry
:
break
;
}
removeEntry
(
m_entries
[
row
]);
m_entries
.
removeAt
(
row
);
}
endRemoveRows
();
...
...
@@ -74,8 +64,38 @@ void ChatModel::removeEntry (int id) {
qWarning
()
<<
"Unable to remove chat entry:"
<<
id
;
}
void
ChatModel
::
removeAllEntries
()
{
qInfo
()
<<
"Removing all chat entries of:"
<<
getSipAddress
();
beginResetModel
();
for
(
auto
&
entry
:
m_entries
)
removeEntry
(
entry
);
m_entries
.
clear
();
endResetModel
();
}
// -------------------------------------------------------------------
void
ChatModel
::
removeEntry
(
ChatEntryData
&
pair
)
{
int
type
=
pair
.
first
[
"type"
].
toInt
();
switch
(
type
)
{
case
ChatModel
:
:
MessageEntry
:
m_chat_room
->
deleteMessage
(
static_pointer_cast
<
linphone
::
ChatMessage
>
(
pair
.
second
)
);
break
;
case
ChatModel
:
:
CallEntry
:
break
;
default:
qWarning
()
<<
"Unknown chat entry type:"
<<
type
;
}
}
QString
ChatModel
::
getSipAddress
()
const
{
if
(
!
m_chat_room
)
return
""
;
...
...
tests/src/components/chat/ChatModel.hpp
View file @
74be0201
...
...
@@ -42,15 +42,20 @@ public:
public
slots
:
void
removeEntry
(
int
id
);
void
removeAllEntries
();
signals:
void
sipAddressChanged
(
const
QString
&
sipAddress
);
private:
typedef
QPair
<
QVariantMap
,
std
::
shared_ptr
<
void
>
>
ChatEntryData
;
void
removeEntry
(
ChatEntryData
&
pair
);
QString
getSipAddress
()
const
;
void
setSipAddress
(
const
QString
&
sip_address
);
QList
<
QPair
<
QVariantMap
,
std
::
shared_ptr
<
void
>
>
>
m_entries
;
QList
<
ChatEntryData
>
m_entries
;
std
::
shared_ptr
<
linphone
::
ChatRoom
>
m_chat_room
;
};
...
...
tests/ui/views/App/MainWindow/Conversation.qml
View file @
74be0201
...
...
@@ -18,6 +18,20 @@ ColumnLayout {
sipAddress
)
||
sipAddress
function
_removeAllEntries
()
{
Utils
.
openConfirmDialog
(
window
,
{
descriptionText
:
qsTr
(
'
removeAllEntriesDescription
'
),
exitHandler
:
function
(
status
)
{
if
(
status
)
{
chatModel
.
removeAllEntries
()
}
},
title
:
qsTr
(
'
removeAllEntriesTitle
'
)
})
}
// -----------------------------------------------------------------
spacing
:
0
// -----------------------------------------------------------------
...
...
@@ -90,7 +104,7 @@ ColumnLayout {
icon
:
'
delete
'
iconSize
:
ConversationStyle
.
bar
.
actions
.
edit
.
iconSize
onClicked
:
window
.
setView
(
'
Contact
'
)
// TODO.
onClicked
:
_removeAllEntries
()
}
}
}
...
...
@@ -132,6 +146,8 @@ ColumnLayout {
Layout.fillWidth
:
true
contact
:
parent
.
_contact
model
:
ChatModel
{
id
:
chatModel
sipAddress
:
conversation
.
sipAddress
}
}
...
...
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