Nokia中文解决方案(1)
来源:互联网 发布:澳洲留学物品清单 知乎 编辑:程序博客网 时间:2024/05/21 06:20
1、标题: 创建Internet连接最好的方法
TSS000031
开发伙伴平台: 60系列开发平台 1.0/2.0
说明:
建立Internet连接的最好的方法是使用Internet Connection Initiator API.
其头文件为Intconninit.h,链接库为Intconninit.lib。
下面是如何使用的示例代码,如果没有默认连接(Preferred Connection),
实际上, 你可以创建一个活动对象(active object)来控制连接的初始化过程.
3、标题: 不綺用户提示创建一个Internet连接
TSS000050
开发伙伴平台: 60系列开发平台 2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
下面的代码演示了如何创建一个Internet连接,而不提示用户
使用哪种方法连接或者选择哪个GPRS接入点. 你需要知道你想
使用的那个Internet接入点(IAP)的标示(ID)。
TSS000031
开发伙伴平台: 60系列开发平台 1.0/2.0
说明:
建立Internet连接的最好的方法是使用Internet Connection Initiator API.
其头文件为Intconninit.h,链接库为Intconninit.lib。
下面是如何使用的示例代码,如果没有默认连接(Preferred Connection),
实际上, 你可以创建一个活动对象(active object)来控制连接的初始化过程.
Code:
CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref1;
CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref2;
//--- First preference ----
pref1.iRanking = 1;
pref1.iDirection = ECommDbConnectionDirectionOutgoing;
pref1.iDialogPref = ECommDbDialogPrefDoNotPrompt;
CCommsDbConnectionPrefTableView::TCommDbIapBeare bearer1;
bearer1.iBearerSet = ECommDbBearerGPRS;
bearer1.iIapId = 0x01;
pref1.iBearer = bearer1;
//---Second preference ---
pref2.iRanking = 2;
pref2.iDirection = ECommDbConnectionDirectionOutgoing;
pref2.iDialogPref = ECommDbDialogPrefDoNotPrompt;
CCommsDbConnectionPrefTableView::TCommDbIapBearer bearer2;
bearer2.iBearerSet = ECommDbBearerCSD;
bearer2.iIapId = 0x04;
pref2.iBearer = bearer2;
//---Call Initiator---
TRequestStatus status(KRequestPending);
CIntConnectionInitiator* initConn = CIntConnectionInitiator::NewL();
CleanupStack::PushL(initConn);
initConn->ConnectL(pref1, pref2, status);
CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref2;
//--- First preference ----
pref1.iRanking = 1;
pref1.iDirection = ECommDbConnectionDirectionOutgoing;
pref1.iDialogPref = ECommDbDialogPrefDoNotPrompt;
CCommsDbConnectionPrefTableView::TCommDbIapBeare bearer1;
bearer1.iBearerSet = ECommDbBearerGPRS;
bearer1.iIapId = 0x01;
pref1.iBearer = bearer1;
//---Second preference ---
pref2.iRanking = 2;
pref2.iDirection = ECommDbConnectionDirectionOutgoing;
pref2.iDialogPref = ECommDbDialogPrefDoNotPrompt;
CCommsDbConnectionPrefTableView::TCommDbIapBearer bearer2;
bearer2.iBearerSet = ECommDbBearerCSD;
bearer2.iIapId = 0x04;
pref2.iBearer = bearer2;
//---Call Initiator---
TRequestStatus status(KRequestPending);
CIntConnectionInitiator* initConn = CIntConnectionInitiator::NewL();
CleanupStack::PushL(initConn);
initConn->ConnectL(pref1, pref2, status);
2、标题: 热键事件和键位码
TSS000045
开发伙伴平台: 60系列开发平台 1.0/2.0
说明:
如果您的窗口组没有获得键盘焦点,您可以使用
RWindowGroup::CaptureKey() 来捕捉键盘事件。
应用程序中按键的扫描码(scan code)有着会有下面这样的
名字EStdKeyApplication0。具体可以参看60系列开发工具
中/Epoc32/Include/uikon.hrh 文件的内容。
创建日期: 2003.7.15
TSS000045
开发伙伴平台: 60系列开发平台 1.0/2.0
说明:
如果您的窗口组没有获得键盘焦点,您可以使用
RWindowGroup::CaptureKey() 来捕捉键盘事件。
应用程序中按键的扫描码(scan code)有着会有下面这样的
名字EStdKeyApplication0。具体可以参看60系列开发工具
中/Epoc32/Include/uikon.hrh 文件的内容。
创建日期: 2003.7.15
3、标题: 不綺用户提示创建一个Internet连接
TSS000050
开发伙伴平台: 60系列开发平台 2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
下面的代码演示了如何创建一个Internet连接,而不提示用户
使用哪种方法连接或者选择哪个GPRS接入点. 你需要知道你想
使用的那个Internet接入点(IAP)的标示(ID)。
Code:
RSocketServ socketServ;
RConnection connection;
User::LeaveIfError(socketServ.Connect());
User::LeaveIfError(connect.Open(socketServ));
TCommDbConnPref pref;
pref.SetIapId(4); // IAP ID for connection to be used
pref.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
pref.SetDirection( ECommDbConnectionDirectionOutgoing );
connection.Start(pref);
RConnection connection;
User::LeaveIfError(socketServ.Connect());
User::LeaveIfError(connect.Open(socketServ));
TCommDbConnPref pref;
pref.SetIapId(4); // IAP ID for connection to be used
pref.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
pref.SetDirection( ECommDbConnectionDirectionOutgoing );
connection.Start(pref);
4、标题: 把TBuf的内容转换为TInt(按字符串文字内容)
TSS000049
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
如下所示
TSS000049
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
如下所示
Code:
// 15位数字
TInt iNum1(123456789009876);
// 将缓存的内容设置为iNum1
iBuf.Num(iNum1);
// 使用iBuf包含的内容创建TLex对象
// the 15 digit number
TLex iLex(iBuf);
// iNum1
TInt iNum2;
//iNum2现在包含了15位数字
iLex.Val(iNum2);
TInt iNum1(123456789009876);
// 将缓存的内容设置为iNum1
iBuf.Num(iNum1);
// 使用iBuf包含的内容创建TLex对象
// the 15 digit number
TLex iLex(iBuf);
// iNum1
TInt iNum2;
//iNum2现在包含了15位数字
iLex.Val(iNum2);
5、标题: 如何在S60设备的“收藏夹”中增添一个快捷方式
TSS000024
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
在一部S60设备上,如何编程中将一个应用程序(如果我知道它的UID)的
快捷方式添加“收藏夹”中呢?这里使用到的类是CPinbLinkBase . 要设置这个
应用程序的UID, 可以使用
CPinbLinkBase::SetApplicationUidL(const TUid& aUid);
创建日期: 2003.8.12
TSS000024
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
在一部S60设备上,如何编程中将一个应用程序(如果我知道它的UID)的
快捷方式添加“收藏夹”中呢?这里使用到的类是CPinbLinkBase . 要设置这个
应用程序的UID, 可以使用
CPinbLinkBase::SetApplicationUidL(const TUid& aUid);
创建日期: 2003.8.12
6、标题: 使用CAknIconArray读取资源图标供listbox所用
TSS000022
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
询问:
symbian API中提供了使用CAknIconArray读取资源图标供listbox所用的方法。
它使用了AKN_ICON_ARRAY结构,请问能否提供一段代码描述如何使用?
解答:
在资源中有如下描述:
TSS000022
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
询问:
symbian API中提供了使用CAknIconArray读取资源图标供listbox所用的方法。
它使用了AKN_ICON_ARRAY结构,请问能否提供一段代码描述如何使用?
解答:
在资源中有如下描述:
Code:
RESOURCE AKN_ICON_ARRAY r_icon_testIcons
{
type = EAknIconArraySimple;
bmpfile = "z:/SYSTEM/DATA/AVKON.MBM";
icons =
{
AKN_ICON
{
iconId = EMbmAvkonQgn_indi_checkbox_on;
maskId = EMbmAvkonQgn_indi_checkbox_on_mask;
},
AKN_ICON
{
IconId = EMbmAvkonQgn_indi_checkbox_off;
maskId = EMbmAvkonQgn_indi_checkbox_off_mask;
}
};
}
{
type = EAknIconArraySimple;
bmpfile = "z:/SYSTEM/DATA/AVKON.MBM";
icons =
{
AKN_ICON
{
iconId = EMbmAvkonQgn_indi_checkbox_on;
maskId = EMbmAvkonQgn_indi_checkbox_on_mask;
},
AKN_ICON
{
IconId = EMbmAvkonQgn_indi_checkbox_off;
maskId = EMbmAvkonQgn_indi_checkbox_off_mask;
}
};
}
这里资源包括了checkboxes的缺省图标。
在编写代码时,可以使用CAknIconArray::ConstructFromResourceL()来构造图标
在编写代码时,可以使用CAknIconArray::ConstructFromResourceL()来构造图标
Code:
...
// CAknSingleGraphicStyleListBox* iListbox;
iListbox = new(ELeave)CAknSingleGraphicStyleListBox();
iListbox->SetContainerWindowL(*this);
TResourceReader reader;
CEikonEnv::Static()->CreateResourceReaderLC(reader, R_LIST);
iListbox->ConstructFromResourceL(reader);
// Creates a GUI icon array.
CAknIconArray* icons =new(ELeave) CAknIconArray(2);
CleanupStack::PushL(icons);
icons->ConstructFromResourceL(R_ICON_TESTICONS);
// Sets graphics as ListBox icon.
iListbox->ItemDrawer()->ColumnData()->SetIconArray(icons);
CleanupStack::Pop(); // icons
CleanupStack::PopAndDestroy(); // reader
// CAknSingleGraphicStyleListBox* iListbox;
iListbox = new(ELeave)CAknSingleGraphicStyleListBox();
iListbox->SetContainerWindowL(*this);
TResourceReader reader;
CEikonEnv::Static()->CreateResourceReaderLC(reader, R_LIST);
iListbox->ConstructFromResourceL(reader);
// Creates a GUI icon array.
CAknIconArray* icons =new(ELeave) CAknIconArray(2);
CleanupStack::PushL(icons);
icons->ConstructFromResourceL(R_ICON_TESTICONS);
// Sets graphics as ListBox icon.
iListbox->ItemDrawer()->ColumnData()->SetIconArray(icons);
CleanupStack::Pop(); // icons
CleanupStack::PopAndDestroy(); // reader
7、标题: 如何在程序中启动并显示“设置”程序
TSS000023
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
按如下代码所示,可以在程序中启动“设置”程序
TSS000023
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
按如下代码所示,可以在程序中启动“设置”程序
Code:
// Application UID for Settings Application
const TUid KSettingsUid = { 0x100058EC };
// UID of the display view in the Settings Application
const TUid KSettingsUid = { 0x100058EC };
// UID of the display view in the Settings Application
const TUid KSettListDisplViewId = { 5 };
AppUi()->ActivateViewL( TVwsViewId(KSettingsUid, KSettListDisplViewId));
AppUi()->ActivateViewL( TVwsViewId(KSettingsUid, KSettListDisplViewId));
注意这里的启动是异步的
8、标题: Series60中如何动态改变按钮或关闭它们?
TSS000030
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
你可以通过如下方式来改变按钮:
定义一个资源
TSS000030
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
你可以通过如下方式来改变按钮:
定义一个资源
Code:
RESOURCE CBA r_my_cba
{ buttons =
{
CBA_BUTTON { id = EMyButton1; txt = "Button1"; },
CBA_BUTTON { id = EMyButton2; txt = "Button2"; }
};
{ buttons =
{
CBA_BUTTON { id = EMyButton1; txt = "Button1"; },
CBA_BUTTON { id = EMyButton2; txt = "Button2"; }
};
}
在代码中调用SetCommandSetL()方法:
iAvkonAppUi->Cba()->SetCommandSetL(R_MY_CBA);
iAvkonAppUi->Cba()->DrawNow();
如果需要关闭按钮,可以使用系统预定义的R_AVKON_SOFTKEYS_EMPTY资源
iAvkonAppUi->Cba()->SetCommandSetL(R_MY_CBA);
iAvkonAppUi->Cba()->DrawNow();
如果需要关闭按钮,可以使用系统预定义的R_AVKON_SOFTKEYS_EMPTY资源
9、标题: 如何监测名片夹数据库的变化?
TSS000032
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
下面提供一段代码示例如何监测名片夹的变化
// Application UI owns contact observer
class CEventsAppUi : public CEikAppUi
{
public:
void ConstructL();
~CEventsAppUi();
public:
void HandleCommandL(TInt aCommand);
private:
CEventsAppView* iAppView; // owns
CEventsContacts* iContactObserver;
};
void CEventsAppUi::ConstructL()
{
BaseConstructL(); // Call base constructor
iAppView = CEventsAppView::NewL(ClientRect());
AddToStackL(iAppView);
// Create an observer
iContactObserver = new(ELeave) CEventsContacts(iAppView);
iContactObserver->ConstructL();
}
// CEventsContacts implements MContactDbObserver interface
class CEventsContacts : public CBase, public MContactDbObserver
{
public:
CEventsContacts(CEventsAppView* aAppView);
void ConstructL();
~CEventsContacts();
// Override the virtual function of MContactDbObserver
void HandleDatabaseEventL(TContactDbObserverEvent aEvent);
private:
CContactDatabase* iContactDb;
CContactChangeNotifier* iNotifier;
CEventsAppView* iAppView;
};
CEventsContacts::CEventsContacts(CEventsAppView* aAppView)
:iAppView(aAppView)
{
}
void CEventsContacts::ConstructL()
{
// Open the database
iContactDb = CContactDatabase::OpenL();
// Register the observer
iNotifier = CContactChangeNotifier::NewL(*iContactDb, this);
}
CEventsContacts::~CEventsContacts()
{
delete iNotifier;
delete iContactDb;
}
void CEventsContacts::HandleDatabaseEventL(TContactDbObserverEvent
aEvent)
{
// The changed item
TContactItemId contactItem = aEvent.iContactId;
switch (aEvent.iType)
{
case EContactDbObserverEventContactChanged:
// Handle contact changed event
break;
case EContactDbObserverEventContactDeleted:
// Handle contact deleted event
break;
...
default:
break;
}
}
RESOURCE DIALOG r_myconfirmation_query
{
flags = EGeneralQueryFlags;
buttons = r_my_softkey; // note that own softkey is
// used as lowercase
items =
{
DLG_LINE
{
type = EAknCtQuery;
id = EGeneralQuery;
control = AVKON_CONFIRMATION_QUERY;
},
...
}
// class CMyAknQueryDialog: public CAknQueryDialog, ...
#include <eikenv.h>
TBool CMyAknQueryDialog::OkToExitL(TInt aButtonId)
{
if (aButtonId == EAknSoftkeyMaybe)
// Handle “Maybe” key press
else if (aButtonId == EAknSoftkeyWhy)
// Handle “Why” key press
return ETrue;
}
TSS000032
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
下面提供一段代码示例如何监测名片夹的变化
Code:
// Application UI owns contact observer
class CEventsAppUi : public CEikAppUi
{
public:
void ConstructL();
~CEventsAppUi();
public:
void HandleCommandL(TInt aCommand);
private:
CEventsAppView* iAppView; // owns
CEventsContacts* iContactObserver;
};
void CEventsAppUi::ConstructL()
{
BaseConstructL(); // Call base constructor
iAppView = CEventsAppView::NewL(ClientRect());
AddToStackL(iAppView);
// Create an observer
iContactObserver = new(ELeave) CEventsContacts(iAppView);
iContactObserver->ConstructL();
}
// CEventsContacts implements MContactDbObserver interface
class CEventsContacts : public CBase, public MContactDbObserver
{
public:
CEventsContacts(CEventsAppView* aAppView);
void ConstructL();
~CEventsContacts();
// Override the virtual function of MContactDbObserver
void HandleDatabaseEventL(TContactDbObserverEvent aEvent);
private:
CContactDatabase* iContactDb;
CContactChangeNotifier* iNotifier;
CEventsAppView* iAppView;
};
CEventsContacts::CEventsContacts(CEventsAppView* aAppView)
:iAppView(aAppView)
{
}
void CEventsContacts::ConstructL()
{
// Open the database
iContactDb = CContactDatabase::OpenL();
// Register the observer
iNotifier = CContactChangeNotifier::NewL(*iContactDb, this);
}
CEventsContacts::~CEventsContacts()
{
delete iNotifier;
delete iContactDb;
}
void CEventsContacts::HandleDatabaseEventL(TContactDbObserverEvent
aEvent)
{
// The changed item
TContactItemId contactItem = aEvent.iContactId;
switch (aEvent.iType)
{
case EContactDbObserverEventContactChanged:
// Handle contact changed event
break;
case EContactDbObserverEventContactDeleted:
// Handle contact deleted event
break;
...
default:
break;
}
}
创建日期: 2003.3.14
10、标题: 如何自定义询问对话框的按钮?
TSS000033
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
自定义按钮需要先构造资源文件,如下:
[code]
RESOURCE CBA r_my_softkey
{
buttons =
{
CBA_BUTTON
{
id = EAknSoftkeyMaybe;
txt = "Maybe"; // Texts can be defined in .loc file(s)
// to support language localization
},
CBA_BUTTON
{
id = EAknSoftkeyWhy;
txt = "Why?";
}
};
}
[code]
然后取代询问对话框的默认按纽:
TSS000033
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
自定义按钮需要先构造资源文件,如下:
[code]
RESOURCE CBA r_my_softkey
{
buttons =
{
CBA_BUTTON
{
id = EAknSoftkeyMaybe;
txt = "Maybe"; // Texts can be defined in .loc file(s)
// to support language localization
},
CBA_BUTTON
{
id = EAknSoftkeyWhy;
txt = "Why?";
}
};
}
[code]
然后取代询问对话框的默认按纽:
Code:
RESOURCE DIALOG r_myconfirmation_query
{
flags = EGeneralQueryFlags;
buttons = r_my_softkey; // note that own softkey is
// used as lowercase
items =
{
DLG_LINE
{
type = EAknCtQuery;
id = EGeneralQuery;
control = AVKON_CONFIRMATION_QUERY;
},
...
}
询问对话框的处理和其他对话框一样,可以通过OkToExit()来处理按键:
Code:
// class CMyAknQueryDialog: public CAknQueryDialog, ...
#include <eikenv.h>
TBool CMyAknQueryDialog::OkToExitL(TInt aButtonId)
{
if (aButtonId == EAknSoftkeyMaybe)
// Handle “Maybe” key press
else if (aButtonId == EAknSoftkeyWhy)
// Handle “Why” key press
return ETrue;
}
11、标题: 怎样检测还有多少可用内存?
TSS000038
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
下面的代码可以得到可用内存的数量。
TSS000038
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本: 无
大类: Symbian C++
子类: 普通
说明:
下面的代码可以得到可用内存的数量。
Code:
TMemoryInfoV1Buf info;
UserHal::MemoryInfo(info);
TInt freeMemory = info().iFreeRamInBytes;
UserHal::MemoryInfo(info);
TInt freeMemory = info().iFreeRamInBytes;
- Nokia中文解决方案(1)
- Nokia中文解决方案(3)
- Nokia中文解决方案(2)
- Nokia中文解决方案(3)
- Nokia E52 热点解决方案
- NOKIA Seriers60 SDK for Jbuilder 安装配置(中文)
- NOKIA Seriers60 SDK for Jbuilder 安装配置(中文)
- nokia中文站及论坛
- SecureCRT优化(1)中文乱码解决方案
- displaytag-1.1.1中文(乱码)解决方案
- struts项目中文乱码解决方案(java中文乱码解决方案)
- Nokia
- displaytag-1.1.1之中文(乱码)解决方案
- NOKIA Explain Extended Planning Introduction 学习笔记(1)
- 在nokia 手机上使用录音设备(1)
- 在nokia 手机上使用录音设备(1)
- Nokia S60(7610)秘笈
- 【技术】Nokia 5700 提示“插入SIM卡”的解决方案
- 中移动飞信项目招聘
- 实用JS代码大全
- CListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
- Nokia中文解决方案(2)
- KT&&IT:知识技术和信息技术
- Nokia中文解决方案(1)
- ==和equals的区别
- 如何将TXT,EXCEL或CSV数据导入ORACLE到对应表中
- 获取mysql数据的信息
- archlinux下安装完xorg后,启动x,鼠标键盘失灵的问题
- 关于23种设计模式的有趣见解
- HDOJ 1106 排序 [stable_sort]
- 关于flex4 的命名空间的介绍 。
- 将GridView的内容导出到Excel中