author | zecke <zecke> | 2005-03-06 13:51:06 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-03-06 13:51:06 (UTC) |
commit | fe51b2ed0ec3bccbcac880623123d2abc5d71a4e (patch) (unidiff) | |
tree | 43d81f88823b8610c906d97418895379e45f7ae8 /libopie2 | |
parent | b9360499c5f84ab53e080861e0292a70e446f5e4 (diff) | |
download | opie-fe51b2ed0ec3bccbcac880623123d2abc5d71a4e.zip opie-fe51b2ed0ec3bccbcac880623123d2abc5d71a4e.tar.gz opie-fe51b2ed0ec3bccbcac880623123d2abc5d71a4e.tar.bz2 |
Do not switch mode in the eventFilter when we're forced into one mode
(alwin thank you for noticing)
-rw-r--r-- | libopie2/opieui/big-screen/owidgetstack.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opieui/big-screen/owidgetstack.cpp b/libopie2/opieui/big-screen/owidgetstack.cpp index b14a643..00194b4 100644 --- a/libopie2/opieui/big-screen/owidgetstack.cpp +++ b/libopie2/opieui/big-screen/owidgetstack.cpp | |||
@@ -1,51 +1,51 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2003 hOlgAr <zecke@handhelds.org> | 3 | .=l. Copyright (c) 2003,2004,2005 Holger Hans Peter Freyther <zecke@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library 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 Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library 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 library is distributed in the hope that | 12 | .i_,=:_. -<s. This library 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 | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "owidgetstack.h" | 29 | #include "owidgetstack.h" |
30 | 30 | ||
31 | /* OPIE */ | 31 | /* OPIE */ |
32 | #include <opie2/odebug.h> | 32 | #include <opie2/odebug.h> |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | #include <qwidgetstack.h> | 36 | #include <qwidgetstack.h> |
37 | 37 | ||
38 | namespace Opie { | 38 | namespace Opie { |
39 | namespace Ui { | 39 | namespace Ui { |
40 | const int mode_size = 330; | 40 | const int mode_size = 330; |
41 | 41 | ||
42 | 42 | ||
43 | 43 | ||
44 | /** | 44 | /** |
45 | * This is the standard widget. For simple usage see the example. Normally this widget | 45 | * This is the standard widget. For simple usage see the example. Normally this widget |
46 | * is the central widget of a QMainWindow. | 46 | * is the central widget of a QMainWindow. |
47 | * Use removeWidget before you delete a widget yourself. OWidgetStack does not | 47 | * Use removeWidget before you delete a widget yourself. OWidgetStack does not |
48 | * yet recognize removal of children. | 48 | * yet recognize removal of children. |
49 | * | 49 | * |
50 | * @param parent The parent widget. It maybe 0 but then you need to take care of deletion. | 50 | * @param parent The parent widget. It maybe 0 but then you need to take care of deletion. |
51 | * Or you use QPEApplication::showMainWidget(). | 51 | * Or you use QPEApplication::showMainWidget(). |
@@ -265,97 +265,97 @@ void OWidgetStack::raiseWidget( int id) { | |||
265 | /** | 265 | /** |
266 | * This is an overloaded function and only differs in its parameters. | 266 | * This is an overloaded function and only differs in its parameters. |
267 | * @see raiseWidget( int ) | 267 | * @see raiseWidget( int ) |
268 | */ | 268 | */ |
269 | void OWidgetStack::raiseWidget( QWidget* wid) { | 269 | void OWidgetStack::raiseWidget( QWidget* wid) { |
270 | m_last = wid; | 270 | m_last = wid; |
271 | if (m_mode == SmallScreen ) | 271 | if (m_mode == SmallScreen ) |
272 | m_stack->raiseWidget( wid ); | 272 | m_stack->raiseWidget( wid ); |
273 | else { | 273 | else { |
274 | int ide; | 274 | int ide; |
275 | emit aboutToShow( wid ); | 275 | emit aboutToShow( wid ); |
276 | /* if someone is connected and the widget is actually available */ | 276 | /* if someone is connected and the widget is actually available */ |
277 | if ( receivers( SIGNAL(aboutToShow(int) ) ) && | 277 | if ( receivers( SIGNAL(aboutToShow(int) ) ) && |
278 | ( (ide = id( wid ) ) != -1 ) ) | 278 | ( (ide = id( wid ) ) != -1 ) ) |
279 | emit aboutToShow( ide ); | 279 | emit aboutToShow( ide ); |
280 | 280 | ||
281 | /* ### FIXME PLACE THE WIDGET right */ | 281 | /* ### FIXME PLACE THE WIDGET right */ |
282 | wid->show(); | 282 | wid->show(); |
283 | } | 283 | } |
284 | } | 284 | } |
285 | 285 | ||
286 | /** | 286 | /** |
287 | * This will hide the currently visible widget | 287 | * This will hide the currently visible widget |
288 | * and raise the widget specified by the parameter. | 288 | * and raise the widget specified by the parameter. |
289 | * Note that this method does not use visibleWIdget but remembers | 289 | * Note that this method does not use visibleWIdget but remembers |
290 | * the last raisedWidget | 290 | * the last raisedWidget |
291 | */ | 291 | */ |
292 | void OWidgetStack::hideWidget( int id) { | 292 | void OWidgetStack::hideWidget( int id) { |
293 | /* hiding our main widget wouldn't be smart */ | 293 | /* hiding our main widget wouldn't be smart */ |
294 | if ( m_mode == BigScreen && m_last != m_mWidget ) | 294 | if ( m_mode == BigScreen && m_last != m_mWidget ) |
295 | m_last->hide(); | 295 | m_last->hide(); |
296 | raiseWidget( id ); | 296 | raiseWidget( id ); |
297 | } | 297 | } |
298 | 298 | ||
299 | /** | 299 | /** |
300 | * This is overloaded and only differs in the parameters | 300 | * This is overloaded and only differs in the parameters |
301 | * it takes. | 301 | * it takes. |
302 | */ | 302 | */ |
303 | void OWidgetStack::hideWidget( QWidget* wid) { | 303 | void OWidgetStack::hideWidget( QWidget* wid) { |
304 | /* still not smart */ | 304 | /* still not smart */ |
305 | if ( m_mode == BigScreen && m_last != m_mWidget ) | 305 | if ( m_mode == BigScreen && m_last != m_mWidget ) |
306 | m_last->hide(); | 306 | m_last->hide(); |
307 | 307 | ||
308 | raiseWidget( wid ); | 308 | raiseWidget( wid ); |
309 | } | 309 | } |
310 | 310 | ||
311 | 311 | ||
312 | bool OWidgetStack::eventFilter( QObject* obj, QEvent* e) { | 312 | bool OWidgetStack::eventFilter( QObject* obj, QEvent* e) { |
313 | if ( e->type() == QEvent::Resize ) { | 313 | if ( e->type() == QEvent::Resize && !m_forced ) { |
314 | QResizeEvent *res = static_cast<QResizeEvent*>( e ); | 314 | QResizeEvent *res = static_cast<QResizeEvent*>( e ); |
315 | QSize size = res->size(); | 315 | QSize size = res->size(); |
316 | if ( size.width() >= mode_size ) | 316 | if ( size.width() >= mode_size ) |
317 | switchTop(); | 317 | switchTop(); |
318 | else | 318 | else |
319 | switchStack(); | 319 | switchStack(); |
320 | } | 320 | } |
321 | return false; | 321 | return false; |
322 | } | 322 | } |
323 | 323 | ||
324 | 324 | ||
325 | /** | 325 | /** |
326 | * @internal_resons | 326 | * @internal_resons |
327 | */ | 327 | */ |
328 | void OWidgetStack::resizeEvent( QResizeEvent* ev ) { | 328 | void OWidgetStack::resizeEvent( QResizeEvent* ev ) { |
329 | QFrame::resizeEvent( ev ); | 329 | QFrame::resizeEvent( ev ); |
330 | if (m_mode == SmallScreen ) | 330 | if (m_mode == SmallScreen ) |
331 | m_stack->setGeometry( frameRect() ); | 331 | m_stack->setGeometry( frameRect() ); |
332 | else | 332 | else |
333 | if (m_mWidget ) | 333 | if (m_mWidget ) |
334 | m_mWidget->setGeometry( frameRect() ); | 334 | m_mWidget->setGeometry( frameRect() ); |
335 | 335 | ||
336 | } | 336 | } |
337 | 337 | ||
338 | /** | 338 | /** |
339 | * setMainWindow gives the OWidgetStack a hint which | 339 | * setMainWindow gives the OWidgetStack a hint which |
340 | * window should always stay inside the stack. | 340 | * window should always stay inside the stack. |
341 | * Normally the first added widget is considered to be | 341 | * Normally the first added widget is considered to be |
342 | * the mainwindow but you can change this with this | 342 | * the mainwindow but you can change this with this |
343 | * function. | 343 | * function. |
344 | * If in BigScreen mode the current mainwindow will be reparented | 344 | * If in BigScreen mode the current mainwindow will be reparented |
345 | * and hidden. The position will be taken by the new one. | 345 | * and hidden. The position will be taken by the new one. |
346 | * If the old MainWindow was hidden the new window will | 346 | * If the old MainWindow was hidden the new window will |
347 | * also be hidden. If the window was visible the new mainwindow | 347 | * also be hidden. If the window was visible the new mainwindow |
348 | * will be made visible too and the old one hidden. If there | 348 | * will be made visible too and the old one hidden. If there |
349 | * was no mainwindow it will be hidden as well. | 349 | * was no mainwindow it will be hidden as well. |
350 | * | 350 | * |
351 | * @param wid The new mainwindow | 351 | * @param wid The new mainwindow |
352 | */ | 352 | */ |
353 | void OWidgetStack::setMainWindow( QWidget* wid ) { | 353 | void OWidgetStack::setMainWindow( QWidget* wid ) { |
354 | if (m_mode == BigScreen ) { | 354 | if (m_mode == BigScreen ) { |
355 | bool wasVisible = false; | 355 | bool wasVisible = false; |
356 | if (m_mWidget ) { | 356 | if (m_mWidget ) { |
357 | wasVisible = !m_mWidget->isHidden(); | 357 | wasVisible = !m_mWidget->isHidden(); |
358 | /* hidden by default */ | 358 | /* hidden by default */ |
359 | m_mWidget->reparent(0, WType_TopLevel, QPoint(10, 10) ); | 359 | m_mWidget->reparent(0, WType_TopLevel, QPoint(10, 10) ); |
360 | } | 360 | } |
361 | wid->reparent(this, 0, frameRect().topLeft() ); | 361 | wid->reparent(this, 0, frameRect().topLeft() ); |