Rename KDesktopFile to TDEDesktopFile and also rename kdesktopfile.{h,cpp} to tdedesktopfile.{h.cpp}.

This is an API/ABI change.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/364/head
Michele Calgaro 1 week ago
parent 2d03f60833
commit 864284eb1e
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -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 - 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 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 KGuiItem has one of these dangerous ctors, too. KUser has a whole bunch
of them. of them.

@ -24,7 +24,7 @@
#include <tdeglobal.h> #include <tdeglobal.h>
#include <tdelocale.h> #include <tdelocale.h>
#include <tdeconfig.h> #include <tdeconfig.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
#include <kstandarsdirs.h> #include <kstandarsdirs.h>
#include <tdestdaccel.h> #include <tdestdaccel.h>
#include <kdebug.h> #include <kdebug.h>
@ -67,9 +67,9 @@ TDESelectAction * ScriptLoader::getScripts()
while( (fi=it.current())) while( (fi=it.current()))
{ {
// Query each desktop file // 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; kdDebug () << "Trying to load script type: " << desktop.readType() << endl;
KScriptInterface *tmpIface = KParts::ComponentFactory::createInstanceFromQuery<KScriptInterface>(desktop.readType() ); KScriptInterface *tmpIface = KParts::ComponentFactory::createInstanceFromQuery<KScriptInterface>(desktop.readType() );
if( tmpIface != 0 ) if( tmpIface != 0 )

@ -2,7 +2,7 @@
#include <tdeparts/part.h> #include <tdeparts/part.h>
#include <tdeparts/componentfactory.h> #include <tdeparts/componentfactory.h>
#include <tdeapplication.h> #include <tdeapplication.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
#include <tdestandarddirs.h> #include <tdestandarddirs.h>
#include <tdelocale.h> #include <tdelocale.h>
@ -46,9 +46,9 @@ bool KScriptManager::addScript( const TQString &scriptDesktopFile)
TQString tmpScriptMethod = ""; TQString tmpScriptMethod = "";
// Read the desktop file // 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.insert(desktop.readName(), new ScriptInfo());
m_scripts[desktop.readName()]->scriptType = desktop.readType(); m_scripts[desktop.readName()]->scriptType = desktop.readType();
TQString localpath = TQString(tdeApp->name()) + "/scripts/" + desktop.readEntry("X-TDE-ScriptName", ""); TQString localpath = TQString(tdeApp->name()) + "/scripts/" + desktop.readEntry("X-TDE-ScriptName", "");

@ -80,7 +80,7 @@ KBuildServiceFactory::createEntry( const TQString& file, const char *resource )
if (!name.endsWith(".desktop") && !name.endsWith(".kdelnk")) if (!name.endsWith(".desktop") && !name.endsWith(".kdelnk"))
return 0; return 0;
KDesktopFile desktopFile(file, true, resource); TDEDesktopFile desktopFile(file, true, resource);
KService * serv = new KService( &desktopFile ); KService * serv = new KService( &desktopFile );

@ -27,7 +27,7 @@
#include <kdebug.h> #include <kdebug.h>
#include <tdelocale.h> #include <tdelocale.h>
#include <assert.h> #include <assert.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
template class TQDict<KMimeType>; template class TQDict<KMimeType>;
@ -78,7 +78,7 @@ KBuildServiceTypeFactory::createEntry(const TQString &file, const char *resource
if (name.isEmpty()) if (name.isEmpty())
return 0; return 0;
KDesktopFile desktopFile(file, true, resource); TDEDesktopFile desktopFile(file, true, resource);
if ( desktopFile.readBoolEntry( "Hidden", false ) == true ) if ( desktopFile.readBoolEntry( "Hidden", false ) == true )
return 0; return 0;

@ -50,7 +50,7 @@ link_directories(
install( FILES install( FILES
tdeconfig.h tdeconfigskeleton.h tdeconfigdata.h tdesimpleconfig.h 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 kurl.h ksock.h tdeaboutdata.h tdecmdlineargs.h tdeconfigbackend.h
tdeapplication.h tdeuniqueapplication.h tdeapplication.h tdeuniqueapplication.h
kcharsets.h tdeversion.h kpty.h tdeprocess.h tdeprocctrl.h kcharsets.h tdeversion.h kpty.h tdeprocess.h tdeprocctrl.h
@ -107,7 +107,7 @@ set( target tdecore )
set( ${target}_SRCS set( ${target}_SRCS
libintl.cpp tdeapplication.cpp kdebug.cpp netwm.cpp libintl.cpp tdeapplication.cpp kdebug.cpp netwm.cpp
tdeconfigbase.cpp tdeconfig.cpp tdesimpleconfig.cpp tdeconfigbackend.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 ksock.cpp kpty.cpp tdeprocess.cpp tdeprocctrl.cpp tdelocale.cpp
krfcdate.cpp kiconeffect.cpp kicontheme.cpp kiconloader.cpp krfcdate.cpp kiconeffect.cpp kicontheme.cpp kiconloader.cpp
twin.cpp twinmodule.cpp krootprop.cpp kcharsets.cpp twin.cpp twinmodule.cpp krootprop.cpp kcharsets.cpp

@ -26,7 +26,7 @@ tdeconfigbase.cpp Waldo Bastian <bastian@kde.org>
tdecrash.cpp Waldo Bastian <bastian@kde.org> tdecrash.cpp Waldo Bastian <bastian@kde.org>
kdcoppropertyproxy.cpp kdcoppropertyproxy.cpp
kdebug.cpp Stephan Kulow <coolo@kde.org> kdebug.cpp Stephan Kulow <coolo@kde.org>
kdesktopfile.cpp tdedesktopfile.cpp
tdeglobal.cpp Stephan Kulow <coolo@kde.org> tdeglobal.cpp Stephan Kulow <coolo@kde.org>
tdeglobalaccel.cpp Ellis Whitehead <ellis@kde.org> tdeglobalaccel.cpp Ellis Whitehead <ellis@kde.org>
tdeglobalaccel_x11.cpp Ellis Whitehead <ellis@kde.org> tdeglobalaccel_x11.cpp Ellis Whitehead <ellis@kde.org>

@ -38,7 +38,7 @@ lib_LIBRARIES = libtdefakes_nonpic.a libtdefakes_pic.a
include_HEADERS = tdeconfig.h tdeconfigskeleton.h \ include_HEADERS = tdeconfig.h tdeconfigskeleton.h \
tdeconfigdata.h tdesimpleconfig.h tdeconfigdialogmanager.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 \ tdecmdlineargs.h tdeconfigbackend.h tdeapplication.h \
tdeuniqueapplication.h kcharsets.h tdeversion.h kpty.h tdeprocess.h \ tdeuniqueapplication.h kcharsets.h tdeversion.h kpty.h tdeprocess.h \
tdeprocctrl.h tdelocale.h kicontheme.h kiconloader.h kdebug.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 \ libtdecore_la_SOURCES = libintl.cpp tdeapplication.cpp \
kdebug.cpp netwm.cpp tdeconfigbase.cpp tdeconfig.cpp tdesimpleconfig.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 \ tdestandarddirs.cpp ksock.cpp kpty.cpp tdeprocess.cpp tdeprocctrl.cpp \
tdelocale.cpp krfcdate.cpp kiconeffect.cpp kicontheme.cpp \ tdelocale.cpp krfcdate.cpp kiconeffect.cpp kicontheme.cpp \
kiconloader.cpp twin.cpp twinmodule.cpp krootprop.cpp kcharsets.cpp \ kiconloader.cpp twin.cpp twinmodule.cpp krootprop.cpp kcharsets.cpp \

@ -1,251 +1,3 @@
/* This file is part of the KDE libraries #include "tdedesktopfile.h"
Copyright (c) 1999 Pietro Iglio <iglio@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 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 <iglio@kde.org>
* @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
#define KDesktopFile TDEDesktopFile

@ -37,10 +37,10 @@
#include "kcatalogue.h" #include "kcatalogue.h"
#include "tdelocale.h" #include "tdelocale.h"
#include "kdesktopfile.h" #include "tdedesktopfile.h"
#include "kdesktopfile.moc" #include "tdedesktopfile.moc"
KDesktopFile::KDesktopFile(const TQString &fileName, bool bReadOnly, TDEDesktopFile::TDEDesktopFile(const TQString &fileName, bool bReadOnly,
const char * resType) const char * resType)
: TDEConfig(TQString::fromLatin1(""), bReadOnly, false) : TDEConfig(TQString::fromLatin1(""), bReadOnly, false)
{ {
@ -53,12 +53,12 @@ KDesktopFile::KDesktopFile(const TQString &fileName, bool bReadOnly,
setDesktopGroup(); setDesktopGroup();
} }
KDesktopFile::~KDesktopFile() TDEDesktopFile::~TDEDesktopFile()
{ {
// no need to do anything // no need to do anything
} }
TQString KDesktopFile::locateLocal(const TQString &path) TQString TDEDesktopFile::locateLocal(const TQString &path)
{ {
TQString local; TQString local;
if (path.endsWith(".directory")) if (path.endsWith(".directory"))
@ -110,7 +110,7 @@ TQString KDesktopFile::locateLocal(const TQString &path)
return local; return local;
} }
bool KDesktopFile::isDesktopFile(const TQString& path) bool TDEDesktopFile::isDesktopFile(const TQString& path)
{ {
int len = path.length(); int len = path.length();
@ -122,7 +122,7 @@ bool KDesktopFile::isDesktopFile(const TQString& path)
return false; return false;
} }
bool KDesktopFile::isAuthorizedDesktopFile(const TQString& path) bool TDEDesktopFile::isAuthorizedDesktopFile(const TQString& path)
{ {
if (!tdeApp || tdeApp->authorize("run_desktop_files")) if (!tdeApp || tdeApp->authorize("run_desktop_files"))
return true; return true;
@ -147,7 +147,7 @@ bool KDesktopFile::isAuthorizedDesktopFile(const TQString& path)
return false; return false;
} }
TQString KDesktopFile::translatedEntry(const char* key) const TQString TDEDesktopFile::translatedEntry(const char* key) const
{ {
if (hasTranslatedKey(key)) if (hasTranslatedKey(key))
return readEntry(key); return readEntry(key);
@ -168,42 +168,42 @@ TQString KDesktopFile::translatedEntry(const char* key) const
return TQString::null; return TQString::null;
} }
TQString KDesktopFile::readType() const TQString TDEDesktopFile::readType() const
{ {
return readEntry("Type"); return readEntry("Type");
} }
TQString KDesktopFile::readIcon() const TQString TDEDesktopFile::readIcon() const
{ {
return readEntry("Icon"); return readEntry("Icon");
} }
TQString KDesktopFile::readName() const TQString TDEDesktopFile::readName() const
{ {
return translatedEntry("Name"); return translatedEntry("Name");
} }
TQString KDesktopFile::readComment() const TQString TDEDesktopFile::readComment() const
{ {
return translatedEntry("Comment"); return translatedEntry("Comment");
} }
TQString KDesktopFile::readGenericName() const TQString TDEDesktopFile::readGenericName() const
{ {
return translatedEntry("GenericName"); return translatedEntry("GenericName");
} }
TQString KDesktopFile::readPath() const TQString TDEDesktopFile::readPath() const
{ {
return readPathEntry("Path"); return readPathEntry("Path");
} }
TQString KDesktopFile::readDevice() const TQString TDEDesktopFile::readDevice() const
{ {
return readEntry("Dev"); return readEntry("Dev");
} }
TQString KDesktopFile::readURL() const TQString TDEDesktopFile::readURL() const
{ {
if (hasDeviceType()) { if (hasDeviceType()) {
TQString device = readDevice(); TQString device = readDevice();
@ -234,43 +234,43 @@ TQString KDesktopFile::readURL() const
} }
} }
TQStringList KDesktopFile::readActions() const TQStringList TDEDesktopFile::readActions() const
{ {
return readListEntry("Actions", ';'); return readListEntry("Actions", ';');
} }
void KDesktopFile::setActionGroup(const TQString &group) void TDEDesktopFile::setActionGroup(const TQString &group)
{ {
setGroup(TQString::fromLatin1("Desktop Action ") + 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); return hasGroup(TQString::fromLatin1("Desktop Action ") + group);
} }
bool KDesktopFile::hasLinkType() const bool TDEDesktopFile::hasLinkType() const
{ {
return readEntry("Type") == TQString::fromLatin1("Link"); return readEntry("Type") == TQString::fromLatin1("Link");
} }
bool KDesktopFile::hasApplicationType() const bool TDEDesktopFile::hasApplicationType() const
{ {
return readEntry("Type") == TQString::fromLatin1("Application"); return readEntry("Type") == TQString::fromLatin1("Application");
} }
bool KDesktopFile::hasMimeTypeType() const bool TDEDesktopFile::hasMimeTypeType() const
{ {
return readEntry("Type") == TQString::fromLatin1("MimeType"); return readEntry("Type") == TQString::fromLatin1("MimeType");
} }
bool KDesktopFile::hasDeviceType() const bool TDEDesktopFile::hasDeviceType() const
{ {
return readEntry("Type") == TQString::fromLatin1("FSDev") || return readEntry("Type") == TQString::fromLatin1("FSDev") ||
readEntry("Type") == TQString::fromLatin1("FSDevice"); readEntry("Type") == TQString::fromLatin1("FSDevice");
} }
bool KDesktopFile::tryExec() const bool TDEDesktopFile::tryExec() const
{ {
// Test for TryExec and "X-TDE-AuthorizeAction" // Test for TryExec and "X-TDE-AuthorizeAction"
TQString te = readPathEntry("TryExec"); TQString te = readPathEntry("TryExec");
@ -345,31 +345,31 @@ bool KDesktopFile::tryExec() const
* @return the filename as passed to the constructor. * @return the filename as passed to the constructor.
*/ */
TQString TQString
KDesktopFile::fileName() const { return backEnd->fileName(); } TDEDesktopFile::fileName() const { return backEnd->fileName(); }
/** /**
* @return the resource type as passed to the constructor. * @return the resource type as passed to the constructor.
*/ */
TQString TQString
KDesktopFile::resource() const { return backEnd->resource(); } TDEDesktopFile::resource() const { return backEnd->resource(); }
TQStringList TQStringList
KDesktopFile::sortOrder() const TDEDesktopFile::sortOrder() const
{ {
return readListEntry("SortOrder"); return readListEntry("SortOrder");
} }
void KDesktopFile::virtual_hook( int id, void* data ) void TDEDesktopFile::virtual_hook( int id, void* data )
{ TDEConfig::virtual_hook( id, data ); } { TDEConfig::virtual_hook( id, data ); }
TQString KDesktopFile::readDocPath() const TQString TDEDesktopFile::readDocPath() const
{ {
return readPathEntry( "X-DocPath" ); 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); TDEConfig::copyTo(file, config);
config->setDesktopGroup(); config->setDesktopGroup();
return config; return config;

@ -0,0 +1,251 @@
/* This file is part of the TDE libraries
Copyright (c) 1999 Pietro Iglio <iglio@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 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 <iglio@kde.org>
* @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

@ -58,7 +58,7 @@
#include <krun.h> #include <krun.h>
#include <kurifilter.h> #include <kurifilter.h>
#include <kiconloader.h> #include <kiconloader.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
#include <tdemultipledrag.h> #include <tdemultipledrag.h>
#include <kinputdialog.h> #include <kinputdialog.h>
@ -272,7 +272,7 @@ void TDEHTMLPartBrowserExtension::searchProvider()
if( !KURIFilter::self()->filterURI(data, list) ) 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(); TQString encodedSearchTerm = m_part->selectedText();
TQUrl::encode(encodedSearchTerm); TQUrl::encode(encodedSearchTerm);
data.setData(file.readEntry("Query").replace("\\{@}", encodedSearchTerm)); data.setData(file.readEntry("Query").replace("\\{@}", encodedSearchTerm));

@ -23,7 +23,7 @@
#include "autostart.h" #include "autostart.h"
#include <tdeconfig.h> #include <tdeconfig.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
#include <tdeglobal.h> #include <tdeglobal.h>
#include <tdestandarddirs.h> #include <tdestandarddirs.h>
@ -125,7 +125,7 @@ AutoStart::loadAutoStartList()
{ {
continue; continue;
} }
KDesktopFile config(*it, true); TDEDesktopFile config(*it, true);
if (config.hasKey("X-TDE-autostart-condition")) { if (config.hasKey("X-TDE-autostart-condition")) {
if (!startCondition(config.readEntry("X-TDE-autostart-condition"))) if (!startCondition(config.readEntry("X-TDE-autostart-condition")))
continue; continue;
@ -167,7 +167,7 @@ AutoStart::loadAutoStartList()
if (localOuter == localInner) { if (localOuter == localInner) {
// Overridden! // Overridden!
// But is Hidden == True? // But is Hidden == True?
KDesktopFile innerConfig(*localit, true); TDEDesktopFile innerConfig(*localit, true);
if (innerConfig.readBoolEntry("Hidden", false)) { if (innerConfig.readBoolEntry("Hidden", false)) {
// Override confirmed; exit speedily without autostarting // Override confirmed; exit speedily without autostarting
autostartOverriddenAndDisabled = true; autostartOverriddenAndDisabled = true;

@ -37,7 +37,7 @@
#include <tdeapplication.h> #include <tdeapplication.h>
#include <kbuttonbox.h> #include <kbuttonbox.h>
#include <kcombobox.h> #include <kcombobox.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
#include <kdialog.h> #include <kdialog.h>
#include <tdeglobal.h> #include <tdeglobal.h>
#include <klineedit.h> #include <klineedit.h>
@ -739,15 +739,15 @@ void KOpenWithDlg::slotOK()
maxPreference = offerList.first().preference(); maxPreference = offerList.first().preference();
} }
KDesktopFile *desktop = 0; TDEDesktopFile *desktop = 0;
if (!oldPath.isEmpty() && (oldPath != newPath)) if (!oldPath.isEmpty() && (oldPath != newPath))
{ {
KDesktopFile orig(oldPath, true); TDEDesktopFile orig(oldPath, true);
desktop = orig.copyTo(newPath); desktop = orig.copyTo(newPath);
} }
else else
{ {
desktop = new KDesktopFile(newPath); desktop = new TDEDesktopFile(newPath);
} }
desktop->writeEntry("Type", TQString::fromLatin1("Application")); desktop->writeEntry("Type", TQString::fromLatin1("Application"));
desktop->writeEntry("Name", initialServiceName); desktop->writeEntry("Name", initialServiceName);
@ -776,7 +776,7 @@ void KOpenWithDlg::slotOK()
if ( !qServiceType.isEmpty() ) if ( !qServiceType.isEmpty() )
{ {
// Also make sure the "auto embed" setting for this mimetype is off // 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.writeEntry( "X-TDE-AutoEmbed", false );
mimeDesktop.sync(); mimeDesktop.sync();
} }

@ -92,7 +92,7 @@ extern "C" {
#include <kdirnotify_stub.h> #include <kdirnotify_stub.h>
#include <kdiskfreesp.h> #include <kdiskfreesp.h>
#include <kdebug.h> #include <kdebug.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
#include <kicondialog.h> #include <kicondialog.h>
#include <kurl.h> #include <kurl.h>
#include <kurlrequester.h> #include <kurlrequester.h>
@ -800,7 +800,7 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
filename = nameFromFileName( filename ); filename = nameFromFileName( filename );
if ( d->bKDesktopMode && d->bDesktopFile ) { if ( d->bKDesktopMode && d->bDesktopFile ) {
KDesktopFile config( url.path(), true /* readonly */ ); TDEDesktopFile config( url.path(), true /* readonly */ );
if ( config.hasKey( "Name" ) ) { if ( config.hasKey( "Name" ) ) {
filename = config.readName(); filename = config.readName();
} }
@ -875,7 +875,7 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
// So we have to really open .desktop files // So we have to really open .desktop files
TQString iconStr = KMimeType::findByURL( url, mode )->icon( url, isLocal ); TQString iconStr = KMimeType::findByURL( url, mode )->icon( url, isLocal );
if ( bDesktopFile && isLocal ) { if ( bDesktopFile && isLocal ) {
KDesktopFile config( url.path(), true ); TDEDesktopFile config( url.path(), true );
config.setDesktopGroup(); config.setDesktopGroup();
iconStr = config.readEntry( "Icon" ); iconStr = config.readEntry( "Icon" );
if ( config.hasDeviceType() ) { if ( config.hasDeviceType() ) {
@ -1432,7 +1432,7 @@ void KFilePropsPlugin::slotCopyFinished( TDEIO::Job * job )
{ {
kdDebug(250) << "KFilePropsPlugin::slotCopyFinished " << m_sRelativePath << endl; kdDebug(250) << "KFilePropsPlugin::slotCopyFinished " << m_sRelativePath << endl;
KURL newURL; KURL newURL;
newURL.setPath( KDesktopFile::locateLocal(m_sRelativePath) ); newURL.setPath( TDEDesktopFile::locateLocal(m_sRelativePath) );
kdDebug(250) << "KFilePropsPlugin::slotCopyFinished path=" << newURL.path() << endl; kdDebug(250) << "KFilePropsPlugin::slotCopyFinished path=" << newURL.path() << endl;
properties->updateUrl( newURL ); properties->updateUrl( newURL );
} }
@ -1440,7 +1440,7 @@ void KFilePropsPlugin::slotCopyFinished( TDEIO::Job * job )
if ( d->bKDesktopMode && d->bDesktopFile ) { if ( d->bKDesktopMode && d->bDesktopFile ) {
// Renamed? Update Name field // Renamed? Update Name field
if ( d->oldFileName != properties->kurl().fileName() || m_bFromTemplate ) { if ( d->oldFileName != properties->kurl().fileName() || m_bFromTemplate ) {
KDesktopFile config( properties->kurl().path() ); TDEDesktopFile config( properties->kurl().path() );
TQString nameStr = nameFromFileName(properties->kurl().fileName()); TQString nameStr = nameFromFileName(properties->kurl().fileName());
config.writeEntry( "Name", nameStr ); config.writeEntry( "Name", nameStr );
config.writeEntry( "Name", nameStr, true, false, true ); config.writeEntry( "Name", nameStr, true, false, true );
@ -1492,7 +1492,7 @@ void KFilePropsPlugin::applyIconChanges()
} }
f.close(); f.close();
KDesktopFile cfg(path); TDEDesktopFile cfg(path);
kdDebug(250) << "sIcon = " << (sIcon) << endl; kdDebug(250) << "sIcon = " << (sIcon) << endl;
kdDebug(250) << "str = " << (str) << endl; kdDebug(250) << "str = " << (str) << endl;
cfg.writeEntry( "Icon", sIcon ); cfg.writeEntry( "Icon", sIcon );
@ -2667,7 +2667,7 @@ bool KURLPropsPlugin::supports( KFileItemList _items )
return false; return false;
// open file and check type // open file and check type
KDesktopFile config( item->url().path(), true /* readonly */ ); TDEDesktopFile config( item->url().path(), true /* readonly */ );
return config.hasLinkType(); return config.hasLinkType();
} }
@ -2828,7 +2828,7 @@ bool KBindingPropsPlugin::supports( KFileItemList _items )
return false; return false;
// open file and check type // open file and check type
KDesktopFile config( item->url().path(), true /* readonly */ ); TDEDesktopFile config( item->url().path(), true /* readonly */ );
return config.hasMimeTypeType(); return config.hasMimeTypeType();
} }
@ -3127,7 +3127,7 @@ bool KDevicePropsPlugin::supports( KFileItemList _items )
if ( !KPropsDlgPlugin::isDesktopFile( item ) ) if ( !KPropsDlgPlugin::isDesktopFile( item ) )
return false; return false;
// open file and check type // open file and check type
KDesktopFile config( item->url().path(), true /* readonly */ ); TDEDesktopFile config( item->url().path(), true /* readonly */ );
return config.hasDeviceType(); return config.hasDeviceType();
} }
@ -3205,7 +3205,7 @@ KDesktopPropsPlugin::KDesktopPropsPlugin( KPropertiesDialog *_props )
return; return;
f.close(); f.close();
KDesktopFile config( path ); TDEDesktopFile config( path );
TQString nameStr = config.readName(); TQString nameStr = config.readName();
TQString genNameStr = config.readGenericName(); TQString genNameStr = config.readGenericName();
TQString commentStr = config.readComment(); TQString commentStr = config.readComment();
@ -3627,7 +3627,7 @@ bool KDesktopPropsPlugin::supports( KFileItemList _items )
if ( !KPropsDlgPlugin::isDesktopFile( item ) ) if ( !KPropsDlgPlugin::isDesktopFile( item ) )
return false; return false;
// open file and check type // 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"); 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 ) ) if ( !KPropsDlgPlugin::isDesktopFile( item ) )
return false; return false;
// open file and check type // 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"); return config.hasApplicationType() && tdeApp->authorize("run_desktop_files") && tdeApp->authorize("shell_access");
} }
@ -4057,7 +4057,7 @@ TDEApplicationPropsPlugin::TDEApplicationPropsPlugin( KPropertiesDialog *_props
return; return;
f.close(); f.close();
KDesktopFile config( path ); TDEDesktopFile config( path );
TQString commentStr = config.readComment(); TQString commentStr = config.readComment();
TQString genNameStr = config.readGenericName(); TQString genNameStr = config.readGenericName();

@ -32,7 +32,7 @@
#include <kurl.h> #include <kurl.h>
#include <kdebug.h> #include <kdebug.h>
#include <kmimetype.h> #include <kmimetype.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
#include <tqdir.h> #include <tqdir.h>
#include <tqfileinfo.h> #include <tqfileinfo.h>
#include <tqtextstream.h> #include <tqtextstream.h>
@ -61,7 +61,7 @@ TQStringList TDERecentDocument::recentDocuments()
for (TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { for (TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
TQString pathDesktop = d.absFilePath( *it ); TQString pathDesktop = d.absFilePath( *it );
KDesktopFile tmpDesktopFile( pathDesktop, false); TDEDesktopFile tmpDesktopFile( pathDesktop, false);
KURL urlDesktopFile(tmpDesktopFile.readURL()); KURL urlDesktopFile(tmpDesktopFile.readURL());
if( urlDesktopFile.isLocalFile() && !TQFile(urlDesktopFile.path()).exists()) if( urlDesktopFile.isLocalFile() && !TQFile(urlDesktopFile.path()).exists())
d.remove(pathDesktop); d.remove(pathDesktop);

@ -49,7 +49,7 @@
#include <tdeapplication.h> #include <tdeapplication.h>
#include <tdeprocess.h> #include <tdeprocess.h>
#include <kdebug.h> #include <kdebug.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
#include <kdirwatch.h> #include <kdirwatch.h>
#include <kiconloader.h> #include <kiconloader.h>
#include <tdelocale.h> #include <tdelocale.h>
@ -365,14 +365,14 @@ KMimeType::KMimeType( const TQString & _fullpath, const TQString& _type, const T
KMimeType::KMimeType( const TQString & _fullpath ) : KServiceType( _fullpath ) KMimeType::KMimeType( const TQString & _fullpath ) : KServiceType( _fullpath )
{ {
KDesktopFile _cfg( _fullpath, true ); TDEDesktopFile _cfg( _fullpath, true );
init ( &_cfg ); init ( &_cfg );
if ( !isValid() ) if ( !isValid() )
kdWarning(7009) << "mimetype not valid '" << m_strName << "' (missing entry in the file ?)" << endl; 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 ); 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; 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(); config->setDesktopGroup();
m_lstPatterns = config->readListEntry( "Patterns", ';' ); m_lstPatterns = config->readListEntry( "Patterns", ';' );
@ -685,7 +685,7 @@ TQString KFolderType::comment( const KURL& _url, bool _is_local ) const
KURL u( _url ); KURL u( _url );
u.addPath( ".directory" ); u.addPath( ".directory" );
KDesktopFile cfg( u.path(), true ); TDEDesktopFile cfg( u.path(), true );
TQString comment = cfg.readComment(); TQString comment = cfg.readComment();
if ( comment.isEmpty() ) if ( comment.isEmpty() )
return KMimeType::comment( _url, _is_local ); return KMimeType::comment( _url, _is_local );
@ -779,7 +779,7 @@ TQString KDEDesktopMimeType::comment( const KURL& _url, bool _is_local ) const
if ( !_is_local ) if ( !_is_local )
return KMimeType::comment( _url, _is_local ); return KMimeType::comment( _url, _is_local );
KDesktopFile cfg( _url.path(), true ); TDEDesktopFile cfg( _url.path(), true );
TQString comment = cfg.readComment(); TQString comment = cfg.readComment();
if ( comment.isEmpty() ) if ( comment.isEmpty() )
return KMimeType::comment( _url, _is_local ); return KMimeType::comment( _url, _is_local );

@ -78,7 +78,7 @@ public:
* Construct a mimetype and take all information from a desktop file. * Construct a mimetype and take all information from a desktop file.
* @param config the desktop configuration file that describes the mime type * @param config the desktop configuration file that describes the mime type
*/ */
KMimeType( KDesktopFile *config ); KMimeType( TDEDesktopFile *config );
/** /**
* @internal Construct a service from a stream. * @internal Construct a service from a stream.
@ -436,7 +436,7 @@ public:
protected: protected:
void loadInternal( TQDataStream& ); void loadInternal( TQDataStream& );
void init( KDesktopFile * ); void init( TDEDesktopFile * );
/** /**
* Signal a missing mime type. * Signal a missing mime type.
@ -486,7 +486,7 @@ public:
* Construct a folder mimetype and take all information from a desktop file. * Construct a folder mimetype and take all information from a desktop file.
* @param config the desktop configuration file that describes the mime type * @param config the desktop configuration file that describes the mime type
*/ */
KFolderType( KDesktopFile *config) : KMimeType( config ) { } KFolderType( TDEDesktopFile *config) : KMimeType( config ) { }
/** \internal */ /** \internal */
KFolderType( TQDataStream& _str, int offset ) : KMimeType( _str, offset ) { } 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. * Construct a desktop mimetype and take all information from a desktop file.
* @param config the desktop configuration file that describes the mime type * @param config the desktop configuration file that describes the mime type
*/ */
KDEDesktopMimeType( KDesktopFile *config) : KMimeType( config ) { } KDEDesktopMimeType( TDEDesktopFile *config) : KMimeType( config ) { }
/** \internal */ /** \internal */
KDEDesktopMimeType( TQDataStream& _str, int offset ) : KMimeType( _str, offset ) { } 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. * Construct a executable mimetype and take all information from a desktop file.
* @param config the desktop configuration file that describes the mime type * @param config the desktop configuration file that describes the mime type
*/ */
KExecMimeType( KDesktopFile *config) : KMimeType( config ) { } KExecMimeType( TDEDesktopFile *config) : KMimeType( config ) { }
/** \internal */ /** \internal */
KExecMimeType( TQDataStream& _str, int offset ) : KMimeType( _str, offset ) { } KExecMimeType( TQDataStream& _str, int offset ) : KMimeType( _str, offset ) { }
protected: protected:

@ -54,7 +54,7 @@
#include <tqtextstream.h> #include <tqtextstream.h>
#include <tqdatetime.h> #include <tqdatetime.h>
#include <tqregexp.h> #include <tqregexp.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
#include <tdestartupinfo.h> #include <tdestartupinfo.h>
#include <kmacroexpander.h> #include <kmacroexpander.h>
#include <kshell.h> #include <kshell.h>
@ -325,7 +325,7 @@ KRunMX2::subst( int option, const KURL &url, TQStringList &ret )
break; break;
case 'v': case 'v':
if (url.isLocalFile() && TQFile::exists( url.path() ) ) if (url.isLocalFile() && TQFile::exists( url.path() ) )
ret << KDesktopFile( url.path(), true ).readEntry( "Dev" ); ret << TDEDesktopFile( url.path(), true ).readEntry( "Dev" );
break; break;
} }
return; 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 ) const TQString &execName, const TQString & iconName, TQWidget* window, TQCString asn )
{ {
if (service && !service->desktopEntryPath().isEmpty() if (service && !service->desktopEntryPath().isEmpty()
&& !KDesktopFile::isAuthorizedDesktopFile( service->desktopEntryPath() )) && !TDEDesktopFile::isAuthorizedDesktopFile( service->desktopEntryPath() ))
{ {
kdWarning() << "No authorization to execute " << service->desktopEntryPath() << endl; kdWarning() << "No authorization to execute " << service->desktopEntryPath() << endl;
KMessageBox::sorry(window, i18n("You are not authorized to execute this file.")); 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 ) bool tempFiles, const TQString& suggestedFileName )
{ {
if (!_service.desktopEntryPath().isEmpty() && if (!_service.desktopEntryPath().isEmpty() &&
!KDesktopFile::isAuthorizedDesktopFile( _service.desktopEntryPath())) !TDEDesktopFile::isAuthorizedDesktopFile( _service.desktopEntryPath()))
{ {
kdWarning() << "No authorization to execute " << _service.desktopEntryPath() << endl; kdWarning() << "No authorization to execute " << _service.desktopEntryPath() << endl;
KMessageBox::sorry(window, i18n("You are not authorized to execute this service.")); KMessageBox::sorry(window, i18n("You are not authorized to execute this service."));

@ -40,7 +40,7 @@
#include <tdesimpleconfig.h> #include <tdesimpleconfig.h>
#include <tdeapplication.h> #include <tdeapplication.h>
#include <kdebug.h> #include <kdebug.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
#include <tdeglobal.h> #include <tdeglobal.h>
#include <kiconloader.h> #include <kiconloader.h>
#include <tdelocale.h> #include <tdelocale.h>
@ -80,19 +80,19 @@ KService::KService( const TQString & _name, const TQString &_exec, const TQStrin
KService::KService( const TQString & _fullpath ) KService::KService( const TQString & _fullpath )
: KSycocaEntry( _fullpath) : KSycocaEntry( _fullpath)
{ {
KDesktopFile config( _fullpath ); TDEDesktopFile config( _fullpath );
init(&config); init(&config);
} }
KService::KService( KDesktopFile *config ) KService::KService( TDEDesktopFile *config )
: KSycocaEntry( config->fileName()) : KSycocaEntry( config->fileName())
{ {
init(config); init(config);
} }
void void
KService::init( KDesktopFile *config ) KService::init( TDEDesktopFile *config )
{ {
d = new KServicePrivate; d = new KServicePrivate;
m_bValid = true; m_bValid = true;
@ -738,7 +738,7 @@ bool KService::substituteUid() const {
} }
TQString KService::username() const { TQString KService::username() const {
// See also KDesktopFile::tryExec() // See also TDEDesktopFile::tryExec()
TQString user; TQString user;
TQVariant v = property("X-TDE-Username", TQVariant::String); TQVariant v = property("X-TDE-Username", TQVariant::String);
user = v.isValid() ? v.toString() : TQString::null; user = v.isValid() ? v.toString() : TQString::null;
@ -856,7 +856,7 @@ TQString KService::locateLocal()
{ {
if (d->menuId.isEmpty() || desktopEntryPath().startsWith(".hidden") || if (d->menuId.isEmpty() || desktopEntryPath().startsWith(".hidden") ||
(TQDir::isRelativePath(desktopEntryPath()) && d->categories.isEmpty())) (TQDir::isRelativePath(desktopEntryPath()) && d->categories.isEmpty()))
return KDesktopFile::locateLocal(desktopEntryPath()); return TDEDesktopFile::locateLocal(desktopEntryPath());
return ::locateLocal("xdgdata-apps", d->menuId); return ::locateLocal("xdgdata-apps", d->menuId);
} }

@ -28,7 +28,7 @@
#include "tdesycocaentry.h" #include "tdesycocaentry.h"
class TQDataStream; class TQDataStream;
class KDesktopFile; class TDEDesktopFile;
class KService; class KService;
class KBuildSycoca; class KBuildSycoca;
class TQWidget; class TQWidget;
@ -74,7 +74,7 @@ public:
* Construct a service and take all information from a desktop file. * Construct a service and take all information from a desktop file.
* @param config the desktop file to read * @param config the desktop file to read
*/ */
KService( KDesktopFile *config ); // KDE-4.0: make explicit KService( TDEDesktopFile *config ); // KDE-4.0: make explicit
/** /**
* @internal * @internal
@ -521,7 +521,7 @@ public:
protected: protected:
void init(KDesktopFile *config); void init(TDEDesktopFile *config);
TQStringList &accessServiceTypes() { return m_lstServiceTypes; } TQStringList &accessServiceTypes() { return m_lstServiceTypes; }

@ -69,7 +69,7 @@ KServiceGroup::KServiceGroup( const TQString &configFile, const TQString & _relp
d->directoryEntryPath = cfg; d->directoryEntryPath = cfg;
KDesktopFile config( cfg, true, "apps" ); TDEDesktopFile config( cfg, true, "apps" );
m_strCaption = config.readName(); m_strCaption = config.readName();
m_strIcon = config.readIcon(); m_strIcon = config.readIcon();

@ -25,7 +25,7 @@
#include <tqdatastream.h> #include <tqdatastream.h>
#include <tqvariant.h> #include <tqvariant.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
#include <ksortablevaluelist.h> #include <ksortablevaluelist.h>
#include "tdesycocaentry.h" #include "tdesycocaentry.h"

@ -25,7 +25,7 @@
#include "kuserprofile.h" #include "kuserprofile.h"
#include <assert.h> #include <assert.h>
#include <kdebug.h> #include <kdebug.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
class KServiceType::KServiceTypePrivate class KServiceType::KServiceTypePrivate
{ {
@ -40,19 +40,19 @@ public:
KServiceType::KServiceType( const TQString & _fullpath) KServiceType::KServiceType( const TQString & _fullpath)
: KSycocaEntry(_fullpath), d(0) : KSycocaEntry(_fullpath), d(0)
{ {
KDesktopFile config( _fullpath ); TDEDesktopFile config( _fullpath );
init(&config); init(&config);
} }
KServiceType::KServiceType( KDesktopFile *config ) KServiceType::KServiceType( TDEDesktopFile *config )
: KSycocaEntry(config->fileName()), d(0) : KSycocaEntry(config->fileName()), d(0)
{ {
init(config); init(config);
} }
void void
KServiceType::init( KDesktopFile *config) KServiceType::init( TDEDesktopFile *config)
{ {
// Is it a mimetype ? // Is it a mimetype ?
m_strName = config->readEntry( "MimeType" ); m_strName = config->readEntry( "MimeType" );

@ -73,7 +73,7 @@ public:
* Construct a service type and take all informations from a deskop file. * Construct a service type and take all informations from a deskop file.
* @param config the configuration file * @param config the configuration file
*/ */
KServiceType( KDesktopFile *config); KServiceType( TDEDesktopFile *config);
/** /**
* @internal construct a service from a stream. * @internal construct a service from a stream.
@ -227,7 +227,7 @@ public:
static List allServiceTypes(); static List allServiceTypes();
protected: protected:
void init( KDesktopFile *config ); void init( TDEDesktopFile *config );
protected: protected:
TQString m_strName; TQString m_strName;

@ -24,7 +24,7 @@
#include <tdeconfigbase.h> #include <tdeconfigbase.h>
#include <tdeglobal.h> #include <tdeglobal.h>
#include <tdestandarddirs.h> #include <tdestandarddirs.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
#include <kservice.h> #include <kservice.h>
class KPluginInfo::KPluginInfoPrivate class KPluginInfo::KPluginInfoPrivate
@ -70,7 +70,7 @@ class KPluginInfo::KPluginInfoPrivate
KPluginInfo::KPluginInfo( const TQString & filename, const char* resource ) KPluginInfo::KPluginInfo( const TQString & filename, const char* resource )
: d( new KPluginInfoPrivate ) : d( new KPluginInfoPrivate )
{ {
KDesktopFile file( filename, true, resource ); TDEDesktopFile file( filename, true, resource );
d->specfile = filename; d->specfile = filename;

@ -23,7 +23,7 @@
#include <tqvariant.h> #include <tqvariant.h>
#include <kdesktopfile.h> #include <tdedesktopfile.h>
#include <kdebug.h> #include <kdebug.h>
#include <tdeglobal.h> #include <tdeglobal.h>
#include <tdestandarddirs.h> #include <tdestandarddirs.h>

@ -87,7 +87,7 @@ tdeapplication.cpp \
kapplication_win.cpp \ kapplication_win.cpp \
tdeappdcopinterface.cpp \ tdeappdcopinterface.cpp \
tdeprocctrl.cpp \ tdeprocctrl.cpp \
kdesktopfile.cpp \ tdedesktopfile.cpp \
kbufferedio.cpp \ kbufferedio.cpp \
netsupp_win32.cpp \ netsupp_win32.cpp \
kasyncio.cpp \ kasyncio.cpp \

Loading…
Cancel
Save