equal
deleted
inserted
replaced
386 QSharedPointer<CaEntry> CaItemModel::entry(const QModelIndex &index) const |
386 QSharedPointer<CaEntry> CaItemModel::entry(const QModelIndex &index) const |
387 { |
387 { |
388 return m_d->entry(index); |
388 return m_d->entry(index); |
389 } |
389 } |
390 |
390 |
|
391 QList<int> CaItemModel::getUninstallingEntriesIds(int componentId) |
|
392 { |
|
393 return m_d->getUninstallingEntriesIds(componentId); |
|
394 } |
|
395 |
|
396 void CaItemModel::updateProgress(int id, int valueOfProgress) |
|
397 { |
|
398 m_d->updateProgress(id, valueOfProgress); |
|
399 } |
|
400 |
391 /*! |
401 /*! |
392 Constructor |
402 Constructor |
393 \param query needed to create model |
403 \param query needed to create model |
394 \param pointer to public implementation object connected |
404 \param pointer to public implementation object connected |
395 */ |
405 */ |
474 variant = QVariant( |
484 variant = QVariant( |
475 pEntry->attribute(UNINSTALL_PROGRESS_APPLICATION_ATTRIBUTE_NAME).toInt()); |
485 pEntry->attribute(UNINSTALL_PROGRESS_APPLICATION_ATTRIBUTE_NAME).toInt()); |
476 break; |
486 break; |
477 case CaItemModel::CollectionTitleRole: |
487 case CaItemModel::CollectionTitleRole: |
478 if (!pEntry->attribute(COLLECTION_TITLE_NAME).isNull()) { |
488 if (!pEntry->attribute(COLLECTION_TITLE_NAME).isNull()) { |
479 variant = QVariant(hbTrId(pEntry-> |
489 variant = QVariant(pEntry-> |
480 attribute(COLLECTION_TITLE_NAME).toUtf8())); |
490 attribute(COLLECTION_TITLE_NAME).toUtf8()); |
481 } |
491 } |
482 else { |
492 else { |
483 variant = QVariant(pEntry->text()); |
493 variant = QVariant(pEntry->text()); |
484 } |
494 } |
485 break; |
495 break; |
691 } |
701 } |
692 return false; |
702 return false; |
693 } |
703 } |
694 |
704 |
695 |
705 |
|
706 QList<int> CaItemModelPrivate::getUninstallingEntriesIds(int componentId) |
|
707 { |
|
708 CaQuery* query = new CaQuery(mQuery); |
|
709 QString compId(QString().setNum(componentId)); |
|
710 query->setAttribute(QString("component_id"), compId); |
|
711 QList<int> ids = mService->getEntryIds(*query); |
|
712 delete query; |
|
713 return ids; |
|
714 } |
|
715 |
|
716 void CaItemModelPrivate::updateProgress(int id, int valueOfProgress) |
|
717 { |
|
718 int updateIndex = mEntries.updateProgress(id, valueOfProgress); |
|
719 if (updateIndex >= 0) { |
|
720 emit m_q->dataChanged( |
|
721 index(updateIndex), index(updateIndex)); |
|
722 } |
|
723 } |
696 /*! |
724 /*! |
697 Updates model with fresh entries and resets model |
725 Updates model with fresh entries and resets model |
698 */ |
726 */ |
699 void CaItemModelPrivate::updateModel() |
727 void CaItemModelPrivate::updateModel() |
700 { |
728 { |
822 if (newItemCount == oldItemCount) { |
850 if (newItemCount == oldItemCount) { |
823 // count is the same - check if item order changed |
851 // count is the same - check if item order changed |
824 if (itemsList == oldList) { |
852 if (itemsList == oldList) { |
825 // assume that if the order has not changed |
853 // assume that if the order has not changed |
826 // it had to be the secondary lines |
854 // it had to be the secondary lines |
827 updateModel(); |
855 emit m_q->dataChanged(index(0), index(m_q->rowCount()-1)); |
828 } else { |
856 } else { |
829 updateLayout(); |
857 updateLayout(); |
830 } |
858 } |
831 } else { |
859 } else { |
832 updateModel(); |
860 updateModel(); |
1047 { |
1075 { |
1048 if (previousCount != rowCount()) { |
1076 if (previousCount != rowCount()) { |
1049 emit m_q->countChange(); |
1077 emit m_q->countChange(); |
1050 } |
1078 } |
1051 } |
1079 } |
|
1080 |