Overall code clean up. Functionality still to be fixed up.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
r14.0.x
Michele Calgaro 3 years ago
parent 0df7d0722b
commit 872756fd1a
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -3,18 +3,19 @@ TDEIO appinfo
The appinfo:/ TDEIO slave combines an application's configuration, data, manual and The appinfo:/ TDEIO slave combines an application's configuration, data, manual and
temp files and folders into a single view. temp files and folders into a single view.
Type 'appinfo:/' followed by the application name you're interested in the Type 'app:/' followed by the application name you're interested in the
konqueror address bar to get information about the specified application. konqueror address bar to get information about the specified application.
Type 'appinfo:/' without an application name to list all the applications Type 'appinfo:/' without any application name to list all the applications
found in the usual suspect directories (e.g. /usr/bin, /usr/local/bin, etc.) found in the usual suspect directories (e.g. /usr/bin, /usr/local/bin, etc.).
This may take some time, during which Konqueror will be mostly irresponsive.
. .
Contributing Contributing
-------------- --------------
If you wish to contribute to katapult, you might do so: If you wish to contribute to tdeio-appinfo, you might do so:
- TDE Gitea Workspace (TGW) collaboration tool. - TDE Gitea Workspace (TGW) collaboration tool.
https://mirror.git.trinitydesktop.org/gitea https://mirror.git.trinitydesktop.org/gitea

