summaryrefslogtreecommitdiff
path: root/libopie
Unidiff
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/test/converter.cpp36
-rw-r--r--libopie/pim/test/converter_base.ui233
2 files changed, 234 insertions, 35 deletions
diff --git a/libopie/pim/test/converter.cpp b/libopie/pim/test/converter.cpp
index 0a488f2..650d119 100644
--- a/libopie/pim/test/converter.cpp
+++ b/libopie/pim/test/converter.cpp
@@ -1,2 +1,7 @@
1#include "converter.h"
2
3#include <qdatetime.h>
4#include <qprogressbar.h>
5
1#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
2 7
@@ -5,19 +10,8 @@
5#include <opie/ocontactaccessbackend_sql.h> 10#include <opie/ocontactaccessbackend_sql.h>
6 11
7#include "converter_base.h" 12Converter::Converter(){
8 13}
9class ConvertXMLToSQL: public converter_base {
10public:
11 ConvertXMLToSQL()
12 {
13 convertContact();
14 }
15private:
16 void convertContact();
17
18};
19
20 14
21void ConvertXMLToSQL::convertContact(){ 15void Converter::start_conversion(){
22 qWarning("Converting Contacts from XML to SQL.."); 16 qWarning("Converting Contacts from XML to SQL..");
23 17
@@ -35,4 +29,7 @@ void ConvertXMLToSQL::convertContact(){
35 QString::null , sqlBackend, true ); 29 QString::null , sqlBackend, true );
36 30
31 QTime t;
32 t.start();
33
37 // Clean the sql-database.. 34 // Clean the sql-database..
38 sqlAccess->clear(); 35 sqlAccess->clear();
@@ -40,12 +37,19 @@ void ConvertXMLToSQL::convertContact(){
40 // Now trasmit every contact from the xml database to the sql-database 37 // Now trasmit every contact from the xml database to the sql-database
41 OContactAccess::List contactList = xmlAccess->allRecords(); 38 OContactAccess::List contactList = xmlAccess->allRecords();
39 m_progressBar->setTotalSteps( contactList.count() );
40 int count = 0;
42 if ( sqlAccess && xmlAccess ){ 41 if ( sqlAccess && xmlAccess ){
43 OContactAccess::List::Iterator it; 42 OContactAccess::List::Iterator it;
44 for ( it = contactList.begin(); it != contactList.end(); ++it ) 43 for ( it = contactList.begin(); it != contactList.end(); ++it ){
45 sqlAccess->add( *it ); 44 sqlAccess->add( *it );
45 m_progressBar->setProgress( ++count );
46 }
46 } 47 }
47 48
48 // Delete the frontends. Backends will be deleted automatically, too ! 49 // Delete the frontends. Backends will be deleted automatically, too !
49 delete sqlAccess; 50 delete sqlAccess;
51
52 qWarning("Conversion is finished and needed %d ms !", t.elapsed());
53
50 delete xmlAccess; 54 delete xmlAccess;
51} 55}
@@ -55,5 +59,5 @@ int main( int argc, char** argv ) {
55 QPEApplication a( argc, argv ); 59 QPEApplication a( argc, argv );
56 60
57 ConvertXMLToSQL dlg; 61 Converter dlg;
58 62
59 a.showMainWidget( &dlg ); 63 a.showMainWidget( &dlg );
diff --git a/libopie/pim/test/converter_base.ui b/libopie/pim/test/converter_base.ui
index f680550..e9bf636 100644
--- a/libopie/pim/test/converter_base.ui
+++ b/libopie/pim/test/converter_base.ui
@@ -12,32 +12,227 @@
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>579</width> 14 <width>273</width>
15 <height>211</height> 15 <height>324</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Form2</string> 20 <string>PIM-Database Converter</string>
21 </property> 21 </property>
22 <widget> 22 <property>
23 <class>QLabel</class> 23 <name>layoutMargin</name>
24 <property stdset="1"> 24 </property>
25 <name>name</name> 25 <grid>
26 <cstring>TextLabel1</cstring>
27 </property>
28 <property stdset="1"> 26 <property stdset="1">
29 <name>geometry</name> 27 <name>margin</name>
30 <rect> 28 <number>4</number>
31 <x>340</x>
32 <y>40</y>
33 <width>210</width>
34 <height>20</height>
35 </rect>
36 </property> 29 </property>
37 <property stdset="1"> 30 <property stdset="1">
38 <name>text</name> 31 <name>spacing</name>
39 <string>Converter from XML-&gt;SQL</string> 32 <number>6</number>
40 </property> 33 </property>
41 </widget> 34 <widget row="0" column="0" >
35 <class>QGroupBox</class>
36 <property stdset="1">
37 <name>name</name>
38 <cstring>GroupBox6</cstring>
39 </property>
40 <property stdset="1">
41 <name>title</name>
42 <string>Converter</string>
43 </property>
44 <property>
45 <name>layoutMargin</name>
46 </property>
47 <property>
48 <name>layoutSpacing</name>
49 </property>
50 <vbox>
51 <property stdset="1">
52 <name>margin</name>
53 <number>4</number>
54 </property>
55 <property stdset="1">
56 <name>spacing</name>
57 <number>4</number>
58 </property>
59 <widget>
60 <class>QGroupBox</class>
61 <property stdset="1">
62 <name>name</name>
63 <cstring>GroupBox1</cstring>
64 </property>
65 <property stdset="1">
66 <name>title</name>
67 <string>Select Database:</string>
68 </property>
69 <grid>
70 <property stdset="1">
71 <name>margin</name>
72 <number>11</number>
73 </property>
74 <property stdset="1">
75 <name>spacing</name>
76 <number>6</number>
77 </property>
78 <widget row="0" column="1" >
79 <class>QComboBox</class>
80 <item>
81 <property>
82 <name>text</name>
83 <string>Addressbook</string>
84 </property>
85 </item>
86 <item>
87 <property>
88 <name>text</name>
89 <string>TodoList</string>
90 </property>
91 </item>
92 <property stdset="1">
93 <name>name</name>
94 <cstring>ComboBox1</cstring>
95 </property>
96 </widget>
97 </grid>
98 </widget>
99 <widget>
100 <class>QGroupBox</class>
101 <property stdset="1">
102 <name>name</name>
103 <cstring>GroupBox2</cstring>
104 </property>
105 <property stdset="1">
106 <name>title</name>
107 <string>Source/Destination:</string>
108 </property>
109 <grid>
110 <property stdset="1">
111 <name>margin</name>
112 <number>11</number>
113 </property>
114 <property stdset="1">
115 <name>spacing</name>
116 <number>6</number>
117 </property>
118 <widget row="1" column="0" >
119 <class>QLabel</class>
120 <property stdset="1">
121 <name>name</name>
122 <cstring>TextLabel3_2</cstring>
123 </property>
124 <property stdset="1">
125 <name>text</name>
126 <string>to</string>
127 </property>
128 </widget>
129 <widget row="1" column="1" >
130 <class>QComboBox</class>
131 <item>
132 <property>
133 <name>text</name>
134 <string>Select</string>
135 </property>
136 </item>
137 <item>
138 <property>
139 <name>text</name>
140 <string>XML</string>
141 </property>
142 </item>
143 <item>
144 <property>
145 <name>text</name>
146 <string>SQL (SQLite)</string>
147 </property>
148 </item>
149 <property stdset="1">
150 <name>name</name>
151 <cstring>ComboBox2_3</cstring>
152 </property>
153 </widget>
154 <widget row="0" column="0" >
155 <class>QLabel</class>
156 <property stdset="1">
157 <name>name</name>
158 <cstring>TextLabel2_2</cstring>
159 </property>
160 <property stdset="1">
161 <name>text</name>
162 <string>Convert from</string>
163 </property>
164 </widget>
165 <widget row="0" column="1" >
166 <class>QComboBox</class>
167 <item>
168 <property>
169 <name>text</name>
170 <string>XML</string>
171 </property>
172 </item>
173 <item>
174 <property>
175 <name>text</name>
176 <string>SQL (SQLite)</string>
177 </property>
178 </item>
179 <property stdset="1">
180 <name>name</name>
181 <cstring>ComboBox2_2_2</cstring>
182 </property>
183 </widget>
184 </grid>
185 </widget>
186 <widget>
187 <class>QGroupBox</class>
188 <property stdset="1">
189 <name>name</name>
190 <cstring>GroupBox4</cstring>
191 </property>
192 <property stdset="1">
193 <name>title</name>
194 <string>Progress:</string>
195 </property>
196 <grid>
197 <property stdset="1">
198 <name>margin</name>
199 <number>11</number>
200 </property>
201 <property stdset="1">
202 <name>spacing</name>
203 <number>6</number>
204 </property>
205 <widget row="0" column="0" >
206 <class>QProgressBar</class>
207 <property stdset="1">
208 <name>name</name>
209 <cstring>m_progressBar</cstring>
210 </property>
211 </widget>
212 </grid>
213 </widget>
214 <widget>
215 <class>QPushButton</class>
216 <property stdset="1">
217 <name>name</name>
218 <cstring>PushButton1</cstring>
219 </property>
220 <property stdset="1">
221 <name>text</name>
222 <string>Go!</string>
223 </property>
224 </widget>
225 </vbox>
226 </widget>
227 </grid>
42</widget> 228</widget>
229<connections>
230 <connection>
231 <sender>PushButton1</sender>
232 <signal>clicked()</signal>
233 <receiver>converter_base</receiver>
234 <slot>start_conversion()</slot>
235 </connection>
236 <slot access="public">start_conversion()</slot>
237</connections>
43</UI> 238</UI>