author | korovkin <korovkin> | 2006-03-19 14:59:21 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2006-03-19 14:59:21 (UTC) |
commit | 39fedaa847ed64b2c0113a75d0f1de29da5876db (patch) (unidiff) | |
tree | 442fc009975e72a22cb9773b88599ea388af195b | |
parent | 3de693f244170cb9424d841aef6a6d7175766fa3 (diff) | |
download | opie-39fedaa847ed64b2c0113a75d0f1de29da5876db.zip opie-39fedaa847ed64b2c0113a75d0f1de29da5876db.tar.gz opie-39fedaa847ed64b2c0113a75d0f1de29da5876db.tar.bz2 |
Added device browsing and files downloading using OBEX File transfer
protocol.
-rw-r--r-- | noncore/net/opietooth/manager/ReleaseNotes.txt | 9 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/TODO.txt | 6 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/filelistitem.cpp | 71 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/filelistitem.h | 38 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/manager.pro | 25 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialog.cpp | 390 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialog.h | 66 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialogbase.cpp | 131 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialogbase.h | 60 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialogbase.ui | 332 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpopup.cpp | 67 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpopup.h | 35 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/popuphelper.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/stdpopups.cpp | 15 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/stdpopups.h | 1 |
15 files changed, 1234 insertions, 14 deletions
diff --git a/noncore/net/opietooth/manager/ReleaseNotes.txt b/noncore/net/opietooth/manager/ReleaseNotes.txt new file mode 100644 index 0000000..9c0fa8c --- a/dev/null +++ b/noncore/net/opietooth/manager/ReleaseNotes.txt | |||
@@ -0,0 +1,9 @@ | |||
1 | Sun 19 Mar 2006 17:29:28 | ||
2 | 1. In order to build manager you need to build obexftp >= 0.18 | ||
3 | (http://triq.net/obexftp/) with crosscompiler and put client.h, obexftp.h, | ||
4 | object.h and uuid.h files to $LIBBLUEZ_INC_DIR/obexftp and libobexftp.a, | ||
5 | libmulticobex.a and libbfb.a to $LIBBLUEZ_LIB_DIR. | ||
6 | 2. In "ppp connection" dialog if you press connect with an empty ppp script | ||
7 | name it runs rfcomm connect 0 <device> <port>. | ||
8 | |||
9 | //eof | ||
diff --git a/noncore/net/opietooth/manager/TODO.txt b/noncore/net/opietooth/manager/TODO.txt new file mode 100644 index 0000000..2b373b3 --- a/dev/null +++ b/noncore/net/opietooth/manager/TODO.txt | |||
@@ -0,0 +1,6 @@ | |||
1 | 1. Add a "Put file" function to bluetooth manager file transfer protocol. | ||
2 | 2. Make bind table edit /etc/bluetooth/rfcomm.conf file. | ||
3 | 3. Add an rfcomm port number to the connection dialog. | ||
4 | 4. Collect requirements from others. | ||
5 | |||
6 | //eof | ||
diff --git a/noncore/net/opietooth/manager/filelistitem.cpp b/noncore/net/opietooth/manager/filelistitem.cpp new file mode 100644 index 0000000..86fcc54 --- a/dev/null +++ b/noncore/net/opietooth/manager/filelistitem.cpp | |||
@@ -0,0 +1,71 @@ | |||
1 | /* $Id$ */ | ||
2 | /* Directory tree entry */ | ||
3 | /*************************************************************************** | ||
4 | * * | ||
5 | * This program is free software; you can redistribute it and/or modify * | ||
6 | * it under the terms of the GNU General Public License as published by * | ||
7 | * the Free Software Foundation; either version 2 of the License, or * | ||
8 | * (at your option) any later version. * | ||
9 | * * | ||
10 | ***************************************************************************/ | ||
11 | #include "filelistitem.h" | ||
12 | #include <qpe/resource.h> | ||
13 | |||
14 | using namespace OpieTooth; | ||
15 | |||
16 | FileListItem::FileListItem(QListView* parent, stat_entry_t* ent, int size) : | ||
17 | QListViewItem(parent) | ||
18 | { | ||
19 | init(ent, size); | ||
20 | } | ||
21 | |||
22 | FileListItem::FileListItem(QListViewItem* parent, stat_entry_t* ent, int size) : | ||
23 | QListViewItem(parent), m_name(ent->name) | ||
24 | { | ||
25 | init(ent, size); | ||
26 | } | ||
27 | |||
28 | void FileListItem::init(stat_entry_t* ent, int size) | ||
29 | { | ||
30 | if (ent == NULL) { | ||
31 | type = IS_DIR; | ||
32 | m_name = ".."; //Upper directory | ||
33 | m_size = 0; | ||
34 | } | ||
35 | else { | ||
36 | m_name = ent->name; | ||
37 | if (ent->mode == 16877) | ||
38 | type = IS_DIR; | ||
39 | else | ||
40 | type = IS_FILE; | ||
41 | } | ||
42 | if (type == IS_DIR) { | ||
43 | setPixmap(0, Resource::loadPixmap("folder")); | ||
44 | setText(0, m_name + QString("/")); | ||
45 | m_size = 0; | ||
46 | } | ||
47 | else { | ||
48 | setPixmap(0, Resource::loadPixmap("c_src")); | ||
49 | setText(0, m_name); | ||
50 | m_size = size; | ||
51 | setText(1, QString::number(m_size)); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | QString FileListItem::key(int, bool) const | ||
56 | { | ||
57 | QString str; //resulting string | ||
58 | if (type == IS_DIR) | ||
59 | str = "0"; | ||
60 | else | ||
61 | str = "1"; | ||
62 | str += m_name; | ||
63 | return str; | ||
64 | } | ||
65 | |||
66 | enum dtype FileListItem::gettype() | ||
67 | { | ||
68 | return type; | ||
69 | } | ||
70 | |||
71 | //eof | ||
diff --git a/noncore/net/opietooth/manager/filelistitem.h b/noncore/net/opietooth/manager/filelistitem.h new file mode 100644 index 0000000..a45d196 --- a/dev/null +++ b/noncore/net/opietooth/manager/filelistitem.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* $Id$ */ | ||
2 | /* Directory tree entry */ | ||
3 | /*************************************************************************** | ||
4 | * * | ||
5 | * This program is free software; you can redistribute it and/or modify * | ||
6 | * it under the terms of the GNU General Public License as published by * | ||
7 | * the Free Software Foundation; either version 2 of the License, or * | ||
8 | * (at your option) any later version. * | ||
9 | * * | ||
10 | ***************************************************************************/ | ||
11 | #ifndef FILELISTITEM_H | ||
12 | #define FILELISTITEM_H | ||
13 | |||
14 | #include <qlistview.h> | ||
15 | #include <sys/stat.h> | ||
16 | #include <client.h> | ||
17 | |||
18 | enum dtype { IS_DIR = 0, IS_FILE = 1 }; | ||
19 | |||
20 | namespace OpieTooth { | ||
21 | |||
22 | class FileListItem : public QListViewItem { | ||
23 | Q_OBJECT | ||
24 | public: | ||
25 | FileListItem(QListView * parent, stat_entry_t* ent, int size = 0); | ||
26 | FileListItem(QListViewItem * parent, stat_entry_t* ent, int size = 0); | ||
27 | virtual QString key ( int, bool ) const; | ||
28 | virtual enum dtype gettype(); | ||
29 | protected: | ||
30 | void init(stat_entry_t* ent, int size); | ||
31 | protected: | ||
32 | QString m_name; //name | ||
33 | int m_size; //file (not directory) size | ||
34 | enum dtype type; //type: file or directory | ||
35 | }; | ||
36 | }; | ||
37 | |||
38 | #endif | ||
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro index b468784..bd99d08 100644 --- a/noncore/net/opietooth/manager/manager.pro +++ b/noncore/net/opietooth/manager/manager.pro | |||
@@ -2,29 +2,40 @@ CONFIG = qt warn_on quick-app | |||
2 | HEADERS = btconnectionitem.h btdeviceitem.h \ | 2 | HEADERS = btconnectionitem.h btdeviceitem.h \ |
3 | btserviceitem.h stdpopups.h \ | 3 | btserviceitem.h stdpopups.h \ |
4 | popuphelper.h bluebase.h \ | 4 | popuphelper.h bluebase.h \ |
5 | scandialog.h btlistitem.h \ | 5 | scandialog.h btlistitem.h filistitem.h \ |
6 | hciconfwrapper.h bticonloader.h \ | 6 | hciconfwrapper.h bticonloader.h \ |
7 | pppdialog.h obexdialog.h \ | 7 | pppdialog.h obexdialog.h obexftpdialog.h \ |
8 | rfcommassigndialogimpl.h rfcommassigndialogitem.h \ | 8 | rfcommassigndialogimpl.h rfcommassigndialogitem.h \ |
9 | devicehandler.h rfcpopup.h obexpopup.h \ | 9 | devicehandler.h rfcpopup.h obexpopup.h obexftpopup.h \ |
10 | rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h | 10 | rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h |
11 | 11 | ||
12 | SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ | 12 | SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ |
13 | btserviceitem.cpp stdpopups.cpp \ | 13 | btserviceitem.cpp filelistitem.cpp stdpopups.cpp \ |
14 | popuphelper.cpp main.cpp \ | 14 | popuphelper.cpp main.cpp \ |
15 | bluebase.cpp scandialog.cpp \ | 15 | bluebase.cpp scandialog.cpp \ |
16 | btlistitem.cpp hciconfwrapper.cpp \ | 16 | btlistitem.cpp hciconfwrapper.cpp \ |
17 | bticonloader.cpp pppdialog.cpp \ | 17 | bticonloader.cpp pppdialog.cpp \ |
18 | rfcommassigndialogimpl.cpp rfcommassigndialogitem.cpp \ | 18 | rfcommassigndialogimpl.cpp rfcommassigndialogitem.cpp \ |
19 | obexdialog.cpp devicehandler.cpp \ | 19 | obexdialog.cpp devicehandler.cpp \ |
20 | rfcpopup.cpp obexpopup.cpp \ | 20 | rfcpopup.cpp obexpopup.cpp obexftpopup.cpp obexftpdialog.cpp \ |
21 | rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp | 21 | rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp |
22 | INCLUDEPATH += $(OPIEDIR)/include | 22 | INCLUDEPATH += $(OPIEDIR)/include |
23 | INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib | 23 | INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib |
24 | DEPENDPATH += $(OPIEDIR)/include | 24 | DEPENDPATH += $(OPIEDIR)/include |
25 | LIBS += -lqpe -lopietooth1 -lopiecore2 -lopieui2 | 25 | LIBS += -lqpe -lbluetooth -lopietooth1 -lopiecore2 -lopieui2 -lopenobex |
26 | INTERFACES = bluetoothbase.ui devicedialog.ui rfcommassigndialogbase.ui rfcommdialogitembase.ui | 26 | INTERFACES = bluetoothbase.ui devicedialog.ui rfcommassigndialogbase.ui \ |
27 | rfcommdialogitembase.ui obexftpdialogbase.ui | ||
27 | 28 | ||
28 | TARGET = bluetooth-manager | 29 | TARGET = bluetooth-manager |
29 | 30 | ||
30 | include( $(OPIEDIR)/include.pro ) | 31 | include( $(OPIEDIR)/include.pro ) |
32 | |||
33 | !isEmpty( LIBBLUEZ_INC_DIR ) { | ||
34 | INCLUDEPATH += $$LIBBLUEZ_INC_DIR/obexftp | ||
35 | } | ||
36 | |||
37 | !isEmpty( LIBBLUEZ_LIB_DIR ) { | ||
38 | LIBS += $$LIBBLUEZ_LIB_DIR/libobexftp.a | ||
39 | LIBS += $$LIBBLUEZ_LIB_DIR/libmulticobex.a | ||
40 | LIBS += $$LIBBLUEZ_LIB_DIR/libbfb.a | ||
41 | } \ No newline at end of file | ||
diff --git a/noncore/net/opietooth/manager/obexftpdialog.cpp b/noncore/net/opietooth/manager/obexftpdialog.cpp new file mode 100644 index 0000000..c77d49d --- a/dev/null +++ b/noncore/net/opietooth/manager/obexftpdialog.cpp | |||
@@ -0,0 +1,390 @@ | |||
1 | /* $Id$ */ | ||
2 | /* OBEX file browser dialog */ | ||
3 | /*************************************************************************** | ||
4 | * * | ||
5 | * This program is free software; you can redistribute it and/or modify * | ||
6 | * it under the terms of the GNU General Public License as published by * | ||
7 | * the Free Software Foundation; either version 2 of the License, or * | ||
8 | * (at your option) any later version. * | ||
9 | * * | ||
10 | ***************************************************************************/ | ||
11 | /* | ||
12 | * This code uses and is based on ObexFTP project code: http://triq.net/obexftp/ | ||
13 | */ | ||
14 | #include <sys/stat.h> | ||
15 | #include <qpushbutton.h> | ||
16 | #include <qmessagebox.h> | ||
17 | #include <qmultilineedit.h> | ||
18 | #include <qlistview.h> | ||
19 | #include <qprogressbar.h> | ||
20 | #include <qlabel.h> | ||
21 | #include <qlayout.h> | ||
22 | #include <errno.h> | ||
23 | #include "obexftpdialog.h" | ||
24 | #include "filelistitem.h" | ||
25 | |||
26 | #include <qpe/qpeapplication.h> | ||
27 | #include <qpe/resource.h> | ||
28 | #include <qpe/config.h> | ||
29 | #include <opie2/odebug.h> | ||
30 | #include <opie2/ofileselector.h> | ||
31 | |||
32 | using namespace Opie::Core; | ||
33 | using namespace Opie::Ui; | ||
34 | |||
35 | using namespace OpieTooth; | ||
36 | |||
37 | #define MAX_PROGRESS 14 //Maximal progress bar | ||
38 | |||
39 | static void info_cb(int event, const char *msg, int len, void* data); | ||
40 | |||
41 | /* | ||
42 | * Public constructor | ||
43 | * device - bluetooth address of the device | ||
44 | * port - port to connect to | ||
45 | */ | ||
46 | ObexFtpDialog::ObexFtpDialog(const QString& device, int port, | ||
47 | QWidget* parent, const char* name, bool modal, WFlags fl) | ||
48 | : ObexFtpDialogBase(parent, name, modal, fl), m_device(device), | ||
49 | m_port(port), curdir("") | ||
50 | { | ||
51 | client = NULL; | ||
52 | transport = OBEX_TRANS_BLUETOOTH; | ||
53 | use_conn = TRUE; | ||
54 | use_path = TRUE; | ||
55 | progressStatus = 0; | ||
56 | localCurdir = "/"; | ||
57 | browseLog->setEdited(FALSE); | ||
58 | fileList->setSorting(1); | ||
59 | fileList->clear(); | ||
60 | fileProgress->setTotalSteps(MAX_PROGRESS); | ||
61 | statusBar->clear(); | ||
62 | localLayout = new QVBoxLayout(localFs); | ||
63 | localLayout->setSpacing( 0 ); | ||
64 | localLayout->setMargin( 0 ); | ||
65 | destFile = new OFileSelector(localFs, | ||
66 | OFileSelector::FileSelector, | ||
67 | OFileSelector::ExtendedAll, localCurdir, ""); | ||
68 | destFile->setCloseVisible(false); | ||
69 | destFile->setNewVisible(false); | ||
70 | localLayout->addWidget(destFile); | ||
71 | connect(browseOK, SIGNAL(clicked()), SLOT(slotBrowse())); | ||
72 | connect(fileList, SIGNAL(clicked(QListViewItem*)), | ||
73 | SLOT(slotCd(QListViewItem*))); | ||
74 | connect(getButton, | ||
75 | SIGNAL(clicked()), | ||
76 | SLOT(getFile())); | ||
77 | connect(destFile, | ||
78 | SIGNAL(dirSelected (const QString&)), | ||
79 | SLOT(updateDir(const QString&))); | ||
80 | } | ||
81 | |||
82 | ObexFtpDialog::~ObexFtpDialog() | ||
83 | { | ||
84 | if (client != NULL) { | ||
85 | obexftp_disconnect(client); | ||
86 | obexftp_close(client); | ||
87 | } | ||
88 | } | ||
89 | |||
90 | /* | ||
91 | * Do device browsing | ||
92 | */ | ||
93 | void ObexFtpDialog::slotBrowse() | ||
94 | { | ||
95 | stat_entry_t* ent; //Directory entry | ||
96 | void *dir; //Directory to read | ||
97 | const uint8_t use_uuid[] = __UUID_FBS_bytes; | ||
98 | int len = sizeof(UUID_FBS); | ||
99 | FileListItem* root; //root node | ||
100 | stat_entry_t* st; //File statistics | ||
101 | int fsize; //file size | ||
102 | |||
103 | status(tr("Connecting to ") + m_device); | ||
104 | odebug << "Browse device " << m_device << oendl; | ||
105 | browseLog->clear(); | ||
106 | fileList->clear(); | ||
107 | progressStatus = 0; | ||
108 | fileProgress->reset(); | ||
109 | if (!cli_connect_uuid(use_uuid, len)) { | ||
110 | log("Connection failed"); | ||
111 | errBox("Connection failed"); | ||
112 | status("Connection failed"); | ||
113 | return; | ||
114 | } | ||
115 | else { | ||
116 | log(QString("Connected to ") + m_device); | ||
117 | status(QString("Connected to ") + m_device); | ||
118 | } | ||
119 | /* List folder */ | ||
120 | root = new FileListItem(fileList, NULL); | ||
121 | dir = obexftp_opendir(client, curdir); | ||
122 | while ((ent = obexftp_readdir(dir)) != NULL) { | ||
123 | FileListItem* a; //List view item | ||
124 | #if 0 //Causes sigsegv | ||
125 | if (ent->mode != 16877) { | ||
126 | st = obexftp_stat(client, ent->name); | ||
127 | fsize = st->size; | ||
128 | } | ||
129 | else | ||
130 | #endif | ||
131 | fsize = 0; | ||
132 | log(QString(ent->name) + QString(" ") + | ||
133 | QString::number(ent->mode)); | ||
134 | |||
135 | a = new FileListItem(fileList, ent, fsize); | ||
136 | } | ||
137 | obexftp_closedir(dir); | ||
138 | } | ||
139 | |||
140 | //Error message box | ||
141 | int ObexFtpDialog::errBox(QCString msg) | ||
142 | { | ||
143 | return QMessageBox::critical(this, tr("ObexFTP error"), msg); | ||
144 | } | ||
145 | |||
146 | int ObexFtpDialog::errBox(QString msg) | ||
147 | { | ||
148 | return QMessageBox::critical(this, tr("ObexFTP error"), msg); | ||
149 | } | ||
150 | |||
151 | int ObexFtpDialog::errBox(const char* msg) | ||
152 | { | ||
153 | return QMessageBox::critical(this, tr("ObexFTP error"), tr(msg)); | ||
154 | } | ||
155 | |||
156 | //Text in the status bar | ||
157 | void ObexFtpDialog::status(QCString msg) | ||
158 | { | ||
159 | statusBar->setText(msg); | ||
160 | statusBar->repaint(); | ||
161 | } | ||
162 | |||
163 | void ObexFtpDialog::status(QString msg) | ||
164 | { | ||
165 | statusBar->setText(msg); | ||
166 | statusBar->repaint(); | ||
167 | } | ||
168 | |||
169 | void ObexFtpDialog::status(const char* msg) | ||
170 | { | ||
171 | statusBar->setText(msg); | ||
172 | statusBar->repaint(); | ||
173 | } | ||
174 | |||
175 | /* | ||
176 | * Change directory with item under the cursor | ||
177 | */ | ||
178 | void ObexFtpDialog::slotCd(QListViewItem* item) | ||
179 | { | ||
180 | FileListItem* file = (FileListItem*)item; | ||
181 | int idx; | ||
182 | if (file == NULL) | ||
183 | return; | ||
184 | odebug << "Item " << file->text(0) << " clicked" << oendl; | ||
185 | if (file->gettype() == IS_DIR) { | ||
186 | if (file->text(0) == "../") { | ||
187 | if (curdir.right(1) == "/") | ||
188 | curdir.remove(curdir.length() - 1, 1); | ||
189 | idx = curdir.findRev('/'); | ||
190 | if (idx >= 0) | ||
191 | curdir.remove(idx, curdir.length() - idx); | ||
192 | else | ||
193 | curdir = ""; | ||
194 | } | ||
195 | else { | ||
196 | if (curdir != "" && curdir.right(1) != "/") | ||
197 | curdir += "/"; | ||
198 | curdir += file->text(0); | ||
199 | } | ||
200 | odebug << "Browse " << curdir << oendl; | ||
201 | if (obexftp_setpath(client, curdir, 0) < 0) | ||
202 | log("CD failed"); | ||
203 | slotBrowse(); | ||
204 | } | ||
205 | } | ||
206 | |||
207 | /* | ||
208 | * Get the file | ||
209 | */ | ||
210 | void ObexFtpDialog::getFile() | ||
211 | { | ||
212 | FileListItem* file = (FileListItem*)fileList->selectedItem(); | ||
213 | int result; | ||
214 | if (file == NULL) | ||
215 | return; | ||
216 | file2get = "/"; | ||
217 | local = localCurdir; | ||
218 | if (local == "") { | ||
219 | errBox("Select a destination first"); | ||
220 | return; | ||
221 | } | ||
222 | if (local.right(1) != "/") | ||
223 | local += "/"; | ||
224 | if (file->gettype() == IS_FILE) { | ||
225 | file2get += curdir; | ||
226 | if (curdir != "" && curdir.right(1) != "/") | ||
227 | file2get += "/"; | ||
228 | file2get += file->text(0); | ||
229 | local += file->text(0); | ||
230 | odebug << "Copy " << file2get << " to " << local << oendl; | ||
231 | progressStatus = 0; | ||
232 | fileProgress->reset(); | ||
233 | status(tr("Receiving file ") + file2get); | ||
234 | result = obexftp_get(client, local, file2get); | ||
235 | if (result < 0) { | ||
236 | log(file2get + QString(" receive ERROR")); | ||
237 | errBox(file2get + QString(" receive ERROR")); | ||
238 | status(file2get + QString(" receive ERROR")); | ||
239 | } | ||
240 | else { | ||
241 | log(file2get + QString(" received")); | ||
242 | status(file2get + QString(" received")); | ||
243 | destFile->reread(); | ||
244 | } | ||
245 | } | ||
246 | } | ||
247 | |||
248 | /* connect with given uuid. re-connect every time */ | ||
249 | int ObexFtpDialog::cli_connect_uuid(const uint8_t *uuid, int uuid_len) | ||
250 | { | ||
251 | int retry; | ||
252 | if (client != NULL) | ||
253 | return TRUE; | ||
254 | /* Open */ | ||
255 | client = obexftp_open (transport, NULL, info_cb, this); | ||
256 | if(client == NULL) { | ||
257 | errBox("Error opening obexftp-client"); | ||
258 | return FALSE; | ||
259 | } | ||
260 | if (!use_conn) | ||
261 | client->quirks &= ~OBEXFTP_CONN_HEADER; | ||
262 | if (!use_path) | ||
263 | client->quirks &= ~OBEXFTP_SPLIT_SETPATH; | ||
264 | for (retry = 0; retry < 3; retry++) { | ||
265 | /* Connect */ | ||
266 | switch (transport) { | ||
267 | case OBEX_TRANS_IRDA: | ||
268 | if (obexftp_connect_uuid(client, NULL, 0, uuid, uuid_len) >= 0) | ||
269 | return TRUE; | ||
270 | break; | ||
271 | case OBEX_TRANS_BLUETOOTH: | ||
272 | if (obexftp_connect_uuid(client, m_device, m_port, | ||
273 | uuid, uuid_len) >= 0) | ||
274 | return TRUE; | ||
275 | break; | ||
276 | default: | ||
277 | errBox("Transport type unknown"); | ||
278 | return FALSE; | ||
279 | } | ||
280 | log(tr("Still trying to connect")); | ||
281 | } | ||
282 | client = NULL; | ||
283 | |||
284 | return FALSE; | ||
285 | } | ||
286 | |||
287 | /* | ||
288 | * Put a message to the log window | ||
289 | */ | ||
290 | void ObexFtpDialog::log(QString str) | ||
291 | { | ||
292 | browseLog->append(str); | ||
293 | } | ||
294 | |||
295 | void ObexFtpDialog::log(QCString str) | ||
296 | { | ||
297 | browseLog->append(str); | ||
298 | } | ||
299 | |||
300 | void ObexFtpDialog::log(QString& str) | ||
301 | { | ||
302 | browseLog->append(str); | ||
303 | } | ||
304 | |||
305 | void ObexFtpDialog::log(const char* str) | ||
306 | { | ||
307 | browseLog->append(str); | ||
308 | } | ||
309 | |||
310 | void ObexFtpDialog::incProgress() | ||
311 | { | ||
312 | odebug << "Progress " << progressStatus << oendl; | ||
313 | if (progressStatus < MAX_PROGRESS) { | ||
314 | fileProgress->setProgress(progressStatus++); | ||
315 | } | ||
316 | } | ||
317 | |||
318 | void ObexFtpDialog::doneProgress() | ||
319 | { | ||
320 | progressStatus = 0; | ||
321 | fileProgress->reset(); | ||
322 | } | ||
323 | |||
324 | void ObexFtpDialog::updateDir(const QString& newdir) | ||
325 | { | ||
326 | localCurdir = newdir; | ||
327 | } | ||
328 | |||
329 | /* | ||
330 | * Event callback function | ||
331 | */ | ||
332 | static void info_cb(int event, const char *msg, int len, void* data) | ||
333 | { | ||
334 | ObexFtpDialog* dlg = (ObexFtpDialog*)data; | ||
335 | QCString cmsg(msg, len); //Message to display | ||
336 | |||
337 | switch (event) { | ||
338 | |||
339 | case OBEXFTP_EV_ERRMSG: | ||
340 | dlg->log(QCString("Error: ") + cmsg); | ||
341 | break; | ||
342 | |||
343 | case OBEXFTP_EV_ERR: | ||
344 | dlg->log(QCString("failed: ") + cmsg); | ||
345 | dlg->doneProgress(); | ||
346 | break; | ||
347 | case OBEXFTP_EV_OK: | ||
348 | dlg->log(QCString("done")); | ||
349 | dlg->doneProgress(); | ||
350 | break; | ||
351 | |||
352 | case OBEXFTP_EV_CONNECTING: | ||
353 | dlg->log(QCString("Connecting...")); | ||
354 | break; | ||
355 | case OBEXFTP_EV_DISCONNECTING: | ||
356 | dlg->log(QCString("Disconnecting...")); | ||
357 | break; | ||
358 | case OBEXFTP_EV_SENDING: | ||
359 | dlg->log(QCString("Sending ") + msg); | ||
360 | break; | ||
361 | case OBEXFTP_EV_RECEIVING: | ||
362 | dlg->log(QCString("Receiving ") + msg); | ||
363 | break; | ||
364 | |||
365 | case OBEXFTP_EV_LISTENING: | ||
366 | dlg->log(QCString("Waiting for incoming connection")); | ||
367 | break; | ||
368 | |||
369 | case OBEXFTP_EV_CONNECTIND: | ||
370 | dlg->log(QCString("Incoming connection")); | ||
371 | break; | ||
372 | case OBEXFTP_EV_DISCONNECTIND: | ||
373 | dlg->log(QCString("Disconnecting")); | ||
374 | break; | ||
375 | |||
376 | case OBEXFTP_EV_INFO: | ||
377 | // 64 bit problems ? | ||
378 | dlg->log(QString("Got info ") + QString::number((int)msg)); | ||
379 | break; | ||
380 | |||
381 | case OBEXFTP_EV_BODY: | ||
382 | break; | ||
383 | |||
384 | case OBEXFTP_EV_PROGRESS: | ||
385 | dlg->incProgress(); | ||
386 | break; | ||
387 | } | ||
388 | } | ||
389 | |||
390 | //eof | ||
diff --git a/noncore/net/opietooth/manager/obexftpdialog.h b/noncore/net/opietooth/manager/obexftpdialog.h new file mode 100644 index 0000000..b13efe5 --- a/dev/null +++ b/noncore/net/opietooth/manager/obexftpdialog.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /* $Id$ */ | ||
2 | /* OBEX file browser dialog */ | ||
3 | /*************************************************************************** | ||
4 | * * | ||
5 | * This program is free software; you can redistribute it and/or modify * | ||
6 | * it under the terms of the GNU General Public License as published by * | ||
7 | * the Free Software Foundation; either version 2 of the License, or * | ||
8 | * (at your option) any later version. * | ||
9 | * * | ||
10 | ***************************************************************************/ | ||
11 | /* | ||
12 | * This code uses and is based on ObexFTP project code: http://triq.net/obexftp/ | ||
13 | */ | ||
14 | #ifndef _OBEXFTPDIALOG_H_ | ||
15 | #define _OBEXFTPDIALOG_H_ | ||
16 | #include "obexftpdialogbase.h" | ||
17 | #include <qstring.h> | ||
18 | #include <obexftp.h> | ||
19 | #include <uuid.h> | ||
20 | #include <client.h> | ||
21 | #include <opie2/ofileselector.h> | ||
22 | #include <qlayout.h> | ||
23 | namespace OpieTooth { | ||
24 | class ObexFtpDialog : public ObexFtpDialogBase { | ||
25 | Q_OBJECT | ||
26 | public: | ||
27 | ObexFtpDialog(const QString& device = 0, int port = 0, | ||
28 | QWidget* parent = 0, const char* name = 0, bool modal = TRUE, | ||
29 | WFlags fl = 0); | ||
30 | ~ObexFtpDialog(); | ||
31 | void log(QString str); | ||
32 | void log(QCString str); | ||
33 | void log(const char* str); | ||
34 | void log(QString& str); | ||
35 | void incProgress(); | ||
36 | void doneProgress(); | ||
37 | protected: | ||
38 | int cli_connect_uuid(const uint8_t *uuid, int uuid_len); | ||
39 | int errBox(QCString msg); //Error message box | ||
40 | int errBox(QString msg); //Error message box | ||
41 | int errBox(const char* msg); //Error message box | ||
42 | void status(QCString msg); //Text in the status bar | ||
43 | void status(QString msg); //Text in the status bar | ||
44 | void status(const char* msg); //Text in the status bar | ||
45 | protected: | ||
46 | QString m_device; //device MAC address | ||
47 | int m_port; //port | ||
48 | int transport; //transport type | ||
49 | bool use_conn; | ||
50 | bool use_path; | ||
51 | obexftp_client_t* client; //Obex ftp client handler | ||
52 | QString curdir; //Current directory on device | ||
53 | QString localCurdir; //Local current directory | ||
54 | QString file2get; //Remote file name | ||
55 | QString local; //Local file name | ||
56 | int progressStatus; //Progress status | ||
57 | Opie::Ui::OFileSelector* destFile; //Destination file or directory | ||
58 | QVBoxLayout* localLayout; //Window layout | ||
59 | private slots: | ||
60 | void slotBrowse(); | ||
61 | void slotCd(QListViewItem* item); | ||
62 | void getFile(); | ||
63 | void updateDir(const QString& newdir); | ||
64 | }; | ||
65 | }; | ||
66 | #endif | ||
diff --git a/noncore/net/opietooth/manager/obexftpdialogbase.cpp b/noncore/net/opietooth/manager/obexftpdialogbase.cpp new file mode 100644 index 0000000..0640511 --- a/dev/null +++ b/noncore/net/opietooth/manager/obexftpdialogbase.cpp | |||
@@ -0,0 +1,131 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form implementation generated from reading ui file 'obexftpdialogbase.ui' | ||
3 | ** | ||
4 | ** Created: Sun Mar 19 16:47:24 2006 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #include "obexftpdialogbase.h" | ||
10 | |||
11 | #include <qcombobox.h> | ||
12 | #include <qheader.h> | ||
13 | #include <qlabel.h> | ||
14 | #include <qlineedit.h> | ||
15 | #include <qlistview.h> | ||
16 | #include <qmultilineedit.h> | ||
17 | #include <qprogressbar.h> | ||
18 | #include <qpushbutton.h> | ||
19 | #include <qtabwidget.h> | ||
20 | #include <qwidget.h> | ||
21 | #include <qlayout.h> | ||
22 | #include <qvariant.h> | ||
23 | #include <qtooltip.h> | ||
24 | #include <qwhatsthis.h> | ||
25 | |||
26 | /* | ||
27 | * Constructs a ObexFtpDialogBase which is a child of 'parent', with the | ||
28 | * name 'name' and widget flags set to 'f' | ||
29 | * | ||
30 | * The dialog will by default be modeless, unless you set 'modal' to | ||
31 | * TRUE to construct a modal dialog. | ||
32 | */ | ||
33 | ObexFtpDialogBase::ObexFtpDialogBase( QWidget* parent, const char* name, bool modal, WFlags fl ) | ||
34 | : QDialog( parent, name, modal, fl ) | ||
35 | { | ||
36 | if ( !name ) | ||
37 | setName( "ObexFtpDialogBase" ); | ||
38 | resize( 221, 396 ); | ||
39 | setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, sizePolicy().hasHeightForWidth() ) ); | ||
40 | setCaption( tr( "Browse device" ) ); | ||
41 | ObexFtpDialogBaseLayout = new QVBoxLayout( this ); | ||
42 | ObexFtpDialogBaseLayout->setSpacing( 0 ); | ||
43 | ObexFtpDialogBaseLayout->setMargin( 0 ); | ||
44 | |||
45 | obexFtpTab = new QTabWidget( this, "obexFtpTab" ); | ||
46 | |||
47 | files = new QWidget( obexFtpTab, "files" ); | ||
48 | filesLayout = new QVBoxLayout( files ); | ||
49 | filesLayout->setSpacing( 0 ); | ||
50 | filesLayout->setMargin( 0 ); | ||
51 | |||
52 | Layout9 = new QVBoxLayout; | ||
53 | Layout9->setSpacing( 6 ); | ||
54 | Layout9->setMargin( 0 ); | ||
55 | |||
56 | fileList = new QListView( files, "fileList" ); | ||
57 | fileList->addColumn( tr( "Name" ) ); | ||
58 | fileList->addColumn( tr( "Size" ) ); | ||
59 | Layout9->addWidget( fileList ); | ||
60 | |||
61 | fileProgress = new QProgressBar( files, "fileProgress" ); | ||
62 | Layout9->addWidget( fileProgress ); | ||
63 | |||
64 | buttons = new QHBoxLayout; | ||
65 | buttons->setSpacing( 6 ); | ||
66 | buttons->setMargin( 0 ); | ||
67 | |||
68 | getButton = new QPushButton( files, "getButton" ); | ||
69 | getButton->setText( tr( "Get file" ) ); | ||
70 | buttons->addWidget( getButton ); | ||
71 | |||
72 | browseOK = new QPushButton( files, "browseOK" ); | ||
73 | browseOK->setText( tr( "Browse" ) ); | ||
74 | buttons->addWidget( browseOK ); | ||
75 | Layout9->addLayout( buttons ); | ||
76 | |||
77 | statusBar = new QLabel( files, "statusBar" ); | ||
78 | statusBar->setText( tr( "" ) ); | ||
79 | Layout9->addWidget( statusBar ); | ||
80 | filesLayout->addLayout( Layout9 ); | ||
81 | obexFtpTab->insertTab( files, tr( "Device" ) ); | ||
82 | |||
83 | localFs = new QWidget( obexFtpTab, "localFs" ); | ||
84 | obexFtpTab->insertTab( localFs, tr( "Local" ) ); | ||
85 | |||
86 | options = new QWidget( obexFtpTab, "options" ); | ||
87 | |||
88 | connRetries = new QLabel( options, "connRetries" ); | ||
89 | connRetries->setGeometry( QRect( 10, 45, 100, 16 ) ); | ||
90 | connRetries->setText( tr( "Retry to connect" ) ); | ||
91 | |||
92 | nReries = new QLineEdit( options, "nReries" ); | ||
93 | nReries->setGeometry( QRect( 115, 40, 60, 23 ) ); | ||
94 | |||
95 | uuidLabel = new QLabel( options, "uuidLabel" ); | ||
96 | uuidLabel->setGeometry( QRect( 15, 20, 67, 15 ) ); | ||
97 | uuidLabel->setText( tr( "uuid type" ) ); | ||
98 | |||
99 | uuidType = new QComboBox( FALSE, options, "uuidType" ); | ||
100 | uuidType->insertItem( tr( "FBS" ) ); | ||
101 | uuidType->insertItem( tr( "S45" ) ); | ||
102 | uuidType->setGeometry( QRect( 85, 10, 100, 30 ) ); | ||
103 | obexFtpTab->insertTab( options, tr( "Options" ) ); | ||
104 | |||
105 | browse = new QWidget( obexFtpTab, "browse" ); | ||
106 | browseLayout = new QHBoxLayout( browse ); | ||
107 | browseLayout->setSpacing( 0 ); | ||
108 | browseLayout->setMargin( 0 ); | ||
109 | |||
110 | browseLog = new QMultiLineEdit( browse, "browseLog" ); | ||
111 | browseLayout->addWidget( browseLog ); | ||
112 | obexFtpTab->insertTab( browse, tr( "Log" ) ); | ||
113 | ObexFtpDialogBaseLayout->addWidget( obexFtpTab ); | ||
114 | |||
115 | // tab order | ||
116 | setTabOrder( obexFtpTab, fileList ); | ||
117 | setTabOrder( fileList, getButton ); | ||
118 | setTabOrder( getButton, browseOK ); | ||
119 | setTabOrder( browseOK, uuidType ); | ||
120 | setTabOrder( uuidType, nReries ); | ||
121 | setTabOrder( nReries, browseLog ); | ||
122 | } | ||
123 | |||
124 | /* | ||
125 | * Destroys the object and frees any allocated resources | ||
126 | */ | ||
127 | ObexFtpDialogBase::~ObexFtpDialogBase() | ||
128 | { | ||
129 | // no need to delete child widgets, Qt does it all for us | ||
130 | } | ||
131 | |||
diff --git a/noncore/net/opietooth/manager/obexftpdialogbase.h b/noncore/net/opietooth/manager/obexftpdialogbase.h new file mode 100644 index 0000000..3a4937a --- a/dev/null +++ b/noncore/net/opietooth/manager/obexftpdialogbase.h | |||
@@ -0,0 +1,60 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'obexftpdialogbase.ui' | ||
3 | ** | ||
4 | ** Created: Sun Mar 19 16:46:33 2006 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef OBEXFTPDIALOGBASE_H | ||
10 | #define OBEXFTPDIALOGBASE_H | ||
11 | |||
12 | #include <qvariant.h> | ||
13 | #include <qdialog.h> | ||
14 | class QVBoxLayout; | ||
15 | class QHBoxLayout; | ||
16 | class QGridLayout; | ||
17 | class QComboBox; | ||
18 | class QLabel; | ||
19 | class QLineEdit; | ||
20 | class QListView; | ||
21 | class QListViewItem; | ||
22 | class QMultiLineEdit; | ||
23 | class QProgressBar; | ||
24 | class QPushButton; | ||
25 | class QTabWidget; | ||
26 | class QWidget; | ||
27 | |||
28 | class ObexFtpDialogBase : public QDialog | ||
29 | { | ||
30 | Q_OBJECT | ||
31 | |||
32 | public: | ||
33 | ObexFtpDialogBase( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | ||
34 | ~ObexFtpDialogBase(); | ||
35 | |||
36 | QTabWidget* obexFtpTab; | ||
37 | QWidget* files; | ||
38 | QListView* fileList; | ||
39 | QProgressBar* fileProgress; | ||
40 | QPushButton* getButton; | ||
41 | QPushButton* browseOK; | ||
42 | QLabel* statusBar; | ||
43 | QWidget* localFs; | ||
44 | QWidget* options; | ||
45 | QLabel* connRetries; | ||
46 | QLineEdit* nReries; | ||
47 | QLabel* uuidLabel; | ||
48 | QComboBox* uuidType; | ||
49 | QWidget* browse; | ||
50 | QMultiLineEdit* browseLog; | ||
51 | |||
52 | protected: | ||
53 | QVBoxLayout* ObexFtpDialogBaseLayout; | ||
54 | QVBoxLayout* filesLayout; | ||
55 | QVBoxLayout* Layout9; | ||
56 | QHBoxLayout* buttons; | ||
57 | QHBoxLayout* browseLayout; | ||
58 | }; | ||
59 | |||
60 | #endif // OBEXFTPDIALOGBASE_H | ||
diff --git a/noncore/net/opietooth/manager/obexftpdialogbase.ui b/noncore/net/opietooth/manager/obexftpdialogbase.ui new file mode 100644 index 0000000..86e87e4 --- a/dev/null +++ b/noncore/net/opietooth/manager/obexftpdialogbase.ui | |||
@@ -0,0 +1,332 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>ObexFtpDialogBase</class> | ||
3 | <widget> | ||
4 | <class>QDialog</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>ObexFtpDialogBase</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>221</width> | ||
15 | <height>396</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>sizePolicy</name> | ||
20 | <sizepolicy> | ||
21 | <hsizetype>7</hsizetype> | ||
22 | <vsizetype>7</vsizetype> | ||
23 | </sizepolicy> | ||
24 | </property> | ||
25 | <property stdset="1"> | ||
26 | <name>caption</name> | ||
27 | <string>Browse device</string> | ||
28 | </property> | ||
29 | <property> | ||
30 | <name>layoutMargin</name> | ||
31 | </property> | ||
32 | <property> | ||
33 | <name>layoutSpacing</name> | ||
34 | </property> | ||
35 | <vbox> | ||
36 | <property stdset="1"> | ||
37 | <name>margin</name> | ||
38 | <number>0</number> | ||
39 | </property> | ||
40 | <property stdset="1"> | ||
41 | <name>spacing</name> | ||
42 | <number>0</number> | ||
43 | </property> | ||
44 | <widget> | ||
45 | <class>QTabWidget</class> | ||
46 | <property stdset="1"> | ||
47 | <name>name</name> | ||
48 | <cstring>obexFtpTab</cstring> | ||
49 | </property> | ||
50 | <property> | ||
51 | <name>layoutMargin</name> | ||
52 | </property> | ||
53 | <property> | ||
54 | <name>layoutSpacing</name> | ||
55 | </property> | ||
56 | <widget> | ||
57 | <class>QWidget</class> | ||
58 | <property stdset="1"> | ||
59 | <name>name</name> | ||
60 | <cstring>files</cstring> | ||
61 | </property> | ||
62 | <attribute> | ||
63 | <name>title</name> | ||
64 | <string>Device</string> | ||
65 | </attribute> | ||
66 | <vbox> | ||
67 | <property stdset="1"> | ||
68 | <name>margin</name> | ||
69 | <number>0</number> | ||
70 | </property> | ||
71 | <property stdset="1"> | ||
72 | <name>spacing</name> | ||
73 | <number>0</number> | ||
74 | </property> | ||
75 | <widget> | ||
76 | <class>QLayoutWidget</class> | ||
77 | <property stdset="1"> | ||
78 | <name>name</name> | ||
79 | <cstring>Layout9</cstring> | ||
80 | </property> | ||
81 | <vbox> | ||
82 | <property stdset="1"> | ||
83 | <name>margin</name> | ||
84 | <number>0</number> | ||
85 | </property> | ||
86 | <property stdset="1"> | ||
87 | <name>spacing</name> | ||
88 | <number>6</number> | ||
89 | </property> | ||
90 | <widget> | ||
91 | <class>QListView</class> | ||
92 | <column> | ||
93 | <property> | ||
94 | <name>text</name> | ||
95 | <string>Name</string> | ||
96 | </property> | ||
97 | <property> | ||
98 | <name>clickable</name> | ||
99 | <bool>true</bool> | ||
100 | </property> | ||
101 | <property> | ||
102 | <name>resizeable</name> | ||
103 | <bool>true</bool> | ||
104 | </property> | ||
105 | </column> | ||
106 | <column> | ||
107 | <property> | ||
108 | <name>text</name> | ||
109 | <string>Size</string> | ||
110 | </property> | ||
111 | <property> | ||
112 | <name>clickable</name> | ||
113 | <bool>true</bool> | ||
114 | </property> | ||
115 | <property> | ||
116 | <name>resizeable</name> | ||
117 | <bool>true</bool> | ||
118 | </property> | ||
119 | </column> | ||
120 | <property stdset="1"> | ||
121 | <name>name</name> | ||
122 | <cstring>fileList</cstring> | ||
123 | </property> | ||
124 | </widget> | ||
125 | <widget> | ||
126 | <class>QProgressBar</class> | ||
127 | <property stdset="1"> | ||
128 | <name>name</name> | ||
129 | <cstring>fileProgress</cstring> | ||
130 | </property> | ||
131 | </widget> | ||
132 | <widget> | ||
133 | <class>QLayoutWidget</class> | ||
134 | <property stdset="1"> | ||
135 | <name>name</name> | ||
136 | <cstring>buttons</cstring> | ||
137 | </property> | ||
138 | <hbox> | ||
139 | <property stdset="1"> | ||
140 | <name>margin</name> | ||
141 | <number>0</number> | ||
142 | </property> | ||
143 | <property stdset="1"> | ||
144 | <name>spacing</name> | ||
145 | <number>6</number> | ||
146 | </property> | ||
147 | <widget> | ||
148 | <class>QPushButton</class> | ||
149 | <property stdset="1"> | ||
150 | <name>name</name> | ||
151 | <cstring>getButton</cstring> | ||
152 | </property> | ||
153 | <property stdset="1"> | ||
154 | <name>text</name> | ||
155 | <string>Get file</string> | ||
156 | </property> | ||
157 | </widget> | ||
158 | <widget> | ||
159 | <class>QPushButton</class> | ||
160 | <property stdset="1"> | ||
161 | <name>name</name> | ||
162 | <cstring>browseOK</cstring> | ||
163 | </property> | ||
164 | <property stdset="1"> | ||
165 | <name>text</name> | ||
166 | <string>Browse</string> | ||
167 | </property> | ||
168 | </widget> | ||
169 | </hbox> | ||
170 | </widget> | ||
171 | <widget> | ||
172 | <class>QLabel</class> | ||
173 | <property stdset="1"> | ||
174 | <name>name</name> | ||
175 | <cstring>statusBar</cstring> | ||
176 | </property> | ||
177 | <property stdset="1"> | ||
178 | <name>text</name> | ||
179 | <string></string> | ||
180 | </property> | ||
181 | </widget> | ||
182 | </vbox> | ||
183 | </widget> | ||
184 | </vbox> | ||
185 | </widget> | ||
186 | <widget> | ||
187 | <class>QWidget</class> | ||
188 | <property stdset="1"> | ||
189 | <name>name</name> | ||
190 | <cstring>localFs</cstring> | ||
191 | </property> | ||
192 | <attribute> | ||
193 | <name>title</name> | ||
194 | <string>Local</string> | ||
195 | </attribute> | ||
196 | </widget> | ||
197 | <widget> | ||
198 | <class>QWidget</class> | ||
199 | <property stdset="1"> | ||
200 | <name>name</name> | ||
201 | <cstring>options</cstring> | ||
202 | </property> | ||
203 | <attribute> | ||
204 | <name>title</name> | ||
205 | <string>Options</string> | ||
206 | </attribute> | ||
207 | <widget> | ||
208 | <class>QLabel</class> | ||
209 | <property stdset="1"> | ||
210 | <name>name</name> | ||
211 | <cstring>connRetries</cstring> | ||
212 | </property> | ||
213 | <property stdset="1"> | ||
214 | <name>geometry</name> | ||
215 | <rect> | ||
216 | <x>10</x> | ||
217 | <y>45</y> | ||
218 | <width>100</width> | ||
219 | <height>16</height> | ||
220 | </rect> | ||
221 | </property> | ||
222 | <property stdset="1"> | ||
223 | <name>text</name> | ||
224 | <string>Retry to connect</string> | ||
225 | </property> | ||
226 | </widget> | ||
227 | <widget> | ||
228 | <class>QLineEdit</class> | ||
229 | <property stdset="1"> | ||
230 | <name>name</name> | ||
231 | <cstring>nReries</cstring> | ||
232 | </property> | ||
233 | <property stdset="1"> | ||
234 | <name>geometry</name> | ||
235 | <rect> | ||
236 | <x>115</x> | ||
237 | <y>40</y> | ||
238 | <width>60</width> | ||
239 | <height>23</height> | ||
240 | </rect> | ||
241 | </property> | ||
242 | </widget> | ||
243 | <widget> | ||
244 | <class>QLabel</class> | ||
245 | <property stdset="1"> | ||
246 | <name>name</name> | ||
247 | <cstring>uuidLabel</cstring> | ||
248 | </property> | ||
249 | <property stdset="1"> | ||
250 | <name>geometry</name> | ||
251 | <rect> | ||
252 | <x>15</x> | ||
253 | <y>20</y> | ||
254 | <width>67</width> | ||
255 | <height>15</height> | ||
256 | </rect> | ||
257 | </property> | ||
258 | <property stdset="1"> | ||
259 | <name>text</name> | ||
260 | <string>uuid type</string> | ||
261 | </property> | ||
262 | </widget> | ||
263 | <widget> | ||
264 | <class>QComboBox</class> | ||
265 | <item> | ||
266 | <property> | ||
267 | <name>text</name> | ||
268 | <string>FBS</string> | ||
269 | </property> | ||
270 | </item> | ||
271 | <item> | ||
272 | <property> | ||
273 | <name>text</name> | ||
274 | <string>S45</string> | ||
275 | </property> | ||
276 | </item> | ||
277 | <property stdset="1"> | ||
278 | <name>name</name> | ||
279 | <cstring>uuidType</cstring> | ||
280 | </property> | ||
281 | <property stdset="1"> | ||
282 | <name>geometry</name> | ||
283 | <rect> | ||
284 | <x>85</x> | ||
285 | <y>10</y> | ||
286 | <width>100</width> | ||
287 | <height>30</height> | ||
288 | </rect> | ||
289 | </property> | ||
290 | </widget> | ||
291 | </widget> | ||
292 | <widget> | ||
293 | <class>QWidget</class> | ||
294 | <property stdset="1"> | ||
295 | <name>name</name> | ||
296 | <cstring>browse</cstring> | ||
297 | </property> | ||
298 | <attribute> | ||
299 | <name>title</name> | ||
300 | <string>Log</string> | ||
301 | </attribute> | ||
302 | <hbox> | ||
303 | <property stdset="1"> | ||
304 | <name>margin</name> | ||
305 | <number>0</number> | ||
306 | </property> | ||
307 | <property stdset="1"> | ||
308 | <name>spacing</name> | ||
309 | <number>0</number> | ||
310 | </property> | ||
311 | <widget> | ||
312 | <class>QMultiLineEdit</class> | ||
313 | <property stdset="1"> | ||
314 | <name>name</name> | ||
315 | <cstring>browseLog</cstring> | ||
316 | </property> | ||
317 | </widget> | ||
318 | </hbox> | ||
319 | </widget> | ||
320 | </widget> | ||
321 | </vbox> | ||
322 | </widget> | ||
323 | <tabstops> | ||
324 | <tabstop>obexFtpTab</tabstop> | ||
325 | <tabstop>fileList</tabstop> | ||
326 | <tabstop>getButton</tabstop> | ||
327 | <tabstop>browseOK</tabstop> | ||
328 | <tabstop>uuidType</tabstop> | ||
329 | <tabstop>nReries</tabstop> | ||
330 | <tabstop>browseLog</tabstop> | ||
331 | </tabstops> | ||
332 | </UI> | ||
diff --git a/noncore/net/opietooth/manager/obexftpopup.cpp b/noncore/net/opietooth/manager/obexftpopup.cpp new file mode 100644 index 0000000..38f3a43 --- a/dev/null +++ b/noncore/net/opietooth/manager/obexftpopup.cpp | |||
@@ -0,0 +1,67 @@ | |||
1 | /* $Id$ */ | ||
2 | /* OBEX file browser popup */ | ||
3 | /*************************************************************************** | ||
4 | * * | ||
5 | * This program is free software; you can redistribute it and/or modify * | ||
6 | * it under the terms of the GNU General Public License as published by * | ||
7 | * the Free Software Foundation; either version 2 of the License, or * | ||
8 | * (at your option) any later version. * | ||
9 | * * | ||
10 | ***************************************************************************/ | ||
11 | #include "obexdialog.h" | ||
12 | #include "obexftpopup.h" | ||
13 | #include "obexftpdialog.h" | ||
14 | |||
15 | /* OPIE */ | ||
16 | #include <qpe/qpeapplication.h> | ||
17 | #include <opie2/odebug.h> | ||
18 | using namespace Opie::Core; | ||
19 | using namespace OpieTooth; | ||
20 | |||
21 | ObexFtpPopup::ObexFtpPopup(const OpieTooth::Services& service, | ||
22 | OpieTooth::BTDeviceItem* item) | ||
23 | : QPopupMenu(), m_service(service) | ||
24 | { | ||
25 | odebug << "ObexFtpPopup c'tor" << oendl; | ||
26 | |||
27 | m_item = item; | ||
28 | /* connect action */ | ||
29 | m_push = new QAction( ); // so it's get deleted | ||
30 | m_push->setText("Push file"); | ||
31 | m_push->addTo( this ); | ||
32 | connect(m_push, SIGNAL(activated()), SLOT(slotPush())); | ||
33 | |||
34 | /* browse action */ | ||
35 | m_browse = new QAction(this); | ||
36 | m_browse->setText("Browse device"); | ||
37 | m_browse->addTo(this); | ||
38 | connect(m_browse, SIGNAL(activated()), SLOT(slotBrowse())); | ||
39 | } | ||
40 | |||
41 | |||
42 | ObexFtpPopup::~ObexFtpPopup() | ||
43 | { | ||
44 | delete m_push; | ||
45 | delete m_browse; | ||
46 | } | ||
47 | |||
48 | void ObexFtpPopup::slotBrowse() | ||
49 | { | ||
50 | odebug << "browse" <<oendl; | ||
51 | ObexFtpDialog ftpDlg(m_item->mac(), | ||
52 | m_service.protocolDescriptorList().last().port()); | ||
53 | QPEApplication::execDialog(&ftpDlg); | ||
54 | } | ||
55 | |||
56 | void ObexFtpPopup::slotPush() | ||
57 | { | ||
58 | QString device = m_item->mac(); | ||
59 | int port = m_service.protocolDescriptorList().last().port(); | ||
60 | device += "@"; | ||
61 | device += QString::number(port); | ||
62 | owarn << "push something to " << device << oendl; | ||
63 | ObexDialog obexDialog(device); | ||
64 | QPEApplication::execDialog( &obexDialog ); | ||
65 | } | ||
66 | |||
67 | //eof | ||
diff --git a/noncore/net/opietooth/manager/obexftpopup.h b/noncore/net/opietooth/manager/obexftpopup.h new file mode 100644 index 0000000..f7acb86 --- a/dev/null +++ b/noncore/net/opietooth/manager/obexftpopup.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* $Id$ */ | ||
2 | /* OBEX file browser popup */ | ||
3 | /*************************************************************************** | ||
4 | * * | ||
5 | * This program is free software; you can redistribute it and/or modify * | ||
6 | * it under the terms of the GNU General Public License as published by * | ||
7 | * the Free Software Foundation; either version 2 of the License, or * | ||
8 | * (at your option) any later version. * | ||
9 | * * | ||
10 | ***************************************************************************/ | ||
11 | #ifndef _OBEXFTPPOPUP_H_ | ||
12 | #define _OBEXFTPPOPUP_H_ | ||
13 | #include <qpopupmenu.h> | ||
14 | #include <qaction.h> | ||
15 | #include <services.h> | ||
16 | #include "btdeviceitem.h" | ||
17 | namespace OpieTooth { | ||
18 | |||
19 | class ObexFtpPopup : public QPopupMenu { | ||
20 | Q_OBJECT | ||
21 | |||
22 | public: | ||
23 | ObexFtpPopup(const OpieTooth::Services&, OpieTooth::BTDeviceItem*); | ||
24 | ~ObexFtpPopup(); | ||
25 | private: | ||
26 | QAction* m_push; | ||
27 | QAction* m_browse; | ||
28 | OpieTooth::BTDeviceItem *m_item; | ||
29 | Services m_service; | ||
30 | protected slots: | ||
31 | void slotBrowse(); | ||
32 | void slotPush(); | ||
33 | }; | ||
34 | }; | ||
35 | #endif | ||
diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp index 19deb19..bd2071a 100644 --- a/noncore/net/opietooth/manager/popuphelper.cpp +++ b/noncore/net/opietooth/manager/popuphelper.cpp | |||
@@ -31,6 +31,6 @@ void PopupHelper::init() { | |||
31 | insert( 4354, newDunPopup ); | 31 | insert( 4354, newDunPopup ); |
32 | insert( 4353, newRfcComPopup ); | 32 | insert( 4353, newRfcComPopup ); |
33 | insert( 4357, newObexPushPopup ); | 33 | insert( 4357, newObexPushPopup ); |
34 | insert( 4358, newObexPushPopup ); | 34 | insert( 4358, newObexFtpPopup ); |
35 | insert( 4374, newPanPopup ); | 35 | insert( 4374, newPanPopup ); |
36 | } | 36 | } |
diff --git a/noncore/net/opietooth/manager/stdpopups.cpp b/noncore/net/opietooth/manager/stdpopups.cpp index e1f8396..68f19c0 100644 --- a/noncore/net/opietooth/manager/stdpopups.cpp +++ b/noncore/net/opietooth/manager/stdpopups.cpp | |||
@@ -1,6 +1,7 @@ | |||
1 | 1 | ||
2 | #include "rfcpopup.h" | 2 | #include "rfcpopup.h" |
3 | #include "obexpopup.h" | 3 | #include "obexpopup.h" |
4 | #include "obexftpopup.h" | ||
4 | #include "panpopup.h" | 5 | #include "panpopup.h" |
5 | #include "dunpopup.h" | 6 | #include "dunpopup.h" |
6 | 7 | ||
@@ -9,17 +10,19 @@ | |||
9 | extern "C" { | 10 | extern "C" { |
10 | 11 | ||
11 | QPopupMenu* newRfcComPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { | 12 | QPopupMenu* newRfcComPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { |
12 | return new OpieTooth::RfcCommPopup(/* servive,*/ item ); // fix spellin RfComm vs. RfcComm and paramaters | 13 | return new OpieTooth::RfcCommPopup(service, item); // fix spellin RfComm vs. RfcComm and paramaters |
13 | //return 0l; | ||
14 | } | 14 | } |
15 | QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ) { | 15 | QPopupMenu* newObexPushPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item) { |
16 | return new OpieTooth::ObexPopup(); | 16 | return new OpieTooth::ObexPopup(service, item); |
17 | } | 17 | } |
18 | QPopupMenu* newPanPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { | 18 | QPopupMenu* newObexFtpPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item) { |
19 | return new OpieTooth::ObexFtpPopup(service, item); | ||
20 | } | ||
21 | QPopupMenu* newPanPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* item ) { | ||
19 | return new OpieTooth::PanPopup( item ); | 22 | return new OpieTooth::PanPopup( item ); |
20 | } | 23 | } |
21 | 24 | ||
22 | QPopupMenu* newDunPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { | 25 | QPopupMenu* newDunPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* item ) { |
23 | return new OpieTooth::DunPopup( item ); | 26 | return new OpieTooth::DunPopup( item ); |
24 | } | 27 | } |
25 | } | 28 | } |
diff --git a/noncore/net/opietooth/manager/stdpopups.h b/noncore/net/opietooth/manager/stdpopups.h index f52dc3a..3c361db 100644 --- a/noncore/net/opietooth/manager/stdpopups.h +++ b/noncore/net/opietooth/manager/stdpopups.h | |||
@@ -15,6 +15,7 @@ extern "C" { | |||
15 | QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ); | 15 | QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ); |
16 | QPopupMenu* newPanPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ); | 16 | QPopupMenu* newPanPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ); |
17 | QPopupMenu* newDunPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ); | 17 | QPopupMenu* newDunPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ); |
18 | QPopupMenu* newObexFtpPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ); | ||
18 | } | 19 | } |
19 | 20 | ||
20 | #endif | 21 | #endif |