Diffstat (limited to 'noncore/apps/tableviewer/db/xmlsource.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/tableviewer/db/xmlsource.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/noncore/apps/tableviewer/db/xmlsource.cpp b/noncore/apps/tableviewer/db/xmlsource.cpp index 7418a85..94fec36 100644 --- a/noncore/apps/tableviewer/db/xmlsource.cpp +++ b/noncore/apps/tableviewer/db/xmlsource.cpp | |||
@@ -12,24 +12,26 @@ | |||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "xmlsource.h" | 20 | #include "xmlsource.h" |
21 | #include <qdict.h> | 21 | #include <qdict.h> |
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <qtextstream.h> | 23 | #include <qtextstream.h> |
24 | #include "../xmlencodeattr.h" | ||
25 | |||
24 | 26 | ||
25 | 27 | ||
26 | DBXml::DBXml(DBStore *d) | 28 | DBXml::DBXml(DBStore *d) |
27 | { | 29 | { |
28 | dstore = d; | 30 | dstore = d; |
29 | } | 31 | } |
30 | 32 | ||
31 | QString DBXml::type() | 33 | QString DBXml::type() |
32 | { | 34 | { |
33 | return "xml"; | 35 | return "xml"; |
34 | } | 36 | } |
35 | 37 | ||
@@ -59,25 +61,25 @@ bool DBXml::saveSource(QIODevice *outDev) | |||
59 | 61 | ||
60 | outstream << "<database name=\"" << dstore->getName() << "\">" << endl; | 62 | outstream << "<database name=\"" << dstore->getName() << "\">" << endl; |
61 | outstream << "<header>" << endl; | 63 | outstream << "<header>" << endl; |
62 | 64 | ||
63 | k = dstore->getKeys(); | 65 | k = dstore->getKeys(); |
64 | KeyListIterator it(*k); | 66 | KeyListIterator it(*k); |
65 | while(it.current()) { | 67 | while(it.current()) { |
66 | if (!it.current()->delFlag()) { | 68 | if (!it.current()->delFlag()) { |
67 | outstream << "<key name=\"KEYID" << it.currentKey() << "\" "; | 69 | outstream << "<key name=\"KEYID" << it.currentKey() << "\" "; |
68 | outstream << "type=\"" | 70 | outstream << "type=\"" |
69 | << TVVariant::typeToName(it.current()->type()) | 71 | << TVVariant::typeToName(it.current()->type()) |
70 | << "\">"; | 72 | << "\">"; |
71 | outstream << it.current()->name() << "</key>" << endl; | 73 | outstream << encodeAttr(it.current()->name()) << "</key>" << endl; |
72 | } | 74 | } |
73 | ++it; | 75 | ++it; |
74 | } | 76 | } |
75 | 77 | ||
76 | outstream << "</header>" << endl; | 78 | outstream << "</header>" << endl; |
77 | 79 | ||
78 | dstore->first(); | 80 | dstore->first(); |
79 | 81 | ||
80 | do { | 82 | do { |
81 | elem = dstore->getCurrentData(); | 83 | elem = dstore->getCurrentData(); |
82 | if (!elem) | 84 | if (!elem) |
83 | break; | 85 | break; |
@@ -85,25 +87,25 @@ bool DBXml::saveSource(QIODevice *outDev) | |||
85 | it.toFirst(); | 87 | it.toFirst(); |
86 | while (it.current()) { | 88 | while (it.current()) { |
87 | i = it.currentKey(); | 89 | i = it.currentKey(); |
88 | if (elem->hasValidValue(i)) { | 90 | if (elem->hasValidValue(i)) { |
89 | outstream << "<KEYID" << i << ">"; | 91 | outstream << "<KEYID" << i << ">"; |
90 | if (dstore->getKeyType(i) == TVVariant::Date) { | 92 | if (dstore->getKeyType(i) == TVVariant::Date) { |
91 | // dates in files are different from displayed dates | 93 | // dates in files are different from displayed dates |
92 | QDate date = elem->getField(i).toDate(); | 94 | QDate date = elem->getField(i).toDate(); |
93 | outstream << date.day() << "/" | 95 | outstream << date.day() << "/" |
94 | << date.month() << "/" | 96 | << date.month() << "/" |
95 | << date.year(); | 97 | << date.year(); |
96 | } else { | 98 | } else { |
97 | outstream << elem->toQString(i); | 99 | outstream << encodeAttr(elem->toQString(i)); |
98 | } | 100 | } |
99 | outstream << "</KEYID" << i << ">" << endl; | 101 | outstream << "</KEYID" << i << ">" << endl; |
100 | } | 102 | } |
101 | ++it; | 103 | ++it; |
102 | } | 104 | } |
103 | outstream << "</record>" << endl; | 105 | outstream << "</record>" << endl; |
104 | } while(dstore->next()); | 106 | } while(dstore->next()); |
105 | 107 | ||
106 | outstream << "</database>" << endl; | 108 | outstream << "</database>" << endl; |
107 | return TRUE; | 109 | return TRUE; |
108 | } | 110 | } |
109 | 111 | ||