|
|
@ -411,7 +411,8 @@ WBHistoryModel::WBHistoryModel(WBHistoryManager *history, QObject *parent) |
|
|
|
|
|
|
|
|
|
|
|
void WBHistoryModel::historyReset() |
|
|
|
void WBHistoryModel::historyReset() |
|
|
|
{ |
|
|
|
{ |
|
|
|
reset(); |
|
|
|
beginResetModel(); |
|
|
|
|
|
|
|
endResetModel(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WBHistoryModel::entryAdded() |
|
|
|
void WBHistoryModel::entryAdded() |
|
|
@ -751,7 +752,8 @@ QVariant WBHistoryFilterModel::headerData(int section, Qt::Orientation orientati |
|
|
|
void WBHistoryFilterModel::sourceReset() |
|
|
|
void WBHistoryFilterModel::sourceReset() |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_loaded = false; |
|
|
|
m_loaded = false; |
|
|
|
reset(); |
|
|
|
beginResetModel(); |
|
|
|
|
|
|
|
endResetModel(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int WBHistoryFilterModel::rowCount(const QModelIndex &parent) const |
|
|
|
int WBHistoryFilterModel::rowCount(const QModelIndex &parent) const |
|
|
@ -888,7 +890,8 @@ bool WBHistoryFilterModel::removeRows(int row, int count, const QModelIndex &par |
|
|
|
this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); |
|
|
|
this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); |
|
|
|
m_loaded = false; |
|
|
|
m_loaded = false; |
|
|
|
if (oldCount - count != rowCount()) |
|
|
|
if (oldCount - count != rowCount()) |
|
|
|
reset(); |
|
|
|
beginResetModel(); |
|
|
|
|
|
|
|
endResetModel(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -948,7 +951,7 @@ QModelIndex WBHistoryCompletionModel::index(int row, int column, const QModelInd |
|
|
|
if (row < 0 || row >= rowCount(parent) |
|
|
|
if (row < 0 || row >= rowCount(parent) |
|
|
|
|| column < 0 || column >= columnCount(parent)) |
|
|
|
|| column < 0 || column >= columnCount(parent)) |
|
|
|
return QModelIndex(); |
|
|
|
return QModelIndex(); |
|
|
|
return createIndex(row, column, 0); |
|
|
|
return createIndex(row, column); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QModelIndex WBHistoryCompletionModel::parent(const QModelIndex &) const |
|
|
|
QModelIndex WBHistoryCompletionModel::parent(const QModelIndex &) const |
|
|
@ -978,12 +981,14 @@ void WBHistoryCompletionModel::setSourceModel(QAbstractItemModel *newSourceModel |
|
|
|
this, SLOT(sourceReset())); |
|
|
|
this, SLOT(sourceReset())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
reset(); |
|
|
|
beginResetModel(); |
|
|
|
|
|
|
|
endResetModel(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WBHistoryCompletionModel::sourceReset() |
|
|
|
void WBHistoryCompletionModel::sourceReset() |
|
|
|
{ |
|
|
|
{ |
|
|
|
reset(); |
|
|
|
beginResetModel(); |
|
|
|
|
|
|
|
endResetModel(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WBHistoryTreeModel::WBHistoryTreeModel(QAbstractItemModel *sourceModel, QObject *parent) |
|
|
|
WBHistoryTreeModel::WBHistoryTreeModel(QAbstractItemModel *sourceModel, QObject *parent) |
|
|
@ -1107,7 +1112,7 @@ QModelIndex WBHistoryTreeModel::index(int row, int column, const QModelIndex &pa |
|
|
|
return QModelIndex(); |
|
|
|
return QModelIndex(); |
|
|
|
|
|
|
|
|
|
|
|
if (!parent.isValid()) |
|
|
|
if (!parent.isValid()) |
|
|
|
return createIndex(row, column, 0); |
|
|
|
return createIndex(row, column); |
|
|
|
return createIndex(row, column, parent.row() + 1); |
|
|
|
return createIndex(row, column, parent.row() + 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1116,7 +1121,7 @@ QModelIndex WBHistoryTreeModel::parent(const QModelIndex &index) const |
|
|
|
int offset = index.internalId(); |
|
|
|
int offset = index.internalId(); |
|
|
|
if (offset == 0 || !index.isValid()) |
|
|
|
if (offset == 0 || !index.isValid()) |
|
|
|
return QModelIndex(); |
|
|
|
return QModelIndex(); |
|
|
|
return createIndex(offset - 1, 0, 0); |
|
|
|
return createIndex(offset - 1, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool WBHistoryTreeModel::hasChildren(const QModelIndex &parent) const |
|
|
|
bool WBHistoryTreeModel::hasChildren(const QModelIndex &parent) const |
|
|
@ -1183,13 +1188,15 @@ void WBHistoryTreeModel::setSourceModel(QAbstractItemModel *newSourceModel) |
|
|
|
this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); |
|
|
|
this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
reset(); |
|
|
|
beginResetModel(); |
|
|
|
|
|
|
|
endResetModel(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WBHistoryTreeModel::sourceReset() |
|
|
|
void WBHistoryTreeModel::sourceReset() |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_sourceRowCache.clear(); |
|
|
|
m_sourceRowCache.clear(); |
|
|
|
reset(); |
|
|
|
beginResetModel(); |
|
|
|
|
|
|
|
endResetModel(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WBHistoryTreeModel::sourceRowsInserted(const QModelIndex &parent, int start, int end) |
|
|
|
void WBHistoryTreeModel::sourceRowsInserted(const QModelIndex &parent, int start, int end) |
|
|
@ -1199,7 +1206,8 @@ void WBHistoryTreeModel::sourceRowsInserted(const QModelIndex &parent, int start |
|
|
|
if (start != 0 || start != end) |
|
|
|
if (start != 0 || start != end) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_sourceRowCache.clear(); |
|
|
|
m_sourceRowCache.clear(); |
|
|
|
reset(); |
|
|
|
beginResetModel(); |
|
|
|
|
|
|
|
endResetModel(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1249,7 +1257,8 @@ void WBHistoryTreeModel::sourceRowsRemoved(const QModelIndex &parent, int start, |
|
|
|
if (it == m_sourceRowCache.end()) |
|
|
|
if (it == m_sourceRowCache.end()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_sourceRowCache.clear(); |
|
|
|
m_sourceRowCache.clear(); |
|
|
|
reset(); |
|
|
|
beginResetModel(); |
|
|
|
|
|
|
|
endResetModel(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|