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

kmobiletools

pickphonenumberdialog.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 "pickphonenumberdialog.h"
00021 #include "engineslist.h"
00022 
00023 #include <qlayout.h>
00024 #include <kcombobox.h>
00025 #include <klocale.h>
00026 #include <kabc/stdaddressbook.h>
00027 #include <k3listview.h>
00028 #include <q3listview.h>
00029 #include <kabc/addressee.h>
00030 #include <kdebug.h>
00031 
00032 #include "engine.h"
00033 #include "enginedata.h"
00034 #include "devicesconfig.h"
00035 #include "contactslist.h"
00036 
00037 using namespace KMobileTools;
00038 
00039 class PickPhoneNumberDialogPrivate {
00040     public:
00041         PickPhoneNumberDialogPrivate()
00042     : addresseeList(NULL)
00043         {}
00044         Ui::PickPhoneNumber ui;
00045         KMobileTools::ContactsList *addresseeList;
00046         QStringList s_selectedNumbers;
00047 };
00048 
00049 PickPhoneNumberDialog::PickPhoneNumberDialog(QWidget *parent, const char *name)
00050     : KDialog(parent), d(new PickPhoneNumberDialogPrivate)
00051 {
00052     setObjectName( QLatin1String( name ) );
00053     setCaption( i18n("Pick Phonenumber") );
00054     setButtons( Ok|Cancel );
00055     setDefaultButton( Ok );
00056 
00057     d->ui.setupUi(mainWidget());
00058     d->ui.searchLine->addTreeWidget(d->ui.lv_Phone_Numbers);
00059     d->ui.pbSource->addItem(i18n("KDE Addressbook"));
00060     d->ui.pbSource->addItems( KMobileTools::EnginesList::instance()->namesList( true ) );
00061     resize(450,600);
00062     connect(d->ui.pbSource, SIGNAL(activated(int)), this, SLOT(slotSourceChanged( int ) ));
00063     connect(d->ui.lv_Phone_Numbers, SIGNAL(doubleClicked( const QModelIndex &) ), this, SLOT(doubleClick( const QModelIndex &) ) );
00064     connect(d->ui.lv_Phone_Numbers, SIGNAL(clicked( const QModelIndex &) ), this, SLOT(click( const QModelIndex & ) ) );
00065     KMobileTools::EnginesList *enginelist=KMobileTools::EnginesList::instance();
00066     connect(enginelist, SIGNAL(phonebookUpdated()), this, SLOT(updatePhonebook()) );
00067     if(name)
00068     {
00069         d->ui.pbSource->setCurrentItem( DEVCFG(name)->devicename() );
00070         slotSourceChanged( d->ui.pbSource->currentIndex() );
00071     } else slotSourceChanged( 0 );
00072 }
00073 
00074 
00075 PickPhoneNumberDialog::~PickPhoneNumberDialog()
00076 {
00077     delete d;
00078 }
00079 
00080 
00081 #include "pickphonenumberdialog.moc"
00082 
00083 
00087 void PickPhoneNumberDialog::slotSourceChanged(int index)
00088 {
00089     if(!index)
00090         d->addresseeList=new KMobileTools::ContactsList(KABC::StdAddressBook::self()->  allAddressees () );
00091     else
00092     {
00093         KMobileTools::Engine *engine= KMobileTools::EnginesList::instance()->find( d->ui.pbSource->itemText(index), true );
00094         if(engine) d->addresseeList=engine->constEngineData()->contactsList(); else d->addresseeList=0;
00095     }
00096     updateNumbersList();
00097 }
00098 
00099 
00100 void PickPhoneNumberDialog::updatePhonebook()
00101 {
00102     kDebug() <<"PickPhoneNumberDialog::updatePhonebook()";
00103     KMobileTools::Engine *engine= KMobileTools::EnginesList::instance()->find( d->ui.pbSource->currentText(), true );
00104     if(!engine)
00105     {
00106         d->addresseeList=0;
00107         return;
00108     }
00109     d->addresseeList=engine->constEngineData()->contactsList();
00110     updateNumbersList();
00111 }
00115 void PickPhoneNumberDialog::updateNumbersList()
00116 {
00137 }
00138 
00139 
00143 void PickPhoneNumberDialog::doubleClick( const QModelIndex & index )
00144 {
00155 }
00156 
00157 const QStringList PickPhoneNumberDialog::selectedNumbers() {
00158     return d->s_selectedNumbers;
00159 }
00160 
00161 
00165 void PickPhoneNumberDialog::click( const QModelIndex & index )
00166 {
00180 }

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
  • 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