summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/korganizer/allday.pngbin0 -> 279 bytes
-rw-r--r--bin/kdepim/korganizer/icons16/allday.pngbin0 -> 271 bytes
-rw-r--r--bin/kdepim/korganizer/iconsmini/allday.pngbin0 -> 273 bytes
-rw-r--r--bin/kdepim/korganizer/iconsmini/configure.pngbin0 -> 763 bytes
-rw-r--r--kaddressbook/kabcore.cpp40
-rw-r--r--korganizer/calendarview.cpp21
-rw-r--r--korganizer/mainwindow.cpp3
-rw-r--r--libkdepim/ksyncmanager.cpp34
8 files changed, 50 insertions, 48 deletions
diff --git a/bin/kdepim/korganizer/allday.png b/bin/kdepim/korganizer/allday.png
new file mode 100644
index 0000000..735eae2
--- a/dev/null
+++ b/bin/kdepim/korganizer/allday.png
Binary files differ
diff --git a/bin/kdepim/korganizer/icons16/allday.png b/bin/kdepim/korganizer/icons16/allday.png
new file mode 100644
index 0000000..426d250
--- a/dev/null
+++ b/bin/kdepim/korganizer/icons16/allday.png
Binary files differ
diff --git a/bin/kdepim/korganizer/iconsmini/allday.png b/bin/kdepim/korganizer/iconsmini/allday.png
new file mode 100644
index 0000000..be9a2ba
--- a/dev/null
+++ b/bin/kdepim/korganizer/iconsmini/allday.png
Binary files differ
diff --git a/bin/kdepim/korganizer/iconsmini/configure.png b/bin/kdepim/korganizer/iconsmini/configure.png
new file mode 100644
index 0000000..ad965e2
--- a/dev/null
+++ b/bin/kdepim/korganizer/iconsmini/configure.png
Binary files differ
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 590cc82..ae0a068 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -406,70 +406,70 @@ void KABCore::updateToolBar()
{
static int iii = 0;
++iii;
mMainWindow->toolBar()->repaintMe();
if ( iii < 3 )
QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
}
KABCore::~KABCore()
{
// save();
//saveSettings();
//KABPrefs::instance()->writeConfig();
delete AddresseeConfig::instance();
mAddressBook = 0;
KABC::StdAddressBook::close();
delete syncManager;
#ifndef DESKTOP_VERSION
if ( infrared )
delete infrared;
#endif
}
void KABCore::receive( const QCString& cmsg, const QByteArray& data )
{
- qDebug("KA: QCOP message received: %s ", cmsg.data() );
+ //qDebug("KA: QCOP message received: %s ", cmsg.data() );
if ( cmsg == "setDocument(QString)" ) {
QDataStream stream( data, IO_ReadOnly );
QString fileName;
stream >> fileName;
recieve( fileName );
return;
}
}
void KABCore::toggleBeamReceive( )
{
if ( mBRdisabled )
return;
#ifndef DESKTOP_VERSION
if ( infrared ) {
- qDebug("AB disable BeamReceive ");
+ qDebug("KA: AB disable BeamReceive ");
delete infrared;
infrared = 0;
mActionBR->setChecked(false);
return;
}
- qDebug("AB enable BeamReceive ");
+ qDebug("KA: AB enable BeamReceive ");
mActionBR->setChecked(true);
infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
#endif
}
void KABCore::disableBR(bool b)
{
#ifndef DESKTOP_VERSION
if ( b ) {
if ( infrared ) {
toggleBeamReceive( );
}
mBRdisabled = true;
} else {
if ( mBRdisabled ) {
mBRdisabled = false;
//toggleBeamReceive( );
}
}
#endif
@@ -547,49 +547,49 @@ void KABCore::restoreSettings()
mExtensionBarSplitter->setSizes( splitterSize );
}
}
void KABCore::saveSettings()
{
KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
if ( mExtensionBarSplitter )
KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
#ifndef KAB_EMBEDDED
KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
#endif //KAB_EMBEDDED
mExtensionManager->saveSettings();
mViewManager->saveSettings();
KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
KABPrefs::instance()->writeConfig();
- qDebug("KABCore::saveSettings() ");
+ qDebug("KA: KABCore::saveSettings() ");
}
KABC::AddressBook *KABCore::addressBook() const
{
return mAddressBook;
}
KConfig *KABCore::config()
{
#ifndef KAB_EMBEDDED
return KABPrefs::instance()->config();
#else //KAB_EMBEDDED
return KABPrefs::instance()->getConfig();
#endif //KAB_EMBEDDED
}
KActionCollection *KABCore::actionCollection() const
{
return mGUIClient->actionCollection();
}
KABC::Field *KABCore::currentSearchField() const
{
if (mIncSearchWidget)
@@ -885,49 +885,49 @@ void KABCore::export2phone()
KPimGlobalPrefs::instance()->mEx2PhoneModel );
QString fileName = getPhoneFile();
if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
return;
message(i18n("Exporting to phone..."));
QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
}
QString KABCore::getPhoneFile()
{
#ifdef DESKTOP_VERSION
return locateLocal("tmp", "phonefile.vcf");
#else
return "/tmp/phonefile.vcf";
#endif
}
void KABCore::writeToPhone( )
{
if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
message(i18n("Export to phone finished!"));
else
- qDebug(i18n("Error exporting to phone"));
+ qDebug(i18n("KA: Error exporting to phone"));
}
void KABCore::beamVCard()
{
QStringList uids;
XXPortSelectDialog dlg( this, false, this );
if ( dlg.exec() )
uids = dlg.uids();
else
return;
if ( uids.isEmpty() )
return;
beamVCard( uids );
}
void KABCore::beamVCard(const QStringList& uids)
{
// LR: we should use the /tmp dir on the Zaurus,
// because: /tmp = RAM, (HOME)/kdepim = flash memory
#ifdef DESKTOP_VERSION
QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
#else
@@ -956,49 +956,49 @@ void KABCore::beamVCard(const QStringList& uids)
int sep;
if ( semi < dopp && semi >= 0 )
sep = semi ;
else
sep = dopp;
datastream +=vcard.mid( start, next - start);
datastream +=vcard.mid( next+5,sep -next -5 ).upper();
start = sep;
}
datastream += vcard.mid( start,vcard.length() );
}
#ifndef DESKTOP_VERSION
QFile outFile(fileName);
if ( outFile.open(IO_WriteOnly) ) {
datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
QTextStream t( &outFile ); // use a text stream
//t.setEncoding( QTextStream::UnicodeUTF8 );
t.setEncoding( QTextStream::Latin1 );
t <<datastream.latin1();
outFile.close();
Ir *ir = new Ir( this );
connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
ir->send( fileName, description, "text/x-vCard" );
} else {
- qDebug("Error open temp beam file ");
+ qDebug("KA: Error open temp beam file ");
return;
}
#endif
}
void KABCore::beamDone( Ir *ir )
{
#ifndef DESKTOP_VERSION
delete ir;
#endif
topLevelWidget()->raise();
message( i18n("Beaming finished!") );
}
void KABCore::browse( const QString& url )
{
#ifndef KAB_EMBEDDED
kapp->invokeBrowser( url );
#else //KAB_EMBEDDED
qDebug("KABCore::browse must be fixed");
#endif //KAB_EMBEDDED
}
@@ -2663,84 +2663,84 @@ void KABCore::synchowto()
}
void KABCore::kdesynchowto()
{
KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
}
void KABCore::multisynchowto()
{
KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
}
void KABCore::faq()
{
KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
}
#include <libkcal/syncdefines.h>
KABC::Addressee KABCore::getLastSyncAddressee()
{
Addressee lse;
QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
//qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
if (lse.isEmpty()) {
- qDebug("Creating new last-syncAddressee ");
+ qDebug("KA: Creating new last-syncAddressee ");
lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
QString sum = "";
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
sum = "E: ";
lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
lse.setRevision( mLastAddressbookSync );
lse.setCategories( i18n("SyncEvent") );
mAddressBook->insertAddressee( lse );
}
return lse;
}
int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
{
//void setZaurusId(int id);
// int zaurusId() const;
// void setZaurusUid(int id);
// int zaurusUid() const;
// void setZaurusStat(int id);
// int zaurusStat() const;
// 0 equal
// 1 take local
// 2 take remote
// 3 cancel
QDateTime lastSync = mLastAddressbookSync;
QDateTime localMod = local->revision();
QDateTime remoteMod = remote->revision();
QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
bool remCh, locCh;
remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
- if ( remCh )
- qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
+ //if ( remCh )
+ // qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
locCh = ( localMod > mLastAddressbookSync );
//qDebug("cahnged rem %d loc %d",remCh, locCh );
if ( !remCh && ! locCh ) {
//qDebug("both not changed ");
lastSync = localMod.addDays(1);
if ( mode <= SYNC_PREF_ASK )
return 0;
} else {
if ( locCh ) {
//qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
lastSync = localMod.addDays( -1 );
if ( !remCh )
remoteMod =( lastSync.addDays( -1 ) );
} else {
//qDebug(" not loc changed ");
lastSync = localMod.addDays( 1 );
if ( remCh ) {
//qDebug("rem changed ");
remoteMod =( lastSync.addDays( 1 ) );
}
}
}
full = true;
@@ -2835,56 +2835,56 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
int changedLocal = 0;
int changedRemote = 0;
int filteredIN = 0;
int filteredOUT = 0;
QString mCurrentSyncName = syncManager->getCurrentSyncName();
QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
//QPtrList<Addressee> el = local->rawAddressees();
Addressee addresseeR;
QString uid;
int take;
Addressee addresseeL;
Addressee addresseeRSync;
Addressee addresseeLSync;
// KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees();
//KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees();
bool fullDateRange = false;
local->resetTempSyncStat();
mLastAddressbookSync = QDateTime::currentDateTime();
if ( syncManager->syncWithDesktop() ) {
// remote->removeSyncInfo( QString());//remove all info
if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
mLastAddressbookSync = KSyncManager::mRequestedSyncEvent;
- qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() );
+ qDebug("KA: using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() );
} else {
- qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
+ qDebug("KA: KSyncManager::mRequestedSyncEvent has invalid datatime ");
}
}
QDateTime modifiedCalendar = mLastAddressbookSync;
addresseeLSync = getLastSyncAddressee();
- qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1());
+ qDebug("KA: Last Sync %s ", addresseeLSync.revision().toString().latin1());
addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName );
if ( !addresseeR.isEmpty() ) {
addresseeRSync = addresseeR;
remote->removeAddressee(addresseeR );
} else {
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
addresseeRSync = addresseeLSync ;
} else {
//qDebug("FULLDATE 1");
fullDateRange = true;
Addressee newAdd;
addresseeRSync = newAdd;
addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee"));
addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName );
addresseeRSync.setRevision( mLastAddressbookSync );
addresseeRSync.setCategories( i18n("SyncAddressee") );
}
}
if ( addresseeLSync.revision() == mLastAddressbookSync ) {
// qDebug("FULLDATE 2");
fullDateRange = true;
}
if ( ! fullDateRange ) {
@@ -3104,189 +3104,189 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
// get rid of micro seconds
QTime t = mLastAddressbookSync.time();
mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
addresseeLSync.setRevision( mLastAddressbookSync );
addresseeRSync.setRevision( mLastAddressbookSync );
addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
addresseeRSync.setNote( "" ) ;
addresseeLSync.setNote( "" );
if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
remote->insertAddressee( addresseeRSync, false );
local->insertAddressee( addresseeLSync, false );
QString mes;
mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT );
qDebug( mes );
mes = i18n("Local addressbook changed!\n") +mes;
if ( syncManager->mShowSyncSummary ) {
if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
i18n("KA/Pi Synchronization"),i18n("Write back"))) {
- qDebug("cancelled ");
+ qDebug("KA: WB cancelled ");
return false;
}
}
return syncOK;
}
//this is a overwritten callbackmethods from the syncinterface
bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
{
//pending prepare addresseeview for output
//pending detect, if remote file has REV field. if not switch to external sync
mGlobalSyncMode = SYNC_MODE_NORMAL;
if ( manager != syncManager )
qDebug("KABCore::sync:: ERROR! :: manager != syncManager ");
QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
AddressBook abLocal(filename,"syncContact");
bool syncOK = false;
if ( abLocal.load() ) {
- qDebug("Sync:AB loaded %s,sync mode %d",filename.latin1(), mode );
+ qDebug("KA: Sync::AB loaded %s,sync mode %d",filename.latin1(), mode );
bool external = false;
bool isXML = false;
if ( filename.right(4) == ".xml") {
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
isXML = true;
abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
} else {
external = !manager->mIsKapiFile;
if ( external ) {
- qDebug("Sync:Setting vcf mode to external ");
+ qDebug("KA: Sync::Setting vcf mode to external ");
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
AddressBook::Iterator it;
for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
(*it).setID( mCurrentSyncDevice, (*it).uid() );
(*it).computeCsum( mCurrentSyncDevice );
}
}
}
//AddressBook::Iterator it;
//QStringList vcards;
//for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
// qDebug("Name %s ", (*it).familyName().latin1());
//}
syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
if ( syncOK ) {
if ( syncManager->mWriteBackFile )
{
if ( external )
abLocal.removeSyncAddressees( !isXML);
- qDebug("Sync:Saving remote AB ");
+ qDebug("KA: Sync::Saving remote AB ");
if ( ! abLocal.saveAB())
- qDebug("Error writing back AB to file ");
+ qDebug("KA: sync::Error writing back AB to file ");
if ( external ) {
// afterwrite processing
abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML);
}
}
}
setModified();
}
abLocal.removeResources();
if ( syncOK )
mViewManager->refreshView();
return syncOK;
}
void KABCore::removeSyncInfo( QString syncProfile)
{
- qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1());
+ qDebug("KA: AB:removeSyncInfo for profile %s ", syncProfile.latin1());
mAddressBook->removeSyncInfo( syncProfile );
setModified();
}
//this is a overwritten callbackmethods from the syncinterface
bool KABCore::syncExternal(KSyncManager* manager, QString resource)
{
if ( resource == "phone" )
return syncPhone();
disableBR( true );
if ( manager != syncManager )
qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager ");
QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
AddressBook abLocal( resource,"syncContact");
bool syncOK = false;
message(i18n("Loading DTM address data..."), false);
if ( abLocal.load() ) {
- qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
+ qDebug("KA: AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
message(i18n("Sync preprocessing..."),false);
abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
message(i18n("Synchronizing..."),false);
syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
if ( syncOK ) {
if ( syncManager->mWriteBackFile ) {
abLocal.removeSyncAddressees( false );
message(i18n("Saving DTM address data..."),false);
abLocal.saveAB();
message(i18n("Sync postprocessing..."),false);
abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
}
} else
message( i18n("Sync cancelled or failed.") );
setModified();
}
abLocal.removeResources();
if ( syncOK ) {
mViewManager->refreshView();
message(i18n("DTM syncing finished."));
}
disableBR( false );
return syncOK;
}
void KABCore::message( QString m, bool startTimer)
{
topLevelWidget()->setCaption( m );
qApp->processEvents();
if ( startTimer )
mMessageTimer->start( 15000, true );
else
mMessageTimer->stop();
}
bool KABCore::syncPhone()
{
QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
QString fileName = getPhoneFile();
if ( !PhoneAccess::readFromPhone( fileName) ) {
message(i18n("Phone access failed!"));
return false;
}
AddressBook abLocal( fileName,"syncContact");
bool syncOK = false;
{
abLocal.importFromFile( fileName );
- qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
+ qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
abLocal.preparePhoneSync( mCurrentSyncDevice, true );
abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
if ( syncOK ) {
if ( syncManager->mWriteBackFile ) {
abLocal.removeSyncAddressees( true );
abLocal.saveABphone( fileName );
abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
//abLocal.preparePhoneSync( mCurrentSyncDevice, false );
abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
}
}
setModified();
}
abLocal.removeResources();
if ( syncOK )
mViewManager->refreshView();
return syncOK;
}
void KABCore::getFile( bool success )
{
if ( ! success ) {
message( i18n("Error receiving file. Nothing changed!") );
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 038da54..06454c2 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -927,98 +927,98 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
int addedEvent = 0;
int addedEventR = 0;
int deletedEventR = 0;
int deletedEventL = 0;
int changedLocal = 0;
int changedRemote = 0;
int filteredIN = 0;
int filteredOUT = 0;
//QPtrList<Event> el = local->rawEvents();
Event* eventR;
QString uid;
int take;
Event* eventL;
Event* eventRSync;
Event* eventLSync;
QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
bool fullDateRange = false;
local->resetTempSyncStat();
mLastCalendarSync = QDateTime::currentDateTime();
if ( mSyncManager->syncWithDesktop() ) {
remote->resetPilotStat(1);
if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
- qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
+ qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
} else {
qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
}
}
QDateTime modifiedCalendar = mLastCalendarSync;
eventLSync = getLastSyncEvent();
eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
if ( eventR ) {
eventRSync = (Event*) eventR->clone();
remote->deleteEvent(eventR );
} else {
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
eventRSync = (Event*)eventLSync->clone();
} else {
fullDateRange = true;
eventRSync = new Event();
eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
eventRSync->setDtStart( mLastCalendarSync );
eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
eventRSync->setCategories( i18n("SyncEvent") );
}
}
if ( eventLSync->dtStart() == mLastCalendarSync )
fullDateRange = true;
if ( ! fullDateRange ) {
if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
// qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
//qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
fullDateRange = true;
}
}
if ( mSyncManager->syncWithDesktop() ) {
fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
}
if ( fullDateRange )
mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
else
mLastCalendarSync = eventLSync->dtStart();
// for resyncing if own file has changed
if ( mCurrentSyncDevice == "deleteaftersync" ) {
mLastCalendarSync = loadedFileVersion;
//qDebug("setting mLastCalendarSync ");
}
//qDebug("*************************** ");
- qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
+ qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
QPtrList<Incidence> er = remote->rawIncidences();
Incidence* inR = er.first();
Incidence* inL;
QProgressBar bar( er.count(),0 );
bar.setCaption (i18n("Syncing - close to abort!") );
// ************** setting up filter *************
CalFilter *filterIN = 0;
CalFilter *filterOUT = 0;
CalFilter *filter = mFilters.first();
while(filter) {
if ( filter->name() == mSyncManager->mFilterInCal )
filterIN = filter;
if ( filter->name() == mSyncManager->mFilterOutCal )
filterOUT = filter;
filter = mFilters.next();
}
int w = 300;
if ( QApplication::desktop()->width() < 320 )
w = 220;
int h = bar.sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
@@ -1203,67 +1203,68 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
bool ok;
dt = inR->getNextOccurence( cur, &ok );
if ( !ok )
dt = cur.addSecs( -62 );
}
else
dt = inR->dtStart();
if ( dt < cur || dt > end ) {
remote->deleteIncidence( inR );
++delFut;
}
inR = er.next();
}
}
bar.hide();
mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
eventLSync->setReadOnly( false );
eventLSync->setDtStart( mLastCalendarSync );
eventRSync->setDtStart( mLastCalendarSync );
eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
eventLSync->setReadOnly( true );
- qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() );
+ qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL );
if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
remote->addEvent( eventRSync );
else
delete eventRSync;
+ qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() );
QString mes;
mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT );
QString delmess;
if ( delFut ) {
delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut);
mes += delmess;
}
mes = i18n("Local calendar changed!\n") +mes;
mCalendar->checkAlarmForIncidence( 0, true );
qDebug( mes );
if ( mSyncManager->mShowSyncSummary ) {
if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
i18n("KO/Pi Synchronization"),i18n("Write back"))) {
- qDebug("cancelled ");
+ qDebug("KO: WB cancelled ");
return false;
}
}
return syncOK;
}
void CalendarView::setSyncDevice( QString s )
{
mCurrentSyncDevice= s;
}
void CalendarView::setSyncName( QString s )
{
mCurrentSyncName= s;
}
bool CalendarView::syncCalendar(QString filename, int mode)
{
//qDebug("syncCalendar %s ", filename.latin1());
mGlobalSyncMode = SYNC_MODE_NORMAL;
CalendarLocal* calendar = new CalendarLocal();
calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
FileStorage* storage = new FileStorage( calendar );
bool syncOK = false;
storage->setFileName( filename );
// qDebug("loading ... ");
@@ -1419,56 +1420,56 @@ bool CalendarView::importBday()
++addCount;
}
}
updateView();
topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
#else //DESKTOP_VERSION
ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
// the result should now arrive through method insertBirthdays
#endif //DESKTOP_VERSION
#endif //KORG_NOKABC
return true;
}
// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
const QStringList& anniversaryList, const QStringList& realNameList,
const QStringList& emailList, const QStringList& assembledNameList,
const QStringList& uidList)
{
- qDebug("CalendarView::insertBirthdays");
+ //qDebug("KO::CalendarView::insertBirthdays");
if (uid == this->name())
{
int count = birthdayList.count();
int addCount = 0;
KCal::Attendee* a = 0;
- qDebug("CalView 1 %i", count);
+ //qDebug("CalView 1 %i", count);
QProgressBar bar(count,0 );
int w = 300;
if ( QApplication::desktop()->width() < 320 )
w = 220;
int h = bar.sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar.show();
bar.setCaption (i18n("inserting birthdays - close to abort!") );
qApp->processEvents();
QDate birthday;
QDate anniversary;
QString realName;
QString email;
QString assembledName;
QString uid;
bool ok = true;
for ( int i = 0; i < count; i++)
{
if ( ! bar.isVisible() )
return;
@@ -2488,64 +2489,64 @@ void CalendarView::moveIncidence(Incidence * inc )
void CalendarView::showDatePicker( )
{
//qDebug("CalendarView::showDatePicker( ) ");
if ( mDateFrame->isVisible() )
mDateFrame->hide();
else {
int w =mDatePicker->sizeHint().width() ;
int h = mDatePicker->sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
mDateFrame->show();
}
mDatePickerMode = 1;
mDatePicker->setDate( mNavigator->selectedDates().first() );
}
void CalendarView::showEventEditor()
{
#ifdef DESKTOP_VERSION
mEventEditor->show();
#else
if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
- qDebug("CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
+ qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
delete mEventEditor;
mEventEditor = mDialogManager->getEventEditor();
}
mEventEditor->showMaximized();
topLevelWidget()->setCaption( i18n("") );
#endif
}
void CalendarView::showTodoEditor()
{
#ifdef DESKTOP_VERSION
mTodoEditor->show();
#else
if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
- qDebug("CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
+ qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
delete mTodoEditor;
mTodoEditor = mDialogManager->getTodoEditor();
}
mTodoEditor->showMaximized();
topLevelWidget()->setCaption( i18n("") );
#endif
}
void CalendarView::cloneIncidence()
{
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
cloneIncidence(incidence);
}
}
void CalendarView::moveIncidence()
{
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
moveIncidence(incidence);
}
}
@@ -3836,70 +3837,70 @@ void CalendarView::purgeCompleted()
void CalendarView::slotCalendarChanged()
{
;
}
NavigatorBar *CalendarView::navigatorBar()
{
return mNavigatorBar;
}
void CalendarView::keyPressEvent ( QKeyEvent *e)
{
//qDebug(" alendarView::keyPressEvent ");
e->ignore();
}
bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
{
// mSyncManager = manager;
if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
- qDebug("SyncKDE request detected!");
+ qDebug("KO: SyncKDE request detected!");
}
mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
mCurrentSyncName = mSyncManager->getCurrentSyncName();
return syncCalendar( filename, mode );
}
bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
{
//mSyncManager = manager;
mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
mCurrentSyncName = mSyncManager->getCurrentSyncName();
if ( resource == "sharp" )
syncExternal( 0 );
if ( resource == "phone" )
syncExternal( 1 );
// pending setmodified
return true;
}
void CalendarView::setSyncManager(KSyncManager* manager)
{
mSyncManager = manager;
}
void CalendarView::removeSyncInfo( QString syncProfile)
{
- qDebug("removeSyncInfo for profile %s ", syncProfile.latin1());
+ qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
mCalendar->removeSyncInfo( syncProfile );
}
void CalendarView::undo_delete()
{
//qDebug("undo_delete() ");
Incidence* undo = mCalendar->undoIncidence();
if ( !undo ) {
KMessageBox::sorry(this,i18n("There is nothing to undo!"),
i18n("KO/Pi"));
return;
}
if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
i18n("\nAre you sure you want\nto restore this?"),
i18n("KO/Pi Confirmation"),i18n("Restore"))) {
mCalendar->undoDeleteIncidence();
updateView();
}
}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 26ea1e2..877b6f2 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -586,49 +586,50 @@ void MainWindow::initActions()
icon = loadPixmap( pathString + "newevent" );
configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
configureToolBarMenu->insertSeparator();
configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
ne_action->addTo( actionMenu );
connect( ne_action, SIGNAL( activated() ),
mView, SLOT( newEvent() ) );
icon = loadPixmap( pathString + "newtodo" );
configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
nt_action->addTo( actionMenu );
connect( nt_action, SIGNAL( activated() ),
mView, SLOT( newTodo() ) );
icon = loadPixmap( pathString + "navi" );
action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( toggleDateNavigatorWidget() ) );
icon = loadPixmap( pathString + "filter" );
action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( toggleFilter() ) );
- action = new QAction( i18n("Toggle Allday"), i18n("Toggle Allday"), 0, this );
+ icon = loadPixmap( pathString + "allday" );
+ action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( toggleAllDaySize() ) );
viewMenu->insertSeparator();
icon = loadPixmap( pathString + "picker" );
action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( showDatePicker() ) );
action->addTo( iconToolBar );
viewMenu->insertSeparator();
icon = loadPixmap( pathString + "list" );
configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
showlist_action->addTo( viewMenu );
connect( showlist_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showListView() ) );
icon = loadPixmap( pathString + "day" );
configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
day1_action->addTo( viewMenu );
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index f488a07..3adbf61 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -163,49 +163,49 @@ void KSyncManager::fillSyncMenu()
void KSyncManager::slotClearMenu( int action )
{
QString syncDevice;
if ( action > 999 ) {
syncDevice = mSyncProfileNames[action - 1000] ;
}
int result = 0;
QString sd;
if ( syncDevice.isEmpty() )
sd = i18n("Do you want to\nclear all sync info\nof all profiles?");
else
sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice );
result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0,
0, 1 );
if ( result )
return;
mImplementation->removeSyncInfo( syncDevice );
}
void KSyncManager::slotSyncMenu( int action )
{
- qDebug("syncaction %d ", action);
+ qDebug("KSM::syncaction %d ", action);
if ( action == 5000 )
return;
mSyncWithDesktop = false;
if ( action == 0 ) {
// seems to be a Qt2 event handling bug
// syncmenu.clear causes a segfault at first time
// when we call it after the main event loop, it is ok
// same behaviour when calling OM/Pi via QCOP for the first time
QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
//confSync();
return;
}
if ( action == 1 ) {
multiSync( true );
return;
}
if ( action == 2 ) {
enableQuick();
QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
return;
}
if ( action == 3 ) {
@@ -271,49 +271,49 @@ void KSyncManager::slotSyncMenu( int action )
} else if ( action == 1002 ) {
mWriteBackFile = false;
mAskForPreferences = false;
mShowSyncSummary = false;
mSyncAlgoPrefs = 3;
quickSyncLocalFile();
} else if ( action >= 1003 ) {
if ( temp->getIsLocalFileSync() ) {
switch(mTargetApp)
{
case (KAPI):
if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
break;
case (KOPI):
if ( syncWithFile( temp->getRemoteFileName( ), false ) )
mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
break;
case (PWMPI):
if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
break;
default:
- qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
+ qDebug("KSM::slotSyncMenu: invalid apptype selected");
break;
}
} else {
if ( temp->getIsPhoneSync() ) {
mPhoneDevice = temp->getPhoneDevice( ) ;
mPhoneConnection = temp->getPhoneConnection( );
mPhoneModel = temp->getPhoneModel( );
syncPhone();
} else if ( temp->getIsPiSync() ) {
if ( mTargetApp == KAPI ) {
mPassWordPiSync = temp->getRemotePwAB();
mActiveSyncPort = temp->getRemotePortAB();
mActiveSyncIP = temp->getRemoteIPAB();
} else if ( mTargetApp == KOPI ) {
mPassWordPiSync = temp->getRemotePw();
mActiveSyncPort = temp->getRemotePort();
mActiveSyncIP = temp->getRemoteIP();
} else {
mPassWordPiSync = temp->getRemotePwPWM();
mActiveSyncPort = temp->getRemotePortPWM();
mActiveSyncIP = temp->getRemoteIPPWM();
}
syncPi();
@@ -419,107 +419,107 @@ void KSyncManager::enableQuick( bool ask )
mPrefs->writeConfig();
}
connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) );
}
void KSyncManager::syncLocalFile()
{
QString fn =mPrefs->mLastSyncedLocalFile;
QString ext;
switch(mTargetApp)
{
case (KAPI):
ext = "(*.vcf)";
break;
case (KOPI):
ext = "(*.ics/*.vcs)";
break;
case (PWMPI):
ext = "(*.pwm)";
break;
default:
- qDebug("KSyncManager::syncLocalFile: invalid apptype selected");
+ qDebug("KSM::syncLocalFile: invalid apptype selected");
break;
}
fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent );
if ( fn == "" )
return;
if ( syncWithFile( fn, false ) ) {
- qDebug("syncLocalFile() successful ");
+ qDebug("KSM::syncLocalFile() successful ");
}
}
bool KSyncManager::syncWithFile( QString fn , bool quick )
{
bool ret = false;
QFileInfo info;
info.setFile( fn );
QString mess;
bool loadbup = true;
if ( !info. exists() ) {
mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
int result = QMessageBox::warning( mParent, i18n("Warning!"),
mess );
return ret;
}
int result = 0;
if ( !quick ) {
mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
result = QMessageBox::warning( mParent, i18n("Warning!"),
mess,
i18n("Sync"), i18n("Cancel"), 0,
0, 1 );
if ( result )
return false;
}
if ( mAskForPreferences )
if ( !edit_sync_options()) {
mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
return false;
}
if ( result == 0 ) {
//qDebug("Now sycing ... ");
if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) )
mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") );
else
mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
if ( ! quick )
mPrefs->mLastSyncedLocalFile = fn;
}
return ret;
}
void KSyncManager::quickSyncLocalFile()
{
if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) {
- qDebug("quick syncLocalFile() successful ");
+ qDebug("KSM::quick syncLocalFile() successful ");
}
}
void KSyncManager::multiSync( bool askforPrefs )
{
if (blockSave())
return;
setBlockSave(true);
QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"),
question,
i18n("Yes"), i18n("No"),
0, 0 ) != 0 ) {
setBlockSave(false);
mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!"));
return;
}
mCurrentSyncDevice = i18n("Multiple profiles") ;
mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs;
if ( askforPrefs ) {
if ( !edit_sync_options()) {
mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") );
return;
@@ -548,49 +548,49 @@ int KSyncManager::ringSync()
unsigned int i;
QTime timer;
KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
QStringList syncProfileNames = mSyncProfileNames;
KSyncProfile* temp = new KSyncProfile ();
mAskForPreferences = false;
for ( i = 0; i < syncProfileNames.count(); ++i ) {
mCurrentSyncProfile = i;
temp->setName(syncProfileNames[mCurrentSyncProfile]);
temp->readConfig(&config);
bool includeInRingSync;
switch(mTargetApp)
{
case (KAPI):
includeInRingSync = temp->getIncludeInRingSyncAB();
break;
case (KOPI):
includeInRingSync = temp->getIncludeInRingSync();
break;
case (PWMPI):
includeInRingSync = temp->getIncludeInRingSyncPWM();
break;
default:
- qDebug("KSyncManager::ringSync: invalid apptype selected");
+ qDebug("KSM::ringSync: invalid apptype selected");
break;
}
if ( includeInRingSync && ( i < 1 || i > 2 )) {
mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
++syncedProfiles;
mSyncWithDesktop = false;
// mAskForPreferences = temp->getAskForPreferences();
mWriteBackFile = temp->getWriteBackFile();
mWriteBackExistingOnly = temp->getWriteBackExisting();
mIsKapiFile = temp->getIsKapiFile();
mWriteBackInFuture = 0;
if ( temp->getWriteBackFuture() ) {
mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
mWriteBackInPast = temp->getWriteBackPastWeeks( );
}
mFilterInCal = temp->getFilterInCal();
mFilterOutCal = temp->getFilterOutCal();
mFilterInAB = temp->getFilterInAB();
mFilterOutAB = temp->getFilterOutAB();
mShowSyncSummary = false;
mCurrentSyncDevice = syncProfileNames[i] ;
@@ -598,49 +598,49 @@ int KSyncManager::ringSync()
if ( i == 0 ) {
mIsKapiFile = false;
#ifdef DESKTOP_VERSION
syncKDE();
#else
syncSharp();
#endif
} else {
if ( temp->getIsLocalFileSync() ) {
switch(mTargetApp)
{
case (KAPI):
if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
break;
case (KOPI):
if ( syncWithFile( temp->getRemoteFileName( ), false ) )
mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
break;
case (PWMPI):
if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
break;
default:
- qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
+ qDebug("KSM: invalid apptype selected");
break;
}
} else {
if ( temp->getIsPhoneSync() ) {
mPhoneDevice = temp->getPhoneDevice( ) ;
mPhoneConnection = temp->getPhoneConnection( );
mPhoneModel = temp->getPhoneModel( );
syncPhone();
} else if ( temp->getIsPiSync() ) {
if ( mTargetApp == KAPI ) {
mPassWordPiSync = temp->getRemotePwAB();
mActiveSyncPort = temp->getRemotePortAB();
mActiveSyncIP = temp->getRemoteIPAB();
} else if ( mTargetApp == KOPI ) {
mPassWordPiSync = temp->getRemotePw();
mActiveSyncPort = temp->getRemotePort();
mActiveSyncIP = temp->getRemoteIP();
} else {
mPassWordPiSync = temp->getRemotePwPWM();
mActiveSyncPort = temp->getRemotePortPWM();
mActiveSyncIP = temp->getRemoteIPPWM();
}
syncPi();
while ( !mPisyncFinished ) {
@@ -685,97 +685,97 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
}
QString preCommand;
QString localTempFile;
QString postCommand;
switch(mTargetApp)
{
case (KAPI):
preCommand = prof->getPreSyncCommandAB();
postCommand = prof->getPostSyncCommandAB();
localTempFile = prof->getLocalTempFileAB();
break;
case (KOPI):
preCommand = prof->getPreSyncCommand();
postCommand = prof->getPostSyncCommand();
localTempFile = prof->getLocalTempFile();
break;
case (PWMPI):
preCommand = prof->getPreSyncCommandPWM();
postCommand = prof->getPostSyncCommandPWM();
localTempFile = prof->getLocalTempFilePWM();
break;
default:
- qDebug("KSyncManager::syncRemote: invalid apptype selected");
+ qDebug("KSM::syncRemote: invalid apptype selected");
break;
}
int fi;
if ( (fi = preCommand.find("$PWD$")) > 0 ) {
QString pwd = getPassword();
preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 );
}
int maxlen = 30;
if ( QApplication::desktop()->width() > 320 )
maxlen += 25;
mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) );
int fileSize = 0;
int result = system ( preCommand );
// 0 : okay
// 256: no such file or dir
//
- qDebug("Sync: Remote copy result(0 = okay): %d ",result );
+ qDebug("KSM::Sync: Remote copy result(0 = okay): %d ",result );
if ( result != 0 ) {
unsigned int len = maxlen;
while ( len < preCommand.length() ) {
preCommand.insert( len , "\n" );
len += maxlen +2;
}
question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ;
QMessageBox::information( mParent, i18n("Sync - ERROR"),
question,
i18n("Okay!")) ;
mParent->topLevelWidget()->setCaption ("KDE-Pim");
return;
}
mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) );
//qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
if ( syncWithFile( localTempFile, true ) ) {
if ( mWriteBackFile ) {
int fi;
if ( (fi = postCommand.find("$PWD$")) > 0 ) {
QString pwd = getPassword();
postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 );
}
mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) );
result = system ( postCommand );
- qDebug("Sync:Writing back file result: %d ", result);
+ qDebug("KSM::Sync:Writing back file result: %d ", result);
if ( result != 0 ) {
mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
return;
} else {
mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) );
}
}
}
return;
}
bool KSyncManager::edit_pisync_options()
{
QDialog dia( mParent, "dia", true );
dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice );
QVBoxLayout lay ( &dia );
lay.setSpacing( 5 );
lay.setMargin( 3 );
QLabel lab1 ( i18n("Password for remote access:"), &dia);
lay.addWidget( &lab1 );
QLineEdit le1 (&dia );
lay.addWidget( &le1 );
QLabel lab2 ( i18n("Remote IP address:"), &dia);
lay.addWidget( &lab2 );
QLineEdit le2 (&dia );
@@ -928,73 +928,73 @@ void KSyncManager::syncKDE()
case (KOPI):
{
#ifdef DESKTOP_VERSION
QString command = qApp->applicationDirPath () + "/kdecaldump";
#else
QString command = "kdecaldump";
#endif
if ( ! QFile::exists ( command ) )
command = "kdecaldump";
QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics";
system ( command.latin1());
if ( syncWithFile( fileName,true ) ) {
if ( mWriteBackFile ) {
command += " --read";
system ( command.latin1());
}
}
}
break;
case (PWMPI):
break;
default:
- qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
+ qDebug("KSM::slotSyncMenu: invalid apptype selected");
break;
}
}
void KSyncManager::syncSharp()
{
if ( ! syncExternalApplication("sharp") )
- qDebug("ERROR sync sharp ");
+ qDebug("KSM::ERROR sync sharp ");
}
bool KSyncManager::syncExternalApplication(QString resource)
{
emit save();
if ( mAskForPreferences )
if ( !edit_sync_options()) {
mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
return false;
}
- qDebug("Sync extern %s", resource.latin1());
+ qDebug("KSM::Sync extern %s", resource.latin1());
bool syncOK = mImplementation->syncExternal(this, resource);
return syncOK;
}
void KSyncManager::syncPhone()
{
syncExternalApplication("phone");
}
void KSyncManager::showProgressBar(int percentage, QString caption, int total)
{
if (!bar->isVisible())
{
bar->setCaption (caption);
bar->setTotalSteps ( total ) ;
bar->show();
}
bar->raise();
bar->setProgress( percentage );
@@ -1099,73 +1099,73 @@ void KSyncManager::readFileFromSocket()
}
KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this );
connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
if ( mWriteBackFile )
commandSocket->writeFile( fileName );
else {
commandSocket->sendStop();
mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
mPisyncFinished = true;
}
}
KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name )
{
mPassWord = pw;
mSocket = 0;
mSyncActionDialog = 0;
blockRC = false;
};
void KServerSocket::newConnection ( int socket )
{
// qDebug("KServerSocket:New connection %d ", socket);
if ( mSocket ) {
- qDebug("KServerSocket::newConnection Socket deleted! ");
+ qDebug("KSS::newConnection Socket deleted! ");
delete mSocket;
mSocket = 0;
}
mSocket = new QSocket( this );
connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
mSocket->setSocket( socket );
}
void KServerSocket::discardClient()
{
//qDebug(" KServerSocket::discardClient()");
if ( mSocket ) {
delete mSocket;
mSocket = 0;
}
//emit endConnect();
}
void KServerSocket::readClient()
{
if ( blockRC )
return;
if ( mSocket == 0 ) {
- qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 ");
+ qDebug("ERROR::KSS::readClient(): mSocket == 0 ");
return;
}
//qDebug("KServerSocket::readClient()");
if ( mSocket->canReadLine() ) {
QString line = mSocket->readLine();
//qDebug("KServerSocket readline: %s ", line.latin1());
QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line );
if ( tokens[0] == "GET" ) {
if ( tokens[1] == mPassWord ) {
//emit sendFile( mSocket );
bool ok = false;
QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok);
if ( ok ) {
KSyncManager::mRequestedSyncEvent = dt;
}
else
KSyncManager::mRequestedSyncEvent = QDateTime();
send_file();
}
else {
KMessageBox::error( 0, i18n("Got send file request\nwith invalid password"));
//qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() );
}
}
@@ -1198,49 +1198,49 @@ void KServerSocket::send_file()
delete mSyncActionDialog;
mSyncActionDialog = new QDialog ( 0, "input-dialog", true );
mSyncActionDialog->setCaption(i18n("Received sync request"));
QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog );
label->setAlignment ( Qt::AlignHCenter );
QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog );
lay->addWidget( label);
lay->setMargin(7);
lay->setSpacing(7);
if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent );
if ( secs < 0 )
secs = secs * (-1);
if ( secs > 30 )
//if ( true )
{
QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs );
QLabel* label = new QLabel( warning, mSyncActionDialog );
label->setAlignment ( Qt::AlignHCenter );
lay->addWidget( label);
if ( secs > 180 )
{
if ( secs > 300 ) {
if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\n of more than 5 minutes.\nPlease adjust your clocks.\n<b>You may get wrong syncing results!<\b>\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) {
- qDebug("cancelled ");
+ qDebug("KSS::Sync cancelled ,cs");
return ;
}
}
QFont f = label->font();
f.setPointSize ( f.pointSize() *2 );
f. setBold (true );
QLabel* label = new QLabel( warning, mSyncActionDialog );
label->setFont( f );
warning = i18n("ADJUST\nYOUR\nCLOCKS!");
label->setText( warning );
label->setAlignment ( Qt::AlignHCenter );
lay->addWidget( label);
mSyncActionDialog->setFixedSize( 230, 300);
} else {
mSyncActionDialog->setFixedSize( 230, 200);
}
} else {
mSyncActionDialog->setFixedSize( 230, 120);
}
} else
mSyncActionDialog->setFixedSize( 230, 120);
mSyncActionDialog->show();
mSyncActionDialog->raise();
emit request_file();
@@ -1444,42 +1444,42 @@ void KCommandSocket::readFileFromSocket()
deleteSocket();
return ;
}
// mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
QTextStream ts ( &file );
ts.setEncoding( QTextStream::Latin1 );
ts << mFileString;
file.close();
mFileString = "";
mRetVal = successR;
mSocket->close();
// if state is not idle, deleteSocket(); is called via
// connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
if ( mSocket->state() == QSocket::Idle )
deleteSocket();
}
void KCommandSocket::deleteSocket()
{
//qDebug("KCommandSocket::deleteSocket() ");
if ( mTimerSocket->isActive () ) {
mTimerSocket->stop();
mRetVal = errorTO;
- qDebug("Connection to remote host timed out");
+ qDebug("KCS::Connection to remote host timed out");
if ( mSocket ) {
mSocket->close();
//if ( mSocket->state() == QSocket::Idle )
// deleteSocket();
delete mSocket;
mSocket = 0;
}
KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host? "));
emit commandFinished( this, mRetVal );
return;
}
//qDebug("KCommandSocket::deleteSocket() %d", mRetVal );
if ( mSocket)
delete mSocket;
mSocket = 0;
emit commandFinished( this, mRetVal );
}