void DeclarativeTabModel::updateNewTabData(NewTabData *newTabData)
{
    bool hadNewTabData = hasNewTabData();
    QString currentTabUrl = newTabUrl();
    bool urlChanged = newTabData ? currentTabUrl != newTabData->url : !currentTabUrl.isEmpty();

    m_newTabData.reset(newTabData);
    if (urlChanged) {
        emit newTabUrlChanged();
    }

    if (hadNewTabData != hasNewTabData()) {
        emit hasNewTabDataChanged();
    }
}
void DeclarativeTabModel::updateUrl(int tabId, bool activeTab, QString url, bool backForwardNavigation, bool initialLoad)
{
    if (backForwardNavigation)
    {
        updateTabUrl(tabId, activeTab, url, false);
    } else if (!hasNewTabData()) {
        updateTabUrl(tabId, activeTab, url, !initialLoad);
    } else {
        addTab(url, newTabTitle());
    }
    resetNewTabData();
}
void DeclarativeTabModel::updateUrl(int tabId, bool activeTab, QString url)
{
    if (m_backForwardNavigation && activeTab)
    {
        updateTabUrl(tabId, activeTab, url, false);
    } else if (!hasNewTabData() && activeTab) {
        updateTabUrl(tabId, activeTab, url, true);
    } else {
        addTab(url, newTabTitle());
    }
    resetNewTabData();
}
int DeclarativeTabModel::newTabParentId() const
{
    return hasNewTabData() ? m_newTabData->parentId : 0;
}
QObject *DeclarativeTabModel::newTabPreviousPage() const
{
    return hasNewTabData() ? m_newTabData->previousPage : 0;
}
QString DeclarativeTabModel::newTabTitle() const
{
    return hasNewTabData() ? m_newTabData->title : "";
}
QString DeclarativeTabModel::newTabUrl() const
{
    return hasNewTabData() ? m_newTabData->url : "";
}