Changeset View
Changeset View
Standalone View
Standalone View
app/compressfileitemaction.cpp
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 53 | const bool hasLocalUrl = std::any_of(urlList.begin(), urlList.end(), [](const QUrl &url) { | |||
---|---|---|---|---|---|
54 | return url.isLocalFile(); | 54 | return url.isLocalFile(); | ||
55 | }); | 55 | }); | ||
56 | 56 | | |||
57 | if (!hasLocalUrl) { | 57 | if (!hasLocalUrl) { | ||
58 | return {}; | 58 | return {}; | ||
59 | } | 59 | } | ||
60 | 60 | | |||
61 | QList<QAction*> actions; | 61 | QList<QAction*> actions; | ||
62 | const QIcon icon = QIcon::fromTheme(QStringLiteral("ark")); | 62 | const QIcon icon = QIcon::fromTheme(QStringLiteral("archive-insert")); | ||
63 | 63 | | |||
64 | QMenu *compressMenu = new QMenu(parentWidget); | 64 | QMenu *compressMenu = new QMenu(parentWidget); | ||
65 | 65 | | |||
66 | compressMenu->addAction(createAction(icon, | 66 | compressMenu->addAction(createAction(icon, | ||
67 | i18nc("@action:inmenu Part of Compress submenu in Dolphin context menu", "Here (as TAR.GZ)"), | 67 | i18nc("@action:inmenu Part of Compress submenu in Dolphin context menu", "Here (as TAR.GZ)"), | ||
68 | parentWidget, | 68 | parentWidget, | ||
69 | urlList, | 69 | urlList, | ||
70 | QStringLiteral("ark --changetofirstpath --add --autofilename tar.gz %F"))); | 70 | QStringLiteral("ark --changetofirstpath --add --autofilename tar.gz %F"))); | ||
Show All 12 Lines | 82 | compressMenu->addAction(createAction(icon, | |||
83 | i18nc("@action:inmenu Part of Compress submenu in Dolphin context menu", "Compress to..."), | 83 | i18nc("@action:inmenu Part of Compress submenu in Dolphin context menu", "Compress to..."), | ||
84 | parentWidget, | 84 | parentWidget, | ||
85 | urlList, | 85 | urlList, | ||
86 | QStringLiteral("ark --add --changetofirstpath --dialog %F"))); | 86 | QStringLiteral("ark --add --changetofirstpath --dialog %F"))); | ||
87 | 87 | | |||
88 | QAction *compressMenuAction = new QAction(i18nc("@action:inmenu Compress submenu in Dolphin context menu", "Compress"), parentWidget); | 88 | QAction *compressMenuAction = new QAction(i18nc("@action:inmenu Compress submenu in Dolphin context menu", "Compress"), parentWidget); | ||
89 | compressMenuAction->setMenu(compressMenu); | 89 | compressMenuAction->setMenu(compressMenu); | ||
90 | compressMenuAction->setEnabled(fileItemInfos.isLocal() && fileItemInfos.supportsWriting() && !m_pluginManager->availableWritePlugins().isEmpty()); | 90 | compressMenuAction->setEnabled(fileItemInfos.isLocal() && fileItemInfos.supportsWriting() && !m_pluginManager->availableWritePlugins().isEmpty()); | ||
91 | compressMenuAction->setIcon(icon); | ||||
91 | 92 | | |||
92 | actions << compressMenuAction; | 93 | actions << compressMenuAction; | ||
93 | return actions; | 94 | return actions; | ||
94 | } | 95 | } | ||
95 | 96 | | |||
96 | QAction *CompressFileItemAction::createAction(const QIcon& icon, const QString& name, QWidget *parent, const QList<QUrl>& urls, const QString& exec) | 97 | QAction *CompressFileItemAction::createAction(const QIcon& icon, const QString& name, QWidget *parent, const QList<QUrl>& urls, const QString& exec) | ||
97 | { | 98 | { | ||
98 | QAction *action = new QAction(icon, name, parent); | 99 | QAction *action = new QAction(icon, name, parent); | ||
Show All 9 Lines |