kmobiletools
devicehome.h
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
00021 #ifndef _KMOBILETOOLS_MAINPART_DEVICEHOME_H_
00022 #define _KMOBILETOOLS_MAINPART_DEVICEHOME_H_
00023
00024 #include <k3listview.h>
00025
00026 #include <k3listviewsearchline.h>
00027 #include "kmobiletools_mainpart.h"
00028
00029 #include "ui_mainWidget.h"
00030 #include "statusbar.h"
00031
00032 #include <libkmobiletools/homepage.h>
00033
00034 #include <QtGui/QTreeWidgetItem>
00035
00036 class QWidget;
00037
00038 class QString;
00039 class K3ListView;
00040 class K3ListViewItem;
00041 class Q3ListViewItem;
00042 class QTreeWidgetItem;
00043 class StatusBar;
00044 class addressDetails;
00045 class smsPart;
00046 class QProgressBar;
00047 class QLabel;
00048 class kmobiletoolsMainPart;
00049 class StatusBarProgressBox;
00050 namespace KCal {
00051 class CalendarLocal;
00052 }
00053 namespace KParts
00054 {
00055 class StatusBarExtension;
00056 class ReadOnlyPart;
00057 }
00058 namespace KMobileTools
00059 {
00060 class Engine;
00061 class ContactsList;
00062 }
00063 namespace KABC
00064 {
00065 class Addressee;
00066 }
00067
00075 class DeviceListViewItem : public QTreeWidgetItem
00076 {
00077 public:
00078 explicit DeviceListViewItem ( const QString& text, QTreeWidget* parent = 0 )
00079 : QTreeWidgetItem( parent ) {
00080 setText( 0, text );
00081 }
00082
00083 QString deviceName() const { return devicename; }
00084 void setDeviceName(const QString& devname) {
00085 devicename=devname;
00086 }
00087 private:
00088 QString devicename;
00089 };
00090
00091 class ContactListViewItem : public K3ListViewItem
00092 {
00093 public:
00094 explicit ContactListViewItem(Q3ListView *parent, const KABC::Addressee &contact, bool readOnly=false);
00095 KABC::Addressee contact();
00096 bool readOnly() { return b_ro; }
00097 private:
00098 KABC::Addressee p_contact;
00099 bool b_ro;
00100 };
00101
00102 class ContactsSearchLine : public K3ListViewSearchLine
00103 {
00104 Q_OBJECT
00105 public:
00106 explicit ContactsSearchLine (QWidget *parent=0, K3ListView *listView=0)
00107 : K3ListViewSearchLine(parent, listView) {}
00108 protected:
00109 virtual bool itemMatches (const Q3ListViewItem *item, const QString &s) const;
00110 };
00111
00112 class ContactsSearchLineWidget : public K3ListViewSearchLineWidget
00113 {
00114 Q_OBJECT
00115 public:
00116 explicit ContactsSearchLineWidget(K3ListView *listView=0, QWidget *parent=0)
00117 : K3ListViewSearchLineWidget(listView, parent), p_searchline(NULL) {}
00118 K3ListViewSearchLine * searchLine () const { return p_searchline; }
00119 virtual K3ListViewSearchLine * createSearchLine (K3ListView *listView);
00120 private:
00121 ContactsSearchLine *p_searchline;
00122 };
00123
00124 class DeviceHome : public QObject
00125 {
00126 Q_OBJECT
00127 public:
00128 explicit DeviceHome(QWidget *parentWidget, const QString &devicename,kmobiletoolsMainPart *parent);
00129 virtual ~DeviceHome();
00130 virtual QTreeWidgetItem *listViewItem() { return p_listViewItem; }
00131 bool isConnected() { return devIsConnected; }
00132 void stopDevice();
00133 void resumeDevice();
00134
00135
00136 QString friendlyName();
00137 static QStringList parseAddressee(const KABC::Addressee &addressee);
00138 void raiseDevice();
00139 bool openFile() { return false; }
00140 QWidget *widget() { return m_widget;}
00141 QList<QAction*> actionList() { return l_actionList;}
00142 const SMSList *smsList() {
00143 return 0;
00144
00145 }
00146 void setupWidgets();
00147 kmobiletoolsMainPart *parent() { return (kmobiletoolsMainPart *) QObject::parent(); }
00148 KCal::CalendarLocal * calendar() { return p_calendar; }
00149
00150 private:
00151 Ui::mainWidget ui;
00152 QWidget *m_widget;
00153 ContactsSearchLineWidget *slwidget;
00154 StatusBar *m_statusbar;
00155 KMobileTools::Engine* engine;
00156 QTreeWidgetItem *p_smsItem;
00157 DeviceListViewItem *p_listViewItem;
00158 KMobileTools::homepagePart *home;
00159 QTimer *statusPollTimer;
00160 QTimer *smsPollTimer;
00161 addressDetails *p_addressDetails;
00162 smsPart *p_smsPart;
00163 bool devIsConnected;
00164 int suspends_count;
00165 int smsnotifynum;
00166 KParts::StatusBarExtension *statusBarExtension;
00167 QList<QAction*> l_actionList;
00168 int memslotSelected, smsTypeSelected;
00169 KParts::ReadOnlyPart *korgpart;
00170 kmobiletoolsMainPart *p_mainPart;
00171 KCal::CalendarLocal *p_calendar;
00173 StatusBarProgressBox *statusBarBox;
00174 QProgressBar *signalProgress;
00175 QProgressBar *batteryProgress;
00176 QLabel *networkLabel;
00177 QLabel *devNameLabel;
00178 QLabel *voidLabel;
00179 QLabel *batteryLabel;
00180 QLabel *signalLabel;
00181 bool b_dialing, b_dialing_called;
00182
00183 protected:
00184
00185
00186 public slots:
00187 void errNotConnected();
00188 void addSMSFolders();
00189 void updatePB();
00190
00191 void updateAllContacts();
00192 void updateAllContacts(KMobileTools::ContactsList *addressBook);
00193 void updateSMSList();
00194 void clicked ( QTreeWidgetItem * item );
00195 void printInfoPage(int i) { home->printInfoPage(i, engine); }
00196 void pb_clicked ( Q3ListViewItem * item );
00197 void devDisconnected();
00198 void devConnected();
00199 void disableWidgets();
00200 void enableWidgets(bool fetch=true);
00201 void smsSelected(Q3ListViewItem *smsItem);
00202 void setupStatusBar();
00203 void clearStatusBar();
00204 void sendSMS(const QString&, const QString& );
00205 void storeSMS(const QString&, const QString& );
00206 void loadEngine();
00207 void jobDone(KMobileTools::Job::JobType);
00208
00212 QStringList encodings()
00213 {
00214 return engine->encodings();
00215 }
00216 void slotAddContact();
00217 void slotEditContact(const KABC::Addressee&);
00218 void slotDeleteContact();
00219 void slotFetchPhonebook();
00220 void slotSavePhonebook();
00221 void slotUploadAddressBook();
00222 void addresseeListRightClick(Q3ListViewItem *item, const QPoint &point, int column);
00223 void smsListRightClick(Q3ListViewItem *item, const QPoint &point, int column);
00224 void smsModified(const QString & smsUID);
00225 void smsAdded(const QString & smsUID);
00226 void smsRemoved(const QString & smsUID);
00227 void smsFolderClicked( Q3ListViewItem * item );
00228 void slotNewSMS() { slotNewSMS(QString() ); }
00229 void slotNewSMS(const QString &);
00230 void openURL(const KUrl &url);
00231 void updateSMSCount();
00232 void slotFetchCalendar();
00233 void slotCalendarFetched();
00234 void slotExportSMSList();
00235 void slotExportSMSListToCSV();
00236 void slotStatusBar();
00237 void slotSaveAddressBook();
00238 void slotSendStoredSMS(KMobileTools::SMS*);
00239 void slotRing(bool);
00240 void slotDial();
00241 void slotDialNumber(const QString &);
00242 void raisePage(int);
00243 QString currentDeviceName() const;
00244 void switch2filesystem();
00245 void contactsTabChanged();
00246
00247 signals:
00248 void disconnected();
00249 void connected();
00250 void error();
00251 void phonebookUpdated();
00252 void command(const QString &);
00253 void deleteThis(const QString &);
00254 };
00255
00256
00257 #endif // _KMOBILETOOLSPART_H_