diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2005-11-07 15:32:15 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-11-07 11:39:57 +0000 |
commit | d0d72822ba0a68d160ea4c98ca80f24b8f73969b (patch) | |
tree | 735ce6a98b4d91d05a26f9573f8e62ca8f91738f /symbian/symbian_utils.cpp | |
parent | 7d0beb42a2610634ab455d4519a64df3ca90bc2f (diff) | |
download | perl-d0d72822ba0a68d160ea4c98ca80f24b8f73969b.tar.gz |
Symbian update blead@26025
Message-ID: <B356D8F434D20B40A8CEDAEC305A1F24E7A70C@esebe105.NOE.Nokia.com>
p4raw-id: //depot/perl@26030
Diffstat (limited to 'symbian/symbian_utils.cpp')
-rw-r--r-- | symbian/symbian_utils.cpp | 53 |
1 files changed, 48 insertions, 5 deletions
diff --git a/symbian/symbian_utils.cpp b/symbian/symbian_utils.cpp index 4fb13ac2e1..b3eee0b5e9 100644 --- a/symbian/symbian_utils.cpp +++ b/symbian/symbian_utils.cpp @@ -9,14 +9,21 @@ #define SYMBIAN_UTILS_CPP #include <e32base.h> #include <e32std.h> -// #include <textresolver.h> // textresolver not used since seems not to work #include <utf.h> #include <hal.h> +#include <eikenv.h> + #include <string.h> #include <ctype.h> +#include "PerlUi.h" #include "PerlBase.h" +#include "PerlUtil.h" + +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" extern "C" { EXPORT_C int symbian_sys_init(int *argcp, char ***argvp) @@ -27,6 +34,43 @@ extern "C" { (void)times(&PL_timesbase); return 0; } + XS(XS_PerlApp_TextQuery) // Can't be made static because of XS(). + { + dXSARGS; + if (items != 0) + Perl_croak(aTHX_ "PerlApp::TextQuery: no arguments, please"); + SP -= items; + // TODO: parse arguments for title, prompt, and maxsize. + // Suggested syntax: + // TextQuery(title => ..., prompt => ..., maxsize => ...) + // For an example see e.g. universal.c:XS_PerlIO_get_layers(). + _LIT(KTitle, "Title"); + _LIT(KPrompt, "Prompt"); + HBufC* cData = HBufC::New(KPerlUiOneLinerSize); + TBool cSuccess = EFalse; + if (cData) { + TPtr cPtr(cData->Des()); + if (CPerlUi::TextQueryDialogL(KTitle, + KPrompt, + cPtr, + KPerlUiOneLinerSize)) { + ST(0) = sv_2mortal(PerlUtil::newSvPVfromTDesC16(*cData)); + cSuccess = ETrue; + } + delete cData; + } + if (cSuccess) + XSRETURN(1); + else + XSRETURN_UNDEF; + } + EXPORT_C void init_os_extras(void) + { + dTHX; + char *file = __FILE__; + dXSUB_SYS; + newXS("PerlApp::TextQuery", XS_PerlApp_TextQuery, file); + } EXPORT_C SSize_t symbian_read_stdin(const int fd, char *b, int n) { #ifdef PERL_GLOBAL_STRUCT /* Avoid unused variable warning. */ @@ -185,10 +229,10 @@ extern "C" { return tmsbuf->tms_utime; } } - class CE32ProcessWait : public CActive + class CProcessWait : public CActive { public: - CE32ProcessWait() : CActive(EPriorityStandard) { + CProcessWait() : CActive(EPriorityStandard) { CActiveScheduler::Add(this); } #ifdef __WINS__ @@ -208,7 +252,6 @@ extern "C" { void RunL() { CActiveScheduler::Stop(); } - CActiveSchedulerWait iWait; }; class CSpawnIoRedirect : public CBase { @@ -262,7 +305,7 @@ extern "C" { #endif if (error == KErrNone) { if ((TInt)aFlag & (TInt)ESpawnWait) { - CE32ProcessWait* w = new CE32ProcessWait(); + CProcessWait* w = new CProcessWait(); if (w) { error = w->Wait(proc); delete w; |