summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/addressbook.cpp
Side-by-side diff
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
@@ -200,24 +200,30 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
a->addTo( edit );
a->addTo( listTools );
}
edit->insertSeparator();
a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null,
0, this, 0);
actionPersonal = a;
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" ),
QString::null, 0, this, 0 , TRUE );
actionPersonal = a;
connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) );
a->addTo( edit );
#ifdef __DEBUG_RELEASE
// Remove this function for public Release ! This is only
// for debug purposes ..
@@ -322,24 +328,48 @@ void AddressbookWindow::slotSetFont( int size )
}
}
void AddressbookWindow::importvCard() {
QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this );
if(!str.isEmpty() ){
setDocument((const QString&) str );
}
}
+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 )
{
qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() );
if ( filename.find(".vcf") != int(filename.length()) - 4 ){
switch( QMessageBox::information( this, tr ( "Right file type ?" ),
tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ),
tr( "&Yes" ), tr( "&No" ), QString::null,