From 08930f0bc6b6bd3a83f5a5b1b56aae8d81f40391 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Sun, 13 Jan 2013 13:09:17 -0500 Subject: [PATCH] tweak to File set label --- sdk/openbr_plugin.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sdk/openbr_plugin.cpp b/sdk/openbr_plugin.cpp index 20685c3..fb3d3c8 100644 --- a/sdk/openbr_plugin.cpp +++ b/sdk/openbr_plugin.cpp @@ -130,10 +130,17 @@ void File::set(const QString &key, const QVariant &value) { if (key == "Label") { bool ok = false; - if (value.canConvert(QVariant::Double)) + const QString valueString = value.toString(); + + /* We assume that if the value starts with '0' + then it was probably intended to to be a string UID + and that it's numerical value is not relevant. */ + if (value.canConvert(QVariant::Double) && + (!valueString.startsWith('0') || (valueString == "0"))) value.toFloat(&ok); - if (!ok && !Globals->classes.contains(value.toString())) - Globals->classes.insert(value.toString(), Globals->classes.size()); + + if (!ok && !Globals->classes.contains(valueString)) + Globals->classes.insert(valueString, Globals->classes.size()); } m_metadata.insert(key, value); -- libgit2 0.21.4