-rw-r--r-- | core/opie-login/loginwindow.ui | 1 | ||||
-rw-r--r-- | core/opie-login/loginwindowimpl.cpp | 43 | ||||
-rw-r--r-- | core/opie-login/loginwindowimpl.h | 2 |
3 files changed, 45 insertions, 1 deletions
diff --git a/core/opie-login/loginwindow.ui b/core/opie-login/loginwindow.ui index 5a35c8d..245e942 100644 --- a/core/opie-login/loginwindow.ui +++ b/core/opie-login/loginwindow.ui | |||
@@ -45,65 +45,64 @@ | |||
45 | </property> | 45 | </property> |
46 | <property> | 46 | <property> |
47 | <name>layoutSpacing</name> | 47 | <name>layoutSpacing</name> |
48 | </property> | 48 | </property> |
49 | <vbox> | 49 | <vbox> |
50 | <property stdset="1"> | 50 | <property stdset="1"> |
51 | <name>margin</name> | 51 | <name>margin</name> |
52 | <number>4</number> | 52 | <number>4</number> |
53 | </property> | 53 | </property> |
54 | <property stdset="1"> | 54 | <property stdset="1"> |
55 | <name>spacing</name> | 55 | <name>spacing</name> |
56 | <number>4</number> | 56 | <number>4</number> |
57 | </property> | 57 | </property> |
58 | <widget> | 58 | <widget> |
59 | <class>QLabel</class> | 59 | <class>QLabel</class> |
60 | <property stdset="1"> | 60 | <property stdset="1"> |
61 | <name>name</name> | 61 | <name>name</name> |
62 | <cstring>m_caption</cstring> | 62 | <cstring>m_caption</cstring> |
63 | </property> | 63 | </property> |
64 | <property stdset="1"> | 64 | <property stdset="1"> |
65 | <name>sizePolicy</name> | 65 | <name>sizePolicy</name> |
66 | <sizepolicy> | 66 | <sizepolicy> |
67 | <hsizetype>5</hsizetype> | 67 | <hsizetype>5</hsizetype> |
68 | <vsizetype>5</vsizetype> | 68 | <vsizetype>5</vsizetype> |
69 | </sizepolicy> | 69 | </sizepolicy> |
70 | </property> | 70 | </property> |
71 | <property stdset="1"> | 71 | <property stdset="1"> |
72 | <name>font</name> | 72 | <name>font</name> |
73 | <font> | 73 | <font> |
74 | <family>helvetica</family> | 74 | <family>helvetica</family> |
75 | <pointsize>18</pointsize> | 75 | <pointsize>18</pointsize> |
76 | <bold>1</bold> | 76 | <bold>1</bold> |
77 | <underline>1</underline> | ||
78 | </font> | 77 | </font> |
79 | </property> | 78 | </property> |
80 | <property stdset="1"> | 79 | <property stdset="1"> |
81 | <name>autoMask</name> | 80 | <name>autoMask</name> |
82 | <bool>true</bool> | 81 | <bool>true</bool> |
83 | </property> | 82 | </property> |
84 | <property stdset="1"> | 83 | <property stdset="1"> |
85 | <name>backgroundOrigin</name> | 84 | <name>backgroundOrigin</name> |
86 | <enum>ParentOrigin</enum> | 85 | <enum>ParentOrigin</enum> |
87 | </property> | 86 | </property> |
88 | <property stdset="1"> | 87 | <property stdset="1"> |
89 | <name>margin</name> | 88 | <name>margin</name> |
90 | <number>1</number> | 89 | <number>1</number> |
91 | </property> | 90 | </property> |
92 | <property stdset="1"> | 91 | <property stdset="1"> |
93 | <name>text</name> | 92 | <name>text</name> |
94 | <string><center>Welcome to OPIE</center></string> | 93 | <string><center>Welcome to OPIE</center></string> |
95 | </property> | 94 | </property> |
96 | </widget> | 95 | </widget> |
97 | <widget> | 96 | <widget> |
98 | <class>QLayoutWidget</class> | 97 | <class>QLayoutWidget</class> |
99 | <property stdset="1"> | 98 | <property stdset="1"> |
100 | <name>name</name> | 99 | <name>name</name> |
101 | <cstring>Layout6</cstring> | 100 | <cstring>Layout6</cstring> |
102 | </property> | 101 | </property> |
103 | <property> | 102 | <property> |
104 | <name>layoutSpacing</name> | 103 | <name>layoutSpacing</name> |
105 | </property> | 104 | </property> |
106 | <grid> | 105 | <grid> |
107 | <property stdset="1"> | 106 | <property stdset="1"> |
108 | <name>margin</name> | 107 | <name>margin</name> |
109 | <number>0</number> | 108 | <number>0</number> |
diff --git a/core/opie-login/loginwindowimpl.cpp b/core/opie-login/loginwindowimpl.cpp index fe2906a..577cb41 100644 --- a/core/opie-login/loginwindowimpl.cpp +++ b/core/opie-login/loginwindowimpl.cpp | |||
@@ -8,120 +8,163 @@ | |||
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 <qapplication.h> | 28 | #include <qapplication.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qlayout.h> | 30 | #include <qlayout.h> |
31 | #include <qframe.h> | 31 | #include <qframe.h> |
32 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
33 | #include <qtimer.h> | 33 | #include <qtimer.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qpixmap.h> | 35 | #include <qpixmap.h> |
36 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
38 | #include <qmessagebox.h> | 38 | #include <qmessagebox.h> |
39 | #include <qimage.h> | 39 | #include <qimage.h> |
40 | #if QT_VERSION < 300 | ||
41 | #include <qgfx_qws.h> | ||
42 | #endif | ||
43 | #include <qwindowsystem_qws.h> | ||
40 | 44 | ||
41 | #include <qpe/resource.h> | 45 | #include <qpe/resource.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 46 | #include <qpe/qcopenvelope_qws.h> |
43 | #include <qpe/config.h> | 47 | #include <qpe/config.h> |
44 | 48 | ||
45 | #include <opie/odevice.h> | 49 | #include <opie/odevice.h> |
46 | 50 | ||
47 | #include <stdio.h> | 51 | #include <stdio.h> |
48 | #include <stdlib.h> | 52 | #include <stdlib.h> |
49 | 53 | ||
50 | #include "loginwindowimpl.h" | 54 | #include "loginwindowimpl.h" |
51 | #include "loginapplication.h" | 55 | #include "loginapplication.h" |
52 | #include "inputmethods.h" | 56 | #include "inputmethods.h" |
53 | 57 | ||
54 | using namespace Opie; | 58 | using namespace Opie; |
55 | 59 | ||
56 | 60 | ||
57 | LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) | 61 | LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) |
58 | { | 62 | { |
59 | QPopupMenu *pop = new QPopupMenu ( this ); | 63 | QPopupMenu *pop = new QPopupMenu ( this ); |
60 | pop-> insertItem ( tr( "Restart" ), this, SLOT( restart ( ))); | 64 | pop-> insertItem ( tr( "Restart" ), this, SLOT( restart ( ))); |
61 | pop-> insertItem ( tr( "Quit" ), this, SLOT( quit ( ))); | 65 | pop-> insertItem ( tr( "Quit" ), this, SLOT( quit ( ))); |
62 | m_menu-> setPopup ( pop ); | 66 | m_menu-> setPopup ( pop ); |
63 | 67 | ||
68 | QCopChannel *channel = new QCopChannel ( "QPE/TaskBar", this ); | ||
69 | connect ( channel, SIGNAL( received ( const QCString &, const QByteArray & )), this, SLOT( receive ( const QCString &, const QByteArray & ))); | ||
70 | |||
64 | QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 ); | 71 | QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 ); |
65 | m_input = new InputMethods ( m_taskbar ); | 72 | m_input = new InputMethods ( m_taskbar ); |
73 | connect ( m_input, SIGNAL( inputToggled ( bool )), this, SLOT( calcMaxWindowRect ( ))); | ||
66 | lay-> addWidget ( m_input ); | 74 | lay-> addWidget ( m_input ); |
67 | lay-> addStretch ( 10 ); | 75 | lay-> addStretch ( 10 ); |
68 | 76 | ||
69 | setActiveWindow ( ); | 77 | setActiveWindow ( ); |
70 | m_password-> setFocus ( ); | 78 | m_password-> setFocus ( ); |
71 | 79 | ||
72 | m_user-> insertStringList ( lApp-> allUsers ( )); | 80 | m_user-> insertStringList ( lApp-> allUsers ( )); |
73 | 81 | ||
74 | QTimer::singleShot ( 0, this, SLOT( showIM ( ))); | 82 | QTimer::singleShot ( 0, this, SLOT( showIM ( ))); |
75 | 83 | ||
76 | QString opiedir = ::getenv ( "OPIEDIR" ); | 84 | QString opiedir = ::getenv ( "OPIEDIR" ); |
77 | QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" ); | 85 | QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" ); |
78 | 86 | ||
79 | if ( !bgpix. isNull ( )) | 87 | if ( !bgpix. isNull ( )) |
80 | setBackgroundPixmap ( bgpix ); | 88 | setBackgroundPixmap ( bgpix ); |
81 | 89 | ||
82 | m_caption-> setText ( m_caption-> text ( ) + tr( "<center>%1 %2</center>" ). arg ( ODevice::inst ( )-> systemString ( )). arg ( ODevice::inst ( )-> systemVersionString ( ))); | 90 | m_caption-> setText ( m_caption-> text ( ) + tr( "<center>%1 %2</center>" ). arg ( ODevice::inst ( )-> systemString ( )). arg ( ODevice::inst ( )-> systemVersionString ( ))); |
83 | 91 | ||
84 | Config cfg ( "opie-login" ); | 92 | Config cfg ( "opie-login" ); |
85 | cfg. setGroup ( "General" ); | 93 | cfg. setGroup ( "General" ); |
86 | QString last = cfg. readEntry ( "LastLogin" ); | 94 | QString last = cfg. readEntry ( "LastLogin" ); |
87 | 95 | ||
88 | if ( !last. isEmpty ( )) | 96 | if ( !last. isEmpty ( )) |
89 | m_user-> setEditText ( last ); | 97 | m_user-> setEditText ( last ); |
98 | |||
99 | calcMaxWindowRect ( ); | ||
90 | } | 100 | } |
91 | 101 | ||
92 | LoginWindowImpl::~LoginWindowImpl ( ) | 102 | LoginWindowImpl::~LoginWindowImpl ( ) |
93 | { | 103 | { |
94 | } | 104 | } |
95 | 105 | ||
106 | |||
107 | void LoginWindowImpl::receive ( const QCString &msg, const QByteArray &data ) | ||
108 | { | ||
109 | QDataStream stream ( data, IO_ReadOnly ); | ||
110 | |||
111 | if ( msg == "hideInputMethod()" ) | ||
112 | m_input-> hideInputMethod ( ); | ||
113 | else if ( msg == "showInputMethod()" ) | ||
114 | m_input-> showInputMethod ( ); | ||
115 | else if ( msg == "reloadInputMethods()" ) | ||
116 | m_input-> loadInputMethods ( ); | ||
117 | } | ||
118 | |||
119 | void LoginWindowImpl::calcMaxWindowRect ( ) | ||
120 | { | ||
121 | #ifdef Q_WS_QWS | ||
122 | QRect wr; | ||
123 | int displayWidth = qApp-> desktop ( )-> width ( ); | ||
124 | QRect ir = m_input-> inputRect ( ); | ||
125 | if ( ir.isValid() ) | ||
126 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); | ||
127 | else | ||
128 | wr.setCoords( 0, 0, displayWidth-1, m_taskbar->y()-1 ); | ||
129 | |||
130 | #if QT_VERSION < 300 | ||
131 | wr = qt_screen-> mapToDevice ( wr, QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); | ||
132 | #endif | ||
133 | |||
134 | QWSServer::setMaxWindowRect( wr ); | ||
135 | #endif | ||
136 | } | ||
137 | |||
138 | |||
96 | void LoginWindowImpl::keyPressEvent ( QKeyEvent *e ) | 139 | void LoginWindowImpl::keyPressEvent ( QKeyEvent *e ) |
97 | { | 140 | { |
98 | switch ( e-> key ( )) { | 141 | switch ( e-> key ( )) { |
99 | case HardKey_Suspend: suspend ( ); | 142 | case HardKey_Suspend: suspend ( ); |
100 | break; | 143 | break; |
101 | case HardKey_Backlight: backlight ( ); | 144 | case HardKey_Backlight: backlight ( ); |
102 | break; | 145 | break; |
103 | default: e-> ignore ( ); | 146 | default: e-> ignore ( ); |
104 | break; | 147 | break; |
105 | } | 148 | } |
106 | LoginWindow::keyPressEvent ( e ); | 149 | LoginWindow::keyPressEvent ( e ); |
107 | } | 150 | } |
108 | 151 | ||
109 | 152 | ||
110 | void LoginWindowImpl::toggleEchoMode ( bool t ) | 153 | void LoginWindowImpl::toggleEchoMode ( bool t ) |
111 | { | 154 | { |
112 | m_password-> setEchoMode ( t ? QLineEdit::Normal : QLineEdit::Password ); | 155 | m_password-> setEchoMode ( t ? QLineEdit::Normal : QLineEdit::Password ); |
113 | } | 156 | } |
114 | 157 | ||
115 | void LoginWindowImpl::showIM ( ) | 158 | void LoginWindowImpl::showIM ( ) |
116 | { | 159 | { |
117 | m_input-> showInputMethod ( ); | 160 | m_input-> showInputMethod ( ); |
118 | } | 161 | } |
119 | 162 | ||
120 | void LoginWindowImpl::restart ( ) | 163 | void LoginWindowImpl::restart ( ) |
121 | { | 164 | { |
122 | qApp-> quit ( ); | 165 | qApp-> quit ( ); |
123 | } | 166 | } |
124 | 167 | ||
125 | void LoginWindowImpl::quit ( ) | 168 | void LoginWindowImpl::quit ( ) |
126 | { | 169 | { |
127 | lApp-> quitToConsole ( ); | 170 | lApp-> quitToConsole ( ); |
diff --git a/core/opie-login/loginwindowimpl.h b/core/opie-login/loginwindowimpl.h index e769b03..df8dbbb 100644 --- a/core/opie-login/loginwindowimpl.h +++ b/core/opie-login/loginwindowimpl.h | |||
@@ -18,44 +18,46 @@ | |||
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 | #ifndef __OPIE_LOGINWINDOW_IMPL_H__ | 28 | #ifndef __OPIE_LOGINWINDOW_IMPL_H__ |
29 | #define __OPIE_LOGINWINDOW_IMPL_H__ | 29 | #define __OPIE_LOGINWINDOW_IMPL_H__ |
30 | 30 | ||
31 | #include "loginwindow.h" | 31 | #include "loginwindow.h" |
32 | 32 | ||
33 | class InputMethods; | 33 | class InputMethods; |
34 | 34 | ||
35 | class LoginWindowImpl : public LoginWindow { | 35 | class LoginWindowImpl : public LoginWindow { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | LoginWindowImpl ( ); | 39 | LoginWindowImpl ( ); |
40 | virtual ~LoginWindowImpl ( ); | 40 | virtual ~LoginWindowImpl ( ); |
41 | 41 | ||
42 | protected slots: | 42 | protected slots: |
43 | void restart ( ); | 43 | void restart ( ); |
44 | void quit ( ); | 44 | void quit ( ); |
45 | void showIM ( ); | 45 | void showIM ( ); |
46 | void suspend ( ); | 46 | void suspend ( ); |
47 | void backlight ( ); | 47 | void backlight ( ); |
48 | void login ( ); | 48 | void login ( ); |
49 | void toggleEchoMode ( bool ); | 49 | void toggleEchoMode ( bool ); |
50 | void calcMaxWindowRect ( ); | ||
51 | void receive ( const QCString &, const QByteArray & ); | ||
50 | 52 | ||
51 | protected: | 53 | protected: |
52 | virtual void keyPressEvent ( QKeyEvent *e ); | 54 | virtual void keyPressEvent ( QKeyEvent *e ); |
53 | 55 | ||
54 | QStringList getAllUsers ( ); | 56 | QStringList getAllUsers ( ); |
55 | bool changeIdentity ( const char *user ); | 57 | bool changeIdentity ( const char *user ); |
56 | 58 | ||
57 | private: | 59 | private: |
58 | InputMethods *m_input; | 60 | InputMethods *m_input; |
59 | }; | 61 | }; |
60 | 62 | ||
61 | #endif | 63 | #endif |