⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialogs.cpp

📁 手机文件浏览器 Here are the sources to SMan v1.2c 1.2 is a major jump from v1.1. You will see this from the
💻 CPP
📖 第 1 页 / 共 3 页
字号:
			static_cast<CEikGlobalTextEditor*>(Control(cFileAttName))->MoveDisplayL(TCursorPosition::EFPageUp);
			static_cast<CEikGlobalTextEditor*>(Control(cFileAttName))->UpdateScrollBarsL();
			return EKeyWasConsumed;
		}
	}
	return CEikDialog::OfferKeyEventL(aKeyEvent, aType);
}

void CFileManAttrDialog::PostLayoutDynInitL()
{
	TEntry fileAtt;
	CEikGlobalTextEditor *textEditor = STATIC_CAST(CEikGlobalTextEditor*, Control(cFileAttName));
	textEditor->CreateScrollBarFrameL();
	textEditor->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto);

	if (fs.Entry(theFile, fileAtt) == KErrNone)
	{
		TParsePtr parsedFile(theFile);
		textEditor->SetTextL(&(parsedFile.FullName()));
		
		HBufC* dataBufferSize;
		TBuf<2> lineBreak;
		lineBreak.Append(CEditableText::ELineBreak);
		lineBreak.Append(CEditableText::ELineBreak);
		if (!fileAtt.IsDir())
		{
			dataBufferSize = CEikonEnv::Static()->AllocReadResourceL(R_TBUF_FILEMAN_PROP_SIZE);
			
			TInt comma = 0;
			TBuf<20> textNumeric;
			textNumeric.Format(_L("%d"), fileAtt.iSize);
			if (fileAtt.iSize > 999)
			{
				textNumeric.Insert(textNumeric.Length() - 3, _L(","));
				comma++;
			}
			if (fileAtt.iSize > 999999)
				textNumeric.Insert(textNumeric.Length() - 3 - comma - 3, _L(","));
			
			dataBufferSize = dataBufferSize->ReAllocL(dataBufferSize->Length() + textNumeric.Length());
			dataBufferSize->Des().Append(textNumeric);
	
			HBufC* dataBufferByte = CEikonEnv::Static()->AllocReadResourceL(R_TBUF_FILEMAN_PROP_BYTE);
			dataBufferSize = dataBufferSize->ReAllocL(dataBufferSize->Length() + dataBufferByte->Length());
			dataBufferSize->Des().Append(*dataBufferByte);
			delete dataBufferByte;
		}
		else
			dataBufferSize = CEikonEnv::Static()->AllocReadResourceL(R_TBUF_FILEMAN_PROP_ISFOLDER);
					
		TBuf<50> tempTime;
		fileAtt.iModified.FormatL(tempTime, _L("%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B  "));
		HBufC* dataBufferLastMod = CEikonEnv::Static()->AllocReadResourceL(R_TBUF_FILEMAN_PROP_LASTMOD);
		dataBufferSize = dataBufferSize->ReAllocL(dataBufferSize->Length() + tempTime.Length() + lineBreak.Length() + dataBufferLastMod->Length());
		dataBufferSize->Des().Append(lineBreak);
		dataBufferSize->Des().Append(*dataBufferLastMod);
		delete dataBufferLastMod;
		dataBufferSize->Des().Append(tempTime);
		
		textEditor->InsertDeleteCharsL(textEditor->TextLength(), lineBreak, TCursorSelection(0, 0));
		textEditor->InsertDeleteCharsL(textEditor->TextLength(), *dataBufferSize, TCursorSelection(0, 0));
		
		delete dataBufferSize;
		
		if (fileAtt.IsReadOnly())
			static_cast<CEikCheckBox*>(Control(cFileAttReadOnly))->SetState(CEikButtonBase::ESet);
		if (fileAtt.IsArchive())
			static_cast<CEikCheckBox*>(Control(cFileAttArchive))->SetState(CEikButtonBase::ESet);
		if (fileAtt.IsHidden())
			static_cast<CEikCheckBox*>(Control(cFileAttHidden))->SetState(CEikButtonBase::ESet);
		if (fileAtt.IsSystem())
			static_cast<CEikCheckBox*>(Control(cFileAttSystem))->SetState(CEikButtonBase::ESet);
	}
	else
	{
		HBufC* dataBuffer = CEikonEnv::Static()->AllocReadResourceL(R_TBUF_FILEMAN_ERRREADATTR);
		textEditor->SetTextL(dataBuffer);
		delete dataBuffer;
	}
}

TBool CFileManAttrDialog::OkToExitL(TInt aButtonId)
{
	TInt attSetFlags = 0;
	TInt attClearFlags = 0;
	
	if (static_cast<CEikCheckBox*>(Control(cFileAttReadOnly))->State() == CEikButtonBase::ESet)
		attSetFlags = attSetFlags | KEntryAttReadOnly;
	else
		attClearFlags = attClearFlags | KEntryAttReadOnly;

	if (static_cast<CEikCheckBox*>(Control(cFileAttHidden))->State() == CEikButtonBase::ESet)
		attSetFlags = attSetFlags | KEntryAttHidden;
	else
		attClearFlags = attClearFlags | KEntryAttHidden;

	if (static_cast<CEikCheckBox*>(Control(cFileAttSystem))->State() == CEikButtonBase::ESet)
		attSetFlags = attSetFlags | KEntryAttSystem;
	else
		attClearFlags = attClearFlags | KEntryAttSystem;

	if (static_cast<CEikCheckBox*>(Control(cFileAttArchive))->State() == CEikButtonBase::ESet)
		attSetFlags = attSetFlags | KEntryAttArchive;
	else
		attClearFlags = attClearFlags | KEntryAttArchive;
	
	if (aButtonId == EEikBidOk)
	{
		if (fs.SetAtt(theFile, attSetFlags, attClearFlags) != KErrNone)
			iEikonEnv->InfoMsg(R_TBUF_FILEMAN_ERRSETATTRIBS);
	}
	return ETrue;
}

/*************************************************************
*
* Fn Menu toggling
*
**************************************************************/

CFnMenuToggle::CFnMenuToggle(TUint *bits, TInt *defaultView)
{
	toggleBits = bits;
	theDefaultView = defaultView;
}

CFnMenuToggle::~CFnMenuToggle()
{
}

TBool CFnMenuToggle::OkToExitL(TInt aButtonId)
{
	TUint tempBits = 0;
	
	if (aButtonId == EEikBidOk)
	{
		if (((CEikCheckBox*)(Control(cFnToggleMenu1)))->State() == CEikButtonBase::ESet)
			tempBits = tempBits | 1;
		if (((CEikCheckBox*)(Control(cFnToggleMenu2)))->State() == CEikButtonBase::ESet)
			tempBits = tempBits | 2;
		if (((CEikCheckBox*)(Control(cFnToggleMenu3)))->State() == CEikButtonBase::ESet)
			tempBits = tempBits | 4;
		if (((CEikCheckBox*)(Control(cFnToggleMenu4)))->State() == CEikButtonBase::ESet)
			tempBits = tempBits | 8;
		if (((CEikCheckBox*)(Control(cFnToggleMenu5)))->State() == CEikButtonBase::ESet)
			tempBits = tempBits | 16;
		*toggleBits = tempBits;
		
		*theDefaultView = static_cast<CEikChoiceList*>(Control(cFnStartupView))->CurrentItem();
	}
	return ETrue;
}

