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
67e0a4fa
Commit
67e0a4fa
authored
Jan 12, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/modules/Linphone/Chat/OutgoingMessage): supports resend action
parent
bd47b421
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
2 deletions
+36
-2
ChatModel.cpp
tests/src/components/chat/ChatModel.cpp
+22
-0
ChatModel.hpp
tests/src/components/chat/ChatModel.hpp
+2
-0
ChatProxyModel.cpp
tests/src/components/chat/ChatProxyModel.cpp
+7
-0
ChatProxyModel.hpp
tests/src/components/chat/ChatProxyModel.hpp
+1
-0
OutgoingMessage.qml
tests/ui/modules/Linphone/Chat/OutgoingMessage.qml
+4
-2
No files found.
tests/src/components/chat/ChatModel.cpp
View file @
67e0a4fa
...
...
@@ -253,6 +253,28 @@ void ChatModel::sendMessage (const QString &message) {
emit
messageSent
(
_message
);
}
void
ChatModel
::
resendMessage
(
int
id
)
{
if
(
id
<
0
||
id
>
m_entries
.
count
())
{
qWarning
()
<<
QStringLiteral
(
"Entry %1 not exists."
).
arg
(
id
);
return
;
}
const
ChatEntryData
&
entry
=
m_entries
[
id
];
if
(
entry
.
first
[
"type"
]
!=
EntryType
::
MessageEntry
)
{
qWarning
()
<<
QStringLiteral
(
"Unable to resend entry %1. It's not a message."
).
arg
(
id
);
return
;
}
shared_ptr
<
linphone
::
ChatMessage
>
message
=
static_pointer_cast
<
linphone
::
ChatMessage
>
(
entry
.
second
);
if
(
message
->
getState
()
!=
linphone
::
ChatMessageStateNotDelivered
)
{
qWarning
()
<<
QStringLiteral
(
"Unable to resend message: %1. Bad state."
).
arg
(
id
);
return
;
}
message
->
setListener
(
m_message_handlers
);
m_chat_room
->
sendMessage
(
message
);
}
// -----------------------------------------------------------------------------
void
ChatModel
::
fillMessageEntry
(
...
...
tests/src/components/chat/ChatModel.hpp
View file @
67e0a4fa
...
...
@@ -68,6 +68,8 @@ public:
void
sendMessage
(
const
QString
&
message
);
void
resendMessage
(
int
id
);
signals:
void
sipAddressChanged
(
const
QString
&
sip_address
);
void
allEntriesRemoved
();
...
...
tests/src/components/chat/ChatProxyModel.cpp
View file @
67e0a4fa
...
...
@@ -98,6 +98,13 @@ void ChatProxyModel::sendMessage (const QString &message) {
static_cast
<
ChatModel
*>
(
m_chat_model_filter
->
sourceModel
())
->
sendMessage
(
message
);
}
void
ChatProxyModel
::
resendMessage
(
int
id
)
{
QModelIndex
source_index
=
mapToSource
(
index
(
id
,
0
));
static_cast
<
ChatModel
*>
(
m_chat_model_filter
->
sourceModel
())
->
resendMessage
(
m_chat_model_filter
->
mapToSource
(
source_index
).
row
()
);
}
bool
ChatProxyModel
::
filterAcceptsRow
(
int
source_row
,
const
QModelIndex
&
)
const
{
return
m_chat_model_filter
->
rowCount
()
-
source_row
<=
m_n_max_displayed_entries
;
}
...
...
tests/src/components/chat/ChatProxyModel.hpp
View file @
67e0a4fa
...
...
@@ -29,6 +29,7 @@ public:
Q_INVOKABLE
void
removeAllEntries
();
Q_INVOKABLE
void
sendMessage
(
const
QString
&
message
);
Q_INVOKABLE
void
resendMessage
(
int
id
);
signals:
void
sipAddressChanged
(
const
QString
&
sip_address
);
...
...
tests/ui/modules/Linphone/Chat/OutgoingMessage.qml
View file @
67e0a4fa
...
...
@@ -32,12 +32,14 @@ Item {
id
:
icon
Icon
{
icon
:
$chatEntry
.
status
===
ChatModel
.
MessageStatusNotDelivered
?
'
chat_error
'
:
'
chat_send
'
property
bool
isNotDelivered
:
$chatEntry
.
status
===
ChatModel
.
MessageStatusNotDelivered
icon
:
isNotDelivered
?
'
chat_error
'
:
'
chat_send
'
iconSize
:
ChatStyle
.
entry
.
message
.
outgoing
.
sendIconSize
MouseArea
{
anchors.fill
:
parent
onClicked
:
console
.
log
(
'
resend
'
)
onClicked
:
isNotDelivered
&&
proxyModel
.
resendMessage
(
index
)
}
}
}
...
...
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