kmobiletools
popupnumber.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 "popupnumber.h"
00021
00022 #include <klocale.h>
00023 #include <kglobal.h>
00024 #include <kicon.h>
00025 #include <kdebug.h>
00026
00027 #include "engineslist.h"
00028 #if 0 // port to D-Bus!
00029 #include "deviceIFace_stub.h"
00030 #endif
00031 #include "devicesconfig.h"
00032
00033
00034 #define CALL_ID 1
00035 #define CALL_O_ID 2
00036 #define SMS_ID 3
00037 #define SMS_O_ID 4
00038
00039 popupNumber::popupNumber(const QString &deviceName, const QString &number, QWidget *parent)
00040 : KMenu(parent)
00041 {
00042 setObjectName(deviceName);
00043 kDebug() <<"popupNumber" << this;
00044 addTitle(number);
00045 this->number=number;
00046 addAction(KIcon("internet-telephony"), i18n("Call with this mobile phone"), this, SLOT(call() ) );
00047 addAction(KIcon("mail-message-new"), i18n("Send a SMS with this mobile phone"), this, SLOT(newSMS() ) );
00048 if(KMobileTools::EnginesList::instance()->count() >1 )
00049 {
00050 devicesPopup *callsPopup=new devicesPopup(0);
00051 devicesPopup *smsPopup=new devicesPopup(0);
00052 callsPopup->setTitle(i18n("Call with...") );
00053 callsPopup->setIcon(KIcon("internet-telephony") );
00054 addMenu(callsPopup);
00055 smsPopup->setTitle(i18n("Send a SMS with...") );
00056 smsPopup->setIcon(KIcon("mail-message-new") );
00057 addMenu(smsPopup);
00058 connect(callsPopup, SIGNAL(deviceActivated( const QString& ) ), this, SLOT(call( const QString& ) ) );
00059 connect(smsPopup, SIGNAL(deviceActivated( const QString& ) ), this, SLOT(newSMS( const QString& ) ) );
00060 }
00061 }
00062
00063
00064 popupNumber::~popupNumber()
00065 {
00066 }
00067
00068
00069 void popupNumber::newSMS() { newSMS(objectName() ); }
00070
00071 void popupNumber::call() { call(objectName()); }
00072
00073
00074 void popupNumber::call(const QString &deviceName)
00075 {
00076 kDebug() <<"call:" << deviceName;
00077 #if 0
00078 DeviceIFace_stub *stub=new DeviceIFace_stub("kmobiletools", deviceName.latin1() );
00079 stub->raiseDevice();
00080 stub->raisePage(2);
00081 stub->slotDialNumber(number);
00082 #endif
00083 }
00084
00085 void popupNumber::newSMS(const QString &deviceName)
00086 {
00087 kDebug() <<"sms:" << deviceName;
00088 #if 0
00089 (new DeviceIFace_stub("kmobiletools", deviceName.latin1() ))->slotNewSMS(number);
00090 #endif
00091 }
00092
00093
00094
00095 devicesPopup::devicesPopup( QWidget *parent)
00096 : KMenu( parent )
00097 {
00098 sl_devices=KMobileTools::EnginesList::instance()->namesList( false );
00099 QStringList::Iterator it;
00100 QAction *curAction;
00101 int i=0;
00102 for(it=sl_devices.begin(); it!=sl_devices.end(); ++it)
00103 {
00104 if(!DEVCFG(*it)->devicename().length()) continue;
00105
00106 curAction=addAction(KIcon("kmobiletools"), DEVCFG(*it)->devicename() );
00107 curAction->setObjectName(*it);
00108 i++;
00109 }
00110 }
00111
00112 devicesPopup::~devicesPopup()
00113 {
00114 }
00115
00116
00117 void devicesPopup::activated( QAction * action )
00118 {
00119 kDebug() <<"devicesPopup::activated(" << action->objectName() <<")";
00120 emit deviceActivated( action->objectName() );
00121 }
00122
00123 #include "popupnumber.moc"
00124