aboutsummaryrefslogtreecommitdiff
path: root/src/mimeparser.cpp
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2020-06-19 17:55:04 +0200
committerFelix (xq) Queißner <git@mq32.de>2020-06-19 17:55:04 +0200
commite716a44604dcfe0ed57d278cd4d2597bf328de03 (patch)
treeb0ddb57cbca3c4031cf8741690d78bd808e42090 /src/mimeparser.cpp
parent1eec0c9fa22e86225691e7892e9219e7d17d5c42 (diff)
Fixes non-updating status bar, fixes bug in the mime parser.
Diffstat (limited to 'src/mimeparser.cpp')
-rw-r--r--src/mimeparser.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mimeparser.cpp b/src/mimeparser.cpp
index dd254a4..b5f5fc3 100644
--- a/src/mimeparser.cpp
+++ b/src/mimeparser.cpp
@@ -15,6 +15,24 @@ QString MimeType::parameter(const QString &param_name, QString const & default_v
return val;
}
+QString MimeType::toString() const
+{
+ if(isValid()) {
+ QString result = type;
+ if(not subtype.isEmpty())
+ result += "/" + subtype;
+ for(auto const & key : parameters.keys()) {
+ result += "; ";
+ result += key;
+ result += "=";
+ result += parameters[key];
+ }
+ return result;
+ } else {
+ return QString { };
+ }
+}
+
MimeType MimeParser::parse(const QString &mime_text)
{
MimeType type;
@@ -22,7 +40,7 @@ MimeType MimeParser::parse(const QString &mime_text)
QString arg_list;
QString mime_part;
- if(int idx = mime_text.indexOf(' '); idx >= 0) {
+ if(int idx = mime_text.indexOf(';'); idx >= 0) {
arg_list = mime_text.mid(idx + 1).trimmed().toLower();
mime_part = mime_text.mid(0, idx).trimmed().toLower();
} else {