void CFnMenuToggle::PreLayoutDynInitL()
{
	if ((*toggleBits & 1) > 0)
		((CEikCheckBox*)(Control(cFnToggleMenu1)))->SetState(CEikButtonBase::ESet);
	if ((*toggleBits & 2) > 0)
		((CEikCheckBox*)(Control(cFnToggleMenu2)))->SetState(CEikButtonBase::ESet);
	if ((*toggleBits & 4) > 0)
		((CEikCheckBox*)(Control(cFnToggleMenu3)))->SetState(CEikButtonBase::ESet);
	if ((*toggleBits & 8) > 0)
		((CEikCheckBox*)(Control(cFnToggleMenu4)))->SetState(CEikButtonBase::ESet);
	if ((*toggleBits & 16) > 0)
		((CEikCheckBox*)(Control(cFnToggleMenu5)))->SetState(CEikButtonBase::ESet);

	CEikCaptionedControl *separatorControl = Line(cFnToggleMenu5);
	separatorControl->SetDividerAfter(ETrue);
		
	CEikChoiceList *defaultViewChoice = STATIC_CAST(CEikChoiceList*, Control(cFnStartupView));
	defaultViewChoice->SetCurrentItem(*theDefaultView);
}

/*************************************************************
*
* CRC progress dialog
*
**************************************************************/

CCRCDialog::CCRCDialog(TPtrC fileName)
{
	theFileName.Set(fileName);
	static_cast<CSMan2AppUi*>(CEikonEnv::Static()->EikAppUi())->iFileView->crcCalculator->crcDialogActive = ETrue;
}

void CCRCDialog::stopCRC()
{
	static_cast<CSMan2AppUi*>(CEikonEnv::Static()->EikAppUi())->iFileView->crcCalculator->crcDialogActive = EFalse;
	static_cast<CSMan2AppUi*>(CEikonEnv::Static()->EikAppUi())->iFileView->crcCalculator->Cancel();
}

CCRCDialog::~CCRCDialog()
{
	stopCRC();
}

void CCRCDialog::PreLayoutDynInitL()
{
	static_cast<CEikProgressInfo*>(Control(cCRCProgress))->SetFinalValue(100);
	static_cast<CEikProgressInfo*>(Control(cCRCProgress))->SetAndDraw(0);
	static_cast<CEikLabel*>(Control(cCRCValue))->SetTextL(_L("Calculating....."));
	TFileName tempCopy;
	tempCopy.Copy(theFileName);
	TParsePtr theParsedFile(tempCopy);
	static_cast<CEikLabel*>(Control(cCRCFileName))->SetTextL(theParsedFile.NameAndExt());
	ButtonGroupContainer().DimCommand(EEikBidOk, ETrue);
}

void CCRCDialog::updateProgress(TInt aProgress)
{
	static_cast<CEikProgressInfo*>(Control(cCRCProgress))->SetAndDraw(aProgress);
}

/*************************************************************
*
* DB progress dialog
*
**************************************************************/

CDBProgressDialog::CDBProgressDialog()
{
}

CDBProgressDialog::~CDBProgressDialog()
{
}

void CDBProgressDialog::PostLayoutDynInitL()
{
	static_cast<CEikProgressInfo*>(Control(cDBCompactProgress))->SetFinalValue(0);
	static_cast<CEikProgressInfo*>(Control(cDBCompactProgress))->SetAndDraw(0);
}

void CDBProgressDialog::updateProgress(TInt aProgress)
{
	static_cast<CEikProgressInfo*>(Control(cDBCompactProgress))->SetAndDraw(aProgress);
}

void CDBProgressDialog::setProgressMaxValue(TInt aMaxValue)
{
	static_cast<CEikProgressInfo*>(Control(cDBCompactProgress))->SetFinalValue(aMaxValue);
}

/*************************************************************
*
* Generic dialog to get password
*
**************************************************************/

CGetPasswordDialog::CGetPasswordDialog(TPassword *thePassword)
{
	localPassword = thePassword;
}

CGetPasswordDialog::~CGetPasswordDialog()
{
}

TBool CGetPasswordDialog::OkToExitL(TInt aButtonId)
{
	if (aButtonId == EEikBidOk)
		static_cast<CEikSecretEditor*>(Control(cDBPassword))->GetText(*localPassword);
	return ETrue;
}

/*************************************************************
*
* Generic dialog to change password
*
**************************************************************/

CSetPasswordDialog::CSetPasswordDialog(TPassword *thePassword)
{
	localPassword = thePassword;
}

