void DocumentPropertiesWidget::requestProperties(
        const QString &itemType, const QStringList &propertyNames, const QStringList &labels)
{
    QStringList currentPropertyNames = request->propertyNames();

    request->setRootType(itemType);
    request->setPropertyNames(propertyNames + currentPropertyNames);
    request->execute();

    resultSet = request->resultSet();

    if (resultSet) {
        connect(resultSet, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
        connect(resultSet, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
        connect(resultSet, SIGNAL(metaDataChanged(int,int,QList<int>)),
                this, SLOT(metaDataChanged(int,int,QList<int>)));

        for (int i = 0; i < currentPropertyNames.count(); ++i)
            propertyKeys[i] = resultSet->propertyKey(currentPropertyNames.at(i));

        for (int i = 0; i < propertyNames.count(); ++i)
            insertRow(i, propertyNames.at(i), labels.at(i));

        if (resultSet->itemCount() > 0)
            itemsInserted(0, resultSet->itemCount());
    }
}
Пример #2
0
void QMDEGalleryQueryResultSet::HandleQueryNewResults( CMdEQuery &aQuery,
    TInt firstNewItemIndex,
    TInt newItemCount )
{
    if (m_launchUpdateQuery) {
        if (aQuery.ResultMode() == EQueryResultModeItem) {
            int max = aQuery.Count();
            for ( TInt i = firstNewItemIndex; i < max; i++ ) {
                CMdEObject *item = static_cast<CMdEObject *>(aQuery.TakeOwnershipOfResult( i ));
                m_updatedItemArray.Append( item );
                m_updatedObjectIDs.Append( item->Id() );
            }
        }
    }
    else {
        if (aQuery.ResultMode() == EQueryResultModeItem) {
            int max = aQuery.Count();
            for ( TInt i = firstNewItemIndex; i < max; i++ ) {
                CMdEObject *item = static_cast<CMdEObject *>(aQuery.TakeOwnershipOfResult( i ));
                m_itemArray.Append( item );
                m_currentObjectIDs.Append( item->Id() );
            }
        }

        //Signals that items have been inserted into a result set at
        emit itemsInserted(firstNewItemIndex, newItemCount);

        emit progressChanged(aQuery.Count(), KMdEQueryDefaultMaxCount);
    }
}
void VersionControlObserver::setModel(KFileItemModel* model)
{
    if (m_model) {
        disconnect(m_model, SIGNAL(itemsInserted(KItemRangeList)),
                   this, SLOT(delayedDirectoryVerification()));
        disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
                   this, SLOT(delayedDirectoryVerification()));
    }

    m_model = model;

    if (model) {
        connect(m_model, SIGNAL(itemsInserted(KItemRangeList)),
                this, SLOT(delayedDirectoryVerification()));
        connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
                this, SLOT(delayedDirectoryVerification()));
    }
}
Пример #4
0
KAbstractTreeModel* KTreeWidgetPrivate::setModel( KAbstractTreeModel *model )
{
	Q_Q(KTreeWidget);
	KAbstractTreeModel *modelOld = m_model;
	if(m_model)
	{
		QObject::disconnect(m_model, SIGNAL(itemsInserted(QList<qint64>)), q, SLOT(on_model_itemsInserted(QList<qint64>)));
		QObject::disconnect(m_model, SIGNAL(itemsRemoved(QList<qint64>)), q, SLOT(on_model_itemsRemoved(QList<qint64>)));
		QObject::disconnect(m_model, SIGNAL(itemsChanged(QList<qint64>,QList<Qt::ItemDataRole>)), q, SLOT(on_model_itemsChanged(QList<qint64>,QList<Qt::ItemDataRole>)));
		QObject::disconnect(m_model, SIGNAL(modelReset()), q, SLOT(on_model_modelReset()));
	}
	m_model = model;
	QObject::connect(m_model, SIGNAL(itemsInserted(QList<qint64>)), q, SLOT(on_model_itemsInserted(QList<qint64>)));
	QObject::connect(m_model, SIGNAL(itemsRemoved(QList<qint64>)), q, SLOT(on_model_itemsRemoved(QList<qint64>)));
	QObject::connect(m_model, SIGNAL(itemsChanged(QList<qint64>,QList<Qt::ItemDataRole>)), q, SLOT(on_model_itemsChanged(QList<qint64>,QList<Qt::ItemDataRole>)));
	QObject::connect(m_model, SIGNAL(modelReset()), q, SLOT(on_model_modelReset()));
	return modelOld;
}
void RecentFileModel::setRecentFiles(const QStringList &filePaths)
{
    QStringList oldPaths = m_paths;
    m_paths.clear();
    if (oldPaths.size() > 0) {
        emit itemsRemoved(0, oldPaths.size());
    }

    m_paths = filePaths;

    if (m_paths.size() > 0) {
        emit itemsInserted(0, m_paths.size());
    }
}
Пример #6
0
void K3b::MovixDoc::addMovixItems( QList<K3b::MovixFileItem*>& items, int pos )
{
    if( !items.isEmpty() ) {
        if( pos < 0 || pos > m_movixFiles.count() )
            pos = m_movixFiles.count();

        emit itemsAboutToBeInserted( pos, items.count() );

        Q_FOREACH( K3b::MovixFileItem* newItem, items )
        {
            m_movixFiles.insert( pos, newItem );
            pos++;
        }

        emit itemsInserted();
    }
Пример #7
0
int QtListModelInterface::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: itemsInserted((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 1: itemsRemoved((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 2: itemsMoved((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
        case 3: itemsChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< const QList<QByteArray>(*)>(_a[3]))); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Пример #8
0
/*!
    \qmlmethod ListModel::insert(int index, jsobject dict)

    Adds a new item to the list model at position \a index, with the
    values in \a dict.

    \code
        fruitModel.insert(2, {"cost": 5.95, "name":"Pizza"})
    \endcode

    The \a index must be to an existing item in the list, or one past
    the end of the list (equivalent to append).

    \sa set() append()
*/
void QDeclarativeListModel::insert(int index, const QScriptValue& valuemap)
{
    if (!valuemap.isObject() || valuemap.isArray()) {
        qmlInfo(this) << tr("insert: value is not an object");
        return;
    }

    if (index < 0 || index > count()) {
        qmlInfo(this) << tr("insert: index %1 out of range").arg(index);
        return;
    }

    bool ok = m_flat ?  m_flat->insert(index, valuemap) : m_nested->insert(index, valuemap);
    if (ok && !inWorkerThread()) {
        emit itemsInserted(index, 1);
        emit countChanged();
    }
}
Пример #9
0
void QMDEGalleryCategoryResultSet::HandleQueryNewResults(
    CMdEQuery &aQuery, TInt, TInt)
{
    const int insertIndex = m_count;
    const int currentIndex = m_currentIndex;

    m_count = qMax(aQuery.Count() - m_offset, 0);

    const int insertCount = m_count - insertIndex;

    if (insertCount > 0) {
        if (currentIndex >= insertIndex)
            m_currentIndex += insertCount;

        emit itemsInserted(insertIndex, insertCount);

        if (m_currentIndex != currentIndex)
            emit currentIndexChanged(m_currentIndex);
    }
}
Пример #10
0
void KStandardItemModel::insertItem(int index, KStandardItem* item)
{
    if (index < 0 || index > count() || !item) {
        delete item;
        return;
    }

    if (!m_indexesForItems.contains(item)) {
        item->m_model = this;
        m_items.insert(index, item);
        m_indexesForItems.insert(item, index);

        // Inserting an item requires to update the indexes
        // afterwards from m_indexesForItems.
        for (int i = index + 1; i < m_items.count(); ++i) {
            m_indexesForItems.insert(m_items[i], i);
        }

        // TODO: no hierarchical items are handled yet

        onItemInserted(index);
        emit itemsInserted(KItemRangeList() << KItemRange(index, 1));
    }
}
Пример #11
0
/*!
 * Inserts the items specified by \a items to the position \a index. If the
 * index is equal to data array size, the items are added to the array.
 */
void QScatterDataProxy::insertItems(int index, const QScatterDataArray &items)
{
    dptr()->insertItems(index, items);
    emit itemsInserted(index, items.size());
    emit itemCountChanged(itemCount());
}
Пример #12
0
/*!
 * Inserts the item \a item to the position \a index. If the index is equal to
 * the data array size, the item is added to the array.
 */
void QScatterDataProxy::insertItem(int index, const QScatterDataItem &item)
{
    dptr()->insertItem(index, item);
    emit itemsInserted(index, 1);
    emit itemCountChanged(itemCount());
}