• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeprint
 

tdeprint

  • tdeprint
  • management
kminfopage.cpp
1/*
2 * This file is part of the KDE libraries
3 * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License version 2 as published by the Free Software Foundation.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 **/
19
20#include "kminfopage.h"
21#include "kmprinter.h"
22
23#include <tqpixmap.h>
24#include <tqlabel.h>
25#include <tqlayout.h>
26#include <tdelocale.h>
27#include <kiconloader.h>
28#include <kseparator.h>
29
30KMInfoPage::KMInfoPage(TQWidget *parent, const char *name)
31: TQWidget(parent,name)
32{
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);
58
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);
83}
84
85KMInfoPage::~KMInfoPage()
86{
87}
88
89void KMInfoPage::setPrinter(KMPrinter *p)
90{
91 // change "Device" label if it's a real class (not true for implicit classes)
92 if (p && p->isClass(false)) m_devlabel->setText(i18n("Members:"));
93 else m_devlabel->setText(i18n("Device:"));
94
95 // clear everything if p == 0
96 if (!p)
97 {
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);
107 }
108 else
109 {
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))
127 {
128 TQString s;
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);
133 }
134 else
135 {
136 // double decoding in case printer name contains
137 // annoying chars like '#'
138 KURL dev(p->device());
139 m_device->setText(KURL::decode_string(dev.prettyURL()));
140 }
141 m_model->setText(p->driverInfo());
142 }
143}

tdeprint

Skip menu "tdeprint"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeprint

Skip menu "tdeprint"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeprint by doxygen 1.9.4
This website is maintained by Timothy Pearson.