author | korovkin <korovkin> | 2006-04-30 08:54:54 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2006-04-30 08:54:54 (UTC) |
commit | 2f32b6d589d389848c5c73ba2e5ad13117c1da9e (patch) (unidiff) | |
tree | ec8a086ad17e3fa9014baa9476ab9cc77c5c29dc | |
parent | b91d3399fbd3178085e9d0fc5faeefbe31c674b7 (diff) | |
download | opie-2f32b6d589d389848c5c73ba2e5ad13117c1da9e.zip opie-2f32b6d589d389848c5c73ba2e5ad13117c1da9e.tar.gz opie-2f32b6d589d389848c5c73ba2e5ad13117c1da9e.tar.bz2 |
Fixed bug with suspend reenabling.
Made some minor formatting.
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 39 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialog.cpp | 2 |
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 | |||
@@ -673,125 +673,142 @@ void BlueBase::startScan() | |||
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 | */ |
683 | void BlueBase::setInfo() | 683 | void 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 | */ |
692 | BlueBase::~BlueBase() | 692 | BlueBase::~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 | */ |
713 | bool BlueBase::find( const RemoteDevice& rem ) | 716 | bool 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 | */ |
734 | void BlueBase::doForward() | 737 | void 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 | */ |
762 | void BlueBase::forwardExit(Opie::Core::OProcess* proc) | 775 | void 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 | */ |
780 | void BlueBase::doEncrypt(bool doit) | 797 | void 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 | */ |
788 | void BlueBase::editServices() | 805 | void 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 | { |
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 | |||
@@ -257,49 +257,49 @@ void ObexFtpDialog::getFile() | |||
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 | */ |
296 | void ObexFtpDialog::putFile() | 296 | void 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 | } |