summaryrefslogtreecommitdiff
path: root/noncore
authoreilers <eilers>2004-07-18 14:37:20 (UTC)
committer eilers <eilers>2004-07-18 14:37:20 (UTC)
commit30775961a5c33d4721395eb07d11c4fcc142ce96 (patch) (side-by-side diff)
tree99858db337e64689f31b0099c48a26a41e1fc136 /noncore
parentf37561246bc7d8bf4cf791ce156afdf098552dca (diff)
downloadopie-30775961a5c33d4721395eb07d11c4fcc142ce96.zip
opie-30775961a5c33d4721395eb07d11c4fcc142ce96.tar.gz
opie-30775961a5c33d4721395eb07d11c4fcc142ce96.tar.bz2
Fixed bugreport #1370 and
added check, whether source and destdatabase is the same..
Diffstat (limited to 'noncore') (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
@@ -14,6 +14,7 @@
#include <qprogressbar.h>
#include <qcombobox.h>
#include <qcheckbox.h>
+#include <qmessagebox.h>
using namespace Opie;
@@ -22,7 +23,8 @@ using namespace Pim;
Converter::Converter():
m_selectedDatabase( ADDRESSBOOK ),
m_selectedSourceFormat( XML ),
- m_selectedDestFormat( SQL )
+ m_selectedDestFormat( SQL ),
+ m_criticalState( false )
{
m_dataBaseSelector -> setCurrentItem( m_selectedDatabase );
m_sourceFormatSelector -> setCurrentItem( m_selectedSourceFormat );
@@ -51,6 +53,17 @@ void Converter::start_conversion(){
OPimBase* sourceDB;
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:
odebug << "XMLSourceDB = " << m_selectedDatabase << "" << oendl;
@@ -142,6 +155,8 @@ void Converter::start_conversion(){
if ( !sourceDB || !destDB )
return;
+ m_criticalState = true;
+
sourceDB -> load();
destDB -> load();
@@ -169,6 +184,8 @@ void Converter::start_conversion(){
// Now commit data..
destDB -> save();
+ m_criticalState = false;
+
// Delete the frontends. Backends will be deleted automatically, too !
// We have to cast them back to delete them properly !
switch( m_selectedDatabase ){
@@ -193,6 +210,21 @@ void Converter::start_conversion(){
owarn << "Conversion is finished and needed " << t.elapsed() << " ms !" << oendl;
}
+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 ) {
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
@@ -14,6 +14,8 @@ public:
void selectedDatabase( int num );
void selectedDestFormat( int num );
void selectedSourceFormat( int num );
+
+ void closeEvent( QCloseEvent *e );
private:
// Caution:
@@ -33,6 +35,7 @@ private:
int m_selectedDatabase;
int m_selectedSourceFormat;
int m_selectedDestFormat;
+ bool m_criticalState;
};