CSetPasswordDialog::~CSetPasswordDialog()
{
}

TBool CSetPasswordDialog::OkToExitL(TInt aButtonId)
{
	if (aButtonId == EEikBidOk)
	{
		TPassword password1, password2;
		static_cast<CEikSecretEditor*>(Control(cDBPassword))->GetText(password1);
		static_cast<CEikSecretEditor*>(Control(cDBPasswordReEnter))->GetText(password2);
		
		if (password1.Compare(password2) == 0)
			static_cast<CEikSecretEditor*>(Control(cDBPassword))->GetText(*localPassword);
		else
		{
			iEikonEnv->InfoMsg(R_TBUF_DB_ERR_PASSWORDNOMATCH);
			return EFalse;
		}
	}
	return ETrue;
}

/*************************************************************
*
* Detailed calendar dialog
*
**************************************************************/
TKeyResponse CAgendaDetail::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
{
	if (aType == EEventKey)
	{
		if (aKeyEvent.iCode == EQuartzKeyTwoWayDown)
		{
			static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->MoveDisplayL(TCursorPosition::EFPageDown);
			static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->UpdateScrollBarsL();
			return EKeyWasConsumed;
		}
		else if (aKeyEvent.iCode == EQuartzKeyTwoWayUp)
		{
			static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->MoveDisplayL(TCursorPosition::EFPageUp);
			static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->UpdateScrollBarsL();
			return EKeyWasConsumed;
		}
	}
	return CEikDialog::OfferKeyEventL(aKeyEvent, aType);
}

CAgendaDetail::CAgendaDetail()
{
}

CAgendaDetail::~CAgendaDetail()
{
}

void CAgendaDetail::PostLayoutDynInitL()
{
	static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->CreateScrollBarFrameL();
	static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto);
	static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->SetCursorPosL(0, EFalse);	
}

void CAgendaDetail::PreLayoutDynInitL()
{
	static_cast<CEikLabel*>(Control(cAgendaDetailStartDateTime))->SetTextL(*startDateTime);
	static_cast<CEikLabel*>(Control(cAgendaDetailEndDateTime))->SetTextL(*endDateTime);
	static_cast<CEikLabel*>(Control(cAgendaDetailAlarmDateTime))->SetTextL(*alarmDateTime);
	static_cast<CEikLabel*>(Control(cAgendaDetailLocation))->SetTextL(*location);

	static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->SetTextL(&notes);
}

/*************************************************************
*
* Detailed todo dialog
*
**************************************************************/
TKeyResponse CTodoDetail::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
{
	if (aType == EEventKey)
	{
		if (aKeyEvent.iCode == EQuartzKeyTwoWayDown)
		{
			static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->MoveDisplayL(TCursorPosition::EFPageDown);
			static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->UpdateScrollBarsL();
			return EKeyWasConsumed;
		}
		else if (aKeyEvent.iCode == EQuartzKeyTwoWayUp)
		{
			static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->MoveDisplayL(TCursorPosition::EFPageUp);
			static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->UpdateScrollBarsL();
			return EKeyWasConsumed;
		}
	}
	return CEikDialog::OfferKeyEventL(aKeyEvent, aType);
}

CTodoDetail::CTodoDetail()
{
}

CTodoDetail::~CTodoDetail()
{
}

void CTodoDetail::PostLayoutDynInitL()
{
	static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->CreateScrollBarFrameL();
	static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto);
	static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->SetCursorPosL(0, EFalse);	
}

void CTodoDetail::PreLayoutDynInitL()
{
	static_cast<CEikLabel*>(Control(cAgendaDetailEndDateTime))->SetTextL(*dueDateTime);
	static_cast<CEikLabel*>(Control(cAgendaDetailAlarmDateTime))->SetTextL(*alarmDateTime);
	static_cast<CEikLabel*>(Control(cAgendaDetailPriority))->SetTextL(*priority);

	static_cast<CEikGlobalTextEditor*>(Control(cAgendaDetailNotes))->SetTextL(&notes);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -