![]() |
Home · All Namespaces · All Classes |
00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (directui@nokia.com) 00006 ** 00007 ** This file is part of systemui. 00008 ** 00009 ** If you have questions regarding the use of this file, please contact 00010 ** Nokia at directui@nokia.com. 00011 ** 00012 ** This library is free software; you can redistribute it and/or 00013 ** modify it under the terms of the GNU Lesser General Public 00014 ** License version 2.1 as published by the Free Software Foundation 00015 ** and appearing in the file LICENSE.LGPL included in the packaging 00016 ** of this file. 00017 ** 00018 ****************************************************************************/ 00019 #include "lockscreenbusinesslogic.h" 00020 #include "lockscreenwindow.h" 00021 #include "eventeater.h" 00022 #include "closeeventeater.h" 00023 00024 LockScreenBusinessLogic::LockScreenBusinessLogic(QObject* parent) : 00025 QObject(parent), 00026 lockScreenWindow(new LockScreenWindow), 00027 eventEaterWindow(new EventEater) 00028 { 00029 // Install a close event eater for the windows 00030 CloseEventEater *closeEventEater = new CloseEventEater(this); 00031 lockScreenWindow->installEventFilter(closeEventEater); 00032 eventEaterWindow->installEventFilter(closeEventEater); 00033 00034 connect(lockScreenWindow, SIGNAL(unlocked()), this, SLOT(unlockScreen())); 00035 connect(lockScreenWindow, SIGNAL(unlocked()), this, SIGNAL(unlockConfirmed())); 00036 00037 // Hide the event eater when it is clicked 00038 connect(eventEaterWindow, SIGNAL(inputEventReceived()), this, SLOT(hideEventEater())); 00039 00040 #ifdef HAVE_QMSYSTEM 00041 connect(&displayState, SIGNAL(displayStateChanged(MeeGo::QmDisplayState::DisplayState)), this, SLOT(displayStateChanged(MeeGo::QmDisplayState::DisplayState))); 00042 connect(&locks, SIGNAL(stateChanged(MeeGo::QmLocks::Lock, MeeGo::QmLocks::State)), this, SLOT(locksChanged(MeeGo::QmLocks::Lock, MeeGo::QmLocks::State))); 00043 #endif 00044 00045 } 00046 00047 LockScreenBusinessLogic::~LockScreenBusinessLogic() 00048 { 00049 delete lockScreenWindow; 00050 delete eventEaterWindow; 00051 } 00052 00053 void LockScreenBusinessLogic::unlockScreen() 00054 { 00055 toggleScreenLockUI(false); 00056 } 00057 00058 #ifdef HAVE_QMSYSTEM 00059 void LockScreenBusinessLogic::displayStateChanged(MeeGo::QmDisplayState::DisplayState state) 00060 { 00061 // When the screen is unlocked, the lockscreen is visible the lock screen needs to be reset 00062 if (state == MeeGo::QmDisplayState::On && lockScreenWindow->isVisible()) { 00063 lockScreenWindow->reset(); 00064 lockScreenWindow->setFocus(); 00065 } 00066 } 00067 #endif 00068 00069 void LockScreenBusinessLogic::hideEventEater() 00070 { 00071 toggleEventEater(false); 00072 } 00073 00074 void LockScreenBusinessLogic::toggleScreenLockUI(bool toggle) 00075 { 00076 if (toggle) { 00077 // Whenever we're showing the lock screen we need to reset its state 00078 lockScreenWindow->reset(); 00079 00080 if (!lockScreenWindow->isVisible()) { 00081 lockScreenWindow->show(); 00082 } 00083 00084 lockScreenWindow->raise(); 00085 } else { 00086 if (lockScreenWindow->isVisible()) { 00087 lockScreenWindow->hide(); 00088 } 00089 } 00090 } 00091 00092 void LockScreenBusinessLogic::toggleEventEater(bool toggle) 00093 { 00094 if (toggle) { 00095 if (!eventEaterWindow->isVisible()) { 00096 eventEaterWindow->show(); 00097 eventEaterWindow->showFullScreen(); 00098 } 00099 } else { 00100 if (eventEaterWindow->isVisible()) { 00101 eventEaterWindow->hide(); 00102 } 00103 } 00104 } 00105 00106 bool LockScreenBusinessLogic::displayIsOn() 00107 { 00108 #if !defined(__i386__) && defined(HAVE_QMSYSTEM) 00109 return displayState.get() == MeeGo::QmDisplayState::On; 00110 #else 00111 return true; 00112 #endif 00113 } 00114 00115 #if HAVE_QMSYSTEM 00116 void LockScreenBusinessLogic::locksChanged(MeeGo::QmLocks::Lock what, MeeGo::QmLocks::State how) 00117 { 00118 if (what == MeeGo::QmLocks::TouchAndKeyboard) { 00119 switch (how) { 00120 case MeeGo::QmLocks::Locked: 00121 emit screenIsLocked(true); 00122 break; 00123 default: 00124 emit screenIsLocked(false); 00125 break; 00126 } 00127 } 00128 } 00129 #endif
| Copyright © 2010 Nokia Corporation | Generated on Wed Nov 10 16:04:51 2010 Doxygen 1.6.1 |
MeeGo Touch |
