WLayoutChatLog::WLayoutChatLog(ITreeItemChatLogEvents * pContactOrGroupParent)
	{
	Assert(pContactOrGroupParent != NULL);
	m_pContactOrGroup_NZ = pContactOrGroupParent;
	m_pContactParent_YZ = (pContactOrGroupParent->EGetRuntimeClass() == RTI(TContact)) ? (TContact *)pContactOrGroupParent : NULL;
	m_pwFindText = NULL;
	m_tidChatStateComposing = d_zNA;

	#ifdef COMPILE_WITH_CHATLOG_HTML
	m_pwChatLog_NZ = new WChatLogHtml(this, pContactOrGroupParent);
	#else
	m_pwChatLog_NZ = new WChatLog(this, pContactOrGroupParent);
	#endif
	setStretchFactor(0, 5);
	/*
	if (pContactParent_YZ != NULL)
		{
		if (pContactParent_YZ->m_uFlagsContact & TContact::FC_kfContactNeedsInvitation)
			WidgetContactInvitation_Show();
		if (pContactParent_YZ->m_uFlagsContact & TContact::FC_kfContactUnsolicited)
			Layout_NoticeAuxiliaryAdd(PA_DELETING new WNoticeContactUnsolicited(pContactParent_YZ));
		}
	*/

	m_pwChatInput = new WChatInput(this);

	QWidget * pWidget = new QWidget(this);
//	pWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
	OLayoutHorizontal * pLayoutMessageInput = new OLayoutHorizontal(pWidget);
	pLayoutMessageInput->setContentsMargins(0, 0, 5, 0);
	pLayoutMessageInput->addWidget(m_pwChatInput);
	OLayoutVertical * pLayoutButtons = new OLayoutVerticalAlignTop(pLayoutMessageInput);
	pLayoutButtons->setSpacing(0);
	m_pwButtonSendBitcoin = new WButtonIconForToolbar(eMenuIcon_Bitcoin, "Send Bitcoins");
	pLayoutButtons->addWidget(m_pwButtonSendBitcoin);
	connect(m_pwButtonSendBitcoin, SIGNAL(clicked()), this, SLOT(SL_ButtonSendBitcoin()));

	WButtonIconForToolbar * pwButton = new WButtonIconForToolbar(eMenuIcon_FileUpload, "Send File\n\nYou may drag and drop the file, or copy & paste the file from Windows Explorer");
	pLayoutButtons->addWidget(pwButton);
	connect(pwButton, SIGNAL(clicked()), this, SLOT(SL_ButtonSendFile()));

	pwButton = new WButtonIconForToolbar(eMenuIcon_ContactAdd, "Add people to the converstation");
	pLayoutButtons->addWidget(pwButton);
	connect(pwButton, SIGNAL(clicked()), this, SLOT(SL_ButtonAddContacts()));

	pwButton = new WButtonIconForToolbar(eMenuIcon_Vote, "Send a ballot to the group to vote");
	pLayoutButtons->addWidget(pwButton);
	connect(pwButton, SIGNAL(clicked()), this, SLOT(SL_ButtonSendBallot()));

	setChildrenCollapsible(false);		// Do not allow the widget WChatInput() to collapse; it would be very confusing to the user

//	addWidget(PA_CHILD m_pwChatLog);
	//addWidget(PA_CHILD new WFindText(m_pwChatLog->document()));
//	addWidget(PA_CHILD m_pwChatInput);
	setAcceptDrops(true);
	}
