-rw-r--r-- | noncore/tools/pimconverter/converter.cpp | 29 | ||||
-rwxr-xr-x | noncore/tools/pimconverter/converter.h | 3 | ||||
-rw-r--r-- | noncore/tools/pimconverter/converter.pro | 5 | ||||
-rw-r--r-- | noncore/tools/pimconverter/converter_base.ui | 2 |
4 files changed, 13 insertions, 26 deletions
diff --git a/noncore/tools/pimconverter/converter.cpp b/noncore/tools/pimconverter/converter.cpp index ded59b6..e9de3c3 100644 --- a/noncore/tools/pimconverter/converter.cpp +++ b/noncore/tools/pimconverter/converter.cpp | |||
@@ -1,35 +1,37 @@ | |||
1 | #include "converter.h" | 1 | #include "converter.h" |
2 | 2 | ||
3 | /* OPIE */ | 3 | /* OPIE */ |
4 | #include <qpe/qpeapplication.h> | 4 | #include <opie2/oapplicationfactory.h> |
5 | |||
6 | #include <opie2/odebug.h> | 5 | #include <opie2/odebug.h> |
7 | #include <opie2/opimglobal.h> | 6 | #include <opie2/opimglobal.h> |
8 | // Include SQL related header files | 7 | // Include SQL related header files |
9 | #define __USE_SQL | 8 | #define __USE_SQL |
10 | #include <opie2/opimaccessfactory.h> | 9 | #include <opie2/opimaccessfactory.h> |
11 | 10 | ||
12 | /* QT */ | 11 | /* QT */ |
13 | #include <qdatetime.h> | 12 | #include <qdatetime.h> |
14 | #include <qprogressbar.h> | 13 | #include <qprogressbar.h> |
15 | #include <qcombobox.h> | 14 | #include <qcombobox.h> |
16 | #include <qcheckbox.h> | 15 | #include <qcheckbox.h> |
17 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
18 | 17 | ||
19 | 18 | ||
19 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<Converter> ) | ||
20 | |||
20 | using namespace Opie; | 21 | using namespace Opie; |
21 | using namespace Pim; | 22 | using namespace Pim; |
22 | 23 | ||
23 | Converter::Converter(): | 24 | Converter::Converter(QWidget *p, const char* n, WFlags fl): |
25 | converter_base( p, n, fl ), | ||
24 | m_selectedDatabase( ADDRESSBOOK ), | 26 | m_selectedDatabase( ADDRESSBOOK ), |
25 | m_selectedSourceFormat( XML ), | 27 | m_selectedSourceFormat( XML ), |
26 | m_selectedDestFormat( SQL ), | 28 | m_selectedDestFormat( SQL ), |
27 | m_criticalState( false ) | 29 | m_criticalState( false ) |
28 | { | 30 | { |
29 | m_dataBaseSelector -> setCurrentItem( m_selectedDatabase ); | 31 | m_dataBaseSelector -> setCurrentItem( m_selectedDatabase ); |
30 | m_sourceFormatSelector -> setCurrentItem( m_selectedSourceFormat ); | 32 | m_sourceFormatSelector -> setCurrentItem( m_selectedSourceFormat ); |
31 | m_destFormatSelector -> setCurrentItem( m_selectedDestFormat ); | 33 | m_destFormatSelector -> setCurrentItem( m_selectedDestFormat ); |
32 | m_eraseDB -> setChecked( true ); // Default erase on copy | 34 | m_eraseDB -> setChecked( true ); // Default erase on copy |
33 | } | 35 | } |
34 | 36 | ||
35 | void Converter::selectedDatabase( int num ) | 37 | void Converter::selectedDatabase( int num ) |
@@ -47,29 +49,29 @@ void Converter::selectedSourceFormat( int num ) | |||
47 | m_selectedSourceFormat = num; | 49 | m_selectedSourceFormat = num; |
48 | } | 50 | } |
49 | 51 | ||
50 | void Converter::start_conversion(){ | 52 | void Converter::start_conversion(){ |
51 | 53 | ||
52 | // Creating backends to the requested databases.. | 54 | // Creating backends to the requested databases.. |
53 | OPimBase* sourceDB; | 55 | OPimBase* sourceDB; |
54 | OPimBase* destDB; | 56 | OPimBase* destDB; |
55 | 57 | ||
56 | odebug << "SourceFormat: " << m_selectedSourceFormat << oendl; | 58 | odebug << "SourceFormat: " << m_selectedSourceFormat << oendl; |
57 | odebug << "DestFormat: " << m_selectedDestFormat << oendl; | 59 | odebug << "DestFormat: " << m_selectedDestFormat << oendl; |
58 | if ( m_selectedSourceFormat == m_selectedDestFormat ){ | 60 | if ( m_selectedSourceFormat == m_selectedDestFormat ){ |
59 | 61 | ||
60 | QMessageBox::warning( this, "PimConverter", | 62 | QMessageBox::warning( this, "PimConverter", |
61 | tr( "It is not a good idea to use\n" ) | 63 | tr( "It is not a good idea to use\n" ) |
62 | +tr( "the same source and destformat !" ), | 64 | +tr( "the same source and destformat !" ), |
63 | tr( "Ok" ) ); | 65 | tr( "Ok" ) ); |
64 | return; | 66 | return; |
65 | } | 67 | } |
66 | 68 | ||
67 | switch( m_selectedSourceFormat ){ | 69 | switch( m_selectedSourceFormat ){ |
68 | case XML: | 70 | case XML: |
69 | odebug << "XMLSourceDB = " << m_selectedDatabase << "" << oendl; | 71 | odebug << "XMLSourceDB = " << m_selectedDatabase << "" << oendl; |
70 | switch( m_selectedDatabase ){ | 72 | switch( m_selectedDatabase ){ |
71 | case ADDRESSBOOK:{ | 73 | case ADDRESSBOOK:{ |
72 | sourceDB = OPimAccessFactory<OPimContactAccess>::create( OPimGlobal::CONTACTLIST, OPimGlobal::XML, "converter" ); | 74 | sourceDB = OPimAccessFactory<OPimContactAccess>::create( OPimGlobal::CONTACTLIST, OPimGlobal::XML, "converter" ); |
73 | } | 75 | } |
74 | break; | 76 | break; |
75 | case TODOLIST:{ | 77 | case TODOLIST:{ |
@@ -203,37 +205,22 @@ void Converter::start_conversion(){ | |||
203 | break; | 205 | break; |
204 | default: | 206 | default: |
205 | owarn << "Unknown database selected (" << m_selectedDatabase << ")" << oendl; | 207 | owarn << "Unknown database selected (" << m_selectedDatabase << ")" << oendl; |
206 | return; | 208 | return; |
207 | } | 209 | } |
208 | 210 | ||
209 | 211 | ||
210 | owarn << "Conversion is finished and needed " << t.elapsed() << " ms !" << oendl; | 212 | owarn << "Conversion is finished and needed " << t.elapsed() << " ms !" << oendl; |
211 | } | 213 | } |
212 | 214 | ||
213 | void Converter::closeEvent( QCloseEvent *e ) | 215 | void Converter::closeEvent( QCloseEvent *e ) |
214 | { | 216 | { |
215 | 217 | ||
216 | /* Due to the fact that we don't have multitasking here, this | 218 | /* Due to the fact that we don't have multitasking here, this |
217 | * critical handling don't make sense, but the future.. | 219 | * critical handling don't make sense, but the future.. |
218 | */ | 220 | */ |
219 | if ( m_criticalState ){ | 221 | if ( m_criticalState ){ |
220 | e->ignore(); | 222 | e->ignore(); |
221 | return; | 223 | return; |
222 | } | 224 | } |
223 | e->accept(); | 225 | e->accept(); |
224 | } | 226 | } |
225 | |||
226 | |||
227 | |||
228 | int main( int argc, char** argv ) { | ||
229 | |||
230 | QPEApplication a( argc, argv ); | ||
231 | |||
232 | Converter dlg; | ||
233 | |||
234 | a.showMainWidget( &dlg ); | ||
235 | // dlg. showMaximized ( ); | ||
236 | |||
237 | return a.exec(); | ||
238 | |||
239 | } | ||
diff --git a/noncore/tools/pimconverter/converter.h b/noncore/tools/pimconverter/converter.h index a78c6bc..344562a 100755 --- a/noncore/tools/pimconverter/converter.h +++ b/noncore/tools/pimconverter/converter.h | |||
@@ -1,22 +1,23 @@ | |||
1 | #ifndef _CONVERTER_H_ | 1 | #ifndef _CONVERTER_H_ |
2 | #define _CONVERTER_H_ | 2 | #define _CONVERTER_H_ |
3 | 3 | ||
4 | 4 | ||
5 | #include "converter_base.h" | 5 | #include "converter_base.h" |
6 | 6 | ||
7 | 7 | ||
8 | class Converter: public converter_base { | 8 | class Converter: public converter_base { |
9 | public: | 9 | public: |
10 | Converter(); | 10 | Converter(QWidget *parent, const char* name, WFlags fl); |
11 | static QString appName() { return QString::fromLatin1("opimconverter");} | ||
11 | 12 | ||
12 | // Slots defined in the ui-description file | 13 | // Slots defined in the ui-description file |
13 | void start_conversion(); | 14 | void start_conversion(); |
14 | void selectedDatabase( int num ); | 15 | void selectedDatabase( int num ); |
15 | void selectedDestFormat( int num ); | 16 | void selectedDestFormat( int num ); |
16 | void selectedSourceFormat( int num ); | 17 | void selectedSourceFormat( int num ); |
17 | 18 | ||
18 | void closeEvent( QCloseEvent *e ); | 19 | void closeEvent( QCloseEvent *e ); |
19 | 20 | ||
20 | private: | 21 | private: |
21 | // Caution: | 22 | // Caution: |
22 | // The order and value of the following enums must be regarding | 23 | // The order and value of the following enums must be regarding |
diff --git a/noncore/tools/pimconverter/converter.pro b/noncore/tools/pimconverter/converter.pro index 0504a55..4677ee6 100644 --- a/noncore/tools/pimconverter/converter.pro +++ b/noncore/tools/pimconverter/converter.pro | |||
@@ -1,11 +1,10 @@ | |||
1 | CONFIG = qt warn_on debug | 1 | CONFIG = qt quick-app |
2 | # CONFIG = qt warn_on release quick-app | ||
3 | HEADERS = converter.h | 2 | HEADERS = converter.h |
4 | SOURCES = converter.cpp | 3 | SOURCES = converter.cpp |
5 | INTERFACES = converter_base.ui | 4 | INTERFACES = converter_base.ui |
6 | INCLUDEPATH+= $(OPIEDIR)/include | 5 | INCLUDEPATH+= $(OPIEDIR)/include |
7 | DEPENDPATH+= $(OPIEDIR)/include | 6 | DEPENDPATH+= $(OPIEDIR)/include |
8 | LIBS += -lqpe -lopiecore2 -lopiepim2 -lopiedb2 | 7 | LIBS += -lqpe -lopiecore2 -lopiepim2 -lopiedb2 |
9 | TARGET = $(OPIEDIR)/bin/opimconverter | 8 | TARGET = opimconverter |
10 | 9 | ||
11 | include ( $(OPIEDIR)/include.pro ) | 10 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/tools/pimconverter/converter_base.ui b/noncore/tools/pimconverter/converter_base.ui index c7a2fb5..a5b22c9 100644 --- a/noncore/tools/pimconverter/converter_base.ui +++ b/noncore/tools/pimconverter/converter_base.ui | |||
@@ -1,16 +1,16 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>converter_base</class> | 2 | <class>converter_base</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>converter_base</cstring> | 7 | <cstring>converter_base</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>269</width> | 14 | <width>269</width> |
15 | <height>324</height> | 15 | <height>324</height> |
16 | </rect> | 16 | </rect> |