Fix removing call history.
Update SDK.
This commit is contained in:
parent
550295fbe4
commit
390fc16c0a
9 changed files with 32 additions and 9 deletions
|
|
@ -139,5 +139,8 @@ void CallHistoryCore::setDuration(const QString &duration) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallHistoryCore::remove() {
|
void CallHistoryCore::remove() {
|
||||||
mHistoryModelConnection->invokeToModel([this]() { mCallHistoryModel->removeCallHistory(); });
|
mHistoryModelConnection->invokeToModel([this]() {
|
||||||
|
mCallHistoryModel->removeCallHistory();
|
||||||
|
emit removed();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void durationChanged(QString duration);
|
void durationChanged(QString duration);
|
||||||
void displayNameChanged();
|
void displayNameChanged();
|
||||||
|
void removed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString mDuration;
|
QString mDuration;
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ void CallHistoryList::setSelf(QSharedPointer<CallHistoryList> me) {
|
||||||
}
|
}
|
||||||
for (auto it : linphoneCallLogs) {
|
for (auto it : linphoneCallLogs) {
|
||||||
auto model = createCallHistoryCore(it);
|
auto model = createCallHistoryCore(it);
|
||||||
|
toConnect(model.get());
|
||||||
callLogs->push_back(model);
|
callLogs->push_back(model);
|
||||||
}
|
}
|
||||||
mModelConnection->invokeToCore([this, callLogs]() {
|
mModelConnection->invokeToCore([this, callLogs]() {
|
||||||
|
|
@ -88,6 +89,7 @@ void CallHistoryList::setSelf(QSharedPointer<CallHistoryList> me) {
|
||||||
auto oldLog = std::find_if(mList.begin(), mList.end(), [callLogs](QSharedPointer<QObject> log) {
|
auto oldLog = std::find_if(mList.begin(), mList.end(), [callLogs](QSharedPointer<QObject> log) {
|
||||||
return (*callLogs)->mCallId == log.objectCast<CallHistoryCore>()->mCallId;
|
return (*callLogs)->mCallId == log.objectCast<CallHistoryCore>()->mCallId;
|
||||||
});
|
});
|
||||||
|
toConnect(callLogs->get());
|
||||||
if (oldLog == mList.end()) { // New
|
if (oldLog == mList.end()) { // New
|
||||||
prepend(*callLogs);
|
prepend(*callLogs);
|
||||||
} else { // Update (status, duration, etc ...)
|
} else { // Update (status, duration, etc ...)
|
||||||
|
|
@ -99,6 +101,10 @@ void CallHistoryList::setSelf(QSharedPointer<CallHistoryList> me) {
|
||||||
emit lUpdate();
|
emit lUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CallHistoryList::toConnect(CallHistoryCore *data) {
|
||||||
|
connect(data, &CallHistoryCore::removed, this, [this, data]() { ListProxy::remove(data); });
|
||||||
|
}
|
||||||
|
|
||||||
void CallHistoryList::removeAllEntries() {
|
void CallHistoryList::removeAllEntries() {
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
for (auto it = mList.rbegin(); it != mList.rend(); ++it) {
|
for (auto it = mList.rbegin(); it != mList.rend(); ++it) {
|
||||||
|
|
@ -110,10 +116,8 @@ void CallHistoryList::removeAllEntries() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallHistoryList::remove(const int &row) {
|
void CallHistoryList::remove(const int &row) {
|
||||||
beginRemoveRows(QModelIndex(), row, row);
|
|
||||||
auto item = mList[row].objectCast<CallHistoryCore>();
|
auto item = mList[row].objectCast<CallHistoryCore>();
|
||||||
item->remove();
|
if (item) item->remove();
|
||||||
endRemoveRows();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CallHistoryList::data(const QModelIndex &index, int role) const {
|
QVariant CallHistoryList::data(const QModelIndex &index, int role) const {
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ public:
|
||||||
~CallHistoryList();
|
~CallHistoryList();
|
||||||
|
|
||||||
void setSelf(QSharedPointer<CallHistoryList> me);
|
void setSelf(QSharedPointer<CallHistoryList> me);
|
||||||
|
void toConnect(CallHistoryCore *data);
|
||||||
|
|
||||||
void removeAllEntries();
|
void removeAllEntries();
|
||||||
void remove(const int &row);
|
void remove(const int &row);
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,14 @@ void CallHistoryProxy::removeEntriesWithFilter() {
|
||||||
itemList[i] = item;
|
itemList[i] = item;
|
||||||
}
|
}
|
||||||
for (auto item : itemList) {
|
for (auto item : itemList) {
|
||||||
mHistoryList->ListProxy::remove(item.get());
|
item->remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CallHistoryProxy::reload() {
|
||||||
|
emit mHistoryList->lUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
bool CallHistoryProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
|
bool CallHistoryProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void removeAllEntries();
|
Q_INVOKABLE void removeAllEntries();
|
||||||
Q_INVOKABLE void removeEntriesWithFilter();
|
Q_INVOKABLE void removeEntriesWithFilter();
|
||||||
|
Q_INVOKABLE void reload();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QSharedPointer<CallHistoryList> mHistoryList;
|
QSharedPointer<CallHistoryList> mHistoryList;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "model/core/CoreModel.hpp"
|
#include "model/core/CoreModel.hpp"
|
||||||
|
#include "tool/Utils.hpp"
|
||||||
|
|
||||||
DEFINE_ABSTRACT_OBJECT(CallHistoryModel)
|
DEFINE_ABSTRACT_OBJECT(CallHistoryModel)
|
||||||
|
|
||||||
|
|
@ -37,5 +38,6 @@ CallHistoryModel::~CallHistoryModel() {
|
||||||
|
|
||||||
void CallHistoryModel::removeCallHistory() {
|
void CallHistoryModel::removeCallHistory() {
|
||||||
mustBeInLinphoneThread(getClassName() + "::removeCallHistory");
|
mustBeInLinphoneThread(getClassName() + "::removeCallHistory");
|
||||||
|
qInfo() << "Removing call log: " << Utils::coreStringToAppString(callLog->getCallId());
|
||||||
CoreModel::getInstance()->getCore()->removeCallLog(callLog);
|
CoreModel::getInstance()->getCore()->removeCallLog(callLog);
|
||||||
}
|
}
|
||||||
|
|
@ -251,6 +251,7 @@ AbstractMainPage {
|
||||||
onFilterTextChanged: maxDisplayItems = initialDisplayItems
|
onFilterTextChanged: maxDisplayItems = initialDisplayItems
|
||||||
initialDisplayItems: historyListView.height / (56 * DefaultStyle.dp) + 5
|
initialDisplayItems: historyListView.height / (56 * DefaultStyle.dp) + 5
|
||||||
displayItemsStep: initialDisplayItems / 2
|
displayItemsStep: initialDisplayItems / 2
|
||||||
|
|
||||||
}
|
}
|
||||||
cacheBuffer: contentHeight>0 ? contentHeight : 0// cache all items
|
cacheBuffer: contentHeight>0 ? contentHeight : 0// cache all items
|
||||||
flickDeceleration: 10000
|
flickDeceleration: 10000
|
||||||
|
|
@ -274,6 +275,12 @@ AbstractMainPage {
|
||||||
historyListView.model.removeAllEntries()
|
historyListView.model.removeAllEntries()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Connections{
|
||||||
|
target: mainItem
|
||||||
|
function onListViewUpdated(){
|
||||||
|
callHistoryProxy.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
onAtYEndChanged: if(atYEnd) callHistoryProxy.displayMore()
|
onAtYEndChanged: if(atYEnd) callHistoryProxy.displayMore()
|
||||||
delegate: FocusScope {
|
delegate: FocusScope {
|
||||||
width:historyListView.width
|
width:historyListView.width
|
||||||
|
|
|
||||||
2
external/linphone-sdk
vendored
2
external/linphone-sdk
vendored
|
|
@ -1 +1 @@
|
||||||
Subproject commit ec80377f302c9282b983fdbeebeaadb0a693986f
|
Subproject commit 477e178da43fcd9e73eedff50d83164e523e9232
|
||||||
Loading…
Reference in a new issue