-rw-r--r-- | core/obex/obexsend.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/core/obex/obexsend.h b/core/obex/obexsend.h new file mode 100644 index 0000000..030e180 --- a/dev/null +++ b/core/obex/obexsend.h | |||
@@ -0,0 +1,98 @@ | |||
1 | #ifndef OPIE_OBEX_SEND_WIDGET_H | ||
2 | #define OPIE_OBEX_SEND_WIDGET_H | ||
3 | |||
4 | // 7-Jul-2005 mbh@sdgsystems.com: replace hand coded form with one | ||
5 | // generated via QT2 Designer. The new form supports | ||
6 | // selection of target devices, as opposed to sending to | ||
7 | // all. | ||
8 | |||
9 | #include <qstring.h> | ||
10 | #include <qstringlist.h> | ||
11 | #include <qmap.h> | ||
12 | #include "obexsendbase.h" | ||
13 | |||
14 | class QLabel; | ||
15 | class QVBoxLayout; | ||
16 | /** | ||
17 | * This is the new sending widget for Obex | ||
18 | * It will attemp to smart and be able to send | ||
19 | * it to multiple (selected) devices. | ||
20 | * It'll support BT + IrDa | ||
21 | */ | ||
22 | namespace OpieObex { | ||
23 | class Obex; | ||
24 | class BtObex; | ||
25 | |||
26 | struct Pair { | ||
27 | Pair(const QString& first = QString::null, | ||
28 | const QString& second = QString::null) | ||
29 | : m_first(first), m_second(second ) { | ||
30 | } | ||
31 | QString first()const{ return m_first; } | ||
32 | QString second()const { return m_second; } | ||
33 | private: | ||
34 | QString m_first; | ||
35 | QString m_second; | ||
36 | }; | ||
37 | class SendWidget : public obexSendBase { | ||
38 | Q_OBJECT | ||
39 | public: | ||
40 | SendWidget( QWidget* parent = 0, const char* name = 0); | ||
41 | ~SendWidget(); | ||
42 | |||
43 | QString file()const; | ||
44 | |||
45 | protected: | ||
46 | void closeEvent( QCloseEvent* ); | ||
47 | |||
48 | public slots: | ||
49 | void send( const QString& file, const QString& desc ); | ||
50 | |||
51 | signals: | ||
52 | void done(); | ||
53 | |||
54 | protected slots: | ||
55 | virtual void userDone(); | ||
56 | virtual void send_to_receivers(); | ||
57 | virtual void scan_for_receivers(); | ||
58 | virtual void toggle_receiver(QListViewItem* item); | ||
59 | |||
60 | private slots: // QCOP slots | ||
61 | /* IrDa Names*/ | ||
62 | void slotIrDaDevices( const QStringList& ); | ||
63 | /* Bt Names + BD-Addr */ | ||
64 | void slotBTDevices( const QMap<QString, QString>& ); | ||
65 | void slotSelectedDevice( int id, int dev ); | ||
66 | |||
67 | void dispatchIrda( const QCString& str, const QByteArray& ar ); | ||
68 | |||
69 | void slotIrError( int ); | ||
70 | void slotIrSent(bool); | ||
71 | void slotIrTry(unsigned int ); | ||
72 | void slotStartIrda(); | ||
73 | |||
74 | void dispatchBt( const QCString& str, const QByteArray& ar ); | ||
75 | void slotBtError( int ); | ||
76 | void slotBtSent(bool); | ||
77 | void slotBtTry(unsigned int ); | ||
78 | void slotStartBt(); | ||
79 | |||
80 | private: | ||
81 | void initUI(); | ||
82 | int addReceiver(const char *r, const char *icon); | ||
83 | void setReceiverStatus( int id, const QString& status ); | ||
84 | bool receiverSelected(int id); | ||
85 | |||
86 | int m_start; | ||
87 | QMap<int, QString> m_irDa; | ||
88 | QMap<int, QString>::Iterator m_irDaIt; | ||
89 | QMap<int, Pair > m_bt; | ||
90 | QMap<int, Pair>::Iterator m_btIt; | ||
91 | QMap<int, QListViewItem *> receivers; | ||
92 | QString m_file; | ||
93 | Obex* m_obex; | ||
94 | BtObex* m_btobex; | ||
95 | }; | ||
96 | } | ||
97 | |||
98 | #endif | ||