Changeset View
Changeset View
Standalone View
Standalone View
src/dolphincontextmenu.cpp
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 57 | DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent, | |||
---|---|---|---|---|---|
61 | QMenu(parent), | 61 | QMenu(parent), | ||
62 | m_pos(pos), | 62 | m_pos(pos), | ||
63 | m_mainWindow(parent), | 63 | m_mainWindow(parent), | ||
64 | m_fileInfo(fileInfo), | 64 | m_fileInfo(fileInfo), | ||
65 | m_baseUrl(baseUrl), | 65 | m_baseUrl(baseUrl), | ||
66 | m_baseFileItem(nullptr), | 66 | m_baseFileItem(nullptr), | ||
67 | m_selectedItems(), | 67 | m_selectedItems(), | ||
68 | m_selectedItemsProperties(nullptr), | 68 | m_selectedItemsProperties(nullptr), | ||
69 | m_context(NoContext), | 69 | m_context(NoContext), | ||
elvisangelaccio: If we change the type of `m_context`, we don't need the `static_cast`. | |||||
70 | m_copyToMenu(parent), | 70 | m_copyToMenu(parent), | ||
71 | m_customActions(), | 71 | m_customActions(), | ||
72 | m_command(None), | 72 | m_command(Command::None), | ||
73 | m_removeAction(nullptr) | 73 | m_removeAction(nullptr) | ||
74 | { | 74 | { | ||
75 | // The context menu either accesses the URLs of the selected items | 75 | // The context menu either accesses the URLs of the selected items | ||
76 | // or the items itself. To increase the performance both lists are cached. | 76 | // or the items itself. To increase the performance both lists are cached. | ||
77 | const DolphinView* view = m_mainWindow->activeViewContainer()->view(); | 77 | const DolphinView* view = m_mainWindow->activeViewContainer()->view(); | ||
78 | m_selectedItems = view->selectedItems(); | 78 | m_selectedItems = view->selectedItems(); | ||
79 | } | 79 | } | ||
80 | 80 | | |||
▲ Show 20 Lines • Show All 220 Lines • ▼ Show 20 Line(s) | 300 | if (activatedAction) { | |||
301 | if (activatedAction == addToPlacesAction) { | 301 | if (activatedAction == addToPlacesAction) { | ||
302 | const QUrl selectedUrl(m_fileInfo.url()); | 302 | const QUrl selectedUrl(m_fileInfo.url()); | ||
303 | if (selectedUrl.isValid()) { | 303 | if (selectedUrl.isValid()) { | ||
304 | PlacesItemModel model; | 304 | PlacesItemModel model; | ||
305 | const QString text = selectedUrl.fileName(); | 305 | const QString text = selectedUrl.fileName(); | ||
306 | model.createPlacesItem(text, selectedUrl, KIO::iconNameForUrl(selectedUrl)); | 306 | model.createPlacesItem(text, selectedUrl, KIO::iconNameForUrl(selectedUrl)); | ||
307 | } | 307 | } | ||
308 | } else if (activatedAction == openParentAction) { | 308 | } else if (activatedAction == openParentAction) { | ||
309 | m_command = OpenParentFolder; | 309 | m_command = Command::OpenParentFolder; | ||
310 | } else if (activatedAction == openParentInNewWindowAction) { | 310 | } else if (activatedAction == openParentInNewWindowAction) { | ||
311 | m_command = OpenParentFolderInNewWindow; | 311 | m_command = Command::OpenParentFolderInNewWindow; | ||
312 | } else if (activatedAction == openParentInNewTabAction) { | 312 | } else if (activatedAction == openParentInNewTabAction) { | ||
313 | m_command = OpenParentFolderInNewTab; | 313 | m_command = Command::OpenParentFolderInNewTab; | ||
314 | } | 314 | } | ||
315 | } | 315 | } | ||
316 | } | 316 | } | ||
317 | 317 | | |||
318 | void DolphinContextMenu::openViewportContextMenu() | 318 | void DolphinContextMenu::openViewportContextMenu() | ||
319 | { | 319 | { | ||
320 | // setup 'Create New' menu | 320 | // setup 'Create New' menu | ||
321 | KNewFileMenu* newFileMenu = m_mainWindow->newFileMenu(); | 321 | KNewFileMenu* newFileMenu = m_mainWindow->newFileMenu(); | ||
▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines |
If we change the type of m_context, we don't need the static_cast.