Symbian 学习比较之何设置桌面快捷方式
2010-04-14 05:22:00 来源:WEB开发网最近因为工作需要,开始研究如何将自己的应用程序通过code添加到快捷方式中。下面给大家介绍一下。
由于SDK版本不同,因此设置方式也不同
MR 和 FP1
// if the shortcut is in the primary container then we should move it to the secondary container
_LIT(KContainer_Secondary, "Container_Secondary");
RDbTable table2;
err = table2.Open(db, KContainer_Secondary);
User::LeaveIfError(err);
CleanupClosePushL(table2);
TInt rcount = table.CountL();
TInt found=EFalse;
for(table2.FirstL(); table2.AtRow(); table2.NextL())
{
table2.GetL();
if(table2.ColUint32(1)==KShortcut1)
{
found = ETrue;
break;
}
}
if(found)
{
// if the shortcut also exists in the secondary container then we update it
table2.UpdateL();
}
else
{
// else we create a new record
table2.InsertL();
}
// update/copy to the secondary container
TUint32 action = table.ColUint32(1);
table2.SetColL(1, action);
table2.SetColL(2, table.ColUint32(2));
TInt len = table.ColLength(3);
HBufC8* buf = HBufC8::NewLC(len);
TPtr8 ptr(buf->Des());
RDbColReadStream rs;
rs.OpenLC(table, 3);
rs.ReadL(ptr, len);
CleanupStack::PopAndDestroy(); // rs
RDbColWriteStream ws;
ws.OpenLC(table2, 3);
ws.WriteL(ptr, len);
ws.CommitL();
CleanupStack::PopAndDestroy(); // ws
CleanupStack::PopAndDestroy(buf);
table2.PutL();
CleanupStack::PopAndDestroy(&table2);
table.UpdateL();
}
else
{
// else we create a new record
更多精彩
赞助商链接