-rw-r--r-- | core/obex/obexsend.h | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/core/obex/obexsend.h b/core/obex/obexsend.h index fd819bc..02100f7 100644 --- a/core/obex/obexsend.h +++ b/core/obex/obexsend.h | |||
@@ -1,99 +1,122 @@ | |||
1 | #ifndef OPIE_OBEX_SEND_WIDGET_H | 1 | #ifndef OPIE_OBEX_SEND_WIDGET_H |
2 | #define OPIE_OBEX_SEND_WIDGET_H | 2 | #define OPIE_OBEX_SEND_WIDGET_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qstringlist.h> | 5 | #include <qstringlist.h> |
6 | #include <qwidget.h> | 6 | #include <qwidget.h> |
7 | #include <qvbox.h> | 7 | #include <qvbox.h> |
8 | #include <qmap.h> | 8 | #include <qmap.h> |
9 | #include <qtextbrowser.h> | 9 | #include <qtextbrowser.h> |
10 | 10 | ||
11 | class QLabel; | 11 | class QLabel; |
12 | class QVBoxLayout; | 12 | class QVBoxLayout; |
13 | /** | 13 | /** |
14 | * This is the new sending widget for Obex | 14 | * This is the new sending widget for Obex |
15 | * It will attemp to smart and be able to send | 15 | * It will attemp to smart and be able to send |
16 | * it to multiple devices. | 16 | * it to multiple devices. |
17 | * It'll support BT + IrDa | 17 | * It'll support BT + IrDa |
18 | */ | 18 | */ |
19 | namespace OpieObex { | 19 | namespace OpieObex { |
20 | class DeviceBox; | 20 | class DeviceBox; |
21 | class Obex; | 21 | class Obex; |
22 | |||
23 | struct Pair { | ||
24 | Pair(const QString& first = QString::null, | ||
25 | const QString& second = QString::null) | ||
26 | : m_first(first), m_second(second ) { | ||
27 | } | ||
28 | QString first()const{ return m_first; } | ||
29 | QString second()const { return m_second; } | ||
30 | private: | ||
31 | QString m_first; | ||
32 | QString m_second; | ||
33 | }; | ||
22 | class SendWidget : public QWidget{ | 34 | class SendWidget : public QWidget{ |
23 | Q_OBJECT | 35 | Q_OBJECT |
24 | public: | 36 | public: |
25 | SendWidget( QWidget* parent = 0, const char* name = 0); | 37 | SendWidget( QWidget* parent = 0, const char* name = 0); |
26 | ~SendWidget(); | 38 | ~SendWidget(); |
27 | 39 | ||
28 | QString file()const; | 40 | QString file()const; |
29 | 41 | ||
30 | public slots: | 42 | public slots: |
31 | void send( const QString& file, const QString& desc ); | 43 | void send( const QString& file, const QString& desc ); |
32 | 44 | ||
33 | signals: | 45 | signals: |
34 | void done(); | 46 | void done(); |
35 | 47 | ||
36 | private slots: // QCOP slots | 48 | private slots: // QCOP slots |
37 | /* IrDa Names*/ | 49 | /* IrDa Names*/ |
38 | void slotIrDaDevices( const QStringList& ); | 50 | void slotIrDaDevices( const QStringList& ); |
39 | /* Bt Names + BD-Addr */ | 51 | /* Bt Names + BD-Addr */ |
40 | void slotBTDevices( const QMap<QString, QString>& ); | 52 | void slotBTDevices( const QMap<QString, QString>& ); |
41 | void slotSelectedDevice( const QString& name, int dev ); | 53 | void slotSelectedDevice( int id, int dev ); |
42 | void dispatchIrda( const QCString& str, const QByteArray& ar ); | 54 | void dispatchIrda( const QCString& str, const QByteArray& ar ); |
43 | void dispatchBt( const QCString& str, const QByteArray& ar ); | 55 | void dispatchBt( const QCString& str, const QByteArray& ar ); |
44 | 56 | ||
45 | void slotIrError( int ); | 57 | void slotIrError( int ); |
46 | void slotIrSent(bool); | 58 | void slotIrSent(bool); |
47 | void slotIrTry(unsigned int ); | 59 | void slotIrTry(unsigned int ); |
48 | void slotStartIrda(); | 60 | void slotStartIrda(); |
49 | void slotDone(); | 61 | void slotDone(); |
50 | private: | 62 | private: |
51 | void initUI(); | 63 | void initUI(); |
52 | QLabel* m_lblFile; | 64 | QLabel* m_lblFile; |
53 | DeviceBox* m_devBox; | 65 | DeviceBox* m_devBox; |
54 | QVBoxLayout* m_lay; | 66 | QVBoxLayout* m_lay; |
55 | int m_start; | 67 | int m_start; |
56 | QStringList m_irDa; | 68 | QMap<int, QString> m_irDa; |
57 | QMap<QString, QString> m_bt; | 69 | QMap<int, QString>::Iterator m_irDaIt; |
70 | QMap<int, Pair > m_bt; | ||
58 | QString m_file; | 71 | QString m_file; |
59 | Obex* m_obex; | 72 | Obex* m_obex; |
73 | int m_irDeSearch; // search of irda and bt devices | ||
74 | int m_btDeSearch; | ||
60 | }; | 75 | }; |
61 | class DeviceItem { | 76 | class DeviceItem { |
62 | public: | 77 | public: |
63 | DeviceItem( const QString& name = QString::null, | 78 | DeviceItem( const QString& name = QString::null, |
64 | const QString& status = QString::null, int dev = 3); | 79 | const QString& status = QString::null, int dev = 3, int id = -1); |
65 | ~DeviceItem(); | 80 | ~DeviceItem(); |
66 | void setStatus( const QString& text ); | 81 | void setStatus( const QString& text ); |
67 | 82 | ||
68 | QString name()const; | 83 | QString name()const; |
69 | QString status()const; | 84 | QString status()const; |
70 | QString pixmap()const; | 85 | QString pixmap()const; |
71 | int device()const; | 86 | int device()const; |
87 | int id()const; | ||
72 | QString toString()const; | 88 | QString toString()const; |
73 | private: | 89 | private: |
74 | QString m_name; | 90 | QString m_name; |
75 | QString m_status; | 91 | QString m_status; |
76 | int m_dev; | 92 | int m_dev; |
93 | int m_id; | ||
77 | }; | 94 | }; |
95 | |||
96 | /* | ||
97 | * The text field which contains the information about sending... | ||
98 | * | ||
99 | */ | ||
78 | class DeviceBox : public QTextBrowser { | 100 | class DeviceBox : public QTextBrowser { |
79 | Q_OBJECT | 101 | Q_OBJECT |
80 | public: | 102 | public: |
81 | enum Device { IrDa, BT, Search, Error }; | 103 | enum Device { IrDa, BT, Search, Error }; |
82 | DeviceBox( QWidget* parent ); | 104 | DeviceBox( QWidget* parent ); |
83 | ~DeviceBox(); | 105 | ~DeviceBox(); |
84 | 106 | ||
85 | void setSource( const QString& str ); | 107 | void setSource( const QString& str ); |
86 | void addDevice( const QString& name, int dev, | 108 | int addDevice( const QString& name, int dev, |
87 | const QString& status = QString::null ); | 109 | const QString& status = QString::null ); |
88 | void removeDevice( const QString& name ); | 110 | void removeDevice( int ); |
89 | void setStatus( const QString& name, const QString& ); | 111 | void setStatus( int, const QString& ); |
90 | signals: | 112 | signals: |
91 | void selectedDevice( const QString& name, int dev ); | 113 | void selectedDevice( int id, int dev ); |
92 | private: | 114 | private: |
93 | QMap<QString, DeviceItem> m_dev; | 115 | /* returns a id for a device from a device range */ |
94 | QStringList m_devices; | 116 | int idFor (int deviceType ); |
95 | 117 | QString allText(); | |
118 | QMap<int, DeviceItem> m_dev; | ||
96 | }; | 119 | }; |
97 | } | 120 | } |
98 | 121 | ||
99 | #endif | 122 | #endif |