Commit e319551d authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[Mount ISO Action] Allow mounting generic disk images

parent 8165f4c2
Pipeline #109961 passed with stage
in 57 seconds
......@@ -190,12 +190,17 @@ void unmount(const Solid::Device &device)
QList<QAction *> MountIsoAction::actions(const KFileItemListProperties &fileItemInfos,
QWidget *parentWidget)
{
if (fileItemInfos.urlList().size() != 1
|| fileItemInfos.mimeType() != QLatin1String("application/x-cd-image")
|| !fileItemInfos.isLocal()) {
if (fileItemInfos.urlList().size() != 1 || !fileItemInfos.isLocal()) {
return {};
};
const QString mimeType = fileItemInfos.mimeType();
if (mimeType != QLatin1String("application/x-cd-image")
&& mimeType != QLatin1String("application/x-raw-disk-image")) {
return {};
}
auto file = fileItemInfos.urlList().at(0).toLocalFile();
// Check if dbus can handle file descriptor
......@@ -209,7 +214,7 @@ QList<QAction *> MountIsoAction::actions(const KFileItemListProperties &fileItem
if (!device.isValid()) {
const QIcon icon = QIcon::fromTheme(QStringLiteral("media-mount"));
const QString title = i18nc("@action:inmenu Action to mount an ISO image", "Mount ISO");
const QString title = i18nc("@action:inmenu Action to mount a disk image", "Mount");
QAction *action = new QAction(icon, title, parentWidget);
......@@ -218,8 +223,8 @@ QList<QAction *> MountIsoAction::actions(const KFileItemListProperties &fileItem
} else {
// fileItem is mounted on device
const QIcon icon = QIcon::fromTheme(QStringLiteral("media-eject"));
const QString title =
i18nc("@action:inmenu Action to unmount an ISO image", "Unmount ISO");
const QString title = i18nc("@action:inmenu Action to unmount a disk image", "Unmount");
QAction *action = new QAction(icon, title, parentWidget);
connect(action, &QAction::triggered, this, [device]() { unmount(device); });
......
......@@ -2,9 +2,10 @@
"KPlugin": {
"Icon": "application-x-cd-image",
"MimeTypes": [
"application/x-cd-image"
"application/x-cd-image",
"application/x-raw-disk-image"
],
"Name": "Mount and unmount iso image",
"Name": "Mount ISO and disk images",
"Name[az]": "İSO faylını qoşmaq və ayırmaq",
"Name[ca@valencia]": "Muntatge i desmuntatge d'una imatge ISO",
"Name[ca]": "Muntatge i desmuntatge d'una imatge ISO",
......@@ -45,5 +46,5 @@
"KFileItemAction/Plugin"
]
},
"MimeType": "application/x-cd-image;"
"MimeType": "application/x-cd-image;application/x-raw-disk-image;"
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment