示例#1
0
void FMRUList::AddMRUItem(const FString& InItem)
{
	FString CleanedName = FPaths::ConvertRelativePathToFull(InItem);

	// See if the item already exists in the list.  If so,
	// move it to the top of the list and leave.
	const int32 ItemIndex = Items.Find( CleanedName );
	if ( ItemIndex != INDEX_NONE )
	{
		MoveToTop( ItemIndex );
	}
	else
	{
		// Item is new, so add it to the bottom of the list.
		if( CleanedName.Len() )
		{
			new(Items) FString( *CleanedName );
			MoveToTop( Items.Num()-1 );
		}

		Cull();
	}
	
	WriteToINI();
}
示例#2
0
bool FMRUList::VerifyMRUFile(int32 InItem)
{
	check( InItem > -1 && InItem < GetMaxItems() );
	const FString filename = Items[InItem];

	// If the file doesn't exist, tell the user about it, remove the file from the list
	if( IFileManager::Get().FileSize( *filename ) == -1 )
	{
		FMessageLog EditorErrors("EditorErrors");
		FFormatNamedArguments Arguments;
		Arguments.Add(TEXT("FileName"), FText::FromString(filename));
		EditorErrors.Warning(FText::Format( NSLOCTEXT("MRUList", "Error_FileDoesNotExist", "File does not exist : '{FileName}'.  It will be removed from the recent items list."), Arguments ) );
		EditorErrors.Notify(NSLOCTEXT("MRUList", "Notification_FileDoesNotExist", "File does not exist! Removed from recent items list!"));
		RemoveMRUItem( InItem );
		WriteToINI();

		return false;
	}

	// Otherwise, move the file to the top of the list
	MoveToTop( InItem );
	WriteToINI();

	return true;
}
示例#3
0
void Widget::SetKeyFocus(bool b)
{
	if (b)
	{
		gui->hasKeyFocus = this;
		MoveToTop();
	}
	else if (gui->hasKeyFocus == this)
	{
		gui->hasKeyFocus = NULL;
	}
}