@ -19,36 +19,12 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/ ***************************************************************************/
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <tqcstring.h>
#include <tqsocket.h>
#include <tqdatetime.h>
#include <tqbitarray.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <tdeapplication.h> #include <tqcstring.h>
#include <kdebug.h> #include <kdebug.h>
#include <tdemessagebox.h>
#include <kinstance.h> #include <kinstance.h>
#include <tdeglobal.h>
#include <kstandarddirs.h>
#include <tdelocale.h>
#include <kurl.h> #include <kurl.h>
#include <ksock.h>
#include "app.h" #include "app.h"
@ -56,178 +32,157 @@ using namespace TDEIO;
extern "C" extern "C"
{ {
int kdemain(int argc, char **argv) int kdemain(int argc, char **argv)
{
kdDebug(7101) << "*** Starting tdeio_app " << endl;
if (argc != 4)
{ {
TDEInstance instance( "tdeio_app" ); kdDebug(7101) << "Usage: tdeio_app protocol domain-socket1 domain-socket2" << endl;
exit(255);
kdDebug(7101) << "*** Starting tdeio_app " << endl;
if (argc != 4) {
kdDebug(7101) << "Usage: tdeio_app protocol domain-socket1 domain-socket2" << endl;
exit(-1);
}
tdeio_appProtocol slave(argv[2], argv[3]);
slave.dispatchLoop();
kdDebug(7101) << "*** tdeio_app Done" << endl;
return 0;
} }
}
TDEInstance instance("tdeio_app");
tdeio_appProtocol slave(argv[2], argv[3]);
slave.dispatchLoop();
return 0;
}
}
tdeio_appProtocol::tdeio_appProtocol(const TQCString &pool_socket, const TQCString &app_socket) tdeio_appProtocol::tdeio_appProtocol(const TQCString &pool_socket, const TQCString &app_socket)
: SlaveBase("tdeio_app", pool_socket, app_socket) : SlaveBase("tdeio_app", pool_socket, app_socket)
{ {
kdDebug() << "tdeio_appProtocol::tdeio_appProtocol()" << endl; kdDebug() << "tdeio_appProtocol::tdeio_appProtocol()" << endl;
} }
tdeio_appProtocol::~tdeio_appProtocol() tdeio_appProtocol::~tdeio_appProtocol()
{ {
kdDebug() << "tdeio_appProtocol::~tdeio_appProtocol()" << endl; kdDebug() << "tdeio_appProtocol::~tdeio_appProtocol()" << endl;
} }
void tdeio_appProtocol::stat(const KURL &url) void tdeio_appProtocol::stat(const KURL &url)
{ {
kdDebug() << "tdeio_appProtocol::stat: " << url << endl; kdDebug() << "tdeio_appProtocol::stat: " << url << endl;
TQString path = url.path(); TQString path = url.path();
if ( path.isEmpty() || path == "/" ) if (path.isEmpty() || path == "/")
{ {
kdDebug() << "tdeio_appProtocol::stat: " << "creating top level entry" << endl; kdDebug() << "tdeio_appProtocol::stat: " << "creating top level entry" << endl;
// The root is "virtual" - it's not a single physical directory // The root is "virtual" - it's not a single physical directory
TDEIO::UDSEntry entry; TDEIO::UDSEntry entry;
m_impl.createTopLevelEntry( entry ); m_impl.createTopLevelEntry(entry);
statEntry( entry ); statEntry(entry);
finished(); finished();
return; return;
} }
TQString name; TQString name;
bool ok = m_impl.parseURL(url, name, path); bool ok = m_impl.parseURL(url, name, path);
if (!ok)
if ( !ok ) {
{ kdDebug() << "tdeio_appProtocol::stat: " << "can't parse url" << endl;
kdDebug() << "tdeio_appProtocol::stat: " << "can't parse url" << endl; error(TDEIO::ERR_MALFORMED_URL, url.prettyURL());
error(TDEIO::ERR_MALFORMED_URL, url.prettyURL()); return;
return; }
}
if (path.isEmpty())
{
if( path.isEmpty() ) kdDebug() << "tdeio_appProtocol::stat: " << "url empty after parsing" << endl;
{
kdDebug() << "tdeio_appProtocol::stat4: " << "url empty after parsing" << endl; TDEIO::UDSEntry entry;
if (m_impl.statByName(name, entry))
TDEIO::UDSEntry entry; {
statEntry(entry);
if ( m_impl.statByName(name, entry) ) finished();
{ }
statEntry(entry); else
finished(); {
} error(TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL());
else }
{ }
error(TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL()); else
} {
} kdDebug() << "tdeio_appProtocol::stat: " << "url not empty after parsing: statting" << endl;
else SlaveBase::stat(url);
{ }
kdDebug() << "tdeio_appProtocol::stat4: " << "url not empty after parsing: statting" << endl;
SlaveBase::stat(url);
}
} }
void tdeio_appProtocol::listDir(const KURL &url) void tdeio_appProtocol::listDir(const KURL &url)
{ {
kdDebug() << "tdeio_appProtocol::listDir: " << url << endl; kdDebug() << "tdeio_appProtocol::listDir: " << url << endl;
if ( url.path().length() <= 1 ) if (url.path().length() <= 1)
{ {
kdDebug() << "tdeio_appProtocol::listDir: " << "url empty: listing root" << endl; kdDebug() << "tdeio_appProtocol::listDir: " << "url empty: listing root" << endl;
listRoot(); listRoot();
return; return;
} }
TQString name, path; TQString name, path;
bool ok = m_impl.parseURL(url, name, path); bool ok = m_impl.parseURL(url, name, path);
if (!ok)
if ( !ok ) {
{ error(TDEIO::ERR_MALFORMED_URL, url.prettyURL());
error(TDEIO::ERR_MALFORMED_URL, url.prettyURL()); return;
return; }
}
kdDebug() << "tdeio_appProtocol::listDir: " << "url is " << url << ": doing a listDir" << endl;
kdDebug() << "tdeio_appProtocol::listDir: " << "url is " << url << ": doing a listDir" << endl; kdDebug() << "tdeio_appProtocol::listDir: " << "name is " << name << ": doing a listDir" << endl;
kdDebug() << "tdeio_appProtocol::listDir: " << "name is " << name << ": doing a listDir" << endl; kdDebug() << "tdeio_appProtocol::listDir: " << "path is " << path << ": doing a listDir" << endl;
kdDebug() << "tdeio_appProtocol::listDir: " << "path is " << path << ": doing a listDir" << endl; // We've been given something like app:/appname
// We've been given something like app:/appname
listAppContents(name); listAppContents(name);
} }
void tdeio_appProtocol::listRoot() void tdeio_appProtocol::listRoot()
{ {
TDEIO::UDSEntry entry; TDEIO::UDSEntry entry;
TDEIO::UDSEntryList system_entries;
TDEIO::UDSEntryList system_entries; bool ok = m_impl.listRoot(system_entries);
bool ok = m_impl.listRoot(system_entries); if (!ok)
{
if (!ok) error(m_impl.lastErrorCode(), m_impl.lastErrorMessage());
{ return;
error( m_impl.lastErrorCode(), m_impl.lastErrorMessage() ); }
return;
} totalSize(system_entries.count() + 1);
totalSize(system_entries.count()+1); m_impl.createTopLevelEntry(entry);
listEntry(entry, false);
m_impl.createTopLevelEntry(entry); for(const UDSEntry &sysEntry : system_entries)
listEntry(entry, false); {
listEntry(sysEntry, false);
TDEIO::UDSEntryListIterator it = system_entries.begin(); }
TDEIO::UDSEntryListIterator end = system_entries.end();
entry.clear();
for(; it!=end; ++it) listEntry(entry, true);
{ finished();
listEntry(*it, false);
}
entry.clear();
listEntry(entry, true);
finished();
} }
void tdeio_appProtocol::listAppContents(const TQString &name) void tdeio_appProtocol::listAppContents(const TQString &name)
{ {
TDEIO::UDSEntry entry; TDEIO::UDSEntry entry;
TDEIO::UDSEntryList app_entries;
TDEIO::UDSEntryList app_entries; bool ok = m_impl.listAppContents(name, app_entries);
bool ok = m_impl.listAppContents(name, app_entries); if (!ok)
{
if (!ok) error(m_impl.lastErrorCode(), m_impl.lastErrorMessage());
{ return;
error( m_impl.lastErrorCode(), m_impl.lastErrorMessage() ); }
return;
} totalSize(app_entries.count() + 1);
totalSize(app_entries.count()+1); m_impl.createTopLevelEntry(entry);
listEntry(entry, false);
m_impl.createTopLevelEntry(entry); for(const UDSEntry &appEntry : app_entries)
listEntry(entry, false); {
listEntry(appEntry, false);
TDEIO::UDSEntryListIterator it = app_entries.begin(); }
TDEIO::UDSEntryListIterator end = app_entries.end();
entry.clear();
for(; it!=end; ++it) listEntry(entry, true);
{ finished();
listEntry(*it, false);
}
entry.clear();
listEntry(entry, true);
finished();
} }

