[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdepim/kresources/opengroupware
From: Till Adam <adam () kde ! org>
Date: 2004-10-31 23:10:09
Message-ID: 20041031231009.C1CB016C68 () office ! kde ! org
[Download RAW message or body]
CVS commit by tilladam:
Cleanup, only accept text/calendar.
M +17 -12 kcal_resourceopengroupware.cpp 1.17
M +0 -2 kcal_resourceopengroupware.h 1.8
--- kdepim/kresources/opengroupware/kcal_resourceopengroupware.cpp #1.16:1.17
@@ -171,5 +171,4 @@ bool OpenGroupware::doLoad()
mIncidencesForDownload.clear();
- mVersionsPendingDownload.clear();
mProgress = KPIM::ProgressManager::instance()->createProgressItem(
@@ -255,8 +254,8 @@ void OpenGroupware::slotListJobResult( K
i = mCalendar.incidence( localId );
if ( !i ) {
- kdDebug(7000) << "Not locally present, download: " << location << endl;
+ //kdDebug(7000) << "Not locally present, download: " << location << endl;
download = true;
} else {
- kdDebug(7000) << "Locally present " << endl;
+ //kdDebug(7000) << "Locally present " << endl;
/* locally present, let's check if it's newer than what we have */
const QString &oldFingerprint = idMapper().fingerprint( i->uid() );
@@ -273,10 +272,9 @@ void OpenGroupware::slotListJobResult( K
}
} else {
- kdDebug(7000) << "Fingerprint did not change, don't download this one " << endl;
+ //kdDebug(7000) << "Fingerprint did not change, don't download this one " << endl;
}
}
if ( download ) {
mIncidencesForDownload << entry;
- mVersionsPendingDownload.insert( location, newFingerprint );
}
}
@@ -304,5 +302,6 @@ void OpenGroupware::downloadNextIncidenc
mDownloadJob = KIO::get( url, false, false );
- mDownloadJob->addMetaData( "PropagateHTTPHeader", "true" );
+ mDownloadJob->addMetaData( "accept", "text/calendar" );
+ mDownloadJob->addMetaData( "PropagateHttpHeader", "true" );
connect( mDownloadJob, SIGNAL( result( KIO::Job * ) ),
SLOT( slotJobResult( KIO::Job * ) ) );
@@ -340,7 +339,16 @@ void OpenGroupware::slotUploadJobResult(
}
+
+static const QString getEtagFromHeaders( const QString& headers )
+{
+ kdDebug(5006) << "HEADERS " << headers << endl;
+ int start = headers.find( "etag:" );
+ start += 6;
+ return headers.mid( start, headers.find( "\n", start ) - start );
+}
+
void OpenGroupware::slotJobResult( KIO::Job *job )
{
-// kdDebug() << "OpenGroupware::slotJobResult(): " << endl;
+ kdDebug() << "OpenGroupware::slotJobResult(): " << endl;
if ( job->error() ) {
@@ -350,5 +358,5 @@ void OpenGroupware::slotJobResult( KIO::
} else {
const QString& headers = job->queryMetaData( "HTTP-Headers" );
- kdDebug(7000) << "HEADERS: " << endl << headers << endl;
+ const QString& etag = getEtagFromHeaders( headers );
CalendarLocal calendar;
ICalFormat ical;
@@ -368,7 +376,5 @@ void OpenGroupware::slotJobResult( KIO::
i->setUid( local );
}
- assert( mVersionsPendingDownload.contains( remote ) );
- idMapper().setFingerprint( i->uid(), mVersionsPendingDownload[ remote ] );
- // TODO verify the downloaded version matches
+ idMapper().setFingerprint( i->uid(), etag );
i->setCustomProperty( "KCalResourceOpengroupware", "storagelocation" , remote );
// if it's already there, we uploaded or changed it
@@ -376,5 +382,4 @@ void OpenGroupware::slotJobResult( KIO::
disableChangeNotification();
addIncidence( i );
- kdDebug(7000) << "Added incidence: " << i->uid() << endl;
enableChangeNotification();
}
--- kdepim/kresources/opengroupware/kcal_resourceopengroupware.h #1.7:1.8
@@ -112,6 +112,4 @@ class OpenGroupware : public ResourceCac
QStringList mIncidencesForDeletion;
- QMap<QString, QString> mVersionsPendingDownload;
-
QString mCurrentGetUrl;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic