
. So yeah good work!
| The Following 2 Users Say Thank You to sakya For This Useful Post: | ||

class LsUnlockButton : virtual public LsButton
{
Q_OBJECT
public:
LsUnlockButton(QString name="");
void applySettings();
void pressed();
void released();
void clicked();
private:
int m_Wait;
QTimer* m_Timer;
private slots:
void onTimer();
};
LsUnlockButton::LsUnlockButton(QString name) :
LsButton(name.isEmpty() ? "UnlockButton": name)
{
m_Timer = new QTimer(this);
applySettings();
}
void LsUnlockButton::applySettings()
{
m_Wait = getSetting("WaitTimeMsec", 1000).toInt();
m_Bkg = QPixmap(getSetting("BackGroundImage", ":/images/unlock.png").toString());
m_BkgPressed = QPixmap(getSetting("BackGroundImagePressed", ":/images/unlockPressed.png").toString());
m_BkgPressed = m_BkgPressed.scaled(m_Bkg.size());
setSizeAndPosition(m_Bkg.size(), QPoint(0, 0));
connect(m_Timer, SIGNAL(timeout()), this, SLOT(onTimer()));
}
void LsUnlockButton::pressed()
{
m_Timer->stop();
m_Timer->setInterval(m_Wait);
m_Timer->setSingleShot(true);
m_Timer->start();
}
void LsUnlockButton::clicked()
{
}
void LsUnlockButton::released()
{
m_Timer->stop();
}
void LsUnlockButton::onTimer()
{
qDebug() << "UnlockButton clicked";
mouseReleaseEvent(NULL);
#ifdef Q_WS_MAEMO_5
if (isUnderMouse()){
QDBusInterface lockScreen("com.nokia.mce", "/com/nokia/mce/request", "com.nokia.mce.request", QDBusConnection::systemBus(), this);
lockScreen.call("req_tklock_mode_change", "unlocked");
}
#else
if (isUnderMouse())
qApp->quit();
#endif
}
