kmwend.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "kmwend.h"
00021 #include "kmprinter.h"
00022 #include "kmwizard.h"
00023 #include "util.h"
00024
00025 #include <qtextview.h>
00026 #include <klocale.h>
00027 #include <qlayout.h>
00028
00029 KMWEnd::KMWEnd(QWidget *parent, const char *name)
00030 : KMWizardPage(parent,name)
00031 {
00032 m_ID = KMWizard::End;
00033 m_title = i18n("Confirmation");
00034 m_nextpage = KMWizard::Error;
00035
00036 m_view = new QTextView(this);
00037
00038 QVBoxLayout *lay = new QVBoxLayout(this, 0, 0);
00039 lay->addWidget(m_view,1);
00040 }
00041
00042 void KMWEnd::initPrinter(KMPrinter *p)
00043 {
00044 QString txt;
00045 QString s(QString::fromLatin1("<li><u>%1</u>: %2</li>"));
00046 int ID = p->option("kde-backend").toInt();
00047
00048
00049 txt.append(QString::fromLatin1("<b>%1</b><ul type=circle>").arg(i18n("General")));
00050 txt.append(s.arg(i18n("Type")).arg(p->option("kde-backend-description")));
00051 txt.append(s.arg(i18n("Name")).arg(p->name()));
00052 txt.append(s.arg(i18n("Location")).arg(p->location()));
00053 txt.append(s.arg(i18n("Description")).arg(p->description()));
00054 txt.append("</ul><br>");
00055
00056 if (ID == KMWizard::Class)
00057 {
00058
00059 txt.append(QString::fromLatin1("<b>%1</b><ul type=circle>").arg(i18n("Members")));
00060 QStringList m(p->members());
00061 QString s1(QString::fromLatin1("<li>%1</li>"));
00062 for (QStringList::ConstIterator it=m.begin(); it!=m.end(); ++it)
00063 txt.append(s1.arg(*it));
00064 txt.append("</ul><br>");
00065 }
00066 else
00067 {
00068
00069 txt.append(QString::fromLatin1("<b>%1</b><ul type=circle>").arg(i18n("Backend")));
00070 KURL url ( p->device() );
00071 switch (ID)
00072 {
00073 case KMWizard::Local:
00074 txt.append(s.arg(i18n("Device")).arg(url.path()));
00075 break;
00076 case KMWizard::TCP:
00077 txt.append(s.arg(i18n("Printer IP")).arg(url.host()));
00078 txt.append(s.arg(i18n("Port")).arg(url.port()));
00079 break;
00080 case KMWizard::LPD:
00081 txt.append(s.arg(i18n("Host")).arg(url.host()));
00082 txt.append(s.arg(i18n("Queue")).arg(url.path().right(url.path().length()-1)));
00083 break;
00084 case KMWizard::File:
00085 txt.append(s.arg(i18n("File")).arg(url.path()));
00086 break;
00087 case KMWizard::IPP:
00088 txt.append(s.arg(i18n("Host")).arg(url.host()));
00089 txt.append(s.arg(i18n("Port")).arg(url.port()));
00090 txt.append(s.arg(i18n("Printer")).arg(url.path().right(url.path().length()-1)));
00091 if (url.hasUser()) txt.append(s.arg(i18n("Account")).arg(url.user()));
00092 break;
00093 default:
00094
00095
00096 txt.append(s.arg(i18n("URI")).arg(KURL( p->device()).prettyURL()));
00097 break;
00098 }
00099 txt.append("</ul><br>");
00100
00101 if (p->option("kde-driver") == "raw" || p->driver())
00102 {
00103
00104 txt.append(QString::fromLatin1("<b>%1</b><ul type=circle>").arg(i18n("Driver")));
00105 if (p->option("kde-driver") == "raw")
00106 txt.append(s.arg(i18n("Type")).arg(i18n("Raw printer")));
00107 else
00108 {
00109 txt.append(s.arg(i18n("Type")).arg((p->dbEntry() ? i18n("DB driver") : i18n("External driver"))));
00110 txt.append(s.arg(i18n("Manufacturer")).arg(p->manufacturer()));
00111 txt.append(s.arg(i18n("Model")).arg(p->model()));
00112 txt.append(s.arg(i18n("Description")).arg(p->driverInfo()));
00113 }
00114 txt.append("</ul><br>");
00115 }
00116 }
00117
00118 m_view->setText(txt);
00119 }
|