From kde-pim Sun Jun 26 17:20:54 2005 From: Kevin Krammer Date: Sun, 26 Jun 2005 17:20:54 +0000 To: kde-pim Subject: Re: [Kde-pim] Possible unwanted behaviour of the KABC API Message-Id: <200506261921.00602.kevin.krammer () gmx ! at> X-MARC-Message: https://marc.info/?l=kde-pim&m=111980649822384 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0471949177==" --===============0471949177== Content-Type: multipart/signed; boundary="nextPart1160272.HD67uvS2Fp"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart1160272.HD67uvS2Fp Content-Type: multipart/mixed; boundary="Boundary-01=_3PuvC6YR0s8jvV/" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_3PuvC6YR0s8jvV/ Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Tuesday 21 June 2005 23:18, Kevin Krammer wrote: I hope no response doesn't mean I am caught in your spamfilters :( > I changed to synchronous loading, but I am curious if I misunderstood the > meaning of the signal and if I should have used a different one. I did some further investigation using a small test program (attached). Actually KABC loads the file resource but as the resource says it failed to= =20 open it doesn get connected and thus no signals are emitted. =2Drw-r--r-- 1 kdedev kdedev 9957 Jun 2 12:54 std.vcf kdedev@poseidon:~$ ./kabcloading 2>/dev/null Received loadingFinished signal Number of available addressees: 43 Received addressBookChanged signal Number of available addressees: 43 =2Dr--r--r-- 1 kdedev kdedev 10005 Jun 26 19:11 std.vcf kdedev@poseidon:~$ ./kabcloading 2>/dev/null Waiting for signals timed out Number of available addressees: 43 One of the implications is that even kaddressbook fails to list the address= ees=20 if the only resource is a file resource and its file is not writable! I don't know enough of the KABC and KResource stuff to actually propose a=20 proper fix, but I gathered a couple of ideas: =2D connect signal even when open() fails =2D let plugins/file/resourcefile open ReadOnly if readOnly()=20 || !QFileInfo::isWritable =2D overwrite Resource::readOnly to perform that check =2D emit the signal anyway if no resource could be opened Cheers, Kevin =2D-=20 Kevin Krammer Qt/KDE Developer, Debian User Moderator: www.mrunix.de (German), www.qtforum.org --Boundary-01=_3PuvC6YR0s8jvV/ Content-Type: text/x-c++src; charset="iso-8859-15"; name="kabcloading.cpp" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="kabcloading.cpp" #include #include #include #include #include #include using namespace KABC; class Receiver : public QObject { Q_OBJECT public: Receiver(KABC::AddressBook* ab) : addressBook(ab) { QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(slotTimeout(= ))); timer.start(5000, true); =20 QObject::connect(ab, SIGNAL(addressBookChanged(AddressBook*)), this, SLOT(slotAddressBookChanged())); QObject::connect(ab, SIGNAL(addressBookLocked(AddressBook*)), this, SLOT(slotAddressBookLocked())); QObject::connect(ab, SIGNAL(addressBookUnlocked(AddressBook*)), this, SLOT(slotAddressBookUnlocked())); QObject::connect(ab, SIGNAL(loadingFinished(Resource*)), this, SLOT(slotLoadingFinished())); QObject::connect(ab, SIGNAL(savingFinished(Resource*)), this, SLOT(slotSavingFinished())); } =20 private: void printAddresseeCount() { std::cout << "Number of available addressees: " << addressBook->all= Addressees().count() << std::endl; } =20 private slots: void slotTimeout() { std::cout << "Waiting for signals timed out" << std::endl; printAddresseeCount(); KApplication::kApplication()->quit(); } =20 =20 void slotAddressBookChanged() { std::cout << "Received addressBookChanged signal" << std::endl; printAddresseeCount(); KApplication::kApplication()->quit(); } =20 void slotAddressBookLocked() { std::cout << "Received addressBookLocked signal" << std::endl; printAddresseeCount(); } void slotAddressBookUnlocked() { std::cout << "Received addressBookUnlocked signal" << std::endl; printAddresseeCount(); } void slotLoadingFinished() { std::cout << "Received loadingFinished signal" << std::endl; printAddresseeCount(); } void slotSavingFinished() { std::cout << "Received savingFinished signal" << std::endl; printAddresseeCount(); } =20 private: QTimer timer; KABC::AddressBook* addressBook; }; int main(int argc, char** argv) { KAboutData about("kabcloading", "kabcloading", "0.1"); KCmdLineArgs::init(argc, argv, &about); KApplication app(false, false); Receiver receiver(StdAddressBook::self(true)); return app.exec(); =20 } #include "kabcloading.moc" // End of file --Boundary-01=_3PuvC6YR0s8jvV/-- --nextPart1160272.HD67uvS2Fp Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQBCvuP8nKMhG6pzZJIRAu7CAJ9/KGTbBkayXgHv+b6Mwam0U9BrCgCdE0ib 4eDHUl3MW0sZ5+IaF2tMfe8= =eASp -----END PGP SIGNATURE----- --nextPart1160272.HD67uvS2Fp-- --===============0471949177== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kde-pim mailing list kde-pim@kde.org https://mail.kde.org/mailman/listinfo/kde-pim kde-pim home page at http://pim.kde.org/ --===============0471949177==--