from class AddressBook: (header)
{
public:
  // other methods:
  bool importVCard(const string&); // filename
  bool importVCard(const char* text); // from data
public slots:
  void importVCard();
protected:
  void kfmJobDone();
}

from addressbook.cc:

bool AddressBook::importVCard(const string& filename)
{
  ID(bool GUARD=false);
  LG(GUARD, "AddressBook::importVCard: trying to import "
     "vcard file.\n");
  // ########################################################
  Entry entry;
  ifstream file(filename.c_str());
  if(!file.good())
    {
      LG(GUARD, "AddressBook::importVCard: error opening "
	 "file \"%s\".\n", filename.c_str());
      return false;
    }
  L("AddressBook::importVCard: partly not implemented.\n");
  return false;
  // ########################################################
}

void AddressWidget::importVCard()
{
  ID(bool GUARD=false);
  LG(GUARD, "AddressWidget::importVCard: trying to import "
     "vcard.\n");
  // ########################################################
  string filename;
  QString temp=QFileDialog::getOpenFileName();
  if(!temp.isNull()) 
    {
      filename=temp;
      LG(GUARD, "AddressWidget::importVCard: reading from "
	 "file \"%s\".\n", filename.c_str());
      if(!AddressBook::importVCard(filename))
	{
	  qApp->beep();
	  QMessageBox::information
	    (this, i18n("Error"), 
	     i18n("Could not import vCard."));
	}
    } else {
      qApp->beep();
    }
  // ########################################################
}

void AddressWidget::kfmJobDone()
{
  ID(bool GUARD=false);
  // ########################################################
  LG(GUARD, "AddressWidget::kfmJobDone: job done.\n");
  if(AddressBook::importVCard(tmpFile))
    {
      LG(GUARD, "AddressWidget::kfmJobDone: "
	 "successfully imported vcard.\n");
    } else {
      QMessageBox::information
	(this, i18n("Error"),
	 i18n("The file you dropped could not be "
	      "translated to an addressbook entry."));
    }
  ::remove(tmpFile.c_str());
  delete kfm; kfm=0;
  tmpFile="";
  // ########################################################
}


void AddressWidget::dropAction(KDNDDropZone* zone)
{
  ID(bool GUARD=false);
  // ########################################################
  LG(GUARD, "AddressWidget::dropAction: got drop event.\n");
  switch(zone->getDataType()) // do I need this?
    { // WORK_TO_DO: handle lists of URLs here
    case DndURL:
      LG(GUARD, "AddressWidget::dropAction: "
	 "dropped data is an URL.\n");
      if(kfm==0)
	{
	  string temp="file:";
	  char* name;
	  LG(GUARD, "AddressWidget::dropAction: no job "
	     "running.\n");
	  CHECK(tmpFile.empty());
	  name=tempnam(0, "advc");
	  if(name==0)
	    {
	      QMessageBox::information
		(this, i18n("Error"),
		 i18n("Could not create a temporary file."));
	    break;
	    }		       
	  tmpFile=name; 
	  free(name); // avoid memory leaks
	  CHECK(!tmpFile.empty());
	  temp+=tmpFile;
	  LG(GUARD, "AddressWidget::dropAction: using "
	     "temporary URL \"%s\".\n", temp.c_str());
	  kfm=new KFM;
	  CHECK(kfm!=0);
	  connect(kfm, SIGNAL(finished()), 
		  this, SLOT(kfmJobDone()));
	  kfm->copy(zone->getData(), temp.c_str());
	  // the rest is done in kfmJobDone
	} else {
	  QMessageBox::information
	    (this, i18n("Busy"), 
	     i18n
	     ("Sorry, the vcard importer is busy!\n"
	      "Only one vCard can be imported in one time."));
	}
      break;
    case DndText:
      LG(GUARD, "AddressWidget::dropAction: "
	 "dropped data is text.\n");
      break;
    default:
      LG(GUARD, "AddressWidget::dropAction: "
	 "unable to find type of dropped data.\n");
    }
  const char* data;
  data=zone->getData();
  LG(GUARD, "AddressWidget::dropAction: data is \"%s\".\n",
     data);
  // ########################################################
}
  
