Skip to content

Commit

Permalink
[libcommhistory] Provide QML API to add outcalls to history. JB#43717
Browse files Browse the repository at this point in the history
Similar to the existing createOutgoingMessageEvent.

Signed-off-by: Simonas Leleiva <simonas.leleiva@jolla.com>
  • Loading branch information
sledges committed Apr 14, 2020
1 parent 0f8702a commit 81fff7b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions declarative/plugins.qmltypes
Expand Up @@ -99,6 +99,12 @@ Module {
Parameter { name: "index"; type: "int" }
}
Method { name: "markAllRead"; type: "bool" }
Method {
name: "createOutgoingCallEvent"
type: "int"
Parameter { name: "localUid"; type: "string" }
Parameter { name: "remoteUid"; type: "string" }
}
}
Component {
name: "CommHistory::CallModel"
Expand Down
15 changes: 15 additions & 0 deletions declarative/src/callproxymodel.cpp
Expand Up @@ -118,3 +118,18 @@ void CallProxyModel::onReadyChanged(bool ready)
}
}

int CallProxyModel::createOutgoingCallEvent(const QString &localUid, const QString &remoteUid)
{
Event event;
EventModel model;

event.setStartTime(QDateTime::currentDateTime());
event.setEndTime(event.startTime());
event.setType(CommHistory::Event::CallEvent);
event.setDirection(CommHistory::Event::Outbound);
event.setLocalUid(localUid);
event.setRecipients(Recipient(localUid, remoteUid));
if (model.addEvent(event))
return event.id();
return -1;
}
2 changes: 2 additions & 0 deletions declarative/src/callproxymodel.h
Expand Up @@ -137,6 +137,8 @@ class CallProxyModel : public CommHistory::CallModel, public QQmlParserStatus

bool populated() const;

Q_INVOKABLE int createOutgoingCallEvent(const QString &localUid, const QString &remoteUid);

public Q_SLOTS:
void deleteAt(int index);

Expand Down

0 comments on commit 81fff7b

Please sign in to comment.