Version: (using KDE KDE 3.2.0) Installed from: Mandrake RPMs dragging and dropping a contact to the Desktop or a Konqueror window should save it as vCard
Subject: kdepim/kaddressbook CVS commit by tokoe: Add Drag&Drop support, now you can export a vCard by just drag them from KAddressBook to KDesktop, Konqueror or any other application. CCMAIL:74206-done@bugs.kde.org M +22 -1 viewmanager.cpp 1.103 --- kdepim/kaddressbook/viewmanager.cpp #1.102:1.103 @@ -22,4 +22,5 @@ */ +#include <qfile.h> #include <qlayout.h> #include <qwidgetstack.h> @@ -36,4 +37,5 @@ #include <kmessagebox.h> #include <kmultipledrag.h> +#include <ktempdir.h> #include <ktrader.h> #include <kurldrag.h> @@ -431,9 +433,28 @@ void ViewManager::startDrag() KMultipleDrag *drag = new KMultipleDrag( this ); - drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToEmails( addrList ), this ) ); KABC::VCardConverter converter; QString vcards = converter.createVCards( addrList ); + + KTempDir tempDir; + if ( tempDir.status() == 0 ) { + QString fileName; + if ( addrList.count() == 1 ) + fileName = addrList[ 0 ].givenName() + "_" + addrList[ 0 ].familyName() + ".vcf"; + else + fileName = "contacts.vcf"; + + QFile tempFile( tempDir.name() + "/" + fileName ); + if ( tempFile.open( IO_WriteOnly ) ) { + tempFile.writeBlock( vcards.utf8() ); + tempFile.close(); + + KURLDrag *urlDrag = new KURLDrag( KURL( tempFile.name() ), this ); + drag->addDragObject( urlDrag ); + } + } + drag->addDragObject( new KVCardDrag( vcards, this ) ); + drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToEmails( addrList ), this ) ); drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) );
The development of the old KAddressBook will be discontinued for KDE 4.4. Since the new application has the same name, but a completly new code base we close all bug reports against the old version and ask the submitters to resend there reports against the new product.