@ -18,36 +18,30 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef _app_H_ #ifndef TDEIO_APP_H_
#define _app_H_ #define TDEIO_APP_H_
#include <tqstring.h>
#include <tqcstring.h>
#include <stdio.h>
#include <tdeio/tcpslavebase.h>
#include <kurl.h>
#include <tdeio/global.h>
#include <tdeio/slavebase.h> #include <tdeio/slavebase.h>
#include "appimpl.h" #include "appimpl.h"
class TQCString; class TQCString;
class TQString;
class KURL;
class tdeio_appProtocol : public TDEIO::SlaveBase class tdeio_appProtocol : public TDEIO::SlaveBase
{ {
public: public:
tdeio_appProtocol(const TQCString &pool_socket, const TQCString &app_socket); tdeio_appProtocol(const TQCString &pool_socket, const TQCString &app_socket);
virtual ~tdeio_appProtocol(); virtual ~tdeio_appProtocol();
virtual void listDir(const KURL & url); virtual void listDir(const KURL &url);
virtual void stat(const KURL & url); virtual void stat(const KURL &url);
private: private:
void listRoot(); void listRoot();
void listAppContents(const TQString &name); void listAppContents(const TQString &name);
AppImpl m_impl;
AppImpl m_impl;
}; };
#endif #endif

File diff suppressed because it is too large Load Diff

@ -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,90 +17,74 @@
* 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 #ifndef TDEIO_APPIMPL_H
modify it under the terms of the GNU Library General Public #define TDEIO_APPIMPL_H
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 APPIMPL_H
#define APPIMPL_H
#include <tdeio/global.h> #include <tdeio/global.h>
#include <tdeio/job.h>
#include <kurl.h>
#include <dcopobject.h>
#include <tqobject.h> #include <tqobject.h>
#include <tqstring.h> #include <tqstring.h>
#include <tqdir.h> #include <tqdir.h>
namespace TDEIO
{
class Job;
}
class KURL;
class AppImpl : public TQObject class AppImpl : public TQObject
{ {
Q_OBJECT Q_OBJECT
public: public:
AppImpl(); AppImpl();
void createTopLevelEntry(TDEIO::UDSEntry& entry) const; void createTopLevelEntry(TDEIO::UDSEntry &entry) const;
bool statByName(const TQString &filename, TDEIO::UDSEntry& entry); bool statByName(const TQString &filename, TDEIO::UDSEntry &entry);
bool listRoot(TQValueList<TDEIO::UDSEntry> &list); bool listRoot(TQValueList<TDEIO::UDSEntry> &list);
bool listAppContents(const TQString &name, TQValueList<TDEIO::UDSEntry> &list);
bool parseURL(const KURL &url, TQString &name, TQString &path) const; bool parseURL(const KURL &url, TQString &name, TQString &path) const;
bool realURL(const TQString &name, const TQString &path, KURL &url) const; bool realURL(const TQString &name, const TQString &path, KURL &url) const;
int lastErrorCode() const { return m_lastErrorCode; } int lastErrorCode() const { return m_lastErrorCode; }
TQString lastErrorMessage() const { return m_lastErrorMessage; } TQString lastErrorMessage() const { return m_lastErrorMessage; }
bool listAppContents(const TQString &name, TQValueList<TDEIO::UDSEntry> &list);
private slots: private slots:
KURL findBaseURL(const TQString &filename) const; KURL findBaseURL(const TQString &filename) const;
void slotEntries(TDEIO::Job *job, const TDEIO::UDSEntryList &list); void slotEntries(TDEIO::Job *job, const TDEIO::UDSEntryList &list);
void slotResult(TDEIO::Job *job); void slotResult(TDEIO::Job *job);
void createManPageEntry(TDEIO::UDSEntry &entry, void createManPageEntry(TDEIO::UDSEntry &entry, const TQString &shortname);
const TQString &shortname); void createExeEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
void createExeEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry, const TQString &shortname, const TQStringList &fullname);
const TQString &shortname, void createHomeDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
const TQStringList &fullname); const TQString &shortname);
void createHomeDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry, void createTDEDataDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
const TQString &shortname); const TQString &shortname);
void createKDEDataDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry, void createTDEConfigEntry(TDEIO::UDSEntry &entry, const TQString &shortname);
const TQString &shortname); void createStandardConfigEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
void createKDEConfigEntry(TDEIO::UDSEntry &entry, const TQString &shortname);
const TQString &shortname); void createStandardDataDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
void createStandardConfigEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry, const TQString &shortname);
const TQString &shortname); void createTmpDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
void createStandardDataDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry, const TQString &shortname);
const TQString &shortname);
void createTmpDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry, TQStringList getAppAddress(const TQString &name);
const TQString &shortname); TQStringList getFullLocation(const TQStringList &dirList, const TQString &name,
const TQDir::FilterSpec &filter, bool beginswith, bool recursive);
TQStringList getAppAddress(const TQString &name);
TQStringList getFullLocation(const TQStringList & dirList, const TQString &name,
const TQDir::FilterSpec &filter, bool beginswith, bool recursive);
private: private:
void createEntry(TDEIO::UDSEntry& entry, /*const TQString &directory,*/ void createEntry(TDEIO::UDSEntry& entry, const TQString &file);
const TQString &file);
bool m_lastListingEmpty; bool m_lastListingEmpty;
/// Last error code stored in class to simplify API. /// Last error code stored in class to simplify API.
/// Note that this means almost no method can be const. /// Note that this means almost no method can be const.
int m_lastErrorCode; int m_lastErrorCode;
TQString m_lastErrorMessage; TQString m_lastErrorMessage;
}; };
#endif #endif

Loading…
Cancel
Save