Example #1
0
AtomicURL::AtomicURL( const KURL &url )
{
    if( url.isEmpty() )
        return;

    QString s = url.protocol() + "://";
    QString host = url.host();
    if( url.hasUser() )
    {
        s += url.user();
        host.prepend("@");
    }
    if( url.hasPass() )
        s += ':' + url.pass();
    if( url.port() )
        host += QString(":") + QString::number( url.port() );

    m_beginning = s + host;
    m_directory = url.directory();
    m_filename = url.fileName();
    m_end = url.query();
    if( url.hasRef() )
        m_end += QString("#") + url.ref();
    if (url != this->url())
    {
        debug() << "from: " << url << endl;
        debug() << "to:   " << this->url() << endl;
    }
}
Example #2
0
void KMWEnd::initPrinter(KMPrinter *p)
{
	TQString	txt;
	TQString	s(TQString::fromLatin1("<li><u>%1</u>: %2</li>"));
	int	ID = p->option("kde-backend").toInt();

	// general information
	txt.append(TQString::fromLatin1("<b>%1</b><ul type=circle>").arg(i18n("General")));
	txt.append(s.arg(i18n("Type")).arg(p->option("kde-backend-description")));
	txt.append(s.arg(i18n("Name")).arg(p->name()));
	txt.append(s.arg(i18n("Location")).arg(p->location()));
	txt.append(s.arg(i18n("Description")).arg(p->description()));
	txt.append("</ul><br>");

	if (ID == KMWizard::Class)
	{
		// class members
		txt.append(TQString::fromLatin1("<b>%1</b><ul type=circle>").arg(i18n("Members")));
		TQStringList	m(p->members());
		TQString		s1(TQString::fromLatin1("<li>%1</li>"));
		for (TQStringList::ConstIterator it=m.begin(); it!=m.end(); ++it)
			txt.append(s1.arg(*it));
		txt.append("</ul><br>");
	}
	else
	{
		// backend information
		txt.append(TQString::fromLatin1("<b>%1</b><ul type=circle>").arg(i18n("Backend")));
		KURL url ( p->device() );
		switch (ID)
		{
			case KMWizard::Local:
				txt.append(s.arg(i18n("Device")).arg(url.path()));
				break;
			case KMWizard::TCP:
				txt.append(s.arg(i18n("Printer IP")).arg(url.host()));
				txt.append(s.arg(i18n("Port")).arg(url.port()));
				break;
			case KMWizard::LPD:
				txt.append(s.arg(i18n("Host")).arg(url.host()));
				txt.append(s.arg(i18n("Queue")).arg(url.path().right(url.path().length()-1)));
				break;
			case KMWizard::File:
				txt.append(s.arg(i18n("File")).arg(url.path()));
				break;
			case KMWizard::IPP:
				txt.append(s.arg(i18n("Host")).arg(url.host()));
				txt.append(s.arg(i18n("Port")).arg(url.port()));
				txt.append(s.arg(i18n("Printer")).arg(url.path().right(url.path().length()-1)));
				if (url.hasUser()) txt.append(s.arg(i18n("Account")).arg(url.user()));
				break;
			default:
				// double decoding in case the printer name contains chars like '#' that are
				// not decoded by "prettyURL".
				txt.append(s.arg(i18n("URI")).arg(KURL( p->device()).prettyURL()));
				break;
		}
		txt.append("</ul><br>");

		if (p->option("kde-driver") == "raw" || p->driver())
		{
			// driver information
			txt.append(TQString::fromLatin1("<b>%1</b><ul type=circle>").arg(i18n("Driver")));
			if (p->option("kde-driver") == "raw")
				txt.append(s.arg(i18n("Type")).arg(i18n("Raw printer")));
			else
			{
				txt.append(s.arg(i18n("Type")).arg((p->dbEntry() ? i18n("DB driver") : i18n("External driver"))));
				txt.append(s.arg(i18n("Manufacturer")).arg(p->manufacturer()));
				txt.append(s.arg(i18n("Model")).arg(p->model()));
				txt.append(s.arg(i18n("Description")).arg(p->driverInfo()));
			}
			txt.append("</ul><br>");
		}
	}

	m_view->setText(txt);
}