// UniBioMessageDataPlugin::attachmentList()
// @see header
//---------------------------------------------------------------
UniMessageInfoList UniBioMessageDataPlugin::attachmentList()
{
    RFile file;
    QT_TRAP_THROWING(file = d_ptr->attachmentL());

    if(attachmentCount() == 0)
    {
        file.Close();
        return QList<UniMessageInfo*> ();
    }
     
    UniMessageInfoList attlist;

    QString path;
    QString mimetype;
    int size = 0;

    TFileName fullName;
    qt_symbian_throwIfError(file.FullName(fullName));
    qt_symbian_throwIfError(file.Size(size));

    path = XQConversions::s60DescToQString(*fullName.AllocL());

    UniMessageInfo *msgobj = new UniMessageInfo(path, size, mimetype);
    attlist << msgobj;
    file.Close();
    return attlist;
}
Beispiel #2
0
 QWaitConditionPrivate()
 : waiters(0), wakeups(0)
 {
     qt_symbian_throwIfError(mutex.CreateLocal());
     int err = cond.CreateLocal();
     if (err != KErrNone) {
         mutex.Close();
         qt_symbian_throwIfError(err);
     }
 }
 QIdleDetectorThread()
 : m_state(STATE_RUN), m_stop(false)
 {
     qt_symbian_throwIfError(m_lock.CreateLocal(0));
     TInt err = m_idleDetectorThread.Create(KNullDesC(), &idleDetectorThreadFunc, 1024, NULL, this);
     if (err != KErrNone)
         m_lock.Close();
     qt_symbian_throwIfError(err);
     m_idleDetectorThread.SetPriority(EPriorityAbsoluteBackgroundNormal);
     m_idleDetectorThread.Resume();
 }
Beispiel #4
0
QSymbianSocketManager::QSymbianSocketManager() :
    iNextSocket(0), iDefaultConnection(0)
{
    TSessionPref preferences;
    // ### In future this could be changed to KAfInet6 when that is more common than IPv4
    preferences.iAddrFamily = KAfInet;
    preferences.iProtocol = KProtocolInetIp;
    //use global message pool, as we do not know how many sockets app will use
    //TODO: is this the right choice?
    qt_symbian_throwIfError(iSocketServ.Connect(preferences, -1));
    qt_symbian_throwIfError(iSocketServ.ShareAuto());
}
void MsgAudioSelectionEngine::LeaveIfSessionClosedL()
    {
    if (!iSession || !iSessionOpen)
        {
        qt_symbian_throwIfError (KErrDisconnected);
        }
    }
PhoneUiHouseHoldPrivate::PhoneUiHouseHoldPrivate(HbMainWindow &window) :
    iAppsReady (0), iStartupSignalRecoveryId (0), iLightIdleReached (EFalse), 
    iPhoneUIController (0), m_window (window)
{
    PHONE_DEBUG("phoneui - Start phoneapp");
    
    TRAPD( error, ConstructL() );
    qt_symbian_throwIfError(error);
}
Beispiel #7
0
QT_BEGIN_NAMESPACE


QMutexPrivate::QMutexPrivate(QMutex::RecursionMode mode)
    : QMutexData(mode), maximumSpinTime(MaximumSpinTimeThreshold), averageWaitTime(0), owner(0), count(0)
{
    int r = lock.CreateLocal(0);
    if (r != KErrNone)
        qWarning("QMutex: failed to create lock, error %d", r);
    qt_symbian_throwIfError(r);
}
Beispiel #8
0
 QS60RFsSession() {
     qt_symbian_throwIfError(iFs.Connect());
     qt_symbian_throwIfError(iFs.ShareProtected());
     //BC with 4.7: create private path on system drive
     TInt sysdrive = iFs.GetSystemDrive();
     TInt err = iFs.CreatePrivatePath(sysdrive);
     if (err != KErrNone && err != KErrAlreadyExists)
         qWarning("Failed to create private path on system drive.");
     TFileName pfn = RProcess().FileName();
     TInt drive;
     if (pfn.Length() > 0 && iFs.CharToDrive(pfn[0], drive) == KErrNone) {
         //BC with 4.7: create private path on application drive (except rom or system drive which is done above)
         if (drive != sysdrive && drive != EDriveZ) {
             err = iFs.CreatePrivatePath(drive);
             if (err != KErrNone && err != KErrAlreadyExists)
                 qWarning("Failed to create private path on application drive.");
         }
         //BC with 4.7: set working directory to same drive as application
         iFs.SetSessionToPrivate(drive);
     }
 }
