securitydialogs/Autolock/src/main.cpp
changeset 38 e0432375ea67
parent 26 aad866c37519
child 45 5d3e34b7618a
equal deleted inserted replaced
37:7bad16cccaca 38:e0432375ea67
    22 // #include "xqservicelog.h"
    22 // #include "xqservicelog.h"
    23 #include <QDebug>
    23 #include <QDebug>
    24 
    24 
    25 #include <QApplication>
    25 #include <QApplication>
    26 #include "Autolock.h"
    26 #include "Autolock.h"
       
    27 #include "../PubSub/securityuisprivatepskeys.h"
    27 
    28 
    28 #include <hbapplication.h>
    29 #include <hbapplication.h>
    29 #include <hbmainwindow.h>
    30 #include <hbmainwindow.h>
    30 
    31 
    31 int main(int argc, char **argv)
    32 int main(int argc, char **argv)
    32 {
    33 {
    33     // qInstallMsgHandler(XQSERVICEMESSAGEHANDLER);
    34     // qInstallMsgHandler(XQSERVICEMESSAGEHANDLER);
    34     // XQSERVICE_DEBUG_PRINT(" ================== xxxx Autolock::main");
    35     // XQSERVICE_DEBUG_PRINT(" ================== xxxx Autolock::main");
    35     qDebug() << "================== xxxx QApplication Autolock::main";
    36     qDebug() << "================== xxxx QApplication Autolock::main";
       
    37     
       
    38     
       
    39     // Need to check whether process is already running. This happens if it's started from Stater, and 
       
    40     // before fully initialized, it's started by API through QtHighway
       
    41     TSecurityPolicy readPolicy(ECapabilityReadDeviceData);
       
    42     TSecurityPolicy writePolicy(ECapabilityWriteDeviceData);
       
    43     int ret = RProperty::Define(KPSUidSecurityUIs,
       
    44             KSecurityUIsLockInitiatorUID, RProperty::EInt, readPolicy,
       
    45             writePolicy);
       
    46 		qDebug() << "KSecurityUIsLockInitiatorUID ret=" << ret;
       
    47 		int err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, 0);
       
    48 
       
    49     // it takes about 3 seconds to start it, on device
    36     QApplication a( argc, argv );
    50     QApplication a( argc, argv );
    37     Autolock *cl = new Autolock();
    51     Autolock *cl = new Autolock();
    38     // qDebug() << " ================== xxxx cl->show";
    52     // qDebug() << " Autolock::main cl->show";
    39     // cl->show();
    53     // cl->show();
    40     // qDebug() << " ================== xxxx cl->hide";
    54     // qDebug() << " Autolock::main cl->hide";
    41     cl->hide();
    55     cl->hide();
    42     // qDebug() << " ================== xxxx cl->lower";
    56     // qDebug() << " Autolock::main cl->lower";
    43     cl->lower();
    57     cl->lower();
       
    58     qDebug() << " Autolock::main cl->lower";
       
    59     err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, 1);
    44     int rv = a.exec();
    60     int rv = a.exec();
       
    61     qDebug() << " Autolock::main cl->exec";
    45     delete cl;
    62     delete cl;
       
    63     qDebug() << " Autolock::main cl->delete";
    46     return rv;
    64     return rv;
    47 }
    65 }
    48 
    66