summaryrefslogtreecommitdiff
blob: 6ea7ad4effc0fe4185bbfbe4b1956234b0302b26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
commit f57edb20c4fa4e53d6a245dcc81273b62e44f611
Author: Martin Kostolný <clearmartin@zoho.com>
Date:   Mon Dec 5 00:43:53 2016 +0100

    Hard-code krarc.protocol mimetypes that were recently removed from protocol
    
    Differential Revision: https://phabricator.kde.org/D3566

diff --git a/krusader/krservices.cpp b/krusader/krservices.cpp
index 86bc0cf..b286066 100644
--- a/krusader/krservices.cpp
+++ b/krusader/krservices.cpp
@@ -30,14 +30,49 @@
 #include "defaults.h"
 
 QMap<QString, QString>* KrServices::slaveMap = 0;
+QSet<QString> KrServices::krarcArchiveMimetypes = KrServices::generateKrarcArchiveMimetypes();
 #ifdef KRARC_QUERY_ENABLED
-QSet<QString> KrServices::krarcArchiveMimetypes = QSet<QString>::fromList(KProtocolInfo::archiveMimetypes("krarc"));
 QSet<QString> KrServices::isoArchiveMimetypes = QSet<QString>::fromList(KProtocolInfo::archiveMimetypes("iso"));
 #else
-QSet<QString> KrServices::krarcArchiveMimetypes;
 QSet<QString> KrServices::isoArchiveMimetypes;
 #endif
 
+QSet<QString> KrServices::generateKrarcArchiveMimetypes()
+{
+    // Hard-code these proven mimetypes openable by krarc protocol.
+    // They cannot be listed in krarc.protocol itself
+    // because it would baffle other file managers (like Dolphin).
+    QSet<QString> mimes;
+    mimes += QString("application/x-deb");
+    mimes += QString("application/x-debian-package");
+    mimes += QString("application/vnd.debian.binary-package");
+    mimes += QString("application/x-java-archive");
+    mimes += QString("application/x-rpm");
+    mimes += QString("application/x-source-rpm");
+    mimes += QString("application/vnd.oasis.opendocument.chart");
+    mimes += QString("application/vnd.oasis.opendocument.database");
+    mimes += QString("application/vnd.oasis.opendocument.formula");
+    mimes += QString("application/vnd.oasis.opendocument.graphics");
+    mimes += QString("application/vnd.oasis.opendocument.presentation");
+    mimes += QString("application/vnd.oasis.opendocument.spreadsheet");
+    mimes += QString("application/vnd.oasis.opendocument.text");
+    mimes += QString("application/vnd.openxmlformats-officedocument.presentationml.presentation");
+    mimes += QString("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+    mimes += QString("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
+    mimes += QString("application/x-cbz");
+    mimes += QString("application/x-cbr");
+    mimes += QString("application/epub+zip");
+    mimes += QString("application/x-webarchive");
+    mimes += QString("application/x-plasma");
+    mimes += QString("application/vnd.rar");
+
+    #ifdef KRARC_QUERY_ENABLED
+    mimes += QSet<QString>::fromList(KProtocolInfo::archiveMimetypes("krarc"));
+    #endif
+
+    return mimes;
+}
+
 bool KrServices::cmdExist(QString cmdName)
 {
     KConfigGroup group(krConfig, "Dependencies");
diff --git a/krusader/krservices.h b/krusader/krservices.h
index e9e805c..e54a0a6 100644
--- a/krusader/krservices.h
+++ b/krusader/krservices.h
@@ -32,9 +32,6 @@ class QFile;
 class KrServices
 {
 public:
-    KrServices() {}
-    ~KrServices() {}
-
     static bool         cmdExist(QString cmdName);
     static QString      chooseFullPathName(QStringList names, QString confName);
     static QString      fullPathName(QString name, QString confName = QString());
@@ -57,6 +54,9 @@ protected:
     static QString    escape(QString name);
 
 private:
+    KrServices() {}
+    ~KrServices() {}
+    static QSet<QString> generateKrarcArchiveMimetypes();
     static QMap<QString, QString>* slaveMap;
     static QSet<QString> krarcArchiveMimetypes;
     static QSet<QString> isoArchiveMimetypes;