CMdEPropertyDef& MsgAudioSelectionEngine::PropertyDefL(CMdESession* aSession,
        TInt aAttr)
    {
    CMdENamespaceDef& defNS = aSession->GetDefaultNamespaceDefL();

    CMdEObjectDef& objectDef = defNS.GetObjectDefL(
            MdeConstants::Audio::KAudioObject);

    if (aAttr == EAttrFileSize)
        {
        return objectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty);
        }
    else if (aAttr == EAttrMediaType)
        {
        return objectDef.GetPropertyDefL(
                MdeConstants::Object::KItemTypeProperty);
        }
    else if (aAttr == EAttrSongName || aAttr == EAttrFileName)
        {
        return objectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty);
        }
    else if (aAttr == EAttrArtist)
        {
        return objectDef.GetPropertyDefL(
                MdeConstants::MediaObject::KArtistProperty);
        }
    else if (aAttr == EAttrAlbum)
        {
        return objectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumProperty);
        }
    else if (aAttr == EAttrGenre)
        {
        return objectDef.GetPropertyDefL(
                MdeConstants::MediaObject::KGenreProperty);
        }
    else if (aAttr == EAttrComposer)
        {
        return objectDef.GetPropertyDefL(
                MdeConstants::Audio::KComposerProperty);
        }
    else
        {
        qt_symbian_throwIfError(KErrNotSupported);
        }

    return objectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty);
    }
Beispiel #10
0
QS60WindowSurface::QS60WindowSurface(QWidget* widget)
    : QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate)
{
    QWidgetPrivate *widgetPrivate = qt_widget_private(widget);
    const bool opaque = widgetPrivate->isOpaque && !blitWriteAlpha(widgetPrivate);
    TDisplayMode mode = displayMode(opaque);
    // We create empty CFbsBitmap here -> it will be resized in setGeometry
    CFbsBitmap *bitmap = new CFbsBitmap;	// CBase derived object needs check on new
    Q_CHECK_PTR(bitmap);
    qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) );

    QSymbianRasterPixmapData *data = new QSymbianRasterPixmapData(QPixmapData::PixmapType);
    if (data) {
        data->fromSymbianBitmap(bitmap, true);
        d_ptr->device = QPixmap(data);
    }
}
Beispiel #11
0
/*
 * Loads a single cursor shape from resources and appends it to a native sprite.
 * Animated cursors (e.g. the busy cursor) have multiple members.
 */
void QCursorData::loadShapeFromResource(RWsSpriteBase& target, QString resource, int hx, int hy, int interval)
{
    QPixmap pix;
    CFbsBitmap* native;
    QScopedPointer<TSpriteMember> member(new TSpriteMember);
    member->iInterval = interval;
    member->iInvertMask = false;
    member->iMaskBitmap = 0; // all shapes are RGBA
    member->iDrawMode = CGraphicsContext::EDrawModePEN;
    member->iOffset = TPoint(-hx, -hy);
    QString res(QLatin1String(":/trolltech/symbian/cursors/images/%1.png"));
    pix.load(res.arg(resource));
    native = pix.toSymbianCFbsBitmap();
    member->iBitmap = native;
    qt_symbian_throwIfError(nativeSpriteMembers.Append(member.data()));
    target.AppendMember(*(member.take()));
}
void QTimerActiveObject::Start()
{
    CActiveScheduler::Add(this);
    m_timerInfo->msLeft = m_timerInfo->interval;
    if (m_timerInfo->interval > 0) {
        if (!m_rTimer.Handle()) {
            qt_symbian_throwIfError(m_rTimer.CreateLocal());
        }
        m_timeoutTimer.start();
        m_expectedTimeSinceLastEvent = 0;
        StartTimer();
    } else {
        iStatus = KRequestPending;
        SetActive();
        TRequestStatus *status = &iStatus;
        QEventDispatcherSymbian::RequestComplete(status, KErrNone);
    }
}
Beispiel #13
0
/*
 * Common code between the sprite workaround and standard modes of operation.
 * RWsSpriteBase is the base class for both RWsSprite and RWsPointerCursor.
 * It is called from both handle() and qt_s60_show_pointer_sprite()
 */
