Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/plugins/folder/foldermodel.cpp
Show First 20 Lines • Show All 1448 Lines • ▼ Show 20 Line(s) | 1412 | } else { | |||
---|---|---|---|---|---|
1449 | 1449 | | |||
1450 | menu->addAction(m_actionCollection.action(QStringLiteral("rename"))); | 1450 | menu->addAction(m_actionCollection.action(QStringLiteral("rename"))); | ||
1451 | menu->addAction(m_actionCollection.action(QStringLiteral("restoreFromTrash"))); | 1451 | menu->addAction(m_actionCollection.action(QStringLiteral("restoreFromTrash"))); | ||
1452 | 1452 | | |||
1453 | KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig(QStringLiteral("kdeglobals"), KConfig::NoGlobals); | 1453 | KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig(QStringLiteral("kdeglobals"), KConfig::NoGlobals); | ||
1454 | KConfigGroup cg(globalConfig, "KDE"); | 1454 | KConfigGroup cg(globalConfig, "KDE"); | ||
1455 | bool showDeleteCommand = cg.readEntry("ShowDeleteCommand", false); | 1455 | bool showDeleteCommand = cg.readEntry("ShowDeleteCommand", false); | ||
1456 | 1456 | | |||
1457 | // Don't add the "Move to Trash" action if we're showing the menu for the trash link | 1457 | // When we're showing the menu for the trash link, offer "Empty Trash" instead | ||
1458 | if (!isTrashLink) { | 1458 | // of the "Move to Trash" action. | ||
1459 | if (isTrashLink) { | ||||
1460 | QAction *emptyTrashAction = m_actionCollection.action(QStringLiteral("emptyTrash")); | ||||
1461 | if (emptyTrashAction) { | ||||
1462 | // We explicitly force the action visible here, as it relies on the KFileItemList | ||||
1463 | // we collected above. In updateActions() we don't have it and since this is always | ||||
1464 | // called before we open the menu, it would correct visibility again when opening | ||||
1465 | // the context menu for other items later. | ||||
1466 | emptyTrashAction->setVisible(true); | ||||
1467 | menu->addAction(emptyTrashAction); | ||||
1468 | } | ||||
1469 | } else { | ||||
1459 | if (!hasRemoteFiles) { | 1470 | if (!hasRemoteFiles) { | ||
1460 | menu->addAction(m_actionCollection.action(QStringLiteral("trash"))); | 1471 | menu->addAction(m_actionCollection.action(QStringLiteral("trash"))); | ||
1461 | } else { | 1472 | } else { | ||
1462 | showDeleteCommand = true; | 1473 | showDeleteCommand = true; | ||
1463 | } | 1474 | } | ||
1464 | } | 1475 | } | ||
1465 | if (showDeleteCommand) { | 1476 | if (showDeleteCommand) { | ||
1466 | menu->addAction(m_actionCollection.action(QStringLiteral("del"))); | 1477 | menu->addAction(m_actionCollection.action(QStringLiteral("del"))); | ||
▲ Show 20 Lines • Show All 172 Lines • Show Last 20 Lines |