Changeset View
Changeset View
Standalone View
Standalone View
src/panels/places/placespanel.cpp
Show First 20 Lines • Show All 166 Lines • ▼ Show 20 Line(s) | 162 | { | |||
---|---|---|---|---|---|
167 | 167 | | |||
168 | QMenu menu(this); | 168 | QMenu menu(this); | ||
169 | 169 | | |||
170 | QAction* emptyTrashAction = nullptr; | 170 | QAction* emptyTrashAction = nullptr; | ||
171 | QAction* editAction = nullptr; | 171 | QAction* editAction = nullptr; | ||
172 | QAction* teardownAction = nullptr; | 172 | QAction* teardownAction = nullptr; | ||
173 | QAction* ejectAction = nullptr; | 173 | QAction* ejectAction = nullptr; | ||
174 | QAction* mountAction = nullptr; | 174 | QAction* mountAction = nullptr; | ||
175 | QAction* changeLabelAction = nullptr; | ||||
175 | 176 | | |||
176 | const bool isDevice = !item->udi().isEmpty(); | 177 | const bool isDevice = !item->udi().isEmpty(); | ||
177 | const bool isTrash = (item->url().scheme() == QLatin1String("trash")); | 178 | const bool isTrash = (item->url().scheme() == QLatin1String("trash")); | ||
178 | if (isDevice) { | 179 | if (isDevice) { | ||
179 | ejectAction = m_model->ejectAction(index); | 180 | ejectAction = m_model->ejectAction(index); | ||
180 | if (ejectAction) { | 181 | if (ejectAction) { | ||
181 | ejectAction->setParent(&menu); | 182 | ejectAction->setParent(&menu); | ||
182 | menu.addAction(ejectAction); | 183 | menu.addAction(ejectAction); | ||
Show All 14 Lines | 187 | if (teardownAction) { | |||
197 | teardownAction->setParent(&menu); | 198 | teardownAction->setParent(&menu); | ||
198 | menu.addAction(teardownAction); | 199 | menu.addAction(teardownAction); | ||
199 | } | 200 | } | ||
200 | 201 | | |||
201 | if (item->storageSetupNeeded()) { | 202 | if (item->storageSetupNeeded()) { | ||
202 | mountAction = menu.addAction(QIcon::fromTheme(QStringLiteral("media-mount")), i18nc("@action:inmenu", "Mount")); | 203 | mountAction = menu.addAction(QIcon::fromTheme(QStringLiteral("media-mount")), i18nc("@action:inmenu", "Mount")); | ||
203 | } | 204 | } | ||
204 | 205 | | |||
205 | if (teardownAction || ejectAction || mountAction) { | 206 | changeLabelAction = m_model->changeLabelAction(index); | ||
207 | if (changeLabelAction) { | ||||
208 | changeLabelAction->setParent(&menu); | ||||
209 | menu.addAction(changeLabelAction); | ||||
210 | } | ||||
211 | | ||||
212 | if (teardownAction || ejectAction || mountAction || changeLabelAction) { | ||||
206 | menu.addSeparator(); | 213 | menu.addSeparator(); | ||
207 | } | 214 | } | ||
208 | } else { | 215 | } else { | ||
209 | if (isTrash) { | 216 | if (isTrash) { | ||
210 | emptyTrashAction = menu.addAction(QIcon::fromTheme(QStringLiteral("trash-empty")), i18nc("@action:inmenu", "Empty Trash")); | 217 | emptyTrashAction = menu.addAction(QIcon::fromTheme(QStringLiteral("trash-empty")), i18nc("@action:inmenu", "Empty Trash")); | ||
211 | emptyTrashAction->setEnabled(item->icon() == QLatin1String("user-trash-full")); | 218 | emptyTrashAction->setEnabled(item->icon() == QLatin1String("user-trash-full")); | ||
212 | menu.addSeparator(); | 219 | menu.addSeparator(); | ||
213 | } | 220 | } | ||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | 273 | } else if (action == openInNewTabAction) { | |||
268 | // emit the slotItemMiddleClicked signal, because of Qt::MiddleButton. | 275 | // emit the slotItemMiddleClicked signal, because of Qt::MiddleButton. | ||
269 | triggerItem(index, Qt::MiddleButton); | 276 | triggerItem(index, Qt::MiddleButton); | ||
270 | } else if (action == mountAction) { | 277 | } else if (action == mountAction) { | ||
271 | m_model->requestStorageSetup(index); | 278 | m_model->requestStorageSetup(index); | ||
272 | } else if (action == teardownAction) { | 279 | } else if (action == teardownAction) { | ||
273 | m_model->requestTearDown(index); | 280 | m_model->requestTearDown(index); | ||
274 | } else if (action == ejectAction) { | 281 | } else if (action == ejectAction) { | ||
275 | m_model->requestEject(index); | 282 | m_model->requestEject(index); | ||
283 | } else if (action == changeLabelAction) { | ||||
284 | m_model->requestChangeLabel(index); | ||||
276 | } else if (action == propertiesAction) { | 285 | } else if (action == propertiesAction) { | ||
277 | KPropertiesDialog* dialog = new KPropertiesDialog(item->url(), this); | 286 | KPropertiesDialog* dialog = new KPropertiesDialog(item->url(), this); | ||
278 | dialog->setAttribute(Qt::WA_DeleteOnClose); | 287 | dialog->setAttribute(Qt::WA_DeleteOnClose); | ||
279 | dialog->show(); | 288 | dialog->show(); | ||
280 | } | 289 | } | ||
281 | } | 290 | } | ||
282 | } | 291 | } | ||
283 | 292 | | |||
▲ Show 20 Lines • Show All 278 Lines • Show Last 20 Lines |