summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/pimconverter/converter.cpp34
-rwxr-xr-xnoncore/tools/pimconverter/converter.h3
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 @@
#include <qcombobox.h>
#include <qcheckbox.h>
+#include <qmessagebox.h>
@@ -23,5 +24,6 @@ Converter::Converter():
m_selectedDatabase( ADDRESSBOOK ),
m_selectedSourceFormat( XML ),
- m_selectedDestFormat( SQL )
+ m_selectedDestFormat( SQL ),
+ m_criticalState( false )
{
m_dataBaseSelector -> setCurrentItem( m_selectedDatabase );
@@ -52,4 +54,15 @@ void Converter::start_conversion(){
OPimBase* destDB;
+ odebug << "SourceFormat: " << m_selectedSourceFormat << oendl;
+ odebug << "DestFormat: " << m_selectedDestFormat << oendl;
+ if ( m_selectedSourceFormat == m_selectedDestFormat ){
+
+ QMessageBox::warning( this, "PimConverter",
+ tr( "It is not a good idea to use\n" )
+ +tr( "the same source and destformat !" ),
+ tr( "Ok" ) );
+ return;
+ }
+
switch( m_selectedSourceFormat ){
case XML:
@@ -143,4 +156,6 @@ void Converter::start_conversion(){
return;
+ m_criticalState = true;
+
sourceDB -> load();
destDB -> load();
@@ -170,4 +185,6 @@ void Converter::start_conversion(){
destDB -> save();
+ m_criticalState = false;
+
// Delete the frontends. Backends will be deleted automatically, too !
// We have to cast them back to delete them properly !
@@ -194,4 +211,19 @@ void Converter::start_conversion(){
}
+void Converter::closeEvent( QCloseEvent *e )
+{
+
+ /* Due to the fact that we don't have multitasking here, this
+ * critical handling don't make sense, but the future..
+ */
+ if ( m_criticalState ){
+ e->ignore();
+ return;
+ }
+ e->accept();
+}
+
+
+
int main( int argc, char** 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,4 +15,6 @@ public:
void selectedDestFormat( int num );
void selectedSourceFormat( int num );
+
+ void closeEvent( QCloseEvent *e );
private:
@@ -34,4 +36,5 @@ private:
int m_selectedSourceFormat;
int m_selectedDestFormat;
+ bool m_criticalState;
};