summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp39
-rw-r--r--noncore/net/opietooth/manager/obexftpdialog.cpp2
2 files changed, 29 insertions, 12 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 58f97fa..85385d8 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -569,233 +569,250 @@ void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList )
569 QListViewItemIterator it2( connectionsView ); 569 QListViewItemIterator it2( connectionsView );
570 bool found = false; 570 bool found = false;
571 for ( ; it2.current(); ++it2 ) 571 for ( ; it2.current(); ++it2 )
572 { 572 {
573 if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() ) 573 if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() )
574 { 574 {
575 found = true; 575 found = true;
576 } 576 }
577 } 577 }
578 578
579 if ( found == false ) 579 if ( found == false )
580 { 580 {
581 connectionItem = new BTConnectionItem( connectionsView, (*it) ); 581 connectionItem = new BTConnectionItem( connectionsView, (*it) );
582 582
583 if( m_deviceList.find((*it).mac()).data() ) 583 if( m_deviceList.find((*it).mac()).data() )
584 { 584 {
585 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() ); 585 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() );
586 } 586 }
587 } 587 }
588 588
589 } 589 }
590 590
591 QListViewItemIterator it2( connectionsView ); 591 QListViewItemIterator it2( connectionsView );
592 for ( ; it2.current(); ++it2 ) 592 for ( ; it2.current(); ++it2 )
593 { 593 {
594 bool found = false; 594 bool found = false;
595 for (it = connectionList.begin(); it != connectionList.end(); ++it) 595 for (it = connectionList.begin(); it != connectionList.end(); ++it)
596 { 596 {
597 if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) 597 if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() )
598 { 598 {
599 found = true; 599 found = true;
600 } 600 }
601 } 601 }
602 602
603 if ( !found ) 603 if ( !found )
604 { 604 {
605 delete it2.current(); 605 delete it2.current();
606 } 606 }
607 607
608 } 608 }
609 609
610 610
611 } 611 }
612 else 612 else
613 { 613 {
614 connectionsView->clear(); 614 connectionsView->clear();
615 ConnectionState con; 615 ConnectionState con;
616 con.setMac( tr("No connections found") ); 616 con.setMac( tr("No connections found") );
617 connectionItem = new BTConnectionItem( connectionsView , con ); 617 connectionItem = new BTConnectionItem( connectionsView , con );
618 } 618 }
619 619
620 // recall connection search after some time 620 // recall connection search after some time
621 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); 621 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) );
622} 622}
623 623
624 624
625/** 625/**
626 * Find out if a device can currently be reached 626 * Find out if a device can currently be reached
627 * @param device 627 * @param device
628 */ 628 */
629void BlueBase::deviceActive( const RemoteDevice &device ) 629void BlueBase::deviceActive( const RemoteDevice &device )
630{ 630{
631 // search by mac, async, gets a signal back 631 // search by mac, async, gets a signal back
632 // We should have a BTDeviceItem there or where does it get added to the map -zecke 632 // We should have a BTDeviceItem there or where does it get added to the map -zecke
633 m_localDevice->isAvailable( device.mac() ); 633 m_localDevice->isAvailable( device.mac() );
634} 634}
635 635
636 636
637/** 637/**
638 * The signal catcher. Set the avail. status on device. 638 * The signal catcher. Set the avail. status on device.
639 * @param device - the mac address 639 * @param device - the mac address
640 * @param connected - if it is avail. or not 640 * @param connected - if it is avail. or not
641 */ 641 */
642void BlueBase::deviceActive( const QString& device, bool connected ) 642void BlueBase::deviceActive( const QString& device, bool connected )
643{ 643{
644 odebug << "deviceActive slot" << oendl; 644 odebug << "deviceActive slot" << oendl;
645 645
646 QMap<QString,BTDeviceItem*>::Iterator it; 646 QMap<QString,BTDeviceItem*>::Iterator it;
647 647
648 it = m_deviceList.find( device ); 648 it = m_deviceList.find( device );
649 if( it == m_deviceList.end() ) 649 if( it == m_deviceList.end() )
650 return; 650 return;
651 651
652 BTDeviceItem* deviceItem = it.data(); 652 BTDeviceItem* deviceItem = it.data();
653 653
654 if ( connected ) 654 if ( connected )
655 { 655 {
656 deviceItem->setPixmap( 1, m_onPix ); 656 deviceItem->setPixmap( 1, m_onPix );
657 } 657 }
658 else 658 else
659 { 659 {
660 deviceItem->setPixmap( 1, m_offPix ); 660 deviceItem->setPixmap( 1, m_offPix );
661 } 661 }
662 m_deviceList.remove( it ); 662 m_deviceList.remove( it );
663} 663}
664 664
665 665
666/** 666/**
667 * Open the "scan for devices" dialog 667 * Open the "scan for devices" dialog
668 */ 668 */
669void BlueBase::startScan() 669void BlueBase::startScan()
670{ 670{
671 ScanDialog *scan = new ScanDialog( this, "ScanDialog", 671 ScanDialog *scan = new ScanDialog( this, "ScanDialog",
672 true, WDestructiveClose ); 672 true, WDestructiveClose );
673 QObject::connect( scan, SIGNAL( selectedDevices(const QValueList<RemoteDevice>&) ), 673 QObject::connect( scan, SIGNAL( selectedDevices(const QValueList<RemoteDevice>&) ),
674 this, SLOT( addSearchedDevices(const QValueList<RemoteDevice>&) ) ); 674 this, SLOT( addSearchedDevices(const QValueList<RemoteDevice>&) ) );
675 675
676 QPEApplication::showDialog( scan ); 676 QPEApplication::showDialog( scan );
677} 677}
678 678
679 679
680/** 680/**
681 * Set the informations about the local device in information Tab 681 * Set the informations about the local device in information Tab
682 */ 682 */
683void BlueBase::setInfo() 683void BlueBase::setInfo()
684{ 684{
685 StatusLabel->setText( status() ); 685 StatusLabel->setText( status() );
686} 686}
687 687
688 688
689/** 689/**
690 * Decontructor 690 * Decontructor
691 */ 691 */
692BlueBase::~BlueBase() 692BlueBase::~BlueBase()
693{ 693{
694 writeSavedDevices(); 694 writeSavedDevices();
695 if (forwarder) { 695 if (forwarder) {
696#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 696#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
697 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) 697 {
698 << QPEApplication::Enable; 698 odebug << "SUSP: Enable suspend mode" << oendl;
699 QCopEnvelope e("QPE/System", "setScreenSaverMode(int)" );
700 e << QPEApplication::Enable;
701 }
699#endif 702#endif
700 delete forwarder; 703 delete forwarder;
701 forwarder = NULL; 704 forwarder = NULL;
702 } 705 }
703 delete m_iconLoader; 706 delete m_iconLoader;
704} 707}
705 708
706 709
707/** 710/**
708 * find searches the ListView for a BTDeviceItem containig 711 * find searches the ListView for a BTDeviceItem containig
709 * the same Device if found return true else false 712 * the same Device if found return true else false
710 * @param dev RemoteDevice to find 713 * @param dev RemoteDevice to find
711 * @return returns true if found 714 * @return returns true if found
712 */ 715 */
713bool BlueBase::find( const RemoteDevice& rem ) 716bool BlueBase::find( const RemoteDevice& rem )
714{ 717{
715 QListViewItemIterator it( devicesView ); 718 QListViewItemIterator it( devicesView );
716 BTListItem* item; 719 BTListItem* item;
717 BTDeviceItem* device; 720 BTDeviceItem* device;
718 for (; it.current(); ++it ) 721 for (; it.current(); ++it )
719 { 722 {
720 item = (BTListItem*) it.current(); 723 item = (BTListItem*) it.current();
721 if ( item->typeId() != BTListItem::Device ) 724 if ( item->typeId() != BTListItem::Device )
722 continue; 725 continue;
723 726
724 device = (BTDeviceItem*)item; 727 device = (BTDeviceItem*)item;
725 if ( rem.equals( device->remoteDevice() ) ) 728 if ( rem.equals( device->remoteDevice() ) )
726 return true; 729 return true;
727 } 730 }
728 return false; // not found 731 return false; // not found
729} 732}
730 733
731/** 734/**
732 * Start process of the cell phone forwarding 735 * Start process of the cell phone forwarding
733 */ 736 */
734void BlueBase::doForward() 737void BlueBase::doForward()
735{ 738{
736 if (forwarder && forwarder->isRunning()) { 739 if (forwarder && forwarder->isRunning()) {
737 runButton->setText("start gateway"); 740 runButton->setText("start gateway");
738 forwarder->stop(); 741 forwarder->stop();
739 delete forwarder; 742 delete forwarder;
740 forwarder = NULL; 743 forwarder = NULL;
744#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
745 {
746 odebug << "SUSP: Enable suspend mode" << oendl;
747 QCopEnvelope e("QPE/System", "setScreenSaverMode(int)" );
748 e << QPEApplication::Enable;
749 }
750#endif
741 return; 751 return;
742 } 752 }
743 QString str = serDevName->text(); 753 QString str = serDevName->text();
744 forwarder = new SerialForwarder(str, speeds[serSpeed->currentItem()].val); 754 forwarder = new SerialForwarder(str, speeds[serSpeed->currentItem()].val);
745 connect(forwarder, SIGNAL(processExited(Opie::Core::OProcess*)),
746 this, SLOT(forwardExited(Opie::Core::OProcess*)));
747 if (forwarder->start(OProcess::NotifyOnExit) < 0) { 755 if (forwarder->start(OProcess::NotifyOnExit) < 0) {
748 QMessageBox::critical(this, tr("Forwarder Error"), 756 QMessageBox::critical(this, tr("Forwarder Error"),
749 tr("Forwarder start error:") + tr(strerror(errno))); 757 tr("Forwarder start error:") + tr(strerror(errno)));
750 return; 758 return;
751 } 759 }
760 connect(forwarder, SIGNAL(processExited(Opie::Core::OProcess*)),
761 this, SLOT(forwardExited(Opie::Core::OProcess*)));
752 runButton->setText("stop gateway"); 762 runButton->setText("stop gateway");
753#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 763#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
754 QCopEnvelope("QPE/System", "setScreenSaverMode(int)") 764 {
755 << QPEApplication::DisableSuspend; 765 odebug << "SUSP: Disable suspend mode" << oendl;
766 QCopEnvelope e("QPE/System", "setScreenSaverMode(int)");
767 e << QPEApplication::DisableSuspend;
768 }
756#endif 769#endif
757} 770}
758 771
759/** 772/**
760 * React on the process end 773 * React on the process end
761 */ 774 */
762void BlueBase::forwardExit(Opie::Core::OProcess* proc) 775void BlueBase::forwardExit(Opie::Core::OProcess* proc)
763{ 776{
777 odebug << "Process exited" << oendl;
764#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 778#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
765 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) 779 if (forwarder) {
766 << QPEApplication::Enable; 780 delete forwarder;
781 forwarder = NULL;
782 runButton->setText("start gateway");
783 odebug << "SUSP: Enable suspend mode" << oendl;
784 QCopEnvelope e("QPE/System", "setScreenSaverMode(int)" );
785 e << QPEApplication::Enable;
786 }
767#endif 787#endif
768 if (proc->exitStatus() != 0) 788 if (proc->exitStatus() != 0)
769 QMessageBox::critical(this, tr("Forwarder Error"), 789 QMessageBox::critical(this, tr("Forwarder Error"),
770 tr("Forwarder start error")); 790 tr("Forwarder start error"));
771 delete proc;
772 forwarder = NULL;
773 runButton->setText("start gateway");
774} 791}
775 792
776/** 793/**
777 * Encrypt entered passkey 794 * Encrypt entered passkey
778 * doit - do encryption of the key 795 * doit - do encryption of the key
779 */ 796 */
780void BlueBase::doEncrypt(bool doit) 797void BlueBase::doEncrypt(bool doit)
781{ 798{
782 passkeyLine->setEchoMode((doit)? QLineEdit::Password: QLineEdit::Normal); 799 passkeyLine->setEchoMode((doit)? QLineEdit::Password: QLineEdit::Normal);
783} 800}
784 801
785/** 802/**
786 * Start services edit dialog 803 * Start services edit dialog
787 */ 804 */
788void BlueBase::editServices() 805void BlueBase::editServices()
789{ 806{
790 QString conf = "/etc/default/bluetooth"; 807 QString conf = "/etc/default/bluetooth";
791//// Use for debugging purposes 808//// Use for debugging purposes
792//// QString conf = "/mnt/net/opie/bin/bluetooth"; 809//// QString conf = "/mnt/net/opie/bin/bluetooth";
793 ServicesDialog svcEdit(conf, this, "ServicesDialog", true, 810 ServicesDialog svcEdit(conf, this, "ServicesDialog", true,
794 WStyle_ContextHelp); 811 WStyle_ContextHelp);
795 812
796 if (QPEApplication::execDialog(&svcEdit) == QDialog::Accepted) 813 if (QPEApplication::execDialog(&svcEdit) == QDialog::Accepted)
797 { 814 {
798 } 815 }
799} 816}
800 817
801//eof 818//eof
diff --git a/noncore/net/opietooth/manager/obexftpdialog.cpp b/noncore/net/opietooth/manager/obexftpdialog.cpp
index fd2015e..2f04ecf 100644
--- a/noncore/net/opietooth/manager/obexftpdialog.cpp
+++ b/noncore/net/opietooth/manager/obexftpdialog.cpp
@@ -153,257 +153,257 @@ void ObexFtpDialog::slotBrowse()
153 log(tr("Connection failed: ") + tr(strerror(errno))); 153 log(tr("Connection failed: ") + tr(strerror(errno)));
154 errBox("Connection failed"); 154 errBox("Connection failed");
155 status("Connection failed"); 155 status("Connection failed");
156 return; 156 return;
157 } 157 }
158 else { 158 else {
159 log(QString("Connected to ") + m_device); 159 log(QString("Connected to ") + m_device);
160 status(QString("Connected to ") + m_device); 160 status(QString("Connected to ") + m_device);
161 } 161 }
162 /* List folder */ 162 /* List folder */
163 root = new FileListItem(fileList, NULL); 163 root = new FileListItem(fileList, NULL);
164 dir = obexftp_opendir(client, curdir); 164 dir = obexftp_opendir(client, curdir);
165 while ((ent = obexftp_readdir(dir)) != NULL) { 165 while ((ent = obexftp_readdir(dir)) != NULL) {
166 FileListItem* a; //List view item 166 FileListItem* a; //List view item
167 if (ent->mode != 16877) { 167 if (ent->mode != 16877) {
168 fsize = ent->size; 168 fsize = ent->size;
169 } 169 }
170 else 170 else
171 fsize = 0; 171 fsize = 0;
172 log(QString(ent->name) + QString(" ") + 172 log(QString(ent->name) + QString(" ") +
173 QString::number(ent->mode)); 173 QString::number(ent->mode));
174 174
175 a = new FileListItem(fileList, ent, fsize); 175 a = new FileListItem(fileList, ent, fsize);
176 } 176 }
177 obexftp_closedir(dir); 177 obexftp_closedir(dir);
178} 178}
179 179
180//Error message box 180//Error message box
181int ObexFtpDialog::errBox(QCString msg) 181int ObexFtpDialog::errBox(QCString msg)
182{ 182{
183 return QMessageBox::critical(this, tr("ObexFTP error"), msg); 183 return QMessageBox::critical(this, tr("ObexFTP error"), msg);
184} 184}
185 185
186int ObexFtpDialog::errBox(QString msg) 186int ObexFtpDialog::errBox(QString msg)
187{ 187{
188 return QMessageBox::critical(this, tr("ObexFTP error"), msg); 188 return QMessageBox::critical(this, tr("ObexFTP error"), msg);
189} 189}
190 190
191int ObexFtpDialog::errBox(const char* msg) 191int ObexFtpDialog::errBox(const char* msg)
192{ 192{
193 return QMessageBox::critical(this, tr("ObexFTP error"), tr(msg)); 193 return QMessageBox::critical(this, tr("ObexFTP error"), tr(msg));
194} 194}
195 195
196//Text in the status bar 196//Text in the status bar
197void ObexFtpDialog::status(QCString msg) 197void ObexFtpDialog::status(QCString msg)
198{ 198{
199 statusBar->setText(msg); 199 statusBar->setText(msg);
200 statusBar->repaint(); 200 statusBar->repaint();
201} 201}
202 202
203void ObexFtpDialog::status(QString msg) 203void ObexFtpDialog::status(QString msg)
204{ 204{
205 statusBar->setText(msg); 205 statusBar->setText(msg);
206 statusBar->repaint(); 206 statusBar->repaint();
207} 207}
208 208
209void ObexFtpDialog::status(const char* msg) 209void ObexFtpDialog::status(const char* msg)
210{ 210{
211 statusBar->setText(msg); 211 statusBar->setText(msg);
212 statusBar->repaint(); 212 statusBar->repaint();
213} 213}
214 214
215/* 215/*
216 * Change directory with item under the cursor 216 * Change directory with item under the cursor
217 */ 217 */
218void ObexFtpDialog::slotCd(QListViewItem* item) 218void ObexFtpDialog::slotCd(QListViewItem* item)
219{ 219{
220 FileListItem* file = (FileListItem*)item; 220 FileListItem* file = (FileListItem*)item;
221 int idx; 221 int idx;
222 if (file == NULL) 222 if (file == NULL)
223 return; 223 return;
224 odebug << "Item " << file->text(0) << " clicked" << oendl; 224 odebug << "Item " << file->text(0) << " clicked" << oendl;
225 if (file->gettype() == IS_DIR) { 225 if (file->gettype() == IS_DIR) {
226 if (file->text(0) == "../") { 226 if (file->text(0) == "../") {
227 if (curdir.right(1) == "/") 227 if (curdir.right(1) == "/")
228 curdir.remove(curdir.length() - 1, 1); 228 curdir.remove(curdir.length() - 1, 1);
229 idx = curdir.findRev('/'); 229 idx = curdir.findRev('/');
230 if (idx >= 0) 230 if (idx >= 0)
231 curdir.remove(idx, curdir.length() - idx); 231 curdir.remove(idx, curdir.length() - idx);
232 else 232 else
233 curdir = ""; 233 curdir = "";
234 } 234 }
235 else { 235 else {
236 if (curdir != "" && curdir.right(1) != "/") 236 if (curdir != "" && curdir.right(1) != "/")
237 curdir += "/"; 237 curdir += "/";
238 curdir += file->text(0); 238 curdir += file->text(0);
239 } 239 }
240 odebug << "Browse " << curdir << oendl; 240 odebug << "Browse " << curdir << oendl;
241 if (obexftp_setpath(client, curdir, 0) < 0) 241 if (obexftp_setpath(client, curdir, 0) < 0)
242 log(tr("CD failed: ") + tr(strerror(errno))); 242 log(tr("CD failed: ") + tr(strerror(errno)));
243 slotBrowse(); 243 slotBrowse();
244 } 244 }
245} 245}
246 246
247/* 247/*
248 * Copy file from a remote device to the local device 248 * Copy file from a remote device to the local device
249 */ 249 */
250void ObexFtpDialog::getFile() 250void ObexFtpDialog::getFile()
251{ 251{
252 FileListItem* file = (FileListItem*)fileList->selectedItem(); 252 FileListItem* file = (FileListItem*)fileList->selectedItem();
253 int result; 253 int result;
254 if (file == NULL) 254 if (file == NULL)
255 return; 255 return;
256 file2get = "/"; 256 file2get = "/";
257 local = localCurdir; 257 local = localCurdir;
258 if (local == "") { 258 if (local == "") {
259 errBox("Select a destination first"); 259 errBox("Select a destination first");
260 return; 260 return;
261 } 261 }
262 if (local.right(1) != "/") 262 if (local.right(1) != "/")
263 local += "/"; 263 local += "/";
264 if (file->gettype() == IS_FILE) { 264 if (file->gettype() == IS_FILE) {
265 if (client == NULL) { 265 if (client == NULL) {
266 errBox("No connection established"); 266 errBox("No connection established");
267 return; 267 return;
268 } 268 }
269 file2get += curdir; 269 file2get += curdir;
270 if (curdir != "" && curdir.right(1) != "/") 270 if (curdir != "" && curdir.right(1) != "/")
271 file2get += "/"; 271 file2get += "/";
272 file2get += file->text(0); 272 file2get += file->text(0);
273 local += file->text(0); 273 local += file->text(0);
274 odebug << "Copy " << file2get << " to " << local << oendl; 274 odebug << "Copy " << file2get << " to " << local << oendl;
275 progressStatus = 0; 275 progressStatus = 0;
276 fileProgress->setTotalSteps(file->getsize() / 1024); 276 fileProgress->setTotalSteps(file->getsize() / 1024);
277 fileProgress->reset(); 277 fileProgress->reset();
278 status(tr("Receiving file ") + file2get); 278 status(tr("Receiving file ") + file2get);
279 result = obexftp_get(client, local, file2get); 279 result = obexftp_get(client, local, file2get);
280 if (result < 0) { 280 if (result < 0) {
281 log(file2get + QString(" receive ERROR:\n") + tr(strerror(errno))); 281 log(file2get + QString(" receive ERROR:\n") + tr(strerror(errno)));
282 errBox(file2get + QString(" receive ERROR")); 282 errBox(file2get + QString(" receive ERROR"));
283 status(file2get + QString(" receive ERROR")); 283 status(file2get + QString(" receive ERROR"));
284 } 284 }
285 else { 285 else {
286 log(file2get + QString(" received")); 286 log(file2get + QString(" received"));
287 status(file2get + QString(" received")); 287 status(file2get + QString(" received"));
288 destFile->reread(); 288 destFile->reread();
289 } 289 }
290 } 290 }
291} 291}
292 292
293/* 293/*
294 * Copy file from the local device to a remote device 294 * Copy file from the local device to a remote device
295 */ 295 */
296void ObexFtpDialog::putFile() 296void ObexFtpDialog::putFile()
297{ 297{
298 int result; //OPeration result 298 int result; //OPeration result
299 int idx; //Index of a symbol in the string 299 int idx; //Index of a symbol in the string
300 struct stat localFStat; //Local file information 300 struct stat localFStat; //Local file information
301 301
302 if (client == NULL) { 302 if (client == NULL) {
303 errBox("No connection established"); 303 errBox("No connection established");
304 return; 304 return;
305 } 305 }
306 local = destFile->selectedName(); 306 local = destFile->selectedName();
307 if (local == "") { 307 if (local == "") {
308 errBox("No file slected"); 308 errBox("No file slected");
309 return; 309 return;
310 } 310 }
311 result = stat(local, &localFStat); 311 result = stat(local, &localFStat);
312 if (result < 0) { 312 if (result < 0) {
313 errBox(tr("Wrong file selected ") + local + tr(" ") + 313 errBox(tr("Wrong file selected ") + local + tr(" ") +
314 tr(strerror(errno))); 314 tr(strerror(errno)));
315 return; 315 return;
316 } 316 }
317 idx = local.findRev('/'); 317 idx = local.findRev('/');
318 if (idx > 0) { 318 if (idx > 0) {
319 file2get = local.right(local.length() - idx - 1); 319 file2get = local.right(local.length() - idx - 1);
320 } 320 }
321 else 321 else
322 file2get = local; 322 file2get = local;
323 323
324 odebug << "Copy " << local << " to " << file2get << oendl; 324 odebug << "Copy " << local << " to " << file2get << oendl;
325 progressStatus = 0; 325 progressStatus = 0;
326 fileProgress->setTotalSteps(localFStat.st_size / 1024); 326 fileProgress->setTotalSteps(localFStat.st_size / 1024);
327 fileProgress->reset(); 327 fileProgress->reset();
328 status(tr("Sending file ") + local); 328 status(tr("Sending file ") + local);
329 result = obexftp_put_file(client, local, file2get); 329 result = obexftp_put_file(client, local, file2get);
330 if (result < 0) { 330 if (result < 0) {
331 log(local + QString(" send ERROR:\n") + tr(strerror(errno))); 331 log(local + QString(" send ERROR:\n") + tr(strerror(errno)));
332 errBox(local + QString(" send ERROR")); 332 errBox(local + QString(" send ERROR"));
333 status(local + QString(" send ERROR")); 333 status(local + QString(" send ERROR"));
334 } 334 }
335 else { 335 else {
336 slotBrowse(); 336 slotBrowse();
337 log(local + QString(" sent")); 337 log(local + QString(" sent"));
338 status(local + QString(" sent")); 338 status(local + QString(" sent"));
339 } 339 }
340} 340}
341 341
342/* 342/*
343 * Delete file on a remote device 343 * Delete file on a remote device
344 */ 344 */
345void ObexFtpDialog::delFile() 345void ObexFtpDialog::delFile()
346{ 346{
347 FileListItem* file = (FileListItem*)fileList->selectedItem(); 347 FileListItem* file = (FileListItem*)fileList->selectedItem();
348 int result; 348 int result;
349 if (file == NULL) 349 if (file == NULL)
350 return; 350 return;
351 file2get = "/"; 351 file2get = "/";
352 if (file->gettype() == IS_FILE) { 352 if (file->gettype() == IS_FILE) {
353 if (client == NULL) { 353 if (client == NULL) {
354 errBox("No connection established"); 354 errBox("No connection established");
355 return; 355 return;
356 } 356 }
357 file2get += curdir; 357 file2get += curdir;
358 if (curdir != "" && curdir.right(1) != "/") 358 if (curdir != "" && curdir.right(1) != "/")
359 file2get += "/"; 359 file2get += "/";
360 file2get += file->text(0); 360 file2get += file->text(0);
361 } 361 }
362 result = QMessageBox::warning(this, tr("Remove File"), 362 result = QMessageBox::warning(this, tr("Remove File"),
363 tr("Do you want to remove\n") + file2get, "Yes", "No"); 363 tr("Do you want to remove\n") + file2get, "Yes", "No");
364 if (result != 0) 364 if (result != 0)
365 return; 365 return;
366 odebug << "Remove " << file2get << oendl; 366 odebug << "Remove " << file2get << oendl;
367 result = obexftp_del(client, file2get); 367 result = obexftp_del(client, file2get);
368 if (result < 0) { 368 if (result < 0) {
369 log(file2get + QString(" remove ERROR\n") + tr(strerror(errno))); 369 log(file2get + QString(" remove ERROR\n") + tr(strerror(errno)));
370 errBox(file2get + QString(" remove ERROR")); 370 errBox(file2get + QString(" remove ERROR"));
371 status(file2get + QString(" remove ERROR")); 371 status(file2get + QString(" remove ERROR"));
372 } 372 }
373 else { 373 else {
374 slotBrowse(); 374 slotBrowse();
375 log(file2get + QString(" removed")); 375 log(file2get + QString(" removed"));
376 status(file2get + QString(" removed")); 376 status(file2get + QString(" removed"));
377 } 377 }
378} 378}
379 379
380/* connect with given uuid. re-connect every time */ 380/* connect with given uuid. re-connect every time */
381int ObexFtpDialog::cli_connect_uuid(const uint8_t *uuid, int uuid_len) 381int ObexFtpDialog::cli_connect_uuid(const uint8_t *uuid, int uuid_len)
382{ 382{
383 int retry; 383 int retry;
384 if (client != NULL) 384 if (client != NULL)
385 return TRUE; 385 return TRUE;
386 /* Open */ 386 /* Open */
387 client = obexftp_open (transport, NULL, info_cb, this); 387 client = obexftp_open (transport, NULL, info_cb, this);
388 if(client == NULL) { 388 if(client == NULL) {
389 errBox("Error opening obexftp-client"); 389 errBox("Error opening obexftp-client");
390 return FALSE; 390 return FALSE;
391 } 391 }
392 if (!use_conn) 392 if (!use_conn)
393 client->quirks &= ~OBEXFTP_CONN_HEADER; 393 client->quirks &= ~OBEXFTP_CONN_HEADER;
394 if (!use_path) 394 if (!use_path)
395 client->quirks &= ~OBEXFTP_SPLIT_SETPATH; 395 client->quirks &= ~OBEXFTP_SPLIT_SETPATH;
396 for (retry = 0; retry < nRetries; retry++) { 396 for (retry = 0; retry < nRetries; retry++) {
397 /* Connect */ 397 /* Connect */
398 switch (transport) { 398 switch (transport) {
399 case OBEX_TRANS_IRDA: 399 case OBEX_TRANS_IRDA:
400 if (obexftp_connect_uuid(client, NULL, 0, uuid, uuid_len) >= 0) 400 if (obexftp_connect_uuid(client, NULL, 0, uuid, uuid_len) >= 0)
401 return TRUE; 401 return TRUE;
402 break; 402 break;
403 case OBEX_TRANS_BLUETOOTH: 403 case OBEX_TRANS_BLUETOOTH:
404 if (obexftp_connect_uuid(client, m_device, m_port, 404 if (obexftp_connect_uuid(client, m_device, m_port,
405 uuid, uuid_len) >= 0) 405 uuid, uuid_len) >= 0)
406 return TRUE; 406 return TRUE;
407 break; 407 break;
408 default: 408 default:
409 errBox("Transport type unknown"); 409 errBox("Transport type unknown");