--- kdebase.o/kate/app/kateconfigdialog.cpp.orig	2012-04-01 18:22:50.732901887 +0200
+++ kdebase/kate/app/kateconfigdialog.cpp	2012-04-01 18:25:01.100327408 +0200
@@ -138,6 +138,16 @@
   TQWhatsThis::add( sb_numRecentFiles, youwouldnotbelieveit );
   connect( sb_numRecentFiles, TQT_SIGNAL( valueChanged ( int ) ), this, TQT_SLOT( slotChanged() ) );
 
+  // Use only one instance of kate (MDI) ?
+  cb_useInstance = new TQCheckBox(bgStartup);
+  cb_useInstance->setText(i18n("Always use the current instance of kate to open new files"));
+  cb_useInstance->setChecked(parent->useInstance);
+  TQWhatsThis::add( cb_useInstance, i18n(
+        "When checked, all files opened from outside of Kate will only use the "
+        "currently opened instance of Kate.") );
+  connect( cb_useInstance, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) );
+
+
   // sync the konsole ?
   cb_syncKonsole = new TQCheckBox(bgStartup);
   cb_syncKonsole->setText(i18n("Sync &terminal emulator with active document"));
@@ -161,7 +171,7 @@
            this, TQT_SLOT( slotChanged() ) );
 
   // GROUP with the one below: "Meta-informations"
-  bgStartup = new TQButtonGroup( 1, Qt::Horizontal, i18n("Meta-Information"), frGeneral );
+  bgStartup = new TQButtonGroup( 2, Qt::Horizontal, i18n("Meta-Information"), frGeneral );
   lo->addWidget( bgStartup );
 
   // save meta infos
@@ -409,6 +419,7 @@
     mainWindow->modNotification = cb_modNotifications->isChecked();
 
     mainWindow->syncKonsole = cb_syncKonsole->isChecked();
+    mainWindow->useInstance = cb_useInstance->isChecked();
 
     mainWindow->filelist->setSortType(cb_sortFiles->isChecked() ? KateFileList::sortByName : KateFileList::sortByID);
 
diff -urN tdebase/kate/app/kateconfigdialog.h tdebase.new/kate/app/kateconfigdialog.h
--- tdebase/kate/app/kateconfigdialog.h	2012-01-08 18:00:01.000000000 -0600
+++ tdebase.new/kate/app/kateconfigdialog.h	2012-03-11 00:05:03.000000000 -0600
@@ -66,6 +66,7 @@
 
     TQCheckBox *cb_fullPath;
     TQCheckBox *cb_syncKonsole;
+    TQCheckBox *cb_useInstance;
     TQCheckBox *cb_sortFiles;
     TQSpinBox *sb_numRecentFiles;
     TQCheckBox *cb_modNotifications;
diff -urN tdebase/kate/app/katemain.cpp tdebase.new/kate/app/katemain.cpp
--- tdebase/kate/app/katemain.cpp	2011-12-25 00:52:38.000000000 -0600
+++ tdebase.new/kate/app/katemain.cpp	2012-03-11 00:05:03.000000000 -0600
@@ -41,6 +41,8 @@
     { "start <name>", I18N_NOOP("Start Kate with a given session"), 0 },
     { "u", 0, 0 },
     { "use", I18N_NOOP("Use a already running kate instance (if possible)"), 0 },
+    { "f", 0, 0 },
+    { "force-sdi", I18N_NOOP("Force single document mode if the MDI setting is enabled."), 0 },
     { "p", 0, 0 },
     { "pid <pid>", I18N_NOOP("Only try to reuse kate instance with this pid"), 0 },
     { "e", 0, 0 },
@@ -57,9 +59,13 @@
 
 extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
 {
+  KConfig * config = NULL;
+  bool alwaysUseInstance;
   // here we go, construct the Kate version
   TQString kateVersion = KateApp::kateVersion();
 
+  KInstance instance( "kate" );
+
   KAboutData aboutData ("kate", I18N_NOOP("Kate"), kateVersion.latin1(),
                         I18N_NOOP( "Kate - Advanced Text Editor" ), KAboutData::License_LGPL_V2,
                         I18N_NOOP( "(c) 2000-2005 The Kate Authors" ), 0, "http://kate.kde.org");
@@ -107,8 +113,13 @@
   // get our command line args ;)
   KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
 
-  // now, first try to contact running kate instance if needed
-  if ( args->isSet("use") || (::getenv("KATE_PID")!=0) )
+  config = KGlobal::config();
+  config->setGroup("General");
+  alwaysUseInstance = config->readBoolEntry("UseInstance");
+
+// now, first try to contact running kate instance if needed
+  if ( ((args->isSet("use") || alwaysUseInstance) &&
+       !(args->isSet("force-sdi")))  || (::getenv("KATE_PID")!=0) )
   {
     DCOPClient client;
     client.attach ();
diff -urN tdebase/kate/app/katemainwindow.cpp tdebase.new/kate/app/katemainwindow.cpp
--- tdebase/kate/app/katemainwindow.cpp	2012-01-08 18:00:01.000000000 -0600
+++ tdebase.new/kate/app/katemainwindow.cpp	2012-03-11 01:18:48.000000000 -0600
@@ -406,6 +406,7 @@
 
   config->setGroup("General");
   syncKonsole =  config->readBoolEntry("Sync Konsole", true);
+  useInstance =  config->readBoolEntry("UseInstance", false);
   modNotification = config->readBoolEntry("Modified Notification", false);
   KateDocManager::self()->setSaveMetaInfos(config->readBoolEntry("Save Meta Infos", true));
   KateDocManager::self()->setDaysMetaInfos(config->readNumEntry("Days Meta Infos", 30));
@@ -437,6 +438,8 @@
 
   config->writeEntry("Sync Konsole", syncKonsole);
 
+  config->writeEntry("UseInstance", useInstance);
+
   fileOpenRecent->saveEntries(config, "Recent Files");
 
   fileselector->writeConfig(config, "fileselector");
diff -urN tdebase/kate/app/katemainwindow.h tdebase.new/kate/app/katemainwindow.h
--- tdebase/kate/app/katemainwindow.h	2011-12-25 00:52:38.000000000 -0600
+++ tdebase.new/kate/app/katemainwindow.h	2012-03-11 00:05:03.000000000 -0600
@@ -182,6 +182,7 @@
     Kate::ToolViewManager *m_toolViewManager;
 
     bool syncKonsole;
+    bool useInstance;
     bool modNotification;
 
     DCOPObject *m_dcop;
diff -urN tdebase/kate/app/katemain.cpp tdebase.new/kate/app/katemain.cpp
--- tdebase/kate/app/katemain.cpp	2011-12-25 00:52:38.000000000 -0600
+++ tdebase.new/kate/app/katemain.cpp	2012-03-11 13:32:05.000000000 -0500
@@ -231,7 +231,9 @@
         else
           wRef.call("restore");
       }
+      wRef.call( "hide" );
       wRef.call( "raise" );
+      wRef.call( "show" );
 
       // stop startup notification
       KStartupInfo::appStarted(  );