summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-10-07 01:10:30 (UTC)
committer ulf69 <ulf69>2004-10-07 01:10:30 (UTC)
commitf434ef382b60c1a420dd0e037d119d082e478491 (patch) (unidiff)
treec68247486b6f714d0d8e01d8b503a4d36c9325e3
parent3338b7239dc2e5cdff95ebc76b6905e6385a5833 (diff)
downloadkdepimpi-f434ef382b60c1a420dd0e037d119d082e478491.zip
kdepimpi-f434ef382b60c1a420dd0e037d119d082e478491.tar.gz
kdepimpi-f434ef382b60c1a420dd0e037d119d082e478491.tar.bz2
added methods to collect birthday data via QCop (from kopi)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp69
-rw-r--r--kaddressbook/kabcore.h1
2 files changed, 70 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 9041e45..d9eb391 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -295,2 +295,3 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
295 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 295 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
296 297
@@ -2157,2 +2158,70 @@ void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QSt
2157 2158
2159/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2160 * to put them into the calendar.
2161 */
2162void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2163{
2164 // qDebug("KABCore::requestForBirthdayList");
2165 QStringList birthdayList;
2166 QStringList anniversaryList;
2167 QStringList realNameList;
2168 QStringList preferredEmailList;
2169 QStringList assembledNameList;
2170 QStringList uidList;
2171
2172 KABC::AddressBook::Iterator it;
2173
2174 int count = 0;
2175 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2176 ++count;
2177 }
2178 QProgressBar bar(count,0 );
2179 int w = 300;
2180 if ( QApplication::desktop()->width() < 320 )
2181 w = 220;
2182 int h = bar.sizeHint().height() ;
2183 int dw = QApplication::desktop()->width();
2184 int dh = QApplication::desktop()->height();
2185 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2186 bar.show();
2187 bar.setCaption (i18n("collecting birthdays - close to abort!") );
2188 qApp->processEvents();
2189
2190 QDate bday;
2191 QString anni;
2192 QString formattedbday;
2193
2194 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2195 {
2196 if ( ! bar.isVisible() )
2197 return;
2198 bar.setProgress( count++ );
2199 qApp->processEvents();
2200 bday = (*it).birthday().date();
2201 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2202
2203 if ( bday.isValid() || !anni.isEmpty())
2204 {
2205 if (bday.isValid())
2206 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2207 else
2208 formattedbday = "NOTVALID";
2209 if (anni.isEmpty())
2210 anni = "INVALID";
2211
2212 birthdayList.append(formattedbday);
2213 anniversaryList.append(anni); //should be ISODate
2214 realNameList.append((*it).realName());
2215 preferredEmailList.append((*it).preferredEmail());
2216 assembledNameList.append((*it).assembledName());
2217 uidList.append((*it).uid());
2218
2219 qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() );
2220 }
2221 }
2222
2223 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2224
2225}
2226
2158/* this method will be called through the QCop interface from other apps to show details of a contact. 2227/* this method will be called through the QCop interface from other apps to show details of a contact.
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index e6f286b..c9c0d38 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -337,2 +337,3 @@ class KABCore : public QWidget, public KSyncInterface
337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
338 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
338 339