calendarui/inc/calendarui_debug.h
changeset 18 c198609911f9
parent 0 f979ecb2b13e
child 55 2c54b51f39c4
equal deleted inserted replaced
0:f979ecb2b13e 18:c198609911f9
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description: Calendar debug file.
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
       
    18 /**
    17 /**
    19 *
    18 *
    20 **/
    19 **/
    21 
    20 
    22 #include "debug.h"
    21 #include "debug.h"
    31     #include <e32base.h>
    30     #include <e32base.h>
    32     #include <e32std.h>
    31     #include <e32std.h>
    33     #include <flogger.h>
    32     #include <flogger.h>
    34     #include <e32svr.h>
    33     #include <e32svr.h>
    35     #include <f32file.h>
    34     #include <f32file.h>
    36     #include <AknGlobalConfirmationQuery.h>
    35     //#include <AknGlobalConfirmationQuery.h>
    37     const TInt KMaxLogLineLength = 512;
    36     const TInt KMaxLogLineLength = 512;
    38 #endif
    37 #endif
    39 
    38 
    40 /**
    39 /**
    41 * Define our own trap and assert macros to prevent compiler warnings.
    40 * Define our own trap and assert macros to prevent compiler warnings.
    42 */
    41 */
    43 #if defined (_DISPLAY_WARNINGS)
    42 #if defined (_DISPLAY_WARNINGS)
    44     _LIT( KWarningFormat, " error %d trapped %S line %d");
    43     _LIT( KWarningFormat, " error %d trapped %S line %d");
    45     inline void DisplayWarningNote( TInt aError, const TDesC8& aFile, TInt aWarningNote )
    44     inline void DisplayWarningNote( TInt aError, const TDesC8& aFile, TInt aWarningNote )
    46         {
    45         {
    47         if ( aError )
    46         /*if ( aError )
    48             {
    47             {
    49             TRAP_IGNORE(
    48             TRAP_IGNORE(
    50             CAknGlobalConfirmationQuery* cq = CAknGlobalConfirmationQuery::NewL();
    49             CAknGlobalConfirmationQuery* cq = CAknGlobalConfirmationQuery::NewL();
    51             CleanupStack::PushL( cq );
    50             CleanupStack::PushL( cq );
    52             
    51             
    59             cq->ShowConfirmationQueryL( stat, text, R_AVKON_SOFTKEYS_YES_NO );
    58             cq->ShowConfirmationQueryL( stat, text, R_AVKON_SOFTKEYS_YES_NO );
    60             User::WaitForRequest( stat );
    59             User::WaitForRequest( stat );
    61             
    60             
    62             CleanupStack::PopAndDestroy( cq );
    61             CleanupStack::PopAndDestroy( cq );
    63             );
    62             );
    64             }       
    63             }  */     
    65         }
    64         }
    66 
    65 
    67     inline void DisplayWarningNote( const TDesC& aNote )
    66     inline void DisplayWarningNote( const TDesC& aNote )
    68         {
    67         {
    69         TRAP_IGNORE(
    68         /*TRAP_IGNORE(
    70             CAknGlobalConfirmationQuery* cq = CAknGlobalConfirmationQuery::NewL();
    69             CAknGlobalConfirmationQuery* cq = CAknGlobalConfirmationQuery::NewL();
    71             CleanupStack::PushL( cq );
    70             CleanupStack::PushL( cq );
    72            
    71            
    73             
    72             
    74             TRequestStatus stat = KRequestPending;
    73             TRequestStatus stat = KRequestPending;
    75             cq->ShowConfirmationQueryL( stat, aNote, R_AVKON_SOFTKEYS_YES_NO );
    74             cq->ShowConfirmationQueryL( stat, aNote, R_AVKON_SOFTKEYS_YES_NO );
    76             User::WaitForRequest( stat );
    75             User::WaitForRequest( stat );
    77             
    76             
    78             CleanupStack::PopAndDestroy( cq );
    77             CleanupStack::PopAndDestroy( cq );
    79             );
    78             );*/
    80         }
    79         }
    81         
    80         
    82     #undef TRAP_INSTRUMENTATION_LEAVE
    81     #undef TRAP_INSTRUMENTATION_LEAVE
    83     #define TRAP_INSTRUMENTATION_LEAVE(aResult) DisplayWarningNote( aResult,TPtrC8( ( TText8* )__FILE__), __LINE__);
    82     #define TRAP_INSTRUMENTATION_LEAVE(aResult) DisplayWarningNote( aResult,TPtrC8( ( TText8* )__FILE__), __LINE__);
    84 
    83 
   104     { \
   103     { \
   105         TRAPD( _err, _s; ); \
   104         TRAPD( _err, _s; ); \
   106         ASSERT( !_err ); \
   105         ASSERT( !_err ); \
   107     }
   106     }
   108     #define WARNING_NOTE( _s )
   107     #define WARNING_NOTE( _s )
   109     #define PIM_ASSERT( _s ) \
       
   110     { \
       
   111         const TInt _err = _s; \
       
   112         if( _err ) RDebug::Print( _L("### PIM_ASSERT: %d"), _err ); \
       
   113         ASSERT( !_err ); \
       
   114     }
       
   115 #else 
   108 #else 
   116 // urel
   109 // urel
   117     #define PIM_TRAP_HANDLE( _err, _s )   TRAP_IGNORE( _s; );
   110     #define PIM_TRAP_HANDLE( _err, _s )   TRAP_IGNORE( _s; );
   118     #define PIM_TRAPD_HANDLE( _s )  TRAP_IGNORE( _s; );
   111     #define PIM_TRAPD_HANDLE( _s )  TRAP_IGNORE( _s; );
   119     #define WARNING_NOTE( _s )
   112     #define WARNING_NOTE( _s )
   120     #define PIM_ASSERT( _s )  _s;
       
   121 #endif // _DEBUG
   113 #endif // _DEBUG
   122 
   114 
   123 #if defined (_DEBUG) || defined (_PIM_FILE_LOG) 
   115 #if defined (_DEBUG) || defined (_PIM_FILE_LOG) 
   124     
   116     
   125    
   117    
   181         TBuf16<KMaxLogLineLength> buf16( buf8.Length() );
   173         TBuf16<KMaxLogLineLength> buf16( buf8.Length() );
   182         buf16.Copy( buf8 );
   174         buf16.Copy( buf8 );
   183         TRefByValue<const TDesC> tmpFmt( _L("%S") );
   175         TRefByValue<const TDesC> tmpFmt( _L("%S") );
   184  #if defined (_PIM_FILE_LOG)  
   176  #if defined (_PIM_FILE_LOG)  
   185         _LIT( KLogDir, "CalenUi");
   177         _LIT( KLogDir, "CalenUi");
   186         _LIT( KLogDir2, "c://CalenUi");
   178         _LIT( KLogDir2, "c:\\CalenUi");
   187         _LIT( KLogFile, "log.txt");
   179         _LIT( KLogFile, "log.txt");
   188         _LIT( KDir, "c://logs//CalenUi" );
   180         _LIT( KDir, "c:\\logs\\CalenUi" );
   189         _LIT( KDir2, "c://logs//CalenUi" );
   181         _LIT( KDir2, "c:\\logs\\CalenUi" );
   190         
   182         
   191         RFs fs;
   183         RFs fs;
   192         fs.Connect();
   184         fs.Connect();
   193         fs.MkDirAll( KDir );
   185         fs.MkDirAll( KDir );
   194         
   186