bool ScriptableProxyHelper::browserChange(const QVariantMap &data, int row) { INVOKE(browserChange(data, row)); ClipboardBrowser *c = fetchBrowser(); if (!c) return false; const QModelIndex index = c->index(row); QVariantMap itemData = index.data(contentType::data).toMap(); foreach (const QString &mime, data.keys()) itemData[mime] = data[mime]; return c->model()->setData(index, itemData, contentType::data); }
QVariantMap ScriptableProxyHelper::nextItem(int where) { INVOKE(nextItem(where)); ClipboardBrowser *c = fetchBrowser(); if (!c) return QVariantMap(); const int row = qMax(0, c->currentIndex().row()) + where; const QModelIndex index = c->index(row); if (!index.isValid()) return QVariantMap(); c->setCurrentIndex(index); return ::itemData(index); }
bool ScriptableProxyHelper::selectItems(const QList<int> &items) { INVOKE(selectItems(items)); ClipboardBrowser *c = fetchBrowser(); if (!c) return false; c->clearSelection(); if ( !items.isEmpty() ) { c->setCurrent(items.last()); foreach (int i, items) { const QModelIndex index = c->index(i); if (index.isValid()) c->selectionModel()->select(index, QItemSelectionModel::Select); } }
void ScriptableProxyHelper::browserMoveToClipboard(int arg1) { ClipboardBrowser *c = fetchBrowser(); if (c) c->moveToClipboard(c->index(arg1)); }