WNavigationTree::WNavigationTree() : QDockWidget(tr("Navigation"))
	{
	g_pwNavigationTree = this;
	setObjectName(c_sNavigation);
	m_pTreeWidgetItemEditing = NULL;

	//setStyleSheet("border: 1px solid red;");
	g_pwButtonSwitchProfile = new WButtonIconForToolbarWithDropDownMenu(this, eMenuIconIdentities, NULL);
	g_pwButtonSwitchProfile->setCursor(Qt::ArrowCursor);	// We need to explicitly set the cursor to arrow because the caption uses the OpenHandCursor which every child inherits
	g_pwMenuSwitchProfile = g_pwButtonSwitchProfile->PwGetMenu();
	connect(g_pwMenuSwitchProfile, SIGNAL(aboutToShow()), this, SLOT(SL_MenuProfilesShow()));
	connect(g_pwMenuSwitchProfile, SIGNAL(triggered(QAction*)), this, SLOT(SL_MenuProfileSelected(QAction*)));

#if 1
	setTitleBarWidget(PA_CHILD new WNavigationTreeCaption);	// Customize the title bar of the navigation tree
#endif

	QWidget * pwWidgetLayout = new QWidget(this);	// Since the QDockWidget can handle only one widget, we create a widget with a layout inside
	OLayoutVertical * pLayoutVertical = new OLayoutVertical(pwWidgetLayout);		// Vertical layout to stack the profile switcher, search, tree view and the status.
	Layout_MarginsClear(INOUT pLayoutVertical);
	pLayoutVertical->setSpacing(0);

	WEditSearch * pwEditSearch = new WEditSearch;
	connect(pwEditSearch, SIGNAL(textChanged(QString)), this, SLOT(SL_EditSearchTextChanged(QString)));
	pLayoutVertical->addWidget(pwEditSearch);


	//setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
	setFeatures(/*DockWidgetClosable |*/ DockWidgetMovable | DockWidgetFloatable);	// Hide the close button in the title bar

	m_pwTreeView = new WTreeWidget;
	m_pwTreeView->header()->hide();
	m_pwTreeView->setContextMenuPolicy(Qt::CustomContextMenu);	// Send the signal customContextMenuRequested()
	//m_pwTreeView->setFrameStyle(QFrame::NoFrame);
	connect(m_pwTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(SL_TreeCustomContextMenuRequested(QPoint)));
	connect(m_pwTreeView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(SL_TreeItemSelectionChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
	connect(m_pwTreeView, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(SL_TreeItemClicked(QTreeWidgetItem*,int)));

	pLayoutVertical->addWidget(m_pwTreeView);

	OLayoutHorizontal * pLayout = new OLayoutHorizontal(pLayoutVertical);
	//pLayout->addWidget(new WLabel("Status:"));

	g_pwButtonStatusOfNavigationTree = new WButtonIconForToolbarWithDropDownMenu(this, eMenuAction_PresenceAccountOffline, "Status: Online");
	g_pwButtonStatusOfNavigationTree->setToolTip("Change your status");

	EMenuAction eMenuAction_Presence = (EMenuAction)(g_uPreferences & P_kmPresenceMask);
	if (eMenuAction_Presence == ezMenuActionNone)
		eMenuAction_Presence = eMenuAction_PresenceAccountOnline;
	Widget_SetIconButton(INOUT g_pwButtonStatusOfNavigationTree, eMenuAction_Presence);
	g_pwMenuStatus = (WMenu *)g_pwButtonStatusOfNavigationTree->menu();
	g_pwMenuStatus->InitAsDymanicMenu();
	/*
	g_pwMenuStatus = new WMenu;
	g_pwMenuStatus->InitAsDymanicMenu();
	g_pwButtonStatusOfNavigationTree->setMenu(g_pwMenuStatus);
	*/
//	connect(g_pMenuStatus, SIGNAL(aboutToShow()), g_pwMainWindow, SLOT(SL_MenuAboutToShow()));
//	connect(g_pMenuStatus, SIGNAL(triggered(QAction*)), g_pwMainWindow, SLOT(SL_MenuActionTriggered(QAction*)));

//	pwButtonStatus->addAction(new QAction("test", pwButtonStatus));

	pLayout->addWidget(g_pwButtonStatusOfNavigationTree);
	pLayout->addStretch();
	//WButtonTextWithIcon * pwButtonAddContact = new WButtonTextWithIcon("Add Peer |Add a new peer to your profile", eMenuAction_ContactAdd);
	WButtonIconForToolbar * pwButtonAddContact = new WButtonIconForToolbar(eMenuAction_ContactAdd, "Add a new peer to your "d_sza_profile);
	pLayout->addWidget(pwButtonAddContact, Qt::AlignBottom);
	connect(pwButtonAddContact, SIGNAL(clicked()), this, SLOT(SL_ContactNew()));

	//pLayoutVertical->addWidget(g_pwButtonStatusOfNavigationTree);
#if 1
	setWidget(PA_CHILD pwWidgetLayout);
#else
	setWidget(PA_CHILD m_pwTreeView);
#endif
	}