webengine/webkitutils/HistoryProvider/HistoryController.cpp
changeset 10 a359256acfc6
parent 5 10e98eab6f85
child 25 0ed94ceaa377
equal deleted inserted replaced
5:10e98eab6f85 10:a359256acfc6
   397 {
   397 {
   398     if (index >= 0 && index < m_historyStack.Count()) {
   398     if (index >= 0 && index < m_historyStack.Count()) {
   399         HistoryEntry* deadEntry = m_historyStack[index];
   399         HistoryEntry* deadEntry = m_historyStack[index];
   400         m_historyStack.Remove(index);
   400         m_historyStack.Remove(index);
   401         delete deadEntry;
   401         delete deadEntry;
   402 		// Shift current page if removing previous pages
   402         // Shift current page if removing previous pages
   403         if (index <= m_currentIndex && m_currentIndex > 0)
   403         if (index <= m_currentIndex && m_currentIndex >= 0)
   404         	{
   404             {
   405         	m_currentIndex--;
   405             m_currentIndex--;
   406         	}
   406             }
   407     }
   407     }
   408 }
   408 }
   409 
   409 
   410 /**
   410 /**
   411 */
   411 */
   416 
   416 
   417 /**
   417 /**
   418 */
   418 */
   419 void HistoryController::updateGlobalHistoryForReload()
   419 void HistoryController::updateGlobalHistoryForReload()
   420 {
   420 {
   421     HistoryEntry* entry = m_historyStack[m_currentIndex];
   421 	HistoryEntry* entry = entryByIndex(m_currentIndex);
   422     entry->touch();
   422 	if ( entry )
   423     updateCurrentEntryPositionIfNeeded();
   423 		{
       
   424 		entry->touch();
       
   425 		updateCurrentEntryPositionIfNeeded();
       
   426 		}
   424 }
   427 }
   425 
   428 
   426 /**
   429 /**
   427 */
   430 */
   428 void HistoryController::goBackOrForward(int distance)
   431 void HistoryController::goBackOrForward(int distance)
   429 {
   432 {    
   430     m_tempCurrentIndex = m_currentIndex;
   433     const HistoryEntry* currentEntry = entryByIndex(m_currentIndex+distance);
   431     m_currentIndex += distance;
       
   432     m_historyLoadOffset = distance;
       
   433     const HistoryEntry* currentEntry = entryByIndex(m_currentIndex);
       
   434     if (currentEntry) {
   434     if (currentEntry) {
       
   435 		m_tempCurrentIndex = m_currentIndex;
       
   436         m_currentIndex += distance;
       
   437         m_historyLoadOffset = distance;
   435         TPtrC8 url = currentEntry->requestUrl();
   438         TPtrC8 url = currentEntry->requestUrl();
   436         m_historyCallback->doHistoryGet( url, TBrCtlDefs::ECacheModeHistory );
   439         m_historyCallback->doHistoryGet( url, TBrCtlDefs::ECacheModeHistory );
   437     }
   440     }
   438 }
   441 }
   439 
   442