summaryrefslogtreecommitdiff
path: root/libopie/pim
Side-by-side diff
Diffstat (limited to 'libopie/pim') (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 @@
+#include "converter.h"
+
+#include <qdatetime.h>
+#include <qprogressbar.h>
+
#include <qpe/qpeapplication.h>
@@ -5,19 +10,8 @@
#include <opie/ocontactaccessbackend_sql.h>
-#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..");
@@ -35,4 +29,7 @@ void ConvertXMLToSQL::convertContact(){
QString::null , sqlBackend, true );
+ QTime t;
+ t.start();
+
// Clean the sql-database..
sqlAccess->clear();
@@ -40,12 +37,19 @@ void ConvertXMLToSQL::convertContact(){
// Now trasmit every contact from the xml database to the sql-database
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 );
+ }
}
// Delete the frontends. Backends will be deleted automatically, too !
delete sqlAccess;
+
+ qWarning("Conversion is finished and needed %d ms !", t.elapsed());
+
delete xmlAccess;
}
@@ -55,5 +59,5 @@ int main( int argc, char** argv ) {
QPEApplication a( argc, argv );
- ConvertXMLToSQL dlg;
+ Converter dlg;
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 @@
<x>0</x>
<y>0</y>
- <width>579</width>
- <height>211</height>
+ <width>273</width>
+ <height>324</height>
</rect>
</property>
<property stdset="1">
<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-&gt;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>