Changeset View
Changeset View
Standalone View
Standalone View
app/extractfileitemaction.cpp
Show All 37 Lines | |||||
38 | ExtractFileItemAction::ExtractFileItemAction(QObject* parent, const QVariantList&) | 38 | ExtractFileItemAction::ExtractFileItemAction(QObject* parent, const QVariantList&) | ||
39 | : KAbstractFileItemActionPlugin(parent) | 39 | : KAbstractFileItemActionPlugin(parent) | ||
40 | , m_pluginManager(new PluginManager(this)) | 40 | , m_pluginManager(new PluginManager(this)) | ||
41 | {} | 41 | {} | ||
42 | 42 | | |||
43 | QList<QAction*> ExtractFileItemAction::actions(const KFileItemListProperties& fileItemInfos, QWidget* parentWidget) | 43 | QList<QAction*> ExtractFileItemAction::actions(const KFileItemListProperties& fileItemInfos, QWidget* parentWidget) | ||
44 | { | 44 | { | ||
45 | QList<QAction*> actions; | 45 | QList<QAction*> actions; | ||
46 | const QIcon icon = QIcon::fromTheme(QStringLiteral("ark")); | 46 | const QIcon icon = QIcon::fromTheme(QStringLiteral("archive-extract")); | ||
47 | 47 | | |||
48 | bool readOnlyParentDir = false; | 48 | bool readOnlyParentDir = false; | ||
49 | QList<QUrl> supportedUrls; | 49 | QList<QUrl> supportedUrls; | ||
50 | // Filter URLs by supported mimetypes. | 50 | // Filter URLs by supported mimetypes. | ||
51 | foreach (const QUrl &url, fileItemInfos.urlList()) { | 51 | foreach (const QUrl &url, fileItemInfos.urlList()) { | ||
52 | const QMimeType mimeType = determineMimeType(url.path()); | 52 | const QMimeType mimeType = determineMimeType(url.path()); | ||
53 | if (m_pluginManager->preferredPluginsFor(mimeType).isEmpty()) { | 53 | if (m_pluginManager->preferredPluginsFor(mimeType).isEmpty()) { | ||
54 | continue; | 54 | continue; | ||
Show All 27 Lines | |||||
82 | extractMenu->addAction(createAction(icon, | 82 | extractMenu->addAction(createAction(icon, | ||
83 | i18nc("@action:inmenu Part of Extract submenu in Dolphin context menu", "Extract archive here, autodetect subfolder"), | 83 | i18nc("@action:inmenu Part of Extract submenu in Dolphin context menu", "Extract archive here, autodetect subfolder"), | ||
84 | parentWidget, | 84 | parentWidget, | ||
85 | supportedUrls, | 85 | supportedUrls, | ||
86 | QStringLiteral("ark --batch --autodestination --autosubfolder %F"))); | 86 | QStringLiteral("ark --batch --autodestination --autosubfolder %F"))); | ||
87 | 87 | | |||
88 | QAction *extractMenuAction = new QAction(i18nc("@action:inmenu Extract submenu in Dolphin context menu", "Extract"), parentWidget); | 88 | QAction *extractMenuAction = new QAction(i18nc("@action:inmenu Extract submenu in Dolphin context menu", "Extract"), parentWidget); | ||
89 | extractMenuAction->setMenu(extractMenu); | 89 | extractMenuAction->setMenu(extractMenu); | ||
90 | extractMenuAction->setIcon(icon); | ||||
90 | 91 | | |||
91 | // #189177: disable extract menu in read-only folders. | 92 | // #189177: disable extract menu in read-only folders. | ||
92 | if (readOnlyParentDir) { | 93 | if (readOnlyParentDir) { | ||
93 | extractMenuAction->setEnabled(false); | 94 | extractMenuAction->setEnabled(false); | ||
94 | } | 95 | } | ||
95 | 96 | | |||
96 | actions << extractMenuAction; | 97 | actions << extractMenuAction; | ||
97 | return actions; | 98 | return actions; | ||
Show All 14 Lines |