[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdepim/kresources
From: Reinhold Kainhofer <reinhold () kainhofer ! com>
Date: 2005-01-16 22:49:23
Message-ID: 20050116224923.F0E3D1CFBD () office ! kde ! org
[Download RAW message or body]
CVS commit by kainhofe:
Remember which job uploaded which item (uid), so we can remove the item from the \
local cache after the upload succeeded.
M +32 -8 lib/groupwaredataadaptor.cpp 1.8
M +4 -0 lib/groupwaredataadaptor.h 1.7
M +2 -2 newexchange/exchangecalendaradaptor.cpp 1.9
--- kdepim/kresources/lib/groupwaredataadaptor.cpp #1.7:1.8
@@ -102,7 +102,9 @@ KIO::TransferJob *GroupwareDataAdaptor::
GroupwareUploadItem *item )
{
- if ( item )
- return item->createUploadJob( this, url );
- else return 0;
+ if ( item ) {
+ KIO::TransferJob *job = item->createUploadJob( this, url );
+ setUidForJob( job, item->uid() );
+ return job;
+ } else return 0;
}
@@ -111,7 +113,9 @@ KIO::TransferJob *GroupwareDataAdaptor::
{
kdDebug()<<"GroupwareDataAdaptor::createUploadNewJob, url=" << url.url() << endl;
- if ( item )
- return item->createUploadNewJob( this, url );
- else return 0;
+ if ( item ) {
+ KIO::TransferJob *job = item->createUploadNewJob( this, url );
+ setUidForJob( job, item->uid() );
+ return job;
+ } else return 0;
}
@@ -192,5 +196,5 @@ bool GroupwareDataAdaptor::interpretUplo
// We don't know the local id here (and we don't want to extract it from
// the idMapper, that's the task of the receiver
- emit itemUploaded( QString::null, url.url() );
+ emit itemUploaded( uidFromJob( job ), url.url() );
}
return true;
@@ -215,5 +219,5 @@ bool GroupwareDataAdaptor::interpretUplo
// We don't know the local id here (and we don't want to extract it from
// the idMapper, that's the task of the receiver
- emit itemUploadedNew( QString::null, url.url() );
+ emit itemUploadedNew( uidFromJob( job ), url.url() );
}
return true;
@@ -223,4 +227,24 @@ bool GroupwareDataAdaptor::interpretUplo
}
+QString GroupwareDataAdaptor::uidFromJob( KIO::Job *job ) const
+{
+kdDebug()<<"GroupwareDataAdaptor::uidFromJob( "<<job<<")"<<endl;
+ if ( mJobUIDMap.contains( job ) ) {
+ kdDebug()<<" Contained: "<< mJobUIDMap[job] << endl;
+ return mJobUIDMap[ job ];
+ } else {
+ return QString::null;
+ }
+}
+
+void GroupwareDataAdaptor::setUidForJob( KIO::Job *job, const QString &uid )
+{
+ if ( uid.isEmpty() ) {
+ mJobUIDMap.remove( job );
+ } else {
+ mJobUIDMap[ job ] = uid;
+ }
+}
+
#include "groupwaredataadaptor.moc"
--- kdepim/kresources/lib/groupwaredataadaptor.h #1.6:1.7
@@ -296,4 +296,7 @@ Q_OBJECT
return QString::null;
}
+ virtual QString uidFromJob( KIO::Job *job ) const;
+ virtual void setUidForJob( KIO::Job *job, const QString &uid );
+
enum {
@@ -336,4 +339,5 @@ Q_OBJECT
QString mPassword;
KPIM::IdMapper *mIdMapper;
+ QMap<KIO::Job*,QString> mJobUIDMap;
};
--- kdepim/kresources/newexchange/exchangecalendaradaptor.cpp #1.8:1.9
@@ -138,5 +138,5 @@ bool ExchangeCalendarAdaptor::interpretU
// We don't know the local id here (and we don't want to extract it from
// the idMapper, that's the task of the receiver
- emit itemUploaded( QString::null, url.url() );
+ emit itemUploaded( uidFromJob( job ), url.url() );
}
return true;
@@ -166,5 +166,5 @@ bool ExchangeCalendarAdaptor::interpretU
// We don't know the local id here (and we don't want to extract it from
// the idMapper, that's the task of the receiver
- emit itemUploadedNew( QString::null, url.url() );
+ emit itemUploadedNew( uidFromJob( job ), url.url() );
}
return true;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic