You Are Here:

Community: Developer Discussion Boards

#1 Old Nokia论坛技术资料Symbian解决方案-中文版 - 2005-04-25, 05:23

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
Nokia论坛技术资料汇编是由Nokia论坛整理发布的一组全面详尽
的技术文档。内容包盖S40、S60等开发平台,是一部不可多得的
开发宝典。hoolee在学习该文档的同时,将译成中文发表在这里,
希望能对大家的开发或学习有所帮助^_^

我不是学法律的,我也很不擅长这种东西(像kcomex大虾置顶帖
子中的声明),但是我还是会说,此文档的内容部分和英文版,
版权归Nokia公司,本人没有其他意思,只是为了方便大家做中文
版本的穇译工作。此穇译版非正式穇译版本,如果Nokia穇译了此
文档,正是中文版大家就不要参考这个了。HOOLEE穇译版的版
权归HOOLEE所有。
(C)Copyright HuWei 2005
未綺本人任何形式的许可,请不要转载到其他地方。
我的联系方式
hooleehoolee@gmail.com
有好环境大家才能更好的学习,相互促进!相互提高!
再次感谢大家对此帖的厚爱!


BestRegards
hoolee
Last edited by hoolee : 2005-04-25 at 05:54.
Reply With Quote

#2 Old 2005-04-25, 05:25

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
标题: 创建Internet连接最好的方法
TSS000031
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本:
大类: Symbian C++
子类: 网络
说明:
建立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);
创建日期: 2003.2.4



BestRegards
hoolee
Reply With Quote

#3 Old 2005-04-25, 05:26

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
标题: 热键事件和键位码
TSS000045
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本:
大类: Symbian C++
子类: 普通
说明:
如果您的窗口组没有获得键盘焦点,您可以使用
RWindowGroup::CaptureKey() 来捕捉键盘事件。
应用程序中按键的扫描码(scan code)有着会有下面这样的
名字EStdKeyApplication0。具体可以参看60系列开发工具
中\Epoc32\Include\uikon.hrh 文件的内容。
创建日期: 2003.7.15


BestRegards
hoolee
Reply With Quote

#4 Old 2005-04-25, 05:27

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
标题: 不綺用户提示创建一个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);
创建日期: 2003.8.5



BestRegards
hoolee
Reply With Quote

#5 Old 2005-04-25, 05:28

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
标题: 把TBuf的内容转换为TInt(按字符串文字内容)
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);
创建日期: 2003.5.16



BestRegards
hoolee
Reply With Quote

#6 Old 2005-04-25, 05:30

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
标题: 如何在S60设备的“收藏夹”中增添一个快捷方式
TSS000024
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本:
大类: Symbian C++
子类: 普通
说明:
在一部S60设备上,如何编程中将一个应用程序(如果我知道它的UID)的
快捷方式添加“收藏夹”中呢?这里使用到的类是CPinbLinkBase . 要设置这个
应用程序的UID, 可以使用
CPinbLinkBase::SetApplicationUidL(const TUid& aUid);
创建日期: 2003.8.12



BestRegards
hoolee
Reply With Quote

#7 Old 2005-04-25, 05:31

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
标题: 使用CAknIconArray读取资源图标供listbox所用
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;
            }
        };
    }
这里资源包括了checkboxes的缺省图标。
在编写代码时,可以使用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
创建日期: 2004.2.4



BestRegards
hoolee
Reply With Quote

#8 Old 2005-04-25, 05:33

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
标题: 如何在程序中启动并显示“设置”程序
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 KSettListDisplViewId = { 5 }; 
AppUi()->ActivateViewL( TVwsViewId(KSettingsUid, KSettListDisplViewId));
注意这里的启动是异步的
创建日期: 2003.3.20



BestRegards
hoolee
Reply With Quote

#9 Old 2005-04-25, 05:40

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
标题: Series60中如何动态改变按钮或关闭它们?
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"; }
      };  
 }
在代码中调用SetCommandSetL()方法:
iAvkonAppUi->Cba()->SetCommandSetL(R_MY_CBA);
iAvkonAppUi->Cba()->DrawNow();
如果需要关闭按钮,可以使用系统预定义的R_AVKON_SOFTKEYS_EMPTY资源
创建日期: 2003.2.4



BestRegards
hoolee
Reply With Quote

#10 Old 2005-04-25, 05:41

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
标题: 如何监测名片夹数据库的变化?
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



BestRegards
hoolee
Last edited by hoolee : 2005-04-25 at 15:23.
Reply With Quote

#11 Old 2005-04-25, 15:25

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
标题: 如何自定义询问对话框的按钮?
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;
    }
创建日期: 2003.3.5


BestRegards
hoolee
Reply With Quote

#12 Old 2005-04-25, 15:45

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
标题: 如何读取GIF图像中的一桢(动籣GIF文件)
TSS000039
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本:
大类: Symbian C++
子类: 多媒体
说明:下面的代码演示
了如何通过修改Bmpmanip例子,来完成从GIF图像文件中读取指定桢的功能。
Series 60 SDK中的CBmpmanipAppView例子(在\Series60Ex\bmpmanip\src\bmpmanipappview.cpp)
并按照如下代码进行修改:
Code:
TFrameInfo frameInfo;

// 从GIF图像文件中找到指定桢

// 将其定义到gifFrameIndex 

// 获取桢信息

iConverter->FrameInfo(gifFrameIndex, frameInfo);

// 从GIF的大小中创建位图

TInt err = iBitmap->Create(frameInfo.iOverallSizeInPixels,                           

KDeviceColourDepth);

if (err == KErrCouldNotConnect)

    {

     // 处理错误

    }

// 把一个GIF桢转换为位图

TRAPD(convertErr, iConverter->ConvertL(*iBitmap, gifFrameIndex));
创建日期: 2004.2.10


BestRegards
hoolee
Reply With Quote

#13 Old 2005-04-25, 15:48

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
标题: 怎样检测还有多少可用内存?
TSS000038
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本:
大类: Symbian C++
子类: 普通
说明:
下面的代码可以得到可用内存的数量。
Code:
TMemoryInfoV1Buf info;

UserHal::MemoryInfo(info);

TInt freeMemory = info().iFreeRamInBytes;
创建日期: 2003.3.10



BestRegards
hoolee
Reply With Quote

#14 Old 2005-04-25, 15:51

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
标题: 如何可以判断一部诺基亚60系列手持设备上的按键是否被按下去了
TSS000036
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本:
大类: Symbian C++
子类: 多媒体
说明:
很不幸,没有可用的API可以检测设备上的按键事件。

创建日期:2004.2.2
BestRegards
hoolee
Reply With Quote

#15 Old 2005-04-25, 15:54

Join Date: Mar 2005
Posts: 3,073
Send a message via Skype™ to hoolee
hoolee's Avatar
hoolee
Offline
Super Contributor
标题: 如何通过C++编程获取60系列设备中软件的Build版本
TSS000041
开发伙伴平台: 60系列开发平台 1.0/2.0
设备, 软件版本:
大类: Symbian C++
子类: 普通
说明:
一个基于60系列的手持设备的软件版本的Build,可以通过
使用SysUtil::GetSWVersion() 类来获取:
Code:
TBuf<64> swBuf;SysUtil::GetSWVersion(swBuf);

创建日期:2003.11.19
BestRegards
hoolee
Last edited by hoolee : 2005-05-10 at 11:52.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
N73 中文版 TANKFans Symbian 1 2007-09-05 03:15

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
User Rating: qfnZuserE5FratingQNx3E2E0000X