kaddressbook Library API Documentation

xxport.cpp

00001 /* 00002 This file is part of KAddressbook. 00003 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 00019 As a special exception, permission is given to link this program 00020 with any edition of Qt, and distribute the resulting executable, 00021 without including the source code for Qt in the source distribution. 00022 */ 00023 00024 #include <qmap.h> 00025 #include <qsignalmapper.h> 00026 00027 #include <kaction.h> 00028 #include <kinstance.h> 00029 #include <kmessagebox.h> 00030 #include "xxport.h" 00031 00032 using namespace KAB; 00033 00034 class XXPort::XXPortPrivate 00035 { 00036 public: 00037 QSignalMapper *mExportMapper; 00038 QSignalMapper *mImportMapper; 00039 }; 00040 00041 XXPort::XXPort( KABC::AddressBook *ab, QWidget *parent, 00042 const char *name ) 00043 : QObject( parent, name ), mAddressBook( ab ), mParentWidget( parent ), 00044 d( new XXPortPrivate ) 00045 { 00046 setInstance( new KInstance( "kaddressbook" ) ); 00047 00048 d->mExportMapper = new QSignalMapper( this ); 00049 d->mImportMapper = new QSignalMapper( this ); 00050 00051 connect( d->mExportMapper, SIGNAL( mapped( const QString& ) ), 00052 SLOT( slotExportActivated( const QString& ) ) ); 00053 connect( d->mImportMapper, SIGNAL( mapped( const QString& ) ), 00054 SLOT( slotImportActivated( const QString& ) ) ); 00055 } 00056 00057 XXPort::~XXPort() 00058 { 00059 delete d; 00060 d = 0; 00061 } 00062 00063 bool XXPort::exportContacts( const KABC::AddresseeList&, const QString& ) 00064 { 00065 // do nothing 00066 return false; 00067 } 00068 00069 KABC::AddresseeList XXPort::importContacts( const QString& ) const 00070 { 00071 // do nothing 00072 return KABC::AddresseeList(); 00073 } 00074 00075 void XXPort::createImportAction( const QString &label, const QString &data ) 00076 { 00077 QString id = "file_import_" + identifier() + ( data.isEmpty() ? QString( "" ) : "_" + data ); 00078 KAction *action = new KAction( label, 0, d->mImportMapper, SLOT( map() ), actionCollection(), id.latin1() ); 00079 00080 d->mImportMapper->setMapping( action, ( data.isEmpty() ? QString( "<empty>" ) : data ) ); 00081 00082 setXMLFile( identifier() + "_xxportui.rc" ); 00083 } 00084 00085 void XXPort::createExportAction( const QString &label, const QString &data ) 00086 { 00087 QString id = "file_export_" + identifier() + ( data.isEmpty() ? QString( "" ) : "_" + data ); 00088 KAction *action = new KAction( label, 0, d->mExportMapper, SLOT( map() ), actionCollection(), id.latin1() ); 00089 00090 d->mExportMapper->setMapping( action, ( data.isEmpty() ? QString( "<empty>" ) : data ) ); 00091 00092 setXMLFile( identifier() + "_xxportui.rc" ); 00093 } 00094 00095 KABC::AddressBook *XXPort::addressBook() const 00096 { 00097 return mAddressBook; 00098 } 00099 00100 QWidget *XXPort::parentWidget() const 00101 { 00102 return mParentWidget; 00103 } 00104 00105 void XXPort::slotExportActivated( const QString &data ) 00106 { 00107 emit exportActivated( identifier(), ( data == "<empty>" ? QString::null : data ) ); 00108 } 00109 00110 void XXPort::slotImportActivated( const QString &data ) 00111 { 00112 emit importActivated( identifier(), ( data == "<empty>" ? QString::null : data ) ); 00113 } 00114 00115 #include "xxport.moc"
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:58:09 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003