• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kmobiletools

popupnumber.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002    Copyright (C) 2007
00003    by Marco Gulino <marco@kmobiletools.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
00017    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
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         //if( ! (*it).contains(name) )
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 

kmobiletools

Skip menu "kmobiletools"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal