SectionWidget* ContainerWidget::addSectionContent(const SectionContent::RefPtr& sc, SectionWidget* sw, DropArea area)
{
	if (!sw)
	{
		if (_sections.isEmpty())
		{	// Create default section
			sw = newSectionWidget();
			addSection(sw);
		}
		else if (area == CenterDropArea)
			// Use existing default section
			sw = _sections.first();
	}

	// Drop it based on "area"
	InternalContentData data;
	data.content = sc;
	data.titleWidget = new SectionTitleWidget(sc, NULL);
	data.contentWidget = new SectionContentWidget(sc, NULL);

#if QT_VERSION >= 0x050000
	QObject::connect(data.titleWidget, &SectionTitleWidget::activeTabChanged, this, &ContainerWidget::onActiveTabChanged);
#else
	QObject::connect(data.titleWidget, SIGNAL(activeTabChanged()), this, SLOT(onActiveTabChanged()));
#endif

	return dropContent(data, sw, area, false);
}
bool ContainerWidget::showSectionContent(const SectionContent::RefPtr& sc)
{
	// Search SC in floatings
	for (int i = 0; i < _floatings.count(); ++i)
	{
		FloatingWidget* fw = _floatings.at(i);
		const bool found = fw->content()->uid() == sc->uid();
		if (!found)
			continue;
		fw->setVisible(true);
		fw->_titleWidget->setVisible(true);
		fw->_contentWidget->setVisible(true);
		emit sectionContentVisibilityChanged(sc, true);
		return true;
	}

	// Search SC in hidden sections
	// Try to show them in the last position, otherwise simply append
	// it to the first section (or create a new section?)
	if (_hiddenSectionContents.contains(sc->uid()))
	{
		const HiddenSectionItem hsi = _hiddenSectionContents.take(sc->uid());
		hsi.data.titleWidget->setVisible(true);
		hsi.data.contentWidget->setVisible(true);
		SectionWidget* sw = NULL;
		if (hsi.preferredSectionId > 0 && (sw = SWLookupMapById(this).value(hsi.preferredSectionId)) != NULL)
		{
			sw->addContent(hsi.data, true);
			emit sectionContentVisibilityChanged(sc, true);
			return true;
		}
		else if (_sections.size() > 0 && (sw = _sections.first()) != NULL)
		{
			sw->addContent(hsi.data, true);
			emit sectionContentVisibilityChanged(sc, true);
			return true;
		}
		else
		{
			sw = newSectionWidget();
			addSection(sw);
			sw->addContent(hsi.data, true);
			emit sectionContentVisibilityChanged(sc, true);
			return true;
		}
	}

	// Already visible?
	// TODO
	qWarning("Unable to show SectionContent, don't know where 8-/ (already visible?)");
	return false;
}