Changeset View
Changeset View
Standalone View
Standalone View
src/dolphincontextmenu.cpp
| Show First 20 Lines • Show All 336 Lines • ▼ Show 20 Line(s) | 336 | if (baseItem.isNull() || baseItem.url() != m_baseUrl) { | |||
|---|---|---|---|---|---|
| 337 | baseItem = baseFileItem(); | 337 | baseItem = baseFileItem(); | ||
| 338 | } | 338 | } | ||
| 339 | 339 | | |||
| 340 | const KFileItemListProperties baseUrlProperties(KFileItemList() << baseItem); | 340 | const KFileItemListProperties baseUrlProperties(KFileItemList() << baseItem); | ||
| 341 | KFileItemActions fileItemActions; | 341 | KFileItemActions fileItemActions; | ||
| 342 | fileItemActions.setParentWidget(m_mainWindow); | 342 | fileItemActions.setParentWidget(m_mainWindow); | ||
| 343 | fileItemActions.setItemListProperties(baseUrlProperties); | 343 | fileItemActions.setItemListProperties(baseUrlProperties); | ||
| 344 | 344 | | |||
| 345 | // Don't show "Open With" menu items if the current dir is empty, because there's | | |||
| 346 | // generally no app that can do anything interesting with an empty directory | | |||
| 347 | if (view->itemsCount() != 0) { | | |||
| 348 | addOpenWithActions(fileItemActions); | | |||
| 349 | } | | |||
| 350 | | ||||
| 351 | // Set up and insert 'Create New' menu | 345 | // Set up and insert 'Create New' menu | ||
| 352 | KNewFileMenu* newFileMenu = m_mainWindow->newFileMenu(); | 346 | KNewFileMenu* newFileMenu = m_mainWindow->newFileMenu(); | ||
| 353 | newFileMenu->setViewShowsHiddenFiles(view->hiddenFilesShown()); | 347 | newFileMenu->setViewShowsHiddenFiles(view->hiddenFilesShown()); | ||
| 354 | newFileMenu->checkUpToDate(); | 348 | newFileMenu->checkUpToDate(); | ||
| 355 | newFileMenu->setPopupFiles(QList<QUrl>() << m_baseUrl); | 349 | newFileMenu->setPopupFiles(QList<QUrl>() << m_baseUrl); | ||
| 356 | addMenu(newFileMenu->menu()); | 350 | addMenu(newFileMenu->menu()); | ||
| 357 | 351 | | |||
| 352 | // Don't show "Open With" menu items if the current dir is empty, because there's | ||||
| 353 | // generally no app that can do anything interesting with an empty directory | ||||
| 354 | if (view->itemsCount() != 0) { | ||||
| 355 | addOpenWithActions(fileItemActions); | ||||
| 356 | } | ||||
| 357 | | ||||
| 358 | QAction* pasteAction = createPasteAction(); | 358 | QAction* pasteAction = createPasteAction(); | ||
| 359 | addAction(pasteAction); | 359 | addAction(pasteAction); | ||
| 360 | 360 | | |||
| 361 | // Insert 'Add to Places' entry if it's not already in the places panel | 361 | // Insert 'Add to Places' entry if it's not already in the places panel | ||
| 362 | if (!placeExists(m_mainWindow->activeViewContainer()->url())) { | 362 | if (!placeExists(m_mainWindow->activeViewContainer()->url())) { | ||
| 363 | addAction(m_mainWindow->actionCollection()->action(QStringLiteral("add_to_places"))); | 363 | addAction(m_mainWindow->actionCollection()->action(QStringLiteral("add_to_places"))); | ||
| 364 | } | 364 | } | ||
| 365 | addSeparator(); | 365 | addSeparator(); | ||
| ▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines | |||||