1 #include <akncommondialogs.h> // For single function calls 2 #include <eikapp.h> 3 #include <e32base.h> 4 #include <sdlapp.h> 5 #include <eikenv.h> 6 #include <eikappui.h> 7 #include <eikapp.h> 8 #include <string.h> 9 #include <bautils.h> 10 #include <sys/time.h> 11 #include <unistd.h> 12 #include <stdio.h> 13 FILE* mystdout = NULL; 14 FILE* mystderr = NULL; desc2str(const TDesC & aDescriptor)15char* desc2str(const TDesC& aDescriptor) 16 { 17 static char fname[256]; 18 TInt length = aDescriptor.Length(); 19 HBufC8* buffer = HBufC8::NewLC(length); 20 buffer->Des().Copy(aDescriptor); 21 char* str = fname; 22 Mem::Copy(str, buffer->Ptr(), length); 23 str[length] = '\0'; 24 CleanupStack::PopAndDestroy(buffer); 25 return str; 26 } 27 28 extern "C" { 29 s60delay(int u)30void s60delay(int u) 31 { 32 if (u > 0) { 33 User::AfterHighRes(u); 34 } 35 } 36 37 char s60_data[] = "E:\\data\\instead"; 38 39 #ifdef _USE_BROWSE get_file_name(void)40char *get_file_name(void) 41 { 42 TFileName FileName; 43 if (!AknCommonDialogs::RunSelectDlgLD(FileName, 0)) 44 return NULL; 45 return desc2str(FileName); 46 } 47 #endif 48 } 49 class CSymbianApp : public CSDLApp { 50 public: 51 CSymbianApp(); 52 ~CSymbianApp(); PreInitializeAppL()53 void PreInitializeAppL() 54 { 55 mystdout = fopen("c:\\data\\instead\\stdout.txt","w"); 56 mystderr = fopen("c:\\data\\instead\\stderr.txt","w"); 57 *stdout = *mystdout; 58 *stderr = *mystderr; 59 60 s60_data[0] = BitmapStoreName()[0]; 61 fprintf(stderr,"Using data from: %s\n", s60_data); 62 } 63 TUid AppDllUid() const; 64 }; 65 66 #ifdef EPOC_AS_APP 67 // this function is called automatically by the SymbianOS to deliver the new CApaApplication object 68 #if !defined (UIQ3) && !defined (S60V3) 69 EXPORT_C 70 #endif NewApplication()71CApaApplication* NewApplication() { 72 return new CSymbianApp; 73 } 74 75 #if defined (UIQ3) || defined (S60V3) 76 #include <eikstart.h> 77 // E32Main() contains the program's start up code, the entry point for an EXE. E32Main()78GLDEF_C TInt E32Main() { 79 return EikStart::RunApplication(NewApplication); 80 } 81 #endif 82 83 #endif // EPOC_AS_APP 84 85 #if !defined (UIQ3) && !defined (S60V3) E32Dll(TDllReason)86GLDEF_C TInt E32Dll(TDllReason) { 87 return KErrNone; 88 } 89 #endif 90 CSymbianApp()91CSymbianApp::CSymbianApp() 92 { 93 } 94 ~CSymbianApp()95CSymbianApp::~CSymbianApp() 96 { 97 } 98 99 #if defined (UIQ3) 100 #include <gp2xpectrum.rsg> 101 /** 102 * Returns the resource id to be used to declare the views supported by this UIQ3 app 103 * @return TInt, resource id 104 */ ViewResourceId()105TInt CSymbianApp::ViewResourceId() { 106 return R_SDL_VIEW_UI_CONFIGURATIONS; 107 } 108 #endif 109 110 /** 111 * Responsible for returning the unique UID of this application 112 * @return unique UID for this application in a TUid 113 **/ AppDllUid() const114TUid CSymbianApp::AppDllUid() const { 115 return TUid::Uid(0xA0020410); 116 } 117