summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/ReleaseNotes.txt9
-rw-r--r--noncore/net/opietooth/manager/TODO.txt6
-rw-r--r--noncore/net/opietooth/manager/filelistitem.cpp71
-rw-r--r--noncore/net/opietooth/manager/filelistitem.h38
-rw-r--r--noncore/net/opietooth/manager/manager.pro25
-rw-r--r--noncore/net/opietooth/manager/obexftpdialog.cpp390
-rw-r--r--noncore/net/opietooth/manager/obexftpdialog.h66
-rw-r--r--noncore/net/opietooth/manager/obexftpdialogbase.cpp131
-rw-r--r--noncore/net/opietooth/manager/obexftpdialogbase.h60
-rw-r--r--noncore/net/opietooth/manager/obexftpdialogbase.ui332
-rw-r--r--noncore/net/opietooth/manager/obexftpopup.cpp67
-rw-r--r--noncore/net/opietooth/manager/obexftpopup.h35
-rw-r--r--noncore/net/opietooth/manager/popuphelper.cpp2
-rw-r--r--noncore/net/opietooth/manager/stdpopups.cpp15
-rw-r--r--noncore/net/opietooth/manager/stdpopups.h1
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 @@
+Sun 19 Mar 2006 17:29:28
+1. In order to build manager you need to build obexftp >= 0.18
+ (http://triq.net/obexftp/) with crosscompiler and put client.h, obexftp.h,
+ object.h and uuid.h files to $LIBBLUEZ_INC_DIR/obexftp and libobexftp.a,
+ libmulticobex.a and libbfb.a to $LIBBLUEZ_LIB_DIR.
+2. In "ppp connection" dialog if you press connect with an empty ppp script
+ name it runs rfcomm connect 0 <device> <port>.
+
+//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. Add a "Put file" function to bluetooth manager file transfer protocol.
+2. Make bind table edit /etc/bluetooth/rfcomm.conf file.
+3. Add an rfcomm port number to the connection dialog.
+4. Collect requirements from others.
+
+//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 @@
+/* $Id$ */
+/* Directory tree entry */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "filelistitem.h"
+#include <qpe/resource.h>
+
+using namespace OpieTooth;
+
+FileListItem::FileListItem(QListView* parent, stat_entry_t* ent, int size) :
+ QListViewItem(parent)
+{
+ init(ent, size);
+}
+
+FileListItem::FileListItem(QListViewItem* parent, stat_entry_t* ent, int size) :
+ QListViewItem(parent), m_name(ent->name)
+{
+ init(ent, size);
+}
+
+void FileListItem::init(stat_entry_t* ent, int size)
+{
+ if (ent == NULL) {
+ type = IS_DIR;
+ m_name = ".."; //Upper directory
+ m_size = 0;
+ }
+ else {
+ m_name = ent->name;
+ if (ent->mode == 16877)
+ type = IS_DIR;
+ else
+ type = IS_FILE;
+ }
+ if (type == IS_DIR) {
+ setPixmap(0, Resource::loadPixmap("folder"));
+ setText(0, m_name + QString("/"));
+ m_size = 0;
+ }
+ else {
+ setPixmap(0, Resource::loadPixmap("c_src"));
+ setText(0, m_name);
+ m_size = size;
+ setText(1, QString::number(m_size));
+ }
+}
+
+QString FileListItem::key(int, bool) const
+{
+ QString str; //resulting string
+ if (type == IS_DIR)
+ str = "0";
+ else
+ str = "1";
+ str += m_name;
+ return str;
+}
+
+enum dtype FileListItem::gettype()
+{
+ return type;
+}
+
+//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 @@
+/* $Id$ */
+/* Directory tree entry */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef FILELISTITEM_H
+#define FILELISTITEM_H
+
+#include <qlistview.h>
+#include <sys/stat.h>
+#include <client.h>
+
+enum dtype { IS_DIR = 0, IS_FILE = 1 };
+
+namespace OpieTooth {
+
+ class FileListItem : public QListViewItem {
+ Q_OBJECT
+ public:
+ FileListItem(QListView * parent, stat_entry_t* ent, int size = 0);
+ FileListItem(QListViewItem * parent, stat_entry_t* ent, int size = 0);
+ virtual QString key ( int, bool ) const;
+ virtual enum dtype gettype();
+ protected:
+ void init(stat_entry_t* ent, int size);
+ protected:
+ QString m_name; //name
+ int m_size; //file (not directory) size
+ enum dtype type; //type: file or directory
+ };
+};
+
+#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
@@ -1,30 +1,41 @@
CONFIG = qt warn_on quick-app
HEADERS = btconnectionitem.h btdeviceitem.h \
btserviceitem.h stdpopups.h \
popuphelper.h bluebase.h \
- scandialog.h btlistitem.h \
+ scandialog.h btlistitem.h filistitem.h \
hciconfwrapper.h bticonloader.h \
- pppdialog.h obexdialog.h \
+ pppdialog.h obexdialog.h obexftpdialog.h \
rfcommassigndialogimpl.h rfcommassigndialogitem.h \
- devicehandler.h rfcpopup.h obexpopup.h \
+ devicehandler.h rfcpopup.h obexpopup.h obexftpopup.h \
rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h
SOURCES = btconnectionitem.cpp btdeviceitem.cpp \
- btserviceitem.cpp stdpopups.cpp \
+ btserviceitem.cpp filelistitem.cpp stdpopups.cpp \
popuphelper.cpp main.cpp \
bluebase.cpp scandialog.cpp \
btlistitem.cpp hciconfwrapper.cpp \
bticonloader.cpp pppdialog.cpp \
rfcommassigndialogimpl.cpp rfcommassigndialogitem.cpp \
obexdialog.cpp devicehandler.cpp \
- rfcpopup.cpp obexpopup.cpp \
+ rfcpopup.cpp obexpopup.cpp obexftpopup.cpp obexftpdialog.cpp \
rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp
INCLUDEPATH += $(OPIEDIR)/include
INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lopietooth1 -lopiecore2 -lopieui2
-INTERFACES = bluetoothbase.ui devicedialog.ui rfcommassigndialogbase.ui rfcommdialogitembase.ui
+LIBS += -lqpe -lbluetooth -lopietooth1 -lopiecore2 -lopieui2 -lopenobex
+INTERFACES = bluetoothbase.ui devicedialog.ui rfcommassigndialogbase.ui \
+ rfcommdialogitembase.ui obexftpdialogbase.ui
TARGET = bluetooth-manager
include( $(OPIEDIR)/include.pro )
+
+!isEmpty( LIBBLUEZ_INC_DIR ) {
+ INCLUDEPATH += $$LIBBLUEZ_INC_DIR/obexftp
+}
+
+!isEmpty( LIBBLUEZ_LIB_DIR ) {
+ LIBS += $$LIBBLUEZ_LIB_DIR/libobexftp.a
+ LIBS += $$LIBBLUEZ_LIB_DIR/libmulticobex.a
+ LIBS += $$LIBBLUEZ_LIB_DIR/libbfb.a
+} \ 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 @@
+/* $Id$ */
+/* OBEX file browser dialog */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+/*
+ * This code uses and is based on ObexFTP project code: http://triq.net/obexftp/
+ */
+#include <sys/stat.h>
+#include <qpushbutton.h>
+#include <qmessagebox.h>
+#include <qmultilineedit.h>
+#include <qlistview.h>
+#include <qprogressbar.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <errno.h>
+#include "obexftpdialog.h"
+#include "filelistitem.h"
+
+#include <qpe/qpeapplication.h>
+#include <qpe/resource.h>
+#include <qpe/config.h>
+#include <opie2/odebug.h>
+#include <opie2/ofileselector.h>
+
+using namespace Opie::Core;
+using namespace Opie::Ui;
+
+using namespace OpieTooth;
+
+#define MAX_PROGRESS 14 //Maximal progress bar
+
+static void info_cb(int event, const char *msg, int len, void* data);
+
+/*
+ * Public constructor
+ * device - bluetooth address of the device
+ * port - port to connect to
+ */
+ObexFtpDialog::ObexFtpDialog(const QString& device, int port,
+ QWidget* parent, const char* name, bool modal, WFlags fl)
+ : ObexFtpDialogBase(parent, name, modal, fl), m_device(device),
+ m_port(port), curdir("")
+{
+ client = NULL;
+ transport = OBEX_TRANS_BLUETOOTH;
+ use_conn = TRUE;
+ use_path = TRUE;
+ progressStatus = 0;
+ localCurdir = "/";
+ browseLog->setEdited(FALSE);
+ fileList->setSorting(1);
+ fileList->clear();
+ fileProgress->setTotalSteps(MAX_PROGRESS);
+ statusBar->clear();
+ localLayout = new QVBoxLayout(localFs);
+ localLayout->setSpacing( 0 );
+ localLayout->setMargin( 0 );
+ destFile = new OFileSelector(localFs,
+ OFileSelector::FileSelector,
+ OFileSelector::ExtendedAll, localCurdir, "");
+ destFile->setCloseVisible(false);
+ destFile->setNewVisible(false);
+ localLayout->addWidget(destFile);
+ connect(browseOK, SIGNAL(clicked()), SLOT(slotBrowse()));
+ connect(fileList, SIGNAL(clicked(QListViewItem*)),
+ SLOT(slotCd(QListViewItem*)));
+ connect(getButton,
+ SIGNAL(clicked()),
+ SLOT(getFile()));
+ connect(destFile,
+ SIGNAL(dirSelected (const QString&)),
+ SLOT(updateDir(const QString&)));
+}
+
+ObexFtpDialog::~ObexFtpDialog()
+{
+ if (client != NULL) {
+ obexftp_disconnect(client);
+ obexftp_close(client);
+ }
+}
+
+/*
+ * Do device browsing
+ */
+void ObexFtpDialog::slotBrowse()
+{
+ stat_entry_t* ent; //Directory entry
+ void *dir; //Directory to read
+ const uint8_t use_uuid[] = __UUID_FBS_bytes;
+ int len = sizeof(UUID_FBS);
+ FileListItem* root; //root node
+ stat_entry_t* st; //File statistics
+ int fsize; //file size
+
+ status(tr("Connecting to ") + m_device);
+ odebug << "Browse device " << m_device << oendl;
+ browseLog->clear();
+ fileList->clear();
+ progressStatus = 0;
+ fileProgress->reset();
+ if (!cli_connect_uuid(use_uuid, len)) {
+ log("Connection failed");
+ errBox("Connection failed");
+ status("Connection failed");
+ return;
+ }
+ else {
+ log(QString("Connected to ") + m_device);
+ status(QString("Connected to ") + m_device);
+ }
+ /* List folder */
+ root = new FileListItem(fileList, NULL);
+ dir = obexftp_opendir(client, curdir);
+ while ((ent = obexftp_readdir(dir)) != NULL) {
+ FileListItem* a; //List view item
+#if 0 //Causes sigsegv
+ if (ent->mode != 16877) {
+ st = obexftp_stat(client, ent->name);
+ fsize = st->size;
+ }
+ else
+#endif
+ fsize = 0;
+ log(QString(ent->name) + QString(" ") +
+ QString::number(ent->mode));
+
+ a = new FileListItem(fileList, ent, fsize);
+ }
+ obexftp_closedir(dir);
+}
+
+//Error message box
+int ObexFtpDialog::errBox(QCString msg)
+{
+ return QMessageBox::critical(this, tr("ObexFTP error"), msg);
+}
+
+int ObexFtpDialog::errBox(QString msg)
+{
+ return QMessageBox::critical(this, tr("ObexFTP error"), msg);
+}
+
+int ObexFtpDialog::errBox(const char* msg)
+{
+ return QMessageBox::critical(this, tr("ObexFTP error"), tr(msg));
+}
+
+//Text in the status bar
+void ObexFtpDialog::status(QCString msg)
+{
+ statusBar->setText(msg);
+ statusBar->repaint();
+}
+
+void ObexFtpDialog::status(QString msg)
+{
+ statusBar->setText(msg);
+ statusBar->repaint();
+}
+
+void ObexFtpDialog::status(const char* msg)
+{
+ statusBar->setText(msg);
+ statusBar->repaint();
+}
+
+/*
+ * Change directory with item under the cursor
+ */
+void ObexFtpDialog::slotCd(QListViewItem* item)
+{
+ FileListItem* file = (FileListItem*)item;
+ int idx;
+ if (file == NULL)
+ return;
+ odebug << "Item " << file->text(0) << " clicked" << oendl;
+ if (file->gettype() == IS_DIR) {
+ if (file->text(0) == "../") {
+ if (curdir.right(1) == "/")
+ curdir.remove(curdir.length() - 1, 1);
+ idx = curdir.findRev('/');
+ if (idx >= 0)
+ curdir.remove(idx, curdir.length() - idx);
+ else
+ curdir = "";
+ }
+ else {
+ if (curdir != "" && curdir.right(1) != "/")
+ curdir += "/";
+ curdir += file->text(0);
+ }
+ odebug << "Browse " << curdir << oendl;
+ if (obexftp_setpath(client, curdir, 0) < 0)
+ log("CD failed");
+ slotBrowse();
+ }
+}
+
+/*
+ * Get the file
+ */
+void ObexFtpDialog::getFile()
+{
+ FileListItem* file = (FileListItem*)fileList->selectedItem();
+ int result;
+ if (file == NULL)
+ return;
+ file2get = "/";
+ local = localCurdir;
+ if (local == "") {
+ errBox("Select a destination first");
+ return;
+ }
+ if (local.right(1) != "/")
+ local += "/";
+ if (file->gettype() == IS_FILE) {
+ file2get += curdir;
+ if (curdir != "" && curdir.right(1) != "/")
+ file2get += "/";
+ file2get += file->text(0);
+ local += file->text(0);
+ odebug << "Copy " << file2get << " to " << local << oendl;
+ progressStatus = 0;
+ fileProgress->reset();
+ status(tr("Receiving file ") + file2get);
+ result = obexftp_get(client, local, file2get);
+ if (result < 0) {
+ log(file2get + QString(" receive ERROR"));
+ errBox(file2get + QString(" receive ERROR"));
+ status(file2get + QString(" receive ERROR"));
+ }
+ else {
+ log(file2get + QString(" received"));
+ status(file2get + QString(" received"));
+ destFile->reread();
+ }
+ }
+}
+
+/* connect with given uuid. re-connect every time */
+int ObexFtpDialog::cli_connect_uuid(const uint8_t *uuid, int uuid_len)
+{
+ int retry;
+ if (client != NULL)
+ return TRUE;
+ /* Open */
+ client = obexftp_open (transport, NULL, info_cb, this);
+ if(client == NULL) {
+ errBox("Error opening obexftp-client");
+ return FALSE;
+ }
+ if (!use_conn)
+ client->quirks &= ~OBEXFTP_CONN_HEADER;
+ if (!use_path)
+ client->quirks &= ~OBEXFTP_SPLIT_SETPATH;
+ for (retry = 0; retry < 3; retry++) {
+ /* Connect */
+ switch (transport) {
+ case OBEX_TRANS_IRDA:
+ if (obexftp_connect_uuid(client, NULL, 0, uuid, uuid_len) >= 0)
+ return TRUE;
+ break;
+ case OBEX_TRANS_BLUETOOTH:
+ if (obexftp_connect_uuid(client, m_device, m_port,
+ uuid, uuid_len) >= 0)
+ return TRUE;
+ break;
+ default:
+ errBox("Transport type unknown");
+ return FALSE;
+ }
+ log(tr("Still trying to connect"));
+ }
+ client = NULL;
+
+ return FALSE;
+}
+
+/*
+ * Put a message to the log window
+ */
+void ObexFtpDialog::log(QString str)
+{
+ browseLog->append(str);
+}
+
+void ObexFtpDialog::log(QCString str)
+{
+ browseLog->append(str);
+}
+
+void ObexFtpDialog::log(QString& str)
+{
+ browseLog->append(str);
+}
+
+void ObexFtpDialog::log(const char* str)
+{
+ browseLog->append(str);
+}
+
+void ObexFtpDialog::incProgress()
+{
+ odebug << "Progress " << progressStatus << oendl;
+ if (progressStatus < MAX_PROGRESS) {
+ fileProgress->setProgress(progressStatus++);
+ }
+}
+
+void ObexFtpDialog::doneProgress()
+{
+ progressStatus = 0;
+ fileProgress->reset();
+}
+
+void ObexFtpDialog::updateDir(const QString& newdir)
+{
+ localCurdir = newdir;
+}
+
+/*
+ * Event callback function
+ */
+static void info_cb(int event, const char *msg, int len, void* data)
+{
+ ObexFtpDialog* dlg = (ObexFtpDialog*)data;
+ QCString cmsg(msg, len); //Message to display
+
+ switch (event) {
+
+ case OBEXFTP_EV_ERRMSG:
+ dlg->log(QCString("Error: ") + cmsg);
+ break;
+
+ case OBEXFTP_EV_ERR:
+ dlg->log(QCString("failed: ") + cmsg);
+ dlg->doneProgress();
+ break;
+ case OBEXFTP_EV_OK:
+ dlg->log(QCString("done"));
+ dlg->doneProgress();
+ break;
+
+ case OBEXFTP_EV_CONNECTING:
+ dlg->log(QCString("Connecting..."));
+ break;
+ case OBEXFTP_EV_DISCONNECTING:
+ dlg->log(QCString("Disconnecting..."));
+ break;
+ case OBEXFTP_EV_SENDING:
+ dlg->log(QCString("Sending ") + msg);
+ break;
+ case OBEXFTP_EV_RECEIVING:
+ dlg->log(QCString("Receiving ") + msg);
+ break;
+
+ case OBEXFTP_EV_LISTENING:
+ dlg->log(QCString("Waiting for incoming connection"));
+ break;
+
+ case OBEXFTP_EV_CONNECTIND:
+ dlg->log(QCString("Incoming connection"));
+ break;
+ case OBEXFTP_EV_DISCONNECTIND:
+ dlg->log(QCString("Disconnecting"));
+ break;
+
+ case OBEXFTP_EV_INFO:
+ // 64 bit problems ?
+ dlg->log(QString("Got info ") + QString::number((int)msg));
+ break;
+
+ case OBEXFTP_EV_BODY:
+ break;
+
+ case OBEXFTP_EV_PROGRESS:
+ dlg->incProgress();
+ break;
+ }
+}
+
+//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 @@
+/* $Id$ */
+/* OBEX file browser dialog */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+/*
+ * This code uses and is based on ObexFTP project code: http://triq.net/obexftp/
+ */
+#ifndef _OBEXFTPDIALOG_H_
+#define _OBEXFTPDIALOG_H_
+#include "obexftpdialogbase.h"
+#include <qstring.h>
+#include <obexftp.h>
+#include <uuid.h>
+#include <client.h>
+#include <opie2/ofileselector.h>
+#include <qlayout.h>
+namespace OpieTooth {
+ class ObexFtpDialog : public ObexFtpDialogBase {
+ Q_OBJECT
+ public:
+ ObexFtpDialog(const QString& device = 0, int port = 0,
+ QWidget* parent = 0, const char* name = 0, bool modal = TRUE,
+ WFlags fl = 0);
+ ~ObexFtpDialog();
+ void log(QString str);
+ void log(QCString str);
+ void log(const char* str);
+ void log(QString& str);
+ void incProgress();
+ void doneProgress();
+ protected:
+ int cli_connect_uuid(const uint8_t *uuid, int uuid_len);
+ int errBox(QCString msg); //Error message box
+ int errBox(QString msg); //Error message box
+ int errBox(const char* msg); //Error message box
+ void status(QCString msg); //Text in the status bar
+ void status(QString msg); //Text in the status bar
+ void status(const char* msg); //Text in the status bar
+ protected:
+ QString m_device; //device MAC address
+ int m_port; //port
+ int transport; //transport type
+ bool use_conn;
+ bool use_path;
+ obexftp_client_t* client; //Obex ftp client handler
+ QString curdir; //Current directory on device
+ QString localCurdir; //Local current directory
+ QString file2get; //Remote file name
+ QString local; //Local file name
+ int progressStatus; //Progress status
+ Opie::Ui::OFileSelector* destFile; //Destination file or directory
+ QVBoxLayout* localLayout; //Window layout
+ private slots:
+ void slotBrowse();
+ void slotCd(QListViewItem* item);
+ void getFile();
+ void updateDir(const QString& newdir);
+ };
+};
+#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 @@
+/****************************************************************************
+** Form implementation generated from reading ui file 'obexftpdialogbase.ui'
+**
+** Created: Sun Mar 19 16:47:24 2006
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#include "obexftpdialogbase.h"
+
+#include <qcombobox.h>
+#include <qheader.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qlistview.h>
+#include <qmultilineedit.h>
+#include <qprogressbar.h>
+#include <qpushbutton.h>
+#include <qtabwidget.h>
+#include <qwidget.h>
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+/*
+ * Constructs a ObexFtpDialogBase which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog.
+ */
+ObexFtpDialogBase::ObexFtpDialogBase( QWidget* parent, const char* name, bool modal, WFlags fl )
+ : QDialog( parent, name, modal, fl )
+{
+ if ( !name )
+ setName( "ObexFtpDialogBase" );
+ resize( 221, 396 );
+ setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, sizePolicy().hasHeightForWidth() ) );
+ setCaption( tr( "Browse device" ) );
+ ObexFtpDialogBaseLayout = new QVBoxLayout( this );
+ ObexFtpDialogBaseLayout->setSpacing( 0 );
+ ObexFtpDialogBaseLayout->setMargin( 0 );
+
+ obexFtpTab = new QTabWidget( this, "obexFtpTab" );
+
+ files = new QWidget( obexFtpTab, "files" );
+ filesLayout = new QVBoxLayout( files );
+ filesLayout->setSpacing( 0 );
+ filesLayout->setMargin( 0 );
+
+ Layout9 = new QVBoxLayout;
+ Layout9->setSpacing( 6 );
+ Layout9->setMargin( 0 );
+
+ fileList = new QListView( files, "fileList" );
+ fileList->addColumn( tr( "Name" ) );
+ fileList->addColumn( tr( "Size" ) );
+ Layout9->addWidget( fileList );
+
+ fileProgress = new QProgressBar( files, "fileProgress" );
+ Layout9->addWidget( fileProgress );
+
+ buttons = new QHBoxLayout;
+ buttons->setSpacing( 6 );
+ buttons->setMargin( 0 );
+
+ getButton = new QPushButton( files, "getButton" );
+ getButton->setText( tr( "Get file" ) );
+ buttons->addWidget( getButton );
+
+ browseOK = new QPushButton( files, "browseOK" );
+ browseOK->setText( tr( "Browse" ) );
+ buttons->addWidget( browseOK );
+ Layout9->addLayout( buttons );
+
+ statusBar = new QLabel( files, "statusBar" );
+ statusBar->setText( tr( "" ) );
+ Layout9->addWidget( statusBar );
+ filesLayout->addLayout( Layout9 );
+ obexFtpTab->insertTab( files, tr( "Device" ) );
+
+ localFs = new QWidget( obexFtpTab, "localFs" );
+ obexFtpTab->insertTab( localFs, tr( "Local" ) );
+
+ options = new QWidget( obexFtpTab, "options" );
+
+ connRetries = new QLabel( options, "connRetries" );
+ connRetries->setGeometry( QRect( 10, 45, 100, 16 ) );
+ connRetries->setText( tr( "Retry to connect" ) );
+
+ nReries = new QLineEdit( options, "nReries" );
+ nReries->setGeometry( QRect( 115, 40, 60, 23 ) );
+
+ uuidLabel = new QLabel( options, "uuidLabel" );
+ uuidLabel->setGeometry( QRect( 15, 20, 67, 15 ) );
+ uuidLabel->setText( tr( "uuid type" ) );
+
+ uuidType = new QComboBox( FALSE, options, "uuidType" );
+ uuidType->insertItem( tr( "FBS" ) );
+ uuidType->insertItem( tr( "S45" ) );
+ uuidType->setGeometry( QRect( 85, 10, 100, 30 ) );
+ obexFtpTab->insertTab( options, tr( "Options" ) );
+
+ browse = new QWidget( obexFtpTab, "browse" );
+ browseLayout = new QHBoxLayout( browse );
+ browseLayout->setSpacing( 0 );
+ browseLayout->setMargin( 0 );
+
+ browseLog = new QMultiLineEdit( browse, "browseLog" );
+ browseLayout->addWidget( browseLog );
+ obexFtpTab->insertTab( browse, tr( "Log" ) );
+ ObexFtpDialogBaseLayout->addWidget( obexFtpTab );
+
+ // tab order
+ setTabOrder( obexFtpTab, fileList );
+ setTabOrder( fileList, getButton );
+ setTabOrder( getButton, browseOK );
+ setTabOrder( browseOK, uuidType );
+ setTabOrder( uuidType, nReries );
+ setTabOrder( nReries, browseLog );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+ObexFtpDialogBase::~ObexFtpDialogBase()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
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 @@
+/****************************************************************************
+** Form interface generated from reading ui file 'obexftpdialogbase.ui'
+**
+** Created: Sun Mar 19 16:46:33 2006
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#ifndef OBEXFTPDIALOGBASE_H
+#define OBEXFTPDIALOGBASE_H
+
+#include <qvariant.h>
+#include <qdialog.h>
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QComboBox;
+class QLabel;
+class QLineEdit;
+class QListView;
+class QListViewItem;
+class QMultiLineEdit;
+class QProgressBar;
+class QPushButton;
+class QTabWidget;
+class QWidget;
+
+class ObexFtpDialogBase : public QDialog
+{
+ Q_OBJECT
+
+public:
+ ObexFtpDialogBase( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~ObexFtpDialogBase();
+
+ QTabWidget* obexFtpTab;
+ QWidget* files;
+ QListView* fileList;
+ QProgressBar* fileProgress;
+ QPushButton* getButton;
+ QPushButton* browseOK;
+ QLabel* statusBar;
+ QWidget* localFs;
+ QWidget* options;
+ QLabel* connRetries;
+ QLineEdit* nReries;
+ QLabel* uuidLabel;
+ QComboBox* uuidType;
+ QWidget* browse;
+ QMultiLineEdit* browseLog;
+
+protected:
+ QVBoxLayout* ObexFtpDialogBaseLayout;
+ QVBoxLayout* filesLayout;
+ QVBoxLayout* Layout9;
+ QHBoxLayout* buttons;
+ QHBoxLayout* browseLayout;
+};
+
+#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 @@
+<!DOCTYPE UI><UI>
+<class>ObexFtpDialogBase</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ObexFtpDialogBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>221</width>
+ <height>396</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Browse device</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>0</number>
+ </property>
+ <widget>
+ <class>QTabWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>obexFtpTab</cstring>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>files</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Device</string>
+ </attribute>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>0</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout9</cstring>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QListView</class>
+ <column>
+ <property>
+ <name>text</name>
+ <string>Name</string>
+ </property>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property>
+ <name>text</name>
+ <string>Size</string>
+ </property>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>fileList</cstring>
+ </property>
+ </widget>
+ <widget>
+ <class>QProgressBar</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>fileProgress</cstring>
+ </property>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>buttons</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>getButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Get file</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>browseOK</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Browse</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>statusBar</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>localFs</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Local</string>
+ </attribute>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>options</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Options</string>
+ </attribute>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>connRetries</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>10</x>
+ <y>45</y>
+ <width>100</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Retry to connect</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>nReries</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>115</x>
+ <y>40</y>
+ <width>60</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>uuidLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>15</x>
+ <y>20</y>
+ <width>67</width>
+ <height>15</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>uuid type</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>FBS</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>S45</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>uuidType</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>85</x>
+ <y>10</y>
+ <width>100</width>
+ <height>30</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>browse</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Log</string>
+ </attribute>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>0</number>
+ </property>
+ <widget>
+ <class>QMultiLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>browseLog</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<tabstops>
+ <tabstop>obexFtpTab</tabstop>
+ <tabstop>fileList</tabstop>
+ <tabstop>getButton</tabstop>
+ <tabstop>browseOK</tabstop>
+ <tabstop>uuidType</tabstop>
+ <tabstop>nReries</tabstop>
+ <tabstop>browseLog</tabstop>
+</tabstops>
+</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 @@
+/* $Id$ */
+/* OBEX file browser popup */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "obexdialog.h"
+#include "obexftpopup.h"
+#include "obexftpdialog.h"
+
+/* OPIE */
+#include <qpe/qpeapplication.h>
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+using namespace OpieTooth;
+
+ObexFtpPopup::ObexFtpPopup(const OpieTooth::Services& service,
+ OpieTooth::BTDeviceItem* item)
+ : QPopupMenu(), m_service(service)
+{
+ odebug << "ObexFtpPopup c'tor" << oendl;
+
+ m_item = item;
+ /* connect action */
+ m_push = new QAction( ); // so it's get deleted
+ m_push->setText("Push file");
+ m_push->addTo( this );
+ connect(m_push, SIGNAL(activated()), SLOT(slotPush()));
+
+ /* browse action */
+ m_browse = new QAction(this);
+ m_browse->setText("Browse device");
+ m_browse->addTo(this);
+ connect(m_browse, SIGNAL(activated()), SLOT(slotBrowse()));
+}
+
+
+ObexFtpPopup::~ObexFtpPopup()
+{
+ delete m_push;
+ delete m_browse;
+}
+
+void ObexFtpPopup::slotBrowse()
+{
+ odebug << "browse" <<oendl;
+ ObexFtpDialog ftpDlg(m_item->mac(),
+ m_service.protocolDescriptorList().last().port());
+ QPEApplication::execDialog(&ftpDlg);
+}
+
+void ObexFtpPopup::slotPush()
+{
+ QString device = m_item->mac();
+ int port = m_service.protocolDescriptorList().last().port();
+ device += "@";
+ device += QString::number(port);
+ owarn << "push something to " << device << oendl;
+ ObexDialog obexDialog(device);
+ QPEApplication::execDialog( &obexDialog );
+}
+
+//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 @@
+/* $Id$ */
+/* OBEX file browser popup */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef _OBEXFTPPOPUP_H_
+#define _OBEXFTPPOPUP_H_
+#include <qpopupmenu.h>
+#include <qaction.h>
+#include <services.h>
+#include "btdeviceitem.h"
+namespace OpieTooth {
+
+ class ObexFtpPopup : public QPopupMenu {
+ Q_OBJECT
+
+ public:
+ ObexFtpPopup(const OpieTooth::Services&, OpieTooth::BTDeviceItem*);
+ ~ObexFtpPopup();
+ private:
+ QAction* m_push;
+ QAction* m_browse;
+ OpieTooth::BTDeviceItem *m_item;
+ Services m_service;
+ protected slots:
+ void slotBrowse();
+ void slotPush();
+ };
+};
+#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
@@ -28,9 +28,9 @@ QPopupMenu* PopupHelper::find( int id, const Services& ser, BTDeviceItem* item )
void PopupHelper::init() {
insert( 4355, newRfcComPopup );
insert( 4354, newDunPopup );
insert( 4353, newRfcComPopup );
insert( 4357, newObexPushPopup );
- insert( 4358, newObexPushPopup );
+ insert( 4358, newObexFtpPopup );
insert( 4374, newPanPopup );
}
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,26 +1,29 @@
#include "rfcpopup.h"
#include "obexpopup.h"
+#include "obexftpopup.h"
#include "panpopup.h"
#include "dunpopup.h"
#include "stdpopups.h"
extern "C" {
QPopupMenu* newRfcComPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) {
- return new OpieTooth::RfcCommPopup(/* servive,*/ item ); // fix spellin RfComm vs. RfcComm and paramaters
- //return 0l;
+ return new OpieTooth::RfcCommPopup(service, item); // fix spellin RfComm vs. RfcComm and paramaters
}
- QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ) {
- return new OpieTooth::ObexPopup();
+ QPopupMenu* newObexPushPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item) {
+ return new OpieTooth::ObexPopup(service, item);
}
- QPopupMenu* newPanPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) {
+ QPopupMenu* newObexFtpPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item) {
+ return new OpieTooth::ObexFtpPopup(service, item);
+ }
+ QPopupMenu* newPanPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* item ) {
return new OpieTooth::PanPopup( item );
}
- QPopupMenu* newDunPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) {
+ QPopupMenu* newDunPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* item ) {
return new OpieTooth::DunPopup( item );
}
}
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
@@ -12,9 +12,10 @@
extern "C" {
QPopupMenu* newRfcComPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
QPopupMenu* newPanPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
QPopupMenu* newDunPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
+ QPopupMenu* newObexFtpPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
}
#endif