Skip to content

Commit

Permalink
Merge branch 'outcalls' into 'master'
Browse files Browse the repository at this point in the history
Provide QML API to add outcalls to history

See merge request mer-core/libcommhistory!38
  • Loading branch information
pvuorela committed Apr 16, 2020
2 parents 0f8702a + 81fff7b commit c48f3c6
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 c48f3c6

Please sign in to comment.