📄 sman.cpp
字号:
SetDefaultViewL(*iAgendaView);
iAgendaView->ReadAgenda(EFalse);
break;
}
// This should never be called unless the config file is corrupted :(
default:
{
SetDefaultViewL(*iTaskView);
iTaskView->refreshTaskList(TODO_REFRESH);
break;
}
};
if (oldScreenMode == 1)
CEikonEnv::Static()->InfoMsg(R_TBUF_SMANLOADED);
}
LOCAL_C void CloseLibrary(TAny* aLibrary)
{
((RLibrary*)aLibrary)->Close();
}
void CSMan2AppUi::launchControlPanel(TPtrC appletName)
{
RLibrary control;
CleanupStack::PushL(TCleanupItem(CloseLibrary, &control));
User::LeaveIfError(control.Load(appletName));
(*(TLoadDll)control.Lookup(1))(appletName);
CleanupStack::PopAndDestroy(); // control
}
void CSMan2AppUi::doFileMan(TInt op)
{
smanFileMan->fileList = iFileView->clipBoard;
smanFileMan->fileManOperation = iFileView->clipBoardOperation;
smanFileMan->targetPath.Copy(iFileView->currentPath);
smanFileMan->currentOperation = op;
smanFileMan->doWork();
}
void CSMan2AppUi::SetZoom(TInt zoomLevel)
{
if (viewId == EViewTask)
iTaskView->SetZoomLevel(zoomLevel);
else if (viewId == EViewBJack)
iBJackView->SetZoomLevel(zoomLevel);
else if (viewId == EViewDB)
iDBView->SetZoomLevel(zoomLevel);
else if (viewId == EViewFile)
iFileView->SetZoomLevel(zoomLevel);
else if (viewId == EViewSysInfo)
iSysInfoView->SetZoomLevel(zoomLevel);
else if (viewId == EViewAgenda)
iAgendaView->SetZoomLevel(zoomLevel);
static_cast<CSMan2Document*>(Document())->saveConfig();
}
void CSMan2AppUi::doProcessCommand(TInt aCommand)
{
ProcessCommandL(aCommand);
}
void CSMan2AppUi::doCancelMenu(void)
{
doProcessCommand(EEikCmdCanceled);
//iFlipCloseView->popupActive = EFalse;
}
void CSMan2AppUi::FileManGetFile(TPtrC *entryType, TPtrC *entryName)
{
TPtrC tempText;
tempText.Set(iFileView->cFileListBox->Model()->ItemTextArray()->MdcaPoint(iFileView->cFileListBox->View()->CurrentItemIndex()));
TextUtils::ColumnText(*entryName, 0, &tempText);
TextUtils::ColumnText(*entryType, 1, &tempText);
}
TBool CSMan2AppUi::PromptAppFixOrder(TInt aPromptResourceId)
{
if (!ConeUtils::FileExists(KAppConfigFileBackup))
return ETrue;
TBool retVal = EFalse;
HBufC *title = CEikonEnv::Static()->AllocReadResourceL(R_TBUF_DB_CONFIRM_CANCEL_TITLE);
HBufC *warning = CEikonEnv::Static()->AllocReadResourceL(aPromptResourceId);
TTime backupFileDateTime;
CEikonEnv::Static()->FsSession().Modified(KAppConfigFileBackup, backupFileDateTime);
TBuf<30> backupFileDateTimeText;
backupFileDateTime.FormatL(backupFileDateTimeText, _L("%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B "));
warning = warning->ReAllocL(warning->Length() + backupFileDateTimeText.Length());
warning->Des().Append(backupFileDateTimeText);
if (CEikonEnv::Static()->QueryWinL(*title, *warning))
retVal = ETrue;
delete title;
delete warning;
return retVal;
}
void CSMan2AppUi::HandleCommandL(TInt aCommand)
{
TInt i;
TPtrC tempText, entryType, entryName;
/*************************************************************
*
* Zoom command appears everywhere
*
**************************************************************/
if (aCommand == cmdZoom)
{
TInt zoomState = 0;
// This is faster than calling APIs....
if (viewId == EViewTask)
zoomState = configData->zoomMain;
else if (viewId == EViewBJack)
zoomState = configData->zoomBJack;
else if (viewId == EViewDB)
zoomState = configData->zoomDB;
else if (viewId == EViewFile)
zoomState = configData->zoomFile;
else if (viewId == EViewSysInfo)
zoomState = configData->zoomSysInfo;
else if (viewId == EViewAgenda)
zoomState = configData->zoomAgenda;
CQikZoomDialog::RunDlgLD((zoomState / ZOOM_INCREMENT) + EQikCmdZoomLevel1 - 1);
}
else if ((aCommand == EQikCmdZoomLevel1) || (aCommand == EQikCmdZoomLevel2) || (aCommand == EQikCmdZoomLevel3))
{
SetZoom(ZOOM_INCREMENT * (aCommand - EQikCmdZoomLevel1 + 1));
}
/*************************************************************
*
* Control panel shortcuts. Thanks to Phil Spencer of Symbian
*
**************************************************************/
if (aCommand == cmdCPIrda)
{
launchControlPanel(_L("Z:\\System\\Controls\\irdase.ctl"));
}
else if (aCommand == cmdCPBluetooth)
{
launchControlPanel(_L("Z:\\System\\Controls\\btconfig.ctl"));
}
/*************************************************************
*
* FN menu commands. Exists in all views.
*
**************************************************************/
else if (aCommand == cmdSwitchMemory)
{
if (iTaskView->firstTime)
{
iTaskView->refreshTaskList(TODO_REFRESH);
iTaskView->firstTime = EFalse;
}
ActivateViewL(TVwsViewId(KUidSMan2App, KUidTaskView));
}
else if (aCommand == cmdSwitchFile)
{
if (iFileView->firstTime)
{
iFileView->fillListBox(_L("C:\\"));
iFileView->firstTime = EFalse;
}
ActivateViewL(TVwsViewId(KUidSMan2App, KUidFileView));
}
else if (aCommand == cmdSwitchBJack)
{
ActivateViewL(TVwsViewId(KUidSMan2App, KUidBJackView));
}
else if (aCommand == cmdSwitchDB)
{
ActivateViewL(TVwsViewId(KUidSMan2App, KUidDBView));
}
else if (aCommand == cmdSwitchSysInfo)
{
ActivateViewL(TVwsViewId(KUidSMan2App, KUidSysInfoView));
}
else if (aCommand == cmdSwitchAgenda)
{
if (iAgendaView->firstTime)
{
iAgendaView->ReadAgenda(ETrue);
iAgendaView->firstTime = EFalse;
}
ActivateViewL(TVwsViewId(KUidSMan2App, KUidAgendaView));
}
else if (aCommand == cmdSwitchOptions)
{
CFnMenuToggle *switchDialog = new (ELeave) CFnMenuToggle(&(configData->fnActivatedMenus), &(configData->defaultView));
if (switchDialog->ExecuteLD(R_DIALOG_FN_OPTIONS) == EEikBidOk)
static_cast<CSMan2Document*>(Document())->saveConfig();
}
else if (aCommand == cmdControlPanel)
{
launchApp(KUidControlPanel, _L(""), EFalse);
}
/*************************************************************
*
* Commands for Agenda View.
*
**************************************************************/
else if (aCommand == cmdAgendaViewOtherDate)
{
iAgendaView->ViewOtherDate();
}
else if (aCommand == cmdAgendaRead)
{
iAgendaView->ReadAgenda(ETrue);
}
else if (aCommand == cmdAgendaCompleteCalendar)
{
configData->agendaShowCompleteCalendar = !configData->agendaShowCompleteCalendar;
static_cast<CSMan2Document*>(Document())->saveConfig();
iAgendaView->ReadAgenda(ETrue);
}
else if (aCommand == cmdAgendaCompleteTodo)
{
configData->agendaShowCompleteTodo = !configData->agendaShowCompleteTodo;
static_cast<CSMan2Document*>(Document())->saveConfig();
iAgendaView->ReadAgenda(ETrue);
}
else if (aCommand == cmdAgendaAutoExpandCalendar)
{
configData->agendaAutoExpandCalendar = !configData->agendaAutoExpandCalendar;
static_cast<CSMan2Document*>(Document())->saveConfig();
}
else if (aCommand == cmdAgendaAutoExpandTodo)
{
configData->agendaAutoExpandTodo = !configData->agendaAutoExpandTodo;
static_cast<CSMan2Document*>(Document())->saveConfig();
}
/*************************************************************
*
* Commands for Sysinfo View
*
**************************************************************/
else if (aCommand == cmdSysInfoRefresh)
{
iSysInfoView->refreshSysInfo();
}
/*************************************************************
*
* Commands for Database View
*
**************************************************************/
else if (aCommand == cmdDBCloseDB)
{
if (iDBView->dbIsOpened)
iDBView->doCloseDB(ETrue);
}
else if (aCommand == cmdDBSortAsc)
{
configData->dbSortAscending = ETrue;
static_cast<CSMan2Document*>(Document())->saveConfig();
iDBView->ShowRecordsList(ETrue, EFalse);
}
else if (aCommand == cmdDBSortDes)
{
configData->dbSortAscending = EFalse;
static_cast<CSMan2Document*>(Document())->saveConfig();
iDBView->ShowRecordsList(ETrue, EFalse);
}
else if (aCommand == cmdDBReInit)
{
iDBView->doReInitDB();
}
else if (aCommand == cmdDBChangePassword)
{
iDBView->doChangePassword();
}
else if (aCommand == cmdDBReadDB)
{
iDBView->doReadDB();
}
else if (aCommand == cmdDBDo)
{
LaunchPopupMenuL(R_DB_DOBUTTON, TPoint(iDBView->Size().iWidth, iDBView->PositionRelativeToScreen().iY + iDBView->Size().iHeight - 2), EPopupTargetBottomRight);
}
else if (aCommand == cmdDBBack)
{
if ((iDBView->currentDBOp == CSMan2DBView::DBOp_Editing) || (iDBView->currentDBOp == CSMan2DBView::DBOp_Adding))
{
HBufC* dataBuffer = CEikonEnv::Static()->AllocReadResourceL(R_TBUF_DB_CONFIRM_CANCEL_TITLE);
HBufC* dataBuffer2 = CEikonEnv::Static()->AllocReadResourceL(R_TBUF_DB_CONFIRM_CANCEL);
if (CEikonEnv::Static()->QueryWinL(*dataBuffer, *dataBuffer2))
iDBView->ShowRecordsList(EFalse, ETrue);
delete dataBuffer;
delete dataBuffer2;
}
else
iDBView->ShowRecordsList(EFalse, ETrue);
}
else if (aCommand == cmdDBSave)
{
if (iDBView->SaveRecord(iDBView->currentRecordIndex))
iDBView->ShowRecordsList(ETrue, ETrue);
else
iEikonEnv->InfoMsg(R_TBUF_DB_ERR_SAVE);
}
else if (aCommand == cmdDBView)
{
iDBView->doDisplayOneRecord(ETrue);
}
else if (aCommand == cmdDBDel)
{
if (!iDBView->doDelete())
iEikonEnv->InfoMsg(R_TBUF_DB_ERR_MASS_DELETE);
else
iDBView->ShowRecordsList(ETrue, EFalse);
}
else if (aCommand == cmdDBAdd)
{
iDBView->ShowRecordsSingle(0, ETrue);
}
else if (aCommand == cmdDBEdit)
{
iDBView->doDisplayOneRecord(EFalse);
}
else if (aCommand == cmdDBCompact)
{
if (!iDBView->doCompact())
iEikonEnv->InfoMsg(R_TBUF_DB_ERR_COMPACT);
else
iEikonEnv->InfoMsg(R_TBUF_MISC_DONE);
}
else if (aCommand == cmdDBUpdateStats)
{
if (!iDBView->doUpdateStats())
iEikonEnv->InfoMsg(R_TBUF_DB_ERR_UPDATESTATS);
else
iEikonEnv->InfoMsg(R_TBUF_MISC_DONE);
}
/*************************************************************
*
* Commands for File View.
*
**************************************************************/
else if (aCommand == cmdDoButton)
{
LaunchPopupMenuL(R_FILEMAN_DOBUTTON, TPoint(iFileView->Size().iWidth, iFileView->cFileListBox->PositionRelativeToScreen().iY + iFileView->cFileListBox->Size().iHeight + 6), EPopupTargetBottomRight);
}
else if (aCommand == cmdFileMan_IrDA)
{
configData->beamProtocol = CBlueBeam::protocolIrDA;
static_cast<CSMan2Document*>(Document())->saveConfig();
iFileView->cFileListBox->ItemDrawer()->SetHighlightedBackColor(TRgb(255, 0, 0));
iFileView->cFileListBox->DrawDeferred();
}
else if (aCommand == cmdFileMan_Bluetooth)
{
configData->beamProtocol = CBlueBeam::protocolBluetooth;
static_cast<CSMan2Document*>(Document())->saveConfig();
iFileView->cFileListBox->ItemDrawer()->SetHighlightedBackColor(TRgb(0, 0, 255));
iFileView->cFileListBox->DrawDeferred();
}
else if (aCommand == cmdFileManReload)
{
iFileView->fillListBox(iFileView->currentPath);
}
else if ((aCommand == cmdFileManOpen) || (aCommand == cmdFileManOpenOverride))
{
FileManGetFile(&entryType, &entryName);
if ((entryType.Compare(_L("<drv>")) != 0) && (entryName.Compare(_L("..")) != 0) && (entryType.Compare(_L("<dir>")) != 0))
{
TFileName fileName;
fileName.Copy(iFileView->currentPath);
fileName.Append(entryName);
fileName.UpperCase();
TParsePtr tempName(fileName);
if (tempName.Ext() == _L(".APP"))
{
if ((configData->autoRunApp) || (aCommand == cmdFileManOpenOverride))
FindAndLaunchAppNoUid(&(tempName.FullName()));
}
else if (tempName.Ext() == _L(".EXE"))
{
if ((configData->autoRunApp) || (aCommand == cmdFileManOpenOverride))
EikDll::StartExeL(tempName.FullName());
}
/*
else if (tempName.Ext() == _L(".CLASS"))
{
CApaCommandLine* cmdLine=CApaCommandLine::NewLC();
cmdLine->SetLibraryNameL(fileName);
cmdLine->SetCommandL(EApaCommandOpen);
RApaLsSession ls;
User::LeaveIfError(ls.Connect());
CleanupClosePushL(ls);
User::LeaveIfError(ls.StartApp(*cmdLine));
CleanupStack::PopAndDestroy(2); // ls and cmdLine
}
*/
else if ((configData->autoOpenFile) || (aCommand == cmdFileManOpenOverride))
{
QikFileUtils::StartAppL(fileName);
}
}
else
iEikonEnv->InfoMsg(R_TBUF_FILEMAN_NOTAFILE);
/*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -