diff --git a/TODO b/TODO index 6f6d21d90..5c7253c63 100644 --- a/TODO +++ b/TODO @@ -63,7 +63,7 @@ that we would like to make for the next binary incompatible release. - Use of the C++ keyword "explicit". Make all ctors explicit which can be used with one parameter to minimize wrong use of the class (i.e. have a look at - Dirk's work on KURL). Another candidate: KService( KDesktopFile *config ). + Dirk's work on KURL). Another candidate: KService( TDEDesktopFile *config ). KGuiItem has one of these dangerous ctors, too. KUser has a whole bunch of them. diff --git a/interfaces/tdescript/scriptloader.cpp b/interfaces/tdescript/scriptloader.cpp index 4abd9421d..916ad2c74 100644 --- a/interfaces/tdescript/scriptloader.cpp +++ b/interfaces/tdescript/scriptloader.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -67,9 +67,9 @@ TDESelectAction * ScriptLoader::getScripts() while( (fi=it.current())) { // Query each desktop file - if(KDesktopFile::isDesktopFile(fi->absFilePath())) + if(TDEDesktopFile::isDesktopFile(fi->absFilePath())) { - KDesktopFile desktop((fi->absFilePath()), true); + TDEDesktopFile desktop((fi->absFilePath()), true); kdDebug () << "Trying to load script type: " << desktop.readType() << endl; KScriptInterface *tmpIface = KParts::ComponentFactory::createInstanceFromQuery(desktop.readType() ); if( tmpIface != 0 ) diff --git a/interfaces/tdescript/scriptmanager.cpp b/interfaces/tdescript/scriptmanager.cpp index 01dab8f47..1f546485a 100644 --- a/interfaces/tdescript/scriptmanager.cpp +++ b/interfaces/tdescript/scriptmanager.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include @@ -46,9 +46,9 @@ bool KScriptManager::addScript( const TQString &scriptDesktopFile) TQString tmpScriptMethod = ""; // Read the desktop file - if(KDesktopFile::isDesktopFile(scriptDesktopFile)) + if(TDEDesktopFile::isDesktopFile(scriptDesktopFile)) { - KDesktopFile desktop(scriptDesktopFile, true); + TDEDesktopFile desktop(scriptDesktopFile, true); m_scripts.insert(desktop.readName(), new ScriptInfo()); m_scripts[desktop.readName()]->scriptType = desktop.readType(); TQString localpath = TQString(tdeApp->name()) + "/scripts/" + desktop.readEntry("X-TDE-ScriptName", ""); diff --git a/kded/kbuildservicefactory.cpp b/kded/kbuildservicefactory.cpp index a06170033..54c09ac9c 100644 --- a/kded/kbuildservicefactory.cpp +++ b/kded/kbuildservicefactory.cpp @@ -80,7 +80,7 @@ KBuildServiceFactory::createEntry( const TQString& file, const char *resource ) if (!name.endsWith(".desktop") && !name.endsWith(".kdelnk")) return 0; - KDesktopFile desktopFile(file, true, resource); + TDEDesktopFile desktopFile(file, true, resource); KService * serv = new KService( &desktopFile ); diff --git a/kded/kbuildservicetypefactory.cpp b/kded/kbuildservicetypefactory.cpp index 64f07a550..7599c43a0 100644 --- a/kded/kbuildservicetypefactory.cpp +++ b/kded/kbuildservicetypefactory.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include template class TQDict; @@ -78,7 +78,7 @@ KBuildServiceTypeFactory::createEntry(const TQString &file, const char *resource if (name.isEmpty()) return 0; - KDesktopFile desktopFile(file, true, resource); + TDEDesktopFile desktopFile(file, true, resource); if ( desktopFile.readBoolEntry( "Hidden", false ) == true ) return 0; diff --git a/tdecore/CMakeLists.txt b/tdecore/CMakeLists.txt index 2fbb0378d..6d87d23f0 100644 --- a/tdecore/CMakeLists.txt +++ b/tdecore/CMakeLists.txt @@ -50,7 +50,7 @@ link_directories( install( FILES tdeconfig.h tdeconfigskeleton.h tdeconfigdata.h tdesimpleconfig.h - tdeconfigdialogmanager.h tdeconfigbase.h kdesktopfile.h + tdeconfigdialogmanager.h tdeconfigbase.h tdedesktopfile.h kdesktopfile.h kurl.h ksock.h tdeaboutdata.h tdecmdlineargs.h tdeconfigbackend.h tdeapplication.h tdeuniqueapplication.h kcharsets.h tdeversion.h kpty.h tdeprocess.h tdeprocctrl.h @@ -107,7 +107,7 @@ set( target tdecore ) set( ${target}_SRCS libintl.cpp tdeapplication.cpp kdebug.cpp netwm.cpp tdeconfigbase.cpp tdeconfig.cpp tdesimpleconfig.cpp tdeconfigbackend.cpp - kmanagerselection.cpp kdesktopfile.cpp tdestandarddirs.cpp + kmanagerselection.cpp tdedesktopfile.cpp tdestandarddirs.cpp ksock.cpp kpty.cpp tdeprocess.cpp tdeprocctrl.cpp tdelocale.cpp krfcdate.cpp kiconeffect.cpp kicontheme.cpp kiconloader.cpp twin.cpp twinmodule.cpp krootprop.cpp kcharsets.cpp diff --git a/tdecore/MAINTAINERS b/tdecore/MAINTAINERS index 7e8da86be..4f306527a 100644 --- a/tdecore/MAINTAINERS +++ b/tdecore/MAINTAINERS @@ -26,7 +26,7 @@ tdeconfigbase.cpp Waldo Bastian tdecrash.cpp Waldo Bastian kdcoppropertyproxy.cpp kdebug.cpp Stephan Kulow -kdesktopfile.cpp +tdedesktopfile.cpp tdeglobal.cpp Stephan Kulow tdeglobalaccel.cpp Ellis Whitehead tdeglobalaccel_x11.cpp Ellis Whitehead diff --git a/tdecore/Makefile.am b/tdecore/Makefile.am index 5b1098688..48fbbe2b8 100644 --- a/tdecore/Makefile.am +++ b/tdecore/Makefile.am @@ -38,7 +38,7 @@ lib_LIBRARIES = libtdefakes_nonpic.a libtdefakes_pic.a include_HEADERS = tdeconfig.h tdeconfigskeleton.h \ tdeconfigdata.h tdesimpleconfig.h tdeconfigdialogmanager.h \ - tdeconfigbase.h kdesktopfile.h kurl.h ksock.h tdeaboutdata.h \ + tdeconfigbase.h tdedesktopfile.h kdesktopfile.h kurl.h ksock.h tdeaboutdata.h \ tdecmdlineargs.h tdeconfigbackend.h tdeapplication.h \ tdeuniqueapplication.h kcharsets.h tdeversion.h kpty.h tdeprocess.h \ tdeprocctrl.h tdelocale.h kicontheme.h kiconloader.h kdebug.h \ @@ -91,7 +91,7 @@ noinst_HEADERS = tdeaccelaction.h tdeaccelbase.h tdeaccelprivate.h kckey.h \ libtdecore_la_SOURCES = libintl.cpp tdeapplication.cpp \ kdebug.cpp netwm.cpp tdeconfigbase.cpp tdeconfig.cpp tdesimpleconfig.cpp \ - tdeconfigbackend.cpp kmanagerselection.cpp kdesktopfile.cpp \ + tdeconfigbackend.cpp kmanagerselection.cpp tdedesktopfile.cpp \ tdestandarddirs.cpp ksock.cpp kpty.cpp tdeprocess.cpp tdeprocctrl.cpp \ tdelocale.cpp krfcdate.cpp kiconeffect.cpp kicontheme.cpp \ kiconloader.cpp twin.cpp twinmodule.cpp krootprop.cpp kcharsets.cpp \ diff --git a/tdecore/kdesktopfile.h b/tdecore/kdesktopfile.h index b4f59085a..371335240 100644 --- a/tdecore/kdesktopfile.h +++ b/tdecore/kdesktopfile.h @@ -1,251 +1,3 @@ -/* This file is part of the KDE libraries - Copyright (c) 1999 Pietro Iglio - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - 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 _KDESKTOPFILE_H -#define _KDESKTOPFILE_H - -#include "tdeconfig.h" -#include "tdelibs_export.h" - -class KDesktopFilePrivate; - -/** - * KDE Desktop File Management. - * - * @author Pietro Iglio - * @see TDEConfigBase TDEConfig - * @short KDE Desktop File Management class - */ -class TDECORE_EXPORT KDesktopFile : public TDEConfig -{ - TQ_OBJECT - -public: - /** - * Constructs a KDesktopFile object and make it either read-write - * or read-only. - * - * @param fileName The name or path of the desktop file. If it - * is not absolute, it will be located - * using the resource type @p resType. - * @param readOnly Whether the object should be read-only. - * @param resType Allows you to change what sort of resource - * to search for if @p fileName is not absolute. For - * instance, you might want to specify "config". - */ - KDesktopFile( const TQString &fileName, bool readOnly = false, - const char * resType = "apps"); - - /** - * Destructs the KDesktopFile object. - * - * Writes back any dirty configuration entries. - */ - virtual ~KDesktopFile(); - - /** - * Checks whether this is really a desktop file. - * - * The check is performed looking at the file extension (the file is not - * opened). - * Currently, valid extensions are ".kdelnk" and ".desktop". - * @param path the path of the file to check - * @return true if the file appears to be a desktop file. - */ - static bool isDesktopFile(const TQString& path); - - /** - * Checks whether the user is authorized to run this desktop file. - * By default users are authorized to run all desktop files but - * the KIOSK framework can be used to activate certain restrictions. - * See README.kiosk for more information. - * @param path the file to check - * @return true if the user is authorized to run the file - * @since 3.1 - */ - static bool isAuthorizedDesktopFile(const TQString& path); - - /** - * Returns the location where changes for the .desktop file @p path - * should be written to. - * @since 3.2 - */ - static TQString locateLocal(const TQString &path); - - /** - * Returns the value of the "Type=" entry. - * @return the type or TQString::null if not specified - */ - TQString readType() const; - - /** - * Returns the value of the "Icon=" entry. - * @return the icon or TQString::null if not specified - */ - TQString readIcon() const; - - /** - * Returns the value of the "Name=" entry. - * @return the name or TQString::null if not specified - */ - TQString readName() const; - - /** - * Returns the value of the "Comment=" entry. - * @return the comment or TQString::null if not specified - */ - TQString readComment() const; - - /** - * Returns the value of the "GenericName=" entry. - * @return the generic name or TQString::null if not specified - */ - TQString readGenericName() const; - - /** - * Returns the value of the "Path=" entry. - * @return the path or TQString::null if not specified - */ - TQString readPath() const; - - /** - * Returns the value of the "Dev=" entry. - * @return the device or TQString::null if not specified - */ - TQString readDevice() const; - - /** - * Returns the value of the "URL=" entry. - * @return the URL or TQString::null if not specified - */ - TQString readURL() const; - - /** - * Returns a list of the "Actions=" entries. - * @return the list of actions - */ - TQStringList readActions() const; - - /** - * Sets the desktop action group. - * @param group the new action group - */ - void setActionGroup(const TQString &group); - - /** - * Returns true if the action group exists, false otherwise - * @param group the action group to test - * @return true if the action group exists - */ - bool hasActionGroup(const TQString &group) const; - - /** - * Checks whether there is a "Type=Link" entry. - * - * The link points to the "URL=" entry. - * @return true if there is a "Type=Link" entry - */ - bool hasLinkType() const; - - /** - * Checks whether there is an entry "Type=Application". - * @return true if there is a "Type=Application" entry - */ - bool hasApplicationType() const; - - /** - * Checks whether there is an entry "Type=MimeType". - * @return true if there is a "Type=MimeType" entry - */ - bool hasMimeTypeType() const; // funny name :) - - /** - * Checks whether there is an entry "Type=FSDev". - * @return true if there is a "Type=FSDev" entry - */ - bool hasDeviceType() const; - - /** - * Checks whether the TryExec field contains a binary - * which is found on the local system. - * @return true if TryExec contains an existing binary - */ - bool tryExec() const; - - /** - * Returns the file name. - * @return The filename as passed to the constructor. - */ - TQString fileName() const; - - /** - * Returns the resource. - * @return The resource type as passed to the constructor. - */ - TQString resource() const; - - /** - * Returns the value of the "X-DocPath=" entry. - * @return The value of the "X-DocPath=" entry. - * @since 3.1 - */ - TQString readDocPath() const; - - /** - * Returns the entry of the "SortOrder=" entry. - * @return the value of the "SortOrder=" entry. - */ - TQStringList sortOrder() const; - - /** - * Copies all entries from this config object to a new - * KDesktopFile object that will save itself to @p file. - * - * Actual saving to @p file happens when the returned object is - * destructed or when sync() is called upon it. - * - * @param file the new KDesktopFile object it will save itself to. - * @since 3.2 - */ - KDesktopFile* copyTo(const TQString &file) const; - -#ifdef KDE_NO_COMPAT -private: -#endif - /** - * @deprecated Use fileName() instead. - */ - TDE_DEPRECATED TQString filename() const { return fileName(); }; - -private: - - TQString translatedEntry(const char*) const; - - // copy-construction and assignment are not allowed - KDesktopFile( const KDesktopFile& ); - KDesktopFile& operator= ( const KDesktopFile& ); - -protected: - virtual void virtual_hook( int id, void* data ); -private: - KDesktopFilePrivate *d; -}; - - -#endif +#include "tdedesktopfile.h" +#define KDesktopFile TDEDesktopFile diff --git a/tdecore/kdesktopfile.cpp b/tdecore/tdedesktopfile.cpp similarity index 84% rename from tdecore/kdesktopfile.cpp rename to tdecore/tdedesktopfile.cpp index 27b25858b..7bb9bcbe2 100644 --- a/tdecore/kdesktopfile.cpp +++ b/tdecore/tdedesktopfile.cpp @@ -37,10 +37,10 @@ #include "kcatalogue.h" #include "tdelocale.h" -#include "kdesktopfile.h" -#include "kdesktopfile.moc" +#include "tdedesktopfile.h" +#include "tdedesktopfile.moc" -KDesktopFile::KDesktopFile(const TQString &fileName, bool bReadOnly, +TDEDesktopFile::TDEDesktopFile(const TQString &fileName, bool bReadOnly, const char * resType) : TDEConfig(TQString::fromLatin1(""), bReadOnly, false) { @@ -53,12 +53,12 @@ KDesktopFile::KDesktopFile(const TQString &fileName, bool bReadOnly, setDesktopGroup(); } -KDesktopFile::~KDesktopFile() +TDEDesktopFile::~TDEDesktopFile() { // no need to do anything } -TQString KDesktopFile::locateLocal(const TQString &path) +TQString TDEDesktopFile::locateLocal(const TQString &path) { TQString local; if (path.endsWith(".directory")) @@ -110,7 +110,7 @@ TQString KDesktopFile::locateLocal(const TQString &path) return local; } -bool KDesktopFile::isDesktopFile(const TQString& path) +bool TDEDesktopFile::isDesktopFile(const TQString& path) { int len = path.length(); @@ -122,7 +122,7 @@ bool KDesktopFile::isDesktopFile(const TQString& path) return false; } -bool KDesktopFile::isAuthorizedDesktopFile(const TQString& path) +bool TDEDesktopFile::isAuthorizedDesktopFile(const TQString& path) { if (!tdeApp || tdeApp->authorize("run_desktop_files")) return true; @@ -147,7 +147,7 @@ bool KDesktopFile::isAuthorizedDesktopFile(const TQString& path) return false; } -TQString KDesktopFile::translatedEntry(const char* key) const +TQString TDEDesktopFile::translatedEntry(const char* key) const { if (hasTranslatedKey(key)) return readEntry(key); @@ -168,42 +168,42 @@ TQString KDesktopFile::translatedEntry(const char* key) const return TQString::null; } -TQString KDesktopFile::readType() const +TQString TDEDesktopFile::readType() const { return readEntry("Type"); } -TQString KDesktopFile::readIcon() const +TQString TDEDesktopFile::readIcon() const { return readEntry("Icon"); } -TQString KDesktopFile::readName() const +TQString TDEDesktopFile::readName() const { return translatedEntry("Name"); } -TQString KDesktopFile::readComment() const +TQString TDEDesktopFile::readComment() const { return translatedEntry("Comment"); } -TQString KDesktopFile::readGenericName() const +TQString TDEDesktopFile::readGenericName() const { return translatedEntry("GenericName"); } -TQString KDesktopFile::readPath() const +TQString TDEDesktopFile::readPath() const { return readPathEntry("Path"); } -TQString KDesktopFile::readDevice() const +TQString TDEDesktopFile::readDevice() const { return readEntry("Dev"); } -TQString KDesktopFile::readURL() const +TQString TDEDesktopFile::readURL() const { if (hasDeviceType()) { TQString device = readDevice(); @@ -234,43 +234,43 @@ TQString KDesktopFile::readURL() const } } -TQStringList KDesktopFile::readActions() const +TQStringList TDEDesktopFile::readActions() const { return readListEntry("Actions", ';'); } -void KDesktopFile::setActionGroup(const TQString &group) +void TDEDesktopFile::setActionGroup(const TQString &group) { setGroup(TQString::fromLatin1("Desktop Action ") + group); } -bool KDesktopFile::hasActionGroup(const TQString &group) const +bool TDEDesktopFile::hasActionGroup(const TQString &group) const { return hasGroup(TQString::fromLatin1("Desktop Action ") + group); } -bool KDesktopFile::hasLinkType() const +bool TDEDesktopFile::hasLinkType() const { return readEntry("Type") == TQString::fromLatin1("Link"); } -bool KDesktopFile::hasApplicationType() const +bool TDEDesktopFile::hasApplicationType() const { return readEntry("Type") == TQString::fromLatin1("Application"); } -bool KDesktopFile::hasMimeTypeType() const +bool TDEDesktopFile::hasMimeTypeType() const { return readEntry("Type") == TQString::fromLatin1("MimeType"); } -bool KDesktopFile::hasDeviceType() const +bool TDEDesktopFile::hasDeviceType() const { return readEntry("Type") == TQString::fromLatin1("FSDev") || readEntry("Type") == TQString::fromLatin1("FSDevice"); } -bool KDesktopFile::tryExec() const +bool TDEDesktopFile::tryExec() const { // Test for TryExec and "X-TDE-AuthorizeAction" TQString te = readPathEntry("TryExec"); @@ -345,31 +345,31 @@ bool KDesktopFile::tryExec() const * @return the filename as passed to the constructor. */ TQString -KDesktopFile::fileName() const { return backEnd->fileName(); } +TDEDesktopFile::fileName() const { return backEnd->fileName(); } /** * @return the resource type as passed to the constructor. */ TQString -KDesktopFile::resource() const { return backEnd->resource(); } +TDEDesktopFile::resource() const { return backEnd->resource(); } TQStringList -KDesktopFile::sortOrder() const +TDEDesktopFile::sortOrder() const { return readListEntry("SortOrder"); } -void KDesktopFile::virtual_hook( int id, void* data ) +void TDEDesktopFile::virtual_hook( int id, void* data ) { TDEConfig::virtual_hook( id, data ); } -TQString KDesktopFile::readDocPath() const +TQString TDEDesktopFile::readDocPath() const { return readPathEntry( "X-DocPath" ); } -KDesktopFile* KDesktopFile::copyTo(const TQString &file) const +TDEDesktopFile* TDEDesktopFile::copyTo(const TQString &file) const { - KDesktopFile *config = new KDesktopFile(TQString::null, false); + TDEDesktopFile *config = new TDEDesktopFile(TQString::null, false); TDEConfig::copyTo(file, config); config->setDesktopGroup(); return config; diff --git a/tdecore/tdedesktopfile.h b/tdecore/tdedesktopfile.h new file mode 100644 index 000000000..fbda9f9fd --- /dev/null +++ b/tdecore/tdedesktopfile.h @@ -0,0 +1,251 @@ +/* This file is part of the TDE libraries + Copyright (c) 1999 Pietro Iglio + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 _TDEDESKTOPFILE_H +#define _TDEDESKTOPFILE_H + +#include "tdeconfig.h" +#include "tdelibs_export.h" + +class TDEDesktopFilePrivate; + +/** + * KDE Desktop File Management. + * + * @author Pietro Iglio + * @see TDEConfigBase TDEConfig + * @short KDE Desktop File Management class + */ +class TDECORE_EXPORT TDEDesktopFile : public TDEConfig +{ + TQ_OBJECT + +public: + /** + * Constructs a TDEDesktopFile object and make it either read-write + * or read-only. + * + * @param fileName The name or path of the desktop file. If it + * is not absolute, it will be located + * using the resource type @p resType. + * @param readOnly Whether the object should be read-only. + * @param resType Allows you to change what sort of resource + * to search for if @p fileName is not absolute. For + * instance, you might want to specify "config". + */ + TDEDesktopFile( const TQString &fileName, bool readOnly = false, + const char * resType = "apps"); + + /** + * Destructs the TDEDesktopFile object. + * + * Writes back any dirty configuration entries. + */ + virtual ~TDEDesktopFile(); + + /** + * Checks whether this is really a desktop file. + * + * The check is performed looking at the file extension (the file is not + * opened). + * Currently, valid extensions are ".kdelnk" and ".desktop". + * @param path the path of the file to check + * @return true if the file appears to be a desktop file. + */ + static bool isDesktopFile(const TQString& path); + + /** + * Checks whether the user is authorized to run this desktop file. + * By default users are authorized to run all desktop files but + * the KIOSK framework can be used to activate certain restrictions. + * See README.kiosk for more information. + * @param path the file to check + * @return true if the user is authorized to run the file + * @since 3.1 + */ + static bool isAuthorizedDesktopFile(const TQString& path); + + /** + * Returns the location where changes for the .desktop file @p path + * should be written to. + * @since 3.2 + */ + static TQString locateLocal(const TQString &path); + + /** + * Returns the value of the "Type=" entry. + * @return the type or TQString::null if not specified + */ + TQString readType() const; + + /** + * Returns the value of the "Icon=" entry. + * @return the icon or TQString::null if not specified + */ + TQString readIcon() const; + + /** + * Returns the value of the "Name=" entry. + * @return the name or TQString::null if not specified + */ + TQString readName() const; + + /** + * Returns the value of the "Comment=" entry. + * @return the comment or TQString::null if not specified + */ + TQString readComment() const; + + /** + * Returns the value of the "GenericName=" entry. + * @return the generic name or TQString::null if not specified + */ + TQString readGenericName() const; + + /** + * Returns the value of the "Path=" entry. + * @return the path or TQString::null if not specified + */ + TQString readPath() const; + + /** + * Returns the value of the "Dev=" entry. + * @return the device or TQString::null if not specified + */ + TQString readDevice() const; + + /** + * Returns the value of the "URL=" entry. + * @return the URL or TQString::null if not specified + */ + TQString readURL() const; + + /** + * Returns a list of the "Actions=" entries. + * @return the list of actions + */ + TQStringList readActions() const; + + /** + * Sets the desktop action group. + * @param group the new action group + */ + void setActionGroup(const TQString &group); + + /** + * Returns true if the action group exists, false otherwise + * @param group the action group to test + * @return true if the action group exists + */ + bool hasActionGroup(const TQString &group) const; + + /** + * Checks whether there is a "Type=Link" entry. + * + * The link points to the "URL=" entry. + * @return true if there is a "Type=Link" entry + */ + bool hasLinkType() const; + + /** + * Checks whether there is an entry "Type=Application". + * @return true if there is a "Type=Application" entry + */ + bool hasApplicationType() const; + + /** + * Checks whether there is an entry "Type=MimeType". + * @return true if there is a "Type=MimeType" entry + */ + bool hasMimeTypeType() const; // funny name :) + + /** + * Checks whether there is an entry "Type=FSDev". + * @return true if there is a "Type=FSDev" entry + */ + bool hasDeviceType() const; + + /** + * Checks whether the TryExec field contains a binary + * which is found on the local system. + * @return true if TryExec contains an existing binary + */ + bool tryExec() const; + + /** + * Returns the file name. + * @return The filename as passed to the constructor. + */ + TQString fileName() const; + + /** + * Returns the resource. + * @return The resource type as passed to the constructor. + */ + TQString resource() const; + + /** + * Returns the value of the "X-DocPath=" entry. + * @return The value of the "X-DocPath=" entry. + * @since 3.1 + */ + TQString readDocPath() const; + + /** + * Returns the entry of the "SortOrder=" entry. + * @return the value of the "SortOrder=" entry. + */ + TQStringList sortOrder() const; + + /** + * Copies all entries from this config object to a new + * TDEDesktopFile object that will save itself to @p file. + * + * Actual saving to @p file happens when the returned object is + * destructed or when sync() is called upon it. + * + * @param file the new TDEDesktopFile object it will save itself to. + * @since 3.2 + */ + TDEDesktopFile* copyTo(const TQString &file) const; + +#ifdef KDE_NO_COMPAT +private: +#endif + /** + * @deprecated Use fileName() instead. + */ + TDE_DEPRECATED TQString filename() const { return fileName(); }; + +private: + + TQString translatedEntry(const char*) const; + + // copy-construction and assignment are not allowed + TDEDesktopFile( const TDEDesktopFile& ); + TDEDesktopFile& operator= ( const TDEDesktopFile& ); + +protected: + virtual void virtual_hook( int id, void* data ); +private: + TDEDesktopFilePrivate *d; +}; + + +#endif + diff --git a/tdehtml/tdehtml_ext.cpp b/tdehtml/tdehtml_ext.cpp index 81d6d748a..9b5d2efe5 100644 --- a/tdehtml/tdehtml_ext.cpp +++ b/tdehtml/tdehtml_ext.cpp @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include @@ -272,7 +272,7 @@ void TDEHTMLPartBrowserExtension::searchProvider() if( !KURIFilter::self()->filterURI(data, list) ) { - KDesktopFile file("searchproviders/google.desktop", true, "services"); + TDEDesktopFile file("searchproviders/google.desktop", true, "services"); TQString encodedSearchTerm = m_part->selectedText(); TQUrl::encode(encodedSearchTerm); data.setData(file.readEntry("Query").replace("\\{@}", encodedSearchTerm)); diff --git a/tdeinit/autostart.cpp b/tdeinit/autostart.cpp index 1435aacb5..c5ebb794a 100644 --- a/tdeinit/autostart.cpp +++ b/tdeinit/autostart.cpp @@ -23,7 +23,7 @@ #include "autostart.h" #include -#include +#include #include #include @@ -125,7 +125,7 @@ AutoStart::loadAutoStartList() { continue; } - KDesktopFile config(*it, true); + TDEDesktopFile config(*it, true); if (config.hasKey("X-TDE-autostart-condition")) { if (!startCondition(config.readEntry("X-TDE-autostart-condition"))) continue; @@ -167,7 +167,7 @@ AutoStart::loadAutoStartList() if (localOuter == localInner) { // Overridden! // But is Hidden == True? - KDesktopFile innerConfig(*localit, true); + TDEDesktopFile innerConfig(*localit, true); if (innerConfig.readBoolEntry("Hidden", false)) { // Override confirmed; exit speedily without autostarting autostartOverriddenAndDisabled = true; diff --git a/tdeio/tdefile/kopenwith.cpp b/tdeio/tdefile/kopenwith.cpp index 7524c063b..3e51f0b20 100644 --- a/tdeio/tdefile/kopenwith.cpp +++ b/tdeio/tdefile/kopenwith.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -739,15 +739,15 @@ void KOpenWithDlg::slotOK() maxPreference = offerList.first().preference(); } - KDesktopFile *desktop = 0; + TDEDesktopFile *desktop = 0; if (!oldPath.isEmpty() && (oldPath != newPath)) { - KDesktopFile orig(oldPath, true); + TDEDesktopFile orig(oldPath, true); desktop = orig.copyTo(newPath); } else { - desktop = new KDesktopFile(newPath); + desktop = new TDEDesktopFile(newPath); } desktop->writeEntry("Type", TQString::fromLatin1("Application")); desktop->writeEntry("Name", initialServiceName); @@ -776,7 +776,7 @@ void KOpenWithDlg::slotOK() if ( !qServiceType.isEmpty() ) { // Also make sure the "auto embed" setting for this mimetype is off - KDesktopFile mimeDesktop( locateLocal( "mime", qServiceType + ".desktop" ) ); + TDEDesktopFile mimeDesktop( locateLocal( "mime", qServiceType + ".desktop" ) ); mimeDesktop.writeEntry( "X-TDE-AutoEmbed", false ); mimeDesktop.sync(); } diff --git a/tdeio/tdefile/kpropertiesdialog.cpp b/tdeio/tdefile/kpropertiesdialog.cpp index b18f147c6..cfd57d7cc 100644 --- a/tdeio/tdefile/kpropertiesdialog.cpp +++ b/tdeio/tdefile/kpropertiesdialog.cpp @@ -92,7 +92,7 @@ extern "C" { #include #include #include -#include +#include #include #include #include @@ -800,7 +800,7 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props ) filename = nameFromFileName( filename ); if ( d->bKDesktopMode && d->bDesktopFile ) { - KDesktopFile config( url.path(), true /* readonly */ ); + TDEDesktopFile config( url.path(), true /* readonly */ ); if ( config.hasKey( "Name" ) ) { filename = config.readName(); } @@ -875,7 +875,7 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props ) // So we have to really open .desktop files TQString iconStr = KMimeType::findByURL( url, mode )->icon( url, isLocal ); if ( bDesktopFile && isLocal ) { - KDesktopFile config( url.path(), true ); + TDEDesktopFile config( url.path(), true ); config.setDesktopGroup(); iconStr = config.readEntry( "Icon" ); if ( config.hasDeviceType() ) { @@ -1432,7 +1432,7 @@ void KFilePropsPlugin::slotCopyFinished( TDEIO::Job * job ) { kdDebug(250) << "KFilePropsPlugin::slotCopyFinished " << m_sRelativePath << endl; KURL newURL; - newURL.setPath( KDesktopFile::locateLocal(m_sRelativePath) ); + newURL.setPath( TDEDesktopFile::locateLocal(m_sRelativePath) ); kdDebug(250) << "KFilePropsPlugin::slotCopyFinished path=" << newURL.path() << endl; properties->updateUrl( newURL ); } @@ -1440,7 +1440,7 @@ void KFilePropsPlugin::slotCopyFinished( TDEIO::Job * job ) if ( d->bKDesktopMode && d->bDesktopFile ) { // Renamed? Update Name field if ( d->oldFileName != properties->kurl().fileName() || m_bFromTemplate ) { - KDesktopFile config( properties->kurl().path() ); + TDEDesktopFile config( properties->kurl().path() ); TQString nameStr = nameFromFileName(properties->kurl().fileName()); config.writeEntry( "Name", nameStr ); config.writeEntry( "Name", nameStr, true, false, true ); @@ -1492,7 +1492,7 @@ void KFilePropsPlugin::applyIconChanges() } f.close(); - KDesktopFile cfg(path); + TDEDesktopFile cfg(path); kdDebug(250) << "sIcon = " << (sIcon) << endl; kdDebug(250) << "str = " << (str) << endl; cfg.writeEntry( "Icon", sIcon ); @@ -2667,7 +2667,7 @@ bool KURLPropsPlugin::supports( KFileItemList _items ) return false; // open file and check type - KDesktopFile config( item->url().path(), true /* readonly */ ); + TDEDesktopFile config( item->url().path(), true /* readonly */ ); return config.hasLinkType(); } @@ -2828,7 +2828,7 @@ bool KBindingPropsPlugin::supports( KFileItemList _items ) return false; // open file and check type - KDesktopFile config( item->url().path(), true /* readonly */ ); + TDEDesktopFile config( item->url().path(), true /* readonly */ ); return config.hasMimeTypeType(); } @@ -3127,7 +3127,7 @@ bool KDevicePropsPlugin::supports( KFileItemList _items ) if ( !KPropsDlgPlugin::isDesktopFile( item ) ) return false; // open file and check type - KDesktopFile config( item->url().path(), true /* readonly */ ); + TDEDesktopFile config( item->url().path(), true /* readonly */ ); return config.hasDeviceType(); } @@ -3205,7 +3205,7 @@ KDesktopPropsPlugin::KDesktopPropsPlugin( KPropertiesDialog *_props ) return; f.close(); - KDesktopFile config( path ); + TDEDesktopFile config( path ); TQString nameStr = config.readName(); TQString genNameStr = config.readGenericName(); TQString commentStr = config.readComment(); @@ -3627,7 +3627,7 @@ bool KDesktopPropsPlugin::supports( KFileItemList _items ) if ( !KPropsDlgPlugin::isDesktopFile( item ) ) return false; // open file and check type - KDesktopFile config( item->url().path(), true /* readonly */ ); + TDEDesktopFile config( item->url().path(), true /* readonly */ ); return config.hasApplicationType() && tdeApp->authorize("run_desktop_files") && tdeApp->authorize("shell_access"); } @@ -3905,7 +3905,7 @@ bool KExecPropsPlugin::supports( KFileItemList _items ) if ( !KPropsDlgPlugin::isDesktopFile( item ) ) return false; // open file and check type - KDesktopFile config( item->url().path(), true /* readonly */ ); + TDEDesktopFile config( item->url().path(), true /* readonly */ ); return config.hasApplicationType() && tdeApp->authorize("run_desktop_files") && tdeApp->authorize("shell_access"); } @@ -4057,7 +4057,7 @@ TDEApplicationPropsPlugin::TDEApplicationPropsPlugin( KPropertiesDialog *_props return; f.close(); - KDesktopFile config( path ); + TDEDesktopFile config( path ); TQString commentStr = config.readComment(); TQString genNameStr = config.readGenericName(); diff --git a/tdeio/tdefile/tderecentdocument.cpp b/tdeio/tdefile/tderecentdocument.cpp index beceefbf2..2b8a96102 100644 --- a/tdeio/tdefile/tderecentdocument.cpp +++ b/tdeio/tdefile/tderecentdocument.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -61,7 +61,7 @@ TQStringList TDERecentDocument::recentDocuments() for (TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { TQString pathDesktop = d.absFilePath( *it ); - KDesktopFile tmpDesktopFile( pathDesktop, false); + TDEDesktopFile tmpDesktopFile( pathDesktop, false); KURL urlDesktopFile(tmpDesktopFile.readURL()); if( urlDesktopFile.isLocalFile() && !TQFile(urlDesktopFile.path()).exists()) d.remove(pathDesktop); diff --git a/tdeio/tdeio/kmimetype.cpp b/tdeio/tdeio/kmimetype.cpp index 5126b7540..d0014d99c 100644 --- a/tdeio/tdeio/kmimetype.cpp +++ b/tdeio/tdeio/kmimetype.cpp @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include #include @@ -365,14 +365,14 @@ KMimeType::KMimeType( const TQString & _fullpath, const TQString& _type, const T KMimeType::KMimeType( const TQString & _fullpath ) : KServiceType( _fullpath ) { - KDesktopFile _cfg( _fullpath, true ); + TDEDesktopFile _cfg( _fullpath, true ); init ( &_cfg ); if ( !isValid() ) kdWarning(7009) << "mimetype not valid '" << m_strName << "' (missing entry in the file ?)" << endl; } -KMimeType::KMimeType( KDesktopFile *config ) : KServiceType( config ) +KMimeType::KMimeType( TDEDesktopFile *config ) : KServiceType( config ) { init( config ); @@ -380,7 +380,7 @@ KMimeType::KMimeType( KDesktopFile *config ) : KServiceType( config ) kdWarning(7009) << "mimetype not valid '" << m_strName << "' (missing entry in the file ?)" << endl; } -void KMimeType::init( KDesktopFile * config ) +void KMimeType::init( TDEDesktopFile * config ) { config->setDesktopGroup(); m_lstPatterns = config->readListEntry( "Patterns", ';' ); @@ -685,7 +685,7 @@ TQString KFolderType::comment( const KURL& _url, bool _is_local ) const KURL u( _url ); u.addPath( ".directory" ); - KDesktopFile cfg( u.path(), true ); + TDEDesktopFile cfg( u.path(), true ); TQString comment = cfg.readComment(); if ( comment.isEmpty() ) return KMimeType::comment( _url, _is_local ); @@ -779,7 +779,7 @@ TQString KDEDesktopMimeType::comment( const KURL& _url, bool _is_local ) const if ( !_is_local ) return KMimeType::comment( _url, _is_local ); - KDesktopFile cfg( _url.path(), true ); + TDEDesktopFile cfg( _url.path(), true ); TQString comment = cfg.readComment(); if ( comment.isEmpty() ) return KMimeType::comment( _url, _is_local ); diff --git a/tdeio/tdeio/kmimetype.h b/tdeio/tdeio/kmimetype.h index 51ee0e234..ed1931361 100644 --- a/tdeio/tdeio/kmimetype.h +++ b/tdeio/tdeio/kmimetype.h @@ -78,7 +78,7 @@ public: * Construct a mimetype and take all information from a desktop file. * @param config the desktop configuration file that describes the mime type */ - KMimeType( KDesktopFile *config ); + KMimeType( TDEDesktopFile *config ); /** * @internal Construct a service from a stream. @@ -436,7 +436,7 @@ public: protected: void loadInternal( TQDataStream& ); - void init( KDesktopFile * ); + void init( TDEDesktopFile * ); /** * Signal a missing mime type. @@ -486,7 +486,7 @@ public: * Construct a folder mimetype and take all information from a desktop file. * @param config the desktop configuration file that describes the mime type */ - KFolderType( KDesktopFile *config) : KMimeType( config ) { } + KFolderType( TDEDesktopFile *config) : KMimeType( config ) { } /** \internal */ KFolderType( TQDataStream& _str, int offset ) : KMimeType( _str, offset ) { } @@ -531,7 +531,7 @@ public: * Construct a desktop mimetype and take all information from a desktop file. * @param config the desktop configuration file that describes the mime type */ - KDEDesktopMimeType( KDesktopFile *config) : KMimeType( config ) { } + KDEDesktopMimeType( TDEDesktopFile *config) : KMimeType( config ) { } /** \internal */ KDEDesktopMimeType( TQDataStream& _str, int offset ) : KMimeType( _str, offset ) { } @@ -631,7 +631,7 @@ public: * Construct a executable mimetype and take all information from a desktop file. * @param config the desktop configuration file that describes the mime type */ - KExecMimeType( KDesktopFile *config) : KMimeType( config ) { } + KExecMimeType( TDEDesktopFile *config) : KMimeType( config ) { } /** \internal */ KExecMimeType( TQDataStream& _str, int offset ) : KMimeType( _str, offset ) { } protected: diff --git a/tdeio/tdeio/krun.cpp b/tdeio/tdeio/krun.cpp index b28820444..d6fd8a80e 100644 --- a/tdeio/tdeio/krun.cpp +++ b/tdeio/tdeio/krun.cpp @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include #include @@ -325,7 +325,7 @@ KRunMX2::subst( int option, const KURL &url, TQStringList &ret ) break; case 'v': if (url.isLocalFile() && TQFile::exists( url.path() ) ) - ret << KDesktopFile( url.path(), true ).readEntry( "Dev" ); + ret << TDEDesktopFile( url.path(), true ).readEntry( "Dev" ); break; } return; @@ -555,7 +555,7 @@ static pid_t runCommandInternal( TDEProcess* proc, const KService* service, cons const TQString &execName, const TQString & iconName, TQWidget* window, TQCString asn ) { if (service && !service->desktopEntryPath().isEmpty() - && !KDesktopFile::isAuthorizedDesktopFile( service->desktopEntryPath() )) + && !TDEDesktopFile::isAuthorizedDesktopFile( service->desktopEntryPath() )) { kdWarning() << "No authorization to execute " << service->desktopEntryPath() << endl; KMessageBox::sorry(window, i18n("You are not authorized to execute this file.")); @@ -775,7 +775,7 @@ pid_t KRun::run( const KService& _service, const KURL::List& _urls, TQWidget* wi bool tempFiles, const TQString& suggestedFileName ) { if (!_service.desktopEntryPath().isEmpty() && - !KDesktopFile::isAuthorizedDesktopFile( _service.desktopEntryPath())) + !TDEDesktopFile::isAuthorizedDesktopFile( _service.desktopEntryPath())) { kdWarning() << "No authorization to execute " << _service.desktopEntryPath() << endl; KMessageBox::sorry(window, i18n("You are not authorized to execute this service.")); diff --git a/tdeio/tdeio/kservice.cpp b/tdeio/tdeio/kservice.cpp index 4721156ed..17545d8e6 100644 --- a/tdeio/tdeio/kservice.cpp +++ b/tdeio/tdeio/kservice.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include #include @@ -80,19 +80,19 @@ KService::KService( const TQString & _name, const TQString &_exec, const TQStrin KService::KService( const TQString & _fullpath ) : KSycocaEntry( _fullpath) { - KDesktopFile config( _fullpath ); + TDEDesktopFile config( _fullpath ); init(&config); } -KService::KService( KDesktopFile *config ) +KService::KService( TDEDesktopFile *config ) : KSycocaEntry( config->fileName()) { init(config); } void -KService::init( KDesktopFile *config ) +KService::init( TDEDesktopFile *config ) { d = new KServicePrivate; m_bValid = true; @@ -738,7 +738,7 @@ bool KService::substituteUid() const { } TQString KService::username() const { - // See also KDesktopFile::tryExec() + // See also TDEDesktopFile::tryExec() TQString user; TQVariant v = property("X-TDE-Username", TQVariant::String); user = v.isValid() ? v.toString() : TQString::null; @@ -856,7 +856,7 @@ TQString KService::locateLocal() { if (d->menuId.isEmpty() || desktopEntryPath().startsWith(".hidden") || (TQDir::isRelativePath(desktopEntryPath()) && d->categories.isEmpty())) - return KDesktopFile::locateLocal(desktopEntryPath()); + return TDEDesktopFile::locateLocal(desktopEntryPath()); return ::locateLocal("xdgdata-apps", d->menuId); } diff --git a/tdeio/tdeio/kservice.h b/tdeio/tdeio/kservice.h index bd42f9b0d..09218ac9d 100644 --- a/tdeio/tdeio/kservice.h +++ b/tdeio/tdeio/kservice.h @@ -28,7 +28,7 @@ #include "tdesycocaentry.h" class TQDataStream; -class KDesktopFile; +class TDEDesktopFile; class KService; class KBuildSycoca; class TQWidget; @@ -74,7 +74,7 @@ public: * Construct a service and take all information from a desktop file. * @param config the desktop file to read */ - KService( KDesktopFile *config ); // KDE-4.0: make explicit + KService( TDEDesktopFile *config ); // KDE-4.0: make explicit /** * @internal @@ -521,7 +521,7 @@ public: protected: - void init(KDesktopFile *config); + void init(TDEDesktopFile *config); TQStringList &accessServiceTypes() { return m_lstServiceTypes; } diff --git a/tdeio/tdeio/kservicegroup.cpp b/tdeio/tdeio/kservicegroup.cpp index fb86c35fa..e612705e5 100644 --- a/tdeio/tdeio/kservicegroup.cpp +++ b/tdeio/tdeio/kservicegroup.cpp @@ -69,7 +69,7 @@ KServiceGroup::KServiceGroup( const TQString &configFile, const TQString & _relp d->directoryEntryPath = cfg; - KDesktopFile config( cfg, true, "apps" ); + TDEDesktopFile config( cfg, true, "apps" ); m_strCaption = config.readName(); m_strIcon = config.readIcon(); diff --git a/tdeio/tdeio/kservicegroup.h b/tdeio/tdeio/kservicegroup.h index ac4646599..6cb910f18 100644 --- a/tdeio/tdeio/kservicegroup.h +++ b/tdeio/tdeio/kservicegroup.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include "tdesycocaentry.h" diff --git a/tdeio/tdeio/kservicetype.cpp b/tdeio/tdeio/kservicetype.cpp index 66d12698b..f94d7cc77 100644 --- a/tdeio/tdeio/kservicetype.cpp +++ b/tdeio/tdeio/kservicetype.cpp @@ -25,7 +25,7 @@ #include "kuserprofile.h" #include #include -#include +#include class KServiceType::KServiceTypePrivate { @@ -40,19 +40,19 @@ public: KServiceType::KServiceType( const TQString & _fullpath) : KSycocaEntry(_fullpath), d(0) { - KDesktopFile config( _fullpath ); + TDEDesktopFile config( _fullpath ); init(&config); } -KServiceType::KServiceType( KDesktopFile *config ) +KServiceType::KServiceType( TDEDesktopFile *config ) : KSycocaEntry(config->fileName()), d(0) { init(config); } void -KServiceType::init( KDesktopFile *config) +KServiceType::init( TDEDesktopFile *config) { // Is it a mimetype ? m_strName = config->readEntry( "MimeType" ); diff --git a/tdeio/tdeio/kservicetype.h b/tdeio/tdeio/kservicetype.h index 4272c40ae..8b40b7695 100644 --- a/tdeio/tdeio/kservicetype.h +++ b/tdeio/tdeio/kservicetype.h @@ -73,7 +73,7 @@ public: * Construct a service type and take all informations from a deskop file. * @param config the configuration file */ - KServiceType( KDesktopFile *config); + KServiceType( TDEDesktopFile *config); /** * @internal construct a service from a stream. @@ -227,7 +227,7 @@ public: static List allServiceTypes(); protected: - void init( KDesktopFile *config ); + void init( TDEDesktopFile *config ); protected: TQString m_strName; diff --git a/tdeutils/kplugininfo.cpp b/tdeutils/kplugininfo.cpp index 54f161db6..c1b30307c 100644 --- a/tdeutils/kplugininfo.cpp +++ b/tdeutils/kplugininfo.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include class KPluginInfo::KPluginInfoPrivate @@ -70,7 +70,7 @@ class KPluginInfo::KPluginInfoPrivate KPluginInfo::KPluginInfo( const TQString & filename, const char* resource ) : d( new KPluginInfoPrivate ) { - KDesktopFile file( filename, true, resource ); + TDEDesktopFile file( filename, true, resource ); d->specfile = filename; diff --git a/tdeutils/tdecmoduleinfo.cpp b/tdeutils/tdecmoduleinfo.cpp index 91a1814d4..dada2ad3b 100644 --- a/tdeutils/tdecmoduleinfo.cpp +++ b/tdeutils/tdecmoduleinfo.cpp @@ -23,7 +23,7 @@ #include -#include +#include #include #include #include diff --git a/win/pro_files/tdecore/tdecore.pro b/win/pro_files/tdecore/tdecore.pro index 1c05bd184..5806fd3e2 100644 --- a/win/pro_files/tdecore/tdecore.pro +++ b/win/pro_files/tdecore/tdecore.pro @@ -87,7 +87,7 @@ tdeapplication.cpp \ kapplication_win.cpp \ tdeappdcopinterface.cpp \ tdeprocctrl.cpp \ -kdesktopfile.cpp \ +tdedesktopfile.cpp \ kbufferedio.cpp \ netsupp_win32.cpp \ kasyncio.cpp \