-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 | |||
@@ -15,4 +15,5 @@ | |||
15 | #include <qcombobox.h> | 15 | #include <qcombobox.h> |
16 | #include <qcheckbox.h> | 16 | #include <qcheckbox.h> |
17 | #include <qmessagebox.h> | ||
17 | 18 | ||
18 | 19 | ||
@@ -23,5 +24,6 @@ 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 ); |
@@ -52,4 +54,15 @@ void Converter::start_conversion(){ | |||
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: |
@@ -143,4 +156,6 @@ void Converter::start_conversion(){ | |||
143 | return; | 156 | return; |
144 | 157 | ||
158 | m_criticalState = true; | ||
159 | |||
145 | sourceDB -> load(); | 160 | sourceDB -> load(); |
146 | destDB -> load(); | 161 | destDB -> load(); |
@@ -170,4 +185,6 @@ void Converter::start_conversion(){ | |||
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 ! |
@@ -194,4 +211,19 @@ void Converter::start_conversion(){ | |||
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 | ||
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,4 +15,6 @@ public: | |||
15 | void selectedDestFormat( int num ); | 15 | void selectedDestFormat( int num ); |
16 | void selectedSourceFormat( int num ); | 16 | void selectedSourceFormat( int num ); |
17 | |||
18 | void closeEvent( QCloseEvent *e ); | ||
17 | 19 | ||
18 | private: | 20 | private: |
@@ -34,4 +36,5 @@ private: | |||
34 | int m_selectedSourceFormat; | 36 | int m_selectedSourceFormat; |
35 | int m_selectedDestFormat; | 37 | int m_selectedDestFormat; |
38 | bool m_criticalState; | ||
36 | 39 | ||
37 | }; | 40 | }; |