Changeset View
Changeset View
Standalone View
Standalone View
components/Global.cpp
Show All 19 Lines | |||||
20 | * | 20 | * | ||
21 | */ | 21 | */ | ||
22 | 22 | | |||
23 | #include "Global.h" | 23 | #include "Global.h" | ||
24 | 24 | | |||
25 | #include <QDebug> | 25 | #include <QDebug> | ||
26 | 26 | | |||
27 | #include <QUrl> | 27 | #include <QUrl> | ||
28 | #include <QUrlQuery> | ||||
28 | #include <QMimeDatabase> | 29 | #include <QMimeDatabase> | ||
29 | #include <QPluginLoader> | 30 | #include <QPluginLoader> | ||
30 | 31 | | |||
31 | #include <KoPluginLoader.h> | 32 | #include <KoPluginLoader.h> | ||
32 | 33 | | |||
33 | // For the mimetype names | 34 | // For the mimetype names | ||
34 | #include <KWDocument.h> | 35 | #include <KWDocument.h> | ||
35 | #include <DocBase.h> | 36 | #include <DocBase.h> | ||
Show All 11 Lines | |||||
47 | void Global::loadPlugins() | 48 | void Global::loadPlugins() | ||
48 | { | 49 | { | ||
49 | 50 | | |||
50 | } | 51 | } | ||
51 | 52 | | |||
52 | int Global::documentType(const QUrl& document) | 53 | int Global::documentType(const QUrl& document) | ||
53 | { | 54 | { | ||
54 | int result = DocumentType::Unknown; | 55 | int result = DocumentType::Unknown; | ||
56 | const QUrlQuery query(document); | ||||
55 | 57 | | |||
56 | // 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) | ||
57 | if(document.hasQueryItem("mimetype")) { | 59 | if(query.hasQueryItem("mimetype")) { | ||
58 | QString mime = document.queryItemValue("mimetype"); | 60 | QString mime = query.queryItemValue("mimetype"); | ||
59 | if(mime == WORDS_MIME_TYPE) { | 61 | if(mime == WORDS_MIME_TYPE) { | ||
60 | result = DocumentType::TextDocument; | 62 | result = DocumentType::TextDocument; | ||
61 | } | 63 | } | ||
62 | else if(mime == SHEETS_MIME_TYPE) { | 64 | else if(mime == SHEETS_MIME_TYPE) { | ||
63 | result = DocumentType::Spreadsheet; | 65 | result = DocumentType::Spreadsheet; | ||
64 | } | 66 | } | ||
65 | else if(mime == STAGE_MIME_TYPE) { | 67 | else if(mime == STAGE_MIME_TYPE) { | ||
66 | result = DocumentType::Presentation; | 68 | result = DocumentType::Presentation; | ||
Show All 34 Lines |