|
|
@ -1,5 +1,4 @@
|
|
|
|
/***************************************************************************
|
|
|
|
/***************************************************************************
|
|
|
|
* $Id: tork.cpp,v 1.160 2007/12/30 12:58:22 hoganrobert Exp $
|
|
|
|
|
|
|
|
* Copyright (C) 2006 by Robert Hogan *
|
|
|
|
* Copyright (C) 2006 by Robert Hogan *
|
|
|
|
* robert@roberthogan.net *
|
|
|
|
* robert@roberthogan.net *
|
|
|
|
* *
|
|
|
|
* *
|
|
|
@ -18,41 +17,20 @@
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
|
|
|
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
|
|
|
***************************************************************************/
|
|
|
|
***************************************************************************/
|
|
|
|
/* This file is part of the KDE project
|
|
|
|
|
|
|
|
Copyright (c) 2004 Kevin Ottens <ervin ipsquad net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "appimpl.h"
|
|
|
|
#include "appimpl.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <tqapplication.h>
|
|
|
|
|
|
|
|
#include <tqeventloop.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include <kdebug.h>
|
|
|
|
#include <kdebug.h>
|
|
|
|
#include <tdeglobalsettings.h>
|
|
|
|
|
|
|
|
#include <kstandarddirs.h>
|
|
|
|
#include <kstandarddirs.h>
|
|
|
|
#include <kdesktopfile.h>
|
|
|
|
#include <kdesktopfile.h>
|
|
|
|
#include <tdelocale.h>
|
|
|
|
#include <tdelocale.h>
|
|
|
|
#include <kiconloader.h>
|
|
|
|
|
|
|
|
#include <kservice.h>
|
|
|
|
#include <kservice.h>
|
|
|
|
#include <kservicegroup.h>
|
|
|
|
#include <kservicegroup.h>
|
|
|
|
|
|
|
|
#include <tdeio/job.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include <tqapplication.h>
|
|
|
|
|
|
|
|
#include <tqeventloop.h>
|
|
|
|
|
|
|
|
#include <tqdir.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -62,58 +40,43 @@ AppImpl::AppImpl() : TQObject()
|
|
|
|
|
|
|
|
|
|
|
|
bool AppImpl::listRoot(TQValueList<TDEIO::UDSEntry> &list)
|
|
|
|
bool AppImpl::listRoot(TQValueList<TDEIO::UDSEntry> &list)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
kdDebug() << "AppImpl::listRoot" << endl;
|
|
|
|
kdDebug() << "AppImpl::listRoot" << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList dirList = TQStringList::split(":", getenv("PATH"));
|
|
|
|
TQStringList dirList = TQStringList::split(":",getenv("PATH"));
|
|
|
|
|
|
|
|
kdDebug() << dirList << endl;
|
|
|
|
kdDebug() << dirList << endl;
|
|
|
|
TQStringList names_found;
|
|
|
|
|
|
|
|
// TQStringList dirList;
|
|
|
|
|
|
|
|
// dirList << "/usr/local/bin/";
|
|
|
|
|
|
|
|
// dirList << "/usr/bin/";
|
|
|
|
|
|
|
|
// dirList << "/usr/sbin/";
|
|
|
|
|
|
|
|
// dirList << "/bin/";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList names_found;
|
|
|
|
TQStringList::ConstIterator dirpath = dirList.begin();
|
|
|
|
for (const TQString &dirName : dirList)
|
|
|
|
TQStringList::ConstIterator end = dirList.end();
|
|
|
|
|
|
|
|
for(; dirpath!=end; ++dirpath)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQDir dir = *dirpath;
|
|
|
|
TQDir dir(dirName);
|
|
|
|
if (!dir.exists()) continue;
|
|
|
|
if (!dir.exists())
|
|
|
|
|
|
|
|
{
|
|
|
|
TQStringList filenames
|
|
|
|
continue;
|
|
|
|
= dir.entryList( TQDir::Files | TQDir::Readable );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList filenames = dir.entryList(TQDir::Files | TQDir::Readable);
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
|
|
|
|
for(const TQString &filename : filenames)
|
|
|
|
TQStringList::ConstIterator filename = filenames.begin();
|
|
|
|
|
|
|
|
TQStringList::ConstIterator endf = filenames.end();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(; filename!=endf; ++filename)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!names_found.contains(*filename))
|
|
|
|
if (!names_found.contains(filename))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
entry.clear();
|
|
|
|
entry.clear();
|
|
|
|
createEntry(entry, /**dirpath,*/ *filename);
|
|
|
|
createEntry(entry, filename);
|
|
|
|
if ( !entry.isEmpty() )
|
|
|
|
if (!entry.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
list.append(entry);
|
|
|
|
list.append(entry);
|
|
|
|
names_found.append(*filename);
|
|
|
|
names_found.append(filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
kdDebug() << "AppImpl::listRoot" << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool AppImpl::parseURL(const KURL &url, TQString &name, TQString &path) const
|
|
|
|
bool AppImpl::parseURL(const KURL &url, TQString &name, TQString &path) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
kdDebug() << "AppImpl::parseURL" << endl;
|
|
|
|
TQString url_path = url.path();
|
|
|
|
TQString url_path = url.path();
|
|
|
|
|
|
|
|
|
|
|
|
int i = url_path.find('/', 1);
|
|
|
|
int i = url_path.find('/', 1);
|
|
|
@ -128,11 +91,10 @@ bool AppImpl::parseURL(const KURL &url, TQString &name, TQString &path) const
|
|
|
|
path = TQString::null;
|
|
|
|
path = TQString::null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return name != TQString::null;
|
|
|
|
return !name.isEmpty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool AppImpl::realURL(const TQString &name, const TQString &path,
|
|
|
|
bool AppImpl::realURL(const TQString &name, const TQString &path, KURL &url) const
|
|
|
|
KURL &url) const
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
url = findBaseURL(name);
|
|
|
|
url = findBaseURL(name);
|
|
|
|
if (!url.isValid())
|
|
|
|
if (!url.isValid())
|
|
|
@ -146,33 +108,29 @@ bool AppImpl::realURL(const TQString &name, const TQString &path,
|
|
|
|
|
|
|
|
|
|
|
|
bool AppImpl::statByName(const TQString &filename, TDEIO::UDSEntry& entry)
|
|
|
|
bool AppImpl::statByName(const TQString &filename, TDEIO::UDSEntry& entry)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
kdDebug() << "AppImpl::statByName" << endl;
|
|
|
|
kdDebug() << "AppImpl::statByName" << endl;
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList dirList;
|
|
|
|
TQStringList dirList;
|
|
|
|
dirList << "/usr/local/bin/";
|
|
|
|
|
|
|
|
dirList << "/usr/bin/";
|
|
|
|
dirList << "/usr/bin/";
|
|
|
|
|
|
|
|
dirList << "/usr/local/bin/";
|
|
|
|
|
|
|
|
dirList << "/opt/trinity/bin/";
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList::ConstIterator dirpath = dirList.begin();
|
|
|
|
TQStringList names_found;
|
|
|
|
TQStringList::ConstIterator end = dirList.end();
|
|
|
|
for (const TQString &dirName : dirList)
|
|
|
|
for(; dirpath!=end; ++dirpath)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQDir dir = *dirpath;
|
|
|
|
TQDir dir(dirName);
|
|
|
|
if (!dir.exists()) continue;
|
|
|
|
if (!dir.exists())
|
|
|
|
|
|
|
|
{
|
|
|
|
TQStringList filenames
|
|
|
|
continue;
|
|
|
|
= dir.entryList( TQDir::Files | TQDir::Readable );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList::ConstIterator name = filenames.begin();
|
|
|
|
|
|
|
|
TQStringList::ConstIterator endf = filenames.end();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(; name!=endf; ++name)
|
|
|
|
TQStringList filenames = dir.entryList(TQDir::Files | TQDir::Readable);
|
|
|
|
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
|
|
|
|
for (const TQString &fname : filenames)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (*name==filename)
|
|
|
|
if (fname == filename)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
createEntry(entry, /**dirpath,*/ *name);
|
|
|
|
createEntry(entry, fname);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -186,35 +144,27 @@ KURL AppImpl::findBaseURL(const TQString &filename) const
|
|
|
|
kdDebug() << "AppImpl::findBaseURL" << endl;
|
|
|
|
kdDebug() << "AppImpl::findBaseURL" << endl;
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList dirList = TDEGlobal::dirs()->resourceDirs("system_entries");
|
|
|
|
TQStringList dirList = TDEGlobal::dirs()->resourceDirs("system_entries");
|
|
|
|
|
|
|
|
for (const TQString &dirName : dirList)
|
|
|
|
TQStringList::ConstIterator dirpath = dirList.begin();
|
|
|
|
|
|
|
|
TQStringList::ConstIterator end = dirList.end();
|
|
|
|
|
|
|
|
for(; dirpath!=end; ++dirpath)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQDir dir = *dirpath;
|
|
|
|
TQDir dir(dirName);
|
|
|
|
if (!dir.exists()) continue;
|
|
|
|
if (!dir.exists())
|
|
|
|
|
|
|
|
{
|
|
|
|
TQStringList filenames
|
|
|
|
continue;
|
|
|
|
= dir.entryList( TQDir::Files | TQDir::Readable );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList filenames = dir.entryList(TQDir::Files | TQDir::Readable);
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
|
|
|
|
for (const TQString &fname : filenames)
|
|
|
|
TQStringList::ConstIterator name = filenames.begin();
|
|
|
|
|
|
|
|
TQStringList::ConstIterator endf = filenames.end();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(; name!=endf; ++name)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (*name==filename+".desktop")
|
|
|
|
if (fname == filename + ".desktop")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KDesktopFile desktop(*dirpath+filename+".desktop", true);
|
|
|
|
KDesktopFile desktop(dirName + fname, true);
|
|
|
|
if ( desktop.readURL().isEmpty() )
|
|
|
|
if (desktop.readURL().isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KURL url;
|
|
|
|
KURL url;
|
|
|
|
url.setPath( desktop.readPath() );
|
|
|
|
url.setPath(desktop.readPath());
|
|
|
|
return url;
|
|
|
|
return url;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return desktop.readURL();
|
|
|
|
return desktop.readURL();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -234,7 +184,6 @@ static void addAtom(TDEIO::UDSEntry &entry, unsigned int ID, long l,
|
|
|
|
entry.append(atom);
|
|
|
|
entry.append(atom);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createTopLevelEntry(TDEIO::UDSEntry &entry) const
|
|
|
|
void AppImpl::createTopLevelEntry(TDEIO::UDSEntry &entry) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
entry.clear();
|
|
|
|
entry.clear();
|
|
|
@ -245,273 +194,223 @@ void AppImpl::createTopLevelEntry(TDEIO::UDSEntry &entry) const
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "system");
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "system");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createEntry(TDEIO::UDSEntry &entry,
|
|
|
|
void AppImpl::createEntry(TDEIO::UDSEntry &entry, const TQString &file)
|
|
|
|
// const TQString &directory,
|
|
|
|
|
|
|
|
const TQString &file)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
entry.clear();
|
|
|
|
entry.clear();
|
|
|
|
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, file);
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, file);
|
|
|
|
|
|
|
|
|
|
|
|
TQString new_filename = file;
|
|
|
|
TQString new_filename = file;
|
|
|
|
new_filename.truncate(file.length()-8);
|
|
|
|
new_filename.truncate(file.length() - 8);
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, "app:/"+new_filename);
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, "app:/" + new_filename);
|
|
|
|
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
|
|
|
|
|
|
|
|
|
|
|
|
KService::Ptr service = KService::serviceByDesktopName( new_filename );
|
|
|
|
KService::Ptr service = KService::serviceByDesktopName(new_filename);
|
|
|
|
if (service && service->isValid())
|
|
|
|
if (service && service->isValid())
|
|
|
|
|
|
|
|
{
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, service->icon());
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, service->icon());
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "binary");
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "binary");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createExeEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
|
|
|
|
void AppImpl::createExeEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
|
|
|
|
const TQString &shortname,
|
|
|
|
const TQString &shortname,
|
|
|
|
const TQStringList &fullname)
|
|
|
|
const TQStringList &fullname)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
for (const TQString &name : fullname)
|
|
|
|
|
|
|
|
{
|
|
|
|
for ( TQStringList::ConstIterator it = fullname.begin(); it != fullname.end(); ++it )
|
|
|
|
if (name.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ((*it).isEmpty())
|
|
|
|
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
entry.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* TQStringList dirList = TDEGlobal::instance()->dirs()->resourceDirs("apps");
|
|
|
|
|
|
|
|
kdDebug() << dirList << endl;
|
|
|
|
|
|
|
|
TQStringList desktop = getFullLocation(dirList,shortname+".desktop",
|
|
|
|
|
|
|
|
TQDir::FilterSpec(TQDir::Files | TQDir::Dirs | TQDir::Readable),
|
|
|
|
|
|
|
|
false,true);
|
|
|
|
|
|
|
|
kdDebug() << desktop << endl;*/
|
|
|
|
|
|
|
|
KService::Ptr service = KService::serviceByDesktopName( shortname );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (!desktop.isEmpty()){
|
|
|
|
|
|
|
|
if (service && service->isValid()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// for ( TQStringList::Iterator dit = desktop.begin(); dit != desktop.end(); ++dit )
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// if ((*dit).isEmpty())
|
|
|
|
|
|
|
|
// continue;
|
|
|
|
|
|
|
|
// entry.clear();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entry.clear();
|
|
|
|
|
|
|
|
KService::Ptr service = KService::serviceByDesktopName(shortname);
|
|
|
|
|
|
|
|
if (service && service->isValid())
|
|
|
|
|
|
|
|
{
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Application (%1)").arg(service->name()));
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Application (%1)").arg(service->name()));
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, locate("apps", service->desktopEntryPath()));
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, locate("apps", service->desktopEntryPath()));
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG);
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "application/x-desktop");
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "application/x-desktop");
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, service->icon());
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, service->icon());
|
|
|
|
// createFileEntry(entry, service->name(), url.url(1)+service->desktopEntryName(),
|
|
|
|
|
|
|
|
// "application/x-desktop", service->icon(), locate("apps",
|
|
|
|
|
|
|
|
// service->desktopEntryPath()) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( !entry.isEmpty() )
|
|
|
|
|
|
|
|
list.append(entry);
|
|
|
|
list.append(entry);
|
|
|
|
// }
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Application (%1)").arg(*it));
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Application (%1)").arg(name));
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, *it);
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, name);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG);
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "application");
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "application");
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "binary");
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "binary");
|
|
|
|
if ( !entry.isEmpty() )
|
|
|
|
|
|
|
|
list.append(entry);
|
|
|
|
list.append(entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createManPageEntry(TDEIO::UDSEntry &entry,
|
|
|
|
void AppImpl::createManPageEntry(TDEIO::UDSEntry &entry, const TQString &shortname)
|
|
|
|
const TQString &shortname)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
entry.clear();
|
|
|
|
entry.clear();
|
|
|
|
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Manual for %1").arg(shortname));
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Manual for %1").arg(shortname));
|
|
|
|
|
|
|
|
|
|
|
|
/* TQString new_filename = file;
|
|
|
|
|
|
|
|
new_filename.truncate(file.length()-8);*/
|
|
|
|
|
|
|
|
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);
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "application/x-desktop");
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "application/x-desktop");
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "man");
|
|
|
|
TQString icon = "man";
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, icon);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createHomeDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
|
|
|
|
void AppImpl::createHomeDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
|
|
|
|
const TQString &shortname)
|
|
|
|
const TQString &shortname)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList homedir;
|
|
|
|
TQStringList homedir;
|
|
|
|
homedir << TQString("%1/").arg(getenv("HOME"));
|
|
|
|
homedir << TQString("%1/").arg(getenv("HOME"));
|
|
|
|
|
|
|
|
TQString dirname = "." + shortname;
|
|
|
|
|
|
|
|
TQStringList fullname = getFullLocation(homedir, dirname,
|
|
|
|
|
|
|
|
TQDir::FilterSpec(TQDir::Hidden | TQDir::Dirs | TQDir::Readable), true, false);
|
|
|
|
|
|
|
|
|
|
|
|
TQString dirname = "."+shortname;
|
|
|
|
for (const TQString &fname : fullname)
|
|
|
|
TQStringList fullname = getFullLocation(homedir,dirname,
|
|
|
|
{
|
|
|
|
TQDir::FilterSpec(TQDir::Hidden | TQDir::Dirs | TQDir::Readable),
|
|
|
|
if (fname.isEmpty())
|
|
|
|
true, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ( TQStringList::Iterator it = fullname.begin(); it != fullname.end(); ++it )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ((*it).isEmpty())
|
|
|
|
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
entry.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("User Data (%1)").arg(*it));
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, *it);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entry.clear();
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("User Data (%1)").arg(fname));
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, fname);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "cachefolder");
|
|
|
|
TQString icon = "cachefolder";
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, icon);
|
|
|
|
|
|
|
|
if ( !entry.isEmpty() )
|
|
|
|
|
|
|
|
list.append(entry);
|
|
|
|
list.append(entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createKDEDataDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
|
|
|
|
void AppImpl::createTDEDataDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
|
|
|
|
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 KDEDataDir = getFullLocation(dirList,shortname,
|
|
|
|
|
|
|
|
TQDir::FilterSpec(TQDir::Dirs | TQDir::Readable), false, false);
|
|
|
|
TQDir::FilterSpec(TQDir::Dirs | TQDir::Readable), false, false);
|
|
|
|
if (KDEDataDir.isEmpty())
|
|
|
|
if (TDEDataDir.isEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const TQString &dirname : TDEDataDir)
|
|
|
|
for ( TQStringList::Iterator it = KDEDataDir.begin(); it != KDEDataDir.end(); ++it )
|
|
|
|
{
|
|
|
|
|
|
|
|
if (dirname.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ((*it).isEmpty())
|
|
|
|
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
entry.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("App Data (%1)").arg(*it));
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, *it);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entry.clear();
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("App Data (%1)").arg(dirname));
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, dirname);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "binaryfolder");
|
|
|
|
TQString icon = "binaryfolder";
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, icon);
|
|
|
|
|
|
|
|
if ( !entry.isEmpty() )
|
|
|
|
|
|
|
|
list.append(entry);
|
|
|
|
list.append(entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createStandardDataDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
|
|
|
|
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/";
|
|
|
|
dirList << "/usr/local/share/";
|
|
|
|
dirList << "/usr/local/share/";
|
|
|
|
|
|
|
|
dirList << "/opt/trinity/share/";
|
|
|
|
TQStringList StandardDataDir =
|
|
|
|
TQStringList StandardDataDir = getFullLocation(dirList, shortname,
|
|
|
|
getFullLocation(dirList,shortname,
|
|
|
|
TQDir::FilterSpec(TQDir::Files | TQDir::Dirs | TQDir::Readable), true, false);
|
|
|
|
TQDir::FilterSpec(TQDir::Files | TQDir::Dirs | TQDir::Readable),
|
|
|
|
|
|
|
|
true, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StandardDataDir.isEmpty())
|
|
|
|
if (StandardDataDir.isEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for ( TQStringList::Iterator it = StandardDataDir.begin(); it != StandardDataDir.end(); ++it )
|
|
|
|
for (const TQString &dirname : StandardDataDir)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (dirname.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ((*it).isEmpty())
|
|
|
|
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
entry.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("App Data (%1)").arg(*it));
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, *it);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entry.clear();
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("App Data (%1)").arg(dirname));
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, dirname);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "binaryfolder");
|
|
|
|
TQString icon = "binaryfolder";
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, icon);
|
|
|
|
|
|
|
|
if ( !entry.isEmpty() )
|
|
|
|
|
|
|
|
list.append(entry);
|
|
|
|
list.append(entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createKDEConfigEntry(TDEIO::UDSEntry &entry,
|
|
|
|
void AppImpl::createTDEConfigEntry(TDEIO::UDSEntry &entry, const TQString &shortname)
|
|
|
|
const TQString &shortname)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
TQString TDEDataDir = locate("config", shortname + "rc");
|
|
|
|
entry.clear();
|
|
|
|
kdDebug() << "TDEDataDir: " << TDEDataDir << endl;
|
|
|
|
|
|
|
|
if (TDEDataDir.isEmpty())
|
|
|
|
TQString KDEDataDir = locate("config", shortname+"rc");
|
|
|
|
{
|
|
|
|
kdDebug() << "KDEDataDir: " << KDEDataDir << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (KDEDataDir.isEmpty())
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Config File (%1)").arg(KDEDataDir));
|
|
|
|
entry.clear();
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, KDEDataDir);
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Config File (%1)").arg(TDEDataDir));
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, TDEDataDir);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "text/plain");
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "text/plain");
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "configure");
|
|
|
|
TQString icon = "configure";
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, icon);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::createStandardConfigEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
|
|
|
|
void AppImpl::createStandardConfigEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
|
|
|
|
const TQString &shortname)
|
|
|
|
const TQString &shortname)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList dirList;
|
|
|
|
TQStringList dirList;
|
|
|
|
dirList << "/etc/";
|
|
|
|
dirList << "/etc/";
|
|
|
|
dirList << "/usr/local/etc/";
|
|
|
|
|
|
|
|
dirList << "/usr/etc/";
|
|
|
|
dirList << "/usr/etc/";
|
|
|
|
|
|
|
|
dirList << "/usr/local/etc/";
|
|
|
|
TQStringList StandardConfigFile =
|
|
|
|
dirList << "/opt/trinity/etc/";
|
|
|
|
getFullLocation(dirList,shortname,
|
|
|
|
TQStringList StandardConfigFile = getFullLocation(dirList,shortname,
|
|
|
|
TQDir::FilterSpec(TQDir::Files | TQDir::Dirs | TQDir::Readable),
|
|
|
|
TQDir::FilterSpec(TQDir::Files | TQDir::Dirs | TQDir::Readable), true, false);
|
|
|
|
true, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StandardConfigFile.isEmpty())
|
|
|
|
if (StandardConfigFile.isEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for ( TQStringList::Iterator it = StandardConfigFile.begin(); it != StandardConfigFile.end(); ++it )
|
|
|
|
for (const TQString &fname : StandardConfigFile)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (fname.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ((*it).isEmpty())
|
|
|
|
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
entry.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entry.clear();
|
|
|
|
bool isFolder = false;
|
|
|
|
bool isFolder = false;
|
|
|
|
TQFileInfo fi(*it);
|
|
|
|
TQFileInfo fi(fname);
|
|
|
|
if (fi.isDir())
|
|
|
|
if (fi.isDir())
|
|
|
|
|
|
|
|
{
|
|
|
|
isFolder = true;
|
|
|
|
isFolder = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
kdDebug() << "createStandardConfigEntry: " << *it << endl;
|
|
|
|
kdDebug() << "createStandardConfigEntry: " << fname << endl;
|
|
|
|
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, *it);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, fname);
|
|
|
|
TQString icon;
|
|
|
|
TQString icon;
|
|
|
|
if (isFolder){
|
|
|
|
if (isFolder)
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Config Data(%1)").arg(*it));
|
|
|
|
{
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Config Data(%1)").arg(fname));
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
|
|
|
|
icon = "configfolder";
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "configfolder");
|
|
|
|
}else{
|
|
|
|
}
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Config File(%1)").arg(*it));
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Config File(%1)").arg(fname));
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG);
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "text/plain");
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "text/plain");
|
|
|
|
icon = "configure";
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "configure");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, icon);
|
|
|
|
|
|
|
|
if ( !entry.isEmpty() )
|
|
|
|
|
|
|
|
list.append(entry);
|
|
|
|
list.append(entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -519,55 +418,54 @@ 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, TDEIO::UDSEntry &entry,
|
|
|
|
const TQString &shortname)
|
|
|
|
const TQString &shortname)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList dirList;
|
|
|
|
TQStringList dirList;
|
|
|
|
dirList << "/tmp/";
|
|
|
|
dirList << "/tmp/";
|
|
|
|
|
|
|
|
TQStringList TmpDir = getFullLocation(dirList,shortname,
|
|
|
|
TQStringList TmpDir =
|
|
|
|
TQDir::FilterSpec(TQDir::Files | TQDir::Dirs | TQDir::Readable), true, true);
|
|
|
|
getFullLocation(dirList,shortname,
|
|
|
|
|
|
|
|
TQDir::FilterSpec(TQDir::Files | TQDir::Dirs | TQDir::Readable),
|
|
|
|
|
|
|
|
true, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (TmpDir.isEmpty())
|
|
|
|
if (TmpDir.isEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for ( TQStringList::Iterator it = TmpDir.begin(); it != TmpDir.end(); ++it )
|
|
|
|
for (const TQString &fname : TmpDir)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (fname.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ((*it).isEmpty())
|
|
|
|
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
entry.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entry.clear();
|
|
|
|
bool isFolder = false;
|
|
|
|
bool isFolder = false;
|
|
|
|
TQFileInfo fi(*it);
|
|
|
|
TQFileInfo fi(fname);
|
|
|
|
if (fi.isDir())
|
|
|
|
if (fi.isDir())
|
|
|
|
|
|
|
|
{
|
|
|
|
isFolder = true;
|
|
|
|
isFolder = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
kdDebug() << "createTmpDirEntry: " << *it << endl;
|
|
|
|
kdDebug() << "createTmpDirEntry: " << fname << endl;
|
|
|
|
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, *it);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQString icon;
|
|
|
|
addAtom(entry, TDEIO::UDS_URL, 0, fname);
|
|
|
|
if (isFolder){
|
|
|
|
if (isFolder)
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Tmp Data (%1)").arg(*it));
|
|
|
|
{
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Tmp Data (%1)").arg(fname));
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
|
|
|
|
icon = "tmpfolder";
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "tmpfolder");
|
|
|
|
}else{
|
|
|
|
}
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Tmp File (%1)").arg(*it));
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Tmp File (%1)").arg(fname));
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG);
|
|
|
|
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG);
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "text/plain");
|
|
|
|
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "text/plain");
|
|
|
|
icon = "eraser";
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "eraser");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, icon);
|
|
|
|
|
|
|
|
if ( !entry.isEmpty() )
|
|
|
|
|
|
|
|
list.append(entry);
|
|
|
|
list.append(entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppImpl::slotEntries(TDEIO::Job *job, const TDEIO::UDSEntryList &list)
|
|
|
|
void AppImpl::slotEntries(TDEIO::Job *job, const TDEIO::UDSEntryList &list)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (list.size()>0)
|
|
|
|
if (list.size() > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
job->kill(true);
|
|
|
|
job->kill(true);
|
|
|
|
m_lastListingEmpty = false;
|
|
|
|
m_lastListingEmpty = false;
|
|
|
@ -582,115 +480,126 @@ void AppImpl::slotResult(TDEIO::Job *)
|
|
|
|
|
|
|
|
|
|
|
|
bool AppImpl::listAppContents(const TQString &name, TQValueList<TDEIO::UDSEntry> &list)
|
|
|
|
bool AppImpl::listAppContents(const TQString &name, TQValueList<TDEIO::UDSEntry> &list)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
kdDebug() << "AppImpl::listAppEntries" << endl;
|
|
|
|
kdDebug() << "AppImpl::listAppEntries" << endl;
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
|
|
|
|
|
|
|
|
//Create entry for binary file
|
|
|
|
// Create entry for binary file
|
|
|
|
entry.clear();
|
|
|
|
entry.clear();
|
|
|
|
createExeEntry(list,entry,name,getAppAddress(name));
|
|
|
|
createExeEntry(list, entry, name, getAppAddress(name));
|
|
|
|
// if ( !entry.isEmpty() )
|
|
|
|
if (!entry.isEmpty())
|
|
|
|
// list.append(entry);
|
|
|
|
{
|
|
|
|
|
|
|
|
list.append(entry);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Create entry for man page
|
|
|
|
// Create entry for man page
|
|
|
|
entry.clear();
|
|
|
|
entry.clear();
|
|
|
|
createManPageEntry(entry,name);
|
|
|
|
createManPageEntry(entry, name);
|
|
|
|
if ( !entry.isEmpty() )
|
|
|
|
if (!entry.isEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
list.append(entry);
|
|
|
|
list.append(entry);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Create entry for apps folder in home dir
|
|
|
|
// Create entry for apps folder in home dir
|
|
|
|
entry.clear();
|
|
|
|
entry.clear();
|
|
|
|
createHomeDirEntry(list,entry,name);
|
|
|
|
createHomeDirEntry(list, entry, name);
|
|
|
|
// if ( !entry.isEmpty() )
|
|
|
|
if (!entry.isEmpty())
|
|
|
|
// list.append(entry);
|
|
|
|
{
|
|
|
|
|
|
|
|
list.append(entry);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Create entry for apps folder in home dir
|
|
|
|
// Create entry for apps folder in home dir
|
|
|
|
entry.clear();
|
|
|
|
entry.clear();
|
|
|
|
createKDEDataDirEntry(list,entry,name);
|
|
|
|
createTDEDataDirEntry(list, entry, name);
|
|
|
|
// if ( !entry.isEmpty() )
|
|
|
|
if (!entry.isEmpty())
|
|
|
|
// list.append(entry);
|
|
|
|
{
|
|
|
|
|
|
|
|
list.append(entry);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Create entry for apps folder in home dir
|
|
|
|
// Create entry for apps folder in home dir
|
|
|
|
entry.clear();
|
|
|
|
entry.clear();
|
|
|
|
createStandardDataDirEntry(list,entry,name);
|
|
|
|
createStandardDataDirEntry(list, entry, name);
|
|
|
|
// if ( !entry.isEmpty() )
|
|
|
|
if (!entry.isEmpty())
|
|
|
|
// list.append(entry);
|
|
|
|
{
|
|
|
|
|
|
|
|
list.append(entry);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Create entry for apps folder in home dir
|
|
|
|
// Create entry for apps folder in home dir
|
|
|
|
entry.clear();
|
|
|
|
entry.clear();
|
|
|
|
createKDEConfigEntry(entry,name);
|
|
|
|
createTDEConfigEntry(entry, name);
|
|
|
|
if ( !entry.isEmpty() )
|
|
|
|
if (!entry.isEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
list.append(entry);
|
|
|
|
list.append(entry);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Create entry for apps folder in home dir
|
|
|
|
// Create entry for apps folder in home dir
|
|
|
|
entry.clear();
|
|
|
|
entry.clear();
|
|
|
|
createStandardConfigEntry(list,entry,name);
|
|
|
|
createStandardConfigEntry(list, entry, name);
|
|
|
|
// if ( !entry.isEmpty() )
|
|
|
|
if (!entry.isEmpty())
|
|
|
|
// list.append(entry);
|
|
|
|
{
|
|
|
|
|
|
|
|
list.append(entry);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Create entry for apps folder in home dir
|
|
|
|
//Create entry for apps folder in home dir
|
|
|
|
entry.clear();
|
|
|
|
entry.clear();
|
|
|
|
createTmpDirEntry(list,entry,name);
|
|
|
|
createTmpDirEntry(list, entry, name);
|
|
|
|
|
|
|
|
if (!entry.isEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
list.append(entry);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList AppImpl::getAppAddress(const TQString &name)
|
|
|
|
TQStringList AppImpl::getAppAddress(const TQString &name)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList dirList;
|
|
|
|
TQStringList dirList;
|
|
|
|
dirList << "/usr/local/bin/";
|
|
|
|
|
|
|
|
dirList << "/usr/bin/";
|
|
|
|
dirList << "/usr/bin/";
|
|
|
|
|
|
|
|
dirList << "/usr/local/bin/";
|
|
|
|
return getFullLocation(dirList,name, TQDir::FilterSpec(TQDir::Files | TQDir::Readable),false, false);
|
|
|
|
dirList << "/opt/trinity/bin/";
|
|
|
|
|
|
|
|
return getFullLocation(dirList, name,
|
|
|
|
|
|
|
|
TQDir::FilterSpec(TQDir::Files | TQDir::Readable), false, false);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList AppImpl::getFullLocation(const TQStringList &dirList, const TQString &name,
|
|
|
|
TQStringList AppImpl::getFullLocation(const TQStringList &dirList, const TQString &name,
|
|
|
|
const TQDir::FilterSpec &filter, bool beginswith, bool recursive)
|
|
|
|
const TQDir::FilterSpec &filter, bool beginswith, bool recursive)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList finds;
|
|
|
|
TQStringList finds;
|
|
|
|
TQStringList::ConstIterator dirpath = dirList.begin();
|
|
|
|
for (const TQString &dirpath : dirList)
|
|
|
|
TQStringList::ConstIterator end = dirList.end();
|
|
|
|
|
|
|
|
for(; dirpath!=end; ++dirpath)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQDir dir = *dirpath;
|
|
|
|
TQDir dir = dirpath;
|
|
|
|
if (!dir.exists()) continue;
|
|
|
|
if (!dir.exists())
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList filenames
|
|
|
|
|
|
|
|
= dir.entryList( filter );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList::ConstIterator filename = filenames.begin();
|
|
|
|
|
|
|
|
TQStringList::ConstIterator endf = filenames.end();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(; filename!=endf; ++filename)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((recursive) && ((*filename != "..")&&(*filename != "."))){
|
|
|
|
TQStringList filenames = dir.entryList(filter);
|
|
|
|
TQFileInfo fi(*dirpath+*filename);
|
|
|
|
for (const TQString &filename : dirList)
|
|
|
|
if (fi.isDir()){
|
|
|
|
{
|
|
|
|
|
|
|
|
if (recursive && filename != ".." && filename != ".")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TQFileInfo fi(dirpath + filename);
|
|
|
|
|
|
|
|
if (fi.isDir())
|
|
|
|
|
|
|
|
{
|
|
|
|
TQStringList recurfinds;
|
|
|
|
TQStringList recurfinds;
|
|
|
|
recurfinds = getFullLocation(TQStringList(*dirpath+*filename+"/"),
|
|
|
|
recurfinds = getFullLocation(TQStringList(dirpath + filename + "/"),
|
|
|
|
name, filter, beginswith, recursive);
|
|
|
|
name, filter, beginswith, recursive);
|
|
|
|
if (!recurfinds.isEmpty()){
|
|
|
|
if (!recurfinds.isEmpty())
|
|
|
|
for ( TQStringList::Iterator it = recurfinds.begin();
|
|
|
|
{
|
|
|
|
it != recurfinds.end(); ++it )
|
|
|
|
for (const TQString &recurFilename : recurfinds)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (recurFilename.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ((*it).isEmpty())
|
|
|
|
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
finds << (*it);
|
|
|
|
}
|
|
|
|
|
|
|
|
finds << recurFilename;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((name == *filename) ||
|
|
|
|
if (name == filename || (beginswith && filename.startsWith(name)))
|
|
|
|
((beginswith) && (*filename).startsWith(name)))
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
finds << *dirpath+*filename;
|
|
|
|
finds << dirpath + filename;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|