-rw-r--r-- | libopie/pim/test/converter.cpp | 36 | ||||
-rw-r--r-- | libopie/pim/test/converter_base.ui | 233 |
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 +1,6 @@ +#include "converter.h" + +#include <qdatetime.h> +#include <qprogressbar.h> + #include <qpe/qpeapplication.h> @@ -6,17 +11,6 @@ -#include "converter_base.h" - -class ConvertXMLToSQL: public converter_base { -public: - ConvertXMLToSQL() - { - convertContact(); - } -private: - void convertContact(); - -}; - +Converter::Converter(){ +} -void ConvertXMLToSQL::convertContact(){ +void Converter::start_conversion(){ qWarning("Converting Contacts from XML to SQL.."); @@ -36,2 +30,5 @@ void ConvertXMLToSQL::convertContact(){ + QTime t; + t.start(); + // Clean the sql-database.. @@ -41,6 +38,10 @@ void ConvertXMLToSQL::convertContact(){ OContactAccess::List contactList = xmlAccess->allRecords(); + m_progressBar->setTotalSteps( contactList.count() ); + int count = 0; if ( sqlAccess && xmlAccess ){ OContactAccess::List::Iterator it; - for ( it = contactList.begin(); it != contactList.end(); ++it ) + for ( it = contactList.begin(); it != contactList.end(); ++it ){ sqlAccess->add( *it ); + m_progressBar->setProgress( ++count ); + } } @@ -49,2 +50,5 @@ void ConvertXMLToSQL::convertContact(){ delete sqlAccess; + + qWarning("Conversion is finished and needed %d ms !", t.elapsed()); + delete xmlAccess; @@ -56,3 +60,3 @@ int main( int argc, char** argv ) { - ConvertXMLToSQL dlg; + Converter 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 @@ -13,4 +13,4 @@ <y>0</y> - <width>579</width> - <height>211</height> + <width>273</width> + <height>324</height> </rect> @@ -19,25 +19,220 @@ <name>caption</name> - <string>Form2</string> + <string>PIM-Database Converter</string> </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> - </property> + <property> + <name>layoutMargin</name> + </property> + <grid> <property stdset="1"> - <name>geometry</name> - <rect> - <x>340</x> - <y>40</y> - <width>210</width> - <height>20</height> - </rect> + <name>margin</name> + <number>4</number> </property> <property stdset="1"> - <name>text</name> - <string>Converter from XML->SQL</string> + <name>spacing</name> + <number>6</number> </property> - </widget> + <widget row="0" column="0" > + <class>QGroupBox</class> + <property stdset="1"> + <name>name</name> + <cstring>GroupBox6</cstring> + </property> + <property stdset="1"> + <name>title</name> + <string>Converter</string> + </property> + <property> + <name>layoutMargin</name> + </property> + <property> + <name>layoutSpacing</name> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>4</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>4</number> + </property> + <widget> + <class>QGroupBox</class> + <property stdset="1"> + <name>name</name> + <cstring>GroupBox1</cstring> + </property> + <property stdset="1"> + <name>title</name> + <string>Select Database:</string> + </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>11</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget row="0" column="1" > + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string>Addressbook</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>TodoList</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>ComboBox1</cstring> + </property> + </widget> + </grid> + </widget> + <widget> + <class>QGroupBox</class> + <property stdset="1"> + <name>name</name> + <cstring>GroupBox2</cstring> + </property> + <property stdset="1"> + <name>title</name> + <string>Source/Destination:</string> + </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>11</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget row="1" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel3_2</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>to</string> + </property> + </widget> + <widget row="1" column="1" > + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string>Select</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>XML</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>SQL (SQLite)</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>ComboBox2_3</cstring> + </property> + </widget> + <widget row="0" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel2_2</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Convert from</string> + </property> + </widget> + <widget row="0" column="1" > + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string>XML</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>SQL (SQLite)</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>ComboBox2_2_2</cstring> + </property> + </widget> + </grid> + </widget> + <widget> + <class>QGroupBox</class> + <property stdset="1"> + <name>name</name> + <cstring>GroupBox4</cstring> + </property> + <property stdset="1"> + <name>title</name> + <string>Progress:</string> + </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>11</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget row="0" column="0" > + <class>QProgressBar</class> + <property stdset="1"> + <name>name</name> + <cstring>m_progressBar</cstring> + </property> + </widget> + </grid> + </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>PushButton1</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Go!</string> + </property> + </widget> + </vbox> + </widget> + </grid> </widget> +<connections> + <connection> + <sender>PushButton1</sender> + <signal>clicked()</signal> + <receiver>converter_base</receiver> + <slot>start_conversion()</slot> + </connection> + <slot access="public">start_conversion()</slot> +</connections> </UI> |