[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdepim/kresources/kolab/kabc
From: David Faure <faure () kde ! org>
Date: 2007-05-06 22:53:22
Message-ID: 1178492002.901489.23510.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 661907 by dfaure:
Backport from enterprise r661904
When loading a large contacts folder, show one progress dialog instead of three. \
(minor speed improvement too) Making it really faster (loading the mails once instead \
of 3 times) would involve making the kmail dcop interface more complex...
M +24 -19 resourcekolab.cpp
M +0 -1 resourcekolab.h
--- branches/KDE/3.5/kdepim/kresources/kolab/kabc/resourcekolab.cpp #661906:661907
@@ -174,20 +174,17 @@
return addr.uid();
}
-bool KABC::ResourceKolab::loadSubResource( const QString& subResource )
+static const struct { const char* mimetype; KMailICalIface::StorageFormat format; } \
s_formats[] = {
- bool kolabcontacts = loadSubResourceHelper( subResource, \
s_attachmentMimeTypeContact, KMailICalIface::StorageXML );
- bool kolabdistlists = loadSubResourceHelper( subResource, \
s_attachmentMimeTypeDistList, KMailICalIface::StorageXML );
- bool vcardstyle = loadSubResourceHelper( subResource, s_inlineMimeType, \
KMailICalIface::StorageIcalVcard );
- return kolabcontacts && kolabdistlists && vcardstyle;
-}
+ { s_attachmentMimeTypeContact, KMailICalIface::StorageXML },
+ { s_attachmentMimeTypeDistList, KMailICalIface::StorageXML },
+ { s_inlineMimeType, KMailICalIface::StorageIcalVcard }
+};
-bool KABC::ResourceKolab::loadSubResourceHelper( const QString& subResource,
- const char* mimetype,
- KMailICalIface::StorageFormat \
format ) +bool KABC::ResourceKolab::loadSubResource( const QString& subResource )
{
int count = 0;
- if ( !kmailIncidencesCount( count, mimetype, subResource ) ) {
+ if ( !kmailIncidencesCount( count, QString::null, subResource ) ) {
kdError() << "Communication problem in \
KABC::ResourceKolab::loadSubResourceHelper()\n"; return false;
}
@@ -210,17 +207,25 @@
}
for ( int startIndex = 0; startIndex < count; startIndex += nbMessages ) {
- QMap<Q_UINT32, QString> lst;
- if ( !kmailIncidences( lst, mimetype, subResource, startIndex, nbMessages ) ) {
- kdError() << "Communication problem in ResourceKolab::load()\n";
- if ( progressId )
- uiserver.jobFinished( progressId );
- return false;
- }
+ // TODO it would be faster to pass the s_formats array to kmail and let it load
+ // all events - to avoid loading each mail 3 times. But then we need to extend \
the returned + // QMap to also tell us the StorageFormat of each found contact...
+ for ( int indexFormat = 0; indexFormat < 3; ++indexFormat ) {
+ const char* mimetype = s_formats[indexFormat].mimetype;
+ KMailICalIface::StorageFormat format = s_formats[indexFormat].format;
+ QMap<Q_UINT32, QString> lst;
+ if ( !kmailIncidences( lst, mimetype, subResource, startIndex, nbMessages ) ) \
{ + kdError() << "Communication problem in \
KABC::ResourceKolab::loadSubResource()\n"; + if ( progressId )
+ uiserver.jobFinished( progressId );
+ return false;
+ }
- for( QMap<Q_UINT32, QString>::ConstIterator it = lst.begin(); it != lst.end(); \
++it ) {
- loadContact( it.data(), subResource, it.key(), format );
+ for( QMap<Q_UINT32, QString>::ConstIterator it = lst.begin(); it != lst.end(); \
++it ) { + loadContact( it.data(), subResource, it.key(), format );
+ }
+
}
if ( progressId ) {
uiserver.processedFiles( progressId, startIndex );
--- branches/KDE/3.5/kdepim/kresources/kolab/kabc/resourcekolab.h #661906:661907
@@ -150,7 +150,6 @@
void loadSubResourceConfig( KConfig& config, const QString& name,
const QString& label, bool writable );
bool loadSubResource( const QString& subResource );
- bool loadSubResourceHelper( const QString& subResource, const char* mimetype, \
KMailICalIface::StorageFormat format ); QString loadContact( const QString& \
contactData, const QString& subResource,
Q_UINT32 sernum, const KMailICalIface::StorageFormat format \
);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic