summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/shutdownimpl.cpp5
-rw-r--r--core/launcher/taskbar.cpp6
2 files changed, 1 insertions, 10 deletions
diff --git a/core/launcher/shutdownimpl.cpp b/core/launcher/shutdownimpl.cpp
index a202b7b..cf4f926 100644
--- a/core/launcher/shutdownimpl.cpp
+++ b/core/launcher/shutdownimpl.cpp
@@ -69,101 +69,96 @@ ShutdownImpl::ShutdownImpl( QWidget* parent, const char *name, WFlags fl )
changeButtonColor ( quit, QColor ( 236, 236, 179 ) );
btngrp-> insert ( quit, 4 );
grid-> addWidget ( quit, 1, 1 );
QPushButton *reboot = new QPushButton ( tr( "Reboot" ), btngrp, "reboot" );
changeButtonColor ( reboot, QColor( 236, 183, 181 ) );
btngrp-> insert ( reboot, 2 );
grid-> addWidget( reboot, 1, 0 );
QPushButton *restart = new QPushButton ( tr( "Restart Opie" ), btngrp, "restart" );
changeButtonColor ( restart, QColor( 236, 236, 179 ) );
btngrp-> insert ( restart, 3 );
grid-> addWidget ( restart, 0, 1 );
QPushButton *shutdown = new QPushButton( tr( "Shutdown" ), btngrp, "shutdown" );
changeButtonColor ( shutdown, QColor( 236, 183, 181 ) );
btngrp-> insert ( shutdown, 1 );
grid-> addWidget ( shutdown, 0, 0 );
vbox-> addWidget ( btngrp );
m_info = new QLabel ( this, "info" );
m_info-> setText( tr( "<p>\n" "These termination options are provided primarily for use while developing and testing the Opie system. In a normal environment, these concepts are unnecessary." ) );
vbox-> addWidget ( m_info );
m_progress = new QProgressBar ( this, "progressBar" );
m_progress-> setFrameShape ( QProgressBar::Panel );
m_progress-> setFrameShadow ( QProgressBar::Sunken );
m_progress-> setTotalSteps ( 20 );
m_progress-> setIndicatorFollowsStyle ( false );
vbox-> addWidget ( m_progress );
vbox-> addItem ( new QSpacerItem ( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
QPushButton *cancel = new QPushButton ( tr( "Cancel" ), this, "cancel" );
changeButtonColor ( cancel, QColor( 181, 222, 178 ) );
cancel-> setDefault ( true );
cancel-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding, cancel-> sizePolicy ( ). hasHeightForWidth ( ) ) );
vbox-> addWidget ( cancel );
m_timer = new QTimer ( this );
connect ( m_timer, SIGNAL( timeout ( ) ), this, SLOT( timeout ( ) ) );
connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( buttonClicked ( int ) ) );
connect ( cancel, SIGNAL( clicked ( ) ), this, SLOT( cancelClicked ( ) ) );
m_progress-> hide ( );
Global::hideInputMethod ( );
-
-#ifdef QT_QWS_SHARP
-
- shutdown-> hide ( );
-#endif
}
void ShutdownImpl::buttonClicked ( int b )
{
m_counter = 0;
switch ( b ) {
case 1:
m_operation = ShutdownSystem;
break;
case 2:
m_operation = RebootSystem;
break;
case 3:
m_operation = RestartDesktop;
break;
case 4:
m_operation = TerminateDesktop;
break;
}
m_info-> hide ( );
m_progress-> show ( );
m_timer-> start ( 300 );
timeout ( );
}
void ShutdownImpl::cancelClicked ( )
{
m_progress-> hide ( );
m_info-> show ( );
if ( m_timer-> isActive ( ) )
m_timer-> stop ( );
else
close ( );
}
void ShutdownImpl::timeout ( )
{
if ( ( m_counter += 2 ) > m_progress-> totalSteps ( ) ) {
m_progress-> hide ( );
m_timer-> stop ( );
emit shutdown ( m_operation );
}
else
m_progress-> setProgress ( m_counter );
}
void ShutdownImpl::hide ( )
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 1e6b74e..b4b7df6 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -37,188 +37,184 @@
#include <qpe/custom.h>
#endif
#include <opie/odevice.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qtimer.h>
#include <qwindowsystem_qws.h>
#include <qwidgetstack.h>
#if defined( Q_WS_QWS )
#include <qwsdisplay_qws.h>
#include <qgfx_qws.h>
#endif
using namespace Opie;
#define FACTORY(T) \
static QWidget *new##T( bool maximized ) { \
QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
if ( maximized ) { \
if ( qApp->desktop()->width() <= 350 ) { \
w->showMaximized(); \
} else { \
w->resize( QSize( 300, 300 ) ); \
} \
} \
w->show(); \
return w; \
}
#ifdef SINGLE_APP
#define APP(a,b,c,d) FACTORY(b)
#include "../launcher/apps.h"
#undef APP
#endif // SINGLE_APP
static Global::Command builtins[] = {
#ifdef SINGLE_APP
#define APP(a,b,c,d) { a, new##b, c },
#include "../launcher/apps.h"
#undef APP
#endif
-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX)
+#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_SHARP)
{ "calibrate", TaskBar::calibrate, 1, 0 },
#endif
#if !defined(QT_QWS_CASSIOPEIA)
{ "shutdown", Global::shutdown, 1, 0 },
// { "run", run, 1, 0 },
#endif
{ 0, TaskBar::calibrate, 0, 0 },
};
static bool initNumLock()
{
#ifdef QPE_INITIAL_NUMLOCK_STATE
QPE_INITIAL_NUMLOCK_STATE
#endif
return FALSE;
}
class LockKeyState : public QWidget
{
public:
LockKeyState( QWidget *parent ) :
QWidget(parent),
nl(initNumLock()), cl(FALSE)
{
nl_pm = Resource::loadPixmap("numlock");
cl_pm = Resource::loadPixmap("capslock");
}
QSize sizeHint() const
{
return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1);
}
void toggleNumLockState()
{
nl = !nl; repaint();
}
void toggleCapsLockState()
{
cl = !cl; repaint();
}
void paintEvent( QPaintEvent * )
{
int y = (height()-sizeHint().height())/2;
QPainter p(this);
if ( nl )
p.drawPixmap(1,y,nl_pm);
if ( cl )
p.drawPixmap(1,y+nl_pm.height()+1,cl_pm);
}
private:
QPixmap nl_pm, cl_pm;
bool nl, cl;
};
TaskBar::~TaskBar()
{
}
TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
{
Global::setBuiltinCommands(builtins);
sm = new StartMenu( this );
inputMethods = new InputMethods( this );
connect( inputMethods, SIGNAL(inputToggled(bool)),
this, SLOT(calcMaxWindowRect()) );
//new QuickLauncher( this );
stack = new QWidgetStack( this );
stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
label = new QLabel(stack);
//mru = new MRUList( stack );
//stack->raiseWidget( mru );
runningAppBar = new RunningAppBar(stack);
stack->raiseWidget(runningAppBar);
waitIcon = new Wait( this );
(void) new AppIcons( this );
sysTray = new SysTray( this );
// ## make customizable in some way?
-#ifdef QT_QWS_SHARP
lockState = new LockKeyState( this );
-#else
- lockState = 0;
-#endif
#if defined(Q_WS_QWS)
#if !defined(QT_NO_COP)
QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
this, SLOT(receive(const QCString&, const QByteArray&)) );
#endif
#endif
waitTimer = new QTimer( this );
connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
clearer = new QTimer( this );
QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar()));
QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show()));
}
void TaskBar::setStatusMessage( const QString &text )
{
if ( !text.isEmpty() ) {
label->setText( text );
stack->raiseWidget( label );
if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) )
sysTray->hide();
clearer->start( 3000, TRUE );
} else {
clearStatusBar();
}
}
void TaskBar::clearStatusBar()
{
label->clear();
stack->raiseWidget(runningAppBar);
// stack->raiseWidget( mru );
}
void TaskBar::startWait()
{
waitIcon->setWaiting( true );
// a catchall stop after 10 seconds...
waitTimer->start( 10 * 1000, true );
}
void TaskBar::stopWait(const QString& /*app*/)
{
waitTimer->stop();
//mru->addTask(sm->execToLink(app));
waitIcon->setWaiting( false );
}