Bug 74206 - drag and drop of contact to Desktop should save it as vCard
Summary: drag and drop of contact to Desktop should save it as vCard
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kab3
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Mandrake RPMs Linux
: NOR wishlist
Target Milestone: ---
Assignee: Tobias Koenig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-05 09:01 UTC by Helge Hielscher
Modified: 2009-08-05 16:04 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Helge Hielscher 2004-02-05 09:01:04 UTC
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
Comment 1 Tobias Koenig 2004-02-07 15:12:51 UTC
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 ) );


Comment 2 Tobias Koenig 2009-08-05 16:04:19 UTC
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.