From b2e22408970ef548e23e9bbdcd87302f35fc6d4d Mon Sep 17 00:00:00 2001 From: eilers Date: Mon, 29 Sep 2003 07:41:45 +0000 Subject: Starting to develop a universal PIM-database converter --- (limited to 'libopie/pim/test') 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,24 +1,18 @@ +#include "converter.h" + +#include +#include + #include #include #include #include -#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.."); // Creating backends to the requested databases.. @@ -34,19 +28,29 @@ void ConvertXMLToSQL::convertContact(){ OContactAccess* sqlAccess = new OContactAccess ( "addressbook_sql", QString::null , sqlBackend, true ); + QTime t; + t.start(); + // Clean the sql-database.. sqlAccess->clear(); // 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; } @@ -54,7 +58,7 @@ int main( int argc, char** argv ) { QPEApplication a( argc, argv ); - ConvertXMLToSQL dlg; + Converter dlg; a.showMainWidget( &dlg ); // dlg. showMaximized ( ); 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 @@ -11,33 +11,228 @@ 0 0 - 579 - 211 + 273 + 324 caption - Form2 + PIM-Database Converter - - QLabel - - name - TextLabel1 - + + layoutMargin + + - geometry - - 340 - 40 - 210 - 20 - + margin + 4 - text - Converter from XML->SQL + spacing + 6 - + + QGroupBox + + name + GroupBox6 + + + title + Converter + + + layoutMargin + + + layoutSpacing + + + + margin + 4 + + + spacing + 4 + + + QGroupBox + + name + GroupBox1 + + + title + Select Database: + + + + margin + 11 + + + spacing + 6 + + + QComboBox + + + text + Addressbook + + + + + text + TodoList + + + + name + ComboBox1 + + + + + + QGroupBox + + name + GroupBox2 + + + title + Source/Destination: + + + + margin + 11 + + + spacing + 6 + + + QLabel + + name + TextLabel3_2 + + + text + to + + + + QComboBox + + + text + Select + + + + + text + XML + + + + + text + SQL (SQLite) + + + + name + ComboBox2_3 + + + + QLabel + + name + TextLabel2_2 + + + text + Convert from + + + + QComboBox + + + text + XML + + + + + text + SQL (SQLite) + + + + name + ComboBox2_2_2 + + + + + + QGroupBox + + name + GroupBox4 + + + title + Progress: + + + + margin + 11 + + + spacing + 6 + + + QProgressBar + + name + m_progressBar + + + + + + QPushButton + + name + PushButton1 + + + text + Go! + + + + + + + + PushButton1 + clicked() + converter_base + start_conversion() + + start_conversion() + -- cgit v0.9.0.2