예제 #1
0
bool ContextMenuUtil::GetContextMenuAction(int action, ContextMenuAction** item)
{
	ContextMenuItem* contextMenuItem;

	if (GetContextMenuItem(action, &contextMenuItem))
	{
		ContextMenuAction* action = new ContextMenuAction();
		action->SetUuid(contextMenuItem->GetUuid());
		action->SetFiles(_selectedFiles);

		item = &action;

		return true;
	}

	return false;
}
예제 #2
0
bool ContextMenuUtil::GetContextMenuAction(std::wstring* title, ContextMenuAction** item)
{
	for (vector<ContextMenuItem*>::iterator it = _menuList->begin(); it != _menuList->end(); it++)
	{
		ContextMenuItem* temp = *it;
		wstring* currentTitle = temp->GetTitle();

		if (currentTitle->compare(*title) == 0)
		{
			ContextMenuAction* action = new ContextMenuAction();
			action->SetUuid(temp->GetUuid());
			action->SetFiles(_selectedFiles);

			item = &action;
			return true;
		}
	}

	return false;
}
예제 #3
0
bool ContextMenuUtil::PerformAction(int command)
{
	ContextMenuItem* contextMenuItem;

	if (!GetContextMenuItem(command, &contextMenuItem))
	{
		return false;
	}

	Json::Value jsonValue;

	jsonValue[NATIVITY_UUID] = StringUtil::toString(contextMenuItem->GetUuid()->c_str());

	for (vector<wstring>::iterator it = _selectedFiles->begin(); it != _selectedFiles->end(); it++)
	{
		wstring selectedFile = *it;

		jsonValue[NATIVITY_FILES].append(StringUtil::toString(selectedFile));
	}

	Json::Value jsonRoot;

	jsonRoot[NATIVITY_COMMAND] = NATIVITY_CONTEXT_MENU_ACTION;
	jsonRoot[NATIVITY_VALUE] = jsonValue;

	Json::FastWriter jsonWriter;

	wstring* jsonMessage = new wstring();

	jsonMessage->append(StringUtil::toWstring(jsonWriter.write(jsonRoot)));

	wstring* response = new wstring();

	if (!_communicationSocket->SendMessageReceiveResponse(jsonMessage->c_str(), response))
	{
		return false;
	}

	return true;
}