summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/addressbook.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp30
1 files changed, 30 insertions, 0 deletions
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
@@ -206,12 +206,18 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
206 a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null, 206 a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null,
207 0, this, 0); 207 0, this, 0);
208 actionPersonal = a; 208 actionPersonal = a;
209 connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); 209 connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) );
210 a->addTo( edit ); 210 a->addTo( edit );
211 211
212 a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), QString::null,
213 0, this, 0);
214 actionPersonal = a;
215 connect( a, SIGNAL( activated() ), this, SLOT( exportvCard() ) );
216 a->addTo( edit );
217
212 edit->insertSeparator(); 218 edit->insertSeparator();
213 219
214 a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), 220 a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ),
215 QString::null, 0, this, 0 , TRUE ); 221 QString::null, 0, this, 0 , TRUE );
216 actionPersonal = a; 222 actionPersonal = a;
217 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); 223 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) );
@@ -328,12 +334,36 @@ void AddressbookWindow::importvCard() {
328 QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); 334 QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this );
329 if(!str.isEmpty() ){ 335 if(!str.isEmpty() ){
330 setDocument((const QString&) str ); 336 setDocument((const QString&) str );
331 } 337 }
332 338
333} 339}
340void AddressbookWindow::exportvCard()
341{
342 qWarning(" void AddressbookWindow::exportvCard()");
343 QString filename = OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this );
344 if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){
345 qWarning(" Save to file %s, (%d)", filename.latin1(), filename.length()-1 );
346 OContact curCont = m_abView->currentEntry();
347 if ( !curCont.isEmpty() ){
348 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
349 filename );
350 OContactAccess* access = new OContactAccess ( "addressbook_exp", QString::null , vcard_backend, true );
351 if ( access ){
352 access->add( curCont );
353 access->save();
354 }
355 delete access;
356 }else
357 QMessageBox::critical( 0, "Export VCard",
358 QString( tr( "You have to select a contact !") ) );
359
360 }else
361 QMessageBox::critical( 0, "Export VCard",
362 QString( tr( "You have to set a filename !") ) );
363}
334 364
335void AddressbookWindow::setDocument( const QString &filename ) 365void AddressbookWindow::setDocument( const QString &filename )
336{ 366{
337 qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); 367 qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() );
338 368
339 if ( filename.find(".vcf") != int(filename.length()) - 4 ){ 369 if ( filename.find(".vcf") != int(filename.length()) - 4 ){