Skip to content
Snippets Groups Projects
Commit 16342e62 authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee Committed by Guillaume Roguez
Browse files

history: Notify client when a category is filled

 * Remove some dead, commented code

Refs #72489

(cherry picked from commit ce0be45f)
parent b6205343
Branches
Tags
No related merge requests found
...@@ -300,40 +300,33 @@ void CategorizedHistoryModelPrivate::add(Call* call) ...@@ -300,40 +300,33 @@ void CategorizedHistoryModelPrivate::add(Call* call)
return; return;
} }
// if (!m_HavePersonModel && call->contactBackend()) {
// connect(((QObject*)call->contactBackend()),SIGNAL(collectionChanged()),this,SLOT(reloadCategories()));
// m_HavePersonModel = true;
// }//TODO implement reordering
emit q_ptr->newHistoryCall(call); emit q_ptr->newHistoryCall(call);
HistoryTopLevelItem* tl = getCategory(call); HistoryTopLevelItem* tl = getCategory(call);
const QModelIndex& parentIdx = q_ptr->index(tl->modelRow,0); const QModelIndex& parentIdx = q_ptr->index(tl->modelRow,0);
q_ptr->beginInsertRows(parentIdx,tl->m_lChildren.size(),tl->m_lChildren.size()); q_ptr->beginInsertRows(parentIdx,tl->m_lChildren.size(),tl->m_lChildren.size());
CategorizedHistoryModelPrivate::HistoryItem* item = new CategorizedHistoryModelPrivate::HistoryItem(call); CategorizedHistoryModelPrivate::HistoryItem* item = new CategorizedHistoryModelPrivate::HistoryItem(call);
item->m_pParent = tl; item->m_pParent = tl;
item->m_pNode = new HistoryItemNode(q_ptr,call,item); item->m_pNode = new HistoryItemNode(q_ptr,call,item);
connect(item->m_pNode,SIGNAL(changed(QModelIndex)),this,SLOT(slotChanged(QModelIndex))); connect(item->m_pNode,SIGNAL(changed(QModelIndex)),this,SLOT(slotChanged(QModelIndex)));
item->m_Index = tl->m_lChildren.size(); const int size = tl->m_lChildren.size();
item->m_Index = size;
tl->m_lChildren << item; tl->m_lChildren << item;
//Try to prevent startTimeStamp() collisions, it technically doesn't work as time_t are signed //Try to prevent startTimeStamp() collisions, it technically doesn't work as time_t are signed
//we don't care //we don't care
m_sHistoryCalls[(call->startTimeStamp() << 10)+qrand()%1024] = call; m_sHistoryCalls[(call->startTimeStamp() << 10)+qrand()%1024] = call;
q_ptr->endInsertRows(); q_ptr->endInsertRows();
LastUsedNumberModel::instance()->addCall(call); LastUsedNumberModel::instance()->addCall(call);
emit q_ptr->historyChanged(); emit q_ptr->historyChanged();
/* //When the categories goes from 0 items to many, its conceptual state change
// Loop until it find a compatible backend //therefore the clients may want to act on this, notify them
//HACK only support a single active history backend if (!size) {
if (!call->collection()) { const QModelIndex idx = q_ptr->index(item->m_Index,0);
foreach (CollectionInterface* backend, q_ptr->collections(CollectionInterface::ADD)) { emit q_ptr->dataChanged(idx,idx);
if (backend->editor<Call>()->addNew(call)) {
call->setCollection(backend);
break;
}
} }
}*/
} }
///Set if the history has a limit ///Set if the history has a limit
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment