+ QAction* action = menu.exec(pos.toPoint());
+ if (action) {
+ if (action == emptyTrashAction) {
+ emptyTrash();
+ } else {
+ // The index might have changed if devices were added/removed while
+ // the context menu was open.
+ index = m_model->index(item);
+ if (index < 0) {
+ // The item is not in the model any more, probably because it was an
+ // external device that has been removed while the context menu was open.
+ return;
+ }
+
+ if (action == editAction) {
+ editEntry(index);
+ } else if (action == removeAction) {
+ m_model->removeItem(index);
+ m_model->saveBookmarks();
+ } else if (action == hideAction) {
+ item->setHidden(hideAction->isChecked());
+ m_model->saveBookmarks();
+ } else if (action == openInNewWindowAction) {
+ Dolphin::openNewWindow({PlacesItemModel::convertedUrl(m_model->data(index).value("url").toUrl())}, this);
+ } else if (action == openInNewTabAction) {
+ // TriggerItem does set up the storage first and then it will
+ // emit the slotItemMiddleClicked signal, because of Qt::MiddleButton.
+ triggerItem(index, Qt::MiddleButton);
+ } else if (action == teardownAction) {
+ m_model->requestTearDown(index);
+ } else if (action == ejectAction) {
+ m_model->requestEject(index);
+ }
+ }
+ }
+
+ selectClosestItem();
+}
+
+void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos)
+{
+ QMenu menu(this);
+
+ QAction* addAction = menu.addAction(QIcon::fromTheme(QStringLiteral("document-new")), i18nc("@item:inmenu", "Add Entry..."));
+