Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 26c6dca..129215b 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -662,124 +662,128 @@ void ODevice::reloadButtonMapping() | |||
662 | b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); | 662 | b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); |
663 | } | 663 | } |
664 | } | 664 | } |
665 | 665 | ||
666 | void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) | 666 | void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) |
667 | { | 667 | { |
668 | initButtons(); | 668 | initButtons(); |
669 | 669 | ||
670 | QString mb_chan; | 670 | QString mb_chan; |
671 | 671 | ||
672 | if ( button >= (int) d->m_buttons->count()) | 672 | if ( button >= (int) d->m_buttons->count()) |
673 | return; | 673 | return; |
674 | 674 | ||
675 | ODeviceButton &b = ( *d->m_buttons ) [button]; | 675 | ODeviceButton &b = ( *d->m_buttons ) [button]; |
676 | b. setPressedAction ( action ); | 676 | b. setPressedAction ( action ); |
677 | 677 | ||
678 | mb_chan=b. pressedAction(). channel(); | 678 | mb_chan=b. pressedAction(). channel(); |
679 | 679 | ||
680 | Config buttonFile ( "ButtonSettings" ); | 680 | Config buttonFile ( "ButtonSettings" ); |
681 | buttonFile. setGroup ( "Button" + QString::number ( button )); | 681 | buttonFile. setGroup ( "Button" + QString::number ( button )); |
682 | buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); | 682 | buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); |
683 | buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message()); | 683 | buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message()); |
684 | 684 | ||
685 | // buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data())); | 685 | // buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data())); |
686 | 686 | ||
687 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); | 687 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); |
688 | } | 688 | } |
689 | 689 | ||
690 | void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) | 690 | void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) |
691 | { | 691 | { |
692 | initButtons(); | 692 | initButtons(); |
693 | 693 | ||
694 | if ( button >= (int) d->m_buttons->count()) | 694 | if ( button >= (int) d->m_buttons->count()) |
695 | return; | 695 | return; |
696 | 696 | ||
697 | ODeviceButton &b = ( *d->m_buttons ) [button]; | 697 | ODeviceButton &b = ( *d->m_buttons ) [button]; |
698 | b. setHeldAction ( action ); | 698 | b. setHeldAction ( action ); |
699 | 699 | ||
700 | Config buttonFile ( "ButtonSettings" ); | 700 | Config buttonFile ( "ButtonSettings" ); |
701 | buttonFile. setGroup ( "Button" + QString::number ( button )); | 701 | buttonFile. setGroup ( "Button" + QString::number ( button )); |
702 | buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); | 702 | buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); |
703 | buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); | 703 | buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); |
704 | 704 | ||
705 | // buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); | 705 | // buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); |
706 | 706 | ||
707 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); | 707 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); |
708 | } | 708 | } |
709 | void ODevice::virtual_hook(int, void* ){ | 709 | void ODevice::virtual_hook(int, void* ){ |
710 | 710 | ||
711 | } | 711 | } |
712 | 712 | ||
713 | /** | 713 | /** |
714 | * Sends a QCOP message to channel QPE/System | 714 | * Sends a QCOP message to channel QPE/System |
715 | * with the message "aboutToSuspend()" if this | 715 | * with the message "aboutToSuspend()" if this |
716 | * is the windowing server | 716 | * is the windowing server |
717 | */ | 717 | */ |
718 | void ODevice::sendSuspendmsg() | 718 | void ODevice::sendSuspendmsg() |
719 | { | 719 | { |
720 | if ( isQWS() ) | 720 | if ( isQWS() ) |
721 | return; | 721 | return; |
722 | 722 | ||
723 | QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); | 723 | QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); |
724 | } | 724 | } |
725 | 725 | ||
726 | /** | 726 | /** |
727 | * \brief Prepend the QWSServer::KeyboardFilter to the list of installed KeyFilters | 727 | * \brief Prepend the QWSServer::KeyboardFilter to the list of installed KeyFilters |
728 | * | 728 | * |
729 | * Prepend a QWSServer::KeyboardFilter to the List of Keyboard | 729 | * Prepend a QWSServer::KeyboardFilter to the List of Keyboard |
730 | * Filters. This function is the only way to prepend a KeyFilter. | 730 | * Filters. This function is the only way to prepend a KeyFilter. |
731 | * | 731 | * |
732 | * @param aFilter The KeyFilter to be prepended to the list of filters | 732 | * @param aFilter The KeyFilter to be prepended to the list of filters |
733 | * | 733 | * |
734 | * @see Opie::Core::OKeyFilter | 734 | * @see Opie::Core::OKeyFilter |
735 | * @see Opie::Core::OKeyFilter::inst() | 735 | * @see Opie::Core::OKeyFilter::inst() |
736 | */ | 736 | */ |
737 | void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) | 737 | void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) |
738 | { | 738 | { |
739 | Opie::Core::OKeyFilter::inst()->addPreHandler(aFilter); | 739 | Opie::Core::OKeyFilter::inst()->addPreHandler(aFilter); |
740 | } | 740 | } |
741 | 741 | ||
742 | /** | 742 | /** |
743 | * \brief Remove the QWSServer::KeyboardFilter in the param from the list | 743 | * \brief Remove the QWSServer::KeyboardFilter in the param from the list |
744 | * | 744 | * |
745 | * Remove the QWSServer::KeyboardFilter \par aFilter from the List | 745 | * Remove the QWSServer::KeyboardFilter \par aFilter from the List |
746 | * of Keyfilters. Call this when you delete the KeyFilter! | 746 | * of Keyfilters. Call this when you delete the KeyFilter! |
747 | * | 747 | * |
748 | * @param aFilter The filter to be removed from the Opie::Core::OKeyFilter | 748 | * @param aFilter The filter to be removed from the Opie::Core::OKeyFilter |
749 | * @see Opie::Core::ODevice::addPreHandler | 749 | * @see Opie::Core::ODevice::addPreHandler |
750 | */ | 750 | */ |
751 | void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) | 751 | void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) |
752 | { | 752 | { |
753 | Opie::Core::OKeyFilter::inst()->remPreHandler(aFilter); | 753 | Opie::Core::OKeyFilter::inst()->remPreHandler(aFilter); |
754 | } | 754 | } |
755 | 755 | ||
756 | void ODevice::playingStopped() { | 756 | void ODevice::playingStopped() { |
757 | const_cast<QObject*>(sender())->disconnect( this ); | 757 | const_cast<QObject*>(sender())->disconnect( this ); |
758 | #ifndef QT_NO_SOUND | ||
758 | if ( d->m_sound >= 0 ) { | 759 | if ( d->m_sound >= 0 ) { |
759 | ::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol ); | 760 | ::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol ); |
760 | ::close ( d->m_sound ); | 761 | ::close ( d->m_sound ); |
761 | } | 762 | } |
763 | #endif | ||
762 | } | 764 | } |
763 | 765 | ||
764 | void ODevice::changeMixerForAlarm( int mixer, const char* file, Sound *snd ) { | 766 | void ODevice::changeMixerForAlarm( int mixer, const char* file, Sound *snd ) { |
767 | #ifndef QT_NO_SOUND | ||
765 | if (( d->m_sound = ::open ( file, O_RDWR )) >= 0 ) { | 768 | if (( d->m_sound = ::open ( file, O_RDWR )) >= 0 ) { |
766 | if ( ::ioctl ( d->m_sound, MIXER_READ( mixer ), &d->m_vol ) >= 0 ) { | 769 | if ( ::ioctl ( d->m_sound, MIXER_READ( mixer ), &d->m_vol ) >= 0 ) { |
767 | Config cfg ( "qpe" ); | 770 | Config cfg ( "qpe" ); |
768 | cfg. setGroup ( "Volume" ); | 771 | cfg. setGroup ( "Volume" ); |
769 | 772 | ||
770 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 773 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
771 | if ( volalarm < 0 ) | 774 | if ( volalarm < 0 ) |
772 | volalarm = 0; | 775 | volalarm = 0; |
773 | else if ( volalarm > 100 ) | 776 | else if ( volalarm > 100 ) |
774 | volalarm = 100; | 777 | volalarm = 100; |
775 | volalarm |= ( volalarm << 8 ); | 778 | volalarm |= ( volalarm << 8 ); |
776 | 779 | ||
777 | if ( ::ioctl ( d->m_sound, MIXER_WRITE( mixer ), &volalarm ) >= 0 ) | 780 | if ( ::ioctl ( d->m_sound, MIXER_WRITE( mixer ), &volalarm ) >= 0 ) |
778 | register_qpe_sound_finished(snd, this, SLOT(playingStopped())); | 781 | register_qpe_sound_finished(snd, this, SLOT(playingStopped())); |
779 | } | 782 | } |
780 | d->m_mixer = mixer; | 783 | d->m_mixer = mixer; |
781 | } | 784 | } |
785 | #endif | ||
782 | } | 786 | } |
783 | 787 | ||
784 | } | 788 | } |
785 | } | 789 | } |