示例#1
0
void OsSpecific::SetRights()
{
    // Qt uses permissions in HEX while OS's in 8-based !

//	SetChmod("744", PathHelper::Instance()->UpScriptPfn());				// chown need not
//	SetChmod("744", PathHelper::Instance()->DownScriptPfn());			// chown need not

    // will ask for elevated rights inside
#ifdef Q_OS_MAC

    SetChmod("04755", PathHelper::Instance()->UpScriptPfn());
    SetChown(PathHelper::Instance()->UpScriptPfn());

    SetChmod("04755", PathHelper::Instance()->DownScriptPfn());
    SetChown(PathHelper::Instance()->DownScriptPfn());

    // TODO: -0 will be gone once launcher be rewritten to execv()
    SetChmod("04755", PathHelper::Instance()->OpenvpnPathfilename());		 // 04755 for running up/down script with sudo enabled
    SetChown(PathHelper::Instance()->OpenvpnPathfilename());
    SetChmod("04755", PathHelper::Instance()->LauncherPfn());
    SetChown(PathHelper::Instance()->LauncherPfn());
#endif		// Q_OS_MAC

#ifdef Q_OS_LINUX
    SetChown(PathHelper::Instance()->LauncherPfn());
    SetChmod("04755", PathHelper::Instance()->LauncherPfn());				// odrer is important
#endif

    ReleaseRights();

    QThread::msleep(200);		// HACK: -1 wait till file system changes become effective
}
// ---------------------------------------------------------
// CUniDrmInfo::CUniDrmInfo
//
// Destructor.
// ---------------------------------------------------------
//
CUniDrmInfo::~CUniDrmInfo()
    {
    ReleaseRights();
    delete iDRMHelper;

#ifdef DRMCOMMONIN_POISTO
    delete iRightsManager;
#else
    delete iDRMCommon;
#endif

    delete iSendContentUrl;
    }
// ---------------------------------------------------------
// CUniDrmInfo::ConsumeRights
// ---------------------------------------------------------
//
EXPORT_C TInt CUniDrmInfo::ConsumeRights()
    {
//    UNILOGGER_ENTERFN( "CUniDrmInfo::ConsumeRights" );

    TInt err( KErrNone );
    if ( ( iMediaInfo.MediaType() == EMsgMediaAudio ||
           ( iMediaInfo.MediaType() != EMsgMediaAudio &&
             iDRMExpiration == CDRMRights::EValidRights ) ) &&
         iDRMConsumeStatus != EUniDRMConsumed )
        {
        if ( iDRMConsumeCount )
            {
            //UNILOGGER_WRITE( "Rights freezed" );

            // Already once consumed. Freeze is enough!
            FreezeRights();
            }
        else
            {
            if ( iDRMConsumeStatus == EUniDRMFrozen )
                {
                //UNILOGGER_WRITE( "Rights released" );

                ReleaseRights();
                }

            err = iDRMHelper->Consume2( iMediaInfo.DRMContentURI()->Des(),
                                        ConsumeIntent(),
                                        CDRMHelper::EStart );

            if ( !err )
                {
                //UNILOGGER_WRITE( "Rights consumed" );

                iDRMConsumeStatus = EUniDRMConsumed;
                iDRMConsumeCount++;
                }
            }
        }
    // else - never consume for preview

    //UNILOGGER_WRITEF( _L("Result: %d"), err );
    //UNILOGGER_LEAVEFN( "CUniDrmInfo::ConsumeRights" );

    return err;
    }