Changeset View
Changeset View
Standalone View
Standalone View
components/Global.cpp
Show All 39 Lines | |||||
40 | 40 | | |||
41 | static const QStringList staticTextTypes{ "application/pdf" }; | 41 | static const QStringList staticTextTypes{ "application/pdf" }; | ||
42 | 42 | | |||
43 | Calligra::Components::Global::Global(QObject* parent) | 43 | Calligra::Components::Global::Global(QObject* parent) | ||
44 | : QObject{parent} | 44 | : QObject{parent} | ||
45 | { | 45 | { | ||
46 | } | 46 | } | ||
47 | 47 | | |||
48 | void Global::loadPlugins() | 48 | int Global::documentType(const QUrl& document) | ||
49 | { | 49 | { | ||
50 | int result = DocumentType::Unknown; | ||||
50 | 51 | | |||
52 | if (!document.isValid()) { | ||||
53 | return result; | ||||
51 | } | 54 | } | ||
52 | 55 | | |||
53 | int Global::documentType(const QUrl& document) | | |||
54 | { | | |||
55 | int result = DocumentType::Unknown; | | |||
56 | const QUrlQuery query(document); | 56 | const QUrlQuery query(document); | ||
57 | 57 | | |||
58 | // First, check if the URL gives us specific information on this topic (such as asking for a new file) | 58 | // First, check if the URL gives us specific information on this topic (such as asking for a new file) | ||
59 | if(query.hasQueryItem("mimetype")) { | 59 | if(query.hasQueryItem("mimetype")) { | ||
60 | QString mime = query.queryItemValue("mimetype"); | 60 | QString mime = query.queryItemValue("mimetype"); | ||
61 | if(mime == WORDS_MIME_TYPE) { | 61 | if(mime == WORDS_MIME_TYPE) { | ||
62 | result = DocumentType::TextDocument; | 62 | result = DocumentType::TextDocument; | ||
63 | } | 63 | } | ||
Show All 39 Lines |