From f0d3ff51dde49f994783827051464920529024af Mon Sep 17 00:00:00 2001 From: eilers Date: Wed, 02 Apr 2003 14:22:18 +0000 Subject: Fix bug #791 (Misbehaviour of contacteditor: The main tab is active for every new entry) Export to VCard added. Edit:Save removed (Was just for testing purposes) --- (limited to 'core/pim/addressbook/addressbook.cpp') diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index a5bf19b..89a3312 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -209,6 +209,12 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); a->addTo( edit ); + a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), QString::null, + 0, this, 0); + actionPersonal = a; + connect( a, SIGNAL( activated() ), this, SLOT( exportvCard() ) ); + a->addTo( edit ); + edit->insertSeparator(); a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), @@ -331,6 +337,30 @@ void AddressbookWindow::importvCard() { } } +void AddressbookWindow::exportvCard() +{ + qWarning(" void AddressbookWindow::exportvCard()"); + QString filename = OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this ); + if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){ + qWarning(" Save to file %s, (%d)", filename.latin1(), filename.length()-1 ); + OContact curCont = m_abView->currentEntry(); + if ( !curCont.isEmpty() ){ + OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, + filename ); + OContactAccess* access = new OContactAccess ( "addressbook_exp", QString::null , vcard_backend, true ); + if ( access ){ + access->add( curCont ); + access->save(); + } + delete access; + }else + QMessageBox::critical( 0, "Export VCard", + QString( tr( "You have to select a contact !") ) ); + + }else + QMessageBox::critical( 0, "Export VCard", + QString( tr( "You have to set a filename !") ) ); +} void AddressbookWindow::setDocument( const QString &filename ) { -- cgit v0.9.0.2