Changeset View
Changeset View
Standalone View
Standalone View
src/panels/places/placespanel.cpp
Show All 39 Lines | |||||
40 | 40 | | |||
41 | #include <KFilePlacesModel> | 41 | #include <KFilePlacesModel> | ||
42 | #include <KIO/DropJob> | 42 | #include <KIO/DropJob> | ||
43 | #include <KIO/EmptyTrashJob> | 43 | #include <KIO/EmptyTrashJob> | ||
44 | #include <KIO/Job> | 44 | #include <KIO/Job> | ||
45 | #include <KIconLoader> | 45 | #include <KIconLoader> | ||
46 | #include <KLocalizedString> | 46 | #include <KLocalizedString> | ||
47 | #include <KMountPoint> | 47 | #include <KMountPoint> | ||
48 | #include <KPropertiesDialog> | ||||
48 | 49 | | |||
49 | #include <QGraphicsSceneDragDropEvent> | 50 | #include <QGraphicsSceneDragDropEvent> | ||
50 | #include <QIcon> | 51 | #include <QIcon> | ||
51 | #include <QMenu> | 52 | #include <QMenu> | ||
52 | #include <QMimeData> | 53 | #include <QMimeData> | ||
53 | #include <QVBoxLayout> | 54 | #include <QVBoxLayout> | ||
54 | 55 | | |||
55 | PlacesPanel::PlacesPanel(QWidget* parent) : | 56 | PlacesPanel::PlacesPanel(QWidget* parent) : | ||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Line(s) | 162 | { | |||
169 | QAction* emptyTrashAction = nullptr; | 170 | QAction* emptyTrashAction = nullptr; | ||
170 | QAction* editAction = nullptr; | 171 | QAction* editAction = nullptr; | ||
171 | QAction* teardownAction = nullptr; | 172 | QAction* teardownAction = nullptr; | ||
172 | QAction* ejectAction = nullptr; | 173 | QAction* ejectAction = nullptr; | ||
173 | QAction* mountAction = nullptr; | 174 | QAction* mountAction = nullptr; | ||
174 | 175 | | |||
175 | const bool isDevice = !item->udi().isEmpty(); | 176 | const bool isDevice = !item->udi().isEmpty(); | ||
176 | const bool isTrash = (item->url().scheme() == QLatin1String("trash")); | 177 | const bool isTrash = (item->url().scheme() == QLatin1String("trash")); | ||
177 | if (isDevice) { | 178 | if (isDevice) { | ||
anthonyfieroni: Remove unrelated changes. | |||||
178 | ejectAction = m_model->ejectAction(index); | 179 | ejectAction = m_model->ejectAction(index); | ||
179 | if (ejectAction) { | 180 | if (ejectAction) { | ||
180 | ejectAction->setParent(&menu); | 181 | ejectAction->setParent(&menu); | ||
181 | menu.addAction(ejectAction); | 182 | menu.addAction(ejectAction); | ||
182 | } | 183 | } | ||
183 | 184 | | |||
184 | teardownAction = m_model->teardownAction(index); | 185 | teardownAction = m_model->teardownAction(index); | ||
185 | if (teardownAction) { | 186 | if (teardownAction) { | ||
Show All 23 Lines | 209 | if (isTrash) { | |||
209 | emptyTrashAction = menu.addAction(QIcon::fromTheme(QStringLiteral("trash-empty")), i18nc("@action:inmenu", "Empty Trash")); | 210 | emptyTrashAction = menu.addAction(QIcon::fromTheme(QStringLiteral("trash-empty")), i18nc("@action:inmenu", "Empty Trash")); | ||
210 | emptyTrashAction->setEnabled(item->icon() == QLatin1String("user-trash-full")); | 211 | emptyTrashAction->setEnabled(item->icon() == QLatin1String("user-trash-full")); | ||
211 | menu.addSeparator(); | 212 | menu.addSeparator(); | ||
212 | } | 213 | } | ||
213 | } | 214 | } | ||
214 | 215 | | |||
215 | QAction* openInNewWindowAction = menu.addAction(QIcon::fromTheme(QStringLiteral("window-new")), i18nc("@item:inmenu", "Open in New Window")); | 216 | QAction* openInNewWindowAction = menu.addAction(QIcon::fromTheme(QStringLiteral("window-new")), i18nc("@item:inmenu", "Open in New Window")); | ||
216 | QAction* openInNewTabAction = menu.addAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18nc("@item:inmenu", "Open in New Tab")); | 217 | QAction* openInNewTabAction = menu.addAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18nc("@item:inmenu", "Open in New Tab")); | ||
218 | QAction* propertiesAction = nullptr; | ||||
219 | if (item->url().isLocalFile()) { | ||||
220 | propertiesAction = menu.addAction(QIcon::fromTheme(QStringLiteral("document-properties")), i18nc("@action:inmenu", "Properties")); | ||||
221 | } | ||||
217 | if (!isDevice && !isTrash) { | 222 | if (!isDevice && !isTrash) { | ||
218 | menu.addSeparator(); | 223 | menu.addSeparator(); | ||
219 | } | 224 | } | ||
220 | 225 | | |||
221 | if (!isDevice) { | 226 | if (!isDevice) { | ||
222 | editAction = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-entry")), i18nc("@item:inmenu", "Edit...")); | 227 | editAction = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-entry")), i18nc("@item:inmenu", "Edit...")); | ||
223 | } | 228 | } | ||
224 | 229 | | |||
225 | QAction* removeAction = nullptr; | 230 | QAction* removeAction = nullptr; | ||
226 | if (!isDevice && !item->isSystemItem()) { | 231 | if (!isDevice && !item->isSystemItem()) { | ||
227 | removeAction = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18nc("@item:inmenu", "Remove")); | 232 | removeAction = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18nc("@item:inmenu", "Remove")); | ||
228 | } | 233 | } | ||
229 | 234 | | |||
230 | QAction* hideAction = menu.addAction(QIcon::fromTheme(QStringLiteral("hint")), i18nc("@item:inmenu", "Hide")); | 235 | QAction* hideAction = menu.addAction(QIcon::fromTheme(QStringLiteral("hint")), i18nc("@item:inmenu", "Hide")); | ||
231 | hideAction->setCheckable(true); | 236 | hideAction->setCheckable(true); | ||
anthonyfieroni: Remove white-space line | |||||
232 | hideAction->setChecked(item->isHidden()); | 237 | hideAction->setChecked(item->isHidden()); | ||
233 | 238 | | |||
234 | buildGroupContextMenu(&menu, index); | 239 | buildGroupContextMenu(&menu, index); | ||
235 | 240 | | |||
236 | QAction* action = menu.exec(pos.toPoint()); | 241 | QAction* action = menu.exec(pos.toPoint()); | ||
237 | if (action) { | 242 | if (action) { | ||
238 | if (action == emptyTrashAction) { | 243 | if (action == emptyTrashAction) { | ||
239 | Trash::empty(this); | 244 | Trash::empty(this); | ||
Show All 20 Lines | 263 | } else if (action == openInNewTabAction) { | |||
260 | // emit the slotItemMiddleClicked signal, because of Qt::MiddleButton. | 265 | // emit the slotItemMiddleClicked signal, because of Qt::MiddleButton. | ||
261 | triggerItem(index, Qt::MiddleButton); | 266 | triggerItem(index, Qt::MiddleButton); | ||
262 | } else if (action == mountAction) { | 267 | } else if (action == mountAction) { | ||
263 | m_model->requestStorageSetup(index); | 268 | m_model->requestStorageSetup(index); | ||
264 | } else if (action == teardownAction) { | 269 | } else if (action == teardownAction) { | ||
265 | m_model->requestTearDown(index); | 270 | m_model->requestTearDown(index); | ||
266 | } else if (action == ejectAction) { | 271 | } else if (action == ejectAction) { | ||
267 | m_model->requestEject(index); | 272 | m_model->requestEject(index); | ||
273 | } else if (action == propertiesAction) { | ||||
274 | KPropertiesDialog* dialog = new KPropertiesDialog(item->url(), this); | ||||
275 | dialog->setAttribute(Qt::WA_DeleteOnClose); | ||||
276 | dialog->show(); | ||||
268 | } | 277 | } | ||
269 | } | 278 | } | ||
270 | } | 279 | } | ||
271 | 280 | | |||
272 | selectClosestItem(); | 281 | selectClosestItem(); | ||
273 | } | 282 | } | ||
274 | 283 | | |||
275 | void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos) | 284 | void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos) | ||
▲ Show 20 Lines • Show All 259 Lines • Show Last 20 Lines |
Remove unrelated changes.