summaryrefslogtreecommitdiff
authordeller <deller>2005-04-01 22:46:30 (UTC)
committer deller <deller>2005-04-01 22:46:30 (UTC)
commit88cc0cc17864de6e36bdeedaae6df0a5cc738c5a (patch) (unidiff)
treeae0b24a579e940e6d508821dd98ee0edf2c95c03
parentcc4594a5c8d45d2f8d14c6ac1723a8ed39577f8f (diff)
downloadopie-88cc0cc17864de6e36bdeedaae6df0a5cc738c5a.zip
opie-88cc0cc17864de6e36bdeedaae6df0a5cc738c5a.tar.gz
opie-88cc0cc17864de6e36bdeedaae6df0a5cc738c5a.tar.bz2
show the popups inside the visible screen
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/volumeapplet/volume.cpp2
-rw-r--r--noncore/applets/wirelessapplet/wireless.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp
index 11ba2f6..7f0aca5 100644
--- a/core/applets/volumeapplet/volume.cpp
+++ b/core/applets/volumeapplet/volume.cpp
@@ -454,129 +454,129 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
454 writeConfigEntry ( "Mic", m_mic_percent, UPD_None ); 454 writeConfigEntry ( "Mic", m_mic_percent, UPD_None );
455 writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); 455 writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic );
456} 456}
457 457
458bool VolumeControl::volMuted ( ) const 458bool VolumeControl::volMuted ( ) const
459{ 459{
460 return m_vol_muted; 460 return m_vol_muted;
461} 461}
462 462
463int VolumeControl::volPercent ( ) const 463int VolumeControl::volPercent ( ) const
464{ 464{
465 return m_vol_percent; 465 return m_vol_percent;
466} 466}
467 467
468void VolumeControl::keyPressEvent ( QKeyEvent *e ) 468void VolumeControl::keyPressEvent ( QKeyEvent *e )
469{ 469{
470 switch ( e-> key ( )) { 470 switch ( e-> key ( )) {
471 case Key_Up: 471 case Key_Up:
472 volSlider-> subtractStep ( ); 472 volSlider-> subtractStep ( );
473 break; 473 break;
474 case Key_Down: 474 case Key_Down:
475 volSlider-> addStep ( ); 475 volSlider-> addStep ( );
476 break; 476 break;
477 case Key_Space: 477 case Key_Space:
478 volLed-> toggle ( ); 478 volLed-> toggle ( );
479 break; 479 break;
480 case Key_Escape: 480 case Key_Escape:
481 hide ( ); 481 hide ( );
482 break; 482 break;
483 } 483 }
484} 484}
485 485
486void VolumeControl::buttonChanged ( ) 486void VolumeControl::buttonChanged ( )
487{ 487{
488 if ( upButton-> isDown ( ) || downButton->isDown ( )) { 488 if ( upButton-> isDown ( ) || downButton->isDown ( )) {
489 rateTimerDone ( ); // Call it one time manually, otherwise it wont get 489 rateTimerDone ( ); // Call it one time manually, otherwise it wont get
490 // called at all when a button is pressed for a time 490 // called at all when a button is pressed for a time
491 // shorter than RATE_TIMER_INTERVAL. 491 // shorter than RATE_TIMER_INTERVAL.
492 rateTimer-> start ( RATE_TIMER_INTERVAL, false ); 492 rateTimer-> start ( RATE_TIMER_INTERVAL, false );
493 } 493 }
494 else 494 else
495 rateTimer-> stop ( ); 495 rateTimer-> stop ( );
496} 496}
497 497
498void VolumeControl::rateTimerDone ( ) 498void VolumeControl::rateTimerDone ( )
499{ 499{
500 if ( upButton-> isDown ( )) 500 if ( upButton-> isDown ( ))
501 volSlider-> setValue ( volSlider-> value ( ) - 2 ); 501 volSlider-> setValue ( volSlider-> value ( ) - 2 );
502 else // if ( downButton-> isDown ( )) 502 else // if ( downButton-> isDown ( ))
503 volSlider-> setValue ( volSlider-> value ( ) + 2 ); 503 volSlider-> setValue ( volSlider-> value ( ) + 2 );
504} 504}
505 505
506void VolumeControl::show ( bool /*showMic*/ ) 506void VolumeControl::show ( bool /*showMic*/ )
507{ 507{
508 readConfig ( ); 508 readConfig ( );
509 509
510 QPoint curPos = m_icon-> mapToGlobal ( QPoint ( 0, 0 )); 510 QPoint curPos = m_icon-> mapToGlobal ( QPoint ( 0, 0 ));
511 511
512 int w = sizeHint ( ). width ( ); 512 int w = sizeHint ( ). width ( );
513 int x = curPos.x ( ) - ( w / 2 ); 513 int x = curPos.x ( ) - ( w / 2 );
514 514
515 if (( x + w ) > QPEApplication::desktop ( )-> width ( )) 515 if (( x + w ) > QPEApplication::desktop ( )-> width ( ))
516 x = QPEApplication::desktop ( )-> width ( ) - w; 516 x = QPEApplication::desktop ( )-> width ( ) - w;
517 517
518 move ( x, curPos. y ( ) - sizeHint ( ). height ( )); 518 move ( QMAX(x,0), curPos. y ( ) - sizeHint ( ). height ( ));
519 QFrame::show ( ); 519 QFrame::show ( );
520 520
521} 521}
522 522
523void VolumeControl::readConfig ( bool force ) 523void VolumeControl::readConfig ( bool force )
524{ 524{
525 Config cfg ( "qpe" ); 525 Config cfg ( "qpe" );
526 cfg. setGroup ( "Volume" ); 526 cfg. setGroup ( "Volume" );
527 527
528 int old_vp = m_vol_percent; 528 int old_vp = m_vol_percent;
529 int old_mp = m_mic_percent; 529 int old_mp = m_mic_percent;
530 int old_bass = m_bass_percent; 530 int old_bass = m_bass_percent;
531 int old_treble = m_treble_percent; 531 int old_treble = m_treble_percent;
532 bool old_vm = m_vol_muted; 532 bool old_vm = m_vol_muted;
533 bool old_mm = m_mic_muted; 533 bool old_mm = m_mic_muted;
534 bool old_sk = m_snd_key; 534 bool old_sk = m_snd_key;
535 bool old_st = m_snd_touch; 535 bool old_st = m_snd_touch;
536 bool old_sa = m_snd_alarm; 536 bool old_sa = m_snd_alarm;
537 int old_ap = m_alarm_percent; 537 int old_ap = m_alarm_percent;
538 538
539 m_vol_percent = cfg. readNumEntry ( "VolumePercent", 50 ); 539 m_vol_percent = cfg. readNumEntry ( "VolumePercent", 50 );
540 m_mic_percent = cfg. readNumEntry ( "Mic", 50 ); 540 m_mic_percent = cfg. readNumEntry ( "Mic", 50 );
541 m_bass_percent = cfg. readNumEntry ( "BassPercent", 50 ); 541 m_bass_percent = cfg. readNumEntry ( "BassPercent", 50 );
542 m_treble_percent = cfg. readNumEntry ( "TreblePercent", 50 ); 542 m_treble_percent = cfg. readNumEntry ( "TreblePercent", 50 );
543 m_vol_muted = cfg. readBoolEntry ( "Mute", 0 ); 543 m_vol_muted = cfg. readBoolEntry ( "Mute", 0 );
544 m_mic_muted = cfg. readBoolEntry ( "MicMute", 0 ); 544 m_mic_muted = cfg. readBoolEntry ( "MicMute", 0 );
545 m_snd_key = cfg. readBoolEntry ( "KeySound", 0 ); 545 m_snd_key = cfg. readBoolEntry ( "KeySound", 0 );
546 m_snd_touch = cfg. readBoolEntry ( "TouchSound", 0 ); 546 m_snd_touch = cfg. readBoolEntry ( "TouchSound", 0 );
547 m_snd_alarm = cfg. readBoolEntry ( "AlarmSound", 1 ); 547 m_snd_alarm = cfg. readBoolEntry ( "AlarmSound", 1 );
548 m_alarm_percent = cfg. readNumEntry ( "AlarmPercent", 65 ); 548 m_alarm_percent = cfg. readNumEntry ( "AlarmPercent", 65 );
549 549
550 if ( force || ( m_vol_percent != old_vp )) 550 if ( force || ( m_vol_percent != old_vp ))
551 volSlider-> setValue ( 100 - m_vol_percent ); 551 volSlider-> setValue ( 100 - m_vol_percent );
552 if ( force || ( m_mic_percent != old_mp )) 552 if ( force || ( m_mic_percent != old_mp ))
553 micSlider-> setValue ( 100 - m_mic_percent ); 553 micSlider-> setValue ( 100 - m_mic_percent );
554 if ( force || ( m_alarm_percent != old_ap )) 554 if ( force || ( m_alarm_percent != old_ap ))
555 alarmSlider-> setValue ( 100 - m_alarm_percent ); 555 alarmSlider-> setValue ( 100 - m_alarm_percent );
556 if ( force || ( m_bass_percent != old_bass )) 556 if ( force || ( m_bass_percent != old_bass ))
557 bassSlider-> setValue ( 100 - m_bass_percent ); 557 bassSlider-> setValue ( 100 - m_bass_percent );
558 if ( force || ( m_treble_percent != old_treble )) 558 if ( force || ( m_treble_percent != old_treble ))
559 trebleSlider-> setValue ( 100 - m_treble_percent ); 559 trebleSlider-> setValue ( 100 - m_treble_percent );
560 560
561 561
562 if ( force || ( m_vol_muted != old_vm )) 562 if ( force || ( m_vol_muted != old_vm ))
563 volLed-> setOn ( !m_vol_muted ); 563 volLed-> setOn ( !m_vol_muted );
564 if ( force || ( m_mic_muted != old_mm )) 564 if ( force || ( m_mic_muted != old_mm ))
565 micLed-> setOn ( !m_mic_muted ); 565 micLed-> setOn ( !m_mic_muted );
566 if ( force || ( m_snd_alarm != old_sa )) 566 if ( force || ( m_snd_alarm != old_sa ))
567 alarmLed-> setOn ( m_snd_alarm ); 567 alarmLed-> setOn ( m_snd_alarm );
568 568
569 if ( force || ( m_snd_key != old_sk )) 569 if ( force || ( m_snd_key != old_sk ))
570 keyBox-> setChecked ( m_snd_key ); 570 keyBox-> setChecked ( m_snd_key );
571 if ( force || ( m_snd_touch != old_st )) 571 if ( force || ( m_snd_touch != old_st ))
572 tapBox-> setChecked ( m_snd_touch ); 572 tapBox-> setChecked ( m_snd_touch );
573 if ( force || ( m_snd_alarm != old_sa )) 573 if ( force || ( m_snd_alarm != old_sa ))
574 alarmBox-> setChecked ( m_snd_alarm ); 574 alarmBox-> setChecked ( m_snd_alarm );
575} 575}
576 576
577 577
578void VolumeControl::volumeChanged ( bool /*nowMuted*/ ) 578void VolumeControl::volumeChanged ( bool /*nowMuted*/ )
579{ 579{
580 int prevVol = m_vol_percent; 580 int prevVol = m_vol_percent;
581 bool prevMute = m_vol_muted; 581 bool prevMute = m_vol_muted;
582 582
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp
index 364f3ad..88ab032 100644
--- a/noncore/applets/wirelessapplet/wireless.cpp
+++ b/noncore/applets/wirelessapplet/wireless.cpp
@@ -98,129 +98,129 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
98 updateLabel = new QLabel( this ); 98 updateLabel = new QLabel( this );
99 text.sprintf( "Update every %d s", updateFrequency ); 99 text.sprintf( "Update every %d s", updateFrequency );
100 updateLabel->setText( text ); 100 updateLabel->setText( text );
101 grid->addWidget( updateLabel, 2, 1 ); 101 grid->addWidget( updateLabel, 2, 1 );
102 102
103 /* update Frequency Slider */ 103 /* update Frequency Slider */
104 104
105 QSlider* updateSlider = new QSlider( QSlider::Horizontal, this ); 105 QSlider* updateSlider = new QSlider( QSlider::Horizontal, this );
106 updateSlider->setRange( 0, 9 ); 106 updateSlider->setRange( 0, 9 );
107 updateSlider->setValue( updateFrequency ); 107 updateSlider->setValue( updateFrequency );
108 updateSlider->setTickmarks( QSlider::Both ); 108 updateSlider->setTickmarks( QSlider::Both );
109 updateSlider->setTickInterval( 1 ); 109 updateSlider->setTickInterval( 1 );
110 updateSlider->setSteps( 1, 1 ); 110 updateSlider->setSteps( 1, 1 );
111 updateSlider->setFocusPolicy( QWidget::NoFocus ); 111 updateSlider->setFocusPolicy( QWidget::NoFocus );
112 grid->addWidget( updateSlider, 1, 1 ); 112 grid->addWidget( updateSlider, 1, 1 );
113 connect( updateSlider, SIGNAL( valueChanged(int) ), 113 connect( updateSlider, SIGNAL( valueChanged(int) ),
114 this, SLOT( updateDelayChange(int) ) ); 114 this, SLOT( updateDelayChange(int) ) );
115 115
116 setFixedSize( sizeHint() ); 116 setFixedSize( sizeHint() );
117 setFocusPolicy( QWidget::NoFocus ); 117 setFocusPolicy( QWidget::NoFocus );
118 118
119 applet->updateDelayChange( updateFrequency ); 119 applet->updateDelayChange( updateFrequency );
120 120
121 applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); 121 applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE );
122} 122}
123 123
124void WirelessControl::advancedConfigClicked() 124void WirelessControl::advancedConfigClicked()
125{ 125{
126 AdvancedConfig * a = new AdvancedConfig( this, "dialog", TRUE ); 126 AdvancedConfig * a = new AdvancedConfig( this, "dialog", TRUE );
127 int result = a->exec(); 127 int result = a->exec();
128 a->hide(); 128 a->hide();
129 delete a; 129 delete a;
130 if ( result == QDialog::Accepted ) 130 if ( result == QDialog::Accepted )
131 { 131 {
132 readConfig(); 132 readConfig();
133 applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); 133 applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE );
134 } 134 }
135} 135}
136 136
137void WirelessControl::updateDelayChange( int delay ) 137void WirelessControl::updateDelayChange( int delay )
138{ 138{
139 QString text; 139 QString text;
140 text.sprintf( "Update every %d s", delay ); 140 text.sprintf( "Update every %d s", delay );
141 updateLabel->setText( text ); 141 updateLabel->setText( text );
142 applet->updateDelayChange( delay ); 142 applet->updateDelayChange( delay );
143 writeConfigEntry( "UpdateFrequency", delay ); 143 writeConfigEntry( "UpdateFrequency", delay );
144} 144}
145 145
146void WirelessControl::displayStyleChange( int style ) 146void WirelessControl::displayStyleChange( int style )
147{ 147{
148 applet->displayStyleChange( style ); 148 applet->displayStyleChange( style );
149 writeConfigEntry( "DisplayStyle", style ); 149 writeConfigEntry( "DisplayStyle", style );
150} 150}
151 151
152void WirelessControl::show ( bool ) 152void WirelessControl::show ( bool )
153{ 153{
154 QPoint curPos = applet->mapToGlobal( QPoint ( 0, 0 ) ); 154 QPoint curPos = applet->mapToGlobal( QPoint ( 0, 0 ) );
155 155
156 int w = sizeHint().width(); 156 int w = sizeHint().width();
157 int x = curPos.x() - ( w / 2 ); 157 int x = curPos.x() - ( w / 2 );
158 158
159 if ( ( x + w ) > QPEApplication::desktop() ->width() ) 159 if ( ( x + w ) > QPEApplication::desktop() ->width() )
160 x = QPEApplication::desktop ( ) -> width ( ) - w; 160 x = QPEApplication::desktop ( ) -> width ( ) - w;
161 161
162 move( x, curPos.y () - sizeHint().height () ); 162 move( QMAX(x,0), curPos.y () - sizeHint().height () );
163 QFrame::show(); 163 QFrame::show();
164} 164}
165 165
166void WirelessControl::readConfig() 166void WirelessControl::readConfig()
167{ 167{
168 Config cfg( "qpe" ); 168 Config cfg( "qpe" );
169 cfg.setGroup( "Wireless" ); 169 cfg.setGroup( "Wireless" );
170 170
171 updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 ); 171 updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 );
172 rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false ); 172 rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false );
173 rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false ); 173 rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false );
174 rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false ); 174 rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false );
175 rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false ); 175 rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false );
176} 176}
177 177
178void WirelessControl::writeConfigEntry( const char *entry, int val ) 178void WirelessControl::writeConfigEntry( const char *entry, int val )
179{ 179{
180 Config cfg( "qpe" ); 180 Config cfg( "qpe" );
181 cfg.setGroup( "Wireless" ); 181 cfg.setGroup( "Wireless" );
182 cfg.writeEntry( entry, val ); 182 cfg.writeEntry( entry, val );
183} 183}
184 184
185//=========================================================================== 185//===========================================================================
186 186
187WirelessApplet::WirelessApplet( QWidget *parent, const char *name ) 187WirelessApplet::WirelessApplet( QWidget *parent, const char *name )
188 : QWidget( parent, name ), 188 : QWidget( parent, name ),
189 timer( 0 ), interface( 0 ), oldiface( 0 ), 189 timer( 0 ), interface( 0 ), oldiface( 0 ),
190 rocESSID( false ), rocFREQ( false ), rocAP( false ), rocMODE( false ) 190 rocESSID( false ), rocFREQ( false ), rocAP( false ), rocMODE( false )
191{ 191{
192 setFixedHeight( 18 ); 192 setFixedHeight( 18 );
193 setFixedWidth( 14 ); 193 setFixedWidth( 14 );
194 status = new WirelessControl( this, this, "wireless status" ); 194 status = new WirelessControl( this, this, "wireless status" );
195} 195}
196 196
197void WirelessApplet::checkInterface() 197void WirelessApplet::checkInterface()
198{ 198{
199 interface = 0L; 199 interface = 0L;
200 ONetwork* net = ONetwork::instance(); 200 ONetwork* net = ONetwork::instance();
201 net->synchronize(); 201 net->synchronize();
202 ONetwork::InterfaceIterator it = net->iterator(); 202 ONetwork::InterfaceIterator it = net->iterator();
203 203
204 while ( it.current() && !it.current()->isWireless() ) ++it; 204 while ( it.current() && !it.current()->isWireless() ) ++it;
205 205
206 if ( it.current() && it.current()->isWireless() ) 206 if ( it.current() && it.current()->isWireless() )
207 interface = static_cast<OWirelessNetworkInterface*>( it.current() ); 207 interface = static_cast<OWirelessNetworkInterface*>( it.current() );
208 208
209 if ( interface ) 209 if ( interface )
210 { 210 {
211#ifdef MDEBUG 211#ifdef MDEBUG
212 odebug << "WIFIAPPLET: using interface '" << ( const char* ) interface->name() << "'" << oendl; 212 odebug << "WIFIAPPLET: using interface '" << ( const char* ) interface->name() << "'" << oendl;
213#endif 213#endif
214 214
215 } 215 }
216 else 216 else
217 { 217 {
218#ifdef MDEBUG 218#ifdef MDEBUG
219 odebug << "WIFIAPPLET: D'oh! No Wireless interface present... :(" << oendl; 219 odebug << "WIFIAPPLET: D'oh! No Wireless interface present... :(" << oendl;
220#endif 220#endif
221 hide(); 221 hide();
222 } 222 }
223} 223}
224 224
225void WirelessApplet::renewDHCP() 225void WirelessApplet::renewDHCP()
226{ 226{