author | eilers <eilers> | 2004-07-18 14:37:20 (UTC) |
---|---|---|
committer | eilers <eilers> | 2004-07-18 14:37:20 (UTC) |
commit | 30775961a5c33d4721395eb07d11c4fcc142ce96 (patch) (unidiff) | |
tree | 99858db337e64689f31b0099c48a26a41e1fc136 | |
parent | f37561246bc7d8bf4cf791ce156afdf098552dca (diff) | |
download | opie-30775961a5c33d4721395eb07d11c4fcc142ce96.zip opie-30775961a5c33d4721395eb07d11c4fcc142ce96.tar.gz opie-30775961a5c33d4721395eb07d11c4fcc142ce96.tar.bz2 |
Fixed bugreport #1370 and
added check, whether source and destdatabase is the same..
-rw-r--r-- | noncore/tools/pimconverter/converter.cpp | 34 | ||||
-rwxr-xr-x | noncore/tools/pimconverter/converter.h | 3 |
2 files changed, 36 insertions, 1 deletions
diff --git a/noncore/tools/pimconverter/converter.cpp b/noncore/tools/pimconverter/converter.cpp index 7d34b24..ded59b6 100644 --- a/noncore/tools/pimconverter/converter.cpp +++ b/noncore/tools/pimconverter/converter.cpp | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <qprogressbar.h> | 14 | #include <qprogressbar.h> |
15 | #include <qcombobox.h> | 15 | #include <qcombobox.h> |
16 | #include <qcheckbox.h> | 16 | #include <qcheckbox.h> |
17 | #include <qmessagebox.h> | ||
17 | 18 | ||
18 | 19 | ||
19 | using namespace Opie; | 20 | using namespace Opie; |
@@ -22,7 +23,8 @@ using namespace Pim; | |||
22 | Converter::Converter(): | 23 | Converter::Converter(): |
23 | m_selectedDatabase( ADDRESSBOOK ), | 24 | m_selectedDatabase( ADDRESSBOOK ), |
24 | m_selectedSourceFormat( XML ), | 25 | m_selectedSourceFormat( XML ), |
25 | m_selectedDestFormat( SQL ) | 26 | m_selectedDestFormat( SQL ), |
27 | m_criticalState( false ) | ||
26 | { | 28 | { |
27 | m_dataBaseSelector -> setCurrentItem( m_selectedDatabase ); | 29 | m_dataBaseSelector -> setCurrentItem( m_selectedDatabase ); |
28 | m_sourceFormatSelector -> setCurrentItem( m_selectedSourceFormat ); | 30 | m_sourceFormatSelector -> setCurrentItem( m_selectedSourceFormat ); |
@@ -51,6 +53,17 @@ void Converter::start_conversion(){ | |||
51 | OPimBase* sourceDB; | 53 | OPimBase* sourceDB; |
52 | OPimBase* destDB; | 54 | OPimBase* destDB; |
53 | 55 | ||
56 | odebug << "SourceFormat: " << m_selectedSourceFormat << oendl; | ||
57 | odebug << "DestFormat: " << m_selectedDestFormat << oendl; | ||
58 | if ( m_selectedSourceFormat == m_selectedDestFormat ){ | ||
59 | |||
60 | QMessageBox::warning( this, "PimConverter", | ||
61 | tr( "It is not a good idea to use\n" ) | ||
62 | +tr( "the same source and destformat !" ), | ||
63 | tr( "Ok" ) ); | ||
64 | return; | ||
65 | } | ||
66 | |||
54 | switch( m_selectedSourceFormat ){ | 67 | switch( m_selectedSourceFormat ){ |
55 | case XML: | 68 | case XML: |
56 | odebug << "XMLSourceDB = " << m_selectedDatabase << "" << oendl; | 69 | odebug << "XMLSourceDB = " << m_selectedDatabase << "" << oendl; |
@@ -142,6 +155,8 @@ void Converter::start_conversion(){ | |||
142 | if ( !sourceDB || !destDB ) | 155 | if ( !sourceDB || !destDB ) |
143 | return; | 156 | return; |
144 | 157 | ||
158 | m_criticalState = true; | ||
159 | |||
145 | sourceDB -> load(); | 160 | sourceDB -> load(); |
146 | destDB -> load(); | 161 | destDB -> load(); |
147 | 162 | ||
@@ -169,6 +184,8 @@ void Converter::start_conversion(){ | |||
169 | // Now commit data.. | 184 | // Now commit data.. |
170 | destDB -> save(); | 185 | destDB -> save(); |
171 | 186 | ||
187 | m_criticalState = false; | ||
188 | |||
172 | // Delete the frontends. Backends will be deleted automatically, too ! | 189 | // Delete the frontends. Backends will be deleted automatically, too ! |
173 | // We have to cast them back to delete them properly ! | 190 | // We have to cast them back to delete them properly ! |
174 | switch( m_selectedDatabase ){ | 191 | switch( m_selectedDatabase ){ |
@@ -193,6 +210,21 @@ void Converter::start_conversion(){ | |||
193 | owarn << "Conversion is finished and needed " << t.elapsed() << " ms !" << oendl; | 210 | owarn << "Conversion is finished and needed " << t.elapsed() << " ms !" << oendl; |
194 | } | 211 | } |
195 | 212 | ||
213 | void Converter::closeEvent( QCloseEvent *e ) | ||
214 | { | ||
215 | |||
216 | /* Due to the fact that we don't have multitasking here, this | ||
217 | * critical handling don't make sense, but the future.. | ||
218 | */ | ||
219 | if ( m_criticalState ){ | ||
220 | e->ignore(); | ||
221 | return; | ||
222 | } | ||
223 | e->accept(); | ||
224 | } | ||
225 | |||
226 | |||
227 | |||
196 | int main( int argc, char** argv ) { | 228 | int main( int argc, char** argv ) { |
197 | 229 | ||
198 | QPEApplication a( argc, argv ); | 230 | QPEApplication a( argc, argv ); |
diff --git a/noncore/tools/pimconverter/converter.h b/noncore/tools/pimconverter/converter.h index 27d7fb2..a78c6bc 100755 --- a/noncore/tools/pimconverter/converter.h +++ b/noncore/tools/pimconverter/converter.h | |||
@@ -15,6 +15,8 @@ public: | |||
15 | void selectedDestFormat( int num ); | 15 | void selectedDestFormat( int num ); |
16 | void selectedSourceFormat( int num ); | 16 | void selectedSourceFormat( int num ); |
17 | 17 | ||
18 | void closeEvent( QCloseEvent *e ); | ||
19 | |||
18 | private: | 20 | private: |
19 | // Caution: | 21 | // Caution: |
20 | // The order and value of the following enums must be regarding | 22 | // The order and value of the following enums must be regarding |
@@ -33,6 +35,7 @@ private: | |||
33 | int m_selectedDatabase; | 35 | int m_selectedDatabase; |
34 | int m_selectedSourceFormat; | 36 | int m_selectedSourceFormat; |
35 | int m_selectedDestFormat; | 37 | int m_selectedDestFormat; |
38 | bool m_criticalState; | ||
36 | 39 | ||
37 | }; | 40 | }; |
38 | 41 | ||