summaryrefslogtreecommitdiff
authorar <ar>2004-02-08 16:09:19 (UTC)
committer ar <ar>2004-02-08 16:09:19 (UTC)
commit6506eeeeaa8d52ae0895630de00e38bc2b8ff10c (patch) (unidiff)
treea306b368cc4192e6a8528c7d602e4726c73a247c
parent811821ed75b87468f521bef2077cf5988aac9b47 (diff)
downloadopie-6506eeeeaa8d52ae0895630de00e38bc2b8ff10c.zip
opie-6506eeeeaa8d52ae0895630de00e38bc2b8ff10c.tar.gz
opie-6506eeeeaa8d52ae0895630de00e38bc2b8ff10c.tar.bz2
improve support for BigScreen
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/batteryapplet/battery.cpp2
-rw-r--r--core/launcher/launcher.cpp3
-rw-r--r--core/launcher/serverapp.cpp2
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp2
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp2
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp2
-rw-r--r--core/obex/obexhandler.cpp3
-rw-r--r--core/pim/today/today.cpp2
-rw-r--r--core/pim/today/todayconfig.cpp3
-rw-r--r--core/settings/button/buttonsettings.cpp3
-rw-r--r--core/settings/launcher/tabssettings.cpp4
-rw-r--r--core/settings/light-and-power/light.cpp3
-rw-r--r--core/settings/security/security.cpp2
13 files changed, 16 insertions, 17 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp
index 4adcab4..3b64fb5 100644
--- a/core/applets/batteryapplet/battery.cpp
+++ b/core/applets/batteryapplet/battery.cpp
@@ -1,170 +1,170 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "battery.h" 20#include "battery.h"
21#include "batterystatus.h" 21#include "batterystatus.h"
22 22
23#include <qpe/applnk.h> 23#include <qpe/applnk.h>
24#include <qpe/config.h> 24#include <qpe/config.h>
25#include <qpe/power.h> 25#include <qpe/power.h>
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27 27
28#include <qpainter.h> 28#include <qpainter.h>
29#include <qtimer.h> 29#include <qtimer.h>
30 30
31 31
32BatteryMeter::BatteryMeter( QWidget *parent ) 32BatteryMeter::BatteryMeter( QWidget *parent )
33 : QWidget( parent ), charging(false) 33 : QWidget( parent ), charging(false)
34{ 34{
35 ps = new PowerStatus; 35 ps = new PowerStatus;
36 startTimer( 10000 ); 36 startTimer( 10000 );
37 37
38 setFixedWidth( QMAX(AppLnk::smallIconSize()*3/4, 6) ); 38 setFixedWidth( QMAX(AppLnk::smallIconSize()*3/4, 6) );
39 setFixedHeight( AppLnk::smallIconSize() ); 39 setFixedHeight( AppLnk::smallIconSize() );
40 40
41 chargeTimer = new QTimer( this ); 41 chargeTimer = new QTimer( this );
42 connect( chargeTimer, SIGNAL(timeout()), this, SLOT(chargeTimeout()) ); 42 connect( chargeTimer, SIGNAL(timeout()), this, SLOT(chargeTimeout()) );
43 timerEvent(0); 43 timerEvent(0);
44 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 44 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
45 Config c( "qpe" ); 45 Config c( "qpe" );
46 c.setGroup( "Battery" ); 46 c.setGroup( "Battery" );
47 style = c.readNumEntry( "Style", 0 ); 47 style = c.readNumEntry( "Style", 0 );
48} 48}
49 49
50BatteryMeter::~BatteryMeter() 50BatteryMeter::~BatteryMeter()
51{ 51{
52 delete ps; 52 delete ps;
53} 53}
54 54
55QSize BatteryMeter::sizeHint() const 55QSize BatteryMeter::sizeHint() const
56{ 56{
57 return QSize(QMAX(AppLnk::smallIconSize()*3/4, 6), height() ); 57 return QSize(QMAX(AppLnk::smallIconSize()*3/4, 6), height() );
58} 58}
59 59
60void BatteryMeter::mousePressEvent( QMouseEvent* e ) 60void BatteryMeter::mousePressEvent( QMouseEvent* e )
61{ 61{
62 if ( e->button() == RightButton ) 62 if ( e->button() == RightButton )
63 { 63 {
64 style = 1-style; 64 style = 1-style;
65 Config c( "qpe" ); 65 Config c( "qpe" );
66 c.setGroup( "Battery" ); 66 c.setGroup( "Battery" );
67 c.writeEntry( "Style", style ); 67 c.writeEntry( "Style", style );
68 repaint( true ); 68 repaint( true );
69 } 69 }
70 QWidget::mousePressEvent( e ); 70 QWidget::mousePressEvent( e );
71} 71}
72 72
73void BatteryMeter::mouseReleaseEvent( QMouseEvent* e) 73void BatteryMeter::mouseReleaseEvent( QMouseEvent* e)
74{ 74{
75 if ( batteryView && batteryView->isVisible() ) { 75 if ( batteryView && batteryView->isVisible() ) {
76 delete (QWidget *) batteryView; 76 delete (QWidget *) batteryView;
77 } else { 77 } else {
78 if ( !batteryView ) batteryView = new BatteryStatus( ps ); 78 if ( !batteryView ) batteryView = new BatteryStatus( ps );
79 batteryView->showMaximized(); 79 QPEApplication::showWidget( batteryView );
80 batteryView->raise(); 80 batteryView->raise();
81 batteryView->show(); 81 batteryView->show();
82 } 82 }
83} 83}
84 84
85void BatteryMeter::timerEvent( QTimerEvent * ) 85void BatteryMeter::timerEvent( QTimerEvent * )
86{ 86{
87 PowerStatus prev = *ps; 87 PowerStatus prev = *ps;
88 88
89 *ps = PowerStatusManager::readStatus(); 89 *ps = PowerStatusManager::readStatus();
90 90
91 if ( prev != *ps ) { 91 if ( prev != *ps ) {
92 percent = ps->batteryPercentRemaining(); 92 percent = ps->batteryPercentRemaining();
93 if ( !charging && ps->batteryStatus() == PowerStatus::Charging ) { 93 if ( !charging && ps->batteryStatus() == PowerStatus::Charging ) {
94 percent = 0; 94 percent = 0;
95 charging = true; 95 charging = true;
96 chargeTimer->start( 500 ); 96 chargeTimer->start( 500 );
97 } else if ( charging && ps->batteryStatus() != PowerStatus::Charging ) { 97 } else if ( charging && ps->batteryStatus() != PowerStatus::Charging ) {
98 charging = false; 98 charging = false;
99 chargeTimer->stop(); 99 chargeTimer->stop();
100 if ( batteryView ) 100 if ( batteryView )
101 batteryView->updatePercent( percent ); 101 batteryView->updatePercent( percent );
102 } 102 }
103 repaint( style != 0 ); 103 repaint( style != 0 );
104 if ( batteryView ) 104 if ( batteryView )
105 batteryView->repaint(); 105 batteryView->repaint();
106 } 106 }
107} 107}
108 108
109void BatteryMeter::chargeTimeout() 109void BatteryMeter::chargeTimeout()
110{ 110{
111 percent += 20; 111 percent += 20;
112 if ( percent > 100 ) 112 if ( percent > 100 )
113 percent = 0; 113 percent = 0;
114 114
115 repaint(FALSE); 115 repaint(FALSE);
116 if ( batteryView ) 116 if ( batteryView )
117 batteryView->updatePercent( percent ); 117 batteryView->updatePercent( percent );
118} 118}
119 119
120void BatteryMeter::paintEvent( QPaintEvent* ) 120void BatteryMeter::paintEvent( QPaintEvent* )
121{ 121{
122 122
123 if ( style == 1 ) 123 if ( style == 1 )
124 { 124 {
125 QPainter p(this); 125 QPainter p(this);
126 QFont f( "Fixed", AppLnk::smallIconSize()/2 ); 126 QFont f( "Fixed", AppLnk::smallIconSize()/2 );
127 QFontMetrics fm( f ); 127 QFontMetrics fm( f );
128 p.setFont( f ); 128 p.setFont( f );
129 p.drawText( 0, height()/2, QString::number( percent ) ); 129 p.drawText( 0, height()/2, QString::number( percent ) );
130 p.drawText( width()/4, height(), "%" ); 130 p.drawText( width()/4, height(), "%" );
131 return; 131 return;
132 } 132 }
133 133
134 QPainter p(this); 134 QPainter p(this);
135 QColor color; 135 QColor color;
136 QColor g = gray.light( 160 ); 136 QColor g = gray.light( 160 );
137 switch ( ps->acStatus() ) 137 switch ( ps->acStatus() )
138 { 138 {
139 case PowerStatus::Offline: color = blue.light( 150 ); break; 139 case PowerStatus::Offline: color = blue.light( 150 ); break;
140 case PowerStatus::Online: color = green.dark( 130 ).light( 180 ); break; 140 case PowerStatus::Online: color = green.dark( 130 ).light( 180 ); break;
141 default: color = red.light( 160 ); 141 default: color = red.light( 160 );
142 } 142 }
143 143
144 int w = height() / 2; 144 int w = height() / 2;
145 if ( !(w%2) ) w--; // should have an odd value to get a real middle line 145 if ( !(w%2) ) w--; // should have an odd value to get a real middle line
146 int h = height() - 4; 146 int h = height() - 4;
147 int pix = (percent * h) / 100; 147 int pix = (percent * h) / 100;
148 int y2 = height() -2; 148 int y2 = height() -2;
149 int y = y2 - pix; 149 int y = y2 - pix;
150 int x1 = (width() - w ) / 2; 150 int x1 = (width() - w ) / 2;
151 151
152 p.setPen(QColor(80,80,80)); 152 p.setPen(QColor(80,80,80));
153 p.drawLine(x1+w/4,0,x1+w/4+w/2+1,0); // header 153 p.drawLine(x1+w/4,0,x1+w/4+w/2+1,0); // header
154 p.drawRect(x1,1,w,height()-1); // corpus 154 p.drawRect(x1,1,w,height()-1); // corpus
155 p.setBrush(color); 155 p.setBrush(color);
156 156
157 int extra = ((percent * h) % 100)/(100/4); 157 int extra = ((percent * h) % 100)/(100/4);
158 158
159 int middle = w/2; 159 int middle = w/2;
160 for ( int i = 0; i < middle; i++ ) 160 for ( int i = 0; i < middle; i++ )
161 { 161 {
162 p.setPen( gray.dark( 100+i*20 ) ); 162 p.setPen( gray.dark( 100+i*20 ) );
163 p.drawLine( x1+middle-i, 2, x1+middle-i, y-1 ); 163 p.drawLine( x1+middle-i, 2, x1+middle-i, y-1 );
164 p.drawLine( x1+middle+i, 2, x1+middle+i, y-1 ); 164 p.drawLine( x1+middle+i, 2, x1+middle+i, y-1 );
165 p.setPen( color.dark( 100+i*20 ) ); 165 p.setPen( color.dark( 100+i*20 ) );
166 p.drawLine( x1+middle-i, y, x1+middle-i, y2 ); 166 p.drawLine( x1+middle-i, y, x1+middle-i, y2 );
167 p.drawLine( x1+middle+i, y, x1+middle+i, y2 ); 167 p.drawLine( x1+middle+i, y, x1+middle+i, y2 );
168 } 168 }
169} 169}
170 170
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index bdddd37..98e7481 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -520,194 +520,193 @@ void Launcher::destroyGUI()
520 tb = 0; 520 tb = 0;
521 delete tabs; 521 delete tabs;
522 tabs =0; 522 tabs =0;
523} 523}
524 524
525bool Launcher::eventFilter( QObject*, QEvent *ev ) 525bool Launcher::eventFilter( QObject*, QEvent *ev )
526{ 526{
527#ifdef QT_QWS_CUSTOM 527#ifdef QT_QWS_CUSTOM
528 if ( ev->type() == QEvent::KeyPress ) { 528 if ( ev->type() == QEvent::KeyPress ) {
529 QKeyEvent *ke = (QKeyEvent *)ev; 529 QKeyEvent *ke = (QKeyEvent *)ev;
530 if ( ke->key() == Qt::Key_F11 ) { // menu key 530 if ( ke->key() == Qt::Key_F11 ) { // menu key
531 QWidget *active = qApp->activeWindow(); 531 QWidget *active = qApp->activeWindow();
532 if ( active && active->isPopup() ) 532 if ( active && active->isPopup() )
533 active->close(); 533 active->close();
534 else { 534 else {
535 Global::terminateBuiltin("calibrate"); // No tr 535 Global::terminateBuiltin("calibrate"); // No tr
536 tb->launchStartMenu(); 536 tb->launchStartMenu();
537 } 537 }
538 return TRUE; 538 return TRUE;
539 } 539 }
540 } 540 }
541#else 541#else
542 Q_UNUSED(ev); 542 Q_UNUSED(ev);
543#endif 543#endif
544 return FALSE; 544 return FALSE;
545} 545}
546 546
547void Launcher::toggleSymbolInput() 547void Launcher::toggleSymbolInput()
548{ 548{
549 tb->toggleSymbolInput(); 549 tb->toggleSymbolInput();
550} 550}
551 551
552void Launcher::toggleNumLockState() 552void Launcher::toggleNumLockState()
553{ 553{
554 tb->toggleNumLockState(); 554 tb->toggleNumLockState();
555} 555}
556 556
557void Launcher::toggleCapsLockState() 557void Launcher::toggleCapsLockState()
558{ 558{
559 tb->toggleCapsLockState(); 559 tb->toggleCapsLockState();
560} 560}
561 561
562static bool isVisibleWindow(int wid) 562static bool isVisibleWindow(int wid)
563{ 563{
564#ifdef Q_WS_QWS 564#ifdef Q_WS_QWS
565 const QList<QWSWindow> &list = qwsServer->clientWindows(); 565 const QList<QWSWindow> &list = qwsServer->clientWindows();
566 QWSWindow* w; 566 QWSWindow* w;
567 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { 567 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
568 if ( w->winId() == wid ) 568 if ( w->winId() == wid )
569 return !w->isFullyObscured(); 569 return !w->isFullyObscured();
570 } 570 }
571#endif 571#endif
572 return FALSE; 572 return FALSE;
573} 573}
574 574
575void Launcher::viewSelected(const QString& s) 575void Launcher::viewSelected(const QString& s)
576{ 576{
577 setCaption( s + tr(" - Launcher") ); 577 setCaption( s + tr(" - Launcher") );
578} 578}
579 579
580void Launcher::showTab(const QString& id) 580void Launcher::showTab(const QString& id)
581{ 581{
582 tabs->categoryBar->showTab(id); 582 tabs->categoryBar->showTab(id);
583 raise(); 583 raise();
584} 584}
585 585
586void Launcher::select( const AppLnk *appLnk ) 586void Launcher::select( const AppLnk *appLnk )
587{ 587{
588 if ( appLnk->type() == "Folder" ) { // No tr 588 if ( appLnk->type() == "Folder" ) { // No tr
589 // Not supported: flat is simpler for the user 589 // Not supported: flat is simpler for the user
590 } else { 590 } else {
591 if ( appLnk->exec().isNull() ) { 591 if ( appLnk->exec().isNull() ) {
592 int i = QMessageBox::information(this,tr("No application"), 592 int i = QMessageBox::information(this,tr("No application"),
593 tr("<p>No application is defined for this document." 593 tr("<p>No application is defined for this document."
594 "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); 594 "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1);
595 595
596 /* ### Fixme */ 596 /* ### Fixme */
597 if ( i == 1 ) 597 if ( i == 1 )
598 Global::execute("textedit",appLnk->file()); 598 Global::execute("textedit",appLnk->file());
599 599
600 return; 600 return;
601 } 601 }
602 tabs->setBusy(TRUE); 602 tabs->setBusy(TRUE);
603 emit executing( appLnk ); 603 emit executing( appLnk );
604 appLnk->execute(); 604 appLnk->execute();
605 } 605 }
606} 606}
607 607
608void Launcher::properties( AppLnk *appLnk ) 608void Launcher::properties( AppLnk *appLnk )
609{ 609{
610 if ( appLnk->type() == "Folder" ) { // No tr 610 if ( appLnk->type() == "Folder" ) { // No tr
611 // Not supported: flat is simpler for the user 611 // Not supported: flat is simpler for the user
612 } else { 612 } else {
613/* ### libqtopia FIXME also moving docLnks... */ 613/* ### libqtopia FIXME also moving docLnks... */
614 LnkProperties prop(appLnk,0 ); 614 LnkProperties prop(appLnk,0 );
615 615
616 prop.showMaximized(); 616 QPEApplication::execDialog( &prop );
617 prop.exec();
618 } 617 }
619} 618}
620 619
621void Launcher::storageChanged( const QList<FileSystem> &fs ) 620void Launcher::storageChanged( const QList<FileSystem> &fs )
622{ 621{
623 // ### update combo boxes if we had a combo box for the storage type 622 // ### update combo boxes if we had a combo box for the storage type
624} 623}
625 624
626void Launcher::systemMessage( const QCString &msg, const QByteArray &data) 625void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
627{ 626{
628 QDataStream stream( data, IO_ReadOnly ); 627 QDataStream stream( data, IO_ReadOnly );
629 if ( msg == "busy()" ) { 628 if ( msg == "busy()" ) {
630 tb->startWait(); 629 tb->startWait();
631 } else if ( msg == "notBusy(QString)" ) { 630 } else if ( msg == "notBusy(QString)" ) {
632 QString app; 631 QString app;
633 stream >> app; 632 stream >> app;
634 tabs->setBusy(FALSE); 633 tabs->setBusy(FALSE);
635 tb->stopWait(app); 634 tb->stopWait(app);
636 } else if (msg == "applyStyle()") { 635 } else if (msg == "applyStyle()") {
637 tabs->currentView()->relayout(); 636 tabs->currentView()->relayout();
638 } 637 }
639} 638}
640 639
641// These are the update functions from the server 640// These are the update functions from the server
642void Launcher::typeAdded( const QString& type, const QString& name, 641void Launcher::typeAdded( const QString& type, const QString& name,
643 const QPixmap& pixmap, const QPixmap& ) 642 const QPixmap& pixmap, const QPixmap& )
644{ 643{
645 tabs->newView( type, pixmap, name ); 644 tabs->newView( type, pixmap, name );
646 ids.append( type ); 645 ids.append( type );
647 tb->refreshStartMenu(); 646 tb->refreshStartMenu();
648 647
649 static bool first = TRUE; 648 static bool first = TRUE;
650 if ( first ) { 649 if ( first ) {
651 first = FALSE; 650 first = FALSE;
652 tabs->categoryBar->showTab(type); 651 tabs->categoryBar->showTab(type);
653 } 652 }
654 653
655 tabs->view( type )->setUpdatesEnabled( FALSE ); 654 tabs->view( type )->setUpdatesEnabled( FALSE );
656 tabs->view( type )->setSortEnabled( FALSE ); 655 tabs->view( type )->setSortEnabled( FALSE );
657} 656}
658 657
659void Launcher::typeRemoved( const QString& type ) 658void Launcher::typeRemoved( const QString& type )
660{ 659{
661 tabs->view( type )->removeAllItems(); 660 tabs->view( type )->removeAllItems();
662 tabs->deleteView( type ); 661 tabs->deleteView( type );
663 ids.remove( type ); 662 ids.remove( type );
664 tb->refreshStartMenu(); 663 tb->refreshStartMenu();
665} 664}
666 665
667void Launcher::applicationAdded( const QString& type, const AppLnk& app ) 666void Launcher::applicationAdded( const QString& type, const AppLnk& app )
668{ 667{
669 if ( app.type() == "Separator" ) // No tr 668 if ( app.type() == "Separator" ) // No tr
670 return; 669 return;
671 670
672 LauncherView *view = tabs->view( type ); 671 LauncherView *view = tabs->view( type );
673 if ( view ) 672 if ( view )
674 view->addItem( new AppLnk( app ), FALSE ); 673 view->addItem( new AppLnk( app ), FALSE );
675 else 674 else
676 qWarning("addAppLnk: No view for type %s. Can't add app %s!", 675 qWarning("addAppLnk: No view for type %s. Can't add app %s!",
677 type.latin1(),app.name().latin1() ); 676 type.latin1(),app.name().latin1() );
678 677
679 MimeType::registerApp( app ); 678 MimeType::registerApp( app );
680} 679}
681 680
682void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) 681void Launcher::applicationRemoved( const QString& type, const AppLnk& app )
683{ 682{
684 LauncherView *view = tabs->view( type ); 683 LauncherView *view = tabs->view( type );
685 if ( view ) 684 if ( view )
686 view->removeLink( app.linkFile() ); 685 view->removeLink( app.linkFile() );
687 else 686 else
688 qWarning("removeAppLnk: No view for %s!", type.latin1() ); 687 qWarning("removeAppLnk: No view for %s!", type.latin1() );
689} 688}
690 689
691void Launcher::allApplicationsRemoved() 690void Launcher::allApplicationsRemoved()
692{ 691{
693 MimeType::clear(); 692 MimeType::clear();
694 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) 693 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it)
695 tabs->view( (*it) )->removeAllItems(); 694 tabs->view( (*it) )->removeAllItems();
696} 695}
697 696
698void Launcher::documentAdded( const DocLnk& doc ) 697void Launcher::documentAdded( const DocLnk& doc )
699{ 698{
700 tabs->docView()->addItem( new DocLnk( doc ), FALSE ); 699 tabs->docView()->addItem( new DocLnk( doc ), FALSE );
701} 700}
702 701
703void Launcher::showLoadingDocs() 702void Launcher::showLoadingDocs()
704{ 703{
705 tabs->docView()->hide(); 704 tabs->docView()->hide();
706} 705}
707 706
708void Launcher::showDocTab() 707void Launcher::showDocTab()
709{ 708{
710 if ( tabs->categoryBar->currentView() == tabs->docView() ) 709 if ( tabs->categoryBar->currentView() == tabs->docView() )
711 tabs->docView()->show(); 710 tabs->docView()->show();
712} 711}
713 712
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp
index e8d49fd..e18bcee 100644
--- a/core/launcher/serverapp.cpp
+++ b/core/launcher/serverapp.cpp
@@ -609,193 +609,193 @@ void ServerApplication::toggleLight()
609{ 609{
610#ifndef QT_NO_COP 610#ifndef QT_NO_COP
611 QCopEnvelope e("QPE/System", "setBacklight(int)"); 611 QCopEnvelope e("QPE/System", "setBacklight(int)");
612 e << -2; // toggle 612 e << -2; // toggle
613#endif 613#endif
614} 614}
615 615
616 616
617/* 617/*
618 * We still listen to key events but handle them in 618 * We still listen to key events but handle them in
619 * a special class 619 * a special class
620 */ 620 */
621 621
622bool ServerApplication::eventFilter( QObject *o, QEvent *e) { 622bool ServerApplication::eventFilter( QObject *o, QEvent *e) {
623 if ( e->type() != QEvent::KeyPress && 623 if ( e->type() != QEvent::KeyPress &&
624 e->type() != QEvent::KeyRelease ) 624 e->type() != QEvent::KeyRelease )
625 return QPEApplication::eventFilter( o, e ); 625 return QPEApplication::eventFilter( o, e );
626 626
627 QKeyEvent *ke = static_cast<QKeyEvent*>( e ); 627 QKeyEvent *ke = static_cast<QKeyEvent*>( e );
628 if ( kf->checkButtonAction( true, ke->key(), 628 if ( kf->checkButtonAction( true, ke->key(),
629 e->type() == QEvent::KeyPress, 629 e->type() == QEvent::KeyPress,
630 ke-> isAutoRepeat() )) 630 ke-> isAutoRepeat() ))
631 return true; 631 return true;
632 632
633 return QPEApplication::eventFilter( o, e ); 633 return QPEApplication::eventFilter( o, e );
634 634
635} 635}
636 636
637#ifdef Q_WS_QWS 637#ifdef Q_WS_QWS
638bool ServerApplication::qwsEventFilter( QWSEvent *e ) 638bool ServerApplication::qwsEventFilter( QWSEvent *e )
639{ 639{
640 checkMemory(); 640 checkMemory();
641 641
642 if ( e->type == QWSEvent::Mouse ) { 642 if ( e->type == QWSEvent::Mouse ) {
643 QWSMouseEvent *me = (QWSMouseEvent *)e; 643 QWSMouseEvent *me = (QWSMouseEvent *)e;
644 static bool up = TRUE; 644 static bool up = TRUE;
645 if ( me->simpleData.state&LeftButton ) { 645 if ( me->simpleData.state&LeftButton ) {
646 if ( up ) { 646 if ( up ) {
647 up = FALSE; 647 up = FALSE;
648 screenClick(TRUE); 648 screenClick(TRUE);
649 } 649 }
650 } else if ( !up ) { 650 } else if ( !up ) {
651 up = TRUE; 651 up = TRUE;
652 screenClick(FALSE); 652 screenClick(FALSE);
653 } 653 }
654 }else if ( e->type == QWSEvent::Key ) { 654 }else if ( e->type == QWSEvent::Key ) {
655 QWSKeyEvent * ke = static_cast<QWSKeyEvent*>( e ); 655 QWSKeyEvent * ke = static_cast<QWSKeyEvent*>( e );
656 if ( kf->checkButtonAction( false, 656 if ( kf->checkButtonAction( false,
657 ke-> simpleData.keycode, 657 ke-> simpleData.keycode,
658 ke-> simpleData.is_press, 658 ke-> simpleData.is_press,
659 ke-> simpleData.is_auto_repeat ) ) 659 ke-> simpleData.is_auto_repeat ) )
660 return true; 660 return true;
661 } 661 }
662 662
663 return QPEApplication::qwsEventFilter( e ); 663 return QPEApplication::qwsEventFilter( e );
664} 664}
665#endif 665#endif
666 666
667 667
668/* ### FIXME libqtopia Plugin Safe Mode */ 668/* ### FIXME libqtopia Plugin Safe Mode */
669 669
670void ServerApplication::showSafeMode() 670void ServerApplication::showSafeMode()
671{ 671{
672#if 0 672#if 0
673 if ( QMessageBox::warning(0, tr("Safe Mode"), tr("<P>A system startup error occurred, " 673 if ( QMessageBox::warning(0, tr("Safe Mode"), tr("<P>A system startup error occurred, "
674 "and the system is now in Safe Mode. " 674 "and the system is now in Safe Mode. "
675 "Plugins are not loaded in Safe Mode. " 675 "Plugins are not loaded in Safe Mode. "
676 "You can use the Plugin Manager to " 676 "You can use the Plugin Manager to "
677 "disable plugins that cause system error."), tr("OK"), tr("Plugin Manager..."), 0) == 1 ) { 677 "disable plugins that cause system error."), tr("OK"), tr("Plugin Manager..."), 0) == 1 ) {
678 Global::execute( "pluginmanager" ); 678 Global::execute( "pluginmanager" );
679 } 679 }
680#endif 680#endif
681} 681}
682 682
683void ServerApplication::clearSafeMode() 683void ServerApplication::clearSafeMode()
684{ 684{
685#if 0 685#if 0
686 // If we've been running OK for a while then we won't bother going into 686 // If we've been running OK for a while then we won't bother going into
687 // safe mode immediately on the next crash. 687 // safe mode immediately on the next crash.
688 Config cfg( "PluginLoader" ); 688 Config cfg( "PluginLoader" );
689 cfg.setGroup( "Global" ); 689 cfg.setGroup( "Global" );
690 QString mode = cfg.readEntry( "Mode", "Normal" ); 690 QString mode = cfg.readEntry( "Mode", "Normal" );
691 if ( mode == "MaybeSafe" ) { 691 if ( mode == "MaybeSafe" ) {
692 cfg.writeEntry( "Mode", "Normal" ); 692 cfg.writeEntry( "Mode", "Normal" );
693 } 693 }
694#endif 694#endif
695} 695}
696 696
697 697
698void ServerApplication::shutdown() 698void ServerApplication::shutdown()
699{ 699{
700 if ( type() != GuiServer ) 700 if ( type() != GuiServer )
701 return; 701 return;
702 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); 702 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose );
703 connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)), 703 connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)),
704 this, SLOT(shutdown(ShutdownImpl::Type)) ); 704 this, SLOT(shutdown(ShutdownImpl::Type)) );
705 sd->showMaximized(); 705 QPEApplication::showWidget( sd );
706} 706}
707 707
708void ServerApplication::shutdown( ShutdownImpl::Type t ) 708void ServerApplication::shutdown( ShutdownImpl::Type t )
709{ 709{
710 char *opt = 0; 710 char *opt = 0;
711 711
712 switch ( t ) { 712 switch ( t ) {
713 case ShutdownImpl::ShutdownSystem: 713 case ShutdownImpl::ShutdownSystem:
714 opt = "-h"; 714 opt = "-h";
715 // fall through 715 // fall through
716 case ShutdownImpl::RebootSystem: 716 case ShutdownImpl::RebootSystem:
717 if ( opt == 0 ) 717 if ( opt == 0 )
718 opt = "-r"; 718 opt = "-r";
719 719
720 if ( execl( "/sbin/shutdown", "shutdown", opt, "now", ( void* ) 0) < 0 ) 720 if ( execl( "/sbin/shutdown", "shutdown", opt, "now", ( void* ) 0) < 0 )
721 perror("shutdown"); 721 perror("shutdown");
722 // ::syslog ( LOG_ERR, "Erroring execing shutdown\n" ); 722 // ::syslog ( LOG_ERR, "Erroring execing shutdown\n" );
723 723
724 break; 724 break;
725 case ShutdownImpl::RestartDesktop: 725 case ShutdownImpl::RestartDesktop:
726 restart(); 726 restart();
727 break; 727 break;
728 case ShutdownImpl::TerminateDesktop: 728 case ShutdownImpl::TerminateDesktop:
729 prepareForTermination( FALSE ); 729 prepareForTermination( FALSE );
730 730
731 // This is a workaround for a Qt bug 731 // This is a workaround for a Qt bug
732 // clipboard applet has to stop its poll timer, or Qt/E 732 // clipboard applet has to stop its poll timer, or Qt/E
733 // will hang on quit() right before it emits aboutToQuit() 733 // will hang on quit() right before it emits aboutToQuit()
734 emit aboutToQuit ( ); 734 emit aboutToQuit ( );
735 735
736 quit(); 736 quit();
737 break; 737 break;
738 } 738 }
739} 739}
740 740
741void ServerApplication::restart() 741void ServerApplication::restart()
742{ 742{
743 if ( allowRestart ) { 743 if ( allowRestart ) {
744 744
745 /* 745 /*
746 * Applets and restart is a problem. Some applets delete 746 * Applets and restart is a problem. Some applets delete
747 * their widgets even if ownership gets transfered to the 747 * their widgets even if ownership gets transfered to the
748 * parent (Systray ) but deleting the applet may be unsafe 748 * parent (Systray ) but deleting the applet may be unsafe
749 * as well ( double deletion ). Some have topLevel widgets 749 * as well ( double deletion ). Some have topLevel widgets
750 * and when we dlclose and then delete the widget we will 750 * and when we dlclose and then delete the widget we will
751 * crash and an crash during restart is not nice 751 * crash and an crash during restart is not nice
752 */ 752 */
753#ifdef ALL_APPLETS_ON_THIS_WORLD_ARE_FIXED 753#ifdef ALL_APPLETS_ON_THIS_WORLD_ARE_FIXED
754 /* same as above */ 754 /* same as above */
755 emit aboutToQuit(); 755 emit aboutToQuit();
756 prepareForTermination(TRUE); 756 prepareForTermination(TRUE);
757 doRestart = TRUE; 757 doRestart = TRUE;
758 quit(); 758 quit();
759#else 759#else
760 prepareForTermination( true ); 760 prepareForTermination( true );
761 for ( int fd = 3; fd < 100; fd++ ) 761 for ( int fd = 3; fd < 100; fd++ )
762 close( fd ); 762 close( fd );
763 execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); 763 execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 );
764 exit( 1 ); 764 exit( 1 );
765#endif 765#endif
766 } 766 }
767} 767}
768 768
769void ServerApplication::rereadVolumes() 769void ServerApplication::rereadVolumes()
770{ 770{
771 Config cfg( "qpe" ); 771 Config cfg( "qpe" );
772 cfg. setGroup ( "Volume" ); 772 cfg. setGroup ( "Volume" );
773 773
774 m_screentap_sound = cfg. readBoolEntry ( "TouchSound" ); 774 m_screentap_sound = cfg. readBoolEntry ( "TouchSound" );
775 m_keyclick_sound = cfg. readBoolEntry ( "KeySound" ); 775 m_keyclick_sound = cfg. readBoolEntry ( "KeySound" );
776 m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" ); 776 m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" );
777} 777}
778 778
779 779
780void ServerApplication::checkMemory() 780void ServerApplication::checkMemory()
781{ 781{
782#if defined(QPE_HAVE_MEMALERTER) 782#if defined(QPE_HAVE_MEMALERTER)
783 static bool ignoreNormal=TRUE; 783 static bool ignoreNormal=TRUE;
784 static bool existingMessage=FALSE; 784 static bool existingMessage=FALSE;
785 785
786 if(existingMessage) 786 if(existingMessage)
787 return; // don't show a second message while still on first 787 return; // don't show a second message while still on first
788 788
789 existingMessage = TRUE; 789 existingMessage = TRUE;
790 switch ( memstate ) { 790 switch ( memstate ) {
791 case MemUnknown: 791 case MemUnknown:
792 break; 792 break;
793 case MemLow: 793 case MemLow:
794 memstate = MemUnknown; 794 memstate = MemUnknown;
795 if ( !recoverMemory() ) { 795 if ( !recoverMemory() ) {
796 QMessageBox::warning( 0 , tr("Memory Status"), 796 QMessageBox::warning( 0 , tr("Memory Status"),
797 tr("Memory Low\nPlease save data.") ); 797 tr("Memory Low\nPlease save data.") );
798 ignoreNormal = FALSE; 798 ignoreNormal = FALSE;
799 } 799 }
800 break; 800 break;
801 case MemNormal: 801 case MemNormal:
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp
index 44fbe48..fbc5072 100644
--- a/core/multimedia/opieplayer/audiowidget.cpp
+++ b/core/multimedia/opieplayer/audiowidget.cpp
@@ -193,193 +193,193 @@ AudioWidget::~AudioWidget() {
193 193
194 194
195QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 195QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
196 QPixmap pix( img.width(), img.height() ); 196 QPixmap pix( img.width(), img.height() );
197 QPainter p( &pix ); 197 QPainter p( &pix );
198 p.drawTiledPixmap( pix.rect(), bg, offset ); 198 p.drawTiledPixmap( pix.rect(), bg, offset );
199 p.drawImage( 0, 0, img ); 199 p.drawImage( 0, 0, img );
200 return new QPixmap( pix ); 200 return new QPixmap( pix );
201} 201}
202 202
203 203
204QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) 204QPixmap *maskPixToMask( QPixmap pix, QBitmap mask )
205{ 205{
206 QPixmap *pixmap = new QPixmap( pix ); 206 QPixmap *pixmap = new QPixmap( pix );
207 pixmap->setMask( mask ); 207 pixmap->setMask( mask );
208 return pixmap; 208 return pixmap;
209} 209}
210 210
211 211
212 212
213void AudioWidget::resizeEvent( QResizeEvent * ) { 213void AudioWidget::resizeEvent( QResizeEvent * ) {
214 int h = height(); 214 int h = height();
215 int w = width(); 215 int w = width();
216 216
217 songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); 217 songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) );
218 slider.setFixedWidth( w - 110 ); 218 slider.setFixedWidth( w - 110 );
219 slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); 219 slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) );
220 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 220 slider.setBackgroundOrigin( QWidget::ParentOrigin );
221 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 221 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
222 222
223 xoff = ( w - imgUp->width() ) / 2; 223 xoff = ( w - imgUp->width() ) / 2;
224 yoff = (( h - imgUp->height() ) / 2) - 10; 224 yoff = (( h - imgUp->height() ) / 2) - 10;
225 QPoint p( xoff, yoff ); 225 QPoint p( xoff, yoff );
226 226
227 QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); 227 QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p );
228 QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); 228 QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p );
229 229
230 for ( int i = 0; i < 10; i++ ) { 230 for ( int i = 0; i < 10; i++ ) {
231 if ( !masks[i]->isNull() ) { 231 if ( !masks[i]->isNull() ) {
232 delete buttonPixUp[i]; 232 delete buttonPixUp[i];
233 delete buttonPixDown[i]; 233 delete buttonPixDown[i];
234 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); 234 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] );
235 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] ); 235 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] );
236 } 236 }
237 } 237 }
238 238
239 delete pixUp; 239 delete pixUp;
240 delete pixDn; 240 delete pixDn;
241} 241}
242 242
243 243
244static bool audioSliderBeingMoved = FALSE; 244static bool audioSliderBeingMoved = FALSE;
245 245
246void AudioWidget::sliderPressed() { 246void AudioWidget::sliderPressed() {
247 audioSliderBeingMoved = TRUE; 247 audioSliderBeingMoved = TRUE;
248} 248}
249 249
250 250
251void AudioWidget::sliderReleased() { 251void AudioWidget::sliderReleased() {
252 audioSliderBeingMoved = FALSE; 252 audioSliderBeingMoved = FALSE;
253 if ( slider.width() == 0 ) 253 if ( slider.width() == 0 )
254 return; 254 return;
255 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); 255 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width());
256 mediaPlayerState->setPosition( val ); 256 mediaPlayerState->setPosition( val );
257} 257}
258 258
259 259
260void AudioWidget::setPosition( long i ) { 260void AudioWidget::setPosition( long i ) {
261// qDebug("set position %d",i); 261// qDebug("set position %d",i);
262 long length = mediaPlayerState->length(); 262 long length = mediaPlayerState->length();
263 updateSlider( i, length ); 263 updateSlider( i, length );
264} 264}
265 265
266 266
267void AudioWidget::setLength( long max ) { 267void AudioWidget::setLength( long max ) {
268 updateSlider( mediaPlayerState->position(), max ); 268 updateSlider( mediaPlayerState->position(), max );
269} 269}
270 270
271 271
272void AudioWidget::setView( char view ) { 272void AudioWidget::setView( char view ) {
273 273
274 if (mediaPlayerState->isStreaming) { 274 if (mediaPlayerState->isStreaming) {
275 if( !slider.isHidden()) slider.hide(); 275 if( !slider.isHidden()) slider.hide();
276 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 276 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
277 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 277 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
278 } else { 278 } else {
279// this stops the slider from being moved, thus 279// this stops the slider from being moved, thus
280 // does not stop stream when it reaches the end 280 // does not stop stream when it reaches the end
281 slider.show(); 281 slider.show();
282 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 282 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
283 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 283 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
284 } 284 }
285 285
286 if ( view == 'a' ) { 286 if ( view == 'a' ) {
287 startTimer( 150 ); 287 startTimer( 150 );
288// show(); 288// show();
289 showMaximized(); 289 QPEApplication::showWidget( this );
290 } else { 290 } else {
291 killTimers(); 291 killTimers();
292 hide(); 292 hide();
293 } 293 }
294 294
295} 295}
296 296
297 297
298static QString timeAsString( long length ) { 298static QString timeAsString( long length ) {
299 length /= 44100; 299 length /= 44100;
300 int minutes = length / 60; 300 int minutes = length / 60;
301 int seconds = length % 60; 301 int seconds = length % 60;
302 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); 302 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
303} 303}
304 304
305void AudioWidget::updateSlider( long i, long max ) { 305void AudioWidget::updateSlider( long i, long max ) {
306this->setFocus(); 306this->setFocus();
307 time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); 307 time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
308 308
309 if ( max == 0 ) 309 if ( max == 0 )
310 return; 310 return;
311 // Will flicker too much if we don't do this 311 // Will flicker too much if we don't do this
312 // Scale to something reasonable 312 // Scale to something reasonable
313 int width = slider.width(); 313 int width = slider.width();
314 int val = int((double)i * width / max); 314 int val = int((double)i * width / max);
315 if ( !audioSliderBeingMoved ) { 315 if ( !audioSliderBeingMoved ) {
316 if ( slider.value() != val ) 316 if ( slider.value() != val )
317 slider.setValue( val ); 317 slider.setValue( val );
318 if ( slider.maxValue() != width ) 318 if ( slider.maxValue() != width )
319 slider.setMaxValue( width ); 319 slider.setMaxValue( width );
320 } 320 }
321} 321}
322 322
323 323
324void AudioWidget::setToggleButton( int i, bool down ) { 324void AudioWidget::setToggleButton( int i, bool down ) {
325 if ( down != audioButtons[i].isDown ) 325 if ( down != audioButtons[i].isDown )
326 toggleButton( i ); 326 toggleButton( i );
327} 327}
328 328
329 329
330void AudioWidget::toggleButton( int i ) { 330void AudioWidget::toggleButton( int i ) {
331 audioButtons[i].isDown = !audioButtons[i].isDown; 331 audioButtons[i].isDown = !audioButtons[i].isDown;
332 QPainter p(this); 332 QPainter p(this);
333 paintButton ( &p, i ); 333 paintButton ( &p, i );
334} 334}
335 335
336 336
337void AudioWidget::paintButton( QPainter *p, int i ) { 337void AudioWidget::paintButton( QPainter *p, int i ) {
338 if ( audioButtons[i].isDown ) 338 if ( audioButtons[i].isDown )
339 p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); 339 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
340 else 340 else
341 p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); 341 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
342} 342}
343 343
344 344
345void AudioWidget::timerEvent( QTimerEvent * ) { 345void AudioWidget::timerEvent( QTimerEvent * ) {
346/* 346/*
347 int x = audioButtons[AudioPlay].xPos; 347 int x = audioButtons[AudioPlay].xPos;
348 int y = audioButtons[AudioPlay].yPos; 348 int y = audioButtons[AudioPlay].yPos;
349 QPainter p( this ); 349 QPainter p( this );
350 // Optimize to only draw the little bit of the changing images which is different 350 // Optimize to only draw the little bit of the changing images which is different
351 p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 ); 351 p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 );
352 p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 ); 352 p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 );
353*/ 353*/
354/* 354/*
355 static int frame = 0; 355 static int frame = 0;
356 if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { 356 if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) {
357 frame = frame >= 7 ? 0 : frame + 1; 357 frame = frame >= 7 ? 0 : frame + 1;
358 } 358 }
359 */ 359 */
360} 360}
361 361
362 362
363void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { 363void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
364 for ( int i = 0; i < numButtons; i++ ) { 364 for ( int i = 0; i < numButtons; i++ ) {
365 if ( event->state() == QMouseEvent::LeftButton ) { 365 if ( event->state() == QMouseEvent::LeftButton ) {
366 366
367 // The test to see if the mouse click is inside the button or not 367 // The test to see if the mouse click is inside the button or not
368 int x = event->pos().x() - xoff; 368 int x = event->pos().x() - xoff;
369 int y = event->pos().y() - yoff; 369 int y = event->pos().y() - yoff;
370 370
371 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() 371 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
372 && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); 372 && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 );
373 373
374// if ( isOnButton && i == AudioVolumeUp ) 374// if ( isOnButton && i == AudioVolumeUp )
375// qDebug("on up"); 375// qDebug("on up");
376 376
377 if ( isOnButton && !audioButtons[i].isHeld ) { 377 if ( isOnButton && !audioButtons[i].isHeld ) {
378 audioButtons[i].isHeld = TRUE; 378 audioButtons[i].isHeld = TRUE;
379 toggleButton(i); 379 toggleButton(i);
380 switch (i) { 380 switch (i) {
381 case AudioVolumeUp: 381 case AudioVolumeUp:
382 // qDebug("more clicked"); 382 // qDebug("more clicked");
383 emit moreClicked(); 383 emit moreClicked();
384 return; 384 return;
385 case AudioVolumeDown: 385 case AudioVolumeDown:
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 82fd1e1..db99866 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -612,193 +612,193 @@ const DocLnk *PlayListWidget::current() { // this is fugly
612 break; 612 break;
613 }; 613 };
614 return 0; 614 return 0;
615} 615}
616 616
617bool PlayListWidget::prev() { 617bool PlayListWidget::prev() {
618 if ( mediaPlayerState->playlist() ) { 618 if ( mediaPlayerState->playlist() ) {
619 if ( mediaPlayerState->shuffled() ) { 619 if ( mediaPlayerState->shuffled() ) {
620 const DocLnk *cur = current(); 620 const DocLnk *cur = current();
621 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 621 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
622 for ( int i = 0; i < j; i++ ) { 622 for ( int i = 0; i < j; i++ ) {
623 if ( !d->selectedFiles->next() ) 623 if ( !d->selectedFiles->next() )
624 d->selectedFiles->first(); 624 d->selectedFiles->first();
625 } 625 }
626 if ( cur == current() ) 626 if ( cur == current() )
627 if ( !d->selectedFiles->next() ) 627 if ( !d->selectedFiles->next() )
628 d->selectedFiles->first(); 628 d->selectedFiles->first();
629 return TRUE; 629 return TRUE;
630 } else { 630 } else {
631 if ( !d->selectedFiles->prev() ) { 631 if ( !d->selectedFiles->prev() ) {
632 if ( mediaPlayerState->looping() ) { 632 if ( mediaPlayerState->looping() ) {
633 return d->selectedFiles->last(); 633 return d->selectedFiles->last();
634 } else { 634 } else {
635 return FALSE; 635 return FALSE;
636 } 636 }
637 } 637 }
638 return TRUE; 638 return TRUE;
639 } 639 }
640 } else { 640 } else {
641 return mediaPlayerState->looping(); 641 return mediaPlayerState->looping();
642 } 642 }
643} 643}
644 644
645 645
646bool PlayListWidget::next() { 646bool PlayListWidget::next() {
647 if ( mediaPlayerState->playlist() ) { 647 if ( mediaPlayerState->playlist() ) {
648 if ( mediaPlayerState->shuffled() ) { 648 if ( mediaPlayerState->shuffled() ) {
649 return prev(); 649 return prev();
650 } else { 650 } else {
651 if ( !d->selectedFiles->next() ) { 651 if ( !d->selectedFiles->next() ) {
652 if ( mediaPlayerState->looping() ) { 652 if ( mediaPlayerState->looping() ) {
653 return d->selectedFiles->first(); 653 return d->selectedFiles->first();
654 } else { 654 } else {
655 return FALSE; 655 return FALSE;
656 } 656 }
657 } 657 }
658 return TRUE; 658 return TRUE;
659 } 659 }
660 } else { 660 } else {
661 return mediaPlayerState->looping(); 661 return mediaPlayerState->looping();
662 } 662 }
663} 663}
664 664
665 665
666bool PlayListWidget::first() { 666bool PlayListWidget::first() {
667 if ( mediaPlayerState->playlist() ) 667 if ( mediaPlayerState->playlist() )
668 return d->selectedFiles->first(); 668 return d->selectedFiles->first();
669 else 669 else
670 return mediaPlayerState->looping(); 670 return mediaPlayerState->looping();
671} 671}
672 672
673 673
674bool PlayListWidget::last() { 674bool PlayListWidget::last() {
675 if ( mediaPlayerState->playlist() ) 675 if ( mediaPlayerState->playlist() )
676 return d->selectedFiles->last(); 676 return d->selectedFiles->last();
677 else 677 else
678 return mediaPlayerState->looping(); 678 return mediaPlayerState->looping();
679} 679}
680 680
681 681
682void PlayListWidget::saveList() { 682void PlayListWidget::saveList() {
683 writem3u(); 683 writem3u();
684} 684}
685 685
686void PlayListWidget::loadList( const DocLnk & lnk) { 686void PlayListWidget::loadList( const DocLnk & lnk) {
687 QString name = lnk.name(); 687 QString name = lnk.name();
688 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); 688 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
689 689
690 if( name.length()>0) { 690 if( name.length()>0) {
691 setCaption("OpiePlayer: "+name); 691 setCaption("OpiePlayer: "+name);
692 // qDebug("<<<<<<<<<<<<load list "+ lnk.file()); 692 // qDebug("<<<<<<<<<<<<load list "+ lnk.file());
693 clearList(); 693 clearList();
694 readm3u(lnk.file()); 694 readm3u(lnk.file());
695 tabWidget->setCurrentPage(0); 695 tabWidget->setCurrentPage(0);
696 } 696 }
697} 697}
698 698
699void PlayListWidget::setPlaylist( bool shown ) { 699void PlayListWidget::setPlaylist( bool shown ) {
700 if ( shown ) 700 if ( shown )
701 d->playListFrame->show(); 701 d->playListFrame->show();
702 else 702 else
703 d->playListFrame->hide(); 703 d->playListFrame->hide();
704} 704}
705 705
706void PlayListWidget::setView( char view ) { 706void PlayListWidget::setView( char view ) {
707 if ( view == 'l' ) 707 if ( view == 'l' )
708 showMaximized(); 708 QPEApplication::showWidget( this );
709 else 709 else
710 hide(); 710 hide();
711} 711}
712 712
713void PlayListWidget::addSelected() { 713void PlayListWidget::addSelected() {
714 DocLnk lnk; 714 DocLnk lnk;
715 QString filename; 715 QString filename;
716 switch (tabWidget->currentPageIndex()) { 716 switch (tabWidget->currentPageIndex()) {
717 717
718 case 0: //playlist 718 case 0: //playlist
719 return; 719 return;
720 break; 720 break;
721 case 1: { //audio 721 case 1: { //audio
722 QListViewItemIterator it( audioView ); 722 QListViewItemIterator it( audioView );
723 for ( ; it.current(); ++it ) { 723 for ( ; it.current(); ++it ) {
724 if ( it.current()->isSelected() ) { 724 if ( it.current()->isSelected() ) {
725 filename = it.current()->text(3); 725 filename = it.current()->text(3);
726 lnk.setName( QFileInfo(filename).baseName() ); //sets name 726 lnk.setName( QFileInfo(filename).baseName() ); //sets name
727 lnk.setFile( filename ); //sets file name 727 lnk.setFile( filename ); //sets file name
728 d->selectedFiles->addToSelection( lnk); 728 d->selectedFiles->addToSelection( lnk);
729 } 729 }
730 } 730 }
731 audioView->clearSelection(); 731 audioView->clearSelection();
732 // d->selectedFiles->next(); 732 // d->selectedFiles->next();
733 } 733 }
734 break; 734 break;
735 735
736 case 2: { // video 736 case 2: { // video
737 QListViewItemIterator it( videoView ); 737 QListViewItemIterator it( videoView );
738 for ( ; it.current(); ++it ) { 738 for ( ; it.current(); ++it ) {
739 if ( it.current()->isSelected() ) { 739 if ( it.current()->isSelected() ) {
740 740
741 filename = it.current()->text(3); 741 filename = it.current()->text(3);
742 lnk.setName( QFileInfo(filename).baseName() ); //sets name 742 lnk.setName( QFileInfo(filename).baseName() ); //sets name
743 lnk.setFile( filename ); //sets file name 743 lnk.setFile( filename ); //sets file name
744 d->selectedFiles->addToSelection( lnk); 744 d->selectedFiles->addToSelection( lnk);
745 } 745 }
746 } 746 }
747 videoView->clearSelection(); 747 videoView->clearSelection();
748 } 748 }
749 break; 749 break;
750 }; 750 };
751 // tabWidget->setCurrentPage(0); 751 // tabWidget->setCurrentPage(0);
752 writeCurrentM3u(); 752 writeCurrentM3u();
753 753
754} 754}
755 755
756void PlayListWidget::removeSelected() { 756void PlayListWidget::removeSelected() {
757 d->selectedFiles->removeSelected( ); 757 d->selectedFiles->removeSelected( );
758} 758}
759 759
760void PlayListWidget::playIt( QListViewItem *) { 760void PlayListWidget::playIt( QListViewItem *) {
761 // d->setDocumentUsed = FALSE; 761 // d->setDocumentUsed = FALSE;
762 // mediaPlayerState->curPosition =0; 762 // mediaPlayerState->curPosition =0;
763 // mediaPlayerState->setPlaying(FALSE); 763 // mediaPlayerState->setPlaying(FALSE);
764 mediaPlayerState->setPlaying(TRUE); 764 mediaPlayerState->setPlaying(TRUE);
765 d->selectedFiles->unSelect(); 765 d->selectedFiles->unSelect();
766} 766}
767 767
768void PlayListWidget::addToSelection( QListViewItem *it) { 768void PlayListWidget::addToSelection( QListViewItem *it) {
769 d->setDocumentUsed = FALSE; 769 d->setDocumentUsed = FALSE;
770 770
771 if(it) { 771 if(it) {
772 switch ( tabWidget->currentPageIndex()) { 772 switch ( tabWidget->currentPageIndex()) {
773 case 0: //playlist 773 case 0: //playlist
774 return; 774 return;
775 break; 775 break;
776 }; 776 };
777 // case 1: { 777 // case 1: {
778 DocLnk lnk; 778 DocLnk lnk;
779 QString filename; 779 QString filename;
780 780
781 filename=it->text(3); 781 filename=it->text(3);
782 lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name 782 lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name
783 lnk.setFile( filename ); //sets file name 783 lnk.setFile( filename ); //sets file name
784 d->selectedFiles->addToSelection( lnk); 784 d->selectedFiles->addToSelection( lnk);
785 785
786 if(tabWidget->currentPageIndex() == 0) 786 if(tabWidget->currentPageIndex() == 0)
787 writeCurrentM3u(); 787 writeCurrentM3u();
788 // tabWidget->setCurrentPage(0); 788 // tabWidget->setCurrentPage(0);
789 789
790 } 790 }
791} 791}
792 792
793void PlayListWidget::tabChanged(QWidget *) { 793void PlayListWidget::tabChanged(QWidget *) {
794 794
795 switch ( tabWidget->currentPageIndex()) { 795 switch ( tabWidget->currentPageIndex()) {
796 case 0: 796 case 0:
797 { 797 {
798 if( !tbDeletePlaylist->isHidden()) 798 if( !tbDeletePlaylist->isHidden())
799 tbDeletePlaylist->hide(); 799 tbDeletePlaylist->hide();
800 d->tbRemoveFromList->setEnabled(TRUE); 800 d->tbRemoveFromList->setEnabled(TRUE);
801 d->tbAddToList->setEnabled(FALSE); 801 d->tbAddToList->setEnabled(FALSE);
802 } 802 }
803 break; 803 break;
804 case 1: 804 case 1:
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index d9a9478..5273ad3 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -327,193 +327,193 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
327 int y = event->pos().y() - yoff; 327 int y = event->pos().y() - yoff;
328 328
329 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() 329 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
330 && y < imgButtonMask->height() 330 && y < imgButtonMask->height()
331 && imgButtonMask->pixelIndex( x, y ) == i + 1 ); 331 && imgButtonMask->pixelIndex( x, y ) == i + 1 );
332 332
333 if ( isOnButton && !videoButtons[i].isHeld ) { 333 if ( isOnButton && !videoButtons[i].isHeld ) {
334 videoButtons[i].isHeld = TRUE; 334 videoButtons[i].isHeld = TRUE;
335 toggleButton(i); 335 toggleButton(i);
336 336
337 switch (i) { 337 switch (i) {
338 case VideoVolUp: 338 case VideoVolUp:
339 emit moreClicked(); 339 emit moreClicked();
340 return; 340 return;
341 case VideoVolDown: 341 case VideoVolDown:
342 emit lessClicked(); 342 emit lessClicked();
343 return; 343 return;
344 } 344 }
345 } else if ( !isOnButton && videoButtons[i].isHeld ) { 345 } else if ( !isOnButton && videoButtons[i].isHeld ) {
346 videoButtons[i].isHeld = FALSE; 346 videoButtons[i].isHeld = FALSE;
347 toggleButton(i); 347 toggleButton(i);
348 } 348 }
349 } else { 349 } else {
350 350
351 if ( videoButtons[i].isHeld ) { 351 if ( videoButtons[i].isHeld ) {
352 videoButtons[i].isHeld = FALSE; 352 videoButtons[i].isHeld = FALSE;
353 if ( !videoButtons[i].isToggle ) { 353 if ( !videoButtons[i].isToggle ) {
354 setToggleButton( i, FALSE ); 354 setToggleButton( i, FALSE );
355 } 355 }
356 356
357 switch(i) { 357 switch(i) {
358 358
359 case VideoPlay: { 359 case VideoPlay: {
360 // qDebug("play"); 360 // qDebug("play");
361 if( !mediaPlayerState->playing()) { 361 if( !mediaPlayerState->playing()) {
362 mediaPlayerState->setPlaying( true); 362 mediaPlayerState->setPlaying( true);
363 setToggleButton( i-1, false ); 363 setToggleButton( i-1, false );
364 setToggleButton( i, false ); 364 setToggleButton( i, false );
365 return; 365 return;
366 } 366 }
367 if( mediaPlayerState->isPaused ) { 367 if( mediaPlayerState->isPaused ) {
368 // qDebug("isPaused"); 368 // qDebug("isPaused");
369 setToggleButton( i, FALSE ); 369 setToggleButton( i, FALSE );
370 mediaPlayerState->setPaused( FALSE ); 370 mediaPlayerState->setPaused( FALSE );
371 return; 371 return;
372 } else if( !mediaPlayerState->isPaused ) { 372 } else if( !mediaPlayerState->isPaused ) {
373 // qDebug("is not paused"); 373 // qDebug("is not paused");
374 setToggleButton( i, TRUE ); 374 setToggleButton( i, TRUE );
375 mediaPlayerState->setPaused( TRUE ); 375 mediaPlayerState->setPaused( TRUE );
376 return; 376 return;
377 } else { 377 } else {
378 return; 378 return;
379 } 379 }
380 } 380 }
381 381
382 case VideoStop: mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return; 382 case VideoStop: mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return;
383 case VideoNext: mediaPlayerState->setNext(); return; 383 case VideoNext: mediaPlayerState->setNext(); return;
384 case VideoPrevious: mediaPlayerState->setPrev(); return; 384 case VideoPrevious: mediaPlayerState->setPrev(); return;
385 case VideoVolUp: emit moreReleased(); return; 385 case VideoVolUp: emit moreReleased(); return;
386 case VideoVolDown: emit lessReleased(); return; 386 case VideoVolDown: emit lessReleased(); return;
387 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; 387 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
388 } 388 }
389 } 389 }
390 } 390 }
391 } 391 }
392} 392}
393 393
394 394
395void VideoWidget::mousePressEvent( QMouseEvent *event ) { 395void VideoWidget::mousePressEvent( QMouseEvent *event ) {
396 mouseMoveEvent( event ); 396 mouseMoveEvent( event );
397} 397}
398 398
399 399
400void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 400void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
401 if ( mediaPlayerState->fullscreen() ) 401 if ( mediaPlayerState->fullscreen() )
402 { 402 {
403 mediaPlayerState->setFullscreen( FALSE ); 403 mediaPlayerState->setFullscreen( FALSE );
404 makeVisible(); 404 makeVisible();
405 } 405 }
406 mouseMoveEvent( event ); 406 mouseMoveEvent( event );
407// } 407// }
408} 408}
409 409
410 410
411void VideoWidget::makeVisible() { 411void VideoWidget::makeVisible() {
412 if ( mediaPlayerState->fullscreen() ) 412 if ( mediaPlayerState->fullscreen() )
413 { 413 {
414 setBackgroundMode( QWidget::NoBackground ); 414 setBackgroundMode( QWidget::NoBackground );
415 showFullScreen(); 415 showFullScreen();
416 resize( qApp->desktop()->size() ); 416 resize( qApp->desktop()->size() );
417 slider->hide(); 417 slider->hide();
418 } 418 }
419 else 419 else
420 { 420 {
421 setBackgroundPixmap( *pixBg ); 421 setBackgroundPixmap( *pixBg );
422 showNormal(); 422 showNormal();
423 showMaximized(); 423 QPEApplication::showWidget( this );
424 slider->show(); 424 slider->show();
425 } 425 }
426} 426}
427 427
428 428
429void VideoWidget::paintEvent( QPaintEvent * pe) { 429void VideoWidget::paintEvent( QPaintEvent * pe) {
430 QPainter p( this ); 430 QPainter p( this );
431 431
432 if ( mediaPlayerState->fullscreen() ) { 432 if ( mediaPlayerState->fullscreen() ) {
433 // Clear the background 433 // Clear the background
434 p.setBrush( QBrush( Qt::black ) ); 434 p.setBrush( QBrush( Qt::black ) );
435 p.drawRect( rect() ); 435 p.drawRect( rect() );
436 } else { 436 } else {
437 if ( !pe->erased() ) { 437 if ( !pe->erased() ) {
438 // Combine with background and double buffer 438 // Combine with background and double buffer
439 QPixmap pix( pe->rect().size() ); 439 QPixmap pix( pe->rect().size() );
440 QPainter p( &pix ); 440 QPainter p( &pix );
441 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 441 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
442 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 442 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
443 for ( int i = 0; i < numVButtons; i++ ) { 443 for ( int i = 0; i < numVButtons; i++ ) {
444 paintButton( &p, i ); 444 paintButton( &p, i );
445 } 445 }
446 QPainter p2( this ); 446 QPainter p2( this );
447 p2.drawPixmap( pe->rect().topLeft(), pix ); 447 p2.drawPixmap( pe->rect().topLeft(), pix );
448 } else { 448 } else {
449 QPainter p( this ); 449 QPainter p( this );
450 for ( int i = 0; i < numVButtons; i++ ) 450 for ( int i = 0; i < numVButtons; i++ )
451 paintButton( &p, i ); 451 paintButton( &p, i );
452 } 452 }
453 slider->repaint( TRUE ); 453 slider->repaint( TRUE );
454 } 454 }
455} 455}
456 456
457 457
458void VideoWidget::closeEvent( QCloseEvent* ) { 458void VideoWidget::closeEvent( QCloseEvent* ) {
459 mediaPlayerState->setList(); 459 mediaPlayerState->setList();
460} 460}
461 461
462 462
463bool VideoWidget::playVideo() { 463bool VideoWidget::playVideo() {
464 bool result = FALSE; 464 bool result = FALSE;
465// qDebug("<<<<<<<<<<<<<<<< play video"); 465// qDebug("<<<<<<<<<<<<<<<< play video");
466 int stream = 0; 466 int stream = 0;
467 467
468 int sw = mediaPlayerState->curDecoder()->videoWidth( stream ); 468 int sw = mediaPlayerState->curDecoder()->videoWidth( stream );
469 int sh = mediaPlayerState->curDecoder()->videoHeight( stream ); 469 int sh = mediaPlayerState->curDecoder()->videoHeight( stream );
470 int dd = QPixmap::defaultDepth(); 470 int dd = QPixmap::defaultDepth();
471 int w = height(); 471 int w = height();
472 int h = width(); 472 int h = width();
473 473
474 ColorFormat format = (dd == 16) ? RGB565 : BGRA8888; 474 ColorFormat format = (dd == 16) ? RGB565 : BGRA8888;
475 475
476 if ( mediaPlayerState->fullscreen() ) 476 if ( mediaPlayerState->fullscreen() )
477 { 477 {
478#ifdef USE_DIRECT_PAINTER 478#ifdef USE_DIRECT_PAINTER
479 QDirectPainter p(this); 479 QDirectPainter p(this);
480 480
481 if ( ( qt_screen->transformOrientation() == 3 ) && 481 if ( ( qt_screen->transformOrientation() == 3 ) &&
482 ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) ) 482 ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) )
483 { 483 {
484 484
485 w = 320; 485 w = 320;
486 h = 240; 486 h = 240;
487 487
488 if ( mediaPlayerState->scaled() ) 488 if ( mediaPlayerState->scaled() )
489 { 489 {
490 // maintain aspect ratio 490 // maintain aspect ratio
491 if ( w * sh > sw * h ) 491 if ( w * sh > sw * h )
492 w = sw * h / sh; 492 w = sw * h / sh;
493 else 493 else
494 h = sh * w / sw; 494 h = sh * w / sw;
495 } 495 }
496 else 496 else
497 { 497 {
498 w = sw; 498 w = sw;
499 h = sh; 499 h = sh;
500 } 500 }
501 501
502 w--; // we can't allow libmpeg to overwrite. 502 w--; // we can't allow libmpeg to overwrite.
503 QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) ); 503 QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) );
504 504
505 int ox = roff.x() - height() + 2 + (height() - w) / 2; 505 int ox = roff.x() - height() + 2 + (height() - w) / 2;
506 int oy = roff.y() + (width() - h) / 2; 506 int oy = roff.y() + (width() - h) / 2;
507 int sx = 0, sy = 0; 507 int sx = 0, sy = 0;
508 508
509 uchar* fp = p.frameBuffer() + p.lineStep() * oy; 509 uchar* fp = p.frameBuffer() + p.lineStep() * oy;
510 fp += dd * ox / 8; 510 fp += dd * ox / 8;
511 uchar **jt = new uchar*[h]; 511 uchar **jt = new uchar*[h];
512 512
513 for ( int i = h; i; i-- ) 513 for ( int i = h; i; i-- )
514 { 514 {
515 jt[h - i] = fp; 515 jt[h - i] = fp;
516 fp += p.lineStep(); 516 fp += p.lineStep();
517 } 517 }
518 518
519 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0; 519 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0;
diff --git a/core/obex/obexhandler.cpp b/core/obex/obexhandler.cpp
index 5aaf63c..c237555 100644
--- a/core/obex/obexhandler.cpp
+++ b/core/obex/obexhandler.cpp
@@ -1,67 +1,68 @@
1#include <qcopchannel_qws.h> 1#include <qcopchannel_qws.h>
2 2
3#include <qpe/qcopenvelope_qws.h> 3#include <qpe/qcopenvelope_qws.h>
4#include <qpe/qpeapplication.h>
4 5
5#include "obexsend.h" 6#include "obexsend.h"
6#include "receiver.h" 7#include "receiver.h"
7#include "obexhandler.h" 8#include "obexhandler.h"
8 9
9using namespace OpieObex; 10using namespace OpieObex;
10 11
11/* TRANSLATOR OpieObex::ObexHandler */ 12/* TRANSLATOR OpieObex::ObexHandler */
12 13
13ObexHandler::ObexHandler() { 14ObexHandler::ObexHandler() {
14 m_wasRec = false; 15 m_wasRec = false;
15 m_sender = 0l; 16 m_sender = 0l;
16 m_receiver = 0l; 17 m_receiver = 0l;
17 QCopChannel* chan = new QCopChannel("QPE/Obex"); 18 QCopChannel* chan = new QCopChannel("QPE/Obex");
18 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ), 19 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ),
19 this, SLOT(irdaMessage(const QCString&, const QByteArray& ) ) ); 20 this, SLOT(irdaMessage(const QCString&, const QByteArray& ) ) );
20} 21}
21ObexHandler::~ObexHandler() { 22ObexHandler::~ObexHandler() {
22 delete m_sender; 23 delete m_sender;
23 delete m_receiver; 24 delete m_receiver;
24} 25}
25void ObexHandler::doSend(const QString& str, const QString& desc) { 26void ObexHandler::doSend(const QString& str, const QString& desc) {
26 delete m_sender; 27 delete m_sender;
27 m_sender = new SendWidget; 28 m_sender = new SendWidget;
28 m_sender->raise(); 29 m_sender->raise();
29 m_sender->showMaximized(); 30 QPEApplication::showWidget( m_sender );
30 connect(m_sender, SIGNAL(done() ), 31 connect(m_sender, SIGNAL(done() ),
31 this, SLOT(slotSent() ) ); 32 this, SLOT(slotSent() ) );
32 m_sender->send( str, desc ); 33 m_sender->send( str, desc );
33} 34}
34void ObexHandler::doReceive(bool b) { 35void ObexHandler::doReceive(bool b) {
35 if (m_receiver && b ) return; // we should enable receiver and it is on 36 if (m_receiver && b ) return; // we should enable receiver and it is on
36 else if (!m_receiver && !b ) return; // we should disbale receiver and it is off 37 else if (!m_receiver && !b ) return; // we should disbale receiver and it is off
37 else if (m_receiver && !b ) { 38 else if (m_receiver && !b ) {
38 delete m_receiver; 39 delete m_receiver;
39 m_receiver=0; 40 m_receiver=0;
40 }else if (!m_receiver && b ) { 41 }else if (!m_receiver && b ) {
41 m_receiver= new Receiver; 42 m_receiver= new Receiver;
42 } 43 }
43} 44}
44void ObexHandler::slotSent() { 45void ObexHandler::slotSent() {
45 QString file = m_sender->file(); 46 QString file = m_sender->file();
46 delete m_sender; 47 delete m_sender;
47 m_sender = 0; 48 m_sender = 0;
48 QCopEnvelope e ("QPE/Obex", "done(QString)" ); 49 QCopEnvelope e ("QPE/Obex", "done(QString)" );
49 e << file; 50 e << file;
50 doReceive(m_wasRec ); 51 doReceive(m_wasRec );
51 m_wasRec = false; 52 m_wasRec = false;
52} 53}
53void ObexHandler::irdaMessage( const QCString& msg, const QByteArray& data) { 54void ObexHandler::irdaMessage( const QCString& msg, const QByteArray& data) {
54 QDataStream stream( data, IO_ReadOnly ); 55 QDataStream stream( data, IO_ReadOnly );
55 if ( msg == "send(QString,QString,QString)" ) { 56 if ( msg == "send(QString,QString,QString)" ) {
56 QString name, desc; 57 QString name, desc;
57 stream >> desc; 58 stream >> desc;
58 stream >> name; 59 stream >> name;
59 m_wasRec = (m_receiver != 0 ); 60 m_wasRec = (m_receiver != 0 );
60 doReceive( false ); 61 doReceive( false );
61 doSend(name, desc); 62 doSend(name, desc);
62 }else if (msg == "receive(int)") { 63 }else if (msg == "receive(int)") {
63 int rec; 64 int rec;
64 stream >> rec; 65 stream >> rec;
65 doReceive(rec); 66 doReceive(rec);
66 } 67 }
67} 68}
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 139c91b..c83a5df 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,181 +1,181 @@
1/* 1/*
2 * today.cpp 2 * today.cpp
3 * 3 *
4 * copyright : (c) 2002,2003 by Maximilian Reiß 4 * copyright : (c) 2002,2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17 17
18 18
19#define QTOPIA_INTERNAL_LANGLIST 19#define QTOPIA_INTERNAL_LANGLIST
20 20
21#include "today.h" 21#include "today.h"
22 22
23#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/global.h> 26#include <qpe/global.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/contact.h> 28#include <qpe/contact.h>
29 29
30#include <qdir.h> 30#include <qdir.h>
31#include <qtimer.h> 31#include <qtimer.h>
32#include <qwhatsthis.h> 32#include <qwhatsthis.h>
33 33
34struct TodayPlugin { 34struct TodayPlugin {
35 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} 35 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {}
36 QLibrary *library; 36 QLibrary *library;
37 QInterfacePtr<TodayPluginInterface> iface; 37 QInterfacePtr<TodayPluginInterface> iface;
38 TodayPluginObject *guiPart; 38 TodayPluginObject *guiPart;
39 QWidget *guiBox; 39 QWidget *guiBox;
40 QString name; 40 QString name;
41 bool active; 41 bool active;
42 bool excludeRefresh; 42 bool excludeRefresh;
43 int pos; 43 int pos;
44}; 44};
45 45
46static QValueList<TodayPlugin> pluginList; 46static QValueList<TodayPlugin> pluginList;
47 47
48static QMap<QString, TodayPlugin> tempList; 48static QMap<QString, TodayPlugin> tempList;
49 49
50Today::Today( QWidget* parent, const char* name, WFlags fl ) 50Today::Today( QWidget* parent, const char* name, WFlags fl )
51 : TodayBase( parent, name, fl ) { 51 : TodayBase( parent, name, fl ) {
52 52
53 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); 53 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) );
54 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); 54 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) );
55 55
56#if defined(Q_WS_QWS) 56#if defined(Q_WS_QWS)
57#if !defined(QT_NO_COP) 57#if !defined(QT_NO_COP)
58 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); 58 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this );
59 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 59 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
60 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 60 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
61#endif 61#endif
62#endif 62#endif
63 63
64 setOwnerField(); 64 setOwnerField();
65 m_refreshTimer = new QTimer( this ); 65 m_refreshTimer = new QTimer( this );
66 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 66 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
67 m_refreshTimer->start( 15000 ); 67 m_refreshTimer->start( 15000 );
68 m_big_box = 0L; 68 m_big_box = 0L;
69 69
70 70
71 layout = new QVBoxLayout( this ); 71 layout = new QVBoxLayout( this );
72 layout->addWidget( Frame ); 72 layout->addWidget( Frame );
73 layout->addWidget( OwnerField ); 73 layout->addWidget( OwnerField );
74 74
75 m_sv = new QScrollView( this ); 75 m_sv = new QScrollView( this );
76 m_sv->setResizePolicy( QScrollView::AutoOneFit ); 76 m_sv->setResizePolicy( QScrollView::AutoOneFit );
77 m_sv->setHScrollBarMode( QScrollView::AlwaysOff ); 77 m_sv->setHScrollBarMode( QScrollView::AlwaysOff );
78 m_sv->setFrameShape( QFrame::NoFrame ); 78 m_sv->setFrameShape( QFrame::NoFrame );
79 79
80 layout->addWidget( m_sv ); 80 layout->addWidget( m_sv );
81 layout->setStretchFactor( m_sv,4 ); 81 layout->setStretchFactor( m_sv,4 );
82 82
83 qApp->processEvents(); 83 qApp->processEvents();
84 loadPlugins(); 84 loadPlugins();
85 showMaximized(); 85 QPEApplication::showWidget( this );
86} 86}
87 87
88/** 88/**
89 * Qcop receive method. 89 * Qcop receive method.
90 */ 90 */
91void Today::channelReceived( const QCString &msg, const QByteArray & data ) { 91void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
92 QDataStream stream( data, IO_ReadOnly ); 92 QDataStream stream( data, IO_ReadOnly );
93 if ( msg == "message(QString)" ) { 93 if ( msg == "message(QString)" ) {
94 QString message; 94 QString message;
95 stream >> message; 95 stream >> message;
96 setOwnerField( message ); 96 setOwnerField( message );
97 } 97 }
98} 98}
99 99
100void Today::setRefreshTimer( int interval ) { 100void Today::setRefreshTimer( int interval ) {
101 101
102 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 102 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
103 103
104 // 0 is "never" case 104 // 0 is "never" case
105 if ( !interval == 0 ) { 105 if ( !interval == 0 ) {
106 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 106 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
107 m_refreshTimer->changeInterval( interval ); 107 m_refreshTimer->changeInterval( interval );
108 } 108 }
109} 109}
110 110
111 111
112/** 112/**
113 * Initialises the owner field with the default value, the username 113 * Initialises the owner field with the default value, the username
114 */ 114 */
115void Today::setOwnerField() { 115void Today::setOwnerField() {
116 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); 116 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" );
117 if ( QFile::exists( file ) ) { 117 if ( QFile::exists( file ) ) {
118 Contact cont = Contact::readVCard( file )[0]; 118 Contact cont = Contact::readVCard( file )[0];
119 QString returnString = cont.fullName(); 119 QString returnString = cont.fullName();
120 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); 120 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" );
121 } else { 121 } else {
122 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); 122 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" );
123 } 123 }
124} 124}
125 125
126/** 126/**
127 * Set the owner field with a given QString, for example per qcop. 127 * Set the owner field with a given QString, for example per qcop.
128 */ 128 */
129void Today::setOwnerField( QString &message ) { 129void Today::setOwnerField( QString &message ) {
130 if ( !message.isEmpty() ) { 130 if ( !message.isEmpty() ) {
131 OwnerField->setText( "<b>" + message + "</b>" ); 131 OwnerField->setText( "<b>" + message + "</b>" );
132 } 132 }
133} 133}
134 134
135/** 135/**
136 * Init stuff needed for today. Reads the config file. 136 * Init stuff needed for today. Reads the config file.
137 */ 137 */
138void Today::init() { 138void Today::init() {
139 // read config 139 // read config
140 Config cfg( "today" ); 140 Config cfg( "today" );
141 141
142 cfg.setGroup( "Plugins" ); 142 cfg.setGroup( "Plugins" );
143 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 143 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
144 m_allApplets = cfg.readListEntry( "AllApplets", ',' ); 144 m_allApplets = cfg.readListEntry( "AllApplets", ',' );
145 145
146 cfg.setGroup( "General" ); 146 cfg.setGroup( "General" );
147 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 147 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
148 m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); 148 m_hideBanner = cfg.readNumEntry( "HideBanner", 0 );
149 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); 149 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
150 150
151 // set the date in top label 151 // set the date in top label
152 QDate date = QDate::currentDate(); 152 QDate date = QDate::currentDate();
153 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); 153 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) );
154 154
155 if ( m_hideBanner ) { 155 if ( m_hideBanner ) {
156 Opiezilla->hide(); 156 Opiezilla->hide();
157 TodayLabel->hide(); 157 TodayLabel->hide();
158 } else { 158 } else {
159 Opiezilla->show(); 159 Opiezilla->show();
160 TodayLabel->show(); 160 TodayLabel->show();
161 } 161 }
162 162
163 if ( m_big_box ) { 163 if ( m_big_box ) {
164 delete m_big_box; 164 delete m_big_box;
165 } 165 }
166 166
167 m_big_box = new QWidget( m_sv->viewport() ); 167 m_big_box = new QWidget( m_sv->viewport() );
168 m_sv->addChild( m_big_box ); 168 m_sv->addChild( m_big_box );
169 m_bblayout = new QVBoxLayout ( m_big_box ); 169 m_bblayout = new QVBoxLayout ( m_big_box );
170} 170}
171 171
172/** 172/**
173 * Load the plugins 173 * Load the plugins
174 */ 174 */
175void Today::loadPlugins() { 175void Today::loadPlugins() {
176 176
177 init(); 177 init();
178 178
179 QValueList<TodayPlugin>::Iterator tit; 179 QValueList<TodayPlugin>::Iterator tit;
180 if ( !pluginList.isEmpty() ) { 180 if ( !pluginList.isEmpty() ) {
181 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { 181 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) {
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp
index e71c5b0..9ced0d8 100644
--- a/core/pim/today/todayconfig.cpp
+++ b/core/pim/today/todayconfig.cpp
@@ -1,186 +1,187 @@
1/* 1/*
2 * todayconfig.cpp 2 * todayconfig.cpp
3 * 3 *
4 * copyright : (c) 2002, 2003 by Maximilian Reiß 4 * copyright : (c) 2002, 2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#include "todayconfig.h" 17#include "todayconfig.h"
18 18
19#include <qpe/config.h> 19#include <qpe/config.h>
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21#include <qpe/qcopenvelope_qws.h> 21#include <qpe/qcopenvelope_qws.h>
22#include <qpe/qpeapplication.h>
22 23
23#include <qcheckbox.h> 24#include <qcheckbox.h>
24#include <qlabel.h> 25#include <qlabel.h>
25#include <qspinbox.h> 26#include <qspinbox.h>
26#include <qlayout.h> 27#include <qlayout.h>
27#include <qheader.h> 28#include <qheader.h>
28#include <qvbox.h> 29#include <qvbox.h>
29#include <qtoolbutton.h> 30#include <qtoolbutton.h>
30#include <qwhatsthis.h> 31#include <qwhatsthis.h>
31 32
32class ToolButton : public QToolButton { 33class ToolButton : public QToolButton {
33 34
34public: 35public:
35 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 36 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
36 : QToolButton( parent, name ) { 37 : QToolButton( parent, name ) {
37 setPixmap( Resource::loadPixmap( icon ) ); 38 setPixmap( Resource::loadPixmap( icon ) );
38 setAutoRaise( TRUE ); 39 setAutoRaise( TRUE );
39 setFocusPolicy( QWidget::NoFocus ); 40 setFocusPolicy( QWidget::NoFocus );
40 setToggleButton( t ); 41 setToggleButton( t );
41 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 42 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
42 } 43 }
43}; 44};
44 45
45 46
46/** 47/**
47 * The class has currently quite some duplicate code. 48 * The class has currently quite some duplicate code.
48 * By that way it would be real easy to have it as seperate app in settings tab 49 * By that way it would be real easy to have it as seperate app in settings tab
49 * 50 *
50 */ 51 */
51TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) 52TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal )
52 : QDialog( parent, name, modal, WStyle_ContextHelp ) { 53 : QDialog( parent, name, modal, WStyle_ContextHelp ) {
53 54
54 setCaption( tr( "Today Config" ) ); 55 setCaption( tr( "Today Config" ) );
55 56
56 QVBoxLayout *layout = new QVBoxLayout( this ); 57 QVBoxLayout *layout = new QVBoxLayout( this );
57 TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 58 TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
58 layout->addWidget( TabWidget3 ); 59 layout->addWidget( TabWidget3 );
59 60
60 tab_2 = new QWidget( TabWidget3, "tab_2" ); 61 tab_2 = new QWidget( TabWidget3, "tab_2" );
61 QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); 62 QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 );
62 QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); 63 QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 );
63 tab2Layout->addWidget( l ); 64 tab2Layout->addWidget( l );
64 QHBox *hbox1 = new QHBox( tab_2 ); 65 QHBox *hbox1 = new QHBox( tab_2 );
65 m_appletListView = new QListView( hbox1 ); 66 m_appletListView = new QListView( hbox1 );
66 m_appletListView->addColumn( "PluginList" ); 67 m_appletListView->addColumn( "PluginList" );
67 m_appletListView->header()->hide(); 68 m_appletListView->header()->hide();
68 m_appletListView->setSorting( -1 ); 69 m_appletListView->setSorting( -1 );
69 QWhatsThis::add( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the appearance order" ) ); 70 QWhatsThis::add( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the appearance order" ) );
70 QVBox *vbox1 = new QVBox( hbox1 ); 71 QVBox *vbox1 = new QVBox( hbox1 );
71 new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); 72 new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) );
72 new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); 73 new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) );
73 tab2Layout->addWidget( hbox1 ); 74 tab2Layout->addWidget( hbox1 );
74 TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); 75 TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) );
75 76
76 // Misc tab 77 // Misc tab
77 tab_3 = new QWidget( TabWidget3, "tab_3" ); 78 tab_3 = new QWidget( TabWidget3, "tab_3" );
78 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); 79 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 );
79 80
80 m_guiMisc = new TodayConfigMiscBase( tab_3 ); 81 m_guiMisc = new TodayConfigMiscBase( tab_3 );
81 82
82 tab3Layout->addWidget( m_guiMisc ); 83 tab3Layout->addWidget( m_guiMisc );
83 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); 84 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) );
84 85
85 m_applets_changed = false; 86 m_applets_changed = false;
86 87
87 connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); 88 connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) );
88 89
89 readConfig(); 90 readConfig();
90 showMaximized(); 91 QPEApplication::showDialog( this );
91} 92}
92 93
93 94
94/** 95/**
95 * Autostart, uses the new (opie only) autostart method in the launcher code. 96 * Autostart, uses the new (opie only) autostart method in the launcher code.
96 * If registered against that today ist started on each resume. 97 * If registered against that today ist started on each resume.
97 */ 98 */
98void TodayConfig::setAutoStart() { 99void TodayConfig::setAutoStart() {
99 Config cfg( "today" ); 100 Config cfg( "today" );
100 cfg.setGroup( "Autostart" ); 101 cfg.setGroup( "Autostart" );
101 if ( m_autoStart ) { 102 if ( m_autoStart ) {
102 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); 103 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" );
103 e << QString( "add" ); 104 e << QString( "add" );
104 e << QString( "today" ); 105 e << QString( "today" );
105 e << QString( "%1" ).arg( m_autoStartTimer ); 106 e << QString( "%1" ).arg( m_autoStartTimer );
106 } else { 107 } else {
107 QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); 108 QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" );
108 e << QString( "remove" ); 109 e << QString( "remove" );
109 e << QString( "today" ); 110 e << QString( "today" );
110 } 111 }
111} 112}
112 113
113/** 114/**
114 * Read the config part 115 * Read the config part
115 */ 116 */
116void TodayConfig::readConfig() { 117void TodayConfig::readConfig() {
117 Config cfg( "today" ); 118 Config cfg( "today" );
118 cfg.setGroup( "Autostart" ); 119 cfg.setGroup( "Autostart" );
119 m_autoStart = cfg.readNumEntry( "autostart", 1 ); 120 m_autoStart = cfg.readNumEntry( "autostart", 1 );
120 m_guiMisc->CheckBoxAuto->setChecked( m_autoStart ); 121 m_guiMisc->CheckBoxAuto->setChecked( m_autoStart );
121 m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); 122 m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 );
122 m_guiMisc->SpinBoxTime->setValue( m_autoStartTimer ); 123 m_guiMisc->SpinBoxTime->setValue( m_autoStartTimer );
123 124
124 cfg.setGroup( "General" ); 125 cfg.setGroup( "General" );
125 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 126 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
126 m_guiMisc->SpinBoxIconSize->setValue( m_iconSize ); 127 m_guiMisc->SpinBoxIconSize->setValue( m_iconSize );
127 m_guiMisc->SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 ); 128 m_guiMisc->SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 );
128 m_guiMisc->CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) ); 129 m_guiMisc->CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) );
129 130
130 131
131 cfg.setGroup( "Plugins" ); 132 cfg.setGroup( "Plugins" );
132 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 133 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
133} 134}
134 135
135/** 136/**
136 * Write the config part 137 * Write the config part
137 */ 138 */
138void TodayConfig::writeConfig() { 139void TodayConfig::writeConfig() {
139 Config cfg( "today" ); 140 Config cfg( "today" );
140 cfg.setGroup( "Plugins" ); 141 cfg.setGroup( "Plugins" );
141 if ( m_applets_changed ) { 142 if ( m_applets_changed ) {
142 QStringList exclude; 143 QStringList exclude;
143 QStringList include; 144 QStringList include;
144 QStringList all_applets; 145 QStringList all_applets;
145 146
146 QListViewItemIterator list_it( m_appletListView ); 147 QListViewItemIterator list_it( m_appletListView );
147 148
148 // this makes sure the names get saved in the order selected 149 // this makes sure the names get saved in the order selected
149 for ( ; list_it.current(); ++list_it ) { 150 for ( ; list_it.current(); ++list_it ) {
150 QMap <QString, QCheckListItem *>::Iterator it; 151 QMap <QString, QCheckListItem *>::Iterator it;
151 for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { 152 for ( it = m_applets.begin(); it != m_applets. end (); ++it ) {
152 if ( list_it.current() == (*it) && !(*it)-> isOn () ) { 153 if ( list_it.current() == (*it) && !(*it)-> isOn () ) {
153 exclude << it.key(); 154 exclude << it.key();
154 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ 155 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){
155 include << it.key(); 156 include << it.key();
156 } 157 }
157 if ( list_it.current() == (*it) ) { 158 if ( list_it.current() == (*it) ) {
158 all_applets << it.key(); 159 all_applets << it.key();
159 } 160 }
160 } 161 }
161 } 162 }
162 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 163 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
163 cfg.writeEntry( "IncludeApplets", include, ',' ); 164 cfg.writeEntry( "IncludeApplets", include, ',' );
164 cfg.writeEntry( "AllApplets", all_applets, ',' ); 165 cfg.writeEntry( "AllApplets", all_applets, ',' );
165 } 166 }
166 167
167 cfg.setGroup( "Autostart" ); 168 cfg.setGroup( "Autostart" );
168 m_autoStart = m_guiMisc->CheckBoxAuto->isChecked(); 169 m_autoStart = m_guiMisc->CheckBoxAuto->isChecked();
169 cfg.writeEntry( "autostart", m_autoStart ); 170 cfg.writeEntry( "autostart", m_autoStart );
170 m_autoStartTimer = m_guiMisc->SpinBoxTime->value(); 171 m_autoStartTimer = m_guiMisc->SpinBoxTime->value();
171 cfg.writeEntry( "autostartdelay", m_autoStartTimer ); 172 cfg.writeEntry( "autostartdelay", m_autoStartTimer );
172 m_iconSize = m_guiMisc->SpinBoxIconSize->value(); 173 m_iconSize = m_guiMisc->SpinBoxIconSize->value();
173 174
174 cfg.setGroup( "General" ); 175 cfg.setGroup( "General" );
175 cfg.writeEntry( "IconSize", m_iconSize ); 176 cfg.writeEntry( "IconSize", m_iconSize );
176 cfg.writeEntry( "HideBanner", m_guiMisc->CheckBoxHide->isChecked() ); 177 cfg.writeEntry( "HideBanner", m_guiMisc->CheckBoxHide->isChecked() );
177 cfg.writeEntry( "checkinterval", m_guiMisc->SpinRefresh->value()*1000 ); 178 cfg.writeEntry( "checkinterval", m_guiMisc->SpinRefresh->value()*1000 );
178 179
179 // set autostart settings 180 // set autostart settings
180 setAutoStart(); 181 setAutoStart();
181} 182}
182 183
183 184
184void TodayConfig::moveSelectedUp() { 185void TodayConfig::moveSelectedUp() {
185 QListViewItem *item = m_appletListView->selectedItem(); 186 QListViewItem *item = m_appletListView->selectedItem();
186 if ( item && item->itemAbove() ) { 187 if ( item && item->itemAbove() ) {
diff --git a/core/settings/button/buttonsettings.cpp b/core/settings/button/buttonsettings.cpp
index 523e295..141e0f6 100644
--- a/core/settings/button/buttonsettings.cpp
+++ b/core/settings/button/buttonsettings.cpp
@@ -121,135 +121,134 @@ ButtonSettings::ButtonSettings ( QWidget *parent , const char *name, bool modal
121 bi-> m_hicon = l; 121 bi-> m_hicon = l;
122 122
123 l = new QLabel ( this ); 123 l = new QLabel ( this );
124 l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine ); 124 l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine );
125 lay-> addWidget ( l, i + 1, 3, AlignLeft | AlignTop ); 125 lay-> addWidget ( l, i + 1, 3, AlignLeft | AlignTop );
126 bi-> m_hlabel = l; 126 bi-> m_hlabel = l;
127 127
128 i += 2; 128 i += 2;
129 129
130 m_infos. append ( bi ); 130 m_infos. append ( bi );
131 } 131 }
132 132
133 toplay-> addStretch ( 10 ); 133 toplay-> addStretch ( 10 );
134 134
135 m_last_button = 0; 135 m_last_button = 0;
136 m_lock = false; 136 m_lock = false;
137 137
138 m_timer = new QTimer ( this ); 138 m_timer = new QTimer ( this );
139 connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( keyTimeout ( ))); 139 connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( keyTimeout ( )));
140 140
141 updateLabels ( ); 141 updateLabels ( );
142 142
143 QPEApplication::grabKeyboard ( ); 143 QPEApplication::grabKeyboard ( );
144} 144}
145 145
146ButtonSettings::~ButtonSettings ( ) 146ButtonSettings::~ButtonSettings ( )
147{ 147{
148 QPEApplication::ungrabKeyboard ( ); 148 QPEApplication::ungrabKeyboard ( );
149} 149}
150 150
151void ButtonSettings::updateLabels ( ) 151void ButtonSettings::updateLabels ( )
152{ 152{
153 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { 153 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) {
154 qCopInfo cip = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_pmsg ); 154 qCopInfo cip = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_pmsg );
155 155
156 (*it)-> m_picon-> setPixmap ( cip. m_icon ); 156 (*it)-> m_picon-> setPixmap ( cip. m_icon );
157 (*it)-> m_plabel-> setText ( cip. m_name ); 157 (*it)-> m_plabel-> setText ( cip. m_name );
158 158
159 qCopInfo cih = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_hmsg ); 159 qCopInfo cih = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_hmsg );
160 160
161 (*it)-> m_hicon-> setPixmap ( cih. m_icon ); 161 (*it)-> m_hicon-> setPixmap ( cih. m_icon );
162 (*it)-> m_hlabel-> setText ( cih. m_name ); 162 (*it)-> m_hlabel-> setText ( cih. m_name );
163 } 163 }
164} 164}
165 165
166buttoninfo *ButtonSettings::buttonInfoForKeycode ( ushort key ) 166buttoninfo *ButtonSettings::buttonInfoForKeycode ( ushort key )
167{ 167{
168 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { 168 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) {
169 if ((*it)-> m_button-> keycode ( ) == key ) 169 if ((*it)-> m_button-> keycode ( ) == key )
170 return *it; 170 return *it;
171 } 171 }
172 return 0; 172 return 0;
173} 173}
174 174
175void ButtonSettings::keyPressEvent ( QKeyEvent *e ) 175void ButtonSettings::keyPressEvent ( QKeyEvent *e )
176{ 176{
177 buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); 177 buttoninfo *bi = buttonInfoForKeycode ( e-> key ( ));
178 178
179 if ( bi && !e-> isAutoRepeat ( )) { 179 if ( bi && !e-> isAutoRepeat ( )) {
180 m_timer-> stop ( ); 180 m_timer-> stop ( );
181 m_last_button = bi; 181 m_last_button = bi;
182 m_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); 182 m_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true );
183 } 183 }
184 else 184 else
185 QDialog::keyPressEvent ( e ); 185 QDialog::keyPressEvent ( e );
186} 186}
187 187
188void ButtonSettings::keyReleaseEvent ( QKeyEvent *e ) 188void ButtonSettings::keyReleaseEvent ( QKeyEvent *e )
189{ 189{
190 buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); 190 buttoninfo *bi = buttonInfoForKeycode ( e-> key ( ));
191 191
192 if ( bi && !e-> isAutoRepeat ( ) && m_timer-> isActive ( )) { 192 if ( bi && !e-> isAutoRepeat ( ) && m_timer-> isActive ( )) {
193 m_timer-> stop ( ); 193 m_timer-> stop ( );
194 edit ( bi, false ); 194 edit ( bi, false );
195 } 195 }
196 else 196 else
197 QDialog::keyReleaseEvent ( e ); 197 QDialog::keyReleaseEvent ( e );
198} 198}
199 199
200void ButtonSettings::keyTimeout ( ) 200void ButtonSettings::keyTimeout ( )
201{ 201{
202 if ( m_last_button ) { 202 if ( m_last_button ) {
203 edit ( m_last_button, true ); 203 edit ( m_last_button, true );
204 m_last_button = false; 204 m_last_button = false;
205 } 205 }
206} 206}
207 207
208void ButtonSettings::edit ( buttoninfo *bi, bool hold ) 208void ButtonSettings::edit ( buttoninfo *bi, bool hold )
209{ 209{
210 210
211 if ( m_lock ) 211 if ( m_lock )
212 return; 212 return;
213 m_lock = true; 213 m_lock = true;
214 214
215 RemapDlg *d = new RemapDlg ( bi-> m_button, hold, this ); 215 RemapDlg *d = new RemapDlg ( bi-> m_button, hold, this );
216 216
217 d-> showMaximized ( ); 217 if ( QPEApplication::execDialog ( d ) == QDialog::Accepted ) {
218 if ( d-> exec ( ) == QDialog::Accepted ) {
219 218
220 219
221 if ( hold ) { 220 if ( hold ) {
222 bi-> m_hmsg = d-> message ( ); 221 bi-> m_hmsg = d-> message ( );
223 bi-> m_hdirty = true; 222 bi-> m_hdirty = true;
224 } 223 }
225 else { 224 else {
226 bi-> m_pmsg = d-> message ( ); 225 bi-> m_pmsg = d-> message ( );
227 bi-> m_pdirty = true; 226 bi-> m_pdirty = true;
228 } 227 }
229 228
230 updateLabels ( ); 229 updateLabels ( );
231 } 230 }
232 231
233 delete d; 232 delete d;
234 233
235 m_lock = false; 234 m_lock = false;
236} 235}
237 236
238void ButtonSettings::accept ( ) 237void ButtonSettings::accept ( )
239{ 238{
240 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { 239 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) {
241 buttoninfo *bi = *it; 240 buttoninfo *bi = *it;
242 241
243 if ( bi-> m_pdirty ) 242 if ( bi-> m_pdirty )
244 ODevice::inst ( )-> remapPressedAction ( bi-> m_index, bi-> m_pmsg ); 243 ODevice::inst ( )-> remapPressedAction ( bi-> m_index, bi-> m_pmsg );
245 if ( bi-> m_hdirty ) 244 if ( bi-> m_hdirty )
246 ODevice::inst ( )-> remapHeldAction ( bi-> m_index, bi-> m_hmsg ); 245 ODevice::inst ( )-> remapHeldAction ( bi-> m_index, bi-> m_hmsg );
247 } 246 }
248 QDialog::accept ( ); 247 QDialog::accept ( );
249} 248}
250 249
251void ButtonSettings::done ( int r ) 250void ButtonSettings::done ( int r )
252{ 251{
253 QDialog::done ( r ); 252 QDialog::done ( r );
254 close ( ); 253 close ( );
255} 254}
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index a3d31a5..17a1609 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -1,130 +1,131 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#include "tabssettings.h" 28#include "tabssettings.h"
29 29
30#include <qpe/resource.h> 30#include <qpe/resource.h>
31#include <qpe/applnk.h> 31#include <qpe/applnk.h>
32#include <qpe/mimetype.h> 32#include <qpe/mimetype.h>
33#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/qpeapplication.h>
35 36
36#include <qlistbox.h> 37#include <qlistbox.h>
37#include <qpushbutton.h> 38#include <qpushbutton.h>
38#include <qlayout.h> 39#include <qlayout.h>
39#include <qlabel.h> 40#include <qlabel.h>
40#include <qwhatsthis.h> 41#include <qwhatsthis.h>
41#include <qcheckbox.h> 42#include <qcheckbox.h>
42 43
43#include "tabdialog.h" 44#include "tabdialog.h"
44 45
45#include <stdlib.h> 46#include <stdlib.h>
46#include <qmessagebox.h> 47#include <qmessagebox.h>
47 48
48 49
49 #define GLOBALID ".global." 50 #define GLOBALID ".global."
50 51
51 52
52TabsSettings::TabsSettings ( QWidget *parent, const char *name ) 53TabsSettings::TabsSettings ( QWidget *parent, const char *name )
53 : QWidget ( parent, name ) 54 : QWidget ( parent, name )
54{ 55{
55 QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); 56 QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 );
56 57
57 QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); 58 QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this );
58 lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); 59 lay-> addMultiCellWidget ( l, 0, 0, 0, 1 );
59 60
60 m_list = new QListBox ( this ); 61 m_list = new QListBox ( this );
61 lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); 62 lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 );
62 63
63 QWhatsThis::add ( m_list, tr( "foobar" )); 64 QWhatsThis::add ( m_list, tr( "foobar" ));
64 65
65 QPushButton *p1, *p2, *p3; 66 QPushButton *p1, *p2, *p3;
66 p1 = new QPushButton ( tr( "New" ), this ); 67 p1 = new QPushButton ( tr( "New" ), this );
67 lay-> addWidget ( p1, 1, 1 ); 68 lay-> addWidget ( p1, 1, 1 );
68 connect ( p1, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); 69 connect ( p1, SIGNAL( clicked ( )), this, SLOT( newClicked ( )));
69 70
70 p2 = new QPushButton ( tr( "Edit" ), this ); 71 p2 = new QPushButton ( tr( "Edit" ), this );
71 lay-> addWidget ( p2, 2, 1 ); 72 lay-> addWidget ( p2, 2, 1 );
72 connect ( p2, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); 73 connect ( p2, SIGNAL( clicked ( )), this, SLOT( editClicked ( )));
73 74
74 p3 = new QPushButton ( tr( "Delete" ), this ); 75 p3 = new QPushButton ( tr( "Delete" ), this );
75 lay-> addWidget ( p3, 3, 1 ); 76 lay-> addWidget ( p3, 3, 1 );
76 connect ( p3, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); 77 connect ( p3, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( )));
77 78
78 lay-> setRowStretch ( 4, 10 ); 79 lay-> setRowStretch ( 4, 10 );
79 80
80 m_bigbusy = new QCheckBox( tr( "Enable big busy indicator" ), this ); 81 m_bigbusy = new QCheckBox( tr( "Enable big busy indicator" ), this );
81 lay-> addMultiCellWidget ( m_bigbusy, 5, 5, 0, 1 ); 82 lay-> addMultiCellWidget ( m_bigbusy, 5, 5, 0, 1 );
82 83
83 m_busyani = new QCheckBox ( tr( "Enable animated busy indicator" ), this ); 84 m_busyani = new QCheckBox ( tr( "Enable animated busy indicator" ), this );
84 lay-> addMultiCellWidget ( m_busyani, 6, 6, 0, 1 ); 85 lay-> addMultiCellWidget ( m_busyani, 6, 6, 0, 1 );
85 86
86 p1-> setEnabled ( false ); 87 p1-> setEnabled ( false );
87 p3-> setEnabled ( false ); 88 p3-> setEnabled ( false );
88 89
89 init ( ); 90 init ( );
90 91
91 QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." )); 92 QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." ));
92 QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); 93 QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." ));
93 QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." )); 94 QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." ));
94 QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); 95 QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." ));
95 QWhatsThis::add ( m_bigbusy, tr( "Activate this, if you want a big busy indicator in the middle of the screen instead of the one in taskbar." )); 96 QWhatsThis::add ( m_bigbusy, tr( "Activate this, if you want a big busy indicator in the middle of the screen instead of the one in taskbar." ));
96 QWhatsThis::add ( m_busyani, tr( "Activate this, if you want an animatedbusy indicator for starting applications in the Launcher." )); 97 QWhatsThis::add ( m_busyani, tr( "Activate this, if you want an animatedbusy indicator for starting applications in the Launcher." ));
97} 98}
98 99
99void TabsSettings::init ( ) 100void TabsSettings::init ( )
100{ 101{
101 AppLnkSet rootFolder( MimeType::appsFolderName ( )); 102 AppLnkSet rootFolder( MimeType::appsFolderName ( ));
102 QStringList types = rootFolder. types ( ); 103 QStringList types = rootFolder. types ( );
103 104
104 m_list-> insertItem ( tr( "All Tabs" )); 105 m_list-> insertItem ( tr( "All Tabs" ));
105 m_ids << GLOBALID; 106 m_ids << GLOBALID;
106 107
107 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { 108 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) {
108 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); 109 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it ));
109 m_ids << *it; 110 m_ids << *it;
110 } 111 }
111 QImage img ( Resource::loadImage ( "DocsIcon" )); 112 QImage img ( Resource::loadImage ( "DocsIcon" ));
112 QPixmap pix; 113 QPixmap pix;
113 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); 114 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( ));
114 m_list-> insertItem ( pix, tr( "Documents" )); 115 m_list-> insertItem ( pix, tr( "Documents" ));
115 m_ids += "Documents"; // No tr 116 m_ids += "Documents"; // No tr
116 117
117 Config cfg ( "Launcher" ); 118 Config cfg ( "Launcher" );
118 119
119 readTabSettings ( cfg ); 120 readTabSettings ( cfg );
120 121
121 cfg. setGroup ( "GUI" ); 122 cfg. setGroup ( "GUI" );
122 m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" ); 123 m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" );
123 m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) ); 124 m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) );
124} 125}
125 126
126 127
127void TabsSettings::readTabSettings ( Config &cfg ) 128void TabsSettings::readTabSettings ( Config &cfg )
128{ 129{
129 QString grp ( "Tab %1" ); // No tr 130 QString grp ( "Tab %1" ); // No tr
130 m_tabs. clear ( ); 131 m_tabs. clear ( );
@@ -207,111 +208,110 @@ void TabsSettings::accept ( )
207 TabConfig &tc = m_tabs [*it]; 208 TabConfig &tc = m_tabs [*it];
208 209
209 if ( !tc. m_changed ) 210 if ( !tc. m_changed )
210 continue; 211 continue;
211 212
212 cfg. setGroup ( grp. arg ( *it )); 213 cfg. setGroup ( grp. arg ( *it ));
213 switch ( tc. m_view ) { 214 switch ( tc. m_view ) {
214 case TabConfig::Icon: 215 case TabConfig::Icon:
215 cfg.writeEntry ( "View", "Icon" ); 216 cfg.writeEntry ( "View", "Icon" );
216 break; 217 break;
217 case TabConfig::List: 218 case TabConfig::List:
218 cfg.writeEntry ( "View", "List" ); 219 cfg.writeEntry ( "View", "List" );
219 break; 220 break;
220 } 221 }
221 222
222 QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); 223 QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" );
223 e << *it << tc. m_view; 224 e << *it << tc. m_view;
224 225
225 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); 226 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image );
226 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); 227 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color );
227 cfg. writeEntry ( "TextColor", tc. m_text_color ); 228 cfg. writeEntry ( "TextColor", tc. m_text_color );
228 229
229 if ( tc. m_font_use ) { 230 if ( tc. m_font_use ) {
230 QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); 231 QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" );
231 cfg. writeEntry ( "Font", f ); 232 cfg. writeEntry ( "Font", f );
232 } 233 }
233 else 234 else
234 cfg. removeEntry ( "Font" ); 235 cfg. removeEntry ( "Font" );
235 236
236 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); 237 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" );
237 238
238 switch ( tc. m_bg_type ) { 239 switch ( tc. m_bg_type ) {
239 case TabConfig::Ruled: 240 case TabConfig::Ruled:
240 cfg.writeEntry( "BackgroundType", "Ruled" ); 241 cfg.writeEntry( "BackgroundType", "Ruled" );
241 be << *it << tc. m_bg_type << QString(""); 242 be << *it << tc. m_bg_type << QString("");
242 break; 243 break;
243 case TabConfig::SolidColor: 244 case TabConfig::SolidColor:
244 cfg.writeEntry( "BackgroundType", "SolidColor" ); 245 cfg.writeEntry( "BackgroundType", "SolidColor" );
245 be << *it << tc. m_bg_type << tc. m_bg_color; 246 be << *it << tc. m_bg_type << tc. m_bg_color;
246 break; 247 break;
247 case TabConfig::Image: 248 case TabConfig::Image:
248 cfg.writeEntry( "BackgroundType", "Image" ); 249 cfg.writeEntry( "BackgroundType", "Image" );
249 be << *it << tc. m_bg_type << tc. m_bg_image; 250 be << *it << tc. m_bg_type << tc. m_bg_image;
250 break; 251 break;
251 } 252 }
252 253
253 QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); 254 QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" );
254 te << *it << tc. m_text_color; 255 te << *it << tc. m_text_color;
255 256
256 QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); 257 QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" );
257 fe << *it; 258 fe << *it;
258 fe << ( tc. m_font_use ? tc. m_font_family : QString::null ); 259 fe << ( tc. m_font_use ? tc. m_font_family : QString::null );
259 fe << tc. m_font_size; 260 fe << tc. m_font_size;
260 fe << tc. m_font_weight; 261 fe << tc. m_font_weight;
261 fe << ( tc. m_font_italic ? 1 : 0 ); 262 fe << ( tc. m_font_italic ? 1 : 0 );
262 263
263 tc. m_changed = false; 264 tc. m_changed = false;
264 } 265 }
265 cfg. setGroup ( "GUI" ); 266 cfg. setGroup ( "GUI" );
266 QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" ); 267 QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" );
267 cfg. writeEntry ( "BusyType", busytype ); 268 cfg. writeEntry ( "BusyType", busytype );
268 269
269 cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) ); 270 cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) );
270 271
271 { 272 {
272 QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" ); 273 QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" );
273 e << busytype; 274 e << busytype;
274 } 275 }
275} 276}
276 277
277void TabsSettings::newClicked ( ) 278void TabsSettings::newClicked ( )
278{ 279{
279 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); 280 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
280} 281}
281 282
282void TabsSettings::deleteClicked ( ) 283void TabsSettings::deleteClicked ( )
283{ 284{
284 int ind = m_list-> currentItem ( ); 285 int ind = m_list-> currentItem ( );
285 286
286 if ( ind < 0 ) 287 if ( ind < 0 )
287 return; 288 return;
288 289
289 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); 290 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
290} 291}
291 292
292void TabsSettings::editClicked ( ) 293void TabsSettings::editClicked ( )
293{ 294{
294 int ind = m_list-> currentItem ( ); 295 int ind = m_list-> currentItem ( );
295 296
296 if ( ind < 0 ) 297 if ( ind < 0 )
297 return; 298 return;
298 299
299 TabConfig tc = m_tabs [m_ids [ind]]; 300 TabConfig tc = m_tabs [m_ids [ind]];
300 301
301 TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); 302 TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true );
302 303
303 d-> showMaximized ( ); 304 if ( QPEApplication::execDialog( d ) == QDialog::Accepted ) {
304 if ( d-> exec ( ) == QDialog::Accepted ) {
305 tc. m_changed = true; 305 tc. m_changed = true;
306 m_tabs [m_ids [ind]] = tc; 306 m_tabs [m_ids [ind]] = tc;
307 307
308 if ( m_ids [ind] == GLOBALID ) { 308 if ( m_ids [ind] == GLOBALID ) {
309 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 309 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
310 if ( *it != GLOBALID ) 310 if ( *it != GLOBALID )
311 m_tabs [*it] = tc; 311 m_tabs [*it] = tc;
312 } 312 }
313 } 313 }
314 } 314 }
315 315
316 delete d; 316 delete d;
317} 317}
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index b21215b..60f7417 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -117,194 +117,193 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
117 int bright = config. readNumEntry ( "Brightness", 127 ); 117 int bright = config. readNumEntry ( "Brightness", 127 );
118 int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); 118 int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 );
119 brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); 119 brightness-> setTickInterval ( QMAX( 16, 256 / m_bres ));
120 brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); 120 brightness-> setLineStep ( QMAX( 1, 256 / m_bres ));
121 brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); 121 brightness-> setPageStep ( QMAX( 1, 256 / m_bres ));
122 brightness-> setValue ( bright ); 122 brightness-> setValue ( bright );
123 123
124 if (m_cres) { 124 if (m_cres) {
125 contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); 125 contrast-> setTickInterval ( QMAX( 16, 256 / m_cres ));
126 contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); 126 contrast-> setLineStep ( QMAX( 1, 256 / m_cres ));
127 contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); 127 contrast-> setPageStep ( QMAX( 1, 256 / m_cres ));
128 contrast-> setValue ( contr ); 128 contrast-> setValue ( contr );
129 } 129 }
130 130
131 // light sensor 131 // light sensor
132 auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); 132 auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
133 m_sensordata = config. readListEntry ( "LightSensorData", ';' ); 133 m_sensordata = config. readListEntry ( "LightSensorData", ';' );
134 134
135 config. setGroup ( "AC" ); 135 config. setGroup ( "AC" );
136 136
137 // ac spinboxes 137 // ac spinboxes
138 interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); 138 interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 ));
139 interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); 139 interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 ));
140 interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); 140 interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 ));
141 141
142 // ac check and slider 142 // ac check and slider
143 LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); 143 LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
144 144
145 // CPU frequency 145 // CPU frequency
146 frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); 146 frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) );
147 147
148 // hinge action 148 // hinge action
149 closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); 149 closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) );
150 150
151 bright = config. readNumEntry ( "Brightness", 255 ); 151 bright = config. readNumEntry ( "Brightness", 255 );
152 brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); 152 brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres ));
153 brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); 153 brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres ));
154 brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); 154 brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres ));
155 brightness_ac-> setValue ( bright ); 155 brightness_ac-> setValue ( bright );
156 156
157 if (m_cres) { 157 if (m_cres) {
158 contr = config. readNumEntry ( "Contrast", 127); 158 contr = config. readNumEntry ( "Contrast", 127);
159 contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); 159 contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres ));
160 contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); 160 contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres ));
161 contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); 161 contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres ));
162 contrast_ac-> setValue ( contr ); 162 contrast_ac-> setValue ( contr );
163 } 163 }
164 164
165 // light sensor 165 // light sensor
166 auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); 166 auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
167 m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); 167 m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' );
168 168
169 // warnings 169 // warnings
170 config. setGroup ( "Warnings" ); 170 config. setGroup ( "Warnings" );
171 warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); 171 warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 );
172 lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); 172 lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) );
173 criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); 173 criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) );
174 174
175 m_resettimer = new QTimer ( this ); 175 m_resettimer = new QTimer ( this );
176 connect ( m_resettimer, SIGNAL( timeout ( )), this, SLOT( resetBacklight ( ))); 176 connect ( m_resettimer, SIGNAL( timeout ( )), this, SLOT( resetBacklight ( )));
177 177
178 if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { 178 if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) {
179 tabs-> setCurrentPage ( 0 ); 179 tabs-> setCurrentPage ( 0 );
180 } 180 }
181 else { 181 else {
182 tabs-> setCurrentPage ( 1 ); 182 tabs-> setCurrentPage ( 1 );
183 } 183 }
184 184
185 connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); 185 connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int )));
186 connect ( brightness_ac, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); 186 connect ( brightness_ac, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int )));
187 if (m_cres) { 187 if (m_cres) {
188 connect ( contrast, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); 188 connect ( contrast, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int )));
189 connect ( contrast_ac, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); 189 connect ( contrast_ac, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int )));
190 } 190 }
191 connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); 191 connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
192 connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); 192 connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
193 connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); 193 connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) );
194 connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); 194 connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) );
195} 195}
196 196
197LightSettings::~LightSettings ( ) 197LightSettings::~LightSettings ( )
198{ 198{
199} 199}
200 200
201void LightSettings::calibrateSensor ( ) 201void LightSettings::calibrateSensor ( )
202{ 202{
203 Sensor *s = new Sensor ( m_sensordata, this ); 203 Sensor *s = new Sensor ( m_sensordata, this );
204 connect ( s, SIGNAL( viewBacklight ( int )), this, SLOT( setBacklight ( int ))); 204 connect ( s, SIGNAL( viewBacklight ( int )), this, SLOT( setBacklight ( int )));
205 QPEApplication::execDialog( s ); 205 QPEApplication::execDialog( s );
206 delete s; 206 delete s;
207} 207}
208 208
209void LightSettings::calibrateSensorAC ( ) 209void LightSettings::calibrateSensorAC ( )
210{ 210{
211 Sensor *s = new Sensor ( m_sensordata_ac, this ); 211 Sensor *s = new Sensor ( m_sensordata_ac, this );
212 connect ( s, SIGNAL( viewBacklight ( int )), this, SLOT( setBacklight ( int ))); 212 connect ( s, SIGNAL( viewBacklight ( int )), this, SLOT( setBacklight ( int )));
213 s-> showMaximized ( ); 213 QPEApplication::execDialog ( s );
214 s-> exec ( );
215 delete s; 214 delete s;
216} 215}
217 216
218void LightSettings::setBacklight ( int bright ) 217void LightSettings::setBacklight ( int bright )
219{ 218{
220 QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); 219 QCopEnvelope e ( "QPE/System", "setBacklight(int)" );
221 e << bright; 220 e << bright;
222 221
223 if ( bright != -1 ) { 222 if ( bright != -1 ) {
224 m_resettimer-> stop ( ); 223 m_resettimer-> stop ( );
225 m_resettimer-> start ( 4000, true ); 224 m_resettimer-> start ( 4000, true );
226 } 225 }
227} 226}
228 227
229void LightSettings::setContrast ( int contr ) 228void LightSettings::setContrast ( int contr )
230{ 229{
231 if (contr == -1) contr = m_oldcontrast; 230 if (contr == -1) contr = m_oldcontrast;
232 ODevice::inst ( )-> setDisplayContrast(contr); 231 ODevice::inst ( )-> setDisplayContrast(contr);
233} 232}
234 233
235void LightSettings::setFrequency ( int index ) 234void LightSettings::setFrequency ( int index )
236{ 235{
237 qWarning("LightSettings::setFrequency(%d)", index); 236 qWarning("LightSettings::setFrequency(%d)", index);
238 ODevice::inst ( )-> setCurrentCpuFrequency(index); 237 ODevice::inst ( )-> setCurrentCpuFrequency(index);
239} 238}
240 239
241void LightSettings::resetBacklight ( ) 240void LightSettings::resetBacklight ( )
242{ 241{
243 setBacklight ( -1 ); 242 setBacklight ( -1 );
244 setContrast ( -1 ); 243 setContrast ( -1 );
245} 244}
246 245
247void LightSettings::setCloseHingeAction ( int index ) 246void LightSettings::setCloseHingeAction ( int index )
248{ 247{
249 qWarning("LightSettings::setCloseHingeStatus(%d)", index); 248 qWarning("LightSettings::setCloseHingeStatus(%d)", index);
250} 249}
251 250
252void LightSettings::accept ( ) 251void LightSettings::accept ( )
253{ 252{
254 Config config ( "apm" ); 253 Config config ( "apm" );
255 254
256 // bat 255 // bat
257 config. setGroup ( "Battery" ); 256 config. setGroup ( "Battery" );
258 config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( )); 257 config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( ));
259 config. writeEntry ( "Dim", interval_dim-> value ( )); 258 config. writeEntry ( "Dim", interval_dim-> value ( ));
260 config. writeEntry ( "LightOff", interval_lightoff-> value ( )); 259 config. writeEntry ( "LightOff", interval_lightoff-> value ( ));
261 config. writeEntry ( "Suspend", interval_suspend-> value ( )); 260 config. writeEntry ( "Suspend", interval_suspend-> value ( ));
262 config. writeEntry ( "Brightness", brightness-> value () ); 261 config. writeEntry ( "Brightness", brightness-> value () );
263 if (m_cres) 262 if (m_cres)
264 config. writeEntry ( "Contrast", contrast-> value () ); 263 config. writeEntry ( "Contrast", contrast-> value () );
265 config. writeEntry ( "Freq", frequency->currentItem() ); 264 config. writeEntry ( "Freq", frequency->currentItem() );
266 config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); 265 config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() );
267 266
268 // ac 267 // ac
269 config. setGroup ( "AC" ); 268 config. setGroup ( "AC" );
270 config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( )); 269 config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( ));
271 config. writeEntry ( "Dim", interval_dim_ac-> value ( )); 270 config. writeEntry ( "Dim", interval_dim_ac-> value ( ));
272 config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( )); 271 config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( ));
273 config. writeEntry ( "Suspend", interval_suspend_ac-> value ( )); 272 config. writeEntry ( "Suspend", interval_suspend_ac-> value ( ));
274 config. writeEntry ( "Brightness", brightness_ac-> value () ); 273 config. writeEntry ( "Brightness", brightness_ac-> value () );
275 if (m_cres) 274 if (m_cres)
276 config. writeEntry ( "Contrast", contrast_ac-> value () ); 275 config. writeEntry ( "Contrast", contrast_ac-> value () );
277 config. writeEntry ( "Freq", frequency_ac->currentItem() ); 276 config. writeEntry ( "Freq", frequency_ac->currentItem() );
278 config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() ); 277 config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() );
279 278
280 // only make light sensor stuff appear if the unit has a sensor 279 // only make light sensor stuff appear if the unit has a sensor
281 if ( ODevice::inst ( )-> hasLightSensor ( )) { 280 if ( ODevice::inst ( )-> hasLightSensor ( )) {
282 config. setGroup ( "Battery" ); 281 config. setGroup ( "Battery" );
283 config. writeEntry ( "LightSensor", auto_brightness->isChecked() ); 282 config. writeEntry ( "LightSensor", auto_brightness->isChecked() );
284 config. writeEntry ( "LightSensorData", m_sensordata, ';' ); 283 config. writeEntry ( "LightSensorData", m_sensordata, ';' );
285 config. setGroup ( "AC" ); 284 config. setGroup ( "AC" );
286 config. writeEntry ( "LightSensor", auto_brightness_ac->isChecked() ); 285 config. writeEntry ( "LightSensor", auto_brightness_ac->isChecked() );
287 config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' ); 286 config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' );
288 } 287 }
289 288
290 // advanced 289 // advanced
291 config. setGroup ( "Warnings" ); 290 config. setGroup ( "Warnings" );
292 config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 ); 291 config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 );
293 config. writeEntry ( "power_verylow", lowSpinBox-> value ( )); 292 config. writeEntry ( "power_verylow", lowSpinBox-> value ( ));
294 config. writeEntry ( "power_critical", criticalSpinBox-> value ( )); 293 config. writeEntry ( "power_critical", criticalSpinBox-> value ( ));
295 config. write ( ); 294 config. write ( );
296 295
297 // notify the launcher 296 // notify the launcher
298 { 297 {
299 QCopEnvelope e ( "QPE/System", "reloadPowerWarnSettings()" ); 298 QCopEnvelope e ( "QPE/System", "reloadPowerWarnSettings()" );
300 } 299 }
301 { 300 {
302 QCopEnvelope e ( "QPE/System", "setScreenSaverInterval(int)" ); 301 QCopEnvelope e ( "QPE/System", "setScreenSaverInterval(int)" );
303 e << -1; 302 e << -1;
304 } 303 }
305 LightSettingsBase::accept ( ); 304 LightSettingsBase::accept ( );
306} 305}
307 306
308void LightSettings::done ( int r ) 307void LightSettings::done ( int r )
309{ 308{
310 m_resettimer-> stop ( ); 309 m_resettimer-> stop ( );
diff --git a/core/settings/security/security.cpp b/core/settings/security/security.cpp
index 7bb14cd..34f7e50 100644
--- a/core/settings/security/security.cpp
+++ b/core/settings/security/security.cpp
@@ -9,193 +9,193 @@
9 ** packaging of this file. 9 ** packaging of this file.
10 ** 10 **
11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 ** 13 **
14 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 14 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
15 ** 15 **
16 ** Contact info@trolltech.com if any conditions of this licensing are 16 ** Contact info@trolltech.com if any conditions of this licensing are
17 ** not clear to you. 17 ** not clear to you.
18 ** 18 **
19 **********************************************************************/ 19 **********************************************************************/
20#include "security.h" 20#include "security.h"
21 21
22#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
23#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/password.h> 24#include <qpe/password.h>
25#include <qpe/qpedialog.h> 25#include <qpe/qpedialog.h>
26#include <qpe/qcopenvelope_qws.h> 26#include <qpe/qcopenvelope_qws.h>
27 27
28#include <qcheckbox.h> 28#include <qcheckbox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34 34
35 Security::Security( QWidget* parent, const char* name, WFlags fl ) 35 Security::Security( QWidget* parent, const char* name, WFlags fl )
36: SecurityBase( parent, name, TRUE, WStyle_ContextHelp ) 36: SecurityBase( parent, name, TRUE, WStyle_ContextHelp )
37{ 37{
38 valid=FALSE; 38 valid=FALSE;
39 Config cfg("Security"); 39 Config cfg("Security");
40 cfg.setGroup("Passcode"); 40 cfg.setGroup("Passcode");
41 passcode = cfg.readEntry("passcode"); 41 passcode = cfg.readEntry("passcode");
42 passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE)); 42 passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE));
43 cfg.setGroup("Sync"); 43 cfg.setGroup("Sync");
44 int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 44 int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24
45 int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); 45 int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24);
46 selectNet(auth_peer,auth_peer_bits,TRUE); 46 selectNet(auth_peer,auth_peer_bits,TRUE);
47 47
48 connect(syncnet, SIGNAL(textChanged(const QString&)), 48 connect(syncnet, SIGNAL(textChanged(const QString&)),
49 this, SLOT(setSyncNet(const QString&))); 49 this, SLOT(setSyncNet(const QString&)));
50 50
51 cfg.setGroup("Sync"); 51 cfg.setGroup("Sync");
52 QString sa = cfg.readEntry("syncapp","Qtopia"); 52 QString sa = cfg.readEntry("syncapp","Qtopia");
53 53
54 for (int i=0; i<syncapp->count(); i++) { 54 for (int i=0; i<syncapp->count(); i++) {
55 if ( syncapp->text(i) == sa ) { 55 if ( syncapp->text(i) == sa ) {
56 syncapp->setCurrentItem(i); 56 syncapp->setCurrentItem(i);
57 } 57 }
58 } 58 }
59 59
60 /* 60 /*
61 cfg.setGroup("Remote"); 61 cfg.setGroup("Remote");
62 if ( telnetAvailable() ) 62 if ( telnetAvailable() )
63 telnet->setChecked(cfg.readEntry("allow_telnet")); 63 telnet->setChecked(cfg.readEntry("allow_telnet"));
64 else 64 else
65 telnet->hide(); 65 telnet->hide();
66 66
67 if ( sshAvailable() ) 67 if ( sshAvailable() )
68 ssh->setChecked(cfg.readEntry("allow_ssh")); 68 ssh->setChecked(cfg.readEntry("allow_ssh"));
69 else 69 else
70 ssh->hide(); 70 ssh->hide();
71 */ 71 */
72 72
73 QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; 73 QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf";
74 Config loginCfg(configFile,Config::File); 74 Config loginCfg(configFile,Config::File);
75 75
76 loginCfg.setGroup("General"); 76 loginCfg.setGroup("General");
77 autoLoginName=loginCfg.readEntry("AutoLogin",""); 77 autoLoginName=loginCfg.readEntry("AutoLogin","");
78 78
79 if (autoLoginName.stripWhiteSpace().isEmpty()) { 79 if (autoLoginName.stripWhiteSpace().isEmpty()) {
80 autoLogin=false; 80 autoLogin=false;
81 } else { 81 } else {
82 autoLogin=true; 82 autoLogin=true;
83 } 83 }
84 84
85 cfg.setGroup("SyncMode"); 85 cfg.setGroup("SyncMode");
86 int mode = cfg.readNumEntry("Mode",2); // Default to Sharp 86 int mode = cfg.readNumEntry("Mode",2); // Default to Sharp
87 syncModeCombo->setCurrentItem( mode - 1 ); 87 syncModeCombo->setCurrentItem( mode - 1 );
88 88
89 //since nobody knows what this is and it doesn't do anything, i'll hide it # CoreDump 89 //since nobody knows what this is and it doesn't do anything, i'll hide it # CoreDump
90 // is this work-in-progress or can it be removed? 90 // is this work-in-progress or can it be removed?
91 syncModeCombo->hide(); 91 syncModeCombo->hide();
92 92
93 connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); 93 connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool)));
94 connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int))); 94 connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int)));
95 connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode())); 95 connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode()));
96 connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); 96 connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode()));
97 connect(syncapp,SIGNAL(activated(int)), this, SLOT(changeSyncApp())); 97 connect(syncapp,SIGNAL(activated(int)), this, SLOT(changeSyncApp()));
98 connect(restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults())); 98 connect(restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults()));
99 connect(deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry())); 99 connect(deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry()));
100 100
101 loadUsers(); 101 loadUsers();
102 updateGUI(); 102 updateGUI();
103 103
104 dl = new QPEDialogListener(this); 104 dl = new QPEDialogListener(this);
105 showMaximized(); 105 QPEApplication::showDialog( this );
106} 106}
107 107
108Security::~Security() 108Security::~Security()
109{ 109{
110} 110}
111 111
112void Security::deleteListEntry() 112void Security::deleteListEntry()
113{ 113{
114 syncnet->removeItem(syncnet->currentItem()); 114 syncnet->removeItem(syncnet->currentItem());
115} 115}
116 116
117void Security::restoreDefaults() 117void Security::restoreDefaults()
118 { 118 {
119 QMessageBox unrecbox( 119 QMessageBox unrecbox(
120 tr("Attention"), 120 tr("Attention"),
121 tr("<p>All user-defined net ranges will be lost."), 121 tr("<p>All user-defined net ranges will be lost."),
122 QMessageBox::Warning, 122 QMessageBox::Warning,
123 QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, 123 QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton,
124 0, QString::null, TRUE, WStyle_StaysOnTop); 124 0, QString::null, TRUE, WStyle_StaysOnTop);
125 unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel")); 125 unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel"));
126 unrecbox.setButtonText(QMessageBox::Yes, tr("Ok")); 126 unrecbox.setButtonText(QMessageBox::Yes, tr("Ok"));
127 127
128 if ( unrecbox.exec() == QMessageBox::Yes) 128 if ( unrecbox.exec() == QMessageBox::Yes)
129 { 129 {
130 syncnet->clear(); 130 syncnet->clear();
131 insertDefaultRanges(); 131 insertDefaultRanges();
132 } 132 }
133} 133}
134 134
135void Security::insertDefaultRanges() 135void Security::insertDefaultRanges()
136{ 136{
137 syncnet->insertItem( tr( "192.168.129.0/24" ) ); 137 syncnet->insertItem( tr( "192.168.129.0/24" ) );
138 syncnet->insertItem( tr( "192.168.1.0/24" ) ); 138 syncnet->insertItem( tr( "192.168.1.0/24" ) );
139 syncnet->insertItem( tr( "192.168.0.0/16" ) ); 139 syncnet->insertItem( tr( "192.168.0.0/16" ) );
140 syncnet->insertItem( tr( "172.16.0.0/12" ) ); 140 syncnet->insertItem( tr( "172.16.0.0/12" ) );
141 syncnet->insertItem( tr( "10.0.0.0/8" ) ); 141 syncnet->insertItem( tr( "10.0.0.0/8" ) );
142 syncnet->insertItem( tr( "1.0.0.0/8" ) ); 142 syncnet->insertItem( tr( "1.0.0.0/8" ) );
143 syncnet->insertItem( tr( "Any" ) ); 143 syncnet->insertItem( tr( "Any" ) );
144 syncnet->insertItem( tr( "None" ) ); 144 syncnet->insertItem( tr( "None" ) );
145} 145}
146 146
147void Security::updateGUI() 147void Security::updateGUI()
148{ 148{
149 bool empty = passcode.isEmpty(); 149 bool empty = passcode.isEmpty();
150 150
151 changepasscode->setText( empty ? tr("Set passcode" ) 151 changepasscode->setText( empty ? tr("Set passcode" )
152 : tr("Change passcode" ) ); 152 : tr("Change passcode" ) );
153 passcode_poweron->setEnabled( !empty ); 153 passcode_poweron->setEnabled( !empty );
154 clearpasscode->setEnabled( !empty ); 154 clearpasscode->setEnabled( !empty );
155 155
156 autologinToggle->setChecked(autoLogin); 156 autologinToggle->setChecked(autoLogin);
157 userlist->setEnabled(autoLogin); 157 userlist->setEnabled(autoLogin);
158} 158}
159 159
160 160
161void Security::show() 161void Security::show()
162{ 162{
163 //valid=FALSE; 163 //valid=FALSE;
164 setEnabled(FALSE); 164 setEnabled(FALSE);
165 SecurityBase::show(); 165 SecurityBase::show();
166 if ( passcode.isEmpty() ) { 166 if ( passcode.isEmpty() ) {
167 // could insist... 167 // could insist...
168 //changePassCode(); 168 //changePassCode();
169 //if ( passcode.isEmpty() ) 169 //if ( passcode.isEmpty() )
170 //reject(); 170 //reject();
171 } else { 171 } else {
172 if (!valid) // security passcode was not asked yet, so ask now 172 if (!valid) // security passcode was not asked yet, so ask now
173 { 173 {
174 QString pc = enterPassCode(tr("Enter passcode")); 174 QString pc = enterPassCode(tr("Enter passcode"));
175 if ( pc != passcode ) { 175 if ( pc != passcode ) {
176 QMessageBox::critical(this, tr("Passcode incorrect"), 176 QMessageBox::critical(this, tr("Passcode incorrect"),
177 tr("The passcode entered is incorrect.\nAccess denied")); 177 tr("The passcode entered is incorrect.\nAccess denied"));
178 reject(); 178 reject();
179 return; 179 return;
180 } 180 }
181 } 181 }
182 } 182 }
183 setEnabled(TRUE); 183 setEnabled(TRUE);
184 valid=TRUE; 184 valid=TRUE;
185} 185}
186 186
187void Security::accept() 187void Security::accept()
188{ 188{
189 applySecurity(); 189 applySecurity();
190 QDialog::accept(); 190 QDialog::accept();
191 QCopEnvelope env("QPE/System", "securityChanged()" ); 191 QCopEnvelope env("QPE/System", "securityChanged()" );
192} 192}
193 193
194void Security::done(int r) 194void Security::done(int r)
195{ 195{
196 QDialog::done(r); 196 QDialog::done(r);
197 close(); 197 close();
198} 198}
199 199
200void Security::selectNet(int auth_peer,int auth_peer_bits, bool update) 200void Security::selectNet(int auth_peer,int auth_peer_bits, bool update)
201{ 201{