xxport.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
00066 return false;
00067 }
00068
00069 KABC::AddresseeList XXPort::importContacts( const QString& ) const
00070 {
00071
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"
This file is part of the documentation for kaddressbook Library Version 3.2.2.