summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2022-05-07 00:27:45 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2022-05-07 00:27:45 +0900
commitefc48a5ae9afcdb9356dbb0e3f6fbba2a69ca106 (patch)
tree86661f2b1309bc1e001eae27910596c0af31958d
parent872756fd1a214b32d8dceb49661a3ce9b464d04d (diff)
downloadtdeio-appinfo-efc48a5ae9afcdb9356dbb0e3f6fbba2a69ca106.tar.gz
tdeio-appinfo-efc48a5ae9afcdb9356dbb0e3f6fbba2a69ca106.zip
Fixed functionality.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r--README.md2
-rw-r--r--src/app.cpp27
-rw-r--r--src/appimpl.cpp119
-rw-r--r--src/appimpl.h8
4 files changed, 50 insertions, 106 deletions
diff --git a/README.md b/README.md
index 2554798..7e94f24 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@ TDEIO appinfo
The appinfo:/ TDEIO slave combines an application's configuration, data, manual and
temp files and folders into a single view.
-Type 'app:/' followed by the application name you're interested in the
+Type 'appinfo:/' followed by the application name you're interested in the
konqueror address bar to get information about the specified application.
Type 'appinfo:/' without any application name to list all the applications
diff --git a/src/app.cpp b/src/app.cpp
index da5135e..6580df8 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -129,17 +129,15 @@ void tdeio_appProtocol::listDir(const KURL &url)
return;
}
- 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: " << "path is " << path << ": doing a listDir" << endl;
- // We've been given something like app:/appname
+ kdDebug() << "tdeio_appProtocol::listDir: " << "name is " << name << endl;
+ kdDebug() << "tdeio_appProtocol::listDir: " << "path is " << path << endl;
+ // We've been given something like appinfo:/name
listAppContents(name);
}
void tdeio_appProtocol::listRoot()
{
- TDEIO::UDSEntry entry;
TDEIO::UDSEntryList system_entries;
bool ok = m_impl.listRoot(system_entries);
if (!ok)
@@ -150,21 +148,15 @@ void tdeio_appProtocol::listRoot()
totalSize(system_entries.count() + 1);
+ TDEIO::UDSEntry entry;
m_impl.createTopLevelEntry(entry);
listEntry(entry, false);
- for(const UDSEntry &sysEntry : system_entries)
- {
- listEntry(sysEntry, false);
- }
-
- entry.clear();
- listEntry(entry, true);
+ listEntries(system_entries);
finished();
}
void tdeio_appProtocol::listAppContents(const TQString &name)
{
- TDEIO::UDSEntry entry;
TDEIO::UDSEntryList app_entries;
bool ok = m_impl.listAppContents(name, app_entries);
if (!ok)
@@ -175,14 +167,9 @@ void tdeio_appProtocol::listAppContents(const TQString &name)
totalSize(app_entries.count() + 1);
+ TDEIO::UDSEntry entry;
m_impl.createTopLevelEntry(entry);
listEntry(entry, false);
- for(const UDSEntry &appEntry : app_entries)
- {
- listEntry(appEntry, false);
- }
-
- entry.clear();
- listEntry(entry, true);
+ listEntries(app_entries);
finished();
}
diff --git a/src/appimpl.cpp b/src/appimpl.cpp
index 8676bcf..0f5639e 100644
--- a/src/appimpl.cpp
+++ b/src/appimpl.cpp
@@ -42,10 +42,13 @@ bool AppImpl::listRoot(TQValueList<TDEIO::UDSEntry> &list)
{
kdDebug() << "AppImpl::listRoot" << endl;
- TQStringList dirList = TQStringList::split(":", getenv("PATH"));
+ //TQStringList dirList = TQStringList::split(":", getenv("PATH"));
+ TQStringList dirList;
+ dirList << "/opt/trinity/bin/";
+ dirList << "/usr/bin/";
+ dirList << "/usr/local/bin/";
kdDebug() << dirList << endl;
- TQStringList names_found;
for (const TQString &dirName : dirList)
{
TQDir dir(dirName);
@@ -56,18 +59,10 @@ bool AppImpl::listRoot(TQValueList<TDEIO::UDSEntry> &list)
TQStringList filenames = dir.entryList(TQDir::Files | TQDir::Readable);
TDEIO::UDSEntry entry;
- for(const TQString &filename : filenames)
+ for (const TQString &filename : filenames)
{
- if (!names_found.contains(filename))
- {
- entry.clear();
- createEntry(entry, filename);
- if (!entry.isEmpty())
- {
- list.append(entry);
- names_found.append(filename);
- }
- }
+ createEntry(entry, filename);
+ list.append(entry);
}
}
@@ -76,9 +71,7 @@ bool AppImpl::listRoot(TQValueList<TDEIO::UDSEntry> &list)
bool AppImpl::parseURL(const KURL &url, TQString &name, TQString &path) const
{
- kdDebug() << "AppImpl::parseURL" << endl;
TQString url_path = url.path();
-
int i = url_path.find('/', 1);
if (i > 0)
{
@@ -106,7 +99,7 @@ bool AppImpl::realURL(const TQString &name, const TQString &path, KURL &url) con
return true;
}
-bool AppImpl::statByName(const TQString &filename, TDEIO::UDSEntry& entry)
+bool AppImpl::statByName(const TQString &filename, TDEIO::UDSEntry &entry)
{
kdDebug() << "AppImpl::statByName" << endl;
@@ -125,7 +118,6 @@ bool AppImpl::statByName(const TQString &filename, TDEIO::UDSEntry& entry)
}
TQStringList filenames = dir.entryList(TQDir::Files | TQDir::Readable);
- TDEIO::UDSEntry entry;
for (const TQString &fname : filenames)
{
if (fname == filename)
@@ -199,14 +191,12 @@ void AppImpl::createEntry(TDEIO::UDSEntry &entry, const TQString &file)
entry.clear();
addAtom(entry, TDEIO::UDS_NAME, 0, file);
-
- TQString new_filename = file;
- new_filename.truncate(file.length() - 8);
- addAtom(entry, TDEIO::UDS_URL, 0, "app:/" + new_filename);
+ addAtom(entry, TDEIO::UDS_URL, 0, "appinfo:/" + file);
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
+ addAtom(entry, TDEIO::UDS_ACCESS, 0555);
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
- KService::Ptr service = KService::serviceByDesktopName(new_filename);
+ KService::Ptr service = KService::serviceByDesktopName(file);
if (service && service->isValid())
{
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, service->icon());
@@ -250,7 +240,8 @@ void AppImpl::createExeEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry
}
}
-void AppImpl::createManPageEntry(TDEIO::UDSEntry &entry, const TQString &shortname)
+void AppImpl::createManPageEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
+ const TQString &shortname)
{
entry.clear();
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Manual for %1").arg(shortname));
@@ -258,9 +249,10 @@ void AppImpl::createManPageEntry(TDEIO::UDSEntry &entry, const TQString &shortna
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG);
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "application/x-desktop");
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "man");
+ list.append(entry);
}
-void AppImpl::createHomeDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
+void AppImpl::createHomeDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
const TQString &shortname)
{
TQStringList homedir;
@@ -281,7 +273,7 @@ void AppImpl::createHomeDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEn
addAtom(entry, TDEIO::UDS_URL, 0, fname);
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
- addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "cachefolder");
+ addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "folder");
list.append(entry);
}
}
@@ -309,7 +301,7 @@ void AppImpl::createTDEDataDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UD
addAtom(entry, TDEIO::UDS_URL, 0, dirname);
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
- addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "binaryfolder");
+ addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "folder");
list.append(entry);
}
}
@@ -340,13 +332,14 @@ void AppImpl::createStandardDataDirEntry(TQValueList<TDEIO::UDSEntry> &list,
addAtom(entry, TDEIO::UDS_URL, 0, dirname);
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
- addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "binaryfolder");
+ addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "folder");
list.append(entry);
}
}
-void AppImpl::createTDEConfigEntry(TDEIO::UDSEntry &entry, const TQString &shortname)
+void AppImpl::createTDEConfigEntry(TQValueList<TDEIO::UDSEntry> &list,
+ TDEIO::UDSEntry &entry, const TQString &shortname)
{
TQString TDEDataDir = locate("config", shortname + "rc");
kdDebug() << "TDEDataDir: " << TDEDataDir << endl;
@@ -361,6 +354,7 @@ void AppImpl::createTDEConfigEntry(TDEIO::UDSEntry &entry, const TQString &short
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "text/plain");
addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "configure");
+ list.append(entry);
}
void AppImpl::createStandardConfigEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
@@ -420,7 +414,7 @@ void AppImpl::createTmpDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEn
{
TQStringList dirList;
dirList << "/tmp/";
- TQStringList TmpDir = getFullLocation(dirList,shortname,
+ TQStringList TmpDir = getFullLocation(dirList, shortname,
TQDir::FilterSpec(TQDir::Files | TQDir::Dirs | TQDir::Readable), true, true);
if (TmpDir.isEmpty())
{
@@ -450,7 +444,7 @@ void AppImpl::createTmpDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEn
addAtom(entry, TDEIO::UDS_NAME, 0, i18n("Tmp Data (%1)").arg(fname));
addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR);
addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory");
- addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "tmpfolder");
+ addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "folder");
}
else
{
@@ -480,72 +474,33 @@ void AppImpl::slotResult(TDEIO::Job *)
bool AppImpl::listAppContents(const TQString &name, TQValueList<TDEIO::UDSEntry> &list)
{
- kdDebug() << "AppImpl::listAppEntries" << endl;
+tqWarning("MIKE AppImpl::listAppContents name="+name);
+ kdDebug() << "AppImpl::listAppContents" << endl;
+
TDEIO::UDSEntry entry;
// Create entry for binary file
- entry.clear();
createExeEntry(list, entry, name, getAppAddress(name));
- if (!entry.isEmpty())
- {
- list.append(entry);
- }
// Create entry for man page
entry.clear();
- createManPageEntry(entry, name);
- if (!entry.isEmpty())
- {
- list.append(entry);
- }
- // Create entry for apps folder in home dir
- entry.clear();
+ // Create entry for apps data folder in home dir
createHomeDirEntry(list, entry, name);
- if (!entry.isEmpty())
- {
- list.append(entry);
- }
- // Create entry for apps folder in home dir
- entry.clear();
- createTDEDataDirEntry(list, entry, name);
- if (!entry.isEmpty())
- {
- list.append(entry);
- }
-
- // Create entry for apps folder in home dir
- entry.clear();
+ // Create entry for standard config and data folders
+ createStandardConfigEntry(list, entry, name);
createStandardDataDirEntry(list, entry, name);
- if (!entry.isEmpty())
- {
- list.append(entry);
- }
- // Create entry for apps folder in home dir
- entry.clear();
- createTDEConfigEntry(entry, name);
- if (!entry.isEmpty())
- {
- list.append(entry);
- }
+ // Create entry for TDE config and data folders
+ createTDEConfigEntry(list, entry, name);
+ createTDEDataDirEntry(list, entry, name);
- // Create entry for apps folder in home dir
- entry.clear();
- createStandardConfigEntry(list, entry, name);
- if (!entry.isEmpty())
- {
- list.append(entry);
- }
+ // Create entry for manual
+ createManPageEntry(list, entry, name);
//Create entry for apps folder in home dir
- entry.clear();
createTmpDirEntry(list, entry, name);
- if (!entry.isEmpty())
- {
- list.append(entry);
- }
return true;
}
@@ -553,9 +508,9 @@ bool AppImpl::listAppContents(const TQString &name, TQValueList<TDEIO::UDSEntry>
TQStringList AppImpl::getAppAddress(const TQString &name)
{
TQStringList dirList;
+ dirList << "/opt/trinity/bin/";
dirList << "/usr/bin/";
dirList << "/usr/local/bin/";
- dirList << "/opt/trinity/bin/";
return getFullLocation(dirList, name,
TQDir::FilterSpec(TQDir::Files | TQDir::Readable), false, false);
@@ -573,7 +528,7 @@ TQStringList AppImpl::getFullLocation(const TQStringList &dirList, const TQStrin
}
TQStringList filenames = dir.entryList(filter);
- for (const TQString &filename : dirList)
+ for (const TQString &filename : filenames)
{
if (recursive && filename != ".." && filename != ".")
{
diff --git a/src/appimpl.h b/src/appimpl.h
index 3f39858..554b5ff 100644
--- a/src/appimpl.h
+++ b/src/appimpl.h
@@ -58,14 +58,16 @@ private slots:
KURL findBaseURL(const TQString &filename) const;
void slotEntries(TDEIO::Job *job, const TDEIO::UDSEntryList &list);
void slotResult(TDEIO::Job *job);
- void createManPageEntry(TDEIO::UDSEntry &entry, const TQString &shortname);
- void createExeEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
+ void createManPageEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
+ const TQString &shortname);
+ void createExeEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
const TQString &shortname, const TQStringList &fullname);
void createHomeDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
const TQString &shortname);
void createTDEDataDirEntry(TQValueList<TDEIO::UDSEntry> &list,TDEIO::UDSEntry &entry,
const TQString &shortname);
- void createTDEConfigEntry(TDEIO::UDSEntry &entry, const TQString &shortname);
+ void createTDEConfigEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
+ const TQString &shortname);
void createStandardConfigEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,
const TQString &shortname);
void createStandardDataDirEntry(TQValueList<TDEIO::UDSEntry> &list, TDEIO::UDSEntry &entry,