×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Jun 2008
    Posts
    55

    my own icon for enabled/disabled appl only on the desktop of the device

    How to show my own icon for enabled and disabled my application only on the desktop of the device(i.e main page of the device)?

    I used the following code but here problem is i dont know the UID of the phone's desktop,if i dont provide the specific uid then the icon shows on every page which is not required.
    /////////////////////////////////////////////
    IndicatorIcon.cpp
    /////////////////////////////////////////////

    void CIndicatorIcon::ConstructL()
    {
    iWs.Connect();
    iMyWindowGroup = RWindowGroup(iCoeEnv->WsSession());
    User::LeaveIfError(iMyWindowGroup.Construct((TUint32)&iMyWindowGroup));

    iMyWindowGroup.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
    // iMyWindowGroup.SetOrdinalPosition(-1, ECoeWinPriorityNeverAtFront);

    iMyWindowGroup.EnableReceiptOfFocus(EFalse);
    iMyWindowGroup.EnableFocusChangeEvents();
    iMyWindowGroup.EnableGroupChangeEvents();
    CreateWindowL(&iMyWindowGroup);

    // by default setting the indicator icon to inactive
    SetIndicatorIconL();

    iFocusObserver = CFocusObserver::NewL(this, &iWs);

    ActivateL();

    iFocusObserver->StartL();

    }

    // ----------------------------------------------------------
    // CIndicatorIcon::~CIndicatorIcon()
    //
    // Destructor
    // ----------------------------------------------------------
    //
    CIndicatorIcon::~CIndicatorIcon()
    {
    if (iIndicator)
    {
    delete iIndicator;
    iIndicator = NULL;
    } // if (iIndicator)

    if (iIndicatorMask)
    {
    delete iIndicatorMask;
    iIndicatorMask = NULL;
    } // if (iIndicatorMask)

    iMyWindowGroup.Close();
    }

    // ---------------------------------------------------------
    // CIndicatorIcon::SetIndicatorIconL(TInt aIconType)
    //
    // Set the indicator icon.
    // ---------------------------------------------------------
    //
    void CIndicatorIcon::SetIndicatorIconL()
    {



    AknIconUtils::CreateIconL(iIndicator, iIndicatorMask, KSysIconFile,
    16384,16385);

    // Set size for the bitmap and mask
    AknIconUtils::SetSize(iIndicator, TSize(100,100));
    AknIconUtils::SetSize(iIndicatorMask, TSize(100,100));


    SetRect(TRect(TPoint(KIndicatorPosX, KIndicatorPosY),iIndicator->SizeInPixels()));

    DrawNow();

    }

    // ---------------------------------------------------------
    // CIndicatorIcon:raw(const TRect& aRect) const
    //
    // Draw function.
    // ---------------------------------------------------------
    //
    void CIndicatorIcon:raw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();

    gc.Clear();
    gc.SetBrushStyle(CGraphicsContext::ENullBrush);

    gc.BitBltMasked(TPoint(aRect.iTl.iX, aRect.iTl.iY), iIndicator, aRect, iIndicatorMask, ETrue);
    }

    ////////////////////////////////////////////
    FocusObserver.cpp
    ///////////////////////////////////////////
    void CFocusObserver::ConstructL() {
    CActiveScheduler::Add(this);
    iStatus = KErrNone;

    User::LeaveIfError(iWindowGroup.Construct((TUint32)this,EFalse));
    iWindowGroup.SetOrdinalPosition(-1, ECoeWinPriorityNeverAtFront);
    User::LeaveIfError(iWindowGroup.EnableFocusChangeEvents());
    User::LeaveIfError(iWindowGroup.EnableGroupChangeEvents());

    }

    void CFocusObserver::StartL() {
    iWs->EventReady(&iStatus);
    SetActive();
    }

    void CFocusObserver::RunL() {

    // Get the event from the window server session iWs
    TWsEvent wsEvent;
    iWs->GetEvent(wsEvent);
    // Get the event type: types are defined in TEventCode
    switch (wsEvent.Type()) {

    case EEventFocusGroupChanged :{
    #ifdef EKA2
    const TUid KUidStandBy = { 0x102750F0 };
    #else
    const TUid KUidStandBy = { 0x100058b3 };
    #endif

    // const TUid KUidStandBy = { 0x102750F0 };
    // const TUid KUidPhonebook = { 0x1000 };

    TInt wgid = iWs->GetFocusWindowGroup();
    CApaWindowGroupName* gn = CApaWindowGroupName::NewLC(*iWs, wgid);
    TUid uid = gn->AppUid();
    CleanupStack::PopAndDestroy(gn);

    iOnTopIcon->MakeVisible(/*(uid == KUidPhone)||*/ (uid == KUidStandBy));

    break;
    }
    }

    StartL();
    }

    void CFocusObserver:oCancel() {
    iWs->EventReadyCancel();
    }

    TInt CFocusObserver::RunError() {
    return KErrNone;
    }

  2. #2
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: my own icon for enabled/disabled appl only on the desktop of the device

    make corrections as per these info:
    3rd edition:

    const TUid KUidStandBy = { 0x101fd64c }; // For 3rd Edition and 3rd Edition FP1 devices
    const TUid KUidStandBy_FP2 = { 0x102750F0 }; //Emulator and 3rd Edition FP2 devices


    2nd edition:
    const TUid KUidPhone = { 0x100058b3 };
    Amit Kankani
    Nokia Developer Champion

  3. #3
    Regular Contributor
    Join Date
    Jun 2008
    Posts
    55

    Re: my own icon for enabled/disabled appl only on the desktop of the device

    Hi Amit,
    Thanks its working
    But one problem when i enabled first time the application icon shows in my application also which is correct,but when i go to my application and my app is enabled then icon does not show 2nd time.

  4. #4
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: my own icon for enabled/disabled appl only on the desktop of the device

    ur welcome

    can u post ur new code, may be i ll be able to help further
    Amit Kankani
    Nokia Developer Champion

Similar Threads

  1. Icon Size Problem..!!!
    By techietintu in forum Symbian C++
    Replies: 6
    Last Post: 2007-02-02, 05:08
  2. Device discovery for connected device
    By ilotsala in forum Bluetooth Technology
    Replies: 3
    Last Post: 2004-07-21, 08:03
  3. Can't find application icon on device
    By vinod_shelke in forum Symbian C++
    Replies: 1
    Last Post: 2004-04-21, 12:46
  4. MIDP icon on desktop?
    By sslo0 in forum Mobile Java General
    Replies: 2
    Last Post: 2003-02-18, 05:11
  5. device name is still not changing?.why nobody is replying back
    By amitagrawal78 in forum Bluetooth Technology
    Replies: 0
    Last Post: 2002-10-18, 13:17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •