Skip to content
Snippets Groups Projects
Commit 494ba12a authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee
Browse files

[ #22321 ] Fix type (childs->children)

parent 0c4939e3
No related branches found
No related tags found
No related merge requests found
......@@ -96,7 +96,7 @@ void ContactProxyModel::reloadCategories()
TopLevelItem* item = m_hCategories[val];
if (item) {
QModelIndex parent = index(m_lCategoryCounter.indexOf(item),0);
item->m_lChilds << cont;
item->m_lChildren << cont;
}
else
qDebug() << "ERROR count";
......@@ -136,34 +136,34 @@ QVariant ContactProxyModel::data( const QModelIndex& index, int role) const
case ContactTreeBackend::Type::CONTACT: /* && (role == Qt::DisplayRole)) {*/
switch (role) {
case Qt::DisplayRole:
return QVariant(m_lCategoryCounter[index.parent().row()]->m_lChilds[index.row()]->formattedName());
return QVariant(m_lCategoryCounter[index.parent().row()]->m_lChildren[index.row()]->formattedName());
case AbstractContactBackend::Role::Organization:
return QVariant(m_lCategoryCounter[index.parent().row()]->m_lChilds[index.row()]->organization());
return QVariant(m_lCategoryCounter[index.parent().row()]->m_lChildren[index.row()]->organization());
case AbstractContactBackend::Role::Group:
return QVariant(m_lCategoryCounter[index.parent().row()]->m_lChilds[index.row()]->group());
return QVariant(m_lCategoryCounter[index.parent().row()]->m_lChildren[index.row()]->group());
case AbstractContactBackend::Role::Department:
return QVariant(m_lCategoryCounter[index.parent().row()]->m_lChilds[index.row()]->department());
return QVariant(m_lCategoryCounter[index.parent().row()]->m_lChildren[index.row()]->department());
case AbstractContactBackend::Role::PreferredEmail:
return QVariant(m_lCategoryCounter[index.parent().row()]->m_lChilds[index.row()]->preferredEmail());
return QVariant(m_lCategoryCounter[index.parent().row()]->m_lChildren[index.row()]->preferredEmail());
case AbstractContactBackend::Role::DropState:
return QVariant(modelItem->dropState());
case AbstractContactBackend::Role::FormattedLastUsed: {
if (!m_isContactDateInit)
((ContactProxyModel*)this)->m_hContactByDate = getContactListByTime();
return QVariant(HistoryModel::timeToHistoryCategory(m_hContactByDate[m_lCategoryCounter[index.parent().row()]->m_lChilds[index.row()]]));
return QVariant(HistoryModel::timeToHistoryCategory(m_hContactByDate[m_lCategoryCounter[index.parent().row()]->m_lChildren[index.row()]]));
}
case AbstractContactBackend::Role::IndexedLastUsed: {
if (!m_isContactDateInit)
((ContactProxyModel*)this)->m_hContactByDate = getContactListByTime();
return QVariant((int)HistoryModel::timeToHistoryConst(m_hContactByDate[m_lCategoryCounter[index.parent().row()]->m_lChilds[index.row()]]));
return QVariant((int)HistoryModel::timeToHistoryConst(m_hContactByDate[m_lCategoryCounter[index.parent().row()]->m_lChildren[index.row()]]));
}
case AbstractContactBackend::Role::DatedLastUsed: {
if (!m_isContactDateInit)
((ContactProxyModel*)this)->m_hContactByDate = getContactListByTime();
return QVariant(QDateTime::fromTime_t( m_hContactByDate[m_lCategoryCounter[index.parent().row()]->m_lChilds[index.row()]]));
return QVariant(QDateTime::fromTime_t( m_hContactByDate[m_lCategoryCounter[index.parent().row()]->m_lChildren[index.row()]]));
}
case AbstractContactBackend::Role::Filter: {
Contact* ct = m_lCategoryCounter[index.parent().row()]->m_lChilds[index.row()];
Contact* ct = m_lCategoryCounter[index.parent().row()]->m_lChildren[index.row()];
QString normStripppedC;
foreach(QChar char2,QString(ct->formattedName()+'\n'+ct->organization()+'\n'+ct->group()+'\n'+
ct->department()+'\n'+ct->preferredEmail()).toLower().normalized(QString::NormalizationForm_KD) ) {
......@@ -179,7 +179,7 @@ QVariant ContactProxyModel::data( const QModelIndex& index, int role) const
case ContactTreeBackend::Type::NUMBER: /* && (role == Qt::DisplayRole)) {*/
switch (role) {
case Qt::DisplayRole:
return QVariant(m_lCategoryCounter[index.parent().parent().row()]->m_lChilds[index.parent().row()]->phoneNumbers()[index.row()]->number());
return QVariant(m_lCategoryCounter[index.parent().parent().row()]->m_lChildren[index.parent().row()]->phoneNumbers()[index.row()]->number());
}
break;
default:
......@@ -212,10 +212,10 @@ int ContactProxyModel::rowCount( const QModelIndex& parent ) const
if (!parent.isValid() || !parent.internalPointer())
return m_lCategoryCounter.size();
else if (!parent.parent().isValid()) {
return m_lCategoryCounter[parent.row()]->m_lChilds.size();
return m_lCategoryCounter[parent.row()]->m_lChildren.size();
}
else if (parent.parent().isValid() && !parent.parent().parent().isValid()) {
return m_lCategoryCounter[parent.parent().row()]->m_lChilds[parent.row()]->phoneNumbers().size();
return m_lCategoryCounter[parent.parent().row()]->m_lChildren[parent.row()]->phoneNumbers().size();
}
return 0;
}
......@@ -250,7 +250,7 @@ QModelIndex ContactProxyModel::parent( const QModelIndex& index) const
const QString val = category(ct);
if (m_hCategories[val]) {
return ContactProxyModel::index(
(m_hCategories[val]->m_lChilds.indexOf(ct)),
(m_hCategories[val]->m_lChildren.indexOf(ct)),
0,
ContactProxyModel::index(m_lCategoryCounter.indexOf(m_hCategories[val]),0));
}
......@@ -266,11 +266,11 @@ QModelIndex ContactProxyModel::index( int row, int column, const QModelIndex& pa
if (!parent.isValid()) {
return createIndex(row,column,m_lCategoryCounter[row]);
}
else if (!parent.parent().isValid() && column < m_lCategoryCounter[parent.row()]->m_lChilds.size() ) {
return createIndex(row,column,(void*)dynamic_cast<ContactTreeBackend*>(m_lCategoryCounter[parent.row()]->m_lChilds[row]));
else if (!parent.parent().isValid() && column < m_lCategoryCounter[parent.row()]->m_lChildren.size() ) {
return createIndex(row,column,(void*)dynamic_cast<ContactTreeBackend*>(m_lCategoryCounter[parent.row()]->m_lChildren[row]));
}
else if (parent.parent().isValid() && m_lCategoryCounter.size() > parent.parent().row() && m_lCategoryCounter[parent.parent().row()]->m_lChilds.size() > parent.row()) {
return createIndex(row,column,(void*)&m_lCategoryCounter[parent.parent().row()]->m_lChilds[parent.row()]->phoneNumbers());
else if (parent.parent().isValid() && m_lCategoryCounter.size() > parent.parent().row() && m_lCategoryCounter[parent.parent().row()]->m_lChildren.size() > parent.row()) {
return createIndex(row,column,(void*)&m_lCategoryCounter[parent.parent().row()]->m_lChildren[parent.row()]->phoneNumbers());
}
return QModelIndex();
}
......@@ -294,7 +294,7 @@ QMimeData* ContactProxyModel::mimeData(const QModelIndexList &indexes) const
}
else if (index.parent().isValid()) {
//Contact
Contact* ct = m_lCategoryCounter[index.parent().row()]->m_lChilds[index.row()];
Contact* ct = m_lCategoryCounter[index.parent().row()]->m_lChildren[index.row()];
if (ct) {
if (ct->phoneNumbers().size() == 1) {
mimeData->setData(MIME_PHONENUMBER , ct->phoneNumbers()[0]->number().toUtf8());
......
......@@ -61,7 +61,7 @@ private:
virtual QObject* self() {return this;}
private:
explicit TopLevelItem(QString name) : ContactTreeBackend(ContactTreeBackend::TOP_LEVEL),QObject(nullptr),m_Name(name) {}
QList<Contact*> m_lChilds;
QList<Contact*> m_lChildren;
QString m_Name;
};
......
......@@ -188,7 +188,7 @@ void HistoryModel::add(Call* call)
m_lCategoryCounter << item;
emit dataChanged(index(rowCount()-1,0),index(rowCount()-1,0));
}
m_hCategories[cat]->m_lChilds << call;
m_hCategories[cat]->m_lChildren << call;
emit historyChanged();
// emit layoutChanged();
}
......@@ -265,7 +265,7 @@ void HistoryModel::reloadCategories()
}
TopLevelItem* item = m_hCategories[val];
if (item) {
item->m_lChilds << call;
item->m_lChildren << call;
}
else
qDebug() << "ERROR count";
......@@ -310,8 +310,8 @@ QVariant HistoryModel::data( const QModelIndex& idx, int role) const
return QVariant(modelItem->dropState());
else if (m_lCategoryCounter.size() >= idx.parent().row() && idx.parent().row() >= 0
&& m_lCategoryCounter[idx.parent().row()]
&& m_lCategoryCounter[idx.parent().row()]->m_lChilds.size() >= idx.row())
return m_lCategoryCounter[idx.parent().row()]->m_lChilds[idx.row()]->roleData((Call::Role)role);
&& m_lCategoryCounter[idx.parent().row()]->m_lChildren.size() >= idx.row())
return m_lCategoryCounter[idx.parent().row()]->m_lChildren[idx.row()]->roleData((Call::Role)role);
break;
case HistoryTreeBackend::Type::NUMBER:
case HistoryTreeBackend::Type::BOOKMARK:
......@@ -337,10 +337,10 @@ int HistoryModel::rowCount( const QModelIndex& parentIdx ) const
return m_lCategoryCounter.size();
}
else if (!parentIdx.parent().isValid()) {
return m_lCategoryCounter[parentIdx.row()]->m_lChilds.size();
return m_lCategoryCounter[parentIdx.row()]->m_lChildren.size();
}
// else if (parent.parent().isValid() && !parent.parent().parent().isValid()) {
// return m_lCategoryCounter[parent.parent().row()]->m_lChilds[parent.row()]->getPhoneNumbers().size();
// return m_lCategoryCounter[parent.parent().row()]->m_lChildren[parent.row()]->getPhoneNumbers().size();
// }
return 0;
}
......@@ -375,7 +375,7 @@ QModelIndex HistoryModel::parent( const QModelIndex& idx) const
// QString val = category(ct);
// if (m_hCategories[val]) {
// return HistoryModel::index(
// (m_hCategories[val]->m_lChilds.indexOf(ct)),
// (m_hCategories[val]->m_lChildren.indexOf(ct)),
// 0,
// HistoryModel::index(m_lCategoryCounter.indexOf(m_hCategories[val]),0));
// }
......@@ -391,11 +391,11 @@ QModelIndex HistoryModel::index( int row, int column, const QModelIndex& parentI
if (!parentIdx.isValid()) {
return createIndex(row,column,m_lCategoryCounter[row]);
}
else if (!parentIdx.parent().isValid() && column < m_lCategoryCounter[parentIdx.row()]->m_lChilds.size() ) {
return createIndex(row,column,(void*)dynamic_cast<HistoryTreeBackend*>(m_lCategoryCounter[parentIdx.row()]->m_lChilds[row]));
else if (!parentIdx.parent().isValid() && column < m_lCategoryCounter[parentIdx.row()]->m_lChildren.size() ) {
return createIndex(row,column,(void*)dynamic_cast<HistoryTreeBackend*>(m_lCategoryCounter[parentIdx.row()]->m_lChildren[row]));
}
// else if (parent.parent().isValid()) {
// return createIndex(row,column,(void*)&m_lCategoryCounter[parent.parent().row()]->m_lChilds[parent.row()]->getPhoneNumbers());
// return createIndex(row,column,(void*)&m_lCategoryCounter[parent.parent().row()]->m_lChildren[parent.row()]->getPhoneNumbers());
// }
return QModelIndex();
}
......
......@@ -126,7 +126,7 @@ private:
}
private:
TopLevelItem(int name);
CallList m_lChilds;
CallList m_lChildren;
int m_Name; //HistoryConst
QString m_NameStr;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment