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

kmobiletools

at_devicesfoundpage.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002    Copyright (C) 2007
00003    by Marco Gulino <marco@kmobiletools.org>
00004 
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010 
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the
00020    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021    Boston, MA 02110-1301, USA.
00022  ***************************************************************************/
00023 #include "at_devicesfoundpage.h"
00024 #include "at_scanprogresspage.h"
00025 #include <QListWidget>
00026 #include <libkmobiletools/enginedata.h>
00027 #include <libkmobiletools/engineslist.h>
00028 #include <kdebug.h>
00029 #include <QLabel>
00030 #include <QStackedWidget>
00031 #include <klocalizedstring.h>
00032 #include <QVBoxLayout>
00033 #include "at_engine.h"
00034 
00035 AT_DevicesFoundPage::AT_DevicesFoundPage(QWidget *parent)
00036  : DevicesFoundPage(parent)
00037 {
00038     enginedata=0;
00039 
00040     b_details=new QLabel();
00041     details()->addWidget(b_details);
00042     details()->setCurrentWidget(b_details);
00043 }
00044 
00045 
00046 AT_DevicesFoundPage::~AT_DevicesFoundPage()
00047 {
00048 }
00049 
00050 #include "at_devicesfoundpage.moc"
00051 
00052 
00053 
00057 void AT_DevicesFoundPage::cleanupPage()
00058 {
00059     phonesListWidget()->clear();
00060 }
00061 
00062 
00066 void AT_DevicesFoundPage::initializePage()
00067 {
00068     registerField("at_lv_device", phonesListWidget() );
00069     kDebug() <<"AT_DevicesFoundPage::initializePage()";
00070     AT_ScanProgressPage *scanpage=(AT_ScanProgressPage *) wizard()->page(wizard()->property("scanprogress_id").toInt() );
00071     kDebug() <<"DevicesFound count:" << scanpage->foundDevices().count();
00072     QListIterator<KMobileTools::EngineData*> it(scanpage->foundDevices());
00073     KMobileTools::EngineData* curitem;
00074     QListWidgetItem *newlwitem;
00075     while(it.hasNext()) {
00076         curitem=it.next();
00077         newlwitem=new QListWidgetItem( curitem->manufacturer() + ' ' + curitem->model() , phonesListWidget() );
00078         newlwitem->setData(Qt::UserRole+1, curitem->property("devicePath").toString() ); 
00079         newlwitem->setData(Qt::UserRole+2, curitem->imei() ); 
00080     }
00081 }
00082 
00083 void AT_DevicesFoundPage::slotDetails(QListWidgetItem *item) {
00084     kDebug() ;
00085     if(!item) return;
00086     AT_ScanProgressPage *scanpage=(AT_ScanProgressPage *) wizard()->page(wizard()->property("scanprogress_id").toInt() );
00087 
00088     QListIterator<KMobileTools::EngineData*> it(scanpage->foundDevices());
00089     KMobileTools::EngineData* curitem; 
00090     while(it.hasNext()) {
00091         curitem=it.next();
00092         if(curitem->imei() == item->data(Qt::UserRole+2).toString() )
00093             enginedata=curitem;
00094     }
00095     showDetails(enginedata);
00096 }
00097 
00098 
00102 void AT_DevicesFoundPage::showDetails(KMobileTools::EngineData* engineData)
00103 {
00104     kDebug() ;
00105     kDebug() <<"EngineData:" << engineData;
00106     if(!engineData) {
00107         b_details->setText(QString() );
00108         return;
00109     }
00110     b_details->setText(i18nc("AT Engine wizard - device details html code",
00111     "<qt><ul><li>Manufacturer: %1</li>\
00112     <li>Model: %2</li>\
00113     <li>IMEI: %3</li>\
00114     <li>Device: %4</li></ul></qt>",
00115     engineData->manufacturer(), engineData->model(), engineData->imei(), engineData->property("devicePath").toString()
00116     ) );
00117 }
00118 
00119 bool AT_DevicesFoundPage::validatePage() 
00120 {
00121     if(!enginedata) return false;
00122     ATDevicesConfig *cfg=(ATDevicesConfig*) DEVCFG(wizard()->objectName() );
00124     //cfg->setMobileimei(enginedata->imei());
00125     //cfg->setRawdevicevendor(enginedata->manufacturer());
00126     //cfg->setRawdevicename(enginedata->model());
00127     cfg->writeConfig();
00129     return true;
00130 }

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