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