summaryrefslogtreecommitdiff
path: root/libopie2
authorzecke <zecke>2004-11-04 22:03:38 (UTC)
committer zecke <zecke>2004-11-04 22:03:38 (UTC)
commit586ba5bb2842d80911ea22bf47eaa2f1b39362e1 (patch) (unidiff)
treee8ee53bea0563e16d8bd2649a5846b8377f53be3 /libopie2
parent2df2234beb066097c1c3bd899c21eff30abf4323 (diff)
downloadopie-586ba5bb2842d80911ea22bf47eaa2f1b39362e1.zip
opie-586ba5bb2842d80911ea22bf47eaa2f1b39362e1.tar.gz
opie-586ba5bb2842d80911ea22bf47eaa2f1b39362e1.tar.bz2
Revert last commit and create a QCOP Channel for QPE/System in
ODevice again, as OApplication doesn't expose the signal anymore
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index e57cdef..39b37cd 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -600,100 +600,101 @@ bool ODevice::setCurrentCpuFrequency(uint index)
600 int res = (::write(fd, writeCommand, count) != -1); 600 int res = (::write(fd, writeCommand, count) != -1);
601 ::close(fd); 601 ::close(fd);
602 return res; 602 return res;
603 } 603 }
604 604
605 return false; 605 return false;
606} 606}
607 607
608 608
609/** 609/**
610* @return a list of hardware buttons 610* @return a list of hardware buttons
611*/ 611*/
612const QValueList <ODeviceButton> &ODevice::buttons() 612const QValueList <ODeviceButton> &ODevice::buttons()
613{ 613{
614 initButtons(); 614 initButtons();
615 615
616 return *d->m_buttons; 616 return *d->m_buttons;
617} 617}
618 618
619/** 619/**
620* @return The amount of time that would count as a hold 620* @return The amount of time that would count as a hold
621*/ 621*/
622uint ODevice::buttonHoldTime() const 622uint ODevice::buttonHoldTime() const
623{ 623{
624 return d->m_holdtime; 624 return d->m_holdtime;
625} 625}
626 626
627/** 627/**
628* This method return a ODeviceButton for a key code 628* This method return a ODeviceButton for a key code
629* or 0 if no special hardware button is available for the device 629* or 0 if no special hardware button is available for the device
630* 630*
631* @return The devicebutton or 0l 631* @return The devicebutton or 0l
632* @see ODeviceButton 632* @see ODeviceButton
633*/ 633*/
634const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) 634const ODeviceButton *ODevice::buttonForKeycode ( ushort code )
635{ 635{
636 initButtons(); 636 initButtons();
637 637
638 for ( QValueListConstIterator<ODeviceButton> it = d->m_buttons->begin(); it != d->m_buttons->end(); ++it ) { 638 for ( QValueListConstIterator<ODeviceButton> it = d->m_buttons->begin(); it != d->m_buttons->end(); ++it ) {
639 if ( (*it). keycode() == code ) 639 if ( (*it). keycode() == code )
640 return &(*it); 640 return &(*it);
641 } 641 }
642 return 0; 642 return 0;
643} 643}
644 644
645void ODevice::reloadButtonMapping() 645void ODevice::reloadButtonMapping()
646{ 646{
647 if(!d->m_buttons) 647 if(!d->m_buttons)
648 initButtons(); 648 initButtons();
649 649
650 if(!d->m_initializedButtonQcop) { 650 if(!d->m_initializedButtonQcop) {
651 connect(qApp,SIGNAL(systemMessageSignal(const QCString&,const QByteArray&)), 651 QCopChannel *chan = new QCopChannel("QPE/System", this, "ODevice button channel");
652 connect(chan,SIGNAL(received(const QCString&,const QByteArray&)),
652 this,SLOT(systemMessage(const QCString&,const QByteArray&))); 653 this,SLOT(systemMessage(const QCString&,const QByteArray&)));
653 d->m_initializedButtonQcop = true; 654 d->m_initializedButtonQcop = true;
654 } 655 }
655 656
656 Config cfg ( "ButtonSettings" ); 657 Config cfg ( "ButtonSettings" );
657 658
658 for ( uint i = 0; i < d->m_buttons->count(); i++ ) { 659 for ( uint i = 0; i < d->m_buttons->count(); i++ ) {
659 ODeviceButton &b = ( *d->m_buttons ) [i]; 660 ODeviceButton &b = ( *d->m_buttons ) [i];
660 QString group = "Button" + QString::number ( i ); 661 QString group = "Button" + QString::number ( i );
661 662
662 QCString pch, hch; 663 QCString pch, hch;
663 QCString pm, hm; 664 QCString pm, hm;
664 QByteArray pdata, hdata; 665 QByteArray pdata, hdata;
665 666
666 if ( cfg. hasGroup ( group )) { 667 if ( cfg. hasGroup ( group )) {
667 cfg. setGroup ( group ); 668 cfg. setGroup ( group );
668 pch = cfg. readEntry ( "PressedActionChannel" ). latin1(); 669 pch = cfg. readEntry ( "PressedActionChannel" ). latin1();
669 pm = cfg. readEntry ( "PressedActionMessage" ). latin1(); 670 pm = cfg. readEntry ( "PressedActionMessage" ). latin1();
670 // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" )); 671 // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" ));
671 672
672 hch = cfg. readEntry ( "HeldActionChannel" ). latin1(); 673 hch = cfg. readEntry ( "HeldActionChannel" ). latin1();
673 hm = cfg. readEntry ( "HeldActionMessage" ). latin1(); 674 hm = cfg. readEntry ( "HeldActionMessage" ). latin1();
674 // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" )); 675 // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" ));
675 } 676 }
676 677
677 b. setPressedAction ( OQCopMessage ( pch, pm, pdata )); 678 b. setPressedAction ( OQCopMessage ( pch, pm, pdata ));
678 679
679 b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); 680 b. setHeldAction ( OQCopMessage ( hch, hm, hdata ));
680 } 681 }
681} 682}
682 683
683void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) 684void ODevice::remapPressedAction ( int button, const OQCopMessage &action )
684{ 685{
685 initButtons(); 686 initButtons();
686 687
687 QString mb_chan; 688 QString mb_chan;
688 689
689 if ( button >= (int) d->m_buttons->count()) 690 if ( button >= (int) d->m_buttons->count())
690 return; 691 return;
691 692
692 ODeviceButton &b = ( *d->m_buttons ) [button]; 693 ODeviceButton &b = ( *d->m_buttons ) [button];
693 b. setPressedAction ( action ); 694 b. setPressedAction ( action );
694 695
695 mb_chan=b. pressedAction(). channel(); 696 mb_chan=b. pressedAction(). channel();
696 697
697 Config buttonFile ( "ButtonSettings" ); 698 Config buttonFile ( "ButtonSettings" );
698 buttonFile. setGroup ( "Button" + QString::number ( button )); 699 buttonFile. setGroup ( "Button" + QString::number ( button ));
699 buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); 700 buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan);