From cfe383b0628d5e8b642e5df2e261b258b7c19103 Mon Sep 17 00:00:00 2001
From: Michele Calgaro <michele.calgaro@yahoo.it>
Date: Wed, 6 Aug 2025 13:07:21 +0900
Subject: Rename kinstance.{h,cpp} to tdeinstance.{h,cpp}. A dummy kinstance.h
 has been temporarily added to keep other apps building while the replacement
 is completed across all TDE code base.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
---
 kate/part/kateconfig.cpp                           |   2 +-
 kate/part/katefactory.h                            |   4 +-
 kate/part/katehighlight.cpp                        |   2 +-
 kdoctools/main.cpp                                 |   2 +-
 kdoctools/main_ghelp.cpp                           |   2 +-
 kdoctools/meinproc.cpp                             |   2 +-
 kdoctools/tdeio_help.cpp                           |   2 +-
 kdoctools/xslt.cpp                                 |   2 +-
 libtdemid/deviceman.cpp                            |   2 +-
 tdeabc/addressbook.cpp                             |   2 +-
 tdecert/tdecertpart.cpp                            |   2 +-
 tdeconf_update/tdeconf_update.cpp                  |   2 +-
 tdecore/CMakeLists.txt                             |   4 +-
 tdecore/MAINTAINERS                                |  10 +-
 tdecore/Makefile.am                                |   4 +-
 tdecore/kdebug.cpp                                 |   2 +-
 tdecore/kgenericfactory.h                          |   2 +-
 tdecore/kiconloader.cpp                            |   2 +-
 tdecore/kiconloader.h                              |   2 +-
 tdecore/kicontheme.cpp                             |   4 +-
 tdecore/kinstance.cpp                              | 362 ---------------------
 tdecore/kinstance.h                                | 193 +----------
 tdecore/kmimesourcefactory.cpp                     |   2 +-
 tdecore/ktempdir.cpp                               |   2 +-
 tdecore/tde-config.cpp.cmake                       |   2 +-
 tdecore/tde-config.cpp.in                          |   2 +-
 tdecore/tdeapplication.h                           |   2 +-
 tdecore/tdeconfig_compiler/tests/test1main.cpp     |   2 +-
 tdecore/tdeconfig_compiler/tests/test2main.cpp     |   2 +-
 tdecore/tdeconfig_compiler/tests/test3main.cpp     |   2 +-
 tdecore/tdeconfig_compiler/tests/test4main.cpp     |   2 +-
 tdecore/tdeconfig_compiler/tests/test5main.cpp     |   2 +-
 tdecore/tdeconfig_compiler/tests/test6main.cpp     |   2 +-
 tdecore/tdeconfig_compiler/tests/test7main.cpp     |   2 +-
 tdecore/tdeconfig_compiler/tests/test8main.cpp     |   2 +-
 tdecore/tdeconfig_compiler/tests/test9main.cpp     |   2 +-
 .../tests/test_dpointer_main.cpp                   |   2 +-
 tdecore/tdecrash.cpp                               |   2 +-
 tdecore/tdeglobal.cpp                              |   2 +-
 tdecore/tdeglobal.h                                |   2 +-
 tdecore/tdeinstance.cpp                            | 362 +++++++++++++++++++++
 tdecore/tdeinstance.h                              | 192 +++++++++++
 tdecore/tdelocale.cpp                              |   2 +-
 tdecore/tdeshortcutlist.cpp                        |   2 +-
 tdecore/tdestandarddirs.cpp                        |   2 +-
 tdecore/tdetempfile.cpp                            |   2 +-
 tdecore/tests/kdebugtest.cpp                       |   2 +-
 tdecore/tests/tdestandarddirstest.cpp              |   2 +-
 tdehtml/tdehtml_factory.cpp                        |   2 +-
 tdehtml/tdehtmlimage.cpp                           |   2 +-
 tdehtml/tdemultipart/tdemultipart.cpp              |   2 +-
 tdeinit/tdedostartupconfig.cpp                     |   2 +-
 tdeinit/tdeinit.cpp                                |   2 +-
 tdeio/tdefile/knotifydialog.h                      |   2 +-
 tdeio/tdefile/kurlbar.cpp                          |   2 +-
 tdeio/tdeio/dataprotocol.cpp                       |   2 +-
 tdeio/tdeio/kdatatool.cpp                          |   2 +-
 tdeio/tdeio/kscan.h                                |   2 +-
 tdeio/tests/kfiltertest.cpp                        |   2 +-
 tdeio/tests/kmfitest.cpp                           |   2 +-
 tdeio/tests/kmimemagictest.cpp                     |   2 +-
 tdeio/tests/kmimetypetest.cpp                      |   2 +-
 tdeio/tests/ktartest.cpp                           |   2 +-
 tdeio/tests/kziptest.cpp                           |   2 +-
 tdeioslave/file/file.cpp                           |   2 +-
 tdeioslave/ftp/ftp.cpp                             |   2 +-
 tdeioslave/http/http.cpp                           |   2 +-
 tdeioslave/http/http_cache_cleaner.cpp             |   2 +-
 tdeioslave/iso/iso.cpp                             |   2 +-
 tdeparts/dockmainwindow.cpp                        |   2 +-
 tdeparts/factory.cpp                               |   2 +-
 tdeparts/mainwindow.cpp                            |   2 +-
 tdeparts/part.cpp                                  |   2 +-
 tdeparts/plugin.cpp                                |   2 +-
 tdersync/rsyncconfigdialog.cpp                     |   2 +-
 tdersync/tdersync.h                                |   2 +-
 tdeui/kedittoolbar.cpp                             |   2 +-
 tdeui/kxmlguiclient.cpp                            |   2 +-
 tdeui/kxmlguifactory.cpp                           |   2 +-
 tdeui/tdecmodule.cpp                               |   2 +-
 tdeunittest/modrunner.cpp                          |   2 +-
 tdeutils/kpluginselector.cpp                       |   2 +-
 tdewidgets/kde.widgets                             |   2 +-
 tdewidgets/maketdewidgets.cpp                      |   2 +-
 tdewidgets/tests/test.widgets                      |   2 +-
 win/pro_files/tdecore/tdecore.pro                  |   2 +-
 86 files changed, 645 insertions(+), 644 deletions(-)
 delete mode 100644 tdecore/kinstance.cpp
 create mode 100644 tdecore/tdeinstance.cpp
 create mode 100644 tdecore/tdeinstance.h

diff --git a/kate/part/kateconfig.cpp b/kate/part/kateconfig.cpp
index bc1c51dd7..981359d1a 100644
--- a/kate/part/kateconfig.cpp
+++ b/kate/part/kateconfig.cpp
@@ -34,7 +34,7 @@
 #include <tdelocale.h>
 #include <kfinddialog.h>
 #include <kreplacedialog.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kstaticdeleter.h>
 
 #include <tqpopupmenu.h>
diff --git a/kate/part/katefactory.h b/kate/part/katefactory.h
index 3d90d187f..3b4c3790e 100644
--- a/kate/part/katefactory.h
+++ b/kate/part/katefactory.h
@@ -23,7 +23,7 @@
 #include <tdeparts/factory.h>
 
 #include <ktrader.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdeaboutdata.h>
 
 // katepart version must be a string in double quotes, format: "x.x"
@@ -224,7 +224,7 @@ class KateFactory
     TDEAboutData m_aboutData;
 
     /**
-     * our kinstance
+     * our TDEInstance
      */
     TDEInstance m_instance;
 
diff --git a/kate/part/katehighlight.cpp b/kate/part/katehighlight.cpp
index c7e5393d2..d5af43f57 100644
--- a/kate/part/katehighlight.cpp
+++ b/kate/part/katehighlight.cpp
@@ -34,7 +34,7 @@
 
 #include <tdeconfig.h>
 #include <tdeglobal.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kmimetype.h>
 #include <tdelocale.h>
 #include <kregexp.h>
diff --git a/kdoctools/main.cpp b/kdoctools/main.cpp
index f2238a67f..af629aec8 100644
--- a/kdoctools/main.cpp
+++ b/kdoctools/main.cpp
@@ -13,7 +13,7 @@
 #include <libxslt/xsltutils.h>
 #include <tqstring.h>
 #include <tdestandarddirs.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kdebug.h>
 #include <stdlib.h>
 #include "tdeio_help.h"
diff --git a/kdoctools/main_ghelp.cpp b/kdoctools/main_ghelp.cpp
index c394776b7..cca632d2d 100644
--- a/kdoctools/main_ghelp.cpp
+++ b/kdoctools/main_ghelp.cpp
@@ -13,7 +13,7 @@
 #include <libxslt/xsltutils.h>
 #include <tqstring.h>
 #include <tdestandarddirs.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kdebug.h>
 #include <stdlib.h>
 #include "tdeio_help.h"
diff --git a/kdoctools/meinproc.cpp b/kdoctools/meinproc.cpp
index f1afaa0da..df8cdbb77 100644
--- a/kdoctools/meinproc.cpp
+++ b/kdoctools/meinproc.cpp
@@ -17,7 +17,7 @@
 #include <libxslt/xsltutils.h>
 #include <tqstring.h>
 #include <tdestandarddirs.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <xslt.h>
 #include <tqfile.h>
 #include <tqdir.h>
diff --git a/kdoctools/tdeio_help.cpp b/kdoctools/tdeio_help.cpp
index 2c2fb0583..7c33fafb1 100644
--- a/kdoctools/tdeio_help.cpp
+++ b/kdoctools/tdeio_help.cpp
@@ -28,7 +28,7 @@
 #include <tdeglobal.h>
 #include <tdelocale.h>
 #include <tdestandarddirs.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 
 #include "tdeio_help.h"
 #include <libxslt/xsltutils.h>
diff --git a/kdoctools/xslt.cpp b/kdoctools/xslt.cpp
index 7798aac61..582828529 100644
--- a/kdoctools/xslt.cpp
+++ b/kdoctools/xslt.cpp
@@ -10,7 +10,7 @@
 #include <tqdir.h>
 #include <tqregexp.h>
 #include <xslt.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include "tdeio_help.h"
 #include <tdelocale.h>
 #include <assert.h>
diff --git a/libtdemid/deviceman.cpp b/libtdemid/deviceman.cpp
index 18bb9fcc2..137bff135 100644
--- a/libtdemid/deviceman.cpp
+++ b/libtdemid/deviceman.cpp
@@ -66,7 +66,7 @@
 #endif
 
 #if 1
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdeglobal.h>
 #include <tdeconfig.h>
 #endif
diff --git a/tdeabc/addressbook.cpp b/tdeabc/addressbook.cpp
index b124eddbe..67073d435 100644
--- a/tdeabc/addressbook.cpp
+++ b/tdeabc/addressbook.cpp
@@ -25,7 +25,7 @@
 #include <tdeapplication.h>
 #include <kdebug.h>
 #include <tdeglobal.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdelocale.h>
 #include <tdestandarddirs.h>
 
diff --git a/tdecert/tdecertpart.cpp b/tdecert/tdecertpart.cpp
index d59f48837..995eae8bd 100644
--- a/tdecert/tdecertpart.cpp
+++ b/tdecert/tdecertpart.cpp
@@ -21,7 +21,7 @@
 
 #include "tdecertpart.h"
 #include <tdeparts/genericfactory.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdeaboutdata.h>
 #include <tqframe.h>
 #include <tdelocale.h>
diff --git a/tdeconf_update/tdeconf_update.cpp b/tdeconf_update/tdeconf_update.cpp
index 43e790360..d074ff0b4 100644
--- a/tdeconf_update/tdeconf_update.cpp
+++ b/tdeconf_update/tdeconf_update.cpp
@@ -35,7 +35,7 @@
 #include <tdeglobal.h>
 #include <tdestandarddirs.h>
 #include <tdeaboutdata.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdetempfile.h>
 
 static TDECmdLineOptions options[] =
diff --git a/tdecore/CMakeLists.txt b/tdecore/CMakeLists.txt
index f5c356073..d8b71696d 100644
--- a/tdecore/CMakeLists.txt
+++ b/tdecore/CMakeLists.txt
@@ -59,7 +59,7 @@ install( FILES
     tdeglobalaccel.h tdestdaccel.h tdeshortcutlist.h kcatalogue.h
     kregexp.h kcompletion.h kstringhandler.h
     tdestandarddirs.h tdeglobal.h tdeglobalsettings.h ksharedptr.h
-    kallocator.h kvmallocator.h tdecrash.h krfcdate.h kinstance.h
+    kallocator.h kvmallocator.h tdecrash.h krfcdate.h tdeinstance.h kinstance.h
     kpalette.h kipc.h klibloader.h tdetempfile.h ksavefile.h
     krandomsequence.h knotifyclient.h kiconeffect.h kaudioplayer.h
     kdcoppropertyproxy.h netwm.h tdeaccelmanager.h netwm_def.h
@@ -116,7 +116,7 @@ set( ${target}_SRCS
   tdeglobalaccel_x11.cpp tdeglobalaccel.cpp tdestdaccel.cpp tdeshortcutlist.cpp
   tdecrash.cpp kurl.cpp kregexp.cpp tdeglobal.cpp tdeglobalsettings.cpp
   kallocator.cpp kvmallocator.cpp kmimesourcefactory.cpp
-  kinstance.cpp kpalette.cpp kipc.cpp klibloader.cpp tdetempfile.cpp
+  tdeinstance.cpp kpalette.cpp kipc.cpp klibloader.cpp tdetempfile.cpp
   tdeuniqueapplication.cpp tdeaccelmanager.cpp ksavefile.cpp
   krandomsequence.cpp kstringhandler.cpp kcompletion.cpp
   tdecmdlineargs.cpp tdeaboutdata.cpp kcompletionbase.cpp knotifyclient.cpp
diff --git a/tdecore/MAINTAINERS b/tdecore/MAINTAINERS
index 4f306527a..902ffd444 100644
--- a/tdecore/MAINTAINERS
+++ b/tdecore/MAINTAINERS
@@ -6,10 +6,10 @@ When adding yourself as a maintainer, don't be afraid to reorder the files to a
 more logical grouping.
 
 dmalloc.cpp
-tdeaboutdata.cpp		David Faure <faure@kde.org>
+tdeaboutdata.cpp	David Faure <faure@kde.org>
 tdeaccel.cpp		Ellis Whitehead <ellis@kde.org>
 tdeaccelaction.cpp	Ellis Whitehead <ellis@kde.org>
-tdeaccelbase.cpp		Ellis Whitehead <ellis@kde.org>
+tdeaccelbase.cpp	Ellis Whitehead <ellis@kde.org>
 kallocator.cpp		Waldo Bastian <bastian@kde.org>
 tdeappdcopinterface.cpp
 tdeapplication.cpp	Waldo Bastian <bastian@kde.org>
@@ -22,7 +22,7 @@ kcompletion.cpp		Carsten Pfeiffer <pfeiffer@kde.org>
 kcompletionbase.cpp
 tdeconfig.cpp		Waldo Bastian <bastian@kde.org>
 tdeconfigbackend.cpp	Waldo Bastian <bastian@kde.org>
-tdeconfigbase.cpp		Waldo Bastian <bastian@kde.org>
+tdeconfigbase.cpp	Waldo Bastian <bastian@kde.org>
 tdecrash.cpp		Waldo Bastian <bastian@kde.org>
 kdcoppropertyproxy.cpp
 kdebug.cpp		Stephan Kulow <coolo@kde.org>
@@ -34,7 +34,7 @@ tdeglobalsettings.cpp	David Faure <faure@kde.org>
 kiconeffect.cpp
 kiconloader.cpp
 kicontheme.cpp
-kinstance.cpp 		Stephan Kulow <coolo@kde.org>
+tdeinstance.cpp 	Stephan Kulow <coolo@kde.org>
 kipc.cpp        	Lubos Lunak <l.lunak@kde.org>
 kkey_x11.cpp		Ellis Whitehead <ellis@kde.org>
 kkeynative_x11.cpp	Ellis Whitehead <ellis@kde.org>
@@ -65,7 +65,7 @@ kstaticdeleter.cpp	Stephan Kulow <coolo@kde.org>
 tdestdaccel.cpp		Ellis Whitehead <ellis@kde.org>
 kstringhandler.cpp
 tdesycoca.cpp		Waldo Bastian <bastian@kde.org>
-tdesycocadict.cpp		Waldo Bastian <bastian@kde.org>
+tdesycocadict.cpp	Waldo Bastian <bastian@kde.org>
 tdesycocafactory.cpp	Waldo Bastian <bastian@kde.org>
 tdetempfile.cpp		Waldo Bastian <bastian@kde.org>
 tdeuniqueapplication.cpp	Waldo Bastian <bastian@kde.org>
diff --git a/tdecore/Makefile.am b/tdecore/Makefile.am
index 200254181..e31e76ef4 100644
--- a/tdecore/Makefile.am
+++ b/tdecore/Makefile.am
@@ -47,7 +47,7 @@ include_HEADERS = tdeconfig.h tdeconfigskeleton.h \
 	kregexp.h kcompletion.h kstringhandler.h \
 	tdestandarddirs.h tdeglobal.h tdeglobalsettings.h ksharedptr.h \
 	kallocator.h kvmallocator.h tdecrash.h krfcdate.h \
-	kinstance.h kpalette.h kipc.h klibloader.h tdetempfile.h ksavefile.h \
+	tdeinstance.h kinstance.h kpalette.h kipc.h klibloader.h tdetempfile.h ksavefile.h \
 	krandomsequence.h knotifyclient.h kiconeffect.h \
 	kaudioplayer.h kdcoppropertyproxy.h netwm.h tdeaccelmanager.h \
 	netwm_def.h kpixmapprovider.h kunload.h kstaticdeleter.h \
@@ -100,7 +100,7 @@ libtdecore_la_SOURCES = libintl.cpp tdeapplication.cpp \
 	tdeglobalaccel_x11.cpp tdeglobalaccel.cpp tdestdaccel.cpp tdeshortcutlist.cpp \
 	tdecrash.cpp kurl.cpp kregexp.cpp tdeglobal.cpp tdeglobalsettings.cpp \
 	kallocator.cpp kvmallocator.cpp kmimesourcefactory.cpp \
-	kinstance.cpp kpalette.cpp kipc.cpp klibloader.cpp tdetempfile.cpp \
+	tdeinstance.cpp kpalette.cpp kipc.cpp klibloader.cpp tdetempfile.cpp \
 	tdeuniqueapplication.cpp tdeaccelmanager.cpp \
 	ksavefile.cpp krandomsequence.cpp kstringhandler.cpp kcompletion.cpp \
 	tdecmdlineargs.cpp tdeaboutdata.cpp kcompletionbase.cpp knotifyclient.cpp \
diff --git a/tdecore/kdebug.cpp b/tdecore/kdebug.cpp
index e30ebeae0..18af9c030 100644
--- a/tdecore/kdebug.cpp
+++ b/tdecore/kdebug.cpp
@@ -28,7 +28,7 @@
 
 #include "tdeapplication.h"
 #include "tdeglobal.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 #include "tdestandarddirs.h"
 
 #include <tqmessagebox.h>
diff --git a/tdecore/kgenericfactory.h b/tdecore/kgenericfactory.h
index e6722b8dd..1ed1b41ee 100644
--- a/tdecore/kgenericfactory.h
+++ b/tdecore/kgenericfactory.h
@@ -21,7 +21,7 @@
 
 #include <klibloader.h>
 #include <ktypelist.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kgenericfactory.tcc>
 #include <tdeglobal.h>
 #include <tdelocale.h>
diff --git a/tdecore/kiconloader.cpp b/tdecore/kiconloader.cpp
index 177e3d781..b1ee62efd 100644
--- a/tdecore/kiconloader.cpp
+++ b/tdecore/kiconloader.cpp
@@ -33,7 +33,7 @@
 #include <tdeglobal.h>
 #include <tdeconfig.h>
 #include <tdesimpleconfig.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 
 #include <kicontheme.h>
 #include <kiconloader.h>
diff --git a/tdecore/kiconloader.h b/tdecore/kiconloader.h
index 067ba5640..3876efc02 100644
--- a/tdecore/kiconloader.h
+++ b/tdecore/kiconloader.h
@@ -28,7 +28,7 @@
 #endif
 
 #include <tdeglobal.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kicontheme.h>
 
 struct TDEIconGroup;
diff --git a/tdecore/kicontheme.cpp b/tdecore/kicontheme.cpp
index 7c2c34aa1..15bad692a 100644
--- a/tdecore/kicontheme.cpp
+++ b/tdecore/kicontheme.cpp
@@ -33,7 +33,7 @@
 #include <tdeglobal.h>
 #include <tdeconfig.h>
 #include <tdesimpleconfig.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 
 #include "kicontheme.h"
 
@@ -136,7 +136,7 @@ TDEIconTheme::TDEIconTheme(const TQString& name, const TQString& appName)
 	fileName = mDir + "index.theme";
 	mainSection="Icon Theme";
     }
-    // Use TDESharedConfig to avoid parsing the file many times, from each kinstance.
+    // Use TDESharedConfig to avoid parsing the file many times, from each TDEInstance.
     // Need to keep a ref to it to make this useful
     d->sharedConfig = TDESharedConfig::openConfig( fileName, true /*readonly*/, false /*useKDEGlobals*/ );
     TDEConfig& cfg = *d->sharedConfig;
diff --git a/tdecore/kinstance.cpp b/tdecore/kinstance.cpp
deleted file mode 100644
index c5fe83ccc..000000000
--- a/tdecore/kinstance.cpp
+++ /dev/null
@@ -1,362 +0,0 @@
-/* This file is part of the KDE libraries
-   Copyright (C) 1999 Torben Weis <weis@kde.org>
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License version 2 as published by the Free Software Foundation.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public License
-   along with this library; see the file COPYING.LIB.  If not, write to
-   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.
-*/
-#include "kinstance.h"
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "tdeconfig.h"
-#include "tdelocale.h"
-#include "kcharsets.h"
-#include "kiconloader.h"
-#ifdef __TDE_HAVE_TDEHWLIB
-#include "klibloader.h"
-#include "tdeversion.h"
-#include "tdehardwaredevices.h"
-#include "tdenetworkconnections.h"
-#endif
-#include "tdeaboutdata.h"
-#include "tdestandarddirs.h"
-#include "kdebug.h"
-#include "tdeglobal.h"
-#include "kmimesourcefactory.h"
-
-#include <tqfont.h>
-
-#include "config.h"
-#ifndef NDEBUG
-  #include <assert.h>
-  #include <tqptrdict.h>
-  static TQPtrList<TDEInstance> *allInstances = 0;
-  static TQPtrDict<TQCString> *allOldInstances = 0;
-  #define DEBUG_ADD do { if (!allInstances) { allInstances = new TQPtrList<TDEInstance>(); allOldInstances = new TQPtrDict<TQCString>(); } allInstances->append(this); allOldInstances->insert( this, new TQCString( _name)); } while (false);
-  #define DEBUG_REMOVE do { allInstances->removeRef(this); } while (false);
-  #define DEBUG_CHECK_ALIVE do { if (!allInstances->contains((TDEInstance*)this)) { TQCString *old = allOldInstances->find((TDEInstance*)this); tqWarning("ACCESSING DELETED KINSTANCE! (%s)", old ? old->data() : "<unknown>"); assert(false); } } while (false);
-#else
-  #define DEBUG_ADD
-  #define DEBUG_REMOVE
-  #define DEBUG_CHECK_ALIVE
-#endif
-
-class TDEInstancePrivate
-{
-public:
-    TDEInstancePrivate ()
-    {
-        mimeSourceFactory = 0L;
-    }
-
-    ~TDEInstancePrivate ()
-    {
-        delete mimeSourceFactory;
-    }
-
-    KMimeSourceFactory* mimeSourceFactory;
-    TQString configName;
-    bool ownAboutdata;
-    TDESharedConfig::Ptr sharedConfig;
-};
-
-TDEInstance::TDEInstance( const TQCString& name)
-  : _dirs (0L),
-    _config (0L),
-    _iconLoader (0L),
-#ifdef __TDE_HAVE_TDEHWLIB
-    _hardwaredevices (0L),
-    _networkmanager (0L),
-#endif
-    _name( name ), _aboutData( new TDEAboutData( name, "", 0 ) ), m_configReadOnly(false)
-{
-    DEBUG_ADD
-    Q_ASSERT(!name.isEmpty());
-    if (!TDEGlobal::_instance)
-    {
-      TDEGlobal::_instance = this;
-      TDEGlobal::setActiveInstance(this);
-    }
-
-    d = new TDEInstancePrivate ();
-    d->ownAboutdata = true;
-}
-
-TDEInstance::TDEInstance( const TDEAboutData * aboutData )
-  : _dirs (0L),
-    _config (0L),
-    _iconLoader (0L),
-#ifdef __TDE_HAVE_TDEHWLIB
-    _hardwaredevices (0L),
-    _networkmanager (0L),
-#endif
-    _name( aboutData->appName() ), _aboutData( aboutData ), m_configReadOnly(false)
-{
-    DEBUG_ADD
-    Q_ASSERT(!_name.isEmpty());
-
-    if (!TDEGlobal::_instance)
-    {
-      TDEGlobal::_instance = this;
-      TDEGlobal::setActiveInstance(this);
-    }
-
-    d = new TDEInstancePrivate ();
-    d->ownAboutdata = false;
-}
-
-TDEInstance::TDEInstance( TDEInstance* src )
-  : _dirs ( src->_dirs ),
-    _config ( src->_config ),
-    _iconLoader ( src->_iconLoader ),
-#ifdef __TDE_HAVE_TDEHWLIB
-    _hardwaredevices ( src->_hardwaredevices ),
-    _networkmanager ( src->_networkmanager ),
-#endif
-    _name( src->_name ), _aboutData( src->_aboutData ), m_configReadOnly(false)
-{
-    DEBUG_ADD
-    Q_ASSERT(!_name.isEmpty());
-
-    if (!TDEGlobal::_instance || TDEGlobal::_instance == src )
-    {
-      TDEGlobal::_instance = this;
-      TDEGlobal::setActiveInstance(this);
-    }
-
-    d = new TDEInstancePrivate ();
-    d->ownAboutdata = src->d->ownAboutdata;
-    d->sharedConfig = src->d->sharedConfig;
-
-    src->_dirs = 0L;
-    src->_config = 0L;
-    src->_iconLoader = 0L;
-#ifdef __TDE_HAVE_TDEHWLIB
-    src->_hardwaredevices = 0L;
-    src->_networkmanager = 0L;
-#endif
-    src->_aboutData = 0L;
-    delete src;
-}
-
-TDEInstance::~TDEInstance()
-{
-    DEBUG_CHECK_ALIVE
-
-    if (d->ownAboutdata)
-        delete _aboutData;
-    _aboutData = 0;
-
-    delete d;
-    d = 0;
-
-    delete _iconLoader;
-    _iconLoader = 0;
-
-#ifdef __TDE_HAVE_TDEHWLIB
-    delete _hardwaredevices;
-    _hardwaredevices = 0;
-
-    delete _networkmanager;
-    _networkmanager = 0;
-#endif
-
-    // delete _config; // Do not delete, stored in d->sharedConfig
-    _config = 0;
-    delete _dirs;
-    _dirs = 0;
-
-    if (TDEGlobal::_instance == this)
-        TDEGlobal::_instance = 0;
-    if (TDEGlobal::activeInstance() == this)
-        TDEGlobal::setActiveInstance(0);
-    DEBUG_REMOVE
-}
-
-
-TDEStandardDirs *TDEInstance::dirs() const
-{
-    DEBUG_CHECK_ALIVE
-    if( _dirs == 0 ) {
-	_dirs = new TDEStandardDirs( );
-        if (_config) {
-            if (_dirs->addCustomized(_config))
-                _config->reparseConfiguration();
-	} else
-            config(); // trigger adding of possible customized dirs
-    }
-
-    return _dirs;
-}
-
-extern bool kde_kiosk_exception;
-extern bool kde_kiosk_admin;
-
-void TDEInstance::setConfigReadOnly(bool ro)
-{
-    m_configReadOnly = ro;
-}
-
-TDEConfig	*TDEInstance::config() const
-{
-    DEBUG_CHECK_ALIVE
-    if( _config == 0 ) {
-        if ( !d->configName.isEmpty() )
-        {
-            d->sharedConfig = TDESharedConfig::openConfig( d->configName );
-
-            // Check whether custom config files are allowed.
-            d->sharedConfig->setGroup( "KDE Action Restrictions" );
-            TQString kioskException = d->sharedConfig->readEntry("kiosk_exception");
-            if (d->sharedConfig->readBoolEntry( "custom_config", true))
-            {
-               d->sharedConfig->setGroup(TQString::null);
-            }
-            else
-            {
-               d->sharedConfig = 0;
-            }
-
-        }
-
-        if ( d->sharedConfig == 0 )
-        {
-	    if ( !_name.isEmpty() ) {
-	        d->sharedConfig = TDESharedConfig::openConfig( _name + "rc", m_configReadOnly );
-	    }
-	    else {
-	        d->sharedConfig = TDESharedConfig::openConfig( TQString::null );
-	    }
-	}
-
-	// Check if we are excempt from kiosk restrictions
-	if (kde_kiosk_admin && !kde_kiosk_exception && !TQCString(getenv("TDE_KIOSK_NO_RESTRICTIONS")).isEmpty())
-	{
-            kde_kiosk_exception = true;
-            d->sharedConfig = 0;
-            return config(); // Reread...
-        }
-
-	_config = d->sharedConfig;
-        if (_dirs)
-            if (_dirs->addCustomized(_config))
-                _config->reparseConfiguration();
-    }
-
-    return _config;
-}
-
-TDESharedConfig *TDEInstance::sharedConfig() const
-{
-    DEBUG_CHECK_ALIVE
-    if (_config == 0)
-       (void) config(); // Initialize config
-
-    return d->sharedConfig;
-}
-
-void TDEInstance::setConfigName(const TQString &configName)
-{
-    DEBUG_CHECK_ALIVE
-    d->configName = configName;
-}
-
-TDEIconLoader *TDEInstance::iconLoader() const
-{
-    DEBUG_CHECK_ALIVE
-    if( _iconLoader == 0 ) {
-	_iconLoader = new TDEIconLoader( _name, dirs() );
-    	_iconLoader->enableDelayedIconSetLoading( true );
-    }
-
-    return _iconLoader;
-}
-
-#ifdef __TDE_HAVE_TDEHWLIB
-TDEHardwareDevices *TDEInstance::hardwareDevices() const
-{
-	DEBUG_CHECK_ALIVE
-	if (_hardwaredevices == 0)
-	{
-		TQString libName = TQString("libtdehw.so.%1").arg(TDE_VERSION_MAJOR);
-		KLibrary *lib = KLibLoader::self()->library(libName.latin1());
-		if (lib)
-		{
-			TDEHardwareDevices* (*create)() = (TDEHardwareDevices* (*)())lib->symbol("create_tdeHardwareDevices");
-			if (create)
-			{
-				_hardwaredevices = create();
-			}
-		}
-	}
-
-	return _hardwaredevices;
-}
-
-TDEGlobalNetworkManager *TDEInstance::networkManager() const
-{
-	DEBUG_CHECK_ALIVE
-	if (_networkmanager == 0)
-	{
-		TQString libName = TQString("libtdehw.so.%1").arg(TDE_VERSION_MAJOR);
-		KLibrary *lib = KLibLoader::self()->library(libName.latin1());
-		if (lib)
-		{
-			TDEGlobalNetworkManager* (*create)() = (TDEGlobalNetworkManager* (*)())lib->symbol("create_tdeGlobalNetworkManager");
-			if (create)
-			{
-				_networkmanager = create();
-			}
-		}
-	}
-
-	return _networkmanager;
-}
-#endif
-
-void TDEInstance::newIconLoader() const
-{
-    DEBUG_CHECK_ALIVE
-    TDEIconTheme::reconfigure();
-    _iconLoader->reconfigure( _name, dirs() );
-}
-
-const TDEAboutData * TDEInstance::aboutData() const
-{
-    DEBUG_CHECK_ALIVE
-    return _aboutData;
-}
-
-TQCString TDEInstance::instanceName() const
-{
-    DEBUG_CHECK_ALIVE
-    return _name;
-}
-
-KMimeSourceFactory* TDEInstance::mimeSourceFactory () const
-{
-  DEBUG_CHECK_ALIVE
-  if (!d->mimeSourceFactory)
-  {
-    d->mimeSourceFactory = new KMimeSourceFactory(_iconLoader);
-    d->mimeSourceFactory->setInstance(const_cast<TDEInstance *>(this));
-  }
-
-  return d->mimeSourceFactory;
-}
-
-void TDEInstance::virtual_hook( int, void* )
-{ /*BASE::virtual_hook( id, data );*/ }
-
diff --git a/tdecore/kinstance.h b/tdecore/kinstance.h
index b46947218..2db63c3e1 100644
--- a/tdecore/kinstance.h
+++ b/tdecore/kinstance.h
@@ -1,192 +1 @@
-/* This file is part of the KDE libraries
-   Copyright (C) 1999 Torben Weis <weis@kde.org>
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License version 2 as published by the Free Software Foundation.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public License
-   along with this library; see the file COPYING.LIB.  If not, write to
-   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.
-*/
-#ifndef _KINSTANCE_H
-#define _KINSTANCE_H
-
-#include <tqstring.h>
-#include "tdelibs_export.h"
-
-class TDEStandardDirs;
-class TDEAboutData;
-class TDEConfig;
-class TDEIconLoader;
-class KCharsets;
-class TQFont;
-class TDEInstancePrivate;
-class KMimeSourceFactory;
-class TDESharedConfig;
-#ifdef __TDE_HAVE_TDEHWLIB
-class TDEHardwareDevices;
-class TDEGlobalNetworkManager;
-#endif
-
-
-/**
- * Access to KDE global objects for use in shared libraries.  In
- * practical terms, this class is used in KDE components.  This allows
- * components to store things that normally would be accessed by
- * TDEGlobal.
- *
- * @author Torben Weis
- */
-class TDECORE_EXPORT TDEInstance
-{
-    friend class TDEStandardDirs;
-
- public:
-    /**
-     *  Constructor.
-     *  @param instanceName the name of the instance
-     */
-    TDEInstance( const TQCString& instanceName) ;
-
-    /**
-     *  Constructor.
-     *  When building a TDEInstance that is not your TDEApplication,
-     *  make sure that the TDEAboutData and the TDEInstance have the same life time.
-     *  You have to destroy both, since the instance doesn't own the about data.
-     *  Don't build a TDEAboutData on the stack in this case !
-     *  Building a TDEAboutData on the stack is only ok for usage with
-     *  TDECmdLineArgs and TDEApplication (not destroyed until the app exits).
-     *  @param aboutData data about this instance (see TDEAboutData)
-     */
-    TDEInstance( const TDEAboutData * aboutData );
-
-    /*
-     * @internal
-     * Only for K(Unique)Application
-     * Initialize from src and delete it.
-     */
-
-    TDEInstance( TDEInstance* src );
-
-    /**
-     * Destructor.
-     */
-    virtual ~TDEInstance();
-
-    /**
-     * Returns the application standard dirs object.
-     * @return The TDEStandardDirs of the application.
-     */
-    TDEStandardDirs	*dirs() const;
-
-    /**
-     * Returns the general config object ("appnamerc").
-     * @return the TDEConfig object for the instance.
-     */
-    TDEConfig            *config() const;
-
-    /**
-     * Returns the general config object ("appnamerc").
-     * @return the TDEConfig object for the instance.
-     */
-    TDESharedConfig      *sharedConfig() const;
-
-    /**
-     * Set a read-only flag on the configuration files
-     * This must be called before config() or dirs() to have any effect
-     * Defaults to false
-     * @param ro read only if true
-     */
-    void                setConfigReadOnly(bool ro);
-
-    /**
-     *  Returns an iconloader object.
-     * @return the iconloader object.
-     */
-    TDEIconLoader	       *iconLoader() const;
-
-#ifdef __TDE_HAVE_TDEHWLIB
-    /**
-     *  Returns a TDEHardwareDevices object.
-     * @return the hardwaredevices object.
-     */
-    TDEHardwareDevices	*hardwareDevices() const;
-
-    /**
-     *  Returns a TDEGlobalNetworkManager object.
-     * @return the networkmanager object.
-     */
-    TDEGlobalNetworkManager  *networkManager() const;
-#endif
-
-    /**
-     * Re-allocate the global iconloader.
-     */
-    void newIconLoader() const;
-
-    /**
-     *  Returns the about data of this instance
-     *  Warning, can be 0L
-     * @return the about data of the instance, or 0 if it has 
-     *         not been set yet
-     */
-    const TDEAboutData *aboutData() const;
-
-    /**
-     * Returns the name of the instance
-     * @return the instance name, can be null if the TDEInstance has been 
-     *         created with a null name
-     */
-    TQCString          instanceName() const;
-
-    /**
-     * Returns the KMimeSourceFactory of the instance.
-     * Mainly added for API completeness and future extensibility.
-     * @return the KMimeSourceFactory set as default for this application.
-     */
-    KMimeSourceFactory* mimeSourceFactory () const;
-
-protected:
-    /**
-     *  Copy Constructor is not allowed
-     */
-    TDEInstance( const TDEInstance& );
-
-    /**
-     * Set name of default config file.
-     * @param name the name of the default config file
-     * @since 3.1
-     */
-    void setConfigName(const TQString &name);
-
-private:
-    mutable TDEStandardDirs       *_dirs;
-
-    mutable TDEConfig             *_config;
-    mutable TDEIconLoader         *_iconLoader;
-
-#ifdef __TDE_HAVE_TDEHWLIB
-    mutable TDEHardwareDevices  *_hardwaredevices;
-    mutable TDEGlobalNetworkManager  *_networkmanager;
-#endif
-    mutable void                *_placeholder;
-
-    TQCString                     _name;
-    const TDEAboutData            *_aboutData;
-
-protected:
-    virtual void virtual_hook( int id, void* data );
-private:
-    TDEInstancePrivate *d;
-    bool m_configReadOnly;
-};
-
-#endif
-
+#include <tdeinstance.h>
diff --git a/tdecore/kmimesourcefactory.cpp b/tdecore/kmimesourcefactory.cpp
index 8ed02941e..c13c22e2d 100644
--- a/tdecore/kmimesourcefactory.cpp
+++ b/tdecore/kmimesourcefactory.cpp
@@ -20,7 +20,7 @@
 
 #include <kdebug.h>
 #include <tdeglobal.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kiconloader.h>
 
 #include "kmimesourcefactory.h"
diff --git a/tdecore/ktempdir.cpp b/tdecore/ktempdir.cpp
index db954010e..045695c07 100644
--- a/tdecore/ktempdir.cpp
+++ b/tdecore/ktempdir.cpp
@@ -49,7 +49,7 @@
 
 #include "tdeglobal.h"
 #include "tdeapplication.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 #include "ktempdir.h"
 #include "tdestandarddirs.h"
 #include "tdeprocess.h"
diff --git a/tdecore/tde-config.cpp.cmake b/tdecore/tde-config.cpp.cmake
index 7c1eebbd2..accc5c80f 100644
--- a/tdecore/tde-config.cpp.cmake
+++ b/tdecore/tde-config.cpp.cmake
@@ -1,6 +1,6 @@
 #include <tdecmdlineargs.h>
 #include <tdelocale.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdestandarddirs.h>
 #include <tdeglobal.h>
 #include <tdeglobalsettings.h>
diff --git a/tdecore/tde-config.cpp.in b/tdecore/tde-config.cpp.in
index 9ef991b41..4968d9d4a 100644
--- a/tdecore/tde-config.cpp.in
+++ b/tdecore/tde-config.cpp.in
@@ -1,6 +1,6 @@
 #include <tdecmdlineargs.h>
 #include <tdelocale.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdestandarddirs.h>
 #include <tdeglobal.h>
 #include <tdeglobalsettings.h>
diff --git a/tdecore/tdeapplication.h b/tdecore/tdeapplication.h
index 14f63e048..171ae2eec 100644
--- a/tdecore/tdeapplication.h
+++ b/tdecore/tdeapplication.h
@@ -37,7 +37,7 @@ typedef void Display;
 
 #include <tqapplication.h>
 #include <tqpixmap.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 
 struct _IceConn;
 class TQPopupMenu;
diff --git a/tdecore/tdeconfig_compiler/tests/test1main.cpp b/tdecore/tdeconfig_compiler/tests/test1main.cpp
index 79546639f..eaa9bc97b 100644
--- a/tdecore/tdeconfig_compiler/tests/test1main.cpp
+++ b/tdecore/tdeconfig_compiler/tests/test1main.cpp
@@ -19,7 +19,7 @@ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 #include "test1.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 
 int main( int, char*[] )
 {
diff --git a/tdecore/tdeconfig_compiler/tests/test2main.cpp b/tdecore/tdeconfig_compiler/tests/test2main.cpp
index 5970bf03d..46b85c6bf 100644
--- a/tdecore/tdeconfig_compiler/tests/test2main.cpp
+++ b/tdecore/tdeconfig_compiler/tests/test2main.cpp
@@ -19,7 +19,7 @@ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 #include "test2.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 
 int main( int, char*[] )
 {
diff --git a/tdecore/tdeconfig_compiler/tests/test3main.cpp b/tdecore/tdeconfig_compiler/tests/test3main.cpp
index f73ae38e3..262301b8b 100644
--- a/tdecore/tdeconfig_compiler/tests/test3main.cpp
+++ b/tdecore/tdeconfig_compiler/tests/test3main.cpp
@@ -19,7 +19,7 @@ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 #include "test3.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 
 int main( int, char*[] )
 {
diff --git a/tdecore/tdeconfig_compiler/tests/test4main.cpp b/tdecore/tdeconfig_compiler/tests/test4main.cpp
index 5229d8a87..92e34c328 100644
--- a/tdecore/tdeconfig_compiler/tests/test4main.cpp
+++ b/tdecore/tdeconfig_compiler/tests/test4main.cpp
@@ -20,7 +20,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "test4.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 
 int main( int, char*[] )
 {
diff --git a/tdecore/tdeconfig_compiler/tests/test5main.cpp b/tdecore/tdeconfig_compiler/tests/test5main.cpp
index 89f28587f..f9111cf24 100644
--- a/tdecore/tdeconfig_compiler/tests/test5main.cpp
+++ b/tdecore/tdeconfig_compiler/tests/test5main.cpp
@@ -20,7 +20,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "test5.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 
 int main( int, char*[] )
 {
diff --git a/tdecore/tdeconfig_compiler/tests/test6main.cpp b/tdecore/tdeconfig_compiler/tests/test6main.cpp
index 9b1b7503e..90c5de929 100644
--- a/tdecore/tdeconfig_compiler/tests/test6main.cpp
+++ b/tdecore/tdeconfig_compiler/tests/test6main.cpp
@@ -20,7 +20,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "test6.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 
 int main( int, char*[] )
 {
diff --git a/tdecore/tdeconfig_compiler/tests/test7main.cpp b/tdecore/tdeconfig_compiler/tests/test7main.cpp
index 81cca0184..522aa4ff6 100644
--- a/tdecore/tdeconfig_compiler/tests/test7main.cpp
+++ b/tdecore/tdeconfig_compiler/tests/test7main.cpp
@@ -20,7 +20,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "test7.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 
 int main( int, char*[] )
 {
diff --git a/tdecore/tdeconfig_compiler/tests/test8main.cpp b/tdecore/tdeconfig_compiler/tests/test8main.cpp
index 2611a48af..a338ea096 100644
--- a/tdecore/tdeconfig_compiler/tests/test8main.cpp
+++ b/tdecore/tdeconfig_compiler/tests/test8main.cpp
@@ -21,7 +21,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "test8a.h"
 #include "test8b.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 
 int main( int, char*[] )
 {
diff --git a/tdecore/tdeconfig_compiler/tests/test9main.cpp b/tdecore/tdeconfig_compiler/tests/test9main.cpp
index 8668d8d8c..e49899bc1 100644
--- a/tdecore/tdeconfig_compiler/tests/test9main.cpp
+++ b/tdecore/tdeconfig_compiler/tests/test9main.cpp
@@ -19,7 +19,7 @@ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 #include "test9.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 #include <kdebug.h>
 #include <tqdir.h>
 
diff --git a/tdecore/tdeconfig_compiler/tests/test_dpointer_main.cpp b/tdecore/tdeconfig_compiler/tests/test_dpointer_main.cpp
index b62ee17af..a46f7ae50 100644
--- a/tdecore/tdeconfig_compiler/tests/test_dpointer_main.cpp
+++ b/tdecore/tdeconfig_compiler/tests/test_dpointer_main.cpp
@@ -20,7 +20,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "test_dpointer.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 
 int main( int, char*[] )
 {
diff --git a/tdecore/tdecrash.cpp b/tdecore/tdecrash.cpp
index e1ff0ab57..b1dc62957 100644
--- a/tdecore/tdecrash.cpp
+++ b/tdecore/tdecrash.cpp
@@ -45,7 +45,7 @@
 
 #include <tqwindowdefs.h>
 #include <tdeglobal.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdeaboutdata.h>
 #include <kdebug.h>
 #include <tdeapplication.h>
diff --git a/tdecore/tdeglobal.cpp b/tdecore/tdeglobal.cpp
index f00a8467c..517debcad 100644
--- a/tdecore/tdeglobal.cpp
+++ b/tdecore/tdeglobal.cpp
@@ -39,7 +39,7 @@
 #include <tdenetworkconnections.h>
 #endif
 #include <tdestandarddirs.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include "kstaticdeleter.h"
 
 #include <tqfont.h>
diff --git a/tdecore/tdeglobal.h b/tdecore/tdeglobal.h
index d604a4244..a8c16d3fb 100644
--- a/tdecore/tdeglobal.h
+++ b/tdecore/tdeglobal.h
@@ -19,7 +19,7 @@
 #define _TDEGLOBAL_H
 
 #include "tdelibs_export.h"
-#include <kinstance.h> // KDE4: class TDEInstance is enough here
+#include <tdeinstance.h> // KDE4: class TDEInstance is enough here
 
 class KCharsets;
 class TDEConfig;
diff --git a/tdecore/tdeinstance.cpp b/tdecore/tdeinstance.cpp
new file mode 100644
index 000000000..c8235e45e
--- /dev/null
+++ b/tdecore/tdeinstance.cpp
@@ -0,0 +1,362 @@
+/* This file is part of the KDE libraries
+   Copyright (C) 1999 Torben Weis <weis@kde.org>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License version 2 as published by the Free Software Foundation.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
+*/
+#include "tdeinstance.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "tdeconfig.h"
+#include "tdelocale.h"
+#include "kcharsets.h"
+#include "kiconloader.h"
+#ifdef __TDE_HAVE_TDEHWLIB
+#include "klibloader.h"
+#include "tdeversion.h"
+#include "tdehardwaredevices.h"
+#include "tdenetworkconnections.h"
+#endif
+#include "tdeaboutdata.h"
+#include "tdestandarddirs.h"
+#include "kdebug.h"
+#include "tdeglobal.h"
+#include "kmimesourcefactory.h"
+
+#include <tqfont.h>
+
+#include "config.h"
+#ifndef NDEBUG
+  #include <assert.h>
+  #include <tqptrdict.h>
+  static TQPtrList<TDEInstance> *allInstances = 0;
+  static TQPtrDict<TQCString> *allOldInstances = 0;
+  #define DEBUG_ADD do { if (!allInstances) { allInstances = new TQPtrList<TDEInstance>(); allOldInstances = new TQPtrDict<TQCString>(); } allInstances->append(this); allOldInstances->insert( this, new TQCString( _name)); } while (false);
+  #define DEBUG_REMOVE do { allInstances->removeRef(this); } while (false);
+  #define DEBUG_CHECK_ALIVE do { if (!allInstances->contains((TDEInstance*)this)) { TQCString *old = allOldInstances->find((TDEInstance*)this); tqWarning("ACCESSING DELETED TDEINSTANCE! (%s)", old ? old->data() : "<unknown>"); assert(false); } } while (false);
+#else
+  #define DEBUG_ADD
+  #define DEBUG_REMOVE
+  #define DEBUG_CHECK_ALIVE
+#endif
+
+class TDEInstancePrivate
+{
+public:
+    TDEInstancePrivate ()
+    {
+        mimeSourceFactory = 0L;
+    }
+
+    ~TDEInstancePrivate ()
+    {
+        delete mimeSourceFactory;
+    }
+
+    KMimeSourceFactory* mimeSourceFactory;
+    TQString configName;
+    bool ownAboutdata;
+    TDESharedConfig::Ptr sharedConfig;
+};
+
+TDEInstance::TDEInstance( const TQCString& name)
+  : _dirs (0L),
+    _config (0L),
+    _iconLoader (0L),
+#ifdef __TDE_HAVE_TDEHWLIB
+    _hardwaredevices (0L),
+    _networkmanager (0L),
+#endif
+    _name( name ), _aboutData( new TDEAboutData( name, "", 0 ) ), m_configReadOnly(false)
+{
+    DEBUG_ADD
+    Q_ASSERT(!name.isEmpty());
+    if (!TDEGlobal::_instance)
+    {
+      TDEGlobal::_instance = this;
+      TDEGlobal::setActiveInstance(this);
+    }
+
+    d = new TDEInstancePrivate ();
+    d->ownAboutdata = true;
+}
+
+TDEInstance::TDEInstance( const TDEAboutData * aboutData )
+  : _dirs (0L),
+    _config (0L),
+    _iconLoader (0L),
+#ifdef __TDE_HAVE_TDEHWLIB
+    _hardwaredevices (0L),
+    _networkmanager (0L),
+#endif
+    _name( aboutData->appName() ), _aboutData( aboutData ), m_configReadOnly(false)
+{
+    DEBUG_ADD
+    Q_ASSERT(!_name.isEmpty());
+
+    if (!TDEGlobal::_instance)
+    {
+      TDEGlobal::_instance = this;
+      TDEGlobal::setActiveInstance(this);
+    }
+
+    d = new TDEInstancePrivate ();
+    d->ownAboutdata = false;
+}
+
+TDEInstance::TDEInstance( TDEInstance* src )
+  : _dirs ( src->_dirs ),
+    _config ( src->_config ),
+    _iconLoader ( src->_iconLoader ),
+#ifdef __TDE_HAVE_TDEHWLIB
+    _hardwaredevices ( src->_hardwaredevices ),
+    _networkmanager ( src->_networkmanager ),
+#endif
+    _name( src->_name ), _aboutData( src->_aboutData ), m_configReadOnly(false)
+{
+    DEBUG_ADD
+    Q_ASSERT(!_name.isEmpty());
+
+    if (!TDEGlobal::_instance || TDEGlobal::_instance == src )
+    {
+      TDEGlobal::_instance = this;
+      TDEGlobal::setActiveInstance(this);
+    }
+
+    d = new TDEInstancePrivate ();
+    d->ownAboutdata = src->d->ownAboutdata;
+    d->sharedConfig = src->d->sharedConfig;
+
+    src->_dirs = 0L;
+    src->_config = 0L;
+    src->_iconLoader = 0L;
+#ifdef __TDE_HAVE_TDEHWLIB
+    src->_hardwaredevices = 0L;
+    src->_networkmanager = 0L;
+#endif
+    src->_aboutData = 0L;
+    delete src;
+}
+
+TDEInstance::~TDEInstance()
+{
+    DEBUG_CHECK_ALIVE
+
+    if (d->ownAboutdata)
+        delete _aboutData;
+    _aboutData = 0;
+
+    delete d;
+    d = 0;
+
+    delete _iconLoader;
+    _iconLoader = 0;
+
+#ifdef __TDE_HAVE_TDEHWLIB
+    delete _hardwaredevices;
+    _hardwaredevices = 0;
+
+    delete _networkmanager;
+    _networkmanager = 0;
+#endif
+
+    // delete _config; // Do not delete, stored in d->sharedConfig
+    _config = 0;
+    delete _dirs;
+    _dirs = 0;
+
+    if (TDEGlobal::_instance == this)
+        TDEGlobal::_instance = 0;
+    if (TDEGlobal::activeInstance() == this)
+        TDEGlobal::setActiveInstance(0);
+    DEBUG_REMOVE
+}
+
+
+TDEStandardDirs *TDEInstance::dirs() const
+{
+    DEBUG_CHECK_ALIVE
+    if( _dirs == 0 ) {
+	_dirs = new TDEStandardDirs( );
+        if (_config) {
+            if (_dirs->addCustomized(_config))
+                _config->reparseConfiguration();
+	} else
+            config(); // trigger adding of possible customized dirs
+    }
+
+    return _dirs;
+}
+
+extern bool kde_kiosk_exception;
+extern bool kde_kiosk_admin;
+
+void TDEInstance::setConfigReadOnly(bool ro)
+{
+    m_configReadOnly = ro;
+}
+
+TDEConfig	*TDEInstance::config() const
+{
+    DEBUG_CHECK_ALIVE
+    if( _config == 0 ) {
+        if ( !d->configName.isEmpty() )
+        {
+            d->sharedConfig = TDESharedConfig::openConfig( d->configName );
+
+            // Check whether custom config files are allowed.
+            d->sharedConfig->setGroup( "KDE Action Restrictions" );
+            TQString kioskException = d->sharedConfig->readEntry("kiosk_exception");
+            if (d->sharedConfig->readBoolEntry( "custom_config", true))
+            {
+               d->sharedConfig->setGroup(TQString::null);
+            }
+            else
+            {
+               d->sharedConfig = 0;
+            }
+
+        }
+
+        if ( d->sharedConfig == 0 )
+        {
+	    if ( !_name.isEmpty() ) {
+	        d->sharedConfig = TDESharedConfig::openConfig( _name + "rc", m_configReadOnly );
+	    }
+	    else {
+	        d->sharedConfig = TDESharedConfig::openConfig( TQString::null );
+	    }
+	}
+
+	// Check if we are excempt from kiosk restrictions
+	if (kde_kiosk_admin && !kde_kiosk_exception && !TQCString(getenv("TDE_KIOSK_NO_RESTRICTIONS")).isEmpty())
+	{
+            kde_kiosk_exception = true;
+            d->sharedConfig = 0;
+            return config(); // Reread...
+        }
+
+	_config = d->sharedConfig;
+        if (_dirs)
+            if (_dirs->addCustomized(_config))
+                _config->reparseConfiguration();
+    }
+
+    return _config;
+}
+
+TDESharedConfig *TDEInstance::sharedConfig() const
+{
+    DEBUG_CHECK_ALIVE
+    if (_config == 0)
+       (void) config(); // Initialize config
+
+    return d->sharedConfig;
+}
+
+void TDEInstance::setConfigName(const TQString &configName)
+{
+    DEBUG_CHECK_ALIVE
+    d->configName = configName;
+}
+
+TDEIconLoader *TDEInstance::iconLoader() const
+{
+    DEBUG_CHECK_ALIVE
+    if( _iconLoader == 0 ) {
+	_iconLoader = new TDEIconLoader( _name, dirs() );
+    	_iconLoader->enableDelayedIconSetLoading( true );
+    }
+
+    return _iconLoader;
+}
+
+#ifdef __TDE_HAVE_TDEHWLIB
+TDEHardwareDevices *TDEInstance::hardwareDevices() const
+{
+	DEBUG_CHECK_ALIVE
+	if (_hardwaredevices == 0)
+	{
+		TQString libName = TQString("libtdehw.so.%1").arg(TDE_VERSION_MAJOR);
+		KLibrary *lib = KLibLoader::self()->library(libName.latin1());
+		if (lib)
+		{
+			TDEHardwareDevices* (*create)() = (TDEHardwareDevices* (*)())lib->symbol("create_tdeHardwareDevices");
+			if (create)
+			{
+				_hardwaredevices = create();
+			}
+		}
+	}
+
+	return _hardwaredevices;
+}
+
+TDEGlobalNetworkManager *TDEInstance::networkManager() const
+{
+	DEBUG_CHECK_ALIVE
+	if (_networkmanager == 0)
+	{
+		TQString libName = TQString("libtdehw.so.%1").arg(TDE_VERSION_MAJOR);
+		KLibrary *lib = KLibLoader::self()->library(libName.latin1());
+		if (lib)
+		{
+			TDEGlobalNetworkManager* (*create)() = (TDEGlobalNetworkManager* (*)())lib->symbol("create_tdeGlobalNetworkManager");
+			if (create)
+			{
+				_networkmanager = create();
+			}
+		}
+	}
+
+	return _networkmanager;
+}
+#endif
+
+void TDEInstance::newIconLoader() const
+{
+    DEBUG_CHECK_ALIVE
+    TDEIconTheme::reconfigure();
+    _iconLoader->reconfigure( _name, dirs() );
+}
+
+const TDEAboutData * TDEInstance::aboutData() const
+{
+    DEBUG_CHECK_ALIVE
+    return _aboutData;
+}
+
+TQCString TDEInstance::instanceName() const
+{
+    DEBUG_CHECK_ALIVE
+    return _name;
+}
+
+KMimeSourceFactory* TDEInstance::mimeSourceFactory () const
+{
+  DEBUG_CHECK_ALIVE
+  if (!d->mimeSourceFactory)
+  {
+    d->mimeSourceFactory = new KMimeSourceFactory(_iconLoader);
+    d->mimeSourceFactory->setInstance(const_cast<TDEInstance *>(this));
+  }
+
+  return d->mimeSourceFactory;
+}
+
+void TDEInstance::virtual_hook( int, void* )
+{ /*BASE::virtual_hook( id, data );*/ }
+
diff --git a/tdecore/tdeinstance.h b/tdecore/tdeinstance.h
new file mode 100644
index 000000000..7ded51878
--- /dev/null
+++ b/tdecore/tdeinstance.h
@@ -0,0 +1,192 @@
+/* This file is part of the TDE libraries
+   Copyright (C) 1999 Torben Weis <weis@kde.org>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License version 2 as published by the Free Software Foundation.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
+*/
+#ifndef _TDEINSTANCE_H
+#define _TDEINSTANCE_H
+
+#include <tqstring.h>
+#include "tdelibs_export.h"
+
+class TDEStandardDirs;
+class TDEAboutData;
+class TDEConfig;
+class TDEIconLoader;
+class KCharsets;
+class TQFont;
+class TDEInstancePrivate;
+class KMimeSourceFactory;
+class TDESharedConfig;
+#ifdef __TDE_HAVE_TDEHWLIB
+class TDEHardwareDevices;
+class TDEGlobalNetworkManager;
+#endif
+
+
+/**
+ * Access to TDE global objects for use in shared libraries.  In
+ * practical terms, this class is used in TDE components.  This allows
+ * components to store things that normally would be accessed by
+ * TDEGlobal.
+ *
+ * @author Torben Weis
+ */
+class TDECORE_EXPORT TDEInstance
+{
+    friend class TDEStandardDirs;
+
+ public:
+    /**
+     *  Constructor.
+     *  @param instanceName the name of the instance
+     */
+    TDEInstance( const TQCString& instanceName) ;
+
+    /**
+     *  Constructor.
+     *  When building a TDEInstance that is not your TDEApplication,
+     *  make sure that the TDEAboutData and the TDEInstance have the same life time.
+     *  You have to destroy both, since the instance doesn't own the about data.
+     *  Don't build a TDEAboutData on the stack in this case !
+     *  Building a TDEAboutData on the stack is only ok for usage with
+     *  TDECmdLineArgs and TDEApplication (not destroyed until the app exits).
+     *  @param aboutData data about this instance (see TDEAboutData)
+     */
+    TDEInstance( const TDEAboutData * aboutData );
+
+    /*
+     * @internal
+     * Only for K(Unique)Application
+     * Initialize from src and delete it.
+     */
+
+    TDEInstance( TDEInstance* src );
+
+    /**
+     * Destructor.
+     */
+    virtual ~TDEInstance();
+
+    /**
+     * Returns the application standard dirs object.
+     * @return The TDEStandardDirs of the application.
+     */
+    TDEStandardDirs	*dirs() const;
+
+    /**
+     * Returns the general config object ("appnamerc").
+     * @return the TDEConfig object for the instance.
+     */
+    TDEConfig            *config() const;
+
+    /**
+     * Returns the general config object ("appnamerc").
+     * @return the TDEConfig object for the instance.
+     */
+    TDESharedConfig      *sharedConfig() const;
+
+    /**
+     * Set a read-only flag on the configuration files
+     * This must be called before config() or dirs() to have any effect
+     * Defaults to false
+     * @param ro read only if true
+     */
+    void                setConfigReadOnly(bool ro);
+
+    /**
+     *  Returns an iconloader object.
+     * @return the iconloader object.
+     */
+    TDEIconLoader	       *iconLoader() const;
+
+#ifdef __TDE_HAVE_TDEHWLIB
+    /**
+     *  Returns a TDEHardwareDevices object.
+     * @return the hardwaredevices object.
+     */
+    TDEHardwareDevices	*hardwareDevices() const;
+
+    /**
+     *  Returns a TDEGlobalNetworkManager object.
+     * @return the networkmanager object.
+     */
+    TDEGlobalNetworkManager  *networkManager() const;
+#endif
+
+    /**
+     * Re-allocate the global iconloader.
+     */
+    void newIconLoader() const;
+
+    /**
+     *  Returns the about data of this instance
+     *  Warning, can be 0L
+     * @return the about data of the instance, or 0 if it has 
+     *         not been set yet
+     */
+    const TDEAboutData *aboutData() const;
+
+    /**
+     * Returns the name of the instance
+     * @return the instance name, can be null if the TDEInstance has been 
+     *         created with a null name
+     */
+    TQCString          instanceName() const;
+
+    /**
+     * Returns the KMimeSourceFactory of the instance.
+     * Mainly added for API completeness and future extensibility.
+     * @return the KMimeSourceFactory set as default for this application.
+     */
+    KMimeSourceFactory* mimeSourceFactory () const;
+
+protected:
+    /**
+     *  Copy Constructor is not allowed
+     */
+    TDEInstance( const TDEInstance& );
+
+    /**
+     * Set name of default config file.
+     * @param name the name of the default config file
+     * @since 3.1
+     */
+    void setConfigName(const TQString &name);
+
+private:
+    mutable TDEStandardDirs       *_dirs;
+
+    mutable TDEConfig             *_config;
+    mutable TDEIconLoader         *_iconLoader;
+
+#ifdef __TDE_HAVE_TDEHWLIB
+    mutable TDEHardwareDevices  *_hardwaredevices;
+    mutable TDEGlobalNetworkManager  *_networkmanager;
+#endif
+    mutable void                *_placeholder;
+
+    TQCString                     _name;
+    const TDEAboutData            *_aboutData;
+
+protected:
+    virtual void virtual_hook( int id, void* data );
+private:
+    TDEInstancePrivate *d;
+    bool m_configReadOnly;
+};
+
+#endif
+
diff --git a/tdecore/tdelocale.cpp b/tdecore/tdelocale.cpp
index 53e85de22..1e771c85a 100644
--- a/tdecore/tdelocale.cpp
+++ b/tdecore/tdelocale.cpp
@@ -35,7 +35,7 @@
 #include "tdeglobal.h"
 #include "tdestandarddirs.h"
 #include "tdesimpleconfig.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 #include "tdeconfig.h"
 #include "kdebug.h"
 #include "kcalendarsystem.h"
diff --git a/tdecore/tdeshortcutlist.cpp b/tdecore/tdeshortcutlist.cpp
index cc9961199..b4ceb86d8 100644
--- a/tdecore/tdeshortcutlist.cpp
+++ b/tdecore/tdeshortcutlist.cpp
@@ -7,7 +7,7 @@
 #include <kdebug.h>
 #include <tdeglobal.h>
 #include <tdeglobalaccel.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdeshortcut.h>
 #include "tdeshortcutlist.h"
 
diff --git a/tdecore/tdestandarddirs.cpp b/tdecore/tdestandarddirs.cpp
index ac827c883..0821b22d1 100644
--- a/tdecore/tdestandarddirs.cpp
+++ b/tdecore/tdestandarddirs.cpp
@@ -48,7 +48,7 @@
 
 #include "tdestandarddirs.h"
 #include "tdeconfig.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 #include "kshell.h"
 #include "tdesimpleconfig.h"
 #include "kuser.h"
diff --git a/tdecore/tdetempfile.cpp b/tdecore/tdetempfile.cpp
index d498f1258..4f6dade45 100644
--- a/tdecore/tdetempfile.cpp
+++ b/tdecore/tdetempfile.cpp
@@ -50,7 +50,7 @@
 
 #include "tdeglobal.h"
 #include "tdeapplication.h"
-#include "kinstance.h"
+#include "tdeinstance.h"
 #include "tdetempfile.h"
 #include "tdestandarddirs.h"
 #include "kde_file.h"
diff --git a/tdecore/tests/kdebugtest.cpp b/tdecore/tests/kdebugtest.cpp
index 9f07b3437..266eaeaae 100644
--- a/tdecore/tests/kdebugtest.cpp
+++ b/tdecore/tests/kdebugtest.cpp
@@ -1,6 +1,6 @@
 #include "kdebug.h"
 #include <tqwidget.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <iostream>
 #include <tqapplication.h>
 #include <tqpen.h>
diff --git a/tdecore/tests/tdestandarddirstest.cpp b/tdecore/tests/tdestandarddirstest.cpp
index 53d76a83c..28c974b9e 100644
--- a/tdecore/tests/tdestandarddirstest.cpp
+++ b/tdecore/tests/tdestandarddirstest.cpp
@@ -1,6 +1,6 @@
 #include <tdeapplication.h>
 #include <kdebug.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdestandarddirs.h>
 #include <tdeconfig.h>
 
diff --git a/tdehtml/tdehtml_factory.cpp b/tdehtml/tdehtml_factory.cpp
index 7aaf16b5a..2f0233403 100644
--- a/tdehtml/tdehtml_factory.cpp
+++ b/tdehtml/tdehtml_factory.cpp
@@ -29,7 +29,7 @@
 #include "misc/loader.h"
 #include "misc/arena.h"
 
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdeaboutdata.h>
 #include <tdelocale.h>
 
diff --git a/tdehtml/tdehtmlimage.cpp b/tdehtml/tdehtmlimage.cpp
index 726f6d6c1..3ade9bd4d 100644
--- a/tdehtml/tdehtmlimage.cpp
+++ b/tdehtml/tdehtmlimage.cpp
@@ -30,7 +30,7 @@
 #include <tqtimer.h>
 
 #include <tdeio/job.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kmimetype.h>
 #include <tdelocale.h>
 
diff --git a/tdehtml/tdemultipart/tdemultipart.cpp b/tdehtml/tdemultipart/tdemultipart.cpp
index 7afda5741..ccb7cdaea 100644
--- a/tdehtml/tdemultipart/tdemultipart.cpp
+++ b/tdehtml/tdemultipart/tdemultipart.cpp
@@ -20,7 +20,7 @@
 #include "tdemultipart.h"
 
 #include <tqvbox.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kmimetype.h>
 #include <tdelocale.h>
 #include <tdeio/job.h>
diff --git a/tdeinit/tdedostartupconfig.cpp b/tdeinit/tdedostartupconfig.cpp
index b9a0e55b6..4ea169f4e 100644
--- a/tdeinit/tdedostartupconfig.cpp
+++ b/tdeinit/tdedostartupconfig.cpp
@@ -28,7 +28,7 @@ DEALINGS IN THE SOFTWARE.
 
 #include <tqfile.h>
 #include <tqtextstream.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdestandarddirs.h>
 #include <tdeconfig.h>
 #include <kdebug.h>
diff --git a/tdeinit/tdeinit.cpp b/tdeinit/tdeinit.cpp
index debe0be12..392cd0662 100644
--- a/tdeinit/tdeinit.cpp
+++ b/tdeinit/tdeinit.cpp
@@ -52,7 +52,7 @@
 #include <tqtextstream.h>
 #include <tqregexp.h>
 #include <tqfont.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdestandarddirs.h>
 #include <tdeglobal.h>
 #include <tdeconfig.h>
diff --git a/tdeio/tdefile/knotifydialog.h b/tdeio/tdefile/knotifydialog.h
index fe6dcc6ba..c9f3fed8d 100644
--- a/tdeio/tdefile/knotifydialog.h
+++ b/tdeio/tdefile/knotifydialog.h
@@ -21,7 +21,7 @@
 
 #include <tdelistview.h>
 #include <kdialogbase.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdeglobal.h>
 
 #include "knotifywidgetbase.h"
diff --git a/tdeio/tdefile/kurlbar.cpp b/tdeio/tdefile/kurlbar.cpp
index fa6d8ea47..ec8040f51 100644
--- a/tdeio/tdefile/kurlbar.cpp
+++ b/tdeio/tdefile/kurlbar.cpp
@@ -36,7 +36,7 @@
 #include <tdeglobal.h>
 #include <kicondialog.h>
 #include <kiconloader.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <klineedit.h>
 #include <tdelocale.h>
 #include <kmimetype.h>
diff --git a/tdeio/tdeio/dataprotocol.cpp b/tdeio/tdeio/dataprotocol.cpp
index efbf549ad..3bfd3ed1c 100644
--- a/tdeio/tdeio/dataprotocol.cpp
+++ b/tdeio/tdeio/dataprotocol.cpp
@@ -29,7 +29,7 @@
 #include <tqtextcodec.h>
 
 #ifdef DATAKIOSLAVE
-#  include <kinstance.h>
+#  include <tdeinstance.h>
 #  include <stdlib.h>
 #endif
 #ifdef TESTKIO
diff --git a/tdeio/tdeio/kdatatool.cpp b/tdeio/tdeio/kdatatool.cpp
index 903bf7775..c916abf0f 100644
--- a/tdeio/tdeio/kdatatool.cpp
+++ b/tdeio/tdeio/kdatatool.cpp
@@ -23,7 +23,7 @@
 #include <tdestandarddirs.h>
 #include <klibloader.h>
 #include <kdebug.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 
 #include <ktrader.h>
 #include <tdeparts/componentfactory.h>
diff --git a/tdeio/tdeio/kscan.h b/tdeio/tdeio/kscan.h
index cfc70e08a..d7d8ffe0b 100644
--- a/tdeio/tdeio/kscan.h
+++ b/tdeio/tdeio/kscan.h
@@ -21,7 +21,7 @@
 #define KSCAN_H
 
 #include <kdialogbase.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <klibloader.h>
 
 class TQImage;
diff --git a/tdeio/tests/kfiltertest.cpp b/tdeio/tests/kfiltertest.cpp
index ed73d6782..5e0fdfba4 100644
--- a/tdeio/tests/kfiltertest.cpp
+++ b/tdeio/tests/kfiltertest.cpp
@@ -23,7 +23,7 @@
 #include <tqfile.h>
 #include <tqtextstream.h>
 #include <kdebug.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 
 void test_block( const TQString & fileName )
 {
diff --git a/tdeio/tests/kmfitest.cpp b/tdeio/tests/kmfitest.cpp
index a2ec91717..aadde7652 100644
--- a/tdeio/tests/kmfitest.cpp
+++ b/tdeio/tests/kmfitest.cpp
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <tqdir.h>
 #include <tqfile.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kurl.h>
 #include <tdefilemetainfo.h>
 #include <kmimetype.h>
diff --git a/tdeio/tests/kmimemagictest.cpp b/tdeio/tests/kmimemagictest.cpp
index 00c545c3c..47583ea21 100644
--- a/tdeio/tests/kmimemagictest.cpp
+++ b/tdeio/tests/kmimemagictest.cpp
@@ -19,7 +19,7 @@
 
 #include <kmimetype.h>
 #include <kmimemagic.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <stdio.h>
 
 int main( int argc, char** argv )
diff --git a/tdeio/tests/kmimetypetest.cpp b/tdeio/tests/kmimetypetest.cpp
index 631521c8a..bf41d8c40 100644
--- a/tdeio/tests/kmimetypetest.cpp
+++ b/tdeio/tests/kmimetypetest.cpp
@@ -17,7 +17,7 @@
  */
 
 #include <kmimetype.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <ktempdir.h>
 #include <kprotocolinfo.h>
 #include <tqdir.h>
diff --git a/tdeio/tests/ktartest.cpp b/tdeio/tests/ktartest.cpp
index 2c470f6e4..84ada6c06 100644
--- a/tdeio/tests/ktartest.cpp
+++ b/tdeio/tests/ktartest.cpp
@@ -18,7 +18,7 @@
 
 #include "ktar.h"
 #include <stdio.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tqfile.h>
 
 #include <assert.h>
diff --git a/tdeio/tests/kziptest.cpp b/tdeio/tests/kziptest.cpp
index 84d38d134..1e34c98b8 100644
--- a/tdeio/tests/kziptest.cpp
+++ b/tdeio/tests/kziptest.cpp
@@ -18,7 +18,7 @@
 
 #include "kzip.h"
 #include <stdio.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kdebug.h>
 #include <tqfile.h>
 
diff --git a/tdeioslave/file/file.cpp b/tdeioslave/file/file.cpp
index ba13cc10f..ba42792ee 100644
--- a/tdeioslave/file/file.cpp
+++ b/tdeioslave/file/file.cpp
@@ -73,7 +73,7 @@
 #include <kshred.h>
 #include <kdebug.h>
 #include <kurl.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdesimpleconfig.h>
 #include <tdetempfile.h>
 #include <tdelocale.h>
diff --git a/tdeioslave/ftp/ftp.cpp b/tdeioslave/ftp/ftp.cpp
index 8a87305f6..780e999cb 100644
--- a/tdeioslave/ftp/ftp.cpp
+++ b/tdeioslave/ftp/ftp.cpp
@@ -53,7 +53,7 @@
 
 #include <kdebug.h>
 #include <tdelocale.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kmimemagic.h>
 #include <kmimetype.h>
 #include <ksockaddr.h>
diff --git a/tdeioslave/http/http.cpp b/tdeioslave/http/http.cpp
index 5cc638bd0..7520349d9 100644
--- a/tdeioslave/http/http.cpp
+++ b/tdeioslave/http/http.cpp
@@ -57,7 +57,7 @@
 #include <kservice.h>
 #include <krfcdate.h>
 #include <kmdcodec.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kresolver.h>
 #include <kmimemagic.h>
 #include <dcopclient.h>
diff --git a/tdeioslave/http/http_cache_cleaner.cpp b/tdeioslave/http/http_cache_cleaner.cpp
index 08ca740b2..0375042e8 100644
--- a/tdeioslave/http/http_cache_cleaner.cpp
+++ b/tdeioslave/http/http_cache_cleaner.cpp
@@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <tqstring.h>
 #include <tqptrlist.h>
 
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdelocale.h>
 #include <tdecmdlineargs.h>
 #include <tdeglobal.h>
diff --git a/tdeioslave/iso/iso.cpp b/tdeioslave/iso/iso.cpp
index 4688a3e7a..b088dbb6a 100644
--- a/tdeioslave/iso/iso.cpp
+++ b/tdeioslave/iso/iso.cpp
@@ -30,7 +30,7 @@
 #include <tqfile.h>
 #include <kurl.h>
 #include <kdebug.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kiso.h>
 #include <kmimemagic.h>
 
diff --git a/tdeparts/dockmainwindow.cpp b/tdeparts/dockmainwindow.cpp
index 7a1bd5703..405f26416 100644
--- a/tdeparts/dockmainwindow.cpp
+++ b/tdeparts/dockmainwindow.cpp
@@ -25,7 +25,7 @@
 #include <tdeaccel.h>
 #include <tdeparts/plugin.h>
 #include <kstatusbar.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <khelpmenu.h>
 #include <tdestandarddirs.h>
 #include <tqapplication.h>
diff --git a/tdeparts/factory.cpp b/tdeparts/factory.cpp
index 0b7d1c84c..69636ad6a 100644
--- a/tdeparts/factory.cpp
+++ b/tdeparts/factory.cpp
@@ -25,7 +25,7 @@
 
 #include <tdelocale.h>
 #include <tdeglobal.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <assert.h>
 
 using namespace KParts;
diff --git a/tdeparts/mainwindow.cpp b/tdeparts/mainwindow.cpp
index 2e6d2b7c3..a0a011a96 100644
--- a/tdeparts/mainwindow.cpp
+++ b/tdeparts/mainwindow.cpp
@@ -22,7 +22,7 @@
 #include <tdeparts/event.h>
 #include <tdeparts/part.h>
 #include <tdeparts/plugin.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <kstatusbar.h>
 #include <khelpmenu.h>
 #include <tdestandarddirs.h>
diff --git a/tdeparts/part.cpp b/tdeparts/part.cpp
index 9a558ee01..2ca0c058f 100644
--- a/tdeparts/part.cpp
+++ b/tdeparts/part.cpp
@@ -32,7 +32,7 @@
 #include <tqtextstream.h>
 #include <tqfileinfo.h>
 
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdelocale.h>
 #include <tdetempfile.h>
 #include <tdemessagebox.h>
diff --git a/tdeparts/plugin.cpp b/tdeparts/plugin.cpp
index ba3d6a663..9d1c78940 100644
--- a/tdeparts/plugin.cpp
+++ b/tdeparts/plugin.cpp
@@ -30,7 +30,7 @@
 #include <tqfileinfo.h>
 
 #include <klibloader.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdestandarddirs.h>
 #include <kdebug.h>
 #include <kxmlguifactory.h>
diff --git a/tdersync/rsyncconfigdialog.cpp b/tdersync/rsyncconfigdialog.cpp
index a97c7b2f1..a6a0fe5f6 100644
--- a/tdersync/rsyncconfigdialog.cpp
+++ b/tdersync/rsyncconfigdialog.cpp
@@ -72,7 +72,7 @@
 
 #include <kdebug.h>
 #include <tdelocale.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 
 #include <twin.h>
 #include <tdeaction.h>
diff --git a/tdersync/tdersync.h b/tdersync/tdersync.h
index a3a6ced31..0d642fcde 100644
--- a/tdersync/tdersync.h
+++ b/tdersync/tdersync.h
@@ -50,7 +50,7 @@
 
 #include <kdebug.h>
 #include <tdelocale.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 
 #include <twin.h>
 #include <kurl.h>
diff --git a/tdeui/kedittoolbar.cpp b/tdeui/kedittoolbar.cpp
index 04bc15016..be0d47a51 100644
--- a/tdeui/kedittoolbar.cpp
+++ b/tdeui/kedittoolbar.cpp
@@ -35,7 +35,7 @@
 #include <tdelocale.h>
 #include <kicontheme.h>
 #include <kiconloader.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdemessagebox.h>
 #include <kxmlguifactory.h>
 #include <kseparator.h>
diff --git a/tdeui/kxmlguiclient.cpp b/tdeui/kxmlguiclient.cpp
index 7b2657376..b8fd549f5 100644
--- a/tdeui/kxmlguiclient.cpp
+++ b/tdeui/kxmlguiclient.cpp
@@ -28,7 +28,7 @@
 #include <tqregexp.h>
 #include <tqguardedptr.h>
 
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdestandarddirs.h>
 #include <kdebug.h>
 #include <tdeaction.h>
diff --git a/tdeui/kxmlguifactory.cpp b/tdeui/kxmlguifactory.cpp
index 07e5af78c..bee9683c4 100644
--- a/tdeui/kxmlguifactory.cpp
+++ b/tdeui/kxmlguifactory.cpp
@@ -34,7 +34,7 @@
 
 #include <tdeaction.h>
 #include <kdebug.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdeglobal.h>
 #include <tdeshortcut.h>
 #include <tdestandarddirs.h>
diff --git a/tdeui/tdecmodule.cpp b/tdeui/tdecmodule.cpp
index 06ca1acda..7b6670b9e 100644
--- a/tdeui/tdecmodule.cpp
+++ b/tdeui/tdecmodule.cpp
@@ -28,7 +28,7 @@
 #include <tdeconfigdialogmanager.h>
 #include <kdebug.h>
 #include <tdeglobal.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdelocale.h>
 
 #include "tdecmodule.h"
diff --git a/tdeunittest/modrunner.cpp b/tdeunittest/modrunner.cpp
index 350778f6c..3ba83628f 100644
--- a/tdeunittest/modrunner.cpp
+++ b/tdeunittest/modrunner.cpp
@@ -25,7 +25,7 @@
 
 #include <kdebug.h>
 #include <tdeglobal.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdeaboutdata.h>
 #include <tdecmdlineargs.h>
 #include <tdelocale.h>
diff --git a/tdeutils/kpluginselector.cpp b/tdeutils/kpluginselector.cpp
index e9b2b6446..84d1629ea 100644
--- a/tdeutils/kpluginselector.cpp
+++ b/tdeutils/kpluginselector.cpp
@@ -55,7 +55,7 @@
 #include <tqsplitter.h>
 #include <tqframe.h>
 #include "kplugininfo.h"
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tqptrdict.h>
 #include <tqstringlist.h>
 #include "tdecmoduleproxy.h"
diff --git a/tdewidgets/kde.widgets b/tdewidgets/kde.widgets
index 28e31c78a..499a14ca8 100644
--- a/tdewidgets/kde.widgets
+++ b/tdewidgets/kde.widgets
@@ -1,6 +1,6 @@
 [Global]
 PluginName=KDEWidgets
-Includes=kinstance.h,classpreviews.h
+Includes=tdeinstance.h,classpreviews.h
 Init=new TDEInstance("tdewidgets");
 
 [KActiveLabel]
diff --git a/tdewidgets/maketdewidgets.cpp b/tdewidgets/maketdewidgets.cpp
index ca3daf732..fbed4b7f4 100644
--- a/tdewidgets/maketdewidgets.cpp
+++ b/tdewidgets/maketdewidgets.cpp
@@ -1,6 +1,6 @@
 /* Copyright (C) 2004-2005 ian reinhart geiser <geiseri@sourcextreme.com> */
 #include <tdeaboutdata.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
 #include <tdecmdlineargs.h>
 #include <tdeconfig.h>
 #include <kmacroexpander.h>
diff --git a/tdewidgets/tests/test.widgets b/tdewidgets/tests/test.widgets
index e8acdb945..b78ae6ba3 100644
--- a/tdewidgets/tests/test.widgets
+++ b/tdewidgets/tests/test.widgets
@@ -1,6 +1,6 @@
 [Global]
 PluginName=KDEWidgets
-Includes=kinstance.h,classpreviews.h
+Includes=tdeinstance.h,classpreviews.h
 Init=new TDEInstance("tdewidgets");
 
 [KActiveLabel]
diff --git a/win/pro_files/tdecore/tdecore.pro b/win/pro_files/tdecore/tdecore.pro
index 5806fd3e2..0c13e5884 100644
--- a/win/pro_files/tdecore/tdecore.pro
+++ b/win/pro_files/tdecore/tdecore.pro
@@ -68,7 +68,7 @@ tdeaccelmanager.cpp \
 tdeshortcut.cpp \
 tdeshortcutmenu.cpp \
 tdeshortcutlist.cpp \
-kinstance.cpp \
+tdeinstance.cpp \
 tdeversion.cpp \
 tdelocale.cpp \
 kicontheme.cpp \
-- 
cgit v1.2.3

