kmobiletools
popupaddressee.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "popupaddressee.h"
00021 #include "popupnumber.h"
00022 #include <kicon.h>
00023 #include <kdebug.h>
00024 #include <klocale.h>
00025
00026 popupAddressee::popupAddressee(const QString &deviceName, const KABC::Addressee &_addressee, QWidget *parent, bool ro)
00027 : KMenu(parent), addressee(_addressee)
00028 {
00029 setObjectName(deviceName);
00030 if(addressee.isEmpty()) return;
00031 addTitle( KIcon( "x-office-contact" ), addressee.formattedName() );
00032 if(!ro) {
00033 addAction( KIcon("document-properties"), i18n("Edit"), this, SLOT(slotEdit()));
00034 addAction( KIcon("edit-delete"), i18n("Delete"), this, SLOT(slotDelete()));
00035 }
00036 KABC::PhoneNumber::List::Iterator it;
00037 KABC::PhoneNumber::List p_list=addressee.phoneNumbers();
00038 QMenu *curmenu;
00039 for( it=p_list.begin(); it!=p_list.end() ;++it )
00040 {
00041 curmenu=new popupNumber( objectName(), (*it).number(), this );
00042 curmenu->setTitle((*it).number() );
00043 addMenu(curmenu );
00044 }
00045 }
00046
00047
00048 popupAddressee::~popupAddressee()
00049 {
00050 }
00051
00052
00053 #include "popupaddressee.moc"
00054
00055
00056 void popupAddressee::slotEdit()
00057 {
00058 emit editClicked( addressee );
00059 }
00060
00061 void popupAddressee::slotDelete()
00062 {
00063 emit delContact();
00064 }
00065