示例#1
0
void WindowsManager::restore(const SessionMainWindow &session)
{
	if (session.windows.isEmpty())
	{
		open();
	}
	else
	{
		for (int i = 0; i < session.windows.count(); ++i)
		{
			Window *window = new Window(m_isPrivate, NULL, m_mdi);
			window->setSession(session.windows.at(i));

			addWindow(window);
		}
	}

	m_isRestored = true;

	connect(SessionsManager::getInstance(), SIGNAL(requestedRemoveStoredUrl(QString)), this, SLOT(removeStoredUrl(QString)));
	connect(m_tabBar, SIGNAL(currentChanged(int)), this, SLOT(setActiveWindow(int)));
	connect(m_tabBar, SIGNAL(requestedClone(int)), this, SLOT(cloneWindow(int)));
	connect(m_tabBar, SIGNAL(requestedDetach(int)), this, SLOT(detachWindow(int)));
	connect(m_tabBar, SIGNAL(requestedPin(int,bool)), this, SLOT(pinWindow(int,bool)));
	connect(m_tabBar, SIGNAL(requestedClose(int)), this, SLOT(closeWindow(int)));
	connect(m_tabBar, SIGNAL(requestedCloseOther(int)), this, SLOT(closeOther(int)));

	setActiveWindow(session.index);
}
示例#2
0
void WindowsManager::restore(const SessionMainWindow &session)
{
	int index = session.index;

	if (session.windows.isEmpty())
	{
		m_isRestored = true;

		if (SettingsManager::getValue(QLatin1String("Interface/LastTabClosingAction")).toString() != QLatin1String("doNothing"))
		{
			open();
		}
		else
		{
			m_mainWindow->setCurrentWindow(NULL);
		}
	}
	else
	{
		for (int i = 0; i < session.windows.count(); ++i)
		{
			Window *window = new Window(m_isPrivate);
			window->setSession(session.windows.at(i));

			if (index < 0 && session.windows.at(i).state != MinimizedWindowState)
			{
				index = i;
			}

			addWindow(window, DefaultOpen, -1, session.windows.at(i).geometry, session.windows.at(i).state, session.windows.at(i).isAlwaysOnTop);
		}
	}

	m_isRestored = true;

	connect(SessionsManager::getInstance(), SIGNAL(requestedRemoveStoredUrl(QString)), this, SLOT(removeStoredUrl(QString)));
	connect(m_mainWindow->getTabBar(), SIGNAL(currentChanged(int)), this, SLOT(setActiveWindowByIndex(int)));

	setActiveWindowByIndex(index);

	m_mainWindow->getWorkspace()->markRestored();
}