summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp1
-rw-r--r--libkdepim/ksyncprefsdialog.cpp6
2 files changed, 7 insertions, 0 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index cbe2a10..53c079c 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -823,96 +823,97 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
if ( localIsNew )
getEventViewerDialog()->setColorMode( 2 );
else
getEventViewerDialog()->setColorMode( 1 );
getEventViewerDialog()->addIncidence(remote);
getEventViewerDialog()->setColorMode( 0 );
//qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
getEventViewerDialog()->showMe();
result = getEventViewerDialog()->executeS( localIsNew );
return result;
break;
case SYNC_PREF_FORCE_LOCAL:
return 1;
break;
case SYNC_PREF_FORCE_REMOTE:
return 2;
break;
default:
// SYNC_PREF_TAKE_BOTH not implemented
break;
}
return 0;
}
Event* CalendarView::getLastSyncEvent()
{
Event* lse;
//qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
if (!lse) {
lse = new Event();
lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
QString sum = "";
if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
sum = "E: ";
lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
lse->setDtStart( mLastCalendarSync );
lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
lse->setCategories( i18n("SyncEvent") );
lse->setReadOnly( true );
mCalendar->addEvent( lse );
}
return lse;
}
+// probaly useless
void CalendarView::setupExternSyncProfiles()
{
Event* lse;
mExternLastSyncEvent.clear();
int i;
for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) {
lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] );
if ( lse )
mExternLastSyncEvent.append( lse );
else
qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1());
}
}
// we check, if the to delete event has a id for a profile
// if yes, we set this id in the profile to delete
void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
{
if ( ! lastSync.count() == 0 )
return;
if ( toDelete->type() == "Journal" )
return;
Event* eve = lastSync.first();
while ( eve ) {
int id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
if ( id >= 0 ) {
QString des = eve->description();
QString pref = "e";
if ( toDelete->type() == "Todo" )
pref = "t";
des += pref+ QString::number ( id ) + ",";
eve->setReadOnly( false );
eve->setDescription( des );
eve->setReadOnly( true );
}
eve = lastSync.next();
}
}
void CalendarView::checkExternalId( Incidence * inc )
{
QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
checkExternSyncEvent( lastSync, inc );
}
bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 59c8418..67a3f52 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -523,92 +523,98 @@ void KSyncPrefsDialog::cloneProfile()
addProfile (mSyncProfiles.at(currentSelection)->clone()) ;
else
newProfile();
}
void KSyncPrefsDialog::setLocalMachineName ( const QString& name )
{
mMyMachineName->setText( name );
}
QString KSyncPrefsDialog::getLocalMachineName ( )
{
return mMyMachineName->text();
}
QStringList KSyncPrefsDialog::getSyncProfileNames()
{
return mSyncProfileNames;
}
void KSyncPrefsDialog::usrReadConfig()
{
//KConfig *config = KOGlobals::config();
KConfig config ( locateLocal( "config","syncprofilesrc" ) );
config.setGroup("General");
mSyncProfileNames =config.readListEntry("SyncProfileNames");
mMyMachineName->setText(config.readEntry("LocalMachineName","undefined"));
int i;
KSyncProfile* temp ;
mSyncProfiles.clear();
for ( i = 0; i < mSyncProfileNames.count();++i ) {
temp = new KSyncProfile ();
temp->setName( mSyncProfileNames[i] );
temp->readConfig( &config );
mSyncProfiles.append( temp );
}
insertProfiles();
//mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName );
}
void KSyncPrefsDialog::usrWriteConfig()
{
saveProfile();
if ( currentSelection >= 0 )
profileChanged(currentSelection);
//KConfig *config = KOGlobals::config();
KConfig config ( locateLocal( "config","syncprofilesrc" ) );
KSyncProfile* prof = mSyncProfiles.first();
+ QStringList externalSyncProfileNames;
+ externalSyncProfileNames.append("Sharp_DTM");;
while ( prof ) {
prof->writeConfig(&config);
+ if ( prof->getIsPhoneSync( ) )
+ externalSyncProfileNames.append(prof->getName( ) );
prof = mSyncProfiles.next();
}
//KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames;
//KOPrefs::instance()->mLocalMachineName = mMyMachineName->text();
config.setGroup("General");
config.writeEntry("SyncProfileNames",mSyncProfileNames);
+ config.writeEntry("ExternSyncProfiles",externalSyncProfileNames);
config.writeEntry("LocalMachineName",mMyMachineName->text());
+ config.sync();
}
void KSyncPrefsDialog::helpDevice()
{
QString hint = i18n("Insert device where\nphone is connected. E.g.:\n");
#ifdef _WIN32_
hint += "Leave empty for Irda.\n"
"com1:\n(first serial port)\n"
"usb not supported\n"
"???\n(bluetooth device address)\n";
#else
hint += "/dev/ircomm\n(Irda)\n"
"/dev/ttyS0\n(first serial port)\n"
"/dev/ttyUSB0\n(first device usb port)\n"
"???\n(bluetooth device address)\n";
#endif
KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
}
void KSyncPrefsDialog::helpModel()
{
QString hint = i18n("Leave empty or\ninsert name of phone model:\n");
hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection";
KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
}
void KSyncPrefsDialog::helpConnection()
{
QString hint = i18n("Insert kind of connection,e.g.:\n");
hint += "irda | Nokia FBUS over infrared\n"
"irdaat | AT commands infrared\n(for Siemens/Sony-Erricsson)\n"
"irdaobex | set also model as obex\n"
"fbus | Nokia FBUS2 serial\n";
KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
}