void ActionHandler::addItem(const QByteArray &data, const QString &format, const QString &tabName) { ClipboardBrowser *c = tabName.isEmpty() ? m_wnd->browser() : m_wnd->tab(tabName); c->add( createDataMap(format, data) ); if (m_lastAction) { if (m_lastAction == sender()) c->setCurrent(0); m_lastAction = NULL; } }
void ActionHandler::addItems(const QStringList &items, const QString &tabName) { ClipboardBrowser *c = tabName.isEmpty() ? m_wnd->browser() : m_wnd->tab(tabName); ClipboardBrowser::Lock lock(c); foreach (const QString &item, items) c->add(item); if (m_lastAction) { if (m_lastAction == sender()) c->setCurrent(items.size() - 1); m_lastAction = NULL; } }
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); } }