20 #include "kminfopage.h"
21 #include "kmprinter.h"
26 #include <tdelocale.h>
27 #include <kiconloader.h>
28 #include <kseparator.h>
30 KMInfoPage::KMInfoPage(TQWidget *parent,
const char *name)
31 : TQWidget(parent,name)
33 m_title =
new TQLabel(
this);
34 m_titlepixmap =
new TQLabel(
this);
35 m_titlepixmap->setAlignment(TQt::AlignCenter);
36 KSeparator* sep =
new KSeparator( KSeparator::HLine,
this);
37 m_type =
new TQLabel(
this);
38 m_description =
new TQLabel(
this);
39 m_state =
new TQLabel(
this);
40 m_location =
new TQLabel(
this);
41 m_model =
new TQLabel(
this);
42 m_uri =
new TQLabel(
this);
43 m_device =
new TQLabel(
this);
44 TQLabel *m_loclabel =
new TQLabel(i18n(
"Physical Location",
"Location:"),
this);
45 m_loclabel->setAlignment(TQt::AlignRight|TQt::AlignVCenter);
46 TQLabel *m_desclabel =
new TQLabel(i18n(
"Description:"),
this);
47 m_desclabel->setAlignment(TQt::AlignRight|TQt::AlignVCenter);
48 TQLabel *m_typelabel =
new TQLabel(i18n(
"Type:"),
this);
49 m_typelabel->setAlignment(TQt::AlignRight|TQt::AlignVCenter);
50 TQLabel *m_statelabel =
new TQLabel(i18n(
"Status",
"State:"),
this);
51 m_statelabel->setAlignment(TQt::AlignRight|TQt::AlignVCenter);
52 TQLabel *m_urilabel =
new TQLabel(i18n(
"URI:"),
this);
53 m_urilabel->setAlignment(TQt::AlignRight|TQt::AlignVCenter);
54 m_devlabel =
new TQLabel(i18n(
"Device:"),
this);
55 m_devlabel->setAlignment(TQt::AlignRight|TQt::AlignVCenter);
56 TQLabel *m_modellabel =
new TQLabel(i18n(
"Model:"),
this);
57 m_modellabel->setAlignment(TQt::AlignRight|TQt::AlignVCenter);
59 TQGridLayout *lay0 =
new TQGridLayout(
this, 11, 2, 0, 5);
60 TQHBoxLayout *lay1 =
new TQHBoxLayout(0, 0, 10);
61 lay0->addRowSpacing(7,20);
62 lay0->setRowStretch(7,0);
63 lay0->setRowStretch(10,1);
64 lay0->setColStretch(1,1);
65 lay0->addMultiCellLayout(lay1, 0, 0, 0, 1);
66 lay0->addMultiCellWidget(sep, 1, 1, 0, 1);
67 lay0->addWidget(m_typelabel, 2, 0);
68 lay0->addWidget(m_statelabel, 3, 0);
69 lay0->addWidget(m_loclabel, 4, 0);
70 lay0->addWidget(m_desclabel, 5, 0);
71 lay0->addWidget(m_urilabel, 6, 0);
72 lay0->addWidget(m_devlabel, 8, 0);
73 lay0->addWidget(m_modellabel, 9, 0);
74 lay0->addWidget(m_type, 2, 1);
75 lay0->addWidget(m_state, 3, 1);
76 lay0->addWidget(m_location, 4, 1);
77 lay0->addWidget(m_description, 5, 1);
78 lay0->addWidget(m_uri, 6, 1);
79 lay0->addWidget(m_device, 8, 1);
80 lay0->addWidget(m_model, 9, 1);
81 lay1->addWidget(m_title, 1);
82 lay1->addWidget(m_titlepixmap, 0);
85 KMInfoPage::~KMInfoPage()
89 void KMInfoPage::setPrinter(KMPrinter *p)
92 if (p && p->isClass(
false)) m_devlabel->setText(i18n(
"Members:"));
93 else m_devlabel->setText(i18n(
"Device:"));
98 m_title->setText(TQString::null);
99 m_titlepixmap->setPixmap(TQPixmap());
100 m_type->setText(TQString::null);
101 m_state->setText(TQString::null);
102 m_location->setText(TQString::null);
103 m_description->setText(TQString::null);
104 m_uri->setText(TQString::null);
105 m_device->setText(TQString::null);
106 m_model->setText(TQString::null);
110 m_title->setText(TQString::fromLatin1(
"<b>%1</b>").arg(p->name()));
111 m_titlepixmap->setPixmap(SmallIcon(p->pixmap()));
112 if (p->isImplicit()) m_type->setText(i18n(
"Implicit class"));
113 else if (p->isClass(
false))
114 if (p->isRemote()) m_type->setText(i18n(
"Remote class"));
115 else m_type->setText(i18n(
"Local class"));
116 else if (p->isPrinter())
117 if (p->isRemote()) m_type->setText(i18n(
"Remote printer"));
118 else m_type->setText(i18n(
"Local printer"));
119 else if (p->isSpecial())
120 m_type->setText(i18n(
"Special (pseudo) printer"));
121 else m_type->setText(i18n(
"Unknown class of printer",
"Unknown"));
122 m_state->setText(p->stateString());
123 m_location->setText(p->location());
124 m_description->setText(p->description());
125 m_uri->setText(p->uri().prettyURL());
126 if (p->isClass(
false))
129 for (TQStringList::ConstIterator it=p->members().begin(); it!=p->members().end(); ++it)
130 s.append(KURL(*it).prettyURL() +
", ");
131 s.truncate(s.length()-2);
132 m_device->setText(s);
138 KURL dev(p->device());
139 m_device->setText(KURL::decode_string(dev.prettyURL()));
141 m_model->setText(p->driverInfo());