void QCursorData::constructCursorSprite(RWsSpriteBase& target)
{
    int count = nativeSpriteMembers.Count();
    if (count) {
        // already constructed
        for (int i = 0; i < count; i++)
            target.AppendMember(*(nativeSpriteMembers[i]));

        return;
    }
    if (pixmap.isNull() && !bm) {
#ifndef Q_SYMBIAN_HAS_SYSTEM_CURSORS
        //shape cursor
        constructShapeSprite(target);
#endif
        return;
    }
    QScopedPointer<TSpriteMember> member(new TSpriteMember);
    if (pixmap.isNull()) {
        //construct mono cursor
        member->iBitmap = bm->toSymbianCFbsBitmap();
        member->iMaskBitmap = bmm->toSymbianCFbsBitmap();
    }
    else {
        //construct normal cursor
        member->iBitmap = pixmap.toSymbianCFbsBitmap();
        if (pixmap.hasAlphaChannel()) {
            member->iMaskBitmap = 0; //use alpha blending
        }
        else if (pixmap.hasAlpha()) {
            member->iMaskBitmap = pixmap.mask().toSymbianCFbsBitmap();
        }
        else {
            member->iMaskBitmap = 0; //opaque rectangle cursor (due to EDrawModePEN)
        }
    }

    member->iDrawMode = CGraphicsContext::EDrawModePEN;
    member->iInvertMask = EFalse;
    member->iInterval = 0;
    member->iOffset = TPoint(-(hx), -(hy)); //Symbian hotspot coordinates are negative
    qt_symbian_throwIfError(nativeSpriteMembers.Append(member.data()));
    target.AppendMember(*(member.take()));
}
QS60WindowSurface::QS60WindowSurface(QWidget* widget)
    : QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate)
{

    TDisplayMode mode = S60->screenDevice()->DisplayMode();
    bool isOpaque = qt_widget_private(widget)->isOpaque;
    if (mode == EColor16MA && isOpaque)
        mode = EColor16MU; // Faster since 16MU -> 16MA is typically accelerated
    else if (mode == EColor16MU && !isOpaque)
        mode = EColor16MA; // Try for transparency anyway

    // We create empty CFbsBitmap here -> it will be resized in setGeometry
	CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap);	// CBase derived object needs check on new
    qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) );
	
    QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType);
    data->fromSymbianBitmap(bitmap);
    d_ptr->device = QPixmap(data);
        
    setStaticContentsSupport(true);
}
Beispiel #15
0
 QS60RFsSession() {
     qt_symbian_throwIfError(iFs.Connect());
     qt_symbian_throwIfError(iFs.ShareProtected());
 }
Beispiel #16
0
static void set_thread_data(QThreadData *data)
{
    qt_symbian_throwIfError(Dll::SetTls(data));
}
DirChecker::DirChecker()
{
    qt_symbian_throwIfError(rfs.Connect());
}
Beispiel #18
0
static void init_symbian_thread_handle(RThread &thread)
{
    thread = RThread();
    TThreadId threadId = thread.Id();
    qt_symbian_throwIfError(thread.Open(threadId, EOwnerProcess));
}