|
|
@ -32,6 +32,7 @@
|
|
|
|
#include <kservice.h>
|
|
|
|
#include <kservice.h>
|
|
|
|
#include <tdeio/job.h>
|
|
|
|
#include <tdeio/job.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
|
|
|
|
AppImpl::AppImpl(TDEIO_AppInfo *slave) : TQObject(), m_slave(slave)
|
|
|
|
AppImpl::AppImpl(TDEIO_AppInfo *slave) : TQObject(), m_slave(slave)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -173,10 +174,10 @@ void AppImpl::createEntry(TDEIO::UDSEntry &entry, const TQString &file)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createExeEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
|
|
|
|
void AppImpl::createExeEntry(TQValueList<TDEIO::UDSEntry> &list, const TQString &shortname,
|
|
|
|
const TQString &shortname,
|
|
|
|
const TQStringList &fullname)
|
|
|
|
const TQStringList &fullname)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
for (const TQString &name : fullname)
|
|
|
|
for (const TQString &name : fullname)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (name.isEmpty())
|
|
|
|
if (name.isEmpty())
|
|
|
@ -206,10 +207,9 @@ void AppImpl::createExeEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createManPageEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
|
|
|
|
void AppImpl::createManPageEntry(TQValueList<TDEIO::UDSEntry> &list, const TQString &shortname)
|
|
|
|
const TQString &shortname)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
entry.clear();
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Manual for %1").arg(shortname));
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Manual for %1").arg(shortname));
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, "man:/"+shortname);
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, "man:/"+shortname);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG);
|
|
|
@ -218,8 +218,7 @@ void AppImpl::createManPageEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSE
|
|
|
|
list.append(entry);
|
|
|
|
list.append(entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createHomeDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
|
|
|
|
void AppImpl::createHomeDirEntry(TQValueList<TDEIO::UDSEntry> &list, const TQString &shortname)
|
|
|
|
const TQString &shortname)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQStringList homedir;
|
|
|
|
TQStringList homedir;
|
|
|
|
homedir << TQString("%1/").arg(getenv("HOME"));
|
|
|
|
homedir << TQString("%1/").arg(getenv("HOME"));
|
|
|
@ -227,6 +226,7 @@ void AppImpl::createHomeDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSE
|
|
|
|
TQStringList fullname = getFullLocation(homedir, dirname,
|
|
|
|
TQStringList fullname = getFullLocation(homedir, dirname,
|
|
|
|
TQDir::FilterSpec(TQDir::Hidden | TQDir::Dirs | TQDir::Readable), true, false);
|
|
|
|
TQDir::FilterSpec(TQDir::Hidden | TQDir::Dirs | TQDir::Readable), true, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
for (const TQString &fname : fullname)
|
|
|
|
for (const TQString &fname : fullname)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (fname.isEmpty())
|
|
|
|
if (fname.isEmpty())
|
|
|
@ -244,8 +244,7 @@ void AppImpl::createHomeDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createTDEDataDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
|
|
|
|
void AppImpl::createTDEDataDirEntry(TQValueList<TDEIO::UDSEntry> &list, const TQString &shortname)
|
|
|
|
const TQString &shortname)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQStringList dirList = TDEGlobal::instance()->dirs()->resourceDirs("data");
|
|
|
|
TQStringList dirList = TDEGlobal::instance()->dirs()->resourceDirs("data");
|
|
|
|
TQStringList TDEDataDir = getFullLocation(dirList, shortname,
|
|
|
|
TQStringList TDEDataDir = getFullLocation(dirList, shortname,
|
|
|
@ -255,6 +254,7 @@ void AppImpl::createTDEDataDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UD
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
for (const TQString &dirname : TDEDataDir)
|
|
|
|
for (const TQString &dirname : TDEDataDir)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (dirname.isEmpty())
|
|
|
|
if (dirname.isEmpty())
|
|
|
@ -272,8 +272,7 @@ void AppImpl::createTDEDataDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UD
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createStandardDataDirEntry(TQValueList<TDEIO::UDSEntry> &list,
|
|
|
|
void AppImpl::createStandardDataDirEntry(TQValueList<TDEIO::UDSEntry> &list, const TQString &shortname)
|
|
|
|
TDEIO::UDSEntry &entry, const TQString &shortname)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQStringList dirList;
|
|
|
|
TQStringList dirList;
|
|
|
|
dirList << "/usr/share/";
|
|
|
|
dirList << "/usr/share/";
|
|
|
@ -285,6 +284,7 @@ void AppImpl::createStandardDataDirEntry(TQValueList<TDEIO::UDSEntry> &list,
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
for (const TQString &dirname : StandardDataDir)
|
|
|
|
for (const TQString &dirname : StandardDataDir)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (dirname.isEmpty())
|
|
|
|
if (dirname.isEmpty())
|
|
|
@ -302,27 +302,32 @@ void AppImpl::createStandardDataDirEntry(TQValueList<TDEIO::UDSEntry> &list,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createTDEConfigEntry(TQValueList<TDEIO::UDSEntry> &list, const TQString &shortname)
|
|
|
|
void AppImpl::createTDEConfigEntry(TQValueList<TDEIO::UDSEntry> &list,
|
|
|
|
|
|
|
|
TDEIO::UDSEntry &entry, const TQString &shortname)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
|
|
|
|
|
|
|
|
// Global TDE config
|
|
|
|
// Global TDE config
|
|
|
|
TQStringList dirList;
|
|
|
|
TQString tdeCfgDir(TDESYSCONFDIR);
|
|
|
|
dirList << "/etc/trinity/";
|
|
|
|
|
|
|
|
TQStringList TDEConfigFiles = getFullLocation(dirList, shortname + "rc",
|
|
|
|
|
|
|
|
TQDir::FilterSpec(TQDir::Files | TQDir::Dirs | TQDir::Readable), false, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const TQString &filename : TDEConfigFiles)
|
|
|
|
if (!tdeCfgDir.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!filename.isEmpty())
|
|
|
|
TQStringList dirList;
|
|
|
|
|
|
|
|
dirList << tdeCfgDir;
|
|
|
|
|
|
|
|
TQStringList TDEConfigFiles = getFullLocation(dirList, shortname + "rc",
|
|
|
|
|
|
|
|
TQDir::FilterSpec(TQDir::Files | TQDir::Dirs | TQDir::Readable), false, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const TQString &filename : TDEConfigFiles)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
entry.clear();
|
|
|
|
if (!filename.isEmpty())
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Config File (%1)").arg(filename));
|
|
|
|
{
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, filename);
|
|
|
|
entry.clear();
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG);
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Config File (%1)").arg(filename));
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "text/plain");
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, filename);
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "configure");
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG);
|
|
|
|
list.append(entry);
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "text/plain");
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "configure");
|
|
|
|
|
|
|
|
list.append(entry);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -342,8 +347,7 @@ void AppImpl::createTDEConfigEntry(TQValueList<TDEIO::UDSEntry> &list,
|
|
|
|
list.append(entry);
|
|
|
|
list.append(entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createStandardConfigEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
|
|
|
|
void AppImpl::createStandardConfigEntry(TQValueList<TDEIO::UDSEntry> &list, const TQString &shortname)
|
|
|
|
const TQString &shortname)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQStringList dirList;
|
|
|
|
TQStringList dirList;
|
|
|
|
dirList << "/etc/";
|
|
|
|
dirList << "/etc/";
|
|
|
@ -356,6 +360,7 @@ void AppImpl::createStandardConfigEntry(TQValueList<TDEIO::UDSEntry> &list, TDEI
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
for (const TQString &fname : StandardConfigFile)
|
|
|
|
for (const TQString &fname : StandardConfigFile)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (fname.isEmpty())
|
|
|
|
if (fname.isEmpty())
|
|
|
@ -363,7 +368,6 @@ void AppImpl::createStandardConfigEntry(TQValueList<TDEIO::UDSEntry> &list, TDEI
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
entry.clear();
|
|
|
|
|
|
|
|
bool isFolder = false;
|
|
|
|
bool isFolder = false;
|
|
|
|
TQFileInfo fi(fname);
|
|
|
|
TQFileInfo fi(fname);
|
|
|
|
if (fi.isDir())
|
|
|
|
if (fi.isDir())
|
|
|
@ -373,6 +377,7 @@ void AppImpl::createStandardConfigEntry(TQValueList<TDEIO::UDSEntry> &list, TDEI
|
|
|
|
|
|
|
|
|
|
|
|
kdDebug() << "createStandardConfigEntry: " << fname << endl;
|
|
|
|
kdDebug() << "createStandardConfigEntry: " << fname << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entry.clear();
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, fname);
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, fname);
|
|
|
|
TQString icon;
|
|
|
|
TQString icon;
|
|
|
|
if (isFolder)
|
|
|
|
if (isFolder)
|
|
|
@ -393,8 +398,7 @@ void AppImpl::createStandardConfigEntry(TQValueList<TDEIO::UDSEntry> &list, TDEI
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createTmpDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
|
|
|
|
void AppImpl::createTmpDirEntry(TQValueList<TDEIO::UDSEntry> &list, const TQString &shortname)
|
|
|
|
const TQString &shortname)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQStringList dirList;
|
|
|
|
TQStringList dirList;
|
|
|
|
dirList << "/tmp/";
|
|
|
|
dirList << "/tmp/";
|
|
|
@ -412,7 +416,6 @@ void AppImpl::createTmpDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEn
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
entry.clear();
|
|
|
|
|
|
|
|
bool isFolder = false;
|
|
|
|
bool isFolder = false;
|
|
|
|
TQFileInfo fi(fname);
|
|
|
|
TQFileInfo fi(fname);
|
|
|
|
if (fi.isDir())
|
|
|
|
if (fi.isDir())
|
|
|
@ -422,6 +425,7 @@ void AppImpl::createTmpDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEn
|
|
|
|
|
|
|
|
|
|
|
|
kdDebug() << "createTmpDirEntry: " << fname << endl;
|
|
|
|
kdDebug() << "createTmpDirEntry: " << fname << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, fname);
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, fname);
|
|
|
|
if (isFolder)
|
|
|
|
if (isFolder)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -441,8 +445,7 @@ void AppImpl::createTmpDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEn
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createXDGDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
|
|
|
|
void AppImpl::createXDGDirEntry(TQValueList<TDEIO::UDSEntry> &list, const TQString &shortname)
|
|
|
|
const TQString &shortname)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQStringList dirList;
|
|
|
|
TQStringList dirList;
|
|
|
|
dirList << TQString("%1/.config/").arg(getenv("HOME"));
|
|
|
|
dirList << TQString("%1/.config/").arg(getenv("HOME"));
|
|
|
@ -456,7 +459,6 @@ void AppImpl::createXDGDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEn
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
entry.clear();
|
|
|
|
|
|
|
|
bool isFolder = false;
|
|
|
|
bool isFolder = false;
|
|
|
|
TQFileInfo fi(filename);
|
|
|
|
TQFileInfo fi(filename);
|
|
|
|
if (fi.isDir())
|
|
|
|
if (fi.isDir())
|
|
|
@ -466,6 +468,7 @@ void AppImpl::createXDGDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEn
|
|
|
|
|
|
|
|
|
|
|
|
kdDebug() << "createXdgDirEntry: " << filename << endl;
|
|
|
|
kdDebug() << "createXdgDirEntry: " << filename << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, filename);
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, filename);
|
|
|
|
if (isFolder)
|
|
|
|
if (isFolder)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -489,30 +492,28 @@ bool AppImpl::listAppContents(const TQString &name, TQValueList<TDEIO::UDSEntry>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
kdDebug() << "AppImpl::listAppContents" << endl;
|
|
|
|
kdDebug() << "AppImpl::listAppContents" << endl;
|
|
|
|
|
|
|
|
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create entry for binary file
|
|
|
|
// Create entry for binary file
|
|
|
|
createExeEntry(list, entry, name, getAppAddress(name));
|
|
|
|
createExeEntry(list, name, getAppAddress(name));
|
|
|
|
|
|
|
|
|
|
|
|
// Create entry for data folder in home dir
|
|
|
|
|
|
|
|
createHomeDirEntry(list, entry, name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create entry for standard config and data folders
|
|
|
|
// Create entry for standard config and data folders
|
|
|
|
createStandardConfigEntry(list, entry, name);
|
|
|
|
createStandardConfigEntry(list, name);
|
|
|
|
createStandardDataDirEntry(list, entry, name);
|
|
|
|
createStandardDataDirEntry(list, name);
|
|
|
|
|
|
|
|
|
|
|
|
//Create entry for app XDF config folder in home dir
|
|
|
|
|
|
|
|
createXDGDirEntry(list, entry, name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create entry for TDE config and data folders
|
|
|
|
// Create entry for TDE config and data folders
|
|
|
|
createTDEConfigEntry(list, entry, name);
|
|
|
|
createTDEConfigEntry(list, name);
|
|
|
|
createTDEDataDirEntry(list, entry, name);
|
|
|
|
createTDEDataDirEntry(list, name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create entry for data folder in home dir
|
|
|
|
|
|
|
|
createHomeDirEntry(list, name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Create entry for app XDF config folder in home dir
|
|
|
|
|
|
|
|
createXDGDirEntry(list, name);
|
|
|
|
|
|
|
|
|
|
|
|
// Create entry for manual
|
|
|
|
// Create entry for manual
|
|
|
|
createManPageEntry(list, entry, name);
|
|
|
|
createManPageEntry(list, name);
|
|
|
|
|
|
|
|
|
|
|
|
//Create entry for folders in tmp dir
|
|
|
|
//Create entry for folders in tmp dir
|
|
|
|
createTmpDirEntry(list, entry, name);
|
|
|
|
createTmpDirEntry(list, name);
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|