contentstorage/caclient/stub/src/caobjectadapter.cpp
changeset 85 7feec50967db
child 86 e492551a0d54
equal deleted inserted replaced
4:1a2a00e78665 85:7feec50967db
       
     1     /*
       
     2  * Copyright (c)2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:  ?Description
       
    15  *
       
    16  */
       
    17 
       
    18 #include <cadefs.h>
       
    19 
       
    20 #include "caobjectadapter.h"
       
    21 #include "caentry.h"
       
    22 #include "caicondescription.h"
       
    23 
       
    24 
       
    25 //----------------------------------------------------------------------------
       
    26 //
       
    27 //----------------------------------------------------------------------------
       
    28 QPixmap CaObjectAdapter::makeIcon(const CaEntry &entry, const QSize &size)
       
    29 {
       
    30     QPixmap icon;
       
    31     if (!entry.iconDescription().filename().isEmpty()) {
       
    32         icon = QPixmap(entry.iconDescription().filename()).scaled(size);
       
    33     }
       
    34     if (icon.isNull()) {
       
    35         if (entry.role() == GroupEntryRole) {
       
    36             icon = QPixmap("./resource/folder.png").scaled(size);
       
    37         }
       
    38         else {
       
    39             icon = QPixmap("./resource/application.png").scaled(size);
       
    40         }
       
    41     }
       
    42     return icon;
       
    43 }
       
    44 
       
    45 //----------------------------------------------------------------------------
       
    46 //
       
    47 //----------------------------------------------------------------------------
       
    48 void CaObjectAdapter::setId(CaEntry &entry,
       
    49     int id)
       
    50 {
       
    51     entry.setId(id);
       
    52 }
       
    53 
       
    54 //----------------------------------------------------------------------------
       
    55 //
       
    56 //----------------------------------------------------------------------------
       
    57 void CaObjectAdapter::setId(CaIconDescription &iconDescription,
       
    58     int id)
       
    59 {
       
    60     iconDescription.setId(id);
       
    61 }
       
    62