@ -300,7 +300,7 @@ bool DOCConduit::doSync(docSyncInfo &sinfo)
}
}
if ( ! sinfo . pdbfilename . isEmpty ( ) & & DOCConduitSettings : : keepPDBsLocally ( ) ) {
if ( ! sinfo . pdbfilename . isEmpty ( ) & & DOCConduitSettings : : keepPDBsLocally ( ) ) {
PilotLocalDatabase * database = new PilotLocalDatabase ( DOCConduitSettings : : pDBDirectory ( ) ,
PilotLocalDatabase * database = new PilotLocalDatabase ( DOCConduitSettings : : pDBDirectory ( ) ,
TQString : : tq fromLatin1( sinfo . dbinfo . name ) , false ) ;
TQString : : fromLatin1( sinfo . dbinfo . name ) , false ) ;
if ( database ) {
if ( database ) {
if ( database - > deleteDatabase ( ) ! = 0 ) {
if ( database - > deleteDatabase ( ) ! = 0 ) {
WARNINGKPILOT < < " Unable to delete database " < < sinfo . dbinfo . name < < " on the PC " < < endl ;
WARNINGKPILOT < < " Unable to delete database " < < sinfo . dbinfo . name < < " on the PC " < < endl ;
@ -378,10 +378,10 @@ bool DOCConduit::doSync(docSyncInfo &sinfo)
if ( ! postSyncAction ( database , sinfo , res ) )
if ( ! postSyncAction ( database , sinfo , res ) )
emit logError ( i18n ( " Unable to install the locally created PalmDOC %1 to the handheld. " )
emit logError ( i18n ( " Unable to install the locally created PalmDOC %1 to the handheld. " )
. tqarg ( TQString : : tq fromLatin1( sinfo . dbinfo . name ) ) ) ;
. tqarg ( TQString : : fromLatin1( sinfo . dbinfo . name ) ) ) ;
if ( ! res )
if ( ! res )
emit logError ( i18n ( " Conversion of PalmDOC \" %1 \" failed. " )
emit logError ( i18n ( " Conversion of PalmDOC \" %1 \" failed. " )
. tqarg ( TQString : : tq fromLatin1( sinfo . dbinfo . name ) ) ) ;
. tqarg ( TQString : : fromLatin1( sinfo . dbinfo . name ) ) ) ;
// disconnect(&docconverter, TQT_SIGNAL(logError(const TQString &)), TQT_SIGNAL(logError(const TQString &)));
// disconnect(&docconverter, TQT_SIGNAL(logError(const TQString &)), TQT_SIGNAL(logError(const TQString &)));
// disconnect(&docconverter, TQT_SIGNAL(logMessage(const TQString &)), TQT_SIGNAL(logMessage(const TQString &)));
// disconnect(&docconverter, TQT_SIGNAL(logMessage(const TQString &)), TQT_SIGNAL(logMessage(const TQString &)));
// KPILOT_DELETE(database);
// KPILOT_DELETE(database);
@ -389,7 +389,7 @@ bool DOCConduit::doSync(docSyncInfo &sinfo)
else
else
{
{
emit logError ( i18n ( " Unable to open or create the database %1. " )
emit logError ( i18n ( " Unable to open or create the database %1. " )
. tqarg ( TQString : : tq fromLatin1( sinfo . dbinfo . name ) ) ) ;
. tqarg ( TQString : : fromLatin1( sinfo . dbinfo . name ) ) ) ;
}
}
return res ;
return res ;
}
}
@ -414,21 +414,21 @@ void DOCConduit::syncNextDB() {
// if creator and/or type don't match, go to next db
// if creator and/or type don't match, go to next db
if ( ! isCorrectDBTypeCreator ( dbinfo ) | |
if ( ! isCorrectDBTypeCreator ( dbinfo ) | |
fDBNames . contains ( TQString : : tq fromLatin1( dbinfo . name ) ) )
fDBNames . contains ( TQString : : fromLatin1( dbinfo . name ) ) )
{
{
TQTimer : : singleShot ( 0 , this , TQT_SLOT ( syncNextDB ( ) ) ) ;
TQTimer : : singleShot ( 0 , this , TQT_SLOT ( syncNextDB ( ) ) ) ;
return ;
return ;
}
}
TQString txtfilename = constructTXTFileName ( TQString : : tq fromLatin1( dbinfo . name ) ) ;
TQString txtfilename = constructTXTFileName ( TQString : : fromLatin1( dbinfo . name ) ) ;
TQString pdbfilename = constructPDBFileName ( TQString : : tq fromLatin1( dbinfo . name ) ) ;
TQString pdbfilename = constructPDBFileName ( TQString : : fromLatin1( dbinfo . name ) ) ;
docSyncInfo syncInfo ( TQString : : tq fromLatin1( dbinfo . name ) ,
docSyncInfo syncInfo ( TQString : : fromLatin1( dbinfo . name ) ,
txtfilename , pdbfilename , eSyncNone ) ;
txtfilename , pdbfilename , eSyncNone ) ;
syncInfo . dbinfo = dbinfo ;
syncInfo . dbinfo = dbinfo ;
needsSync ( syncInfo ) ;
needsSync ( syncInfo ) ;
fSyncInfoList . append ( syncInfo ) ;
fSyncInfoList . append ( syncInfo ) ;
fDBNames . append ( TQString : : tq fromLatin1( dbinfo . name ) ) ;
fDBNames . append ( TQString : : fromLatin1( dbinfo . name ) ) ;
TQTimer : : singleShot ( 0 , this , TQT_SLOT ( syncNextDB ( ) ) ) ;
TQTimer : : singleShot ( 0 , this , TQT_SLOT ( syncNextDB ( ) ) ) ;
return ;
return ;
@ -476,12 +476,12 @@ void DOCConduit::syncNextTXT()
bool alreadySynced = fDBNames . contains ( fl . baseName ( TRUE ) ) ;
bool alreadySynced = fDBNames . contains ( fl . baseName ( TRUE ) ) ;
if ( ! alreadySynced ) {
if ( ! alreadySynced ) {
docSyncInfo syncInfo ( TQString : : tq fromLatin1( dbinfo . name ) ,
docSyncInfo syncInfo ( TQString : : fromLatin1( dbinfo . name ) ,
txtfilename , pdbfilename , eSyncNone ) ;
txtfilename , pdbfilename , eSyncNone ) ;
syncInfo . dbinfo = dbinfo ;
syncInfo . dbinfo = dbinfo ;
needsSync ( syncInfo ) ;
needsSync ( syncInfo ) ;
fSyncInfoList . append ( syncInfo ) ;
fSyncInfoList . append ( syncInfo ) ;
fDBNames . append ( TQString : : tq fromLatin1( dbinfo . name ) ) ;
fDBNames . append ( TQString : : fromLatin1( dbinfo . name ) ) ;
} else {
} else {
# ifdef DEBUG
# ifdef DEBUG
DEBUGKPILOT < < txtfilename < < " has already been synced, skipping it. " < < endl ;
DEBUGKPILOT < < txtfilename < < " has already been synced, skipping it. " < < endl ;
@ -701,7 +701,7 @@ bool DOCConduit::needsSync(docSyncInfo &sinfo)
FUNCTIONSETUP ;
FUNCTIONSETUP ;
sinfo . direction = eSyncNone ;
sinfo . direction = eSyncNone ;
PilotDatabase * docdb = openDOCDatabase ( TQString : : tq fromLatin1( sinfo . dbinfo . name ) ) ;
PilotDatabase * docdb = openDOCDatabase ( TQString : : fromLatin1( sinfo . dbinfo . name ) ) ;
if ( ! fDBListSynced . contains ( sinfo . handheldDB ) ) {
if ( ! fDBListSynced . contains ( sinfo . handheldDB ) ) {
// the database wasn't included on last sync, so it has to be new.
// the database wasn't included on last sync, so it has to be new.
# ifdef DEBUG
# ifdef DEBUG
@ -716,29 +716,29 @@ bool DOCConduit::needsSync(docSyncInfo &sinfo)
N N | C P H
N N | C P H
*/
*/
if ( TQFile : : exists ( sinfo . txtfilename ) ) sinfo . fPC tq Status= eStatNew ;
if ( TQFile : : exists ( sinfo . txtfilename ) ) sinfo . fPC Status= eStatNew ;
else sinfo . fPC tq Status= eStatDoesntExist ;
else sinfo . fPC Status= eStatDoesntExist ;
if ( docdb & & docdb - > isOpen ( ) ) sinfo . fPalm tq Status= eStatNew ;
if ( docdb & & docdb - > isOpen ( ) ) sinfo . fPalm Status= eStatNew ;
else sinfo . fPalm tq Status= eStatDoesntExist ;
else sinfo . fPalm Status= eStatDoesntExist ;
KPILOT_DELETE ( docdb ) ;
KPILOT_DELETE ( docdb ) ;
switch ( eSyncDirection ) {
switch ( eSyncDirection ) {
case eSyncPDAToPC :
case eSyncPDAToPC :
if ( sinfo . fPalm tq Status= = eStatDoesntExist )
if ( sinfo . fPalm Status= = eStatDoesntExist )
sinfo . direction = eSyncDelete ;
sinfo . direction = eSyncDelete ;
else sinfo . direction = eSyncPDAToPC ;
else sinfo . direction = eSyncPDAToPC ;
break ;
break ;
case eSyncPCToPDA :
case eSyncPCToPDA :
if ( sinfo . fPC tq Status= = eStatDoesntExist )
if ( sinfo . fPC Status= = eStatDoesntExist )
sinfo . direction = eSyncDelete ;
sinfo . direction = eSyncDelete ;
else sinfo . direction = eSyncPCToPDA ;
else sinfo . direction = eSyncPCToPDA ;
break ;
break ;
case eSyncNone : // means actually both directions!
case eSyncNone : // means actually both directions!
if ( sinfo . fPC tq Status= = eStatNew ) {
if ( sinfo . fPC Status= = eStatNew ) {
if ( sinfo . fPalm tq Status= = eStatNew ) sinfo . direction = eSyncConflict ;
if ( sinfo . fPalm Status= = eStatNew ) sinfo . direction = eSyncConflict ;
else sinfo . direction = eSyncPCToPDA ;
else sinfo . direction = eSyncPCToPDA ;
} else {
} else {
if ( sinfo . fPalm tq Status= = eStatNew ) sinfo . direction = eSyncPDAToPC ;
if ( sinfo . fPalm Status= = eStatNew ) sinfo . direction = eSyncPDAToPC ;
else {
else {
sinfo . direction = eSyncNone ;
sinfo . direction = eSyncNone ;
# ifdef DEBUG
# ifdef DEBUG
@ -756,9 +756,9 @@ bool DOCConduit::needsSync(docSyncInfo &sinfo)
}
}
// Text was included in the last sync
// Text was included in the last sync
if ( ! TQFile : : exists ( sinfo . txtfilename ) ) sinfo . fPC tq Status= eStatDeleted ;
if ( ! TQFile : : exists ( sinfo . txtfilename ) ) sinfo . fPC Status= eStatDeleted ;
else if ( pcTextChanged ( sinfo . txtfilename ) ) {
else if ( pcTextChanged ( sinfo . txtfilename ) ) {
sinfo . fPC tq Status= eStatChanged ;
sinfo . fPC Status= eStatChanged ;
# ifdef DEBUG
# ifdef DEBUG
DEBUGKPILOT < < " PC side has changed! " < < endl ;
DEBUGKPILOT < < " PC side has changed! " < < endl ;
# endif
# endif
@ -769,12 +769,12 @@ bool DOCConduit::needsSync(docSyncInfo &sinfo)
# endif
# endif
}
}
if ( ! docdb | | ! docdb - > isOpen ( ) ) sinfo . fPalm tq Status= eStatDeleted ;
if ( ! docdb | | ! docdb - > isOpen ( ) ) sinfo . fPalm Status= eStatDeleted ;
else if ( hhTextChanged ( docdb ) ) {
else if ( hhTextChanged ( docdb ) ) {
# ifdef DEBUG
# ifdef DEBUG
DEBUGKPILOT < < " Handheld side has changed! " < < endl ;
DEBUGKPILOT < < " Handheld side has changed! " < < endl ;
# endif
# endif
sinfo . fPalm tq Status= eStatChanged ;
sinfo . fPalm Status= eStatChanged ;
# ifdef DEBUG
# ifdef DEBUG
} else {
} else {
DEBUGKPILOT < < " Handheld side has NOT changed! " < < endl ;
DEBUGKPILOT < < " Handheld side has NOT changed! " < < endl ;
@ -800,7 +800,7 @@ bool DOCConduit::needsSync(docSyncInfo &sinfo)
*/
*/
if ( sinfo . fPC tq Status = = eStatNone & & sinfo . fPalm tq Status= = eStatNone ) {
if ( sinfo . fPC Status = = eStatNone & & sinfo . fPalm Status= = eStatNone ) {
# ifdef DEBUG
# ifdef DEBUG
DEBUGKPILOT < < " Nothing has changed, not need for a sync. " < < endl ;
DEBUGKPILOT < < " Nothing has changed, not need for a sync. " < < endl ;
# endif
# endif
@ -813,12 +813,12 @@ bool DOCConduit::needsSync(docSyncInfo &sinfo)
// to sync that direction
// to sync that direction
if ( eSyncDirection = = eSyncPCToPDA ) {
if ( eSyncDirection = = eSyncPCToPDA ) {
if ( sinfo . fPC tq Status= = eStatDeleted ) sinfo . direction = eSyncDelete ;
if ( sinfo . fPC Status= = eStatDeleted ) sinfo . direction = eSyncDelete ;
else sinfo . direction = eSyncPCToPDA ;
else sinfo . direction = eSyncPCToPDA ;
return true ;
return true ;
}
}
if ( eSyncDirection = = eSyncPDAToPC ) {
if ( eSyncDirection = = eSyncPDAToPC ) {
if ( sinfo . fPalm tq Status= = eStatDeleted ) sinfo . direction = eSyncDelete ;
if ( sinfo . fPalm Status= = eStatDeleted ) sinfo . direction = eSyncDelete ;
else sinfo . direction = eSyncPDAToPC ;
else sinfo . direction = eSyncPDAToPC ;
return true ;
return true ;
}
}
@ -830,8 +830,8 @@ bool DOCConduit::needsSync(docSyncInfo &sinfo)
// if either is deleted, and the other is not changed, delete
// if either is deleted, and the other is not changed, delete
if ( ( ( sinfo . fPC tq Status= = eStatDeleted ) & & ( sinfo . fPalm tq Status! = eStatChanged ) ) | |
if ( ( ( sinfo . fPC Status= = eStatDeleted ) & & ( sinfo . fPalm Status! = eStatChanged ) ) | |
( ( sinfo . fPalm tq Status= = eStatDeleted ) & & ( sinfo . fPC tq Status! = eStatChanged ) ) )
( ( sinfo . fPalm Status= = eStatDeleted ) & & ( sinfo . fPC Status! = eStatChanged ) ) )
{
{
# ifdef DEBUG
# ifdef DEBUG
DEBUGKPILOT < < " DB was deleted on one side and not changed on "
DEBUGKPILOT < < " DB was deleted on one side and not changed on "
@ -843,7 +843,7 @@ bool DOCConduit::needsSync(docSyncInfo &sinfo)
// eStatDeleted (and both not changed) have already been treated, for all
// eStatDeleted (and both not changed) have already been treated, for all
// other values in combination with eStatNone, just copy the texts.
// other values in combination with eStatNone, just copy the texts.
if ( sinfo . fPC tq Status= = eStatNone ) {
if ( sinfo . fPC Status= = eStatNone ) {
# ifdef DEBUG
# ifdef DEBUG
DEBUGKPILOT < < " PC side has changed! " < < endl ;
DEBUGKPILOT < < " PC side has changed! " < < endl ;
# endif
# endif
@ -851,7 +851,7 @@ bool DOCConduit::needsSync(docSyncInfo &sinfo)
return true ;
return true ;
}
}
if ( sinfo . fPalm tq Status= = eStatNone ) {
if ( sinfo . fPalm Status= = eStatNone ) {
sinfo . direction = eSyncPCToPDA ;
sinfo . direction = eSyncPCToPDA ;
return true ;
return true ;
}
}
@ -922,11 +922,11 @@ PilotDatabase *DOCConduit::preSyncAction(docSyncInfo &sinfo) const
if ( DOCConduitSettings : : keepPDBsLocally ( ) )
if ( DOCConduitSettings : : keepPDBsLocally ( ) )
{
{
return new PilotLocalDatabase ( DOCConduitSettings : : pDBDirectory ( ) ,
return new PilotLocalDatabase ( DOCConduitSettings : : pDBDirectory ( ) ,
TQString : : tq fromLatin1( dbinfo . name ) , false ) ;
TQString : : fromLatin1( dbinfo . name ) , false ) ;
}
}
else
else
{
{
return deviceLink ( ) - > database ( TQString : : tq fromLatin1( dbinfo . name ) ) ;
return deviceLink ( ) - > database ( TQString : : fromLatin1( dbinfo . name ) ) ;
}
}
}
}
@ -950,7 +950,7 @@ bool DOCConduit::postSyncAction(PilotDatabase * database,
if ( DOCConduitSettings : : keepPDBsLocally ( ) & & ! DOCConduitSettings : : localSync ( ) )
if ( DOCConduitSettings : : keepPDBsLocally ( ) & & ! DOCConduitSettings : : localSync ( ) )
{
{
PilotDatabase * db = deviceLink ( ) - > database (
PilotDatabase * db = deviceLink ( ) - > database (
TQString : : tq fromLatin1( sinfo . dbinfo . name ) ) ;
TQString : : fromLatin1( sinfo . dbinfo . name ) ) ;
# ifdef DEBUG
# ifdef DEBUG
DEBUGKPILOT < < " Middle 1 Resetting sync flags for database "
DEBUGKPILOT < < " Middle 1 Resetting sync flags for database "
< < sinfo . dbinfo . name < < endl ;
< < sinfo . dbinfo . name < < endl ;