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::browserAdd(const QStringList &texts) { INVOKE(browserAdd(texts)); ClipboardBrowser *c = fetchBrowser(); if (!c) return false; ClipboardBrowser::Lock lock(c); foreach (const QString &text, texts) { if ( !c->add(text) ) return false; } return true; }