author | korovkin <korovkin> | 2006-04-24 19:09:42 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2006-04-24 19:09:42 (UTC) |
commit | 8856190fa34ad67488adc137dc7c8646d0689795 (patch) (unidiff) | |
tree | a9f6f610ec63a35dfec922020d3627026dc81884 | |
parent | 71722eacaa44f3b738318d68dc6148c9e2ff643d (diff) | |
download | opie-8856190fa34ad67488adc137dc7c8646d0689795.zip opie-8856190fa34ad67488adc137dc7c8646d0689795.tar.gz opie-8856190fa34ad67488adc137dc7c8646d0689795.tar.bz2 |
Improved diagnostic messages.
Added LOG saving functionality.
-rw-r--r-- | noncore/net/opietooth/manager/obexdialog.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialog.cpp | 47 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialog.h | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialogbase.ui | 395 |
4 files changed, 217 insertions, 231 deletions
diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp index d3fdd14..8d7b593 100644 --- a/noncore/net/opietooth/manager/obexdialog.cpp +++ b/noncore/net/opietooth/manager/obexdialog.cpp | |||
@@ -48,93 +48,93 @@ ObexDialog::ObexDialog(const QString& device, QWidget* parent, const char* name | |||
48 | connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) ); | 48 | connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) ); |
49 | 49 | ||
50 | chNameLine = new QLineEdit( this ); | 50 | chNameLine = new QLineEdit( this ); |
51 | 51 | ||
52 | sendButton = new QPushButton( this ); | 52 | sendButton = new QPushButton( this ); |
53 | sendButton->setText( tr( "Send" ) ); | 53 | sendButton->setText( tr( "Send" ) ); |
54 | 54 | ||
55 | layout->addWidget(info); | 55 | layout->addWidget(info); |
56 | layout->addWidget(status); | 56 | layout->addWidget(status); |
57 | layout->addWidget(cmdLine); | 57 | layout->addWidget(cmdLine); |
58 | layout->addWidget(browserButton); | 58 | layout->addWidget(browserButton); |
59 | layout->addWidget(chNameLine); | 59 | layout->addWidget(chNameLine); |
60 | layout->addWidget(sendButton); | 60 | layout->addWidget(sendButton); |
61 | layout->addWidget(statLine); | 61 | layout->addWidget(statLine); |
62 | 62 | ||
63 | connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) ); | 63 | connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) ); |
64 | 64 | ||
65 | connect(obexSend, SIGNAL(processExited(Opie::Core::OProcess*)), | 65 | connect(obexSend, SIGNAL(processExited(Opie::Core::OProcess*)), |
66 | this, SLOT(slotProcessExited(Opie::Core::OProcess*))); | 66 | this, SLOT(slotProcessExited(Opie::Core::OProcess*))); |
67 | connect(obexSend, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)), | 67 | connect(obexSend, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)), |
68 | this, SLOT(slotPushOut(Opie::Core::OProcess*, char*, int))); | 68 | this, SLOT(slotPushOut(Opie::Core::OProcess*, char*, int))); |
69 | connect(obexSend, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)), | 69 | connect(obexSend, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)), |
70 | this, SLOT(slotPushErr(Opie::Core::OProcess*, char*, int))); | 70 | this, SLOT(slotPushErr(Opie::Core::OProcess*, char*, int))); |
71 | 71 | ||
72 | } | 72 | } |
73 | 73 | ||
74 | ObexDialog::~ObexDialog() { | 74 | ObexDialog::~ObexDialog() { |
75 | if (obexSend->isRunning()) | 75 | if (obexSend->isRunning()) |
76 | obexSend->kill(); | 76 | obexSend->kill(); |
77 | delete obexSend; | 77 | delete obexSend; |
78 | obexSend = NULL; | 78 | obexSend = NULL; |
79 | } | 79 | } |
80 | 80 | ||
81 | void ObexDialog::browse() { | 81 | void ObexDialog::browse() { |
82 | 82 | ||
83 | MimeTypes types; | 83 | MimeTypes types; |
84 | QStringList all; | 84 | QStringList all; |
85 | all << "*/*"; | 85 | all << "*/*"; |
86 | types.insert("All Files", all ); | 86 | types.insert("All Files", all ); |
87 | 87 | ||
88 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); | 88 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); |
89 | cmdLine->setText( str ); | 89 | cmdLine->setText( str ); |
90 | statLine->setText( tr("Ready") ); | 90 | statLine->setText( tr("Ready") ); |
91 | } | 91 | } |
92 | 92 | ||
93 | void ObexDialog::sendData() { | 93 | void ObexDialog::sendData() { |
94 | QString fileURL = cmdLine->text(); | 94 | QString fileURL = cmdLine->text(); |
95 | QString file = QFileInfo( fileURL ).fileName(); | 95 | QString file = QFileInfo( fileURL ).fileName(); |
96 | QString modifiedName = chNameLine->text(); | 96 | QString modifiedName = chNameLine->text(); |
97 | QString execName = "ussp-push"; | 97 | QString execName = "ussp-push"; |
98 | 98 | ||
99 | if (obexSend->isRunning()) | 99 | if (obexSend->isRunning()) |
100 | return; | 100 | return; |
101 | obexSend->clearArguments(); | 101 | obexSend->clearArguments(); |
102 | // vom popupmenu beziehen | 102 | // vom popupmenu beziehen |
103 | if ( !modifiedName.isEmpty() ) { | 103 | if ( !modifiedName.isEmpty() ) { |
104 | *obexSend << execName << "--timeo 30" << m_device << fileURL << modifiedName; | 104 | *obexSend << execName << "--timeo 30" << m_device << fileURL << modifiedName; |
105 | } else { | 105 | } else { |
106 | *obexSend << execName << "--timeo 30" << m_device << fileURL << file; | 106 | *obexSend << execName << "--timeo 30" << m_device << fileURL << file; |
107 | } | 107 | } |
108 | obexSend->setUseShell(true); | 108 | obexSend->setUseShell(true); |
109 | if (!obexSend->start(OProcess::NotifyOnExit, OProcess::All) ) { | 109 | if (!obexSend->start(OProcess::NotifyOnExit, OProcess::All) ) { |
110 | statLine->setText( tr("Error: couln't start process") ); | 110 | statLine->setText( tr("Error: couln't start process") ); |
111 | } | 111 | } |
112 | else | 112 | else |
113 | statLine->setText( tr("Sending") ); | 113 | statLine->setText( tr("Sending") ); |
114 | } | 114 | } |
115 | 115 | ||
116 | void ObexDialog::slotPushOut(OProcess*, char* buf, int len) { | 116 | void ObexDialog::slotPushOut(OProcess*, char* buf, int len) { |
117 | QCString str(buf, len); | 117 | QCString str(buf, len); |
118 | status->append(str); | 118 | status->append(str); |
119 | } | 119 | } |
120 | 120 | ||
121 | void ObexDialog::slotPushErr(OProcess*, char* buf, int len) { | 121 | void ObexDialog::slotPushErr(OProcess*, char* buf, int len) { |
122 | QCString str(buf, len); | 122 | QCString str(buf, len); |
123 | status->append(str); | 123 | status->append(str); |
124 | } | 124 | } |
125 | 125 | ||
126 | void ObexDialog::slotProcessExited(OProcess*) { | 126 | void ObexDialog::slotProcessExited(OProcess*) { |
127 | if (obexSend == NULL) | 127 | if (obexSend == NULL) |
128 | return; | 128 | return; |
129 | if (obexSend->normalExit()) { | 129 | if (obexSend->normalExit()) { |
130 | status->append( tr("Finished with result ") ); | 130 | status->append( tr("Finished with result ") ); |
131 | status->append( QString::number(obexSend->exitStatus()) ); | 131 | status->append( QString::number(obexSend->exitStatus()) ); |
132 | status->append( tr("\n") ); | 132 | status->append( tr("\n") ); |
133 | odebug << obexSend->exitStatus() << oendl; | 133 | odebug << obexSend->exitStatus() << oendl; |
134 | statLine->setText( tr("Finished: ") + tr(strerror(obexSend->exitStatus())) ); | 134 | statLine->setText( tr("Finished: ") + tr(strerror(obexSend->exitStatus())) ); |
135 | } | 135 | } |
136 | else { | 136 | else { |
137 | status->append( tr("Exited abnormally\n") ); | 137 | status->append( tr("Exited abnormally\n") ); |
138 | statLine->setText( tr("Exited abnormally") ); | 138 | statLine->setText( tr("Exited abnormally") ); |
139 | } | 139 | } |
140 | } | 140 | } |
diff --git a/noncore/net/opietooth/manager/obexftpdialog.cpp b/noncore/net/opietooth/manager/obexftpdialog.cpp index 80a81b4..f479ca2 100644 --- a/noncore/net/opietooth/manager/obexftpdialog.cpp +++ b/noncore/net/opietooth/manager/obexftpdialog.cpp | |||
@@ -1,467 +1,506 @@ | |||
1 | /* $Id$ */ | 1 | /* $Id$ */ |
2 | /* OBEX file browser dialog */ | 2 | /* OBEX file browser dialog */ |
3 | /*************************************************************************** | 3 | /*************************************************************************** |
4 | * * | 4 | * * |
5 | * This program is free software; you can redistribute it and/or modify * | 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 * | 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 * | 7 | * the Free Software Foundation; either version 2 of the License, or * |
8 | * (at your option) any later version. * | 8 | * (at your option) any later version. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | /* | 11 | /* |
12 | * This code uses and is based on ObexFTP project code: http://triq.net/obexftp/ | 12 | * This code uses and is based on ObexFTP project code: http://triq.net/obexftp/ |
13 | */ | 13 | */ |
14 | #include <sys/stat.h> | 14 | #include <sys/stat.h> |
15 | #include <sys/types.h> | 15 | #include <sys/types.h> |
16 | #include <unistd.h> | 16 | #include <unistd.h> |
17 | #include <string.h> | 17 | #include <string.h> |
18 | #include <errno.h> | 18 | #include <errno.h> |
19 | #include <qpushbutton.h> | 19 | #include <qpushbutton.h> |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | #include <qmultilineedit.h> | 21 | #include <qmultilineedit.h> |
22 | #include <qlineedit.h> | ||
22 | #include <qspinbox.h> | 23 | #include <qspinbox.h> |
23 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
24 | #include <qlistview.h> | 25 | #include <qlistview.h> |
25 | #include <qprogressbar.h> | 26 | #include <qprogressbar.h> |
26 | #include <qlabel.h> | 27 | #include <qlabel.h> |
27 | #include <qlayout.h> | 28 | #include <qlayout.h> |
28 | #include <errno.h> | 29 | #include <errno.h> |
30 | #include <qfile.h> | ||
31 | #include <qtextstream.h> | ||
32 | #include <qstringlist.h> | ||
29 | #include "obexftpdialog.h" | 33 | #include "obexftpdialog.h" |
30 | #include "filelistitem.h" | 34 | #include "filelistitem.h" |
31 | 35 | ||
32 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
34 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
35 | #include <opie2/odebug.h> | 39 | #include <opie2/odebug.h> |
36 | #include <opie2/ofileselector.h> | 40 | #include <opie2/ofileselector.h> |
41 | #include <opie2/ofiledialog.h> | ||
37 | 42 | ||
38 | using namespace Opie::Core; | 43 | using namespace Opie::Core; |
39 | using namespace Opie::Ui; | 44 | using namespace Opie::Ui; |
40 | 45 | ||
41 | using namespace OpieTooth; | 46 | using namespace OpieTooth; |
42 | 47 | ||
43 | #define MAX_PROGRESS 14 //Maximal progress bar | 48 | #define MAX_PROGRESS 14 //Maximal progress bar |
44 | 49 | ||
45 | static void info_cb(int event, const char *msg, int len, void* data); | 50 | static void info_cb(int event, const char *msg, int len, void* data); |
46 | 51 | ||
47 | /* | 52 | /* |
48 | * Public constructor | 53 | * Public constructor |
49 | * device - bluetooth address of the device | 54 | * device - bluetooth address of the device |
50 | * port - port to connect to | 55 | * port - port to connect to |
51 | */ | 56 | */ |
52 | ObexFtpDialog::ObexFtpDialog(const QString& device, int port, | 57 | ObexFtpDialog::ObexFtpDialog(const QString& device, int port, |
53 | QWidget* parent, const char* name, bool modal, WFlags fl) | 58 | QWidget* parent, const char* name, bool modal, WFlags fl) |
54 | : ObexFtpDialogBase(parent, name, modal, fl), m_device(device), | 59 | : ObexFtpDialogBase(parent, name, modal, fl), m_device(device), |
55 | m_port(port), curdir("") | 60 | m_port(port), curdir("") |
56 | { | 61 | { |
57 | client = NULL; | 62 | client = NULL; |
58 | nRetries = 3; | 63 | nRetries = 3; |
59 | transport = OBEX_TRANS_BLUETOOTH; | 64 | transport = OBEX_TRANS_BLUETOOTH; |
60 | use_conn = TRUE; | 65 | use_conn = TRUE; |
61 | use_path = TRUE; | 66 | use_path = TRUE; |
62 | progressStatus = 0; | 67 | progressStatus = 0; |
63 | localCurdir = "/"; | 68 | localCurdir = "/"; |
64 | browseLog->setEdited(FALSE); | 69 | browseLog->setEdited(FALSE); |
65 | fileList->setSorting(1); | 70 | fileList->setSorting(1); |
66 | fileList->clear(); | 71 | fileList->clear(); |
67 | fileProgress->setTotalSteps(MAX_PROGRESS); | 72 | fileProgress->setTotalSteps(MAX_PROGRESS); |
68 | statusBar->clear(); | 73 | statusBar->clear(); |
69 | localLayout = new QVBoxLayout(localFs); | 74 | localLayout = new QVBoxLayout(localFs); |
70 | localLayout->setSpacing( 0 ); | 75 | localLayout->setSpacing( 0 ); |
71 | localLayout->setMargin( 0 ); | 76 | localLayout->setMargin( 0 ); |
72 | destFile = new OFileSelector(localFs, | 77 | destFile = new OFileSelector(localFs, |
73 | OFileSelector::FileSelector, | 78 | OFileSelector::FileSelector, |
74 | OFileSelector::ExtendedAll, localCurdir, ""); | 79 | OFileSelector::ExtendedAll, localCurdir, ""); |
75 | destFile->setCloseVisible(false); | 80 | destFile->setCloseVisible(false); |
76 | destFile->setNewVisible(false); | 81 | destFile->setNewVisible(false); |
77 | localLayout->addWidget(destFile); | 82 | localLayout->addWidget(destFile); |
78 | nReries->setValue(nRetries); | 83 | nReries->setValue(nRetries); |
79 | connect(browseOK, SIGNAL(clicked()), SLOT(slotBrowse())); | 84 | connect(browseOK, SIGNAL(clicked()), SLOT(slotBrowse())); |
80 | connect(fileList, SIGNAL(clicked(QListViewItem*)), | 85 | connect(fileList, SIGNAL(clicked(QListViewItem*)), |
81 | SLOT(slotCd(QListViewItem*))); | 86 | SLOT(slotCd(QListViewItem*))); |
82 | connect(getButton, | 87 | connect(getButton, |
83 | SIGNAL(clicked()), | 88 | SIGNAL(clicked()), |
84 | SLOT(getFile())); | 89 | SLOT(getFile())); |
85 | connect(putButton, | 90 | connect(putButton, |
86 | SIGNAL(clicked()), | 91 | SIGNAL(clicked()), |
87 | SLOT(putFile())); | 92 | SLOT(putFile())); |
88 | connect(destFile, | 93 | connect(destFile, |
89 | SIGNAL(dirSelected (const QString&)), | 94 | SIGNAL(dirSelected (const QString&)), |
90 | SLOT(updateDir(const QString&))); | 95 | SLOT(updateDir(const QString&))); |
96 | connect(saveButton, | ||
97 | SIGNAL(clicked()), | ||
98 | SLOT(slotSaveLog())); | ||
99 | connect(browseButton, | ||
100 | SIGNAL(clicked()), | ||
101 | SLOT(slotBrowseLog())); | ||
91 | } | 102 | } |
92 | 103 | ||
93 | ObexFtpDialog::~ObexFtpDialog() | 104 | ObexFtpDialog::~ObexFtpDialog() |
94 | { | 105 | { |
95 | if (client != NULL) { | 106 | if (client != NULL) { |
96 | obexftp_disconnect(client); | 107 | obexftp_disconnect(client); |
97 | obexftp_close(client); | 108 | obexftp_close(client); |
98 | } | 109 | } |
99 | } | 110 | } |
100 | 111 | ||
101 | /* | 112 | /* |
102 | * Do device browsing | 113 | * Do device browsing |
103 | */ | 114 | */ |
104 | void ObexFtpDialog::slotBrowse() | 115 | void ObexFtpDialog::slotBrowse() |
105 | { | 116 | { |
106 | stat_entry_t* ent; //Directory entry | 117 | stat_entry_t* ent; //Directory entry |
107 | void *dir; //Directory to read | 118 | void *dir; //Directory to read |
108 | const uint8_t* use_uuid; //uuid | 119 | const uint8_t* use_uuid; //uuid |
109 | int len; //uuid length | 120 | int len; //uuid length |
110 | FileListItem* root; //root node | 121 | FileListItem* root; //root node |
111 | int fsize; //file size | 122 | int fsize; //file size |
112 | bool numOk; //true if the string is a number | 123 | bool numOk; //true if the string is a number |
113 | int tmp; //just a temp var | 124 | int tmp; //just a temp var |
114 | 125 | ||
115 | status(tr("Connecting to ") + m_device); | 126 | status(tr("Connecting to ") + m_device); |
116 | odebug << "Browse device " << m_device << oendl; | 127 | odebug << "Browse device " << m_device << oendl; |
117 | browseLog->clear(); | 128 | browseLog->clear(); |
118 | fileList->clear(); | 129 | fileList->clear(); |
119 | progressStatus = 0; | 130 | progressStatus = 0; |
120 | fileProgress->setTotalSteps(MAX_PROGRESS); | 131 | fileProgress->setTotalSteps(MAX_PROGRESS); |
121 | fileProgress->reset(); | 132 | fileProgress->reset(); |
122 | 133 | ||
123 | //Get parameters | 134 | //Get parameters |
124 | tmp = nReries->text().toInt(&numOk); | 135 | tmp = nReries->text().toInt(&numOk); |
125 | if (numOk) | 136 | if (numOk) |
126 | nRetries = tmp; | 137 | nRetries = tmp; |
127 | if (uuidType->currentText() == "FBS") { | 138 | if (uuidType->currentText() == "FBS") { |
128 | use_uuid = UUID_FBS; | 139 | use_uuid = UUID_FBS; |
129 | len = sizeof(UUID_FBS); | 140 | len = sizeof(UUID_FBS); |
130 | } else if (uuidType->currentText() == "S45") { | 141 | } else if (uuidType->currentText() == "S45") { |
131 | use_uuid = UUID_S45; | 142 | use_uuid = UUID_S45; |
132 | len = sizeof(UUID_S45); | 143 | len = sizeof(UUID_S45); |
133 | } else { | 144 | } else { |
134 | use_uuid = UUID_FBS; | 145 | use_uuid = UUID_FBS; |
135 | len = sizeof(UUID_FBS); | 146 | len = sizeof(UUID_FBS); |
136 | } | 147 | } |
137 | 148 | ||
138 | if (!cli_connect_uuid(use_uuid, len)) { | 149 | if (!cli_connect_uuid(use_uuid, len)) { |
139 | log("Connection failed"); | 150 | log(tr("Connection failed: ") + tr(strerror(errno))); |
140 | errBox("Connection failed"); | 151 | errBox("Connection failed"); |
141 | status("Connection failed"); | 152 | status("Connection failed"); |
142 | return; | 153 | return; |
143 | } | 154 | } |
144 | else { | 155 | else { |
145 | log(QString("Connected to ") + m_device); | 156 | log(QString("Connected to ") + m_device); |
146 | status(QString("Connected to ") + m_device); | 157 | status(QString("Connected to ") + m_device); |
147 | } | 158 | } |
148 | /* List folder */ | 159 | /* List folder */ |
149 | root = new FileListItem(fileList, NULL); | 160 | root = new FileListItem(fileList, NULL); |
150 | dir = obexftp_opendir(client, curdir); | 161 | dir = obexftp_opendir(client, curdir); |
151 | while ((ent = obexftp_readdir(dir)) != NULL) { | 162 | while ((ent = obexftp_readdir(dir)) != NULL) { |
152 | FileListItem* a; //List view item | 163 | FileListItem* a; //List view item |
153 | if (ent->mode != 16877) { | 164 | if (ent->mode != 16877) { |
154 | fsize = ent->size; | 165 | fsize = ent->size; |
155 | } | 166 | } |
156 | else | 167 | else |
157 | fsize = 0; | 168 | fsize = 0; |
158 | log(QString(ent->name) + QString(" ") + | 169 | log(QString(ent->name) + QString(" ") + |
159 | QString::number(ent->mode)); | 170 | QString::number(ent->mode)); |
160 | 171 | ||
161 | a = new FileListItem(fileList, ent, fsize); | 172 | a = new FileListItem(fileList, ent, fsize); |
162 | } | 173 | } |
163 | obexftp_closedir(dir); | 174 | obexftp_closedir(dir); |
164 | } | 175 | } |
165 | 176 | ||
166 | //Error message box | 177 | //Error message box |
167 | int ObexFtpDialog::errBox(QCString msg) | 178 | int ObexFtpDialog::errBox(QCString msg) |
168 | { | 179 | { |
169 | return QMessageBox::critical(this, tr("ObexFTP error"), msg); | 180 | return QMessageBox::critical(this, tr("ObexFTP error"), msg); |
170 | } | 181 | } |
171 | 182 | ||
172 | int ObexFtpDialog::errBox(QString msg) | 183 | int ObexFtpDialog::errBox(QString msg) |
173 | { | 184 | { |
174 | return QMessageBox::critical(this, tr("ObexFTP error"), msg); | 185 | return QMessageBox::critical(this, tr("ObexFTP error"), msg); |
175 | } | 186 | } |
176 | 187 | ||
177 | int ObexFtpDialog::errBox(const char* msg) | 188 | int ObexFtpDialog::errBox(const char* msg) |
178 | { | 189 | { |
179 | return QMessageBox::critical(this, tr("ObexFTP error"), tr(msg)); | 190 | return QMessageBox::critical(this, tr("ObexFTP error"), tr(msg)); |
180 | } | 191 | } |
181 | 192 | ||
182 | //Text in the status bar | 193 | //Text in the status bar |
183 | void ObexFtpDialog::status(QCString msg) | 194 | void ObexFtpDialog::status(QCString msg) |
184 | { | 195 | { |
185 | statusBar->setText(msg); | 196 | statusBar->setText(msg); |
186 | statusBar->repaint(); | 197 | statusBar->repaint(); |
187 | } | 198 | } |
188 | 199 | ||
189 | void ObexFtpDialog::status(QString msg) | 200 | void ObexFtpDialog::status(QString msg) |
190 | { | 201 | { |
191 | statusBar->setText(msg); | 202 | statusBar->setText(msg); |
192 | statusBar->repaint(); | 203 | statusBar->repaint(); |
193 | } | 204 | } |
194 | 205 | ||
195 | void ObexFtpDialog::status(const char* msg) | 206 | void ObexFtpDialog::status(const char* msg) |
196 | { | 207 | { |
197 | statusBar->setText(msg); | 208 | statusBar->setText(msg); |
198 | statusBar->repaint(); | 209 | statusBar->repaint(); |
199 | } | 210 | } |
200 | 211 | ||
201 | /* | 212 | /* |
202 | * Change directory with item under the cursor | 213 | * Change directory with item under the cursor |
203 | */ | 214 | */ |
204 | void ObexFtpDialog::slotCd(QListViewItem* item) | 215 | void ObexFtpDialog::slotCd(QListViewItem* item) |
205 | { | 216 | { |
206 | FileListItem* file = (FileListItem*)item; | 217 | FileListItem* file = (FileListItem*)item; |
207 | int idx; | 218 | int idx; |
208 | if (file == NULL) | 219 | if (file == NULL) |
209 | return; | 220 | return; |
210 | odebug << "Item " << file->text(0) << " clicked" << oendl; | 221 | odebug << "Item " << file->text(0) << " clicked" << oendl; |
211 | if (file->gettype() == IS_DIR) { | 222 | if (file->gettype() == IS_DIR) { |
212 | if (file->text(0) == "../") { | 223 | if (file->text(0) == "../") { |
213 | if (curdir.right(1) == "/") | 224 | if (curdir.right(1) == "/") |
214 | curdir.remove(curdir.length() - 1, 1); | 225 | curdir.remove(curdir.length() - 1, 1); |
215 | idx = curdir.findRev('/'); | 226 | idx = curdir.findRev('/'); |
216 | if (idx >= 0) | 227 | if (idx >= 0) |
217 | curdir.remove(idx, curdir.length() - idx); | 228 | curdir.remove(idx, curdir.length() - idx); |
218 | else | 229 | else |
219 | curdir = ""; | 230 | curdir = ""; |
220 | } | 231 | } |
221 | else { | 232 | else { |
222 | if (curdir != "" && curdir.right(1) != "/") | 233 | if (curdir != "" && curdir.right(1) != "/") |
223 | curdir += "/"; | 234 | curdir += "/"; |
224 | curdir += file->text(0); | 235 | curdir += file->text(0); |
225 | } | 236 | } |
226 | odebug << "Browse " << curdir << oendl; | 237 | odebug << "Browse " << curdir << oendl; |
227 | if (obexftp_setpath(client, curdir, 0) < 0) | 238 | if (obexftp_setpath(client, curdir, 0) < 0) |
228 | log("CD failed"); | 239 | log(tr("CD failed: ") + tr(strerror(errno))); |
229 | slotBrowse(); | 240 | slotBrowse(); |
230 | } | 241 | } |
231 | } | 242 | } |
232 | 243 | ||
233 | /* | 244 | /* |
234 | * Get the file | 245 | * Get the file |
235 | */ | 246 | */ |
236 | void ObexFtpDialog::getFile() | 247 | void ObexFtpDialog::getFile() |
237 | { | 248 | { |
238 | FileListItem* file = (FileListItem*)fileList->selectedItem(); | 249 | FileListItem* file = (FileListItem*)fileList->selectedItem(); |
239 | int result; | 250 | int result; |
240 | if (file == NULL) | 251 | if (file == NULL) |
241 | return; | 252 | return; |
242 | file2get = "/"; | 253 | file2get = "/"; |
243 | local = localCurdir; | 254 | local = localCurdir; |
244 | if (local == "") { | 255 | if (local == "") { |
245 | errBox("Select a destination first"); | 256 | errBox("Select a destination first"); |
246 | return; | 257 | return; |
247 | } | 258 | } |
248 | if (local.right(1) != "/") | 259 | if (local.right(1) != "/") |
249 | local += "/"; | 260 | local += "/"; |
250 | if (file->gettype() == IS_FILE) { | 261 | if (file->gettype() == IS_FILE) { |
251 | if (client == NULL) { | 262 | if (client == NULL) { |
252 | errBox("No connection established"); | 263 | errBox("No connection established"); |
253 | return; | 264 | return; |
254 | } | 265 | } |
255 | file2get += curdir; | 266 | file2get += curdir; |
256 | if (curdir != "" && curdir.right(1) != "/") | 267 | if (curdir != "" && curdir.right(1) != "/") |
257 | file2get += "/"; | 268 | file2get += "/"; |
258 | file2get += file->text(0); | 269 | file2get += file->text(0); |
259 | local += file->text(0); | 270 | local += file->text(0); |
260 | odebug << "Copy " << file2get << " to " << local << oendl; | 271 | odebug << "Copy " << file2get << " to " << local << oendl; |
261 | progressStatus = 0; | 272 | progressStatus = 0; |
262 | fileProgress->setTotalSteps(file->getsize() / 1024); | 273 | fileProgress->setTotalSteps(file->getsize() / 1024); |
263 | fileProgress->reset(); | 274 | fileProgress->reset(); |
264 | status(tr("Receiving file ") + file2get); | 275 | status(tr("Receiving file ") + file2get); |
265 | result = obexftp_get(client, local, file2get); | 276 | result = obexftp_get(client, local, file2get); |
266 | if (result < 0) { | 277 | if (result < 0) { |
267 | log(file2get + QString(" receive ERROR")); | 278 | log(file2get + QString(" receive ERROR: ") + tr(strerror(errno))); |
268 | errBox(file2get + QString(" receive ERROR")); | 279 | errBox(file2get + QString(" receive ERROR")); |
269 | status(file2get + QString(" receive ERROR")); | 280 | status(file2get + QString(" receive ERROR")); |
270 | } | 281 | } |
271 | else { | 282 | else { |
272 | log(file2get + QString(" received")); | 283 | log(file2get + QString(" received")); |
273 | status(file2get + QString(" received")); | 284 | status(file2get + QString(" received")); |
274 | destFile->reread(); | 285 | destFile->reread(); |
275 | } | 286 | } |
276 | } | 287 | } |
277 | } | 288 | } |
278 | 289 | ||
279 | /* | 290 | /* |
280 | * Put the file | 291 | * Put the file |
281 | */ | 292 | */ |
282 | void ObexFtpDialog::putFile() | 293 | void ObexFtpDialog::putFile() |
283 | { | 294 | { |
284 | int result; //OPeration result | 295 | int result; //OPeration result |
285 | int idx; //Index of a symbol in the string | 296 | int idx; //Index of a symbol in the string |
286 | struct stat localFStat; //Local file information | 297 | struct stat localFStat; //Local file information |
287 | 298 | ||
288 | if (client == NULL) { | 299 | if (client == NULL) { |
289 | errBox("No connection established"); | 300 | errBox("No connection established"); |
290 | return; | 301 | return; |
291 | } | 302 | } |
292 | local = destFile->selectedName(); | 303 | local = destFile->selectedName(); |
293 | if (local == "") { | 304 | if (local == "") { |
294 | errBox("No file slected"); | 305 | errBox("No file slected"); |
295 | return; | 306 | return; |
296 | } | 307 | } |
297 | result = stat(local, &localFStat); | 308 | result = stat(local, &localFStat); |
298 | if (result < 0) { | 309 | if (result < 0) { |
299 | errBox(tr("Wrong file selected ") + local + tr(" ") + | 310 | errBox(tr("Wrong file selected ") + local + tr(" ") + |
300 | tr(strerror(errno))); | 311 | tr(strerror(errno))); |
301 | return; | 312 | return; |
302 | } | 313 | } |
303 | idx = local.findRev('/'); | 314 | idx = local.findRev('/'); |
304 | if (idx > 0) { | 315 | if (idx > 0) { |
305 | file2get = local.right(local.length() - idx - 1); | 316 | file2get = local.right(local.length() - idx - 1); |
306 | } | 317 | } |
307 | else | 318 | else |
308 | file2get = local; | 319 | file2get = local; |
309 | 320 | ||
310 | odebug << "Copy " << local << " to " << file2get << oendl; | 321 | odebug << "Copy " << local << " to " << file2get << oendl; |
311 | progressStatus = 0; | 322 | progressStatus = 0; |
312 | fileProgress->setTotalSteps(localFStat.st_size / 1024); | 323 | fileProgress->setTotalSteps(localFStat.st_size / 1024); |
313 | fileProgress->reset(); | 324 | fileProgress->reset(); |
314 | status(tr("Sending file ") + local); | 325 | status(tr("Sending file ") + local); |
315 | result = obexftp_put_file(client, local, file2get); | 326 | result = obexftp_put_file(client, local, file2get); |
316 | if (result < 0) { | 327 | if (result < 0) { |
317 | log(local + QString(" send ERROR")); | 328 | log(local + QString(" send ERROR: ") + tr(strerror(errno))); |
318 | errBox(local + QString(" send ERROR")); | 329 | errBox(local + QString(" send ERROR")); |
319 | status(local + QString(" send ERROR")); | 330 | status(local + QString(" send ERROR")); |
320 | } | 331 | } |
321 | else { | 332 | else { |
322 | log(local + QString(" sent")); | 333 | log(local + QString(" sent")); |
323 | status(local + QString(" sent")); | 334 | status(local + QString(" sent")); |
324 | } | 335 | } |
325 | } | 336 | } |
326 | 337 | ||
327 | /* connect with given uuid. re-connect every time */ | 338 | /* connect with given uuid. re-connect every time */ |
328 | int ObexFtpDialog::cli_connect_uuid(const uint8_t *uuid, int uuid_len) | 339 | int ObexFtpDialog::cli_connect_uuid(const uint8_t *uuid, int uuid_len) |
329 | { | 340 | { |
330 | int retry; | 341 | int retry; |
331 | if (client != NULL) | 342 | if (client != NULL) |
332 | return TRUE; | 343 | return TRUE; |
333 | /* Open */ | 344 | /* Open */ |
334 | client = obexftp_open (transport, NULL, info_cb, this); | 345 | client = obexftp_open (transport, NULL, info_cb, this); |
335 | if(client == NULL) { | 346 | if(client == NULL) { |
336 | errBox("Error opening obexftp-client"); | 347 | errBox("Error opening obexftp-client"); |
337 | return FALSE; | 348 | return FALSE; |
338 | } | 349 | } |
339 | if (!use_conn) | 350 | if (!use_conn) |
340 | client->quirks &= ~OBEXFTP_CONN_HEADER; | 351 | client->quirks &= ~OBEXFTP_CONN_HEADER; |
341 | if (!use_path) | 352 | if (!use_path) |
342 | client->quirks &= ~OBEXFTP_SPLIT_SETPATH; | 353 | client->quirks &= ~OBEXFTP_SPLIT_SETPATH; |
343 | for (retry = 0; retry < nRetries; retry++) { | 354 | for (retry = 0; retry < nRetries; retry++) { |
344 | /* Connect */ | 355 | /* Connect */ |
345 | switch (transport) { | 356 | switch (transport) { |
346 | case OBEX_TRANS_IRDA: | 357 | case OBEX_TRANS_IRDA: |
347 | if (obexftp_connect_uuid(client, NULL, 0, uuid, uuid_len) >= 0) | 358 | if (obexftp_connect_uuid(client, NULL, 0, uuid, uuid_len) >= 0) |
348 | return TRUE; | 359 | return TRUE; |
349 | break; | 360 | break; |
350 | case OBEX_TRANS_BLUETOOTH: | 361 | case OBEX_TRANS_BLUETOOTH: |
351 | if (obexftp_connect_uuid(client, m_device, m_port, | 362 | if (obexftp_connect_uuid(client, m_device, m_port, |
352 | uuid, uuid_len) >= 0) | 363 | uuid, uuid_len) >= 0) |
353 | return TRUE; | 364 | return TRUE; |
354 | break; | 365 | break; |
355 | default: | 366 | default: |
356 | errBox("Transport type unknown"); | 367 | errBox("Transport type unknown"); |
357 | return FALSE; | 368 | return FALSE; |
358 | } | 369 | } |
359 | log(tr("Still trying to connect")); | 370 | log(tr("Still trying to connect")); |
360 | } | 371 | } |
361 | client = NULL; | 372 | client = NULL; |
362 | 373 | ||
363 | return FALSE; | 374 | return FALSE; |
364 | } | 375 | } |
365 | 376 | ||
366 | /* | 377 | /* |
367 | * Put a message to the log window | 378 | * Put a message to the log window |
368 | */ | 379 | */ |
369 | void ObexFtpDialog::log(QString str) | 380 | void ObexFtpDialog::log(QString str) |
370 | { | 381 | { |
371 | browseLog->append(str); | 382 | browseLog->append(str); |
372 | } | 383 | } |
373 | 384 | ||
374 | void ObexFtpDialog::log(QCString str) | 385 | void ObexFtpDialog::log(QCString str) |
375 | { | 386 | { |
376 | browseLog->append(str); | 387 | browseLog->append(str); |
377 | } | 388 | } |
378 | 389 | ||
379 | void ObexFtpDialog::log(QString& str) | 390 | void ObexFtpDialog::log(QString& str) |
380 | { | 391 | { |
381 | browseLog->append(str); | 392 | browseLog->append(str); |
382 | } | 393 | } |
383 | 394 | ||
384 | void ObexFtpDialog::log(const char* str) | 395 | void ObexFtpDialog::log(const char* str) |
385 | { | 396 | { |
386 | browseLog->append(str); | 397 | browseLog->append(str); |
387 | } | 398 | } |
388 | 399 | ||
389 | void ObexFtpDialog::incProgress() | 400 | void ObexFtpDialog::incProgress() |
390 | { | 401 | { |
391 | if (progressStatus < fileProgress->totalSteps()) | 402 | if (progressStatus < fileProgress->totalSteps()) |
392 | fileProgress->setProgress(progressStatus++); | 403 | fileProgress->setProgress(progressStatus++); |
393 | } | 404 | } |
394 | 405 | ||
395 | void ObexFtpDialog::doneProgress() | 406 | void ObexFtpDialog::doneProgress() |
396 | { | 407 | { |
397 | progressStatus = 0; | 408 | progressStatus = 0; |
398 | fileProgress->reset(); | 409 | fileProgress->reset(); |
399 | } | 410 | } |
400 | 411 | ||
401 | void ObexFtpDialog::updateDir(const QString& newdir) | 412 | void ObexFtpDialog::updateDir(const QString& newdir) |
402 | { | 413 | { |
403 | localCurdir = newdir; | 414 | localCurdir = newdir; |
404 | } | 415 | } |
405 | 416 | ||
417 | /** | ||
418 | * Save Log to the specified file | ||
419 | */ | ||
420 | void ObexFtpDialog::slotSaveLog() | ||
421 | { | ||
422 | QFile logFile(saveLogEdit->text()); | ||
423 | if (!logFile.open(IO_WriteOnly)) { | ||
424 | errBox(tr("Unable to open file ") + saveLogEdit->text() + tr(" ") + | ||
425 | tr(strerror(errno))); | ||
426 | return; | ||
427 | } | ||
428 | QTextStream stream(&logFile); | ||
429 | stream << browseLog->text() << endl; | ||
430 | QMessageBox::information(this, tr("Saving"), | ||
431 | tr("Log file saved to ") + saveLogEdit->text()); | ||
432 | } | ||
433 | |||
434 | void ObexFtpDialog::slotBrowseLog() | ||
435 | { | ||
436 | MimeTypes types; | ||
437 | QStringList all; | ||
438 | all << "*/*"; | ||
439 | types.insert("All Files", all ); | ||
440 | |||
441 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); | ||
442 | saveLogEdit->setText(str); | ||
443 | } | ||
444 | |||
406 | /* | 445 | /* |
407 | * Event callback function | 446 | * Event callback function |
408 | */ | 447 | */ |
409 | static void info_cb(int event, const char *msg, int len, void* data) | 448 | static void info_cb(int event, const char *msg, int len, void* data) |
410 | { | 449 | { |
411 | ObexFtpDialog* dlg = (ObexFtpDialog*)data; | 450 | ObexFtpDialog* dlg = (ObexFtpDialog*)data; |
412 | QCString cmsg(msg, len); //Message to display | 451 | QCString cmsg(msg, len); //Message to display |
413 | 452 | ||
414 | switch (event) { | 453 | switch (event) { |
415 | 454 | ||
416 | case OBEXFTP_EV_ERRMSG: | 455 | case OBEXFTP_EV_ERRMSG: |
417 | dlg->log(QCString("Error: ") + cmsg); | 456 | dlg->log(QCString("Error: ") + cmsg); |
418 | break; | 457 | break; |
419 | 458 | ||
420 | case OBEXFTP_EV_ERR: | 459 | case OBEXFTP_EV_ERR: |
421 | dlg->log(QCString("failed: ") + cmsg); | 460 | dlg->log(QCString("failed: ") + cmsg); |
422 | dlg->doneProgress(); | 461 | dlg->doneProgress(); |
423 | break; | 462 | break; |
424 | case OBEXFTP_EV_OK: | 463 | case OBEXFTP_EV_OK: |
425 | dlg->log(QCString("done")); | 464 | dlg->log(QCString("done")); |
426 | dlg->doneProgress(); | 465 | dlg->doneProgress(); |
427 | break; | 466 | break; |
428 | 467 | ||
429 | case OBEXFTP_EV_CONNECTING: | 468 | case OBEXFTP_EV_CONNECTING: |
430 | dlg->log(QCString("Connecting...")); | 469 | dlg->log(QCString("Connecting...")); |
431 | break; | 470 | break; |
432 | case OBEXFTP_EV_DISCONNECTING: | 471 | case OBEXFTP_EV_DISCONNECTING: |
433 | dlg->log(QCString("Disconnecting...")); | 472 | dlg->log(QCString("Disconnecting...")); |
434 | break; | 473 | break; |
435 | case OBEXFTP_EV_SENDING: | 474 | case OBEXFTP_EV_SENDING: |
436 | dlg->log(QCString("Sending ") + msg); | 475 | dlg->log(QCString("Sending ") + msg); |
437 | break; | 476 | break; |
438 | case OBEXFTP_EV_RECEIVING: | 477 | case OBEXFTP_EV_RECEIVING: |
439 | dlg->log(QCString("Receiving ") + msg); | 478 | dlg->log(QCString("Receiving ") + msg); |
440 | break; | 479 | break; |
441 | 480 | ||
442 | case OBEXFTP_EV_LISTENING: | 481 | case OBEXFTP_EV_LISTENING: |
443 | dlg->log(QCString("Waiting for incoming connection")); | 482 | dlg->log(QCString("Waiting for incoming connection")); |
444 | break; | 483 | break; |
445 | 484 | ||
446 | case OBEXFTP_EV_CONNECTIND: | 485 | case OBEXFTP_EV_CONNECTIND: |
447 | dlg->log(QCString("Incoming connection")); | 486 | dlg->log(QCString("Incoming connection")); |
448 | break; | 487 | break; |
449 | case OBEXFTP_EV_DISCONNECTIND: | 488 | case OBEXFTP_EV_DISCONNECTIND: |
450 | dlg->log(QCString("Disconnecting")); | 489 | dlg->log(QCString("Disconnecting")); |
451 | break; | 490 | break; |
452 | 491 | ||
453 | case OBEXFTP_EV_INFO: | 492 | case OBEXFTP_EV_INFO: |
454 | // 64 bit problems ? | 493 | // 64 bit problems ? |
455 | dlg->log(QString("Got info ") + QString::number((int)msg)); | 494 | dlg->log(QString("Got info ") + QString::number((int)msg)); |
456 | break; | 495 | break; |
457 | 496 | ||
458 | case OBEXFTP_EV_BODY: | 497 | case OBEXFTP_EV_BODY: |
459 | break; | 498 | break; |
460 | 499 | ||
461 | case OBEXFTP_EV_PROGRESS: | 500 | case OBEXFTP_EV_PROGRESS: |
462 | dlg->incProgress(); | 501 | dlg->incProgress(); |
463 | break; | 502 | break; |
464 | } | 503 | } |
465 | } | 504 | } |
466 | 505 | ||
467 | //eof | 506 | //eof |
diff --git a/noncore/net/opietooth/manager/obexftpdialog.h b/noncore/net/opietooth/manager/obexftpdialog.h index 7000f61..81c8921 100644 --- a/noncore/net/opietooth/manager/obexftpdialog.h +++ b/noncore/net/opietooth/manager/obexftpdialog.h | |||
@@ -2,67 +2,69 @@ | |||
2 | /* OBEX file browser dialog */ | 2 | /* OBEX file browser dialog */ |
3 | /*************************************************************************** | 3 | /*************************************************************************** |
4 | * * | 4 | * * |
5 | * This program is free software; you can redistribute it and/or modify * | 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 * | 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 * | 7 | * the Free Software Foundation; either version 2 of the License, or * |
8 | * (at your option) any later version. * | 8 | * (at your option) any later version. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | /* | 11 | /* |
12 | * This code uses and is based on ObexFTP project code: http://triq.net/obexftp/ | 12 | * This code uses and is based on ObexFTP project code: http://triq.net/obexftp/ |
13 | */ | 13 | */ |
14 | #ifndef _OBEXFTPDIALOG_H_ | 14 | #ifndef _OBEXFTPDIALOG_H_ |
15 | #define _OBEXFTPDIALOG_H_ | 15 | #define _OBEXFTPDIALOG_H_ |
16 | #include "obexftpdialogbase.h" | 16 | #include "obexftpdialogbase.h" |
17 | #include <qstring.h> | 17 | #include <qstring.h> |
18 | #include <obexftp.h> | 18 | #include <obexftp.h> |
19 | #include <uuid.h> | 19 | #include <uuid.h> |
20 | #include <client.h> | 20 | #include <client.h> |
21 | #include <opie2/ofileselector.h> | 21 | #include <opie2/ofileselector.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | namespace OpieTooth { | 23 | namespace OpieTooth { |
24 | class ObexFtpDialog : public ObexFtpDialogBase { | 24 | class ObexFtpDialog : public ObexFtpDialogBase { |
25 | Q_OBJECT | 25 | Q_OBJECT |
26 | public: | 26 | public: |
27 | ObexFtpDialog(const QString& device = 0, int port = 0, | 27 | ObexFtpDialog(const QString& device = 0, int port = 0, |
28 | QWidget* parent = 0, const char* name = 0, bool modal = TRUE, | 28 | QWidget* parent = 0, const char* name = 0, bool modal = TRUE, |
29 | WFlags fl = 0); | 29 | WFlags fl = 0); |
30 | ~ObexFtpDialog(); | 30 | ~ObexFtpDialog(); |
31 | void log(QString str); | 31 | void log(QString str); |
32 | void log(QCString str); | 32 | void log(QCString str); |
33 | void log(const char* str); | 33 | void log(const char* str); |
34 | void log(QString& str); | 34 | void log(QString& str); |
35 | void incProgress(); | 35 | void incProgress(); |
36 | void doneProgress(); | 36 | void doneProgress(); |
37 | protected: | 37 | protected: |
38 | int cli_connect_uuid(const uint8_t *uuid, int uuid_len); | 38 | int cli_connect_uuid(const uint8_t *uuid, int uuid_len); |
39 | int errBox(QCString msg); //Error message box | 39 | int errBox(QCString msg); //Error message box |
40 | int errBox(QString msg); //Error message box | 40 | int errBox(QString msg); //Error message box |
41 | int errBox(const char* msg); //Error message box | 41 | int errBox(const char* msg); //Error message box |
42 | void status(QCString msg); //Text in the status bar | 42 | void status(QCString msg); //Text in the status bar |
43 | void status(QString 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 | 44 | void status(const char* msg); //Text in the status bar |
45 | protected: | 45 | protected: |
46 | QString m_device; //device MAC address | 46 | QString m_device; //device MAC address |
47 | int m_port; //port | 47 | int m_port; //port |
48 | int transport; //transport type | 48 | int transport; //transport type |
49 | bool use_conn; | 49 | bool use_conn; |
50 | bool use_path; | 50 | bool use_path; |
51 | obexftp_client_t* client; //Obex ftp client handler | 51 | obexftp_client_t* client; //Obex ftp client handler |
52 | QString curdir; //Current directory on device | 52 | QString curdir; //Current directory on device |
53 | QString localCurdir; //Local current directory | 53 | QString localCurdir; //Local current directory |
54 | QString file2get; //Remote file name | 54 | QString file2get; //Remote file name |
55 | QString local; //Local file name | 55 | QString local; //Local file name |
56 | int progressStatus; //Progress status | 56 | int progressStatus; //Progress status |
57 | Opie::Ui::OFileSelector* destFile; //Destination file or directory | 57 | Opie::Ui::OFileSelector* destFile; //Destination file or directory |
58 | QVBoxLayout* localLayout; //Window layout | 58 | QVBoxLayout* localLayout; //Window layout |
59 | int nRetries; //Number of retries (on connection) | 59 | int nRetries; //Number of retries (on connection) |
60 | private slots: | 60 | private slots: |
61 | void slotBrowse(); | 61 | void slotBrowse(); |
62 | void slotCd(QListViewItem* item); | 62 | void slotCd(QListViewItem* item); |
63 | void getFile(); | 63 | void getFile(); |
64 | void putFile(); | 64 | void putFile(); |
65 | void updateDir(const QString& newdir); | 65 | void updateDir(const QString& newdir); |
66 | void slotSaveLog(); | ||
67 | void slotBrowseLog(); | ||
66 | }; | 68 | }; |
67 | }; | 69 | }; |
68 | #endif | 70 | #endif |
diff --git a/noncore/net/opietooth/manager/obexftpdialogbase.ui b/noncore/net/opietooth/manager/obexftpdialogbase.ui index b372b9d..2447007 100644 --- a/noncore/net/opietooth/manager/obexftpdialogbase.ui +++ b/noncore/net/opietooth/manager/obexftpdialogbase.ui | |||
@@ -1,371 +1,316 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>ObexFtpDialogBase</class> | 2 | <class>ObexFtpDialogBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>ObexFtpDialogBase</cstring> | 7 | <cstring>ObexFtpDialogBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>267</width> | 14 | <width>283</width> |
15 | <height>312</height> | 15 | <height>312</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>sizePolicy</name> | 19 | <name>sizePolicy</name> |
20 | <sizepolicy> | 20 | <sizepolicy> |
21 | <hsizetype>7</hsizetype> | 21 | <hsizetype>7</hsizetype> |
22 | <vsizetype>7</vsizetype> | 22 | <vsizetype>7</vsizetype> |
23 | </sizepolicy> | 23 | </sizepolicy> |
24 | </property> | 24 | </property> |
25 | <property stdset="1"> | 25 | <property stdset="1"> |
26 | <name>caption</name> | 26 | <name>caption</name> |
27 | <string>Browse device</string> | 27 | <string>Browse device</string> |
28 | </property> | 28 | </property> |
29 | <property> | 29 | <property> |
30 | <name>layoutMargin</name> | 30 | <name>layoutMargin</name> |
31 | </property> | 31 | </property> |
32 | <property> | 32 | <property> |
33 | <name>layoutSpacing</name> | 33 | <name>layoutSpacing</name> |
34 | </property> | 34 | </property> |
35 | <vbox> | 35 | <grid> |
36 | <property stdset="1"> | 36 | <property stdset="1"> |
37 | <name>margin</name> | 37 | <name>margin</name> |
38 | <number>0</number> | 38 | <number>0</number> |
39 | </property> | 39 | </property> |
40 | <property stdset="1"> | 40 | <property stdset="1"> |
41 | <name>spacing</name> | 41 | <name>spacing</name> |
42 | <number>0</number> | 42 | <number>0</number> |
43 | </property> | 43 | </property> |
44 | <widget> | 44 | <widget row="0" column="0" > |
45 | <class>QTabWidget</class> | 45 | <class>QTabWidget</class> |
46 | <property stdset="1"> | 46 | <property stdset="1"> |
47 | <name>name</name> | 47 | <name>name</name> |
48 | <cstring>obexFtpTab</cstring> | 48 | <cstring>obexFtpTab</cstring> |
49 | </property> | 49 | </property> |
50 | <property> | 50 | <property> |
51 | <name>layoutMargin</name> | 51 | <name>layoutMargin</name> |
52 | </property> | 52 | </property> |
53 | <property> | 53 | <property> |
54 | <name>layoutSpacing</name> | 54 | <name>layoutSpacing</name> |
55 | </property> | 55 | </property> |
56 | <widget> | 56 | <widget> |
57 | <class>QWidget</class> | 57 | <class>QWidget</class> |
58 | <property stdset="1"> | 58 | <property stdset="1"> |
59 | <name>name</name> | 59 | <name>name</name> |
60 | <cstring>files</cstring> | 60 | <cstring>files</cstring> |
61 | </property> | 61 | </property> |
62 | <attribute> | 62 | <attribute> |
63 | <name>title</name> | 63 | <name>title</name> |
64 | <string>Device</string> | 64 | <string>Device</string> |
65 | </attribute> | 65 | </attribute> |
66 | <vbox> | 66 | <grid> |
67 | <property stdset="1"> | 67 | <property stdset="1"> |
68 | <name>margin</name> | 68 | <name>margin</name> |
69 | <number>0</number> | 69 | <number>0</number> |
70 | </property> | 70 | </property> |
71 | <property stdset="1"> | 71 | <property stdset="1"> |
72 | <name>spacing</name> | 72 | <name>spacing</name> |
73 | <number>0</number> | 73 | <number>0</number> |
74 | </property> | 74 | </property> |
75 | <widget> | 75 | <widget row="1" column="0" rowspan="1" colspan="3" > |
76 | <class>QLayoutWidget</class> | 76 | <class>QProgressBar</class> |
77 | <property stdset="1"> | 77 | <property stdset="1"> |
78 | <name>name</name> | 78 | <name>name</name> |
79 | <cstring>Layout13</cstring> | 79 | <cstring>fileProgress</cstring> |
80 | </property> | 80 | </property> |
81 | <grid> | 81 | </widget> |
82 | <property stdset="1"> | 82 | <widget row="3" column="0" rowspan="1" colspan="3" > |
83 | <name>margin</name> | 83 | <class>QLabel</class> |
84 | <number>0</number> | 84 | <property stdset="1"> |
85 | <name>name</name> | ||
86 | <cstring>statusBar</cstring> | ||
87 | </property> | ||
88 | <property stdset="1"> | ||
89 | <name>text</name> | ||
90 | <string></string> | ||
91 | </property> | ||
92 | </widget> | ||
93 | <widget row="2" column="0" > | ||
94 | <class>QPushButton</class> | ||
95 | <property stdset="1"> | ||
96 | <name>name</name> | ||
97 | <cstring>browseOK</cstring> | ||
98 | </property> | ||
99 | <property stdset="1"> | ||
100 | <name>text</name> | ||
101 | <string>Browse</string> | ||
102 | </property> | ||
103 | </widget> | ||
104 | <widget row="2" column="1" > | ||
105 | <class>QPushButton</class> | ||
106 | <property stdset="1"> | ||
107 | <name>name</name> | ||
108 | <cstring>getButton</cstring> | ||
109 | </property> | ||
110 | <property stdset="1"> | ||
111 | <name>text</name> | ||
112 | <string>Get file</string> | ||
113 | </property> | ||
114 | </widget> | ||
115 | <widget row="2" column="2" > | ||
116 | <class>QPushButton</class> | ||
117 | <property stdset="1"> | ||
118 | <name>name</name> | ||
119 | <cstring>putButton</cstring> | ||
120 | </property> | ||
121 | <property stdset="1"> | ||
122 | <name>text</name> | ||
123 | <string>Put file</string> | ||
124 | </property> | ||
125 | </widget> | ||
126 | <widget row="0" column="0" rowspan="1" colspan="3" > | ||
127 | <class>QListView</class> | ||
128 | <column> | ||
129 | <property> | ||
130 | <name>text</name> | ||
131 | <string>Name</string> | ||
132 | </property> | ||
133 | <property> | ||
134 | <name>clickable</name> | ||
135 | <bool>true</bool> | ||
85 | </property> | 136 | </property> |
86 | <property stdset="1"> | 137 | <property> |
87 | <name>spacing</name> | 138 | <name>resizeable</name> |
88 | <number>6</number> | 139 | <bool>true</bool> |
89 | </property> | 140 | </property> |
90 | <widget row="0" column="0" > | 141 | </column> |
91 | <class>QListView</class> | 142 | <column> |
92 | <column> | 143 | <property> |
93 | <property> | 144 | <name>text</name> |
94 | <name>text</name> | 145 | <string>Size</string> |
95 | <string>Name</string> | 146 | </property> |
96 | </property> | 147 | <property> |
97 | <property> | 148 | <name>clickable</name> |
98 | <name>clickable</name> | 149 | <bool>true</bool> |
99 | <bool>true</bool> | 150 | </property> |
100 | </property> | 151 | <property> |
101 | <property> | 152 | <name>resizeable</name> |
102 | <name>resizeable</name> | 153 | <bool>true</bool> |
103 | <bool>true</bool> | 154 | </property> |
104 | </property> | 155 | </column> |
105 | </column> | 156 | <property stdset="1"> |
106 | <column> | 157 | <name>name</name> |
107 | <property> | 158 | <cstring>fileList</cstring> |
108 | <name>text</name> | 159 | </property> |
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 row="1" column="0" > | ||
126 | <class>QProgressBar</class> | ||
127 | <property stdset="1"> | ||
128 | <name>name</name> | ||
129 | <cstring>fileProgress</cstring> | ||
130 | </property> | ||
131 | </widget> | ||
132 | <widget row="2" column="0" > | ||
133 | <class>QLayoutWidget</class> | ||
134 | <property stdset="1"> | ||
135 | <name>name</name> | ||
136 | <cstring>Layout11</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>browseOK</cstring> | ||
152 | </property> | ||
153 | <property stdset="1"> | ||
154 | <name>text</name> | ||
155 | <string>Browse</string> | ||
156 | </property> | ||
157 | </widget> | ||
158 | <widget> | ||
159 | <class>QPushButton</class> | ||
160 | <property stdset="1"> | ||
161 | <name>name</name> | ||
162 | <cstring>getButton</cstring> | ||
163 | </property> | ||
164 | <property stdset="1"> | ||
165 | <name>text</name> | ||
166 | <string>Get file</string> | ||
167 | </property> | ||
168 | </widget> | ||
169 | <widget> | ||
170 | <class>QPushButton</class> | ||
171 | <property stdset="1"> | ||
172 | <name>name</name> | ||
173 | <cstring>putButton</cstring> | ||
174 | </property> | ||
175 | <property stdset="1"> | ||
176 | <name>text</name> | ||
177 | <string>Put file</string> | ||
178 | </property> | ||
179 | </widget> | ||
180 | </hbox> | ||
181 | </widget> | ||
182 | <widget row="3" column="0" > | ||
183 | <class>QLabel</class> | ||
184 | <property stdset="1"> | ||
185 | <name>name</name> | ||
186 | <cstring>statusBar</cstring> | ||
187 | </property> | ||
188 | <property stdset="1"> | ||
189 | <name>text</name> | ||
190 | <string></string> | ||
191 | </property> | ||
192 | </widget> | ||
193 | </grid> | ||
194 | </widget> | 160 | </widget> |
195 | </vbox> | 161 | </grid> |
196 | </widget> | 162 | </widget> |
197 | <widget> | 163 | <widget> |
198 | <class>QWidget</class> | 164 | <class>QWidget</class> |
199 | <property stdset="1"> | 165 | <property stdset="1"> |
200 | <name>name</name> | 166 | <name>name</name> |
201 | <cstring>localFs</cstring> | 167 | <cstring>localFs</cstring> |
202 | </property> | 168 | </property> |
203 | <attribute> | 169 | <attribute> |
204 | <name>title</name> | 170 | <name>title</name> |
205 | <string>Local</string> | 171 | <string>Local</string> |
206 | </attribute> | 172 | </attribute> |
207 | </widget> | 173 | </widget> |
208 | <widget> | 174 | <widget> |
209 | <class>QWidget</class> | 175 | <class>QWidget</class> |
210 | <property stdset="1"> | 176 | <property stdset="1"> |
211 | <name>name</name> | 177 | <name>name</name> |
212 | <cstring>options</cstring> | 178 | <cstring>options</cstring> |
213 | </property> | 179 | </property> |
214 | <attribute> | 180 | <attribute> |
215 | <name>title</name> | 181 | <name>title</name> |
216 | <string>Options</string> | 182 | <string>Options</string> |
217 | </attribute> | 183 | </attribute> |
218 | <widget> | 184 | <grid> |
219 | <class>QLayoutWidget</class> | ||
220 | <property stdset="1"> | 185 | <property stdset="1"> |
221 | <name>name</name> | 186 | <name>margin</name> |
222 | <cstring>Layout5</cstring> | 187 | <number>11</number> |
223 | </property> | 188 | </property> |
224 | <property stdset="1"> | 189 | <property stdset="1"> |
225 | <name>geometry</name> | 190 | <name>spacing</name> |
226 | <rect> | 191 | <number>6</number> |
227 | <x>45</x> | ||
228 | <y>5</y> | ||
229 | <width>162</width> | ||
230 | <height>63</height> | ||
231 | </rect> | ||
232 | </property> | 192 | </property> |
233 | <vbox> | 193 | <widget row="0" column="0" > |
194 | <class>QLabel</class> | ||
234 | <property stdset="1"> | 195 | <property stdset="1"> |
235 | <name>margin</name> | 196 | <name>name</name> |
236 | <number>0</number> | 197 | <cstring>uuidLabel</cstring> |
237 | </property> | 198 | </property> |
238 | <property stdset="1"> | 199 | <property stdset="1"> |
239 | <name>spacing</name> | 200 | <name>text</name> |
240 | <number>6</number> | 201 | <string>uuid type</string> |
241 | </property> | 202 | </property> |
242 | <widget> | 203 | </widget> |
243 | <class>QLayoutWidget</class> | 204 | <widget row="0" column="1" rowspan="1" colspan="2" > |
244 | <property stdset="1"> | 205 | <class>QComboBox</class> |
245 | <name>name</name> | 206 | <item> |
246 | <cstring>Layout3</cstring> | 207 | <property> |
208 | <name>text</name> | ||
209 | <string>FBS</string> | ||
247 | </property> | 210 | </property> |
248 | <hbox> | 211 | </item> |
249 | <property stdset="1"> | 212 | <item> |
250 | <name>margin</name> | 213 | <property> |
251 | <number>0</number> | 214 | <name>text</name> |
252 | </property> | 215 | <string>S45</string> |
253 | <property stdset="1"> | ||
254 | <name>spacing</name> | ||
255 | <number>6</number> | ||
256 | </property> | ||
257 | <widget> | ||
258 | <class>QLabel</class> | ||
259 | <property stdset="1"> | ||
260 | <name>name</name> | ||
261 | <cstring>uuidLabel</cstring> | ||
262 | </property> | ||
263 | <property stdset="1"> | ||
264 | <name>text</name> | ||
265 | <string>uuid type</string> | ||
266 | </property> | ||
267 | </widget> | ||
268 | <widget> | ||
269 | <class>QComboBox</class> | ||
270 | <item> | ||
271 | <property> | ||
272 | <name>text</name> | ||
273 | <string>FBS</string> | ||
274 | </property> | ||
275 | </item> | ||
276 | <item> | ||
277 | <property> | ||
278 | <name>text</name> | ||
279 | <string>S45</string> | ||
280 | </property> | ||
281 | </item> | ||
282 | <property stdset="1"> | ||
283 | <name>name</name> | ||
284 | <cstring>uuidType</cstring> | ||
285 | </property> | ||
286 | </widget> | ||
287 | </hbox> | ||
288 | </widget> | ||
289 | <widget> | ||
290 | <class>QLayoutWidget</class> | ||
291 | <property stdset="1"> | ||
292 | <name>name</name> | ||
293 | <cstring>Layout4</cstring> | ||
294 | </property> | 216 | </property> |
295 | <hbox> | 217 | </item> |
296 | <property stdset="1"> | 218 | <property stdset="1"> |
297 | <name>margin</name> | 219 | <name>name</name> |
298 | <number>0</number> | 220 | <cstring>uuidType</cstring> |
299 | </property> | 221 | </property> |
300 | <property stdset="1"> | 222 | </widget> |
301 | <name>spacing</name> | 223 | <widget row="1" column="0" rowspan="1" colspan="2" > |
302 | <number>6</number> | 224 | <class>QLabel</class> |
303 | </property> | 225 | <property stdset="1"> |
304 | <widget> | 226 | <name>name</name> |
305 | <class>QLabel</class> | 227 | <cstring>connRetries</cstring> |
306 | <property stdset="1"> | 228 | </property> |
307 | <name>name</name> | 229 | <property stdset="1"> |
308 | <cstring>connRetries</cstring> | 230 | <name>text</name> |
309 | </property> | 231 | <string>Retry to connect</string> |
310 | <property stdset="1"> | 232 | </property> |
311 | <name>text</name> | 233 | </widget> |
312 | <string>Retry to connect</string> | 234 | <widget row="1" column="2" > |
313 | </property> | 235 | <class>QSpinBox</class> |
314 | </widget> | 236 | <property stdset="1"> |
315 | <widget> | 237 | <name>name</name> |
316 | <class>QSpinBox</class> | 238 | <cstring>nReries</cstring> |
317 | <property stdset="1"> | 239 | </property> |
318 | <name>name</name> | 240 | <property stdset="1"> |
319 | <cstring>nReries</cstring> | 241 | <name>buttonSymbols</name> |
320 | </property> | 242 | <enum>PlusMinus</enum> |
321 | <property stdset="1"> | 243 | </property> |
322 | <name>buttonSymbols</name> | 244 | </widget> |
323 | <enum>PlusMinus</enum> | 245 | </grid> |
324 | </property> | ||
325 | </widget> | ||
326 | </hbox> | ||
327 | </widget> | ||
328 | </vbox> | ||
329 | </widget> | ||
330 | </widget> | 246 | </widget> |
331 | <widget> | 247 | <widget> |
332 | <class>QWidget</class> | 248 | <class>QWidget</class> |
333 | <property stdset="1"> | 249 | <property stdset="1"> |
334 | <name>name</name> | 250 | <name>name</name> |
335 | <cstring>browse</cstring> | 251 | <cstring>browse</cstring> |
336 | </property> | 252 | </property> |
337 | <attribute> | 253 | <attribute> |
338 | <name>title</name> | 254 | <name>title</name> |
339 | <string>Log</string> | 255 | <string>Log</string> |
340 | </attribute> | 256 | </attribute> |
341 | <hbox> | 257 | <grid> |
342 | <property stdset="1"> | 258 | <property stdset="1"> |
343 | <name>margin</name> | 259 | <name>margin</name> |
344 | <number>0</number> | 260 | <number>0</number> |
345 | </property> | 261 | </property> |
346 | <property stdset="1"> | 262 | <property stdset="1"> |
347 | <name>spacing</name> | 263 | <name>spacing</name> |
348 | <number>0</number> | 264 | <number>0</number> |
349 | </property> | 265 | </property> |
350 | <widget> | 266 | <widget row="1" column="1" > |
267 | <class>QLineEdit</class> | ||
268 | <property stdset="1"> | ||
269 | <name>name</name> | ||
270 | <cstring>saveLogEdit</cstring> | ||
271 | </property> | ||
272 | </widget> | ||
273 | <widget row="1" column="2" > | ||
274 | <class>QPushButton</class> | ||
275 | <property stdset="1"> | ||
276 | <name>name</name> | ||
277 | <cstring>saveButton</cstring> | ||
278 | </property> | ||
279 | <property stdset="1"> | ||
280 | <name>text</name> | ||
281 | <string>save</string> | ||
282 | </property> | ||
283 | </widget> | ||
284 | <widget row="1" column="0" > | ||
285 | <class>QPushButton</class> | ||
286 | <property stdset="1"> | ||
287 | <name>name</name> | ||
288 | <cstring>browseButton</cstring> | ||
289 | </property> | ||
290 | <property stdset="1"> | ||
291 | <name>text</name> | ||
292 | <string>Save as:</string> | ||
293 | </property> | ||
294 | </widget> | ||
295 | <widget row="0" column="0" rowspan="1" colspan="3" > | ||
351 | <class>QMultiLineEdit</class> | 296 | <class>QMultiLineEdit</class> |
352 | <property stdset="1"> | 297 | <property stdset="1"> |
353 | <name>name</name> | 298 | <name>name</name> |
354 | <cstring>browseLog</cstring> | 299 | <cstring>browseLog</cstring> |
355 | </property> | 300 | </property> |
356 | </widget> | 301 | </widget> |
357 | </hbox> | 302 | </grid> |
358 | </widget> | 303 | </widget> |
359 | </widget> | 304 | </widget> |
360 | </vbox> | 305 | </grid> |
361 | </widget> | 306 | </widget> |
362 | <tabstops> | 307 | <tabstops> |
363 | <tabstop>obexFtpTab</tabstop> | 308 | <tabstop>obexFtpTab</tabstop> |
364 | <tabstop>fileList</tabstop> | 309 | <tabstop>fileList</tabstop> |
365 | <tabstop>browseOK</tabstop> | 310 | <tabstop>browseOK</tabstop> |
366 | <tabstop>getButton</tabstop> | 311 | <tabstop>getButton</tabstop> |
367 | <tabstop>putButton</tabstop> | 312 | <tabstop>putButton</tabstop> |
368 | <tabstop>uuidType</tabstop> | 313 | <tabstop>uuidType</tabstop> |
369 | <tabstop>browseLog</tabstop> | 314 | <tabstop>browseLog</tabstop> |
370 | </tabstops> | 315 | </tabstops> |
371 | </UI> | 316 | </UI> |