apengine/apeng/src/ApListItem.cpp
changeset 66 ed07dcc72692
parent 0 5a93021fdf25
equal deleted inserted replaced
64:84c6623982f6 66:ed07dcc72692
    32 // CApListItem::NewLC
    32 // CApListItem::NewLC
    33 // ---------------------------------------------------------
    33 // ---------------------------------------------------------
    34 //
    34 //
    35 EXPORT_C CApListItem* CApListItem::NewLC()
    35 EXPORT_C CApListItem* CApListItem::NewLC()
    36     {
    36     {
    37     CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
    37     return NULL;
    38 
       
    39     CApListItem* db = new( ELeave ) CApListItem;
       
    40     CleanupStack::PushL( db );
       
    41     db->ConstructL();
       
    42 
       
    43     CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
       
    44     return db;
       
    45     }
    38     }
    46 
    39 
    47 
    40 
    48 // ---------------------------------------------------------
    41 // ---------------------------------------------------------
    49 // CApListItem::NewLC
    42 // CApListItem::NewLC
    55                                         TUint32 aUid,
    48                                         TUint32 aUid,
    56                                         const TDesC& aName,
    49                                         const TDesC& aName,
    57                                         TApBearerType aBearerType
    50                                         TApBearerType aBearerType
    58                                         )
    51                                         )
    59     {
    52     {
    60     CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
    53     (void)aIspType;
    61 
    54     (void)aUid;
    62     CApListItem* db = new( ELeave ) CApListItem;
    55     (void)aName;
    63     CleanupStack::PushL( db );
    56     (void)aBearerType;
    64     db->ConstructL( aIspType, aUid, aName, aBearerType );
    57     return NULL;
    65 
       
    66     CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
       
    67     return db;
       
    68     }
    58     }
    69 
    59 
    70 
    60 
    71 EXPORT_C CApListItem* CApListItem::NewLC
    61 EXPORT_C CApListItem* CApListItem::NewLC
    72                                         (
    62                                         (
    76                                         TApBearerType aBearerType,
    66                                         TApBearerType aBearerType,
    77                                         const TDesC& aStartPage,
    67                                         const TDesC& aStartPage,
    78                                         TBool aReadOnly
    68                                         TBool aReadOnly
    79                                         )
    69                                         )
    80     {
    70     {
    81     CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
    71     (void)aIspType;
    82 
    72     (void)aUid;
    83     CApListItem* db = new( ELeave ) CApListItem;
    73     (void)aName;
    84     CleanupStack::PushL( db );
    74     (void)aBearerType;
    85     db->ConstructL( aIspType, aUid, aName, aBearerType, aStartPage );
    75     (void)aStartPage;
    86     db->iExt->iReadOnly = aReadOnly;
    76     (void)aReadOnly;
    87     
    77     return NULL;
    88     CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
       
    89     return db;
       
    90     }
    78     }
    91 
    79 
    92 // ---------------------------------------------------------
    80 // ---------------------------------------------------------
    93 // CApListItem::NewLC
    81 // CApListItem::NewLC
    94 // ---------------------------------------------------------
    82 // ---------------------------------------------------------
    95 //
    83 //
    96 EXPORT_C CApListItem* CApListItem::NewLC( CApListItem* aItem )
    84 EXPORT_C CApListItem* CApListItem::NewLC( CApListItem* aItem )
    97     {
    85     {
    98     CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
    86     (void)aItem;
    99 
    87     return NULL;
   100     CApListItem* db = new( ELeave ) CApListItem;
       
   101     CleanupStack::PushL( db );
       
   102     db->ConstructL( aItem->iIspType, aItem->iUid, *aItem->iName,
       
   103                     aItem->iBearerType, *aItem->iStartPage );
       
   104     db->iExt->iReadOnly = aItem->IsReadOnly();
       
   105     
       
   106     CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
       
   107     return db;
       
   108     }
    88     }
   109 
    89 
   110 
    90 
   111 // Destructor
    91 // Destructor
   112 // ---------------------------------------------------------
    92 // ---------------------------------------------------------
   113 // CApListItem::~CApListItem
    93 // CApListItem::~CApListItem
   114 // ---------------------------------------------------------
    94 // ---------------------------------------------------------
   115 //
    95 //
   116 EXPORT_C CApListItem::~CApListItem()
    96 EXPORT_C CApListItem::~CApListItem()
   117     {
    97     {
   118     CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
       
   119 
       
   120     delete iName;
       
   121     delete iStartPage;
       
   122     if ( iExt )
       
   123         {
       
   124         delete iExt;
       
   125         }
       
   126 
       
   127     CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
       
   128     }
    98     }
   129 
    99 
   130 
   100 
   131 
   101 
   132 // ---------------------------------------------------------
   102 // ---------------------------------------------------------
   133 // CApListItem::CopyFromL
   103 // CApListItem::CopyFromL
   134 // ---------------------------------------------------------
   104 // ---------------------------------------------------------
   135 //
   105 //
   136 EXPORT_C void CApListItem::CopyFromL( const CApListItem& aCopyFrom )
   106 EXPORT_C void CApListItem::CopyFromL( const CApListItem& aCopyFrom )
   137     {
   107     {
   138     CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
   108     (void)aCopyFrom;
   139 
       
   140     HBufC* temp = NULL;
       
   141     HBufC* temp2 = NULL;
       
   142     temp = aCopyFrom.iName->AllocL();
       
   143     delete iName;
       
   144     iName = temp;
       
   145 
       
   146     temp2 = aCopyFrom.iStartPage->AllocL();
       
   147     delete iStartPage;
       
   148     iStartPage = temp2;
       
   149 
       
   150     iUid = aCopyFrom.iUid;
       
   151     iIspType =  aCopyFrom.iIspType;
       
   152     iBearerType = aCopyFrom.iBearerType;
       
   153     iExt->iReadOnly = aCopyFrom.iExt->iReadOnly;
       
   154 
       
   155     CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
       
   156     }
   109     }
   157 
   110 
   158 
   111 
   159 // C++ default constructor can NOT contain any code that
   112 // C++ default constructor can NOT contain any code that
   160 // might leave.
   113 // might leave.
   176 // CApListItem::ConstructL
   129 // CApListItem::ConstructL
   177 // ---------------------------------------------------------
   130 // ---------------------------------------------------------
   178 //
   131 //
   179 EXPORT_C void CApListItem::ConstructL()
   132 EXPORT_C void CApListItem::ConstructL()
   180     {
   133     {
   181     CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
       
   182 
       
   183     iName = HBufC::NewL( 0 );
       
   184     iStartPage = HBufC::NewL( 0 );
       
   185     CreateExtraL();
       
   186     
       
   187     CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
       
   188     }
   134     }
   189 
   135 
   190 
   136 
   191 // Symbian OS default constructor can leave.
   137 // Symbian OS default constructor can leave.
   192 // ---------------------------------------------------------
   138 // ---------------------------------------------------------
   196 EXPORT_C void CApListItem::ConstructL( TCommsDbIspType aIspType,
   142 EXPORT_C void CApListItem::ConstructL( TCommsDbIspType aIspType,
   197                                       TUint32 aUid,
   143                                       TUint32 aUid,
   198                                       const TDesC& aName,
   144                                       const TDesC& aName,
   199                                       TApBearerType aBearerType )
   145                                       TApBearerType aBearerType )
   200     {
   146     {
   201     CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
   147     (void)aIspType;
   202 
   148     (void)aUid;
   203     ConstructL();
   149     (void)aName;
   204     SetItemL( aIspType, aUid, aName, aBearerType );
   150     (void)aBearerType;
   205     
       
   206     CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
       
   207     }
   151     }
   208 
   152 
   209 
   153 
   210 
   154 
   211 // ---------------------------------------------------------
   155 // ---------------------------------------------------------
   217                                       const TDesC& aName,
   161                                       const TDesC& aName,
   218                                       TApBearerType aBearerType,
   162                                       TApBearerType aBearerType,
   219                                       const TDesC& aStartPage
   163                                       const TDesC& aStartPage
   220                                       )
   164                                       )
   221     {
   165     {
   222     CLOG( ( EUtil, 0, _L( "-> CApListItem::ConstructL" ) ) );
   166     (void)aIspType;
   223 
   167     (void)aUid;
   224     ConstructL();
   168     (void)aName;
   225     SetItemL( aIspType, aUid, aName, aBearerType, aStartPage );
   169     (void)aBearerType;
   226 
   170     (void)aStartPage;
   227     CLOG( ( EUtil, 1, _L( "<- CApListItem::ConstructL" ) ) );
       
   228     }
   171     }
   229 
   172 
   230 
   173 
   231 // ---------------------------------------------------------
   174 // ---------------------------------------------------------
   232 // CApListItem::SetItemL
   175 // CApListItem::SetItemL
   235 EXPORT_C void CApListItem::SetItemL( TCommsDbIspType aIspType,
   178 EXPORT_C void CApListItem::SetItemL( TCommsDbIspType aIspType,
   236                                     TUint32 aUid,
   179                                     TUint32 aUid,
   237                                     const TDesC& aName,
   180                                     const TDesC& aName,
   238                                     TApBearerType aBearerType )
   181                                     TApBearerType aBearerType )
   239     {
   182     {
   240     CLOG( ( EUtil, 0, _L( "-> CApListItem::SetItemL(4)" ) ) );
   183     (void)aIspType;
   241 
   184     (void)aUid;
   242     SetItemL( aIspType, aUid, aName, aBearerType, KEmpty );
   185     (void)aName;
   243 
   186     (void)aBearerType;
   244     CLOG( ( EUtil, 1, _L( "<- CApListItem::SetItemL(4)" ) ) );
       
   245     }
   187     }
   246 
   188 
   247 
   189 
   248 // ---------------------------------------------------------
   190 // ---------------------------------------------------------
   249 // CApListItem::SetItemL
   191 // CApListItem::SetItemL
   254                                     const TDesC& aName,
   196                                     const TDesC& aName,
   255                                     TApBearerType aBearerType,
   197                                     TApBearerType aBearerType,
   256                                     const TDesC& aStartpage
   198                                     const TDesC& aStartpage
   257                                     )
   199                                     )
   258     {
   200     {
   259     CLOG( ( EUtil, 0, _L( "-> CApListItem::SetItemL" ) ) );
   201     (void)aIspType;
   260 
   202     (void)aUid;
   261     HBufC* temp = NULL;
   203     (void)aName;
   262     temp = aName.AllocL();
   204     (void)aBearerType;
   263     delete iName;
       
   264     iName = temp;
       
   265 
       
   266     HBufC* temp2 = NULL;
       
   267     temp2 = aStartpage.AllocL();
       
   268     delete iStartPage;
       
   269     iStartPage = temp2;
       
   270 
       
   271     iIspType = aIspType;
       
   272     iUid = aUid;
       
   273     iBearerType = aBearerType;
       
   274     
       
   275     CLOG( ( EUtil, 1, _L( "<- CApListItem::SetItemL" ) ) );
       
   276     }
   205     }
   277 
   206 
   278 
   207 
   279 // ---------------------------------------------------------
   208 // ---------------------------------------------------------
   280 // CApListItem::Name
   209 // CApListItem::Name
   281 // ---------------------------------------------------------
   210 // ---------------------------------------------------------
   282 //
   211 //
   283 EXPORT_C const TDesC& CApListItem::Name()
   212 EXPORT_C const TDesC& CApListItem::Name()
   284     {
   213     {
   285     CLOG( ( EUtil, 0, _L( "<-> CApListItem::Name" ) ) );
   214     User::Leave( KErrNotSupported );
   286 
       
   287     return *iName;
       
   288     }
   215     }
   289 
   216 
   290 
   217 
   291 // ---------------------------------------------------------
   218 // ---------------------------------------------------------
   292 // CApListItem::Uid
   219 // CApListItem::Uid
   293 // ---------------------------------------------------------
   220 // ---------------------------------------------------------
   294 //
   221 //
   295 EXPORT_C TUint32 CApListItem::Uid()
   222 EXPORT_C TUint32 CApListItem::Uid()
   296     {
   223     {
   297     CLOG( ( EUtil, 0, _L( "<-> CApListItem::Uid" ) ) );
   224     return 0;
   298 
       
   299     return iUid;
       
   300     }
   225     }
   301 
   226 
   302 
   227 
   303 // ---------------------------------------------------------
   228 // ---------------------------------------------------------
   304 // CApListItem::Type
   229 // CApListItem::Type
   305 // ---------------------------------------------------------
   230 // ---------------------------------------------------------
   306 //
   231 //
   307 EXPORT_C TCommsDbIspType CApListItem::Type()
   232 EXPORT_C TCommsDbIspType CApListItem::Type()
   308     {
   233     {
   309     CLOG( ( EUtil, 0, _L( "<-> CApListItem::Type" ) ) );
   234     User::Leave( KErrNotSupported );
   310 
       
   311     return iIspType;
       
   312     }
   235     }
   313 
   236 
   314 
   237 
   315 
   238 
   316 // ---------------------------------------------------------
   239 // ---------------------------------------------------------
   317 // CApListItem::BearerType
   240 // CApListItem::BearerType
   318 // ---------------------------------------------------------
   241 // ---------------------------------------------------------
   319 //
   242 //
   320 EXPORT_C TApBearerType CApListItem::BearerType()
   243 EXPORT_C TApBearerType CApListItem::BearerType()
   321     {
   244     {
   322     CLOG( ( EUtil, 0, _L( "<-> CApListItem::BearerType" ) ) );
   245     User::Leave( KErrNotSupported );
   323 
       
   324     return iBearerType;
       
   325     }
   246     }
   326 
   247 
   327 
   248 
   328 // ---------------------------------------------------------
   249 // ---------------------------------------------------------
   329 // CApListItem::StartPage
   250 // CApListItem::StartPage
   330 // ---------------------------------------------------------
   251 // ---------------------------------------------------------
   331 //
   252 //
   332 EXPORT_C const TDesC& CApListItem::StartPage() const
   253 EXPORT_C const TDesC& CApListItem::StartPage() const
   333     {
   254     {
   334     CLOG( ( EUtil, 0, _L( "<-> CApListItem::StartPage" ) ) );
   255     User::Leave( KErrNotSupported );
   335 
       
   336     return *iStartPage;
       
   337     }
   256     }
   338 
   257 
   339 
   258 
   340 // ---------------------------------------------------------
   259 // ---------------------------------------------------------
   341 // CApListItem::IsReadOnly
   260 // CApListItem::IsReadOnly
   342 // ---------------------------------------------------------
   261 // ---------------------------------------------------------
   343 //
   262 //
   344 EXPORT_C TBool CApListItem::IsReadOnly() const
   263 EXPORT_C TBool CApListItem::IsReadOnly() const
   345     {
   264     {
   346     CLOG( ( EUtil, 0, _L( "<-> CApListItem::IsReadOnly" ) ) );
   265     return EFalse;
   347 
       
   348     return iExt->iReadOnly;
       
   349     }
   266     }
   350 
   267 
   351 
   268 
   352 // ---------------------------------------------------------
   269 // ---------------------------------------------------------
   353 // CApListItem::IsVpnAp
   270 // CApListItem::IsVpnAp
   354 // ---------------------------------------------------------
   271 // ---------------------------------------------------------
   355 //
   272 //
   356 TBool CApListItem::IsVpnAp() const
   273 TBool CApListItem::IsVpnAp() const
   357     {
   274     {
   358     return iExt->iIsVpn;
   275     return EFalse;
   359     }
   276     }
   360 
   277 
   361 
   278 
   362 // ---------------------------------------------------------
   279 // ---------------------------------------------------------
   363 // CApListItem::CreateExtraL
   280 // CApListItem::CreateExtraL
   364 // ---------------------------------------------------------
   281 // ---------------------------------------------------------
   365 //
   282 //
   366 void CApListItem::CreateExtraL()
   283 void CApListItem::CreateExtraL()
   367     {
   284     {
   368     iExt = new ( ELeave )TApListItemExtra;
       
   369     iExt->iIapId = 0;
       
   370     iExt->iIsVpn = EFalse;
       
   371     iExt->iReadOnly = EFalse;
       
   372     }
   285     }
   373 
   286 
   374 
   287 
   375 // ---------------------------------------------------------
   288 // ---------------------------------------------------------
   376 // CApListItem::SetVpnFlag
   289 // CApListItem::SetVpnFlag
   377 // ---------------------------------------------------------
   290 // ---------------------------------------------------------
   378 //
   291 //
   379 void CApListItem::SetVpnFlag( TBool aIsVpn )
   292 void CApListItem::SetVpnFlag( TBool aIsVpn )
   380     {
   293     {
   381     iExt->iIsVpn = aIsVpn;
   294     (void)aIsVpn;
   382     }
   295     }
   383 
   296 
   384 //  End of File
   297 //  End of File