📄 osdlg.cpp
字号:
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Jabber
* Copyright (C) 2004 Xie Tian Lu http://sabber.jabberstudio.org/
*/
#include <aknnotewrappers.h>
#include <Sabber.rsg>
#include "osdlg.h"
#include "osaux.h"
TInt ShowQueryDialogL( TInt rid )
{
TBuf< 128 > text;
CUtil::GetTextFromResource( text, rid );
CAknQueryDialog* dlg = new(ELeave) CAknQueryDialog(CAknQueryDialog::ENoTone);
return dlg->ExecuteLD( R_GENERAL_QUERY_DIALOG, text );
}
TInt ShowQueryDialogL( char* str, TInt rid )
{
TBuf< 256 > aText;
CUtil::UTF82Unicode( aText, str );
TBuf< 100 > aWillYou;
CUtil::GetTextFromResource( aWillYou, rid );
aText.Append(aWillYou);
CAknQueryDialog* dlg = new(ELeave) CAknQueryDialog(CAknQueryDialog::ENoTone);
return dlg->ExecuteLD( R_GENERAL_QUERY_DIALOG, aText );
}
TInt ShowErrorDialogL( TInt rid )
{
TBuf< 128 > text;
CUtil::GetTextFromResource( text, rid );
CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog();
dlg->SetTextL( text );
return dlg->ExecuteLD( R_GENERAL_ERROR_DIALOG );
}
TInt ShowConfirmDialogL( TInt rid )
{
TBuf< 128 > text;
CUtil::GetTextFromResource( text, rid );
CAknNoteDialog* dlg = new( ELeave ) CAknNoteDialog();
dlg->SetTextL( text );
return dlg->ExecuteLD( R_GENERAL_CONFIRM_DIALOG );
}
void symbian_assert( int noerr, void* file, unsigned line )
{
if ( noerr )
return;
int i, len = 0;
TLitC<256> errmsg;
char* dbg = "Debug Error: ";
for ( i = 0; dbg[ i ]; i++ )
errmsg.iBuf[ len++ ] = dbg[ i ];
char* fname = (char*)file;
for ( i = 0; *fname++; i++ );
while( i > 0 && *fname != '\\' )
{
i--;
fname--;
}
fname++;
for ( i = 0; *fname; fname++, i++ )
errmsg.iBuf[ len++ ] = *fname;
errmsg.iBuf[ len++ ] = ' ';
char lnum[ 10 ];
for ( i = 0; line; i++ ) {
lnum[ i ] = line % 10 + '0';
line /= 10;
}
for ( i--; i >= 0; i-- ) {
errmsg.iBuf[ len++ ] = lnum[ i ];
}
errmsg.iTypeLength = len;
CAknErrorNote* informationNote = new (ELeave) CAknErrorNote( ETrue );
informationNote->ExecuteLD( errmsg );
User::After( 2000000 );
User::Exit( KErrGeneral );
}
void symbian_trace0( int noerr, void* file, unsigned line )
{
if ( noerr )
return;
int i, len = 0;
TLitC<256> errmsg;
char* dbg = "TRACE: ";
for ( i = 0; dbg[ i ]; i++ )
errmsg.iBuf[ len++ ] = dbg[ i ];
char* fname = (char*)file;
for ( i = 0; *fname++; i++ );
while( i > 0 && *fname != '\\' )
{
i--;
fname--;
}
fname++;
for ( i = 0; *fname; fname++, i++ )
errmsg.iBuf[ len++ ] = *fname;
errmsg.iBuf[ len++ ] = ' ';
char lnum[ 10 ];
for ( i = 0; line; i++ ) {
lnum[ i ] = line % 10 + '0';
line /= 10;
}
for ( i--; i >= 0; i-- ) {
errmsg.iBuf[ len++ ] = lnum[ i ];
}
errmsg.iTypeLength = len;
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote( ETrue );
informationNote->ExecuteLD( errmsg );
}
void symbian_trace1( int noerr, char* str )
{
if ( noerr )
return;
int i, len = 0;
TLitC<256> errmsg;
char* dbg = "TRACE: ";
for ( i = 0; dbg[ i ]; i++ )
errmsg.iBuf[ len++ ] = dbg[ i ];
char* fname = (char*)str;
for ( i = 0; *fname; fname++, i++ )
errmsg.iBuf[ len++ ] = *fname;
errmsg.iTypeLength = len;
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote( ETrue );
informationNote->ExecuteLD( errmsg );
}
void symbian_trace2( int noerr, char* str, unsigned num )
{
if ( noerr )
return;
int i, len = 0;
TLitC<256> errmsg;
char* dbg = "TRACE: ";
for ( i = 0; dbg[ i ]; i++ )
errmsg.iBuf[ len++ ] = dbg[ i ];
char* fname = (char*)str;
for ( i = 0; *fname; fname++, i++ )
errmsg.iBuf[ len++ ] = *fname;
errmsg.iBuf[ len++ ] = ' ';
char lnum[ 10 ];
for ( i = 0; num; i++ ) {
lnum[ i ] = num % 10 + '0';
num /= 10;
}
for ( i--; i >= 0; i-- ) {
errmsg.iBuf[ len++ ] = lnum[ i ];
}
errmsg.iTypeLength = len;
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote( ETrue );
informationNote->ExecuteLD( errmsg );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -