void Transfer::setState(State newState)
{
	bool now,was = isActive();
	m_lastState = m_state;
	
	if(newState == m_lastState)
		return;
	
	enterLogMessage(tr("Changed state: %1 -> %2").arg(state2string(m_state)).arg(state2string(newState)));
	
	m_state = newState;
	now = isActive();
	
	if(now != was)
	{
		m_bWorking = false;
		changeActive(now);
		
		if(now)
			m_timeStart = QDateTime::currentDateTime();
		else
			m_nTimeRunning += m_timeStart.secsTo(QDateTime::currentDateTime());
	}
	
	if(!m_bLocal)
	emit stateChanged(m_state, newState);
}
Exemple #2
0
JavaUpload::~JavaUpload()
{
	if(isActive())
		changeActive(false);

	delete m_plugin;
	curl_formfree(m_postData);
	m_postData = 0;
}