summaryrefslogtreecommitdiffstats
path: root/src/aptcache.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-10 20:23:29 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-10 20:23:29 +0000
commitea4406b4779306f4d0c65f0619cd8241bbdcef7b (patch)
treea63d24ddd768559eb993d9bb847acbc3750ef261 /src/aptcache.h
downloadtdeio-apt-ea4406b4779306f4d0c65f0619cd8241bbdcef7b.tar.gz
tdeio-apt-ea4406b4779306f4d0c65f0619cd8241bbdcef7b.zip
Added abandoned version of kio-apt
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kio-apt@1088432 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/aptcache.h')
-rw-r--r--src/aptcache.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/aptcache.h b/src/aptcache.h
new file mode 100644
index 0000000..c209507
--- /dev/null
+++ b/src/aptcache.h
@@ -0,0 +1,81 @@
+/***************************************************************************
+* Copyright (C) 2003 by Sylvain Joyeux *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+***************************************************************************/
+#ifndef KIOAPT_APTCACHE_H
+#define KIOAPT_APTCACHE_H
+
+#include <qvaluelist.h>
+#include <qmap.h>
+#include <qstring.h>
+#include <kprocess.h>
+
+class AptProtocol;
+
+/**
+@author Sylvain Joyeux
+*/
+class AptCache : public QObject {
+ Q_OBJECT
+
+ typedef void (AptCache::*ReceiveMethod) (const QStringList& lines);
+ ReceiveMethod m_receive;
+
+ // KProcIO messes the stderr and the stdout lines :(
+ KProcess m_process;
+ QString m_received_out, m_received_err;
+
+ QString m_attribute;
+
+ QString m_installed, m_candidate;
+
+private slots:
+ void receivedStdErr(KProcess* process, char* buffer, int len);
+ void receivedStdOut(KProcess* process, char* buffer, int len);
+
+private:
+ void clear();
+ void receiveSearch(const QStringList& lines);
+ void receiveShow(const QStringList& lines);
+ void receivePolicy(const QStringList& lines);
+ void parse_pkgfield(const QString& data);
+
+public:
+ AptCache();
+ ~AptCache();
+
+ bool search(const QString& expression);
+ bool show(const QString& package);
+ bool policy(const QString& package);
+
+ QString policy_installed() const;
+ QString policy_candidate() const;
+
+signals:
+ /** Tags:
+ * warning (warning text)
+ * error (error text)
+ * package (package_name)
+ * short_desc (description)
+ * field (field_name)
+ * package_link (package_name)
+ * data (plain_data)
+ * indent (value)
+ * policy
+ * installed (version)
+ * candidate (version)
+ * version_table
+ * version (version_desc)
+ * location (location_desc)
+ * file (file_name) [for dpkg]
+ * end
+ */
+ void token(const QString& tag, const QString& value);
+};
+
+#endif