Example #1
0
/* static */
QVector<KDnDAction> UIDnDHandler::toVBoxDnDActions(Qt::DropActions actions)
{
    QVector<KDnDAction> vbActions;
    if (actions.testFlag(Qt::IgnoreAction))
        vbActions << KDnDAction_Ignore;
    if (actions.testFlag(Qt::CopyAction))
        vbActions << KDnDAction_Copy;
    if (actions.testFlag(Qt::MoveAction))
        vbActions << KDnDAction_Move;
    if (actions.testFlag(Qt::LinkAction))
        vbActions << KDnDAction_Link;

    return vbActions;
}
Example #2
0
DndActionMenu::DndActionMenu(Qt::DropActions possibleActions, QWidget* parent)
  : QMenu(parent)
  , copyAction(nullptr)
  , moveAction(nullptr)
  , linkAction(nullptr)
  , cancelAction(nullptr)
{
  if (possibleActions.testFlag(Qt::CopyAction))
    copyAction = addAction(QIcon::fromTheme("edit-copy"), tr("Copy here"));
  if (possibleActions.testFlag(Qt::MoveAction))
    moveAction = addAction(tr("Move here"));
  if (possibleActions.testFlag(Qt::LinkAction))
    linkAction = addAction(tr("Create symlink here"));
  addSeparator();
  cancelAction = addAction(tr("Cancel"));
}