[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/kdevelop/3.4/src
From:       Jens Dagerbo <jens.dagerbo () swipnet ! se>
Date:       2007-02-16 1:27:41
Message-ID: 1171589261.903099.15372.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 634011 by dagerbo:

Fix: Allow Navigation History to track all document switches (even those made via \
TabWidget or Window Menu)

 M  +31 -7     partcontroller.cpp  
 M  +3 -0      partcontroller.h  


--- branches/kdevelop/3.4/src/partcontroller.cpp #634010:634011
@@ -90,7 +90,7 @@
 
 
 PartController::PartController(QWidget *parent)
-  : KDevPartController(parent), _editorFactory(0L)
+  : KDevPartController(parent), _editorFactory(0L), m_currentActivePart(0), \
m_removingActivePart(false)  {
   connect(this, SIGNAL(partRemoved(KParts::Part*)), this, \
SLOT(slotPartRemoved(KParts::Part* )) );  connect(this, \
SIGNAL(partAdded(KParts::Part*)), this, SLOT(slotPartAdded(KParts::Part* )) ); @@ \
-807,6 +807,11 @@  
 	_partURLMap.remove( static_cast<KParts::ReadOnlyPart*>(part) );
 
+	if ( part == m_currentActivePart )
+	{
+		m_removingActivePart = true;
+	}
+
 	updateMenuItems();
 }
 
@@ -1307,8 +1312,19 @@
 
 void PartController::slotActivePartChanged( KParts::Part *part )
 {
-    kdDebug(9000) << k_funcinfo << endl;
+	kdDebug(9000) << k_funcinfo << part << endl;
 
+	if ( !m_isJumping && !m_removingActivePart )
+	{
+		if ( KParts::ReadOnlyPart * ro_part = \
dynamic_cast<KParts::ReadOnlyPart*>(m_currentActivePart) ) +		{
+			addHistoryEntry( ro_part );
+		}
+	}
+
+	m_currentActivePart = part;
+	m_removingActivePart = false;
+
     if (part) {
         KXMLGUIClient* client = dynamic_cast<KXMLGUIClient*>(part->widget());
         if (client) Core::setupShourtcutTips(client);
@@ -1714,11 +1730,19 @@
 	HistoryEntry thisEntry = createHistoryEntry( part );
 	if ( !thisEntry.url.isEmpty() )
 	{
-		m_backHistory.push_front( thisEntry );
-		m_backAction->setEnabled( true );
-
-		m_forwardHistory.clear();
-		m_forwardAction->setEnabled( false );
+		HistoryEntry lastEntry = m_backHistory.front();
+		if ( (lastEntry.url.path() != thisEntry.url.path()) || (lastEntry.line != \
thisEntry.line) ) +		{
+			m_backHistory.push_front( thisEntry );
+			m_backAction->setEnabled( true );
+	
+			m_forwardHistory.clear();
+			m_forwardAction->setEnabled( false );
+		}
+		else
+		{
+			kdDebug(9000) << "** avoiding to create duplicate history entry **" << endl;
+		}
 	}
 }
 
--- branches/kdevelop/3.4/src/partcontroller.h #634010:634011
@@ -222,6 +222,9 @@
 	};
 
 	LastEditPos m_lastEditPos;
+
+	KParts::Part * m_currentActivePart;
+	bool m_removingActivePart;
 };
 
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic