glom r1742 - in trunk: . glom/libglom/data_structure
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1742 - in trunk: . glom/libglom/data_structure
- Date: Mon, 24 Nov 2008 09:43:19 +0000 (UTC)
Author: murrayc
Date: Mon Nov 24 09:43:19 2008
New Revision: 1742
URL: http://svn.gnome.org/viewvc/glom?rev=1742&view=rev
Log:
2008-11-24 Murray Cumming <murrayc murrayc com>
* glom/libglom/data_structure/glomconversions.cc
get_text_for_gda_value: Add a more specific warning when getting a
text representation for a boolean, as done by the import dialog, though
it should not really. Return translated true/false strings in that case.
Modified:
trunk/ChangeLog
trunk/glom/libglom/data_structure/glomconversions.cc
Modified: trunk/glom/libglom/data_structure/glomconversions.cc
==============================================================================
--- trunk/glom/libglom/data_structure/glomconversions.cc (original)
+++ trunk/glom/libglom/data_structure/glomconversions.cc Mon Nov 24 09:43:19 2008
@@ -382,11 +382,11 @@
return text; //Do something like Glib::locale_to_utf(), but with the specified locale instead of the current locale.
}
- else if (glom_type == Field::TYPE_TEXT)
+ else if(glom_type == Field::TYPE_TEXT)
{
return value.get_string();
}
- else if (glom_type == Field::TYPE_IMAGE)
+ else if(glom_type == Field::TYPE_IMAGE)
{
//Return the binary-as-escaped-text format, suitable for use in the document.
std::string result;
@@ -397,6 +397,22 @@
return result;
}
+ else if(glom_type == Field::TYPE_BOOLEAN)
+ {
+ const bool val = value.get_boolean();
+
+ //Careful: Text representations for booleans should generally not be used.
+ //TODO: This is currently used by the import dialog. That should really use a checkbox instead.
+ if(iso_format)
+ return (val ? "TRUE" : "FALSE");
+ else
+ {
+ std::cerr << "Warning: Conversions::get_text_for_gda_value(): Generating a text representation of a boolean. A checkbox should be used instead." << std::endl;
+
+ //TODO: Not only should we not use these in the UI, but we are ignoring the specified locale for this function:
+ return (val ? _("True") : _("False"));
+ }
+ }
else
{
std::cerr << "Conversions::get_text_for_gda_value(): Unexpected glom field type: " << glom_type << std::endl;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]