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

List:       kde-commits
Subject:    kdevelop/src
From:       Jens Dagerbo <jens.dagerbo () swipnet ! se>
Date:       2005-01-23 19:23:43
Message-ID: 20050123192343.DBB671CFA5 () office ! kde ! org
[Download RAW message or body]

CVS commit by dagerbo: 

Make an attempt to switch to an already open file before verifying the URL.
This lets us switch to files that no longer exist on disc (and also makes the 
most common use of editDocument() faster).

Also moved the "embed kdevdesigner" check to when it is needed.


  M +22 -12    partcontroller.cpp   1.156


--- kdevelop/src/partcontroller.cpp  #1.155:1.156
@@ -224,10 +224,13 @@ void PartController::editDocumentInterna
   KURL url = inputUrl;
   
-  KConfig *config = kapp->config();
-  config->setGroup("General Options");
-  bool embedKDevDesigner = config->readBoolEntry("Embed KDevDesigner", true);
-  config->setGroup("General");
-  
-  kdDebug(9000) << "    - embed: " << (embedKDevDesigner ? "true" : "false") << endl;
+        // is it already open? 
+        // (Try this once before verifying the URL, we could be dealing with a file that no longer exists on disc)
+        if ( KParts::Part *existingPart = partForURL( url ) )
+        {
+                addHistoryEntry();
+                activatePart( existingPart );
+                EditorProxy::getInstance()->setLineNumber( existingPart, lineNum, col );
+                return;
+        }
 
   // Make sure the URL exists
@@ -314,4 +317,9 @@ void PartController::editDocumentInterna
         }
 
+        KConfig *config = kapp->config();
+        config->setGroup("General Options");
+        bool embedKDevDesigner = config->readBoolEntry("Embed KDevDesigner", true);
+//      kdDebug(9000) << "    - embed: " << (embedKDevDesigner ? "true" : "false") << endl;
+
         if ( !m_openNextAsText && embedKDevDesigner && MimeType->is( "application/x-designer" ) )
         {
@@ -345,4 +353,6 @@ void PartController::editDocumentInterna
         }
         
+        config->setGroup("General");
+
         QStringList texttypeslist = config->readListEntry( "TextTypes" );
         if ( texttypeslist.contains( MimeType->name() ) )


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

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