summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2005-02-10 07:53:59 (UTC)
committer llornkcor <llornkcor>2005-02-10 07:53:59 (UTC)
commit134bba16e6b476406eed60cb9ff1ae596fac7732 (patch) (unidiff)
treee63de834d670e830ae6525d04ef453855441d1b3
parentdf9f73f2505ac66e804aca3bf490b80e61d3f90d (diff)
downloadopie-134bba16e6b476406eed60cb9ff1ae596fac7732.zip
opie-134bba16e6b476406eed60cb9ff1ae596fac7732.tar.gz
opie-134bba16e6b476406eed60cb9ff1ae596fac7732.tar.bz2
tired of seeing this stupid warning
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/shutdownimpl.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/core/launcher/shutdownimpl.cpp b/core/launcher/shutdownimpl.cpp
index 2731568..b66951f 100644
--- a/core/launcher/shutdownimpl.cpp
+++ b/core/launcher/shutdownimpl.cpp
@@ -1,173 +1,172 @@
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 20
21#include "shutdownimpl.h" 21#include "shutdownimpl.h"
22 22
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25 25
26#include <qtimer.h> 26#include <qtimer.h>
27#include <qprogressbar.h> 27#include <qprogressbar.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qbuttongroup.h> 29#include <qbuttongroup.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qlayout.h> 31#include <qlayout.h>
32 32
33 33
34static void changeButtonColor ( QPushButton *btn, const QColor &col ) 34static void changeButtonColor ( QPushButton *btn, const QColor &col )
35{ 35{
36 QPalette pal = btn-> palette ( ); 36 QPalette pal = btn-> palette ( );
37 37
38 pal. setColor ( QPalette::Active, QColorGroup::Button, col ); 38 pal. setColor ( QPalette::Active, QColorGroup::Button, col );
39 pal. setColor ( QPalette::Disabled, QColorGroup::Button, col ); 39 pal. setColor ( QPalette::Disabled, QColorGroup::Button, col );
40 pal. setColor ( QPalette::Inactive, QColorGroup::Button, col ); 40 pal. setColor ( QPalette::Inactive, QColorGroup::Button, col );
41 41
42 btn-> setPalette ( pal ); 42 btn-> setPalette ( pal );
43} 43}
44 44
45 45
46ShutdownImpl::ShutdownImpl( QWidget* parent, const char *name, WFlags fl ) 46ShutdownImpl::ShutdownImpl( QWidget* parent, const char *name, WFlags fl )
47 : QWidget ( parent, name, fl ) 47 : QWidget ( parent, name, fl )
48{ 48{
49 setCaption ( tr( "Shutdown..." ) ); 49 setCaption ( tr( "Shutdown..." ) );
50 50
51 QVBoxLayout *vbox = new QVBoxLayout ( this ); 51 QVBoxLayout *vbox = new QVBoxLayout ( this );
52 vbox-> setSpacing ( 3 ); 52 vbox-> setSpacing ( 3 );
53 vbox-> setMargin ( 6 ); 53 vbox-> setMargin ( 6 );
54 54
55 QButtonGroup *btngrp = new QButtonGroup ( this ); 55 QButtonGroup *btngrp = new QButtonGroup ( this );
56 56
57 btngrp-> setTitle ( tr( "Terminate" ) ); 57 btngrp-> setTitle ( tr( "Terminate" ) );
58 btngrp-> setColumnLayout ( 0, Qt::Vertical ); 58 btngrp-> setColumnLayout ( 0, Qt::Vertical );
59 btngrp-> layout ( ) -> setSpacing ( 0 ); 59 btngrp-> layout ( ) -> setSpacing ( 0 );
60 btngrp-> layout ( ) -> setMargin ( 0 ); 60 btngrp-> layout ( ) -> setMargin ( 0 );
61 61
62 QGridLayout *grid = new QGridLayout ( btngrp-> layout ( ) ); 62 QGridLayout *grid = new QGridLayout ( btngrp-> layout ( ) );
63 grid-> setAlignment ( Qt::AlignTop ); 63 grid-> setAlignment ( Qt::AlignTop );
64 grid-> setSpacing ( 3 ); 64 grid-> setSpacing ( 3 );
65 grid-> setMargin ( 7 ); 65 grid-> setMargin ( 7 );
66 66
67 QPushButton *quit = new QPushButton ( tr( "Terminate Opie" ), btngrp, "quit" ); 67 QPushButton *quit = new QPushButton ( tr( "Terminate Opie" ), btngrp, "quit" );
68 changeButtonColor ( quit, QColor ( 236, 236, 179 ) ); 68 changeButtonColor ( quit, QColor ( 236, 236, 179 ) );
69 btngrp-> insert ( quit, 4 ); 69 btngrp-> insert ( quit, 4 );
70 grid-> addWidget ( quit, 1, 1 ); 70 grid-> addWidget ( quit, 1, 1 );
71 71
72 QPushButton *reboot = new QPushButton ( tr( "Reboot" ), btngrp, "reboot" ); 72 QPushButton *reboot = new QPushButton ( tr( "Reboot" ), btngrp, "reboot" );
73 changeButtonColor ( reboot, QColor( 236, 183, 181 ) ); 73 changeButtonColor ( reboot, QColor( 236, 183, 181 ) );
74 btngrp-> insert ( reboot, 2 ); 74 btngrp-> insert ( reboot, 2 );
75 grid-> addWidget( reboot, 1, 0 ); 75 grid-> addWidget( reboot, 1, 0 );
76 76
77 QPushButton *restart = new QPushButton ( tr( "Restart Opie" ), btngrp, "restart" ); 77 QPushButton *restart = new QPushButton ( tr( "Restart Opie" ), btngrp, "restart" );
78 changeButtonColor ( restart, QColor( 236, 236, 179 ) ); 78 changeButtonColor ( restart, QColor( 236, 236, 179 ) );
79 btngrp-> insert ( restart, 3 ); 79 btngrp-> insert ( restart, 3 );
80 grid-> addWidget ( restart, 0, 1 ); 80 grid-> addWidget ( restart, 0, 1 );
81 81
82 QPushButton *shutdown = new QPushButton( tr( "Shutdown" ), btngrp, "shutdown" ); 82 QPushButton *shutdown = new QPushButton( tr( "Shutdown" ), btngrp, "shutdown" );
83 changeButtonColor ( shutdown, QColor( 236, 183, 181 ) ); 83 changeButtonColor ( shutdown, QColor( 236, 183, 181 ) );
84 btngrp-> insert ( shutdown, 1 ); 84 btngrp-> insert ( shutdown, 1 );
85 grid-> addWidget ( shutdown, 0, 0 ); 85 grid-> addWidget ( shutdown, 0, 0 );
86 86
87 vbox-> addWidget ( btngrp ); 87 vbox-> addWidget ( btngrp );
88 88
89 m_info = new QLabel ( this, "info" ); 89 m_info = new QLabel ( this, "info" );
90 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." ) );
91 vbox-> addWidget ( m_info ); 90 vbox-> addWidget ( m_info );
92 91
93 m_progress = new QProgressBar ( this, "progressBar" ); 92 m_progress = new QProgressBar ( this, "progressBar" );
94 m_progress-> setFrameShape ( QProgressBar::Panel ); 93 m_progress-> setFrameShape ( QProgressBar::Panel );
95 m_progress-> setFrameShadow ( QProgressBar::Sunken ); 94 m_progress-> setFrameShadow ( QProgressBar::Sunken );
96 m_progress-> setTotalSteps ( 20 ); 95 m_progress-> setTotalSteps ( 20 );
97 m_progress-> setIndicatorFollowsStyle ( false ); 96 m_progress-> setIndicatorFollowsStyle ( false );
98 vbox-> addWidget ( m_progress ); 97 vbox-> addWidget ( m_progress );
99 98
100 vbox-> addItem ( new QSpacerItem ( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); 99 vbox-> addItem ( new QSpacerItem ( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
101 100
102 QPushButton *cancel = new QPushButton ( tr( "Cancel" ), this, "cancel" ); 101 QPushButton *cancel = new QPushButton ( tr( "Cancel" ), this, "cancel" );
103 changeButtonColor ( cancel, QColor( 181, 222, 178 ) ); 102 changeButtonColor ( cancel, QColor( 181, 222, 178 ) );
104 cancel-> setDefault ( true ); 103 cancel-> setDefault ( true );
105 cancel-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding, cancel-> sizePolicy ( ). hasHeightForWidth ( ) ) ); 104 cancel-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding, cancel-> sizePolicy ( ). hasHeightForWidth ( ) ) );
106 vbox-> addWidget ( cancel ); 105 vbox-> addWidget ( cancel );
107 106
108 m_timer = new QTimer ( this ); 107 m_timer = new QTimer ( this );
109 connect ( m_timer, SIGNAL( timeout() ), this, SLOT( timeout() ) ); 108 connect ( m_timer, SIGNAL( timeout() ), this, SLOT( timeout() ) );
110 109
111 connect ( btngrp, SIGNAL( clicked(int) ), this, SLOT( buttonClicked(int) ) ); 110 connect ( btngrp, SIGNAL( clicked(int) ), this, SLOT( buttonClicked(int) ) );
112 connect ( cancel, SIGNAL( clicked() ), this, SLOT( cancelClicked() ) ); 111 connect ( cancel, SIGNAL( clicked() ), this, SLOT( cancelClicked() ) );
113 112
114 m_progress-> hide ( ); 113 m_progress-> hide ( );
115 Global::hideInputMethod ( ); 114 Global::hideInputMethod ( );
116} 115}
117 116
118void ShutdownImpl::buttonClicked ( int b ) 117void ShutdownImpl::buttonClicked ( int b )
119{ 118{
120 m_counter = 0; 119 m_counter = 0;
121 120
122 switch ( b ) { 121 switch ( b ) {
123 case 1: 122 case 1:
124 m_operation = ShutdownSystem; 123 m_operation = ShutdownSystem;
125 break; 124 break;
126 case 2: 125 case 2:
127 m_operation = RebootSystem; 126 m_operation = RebootSystem;
128 break; 127 break;
129 case 3: 128 case 3:
130 m_operation = RestartDesktop; 129 m_operation = RestartDesktop;
131 break; 130 break;
132 case 4: 131 case 4:
133 m_operation = TerminateDesktop; 132 m_operation = TerminateDesktop;
134 break; 133 break;
135 } 134 }
136 m_info-> hide ( ); 135 m_info-> hide ( );
137 m_progress-> show ( ); 136 m_progress-> show ( );
138 m_timer-> start ( 300 ); 137 m_timer-> start ( 300 );
139 timeout ( ); 138 timeout ( );
140} 139}
141 140
142void ShutdownImpl::cancelClicked ( ) 141void ShutdownImpl::cancelClicked ( )
143{ 142{
144 m_progress-> hide ( ); 143 m_progress-> hide ( );
145 m_info-> show ( ); 144 m_info-> show ( );
146 if ( m_timer-> isActive ( ) ) 145 if ( m_timer-> isActive ( ) )
147 m_timer-> stop ( ); 146 m_timer-> stop ( );
148 else 147 else
149 close ( ); 148 close ( );
150} 149}
151 150
152void ShutdownImpl::timeout ( ) 151void ShutdownImpl::timeout ( )
153{ 152{
154 if ( ( m_counter += 2 ) > m_progress-> totalSteps ( ) ) { 153 if ( ( m_counter += 2 ) > m_progress-> totalSteps ( ) ) {
155 m_progress-> hide ( ); 154 m_progress-> hide ( );
156 m_timer-> stop ( ); 155 m_timer-> stop ( );
157 emit shutdown ( m_operation ); 156 emit shutdown ( m_operation );
158 } 157 }
159 else 158 else
160 m_progress-> setProgress ( m_counter ); 159 m_progress-> setProgress ( m_counter );
161} 160}
162 161
163void ShutdownImpl::hide ( ) 162void ShutdownImpl::hide ( )
164{ 163{
165 if ( isVisible ( )) { 164 if ( isVisible ( )) {
166 // hack - shutdown is a launcher dialog, but treated like a standalone app 165 // hack - shutdown is a launcher dialog, but treated like a standalone app
167 QCopEnvelope e( "QPE/System", "closing(QString)" ); 166 QCopEnvelope e( "QPE/System", "closing(QString)" );
168 e << QString ( "shutdown" ); 167 e << QString ( "shutdown" );
169 168
170 } 169 }
171 QWidget::hide ( ); 170 QWidget::hide ( );
172} 171}
173 172