From ea4406b4779306f4d0c65f0619cd8241bbdcef7b Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 10 Feb 2010 20:23:29 +0000 Subject: 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 --- src/parsers/filesearch.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/parsers/filesearch.cpp (limited to 'src/parsers/filesearch.cpp') diff --git a/src/parsers/filesearch.cpp b/src/parsers/filesearch.cpp new file mode 100644 index 0000000..c0a7a36 --- /dev/null +++ b/src/parsers/filesearch.cpp @@ -0,0 +1,52 @@ +/*************************************************************************** + * Copyright (C) 2003 by Sylvain Joyeux * + * sylvain.joyeux@m4x.org * + * * + * 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. * + ***************************************************************************/ +#include "parsers.h" +#include "../apt.h" + +static QString + html_dpkgs_line_begin("%1\n\t"), + html_dpkgs_line_end("\n\n"); + +namespace Parsers +{ + +void FileSearch::operator() (AptProtocol* slave, const QString & tag, const QString & value ) +{ + static QString buffer; + if (tag == "begin") + { + m_result_count = 0; + } + else if (tag == "error") + { + *slave << "
" + value + "
"; + } + else if (tag == "file") + { + if (m_result_count) + *slave << buffer + html_dpkgs_line_end; + + *slave << html_dpkgs_line_begin.arg(value); + ++m_result_count; + buffer = ""; + } + else if (tag == "package") + { + if (!buffer.isEmpty()) buffer = buffer + ", "; + buffer += "" + value + ""; + } + else if (tag == "end") + { + *slave << buffer + html_dpkgs_line_end; + buffer=""; + } +} + +} -- cgit v1.2.1