/***************************************************************************
* 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"
#include %1 \n\t\n\t\t"),
html_attribute_classed(" \n");
// Converts the special chars in orig into its HTML equivalents
static TQString text2html(const TQString& orig)
{ TQString ret(orig);
ret = ret.replace("<(?!a href)", "<");
//ret = ret.replace( TQRegExp("\n"), "%2 \n\t\n\t\t"),
html_attribute_end("\n\t \n
\n");
return ret;
}
static void close_indent(int indent, TQString& buffer)
{
if (buffer.isEmpty()) return;
if (indent)
buffer += "\n\t\t";
}
static void close_item(int indent, TQString& buffer)
{
if (buffer.isEmpty()) return;
close_indent(indent, buffer);
buffer += html_attribute_end;
}
static void close_table(const TQString& version, int indent, TQString& buffer)
{
if (buffer.isEmpty()) return;
close_item(indent, buffer);
buffer = version + "\n" + buffer + "
\n";
}
static TQString version_header_link(const KURL& url, const TQString& name)
{ return TQString("\t" + name + "\n"); }
namespace Parsers
{
Show::Show(const TQString& package, const TQString& installed_version, bool act)
: m_package(package), m_installed(installed_version), m_act(false)
{
m_act = act;
}
void Show::operator() (AptProtocol* slave, const TQString& tag, const TQString& value)
{
// Since we want to show the version first, we should wait for it
// before sending anything
static TQString version;
static TQString buffer;
static TQString attribute;
static int indent;
static bool multiline = false;
static bool first_line = false, new_paragraph = true;
if (tag == "begin" || tag == "package" || tag == "end")
{
if (multiline && !new_paragraph)
buffer += "
"; new_paragraph = false; } } buffer += text2html(TQString(value).replace(TQRegExp("(http://\\S+)"),TQString("\\1"))); } else if (tag == "package_link") buffer += "buildURL("show", value).htmlURL() + "\">" + value + ""; } }