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

tdeprint

  • tdeprint
plugincombobox.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 "plugincombobox.h"
21#include "kmfactory.h"
22#include "kmmanager.h"
23
24#include <tqcombobox.h>
25#include <tqlabel.h>
26#include <tqlayout.h>
27#include <tdelocale.h>
28#include <tqwhatsthis.h>
29
30PluginComboBox::PluginComboBox(TQWidget *parent, const char *name)
31:TQWidget(parent, name)
32{
33 TQString whatsThisCurrentPrintsystem = i18n(" <qt><b>Print Subsystem Selection</b>"
34 " <p>This combo box shows (and lets you select)"
35 " a print subsystem to be used by TDEPrint. (This print"
36 " subsystem must, of course, be installed inside your"
37 " Operating System.) TDEPrint usually auto-detects the"
38 " correct print subsystem by itself upon first startup."
39 " Most Linux distributions have \"CUPS\", the <em>Common"
40 " UNIX Printing System</em>."
41 " </qt>" );
42
43 m_combo = new TQComboBox(this, "PluginCombo");
44 TQWhatsThis::add(m_combo, whatsThisCurrentPrintsystem);
45 TQLabel *m_label = new TQLabel(i18n("Print s&ystem currently used:"), this);
46 TQWhatsThis::add(m_label, whatsThisCurrentPrintsystem);
47 m_label->setAlignment(AlignVCenter|AlignRight);
48 m_label->setBuddy(m_combo);
49 m_plugininfo = new TQLabel("Plugin information", this);
50 TQGridLayout *l0 = new TQGridLayout(this, 2, 2, 0, 5);
51 l0->setColStretch(0, 1);
52 l0->addWidget(m_label, 0, 0);
53 l0->addWidget(m_combo, 0, 1);
54 l0->addWidget(m_plugininfo, 1, 1);
55
56 TQValueList<KMFactory::PluginInfo> list = KMFactory::self()->pluginList();
57 TQString currentPlugin = KMFactory::self()->printSystem();
58 for (TQValueList<KMFactory::PluginInfo>::ConstIterator it=list.begin(); it!=list.end(); ++it)
59 {
60 m_combo->insertItem((*it).comment);
61 if ((*it).name == currentPlugin)
62 m_combo->setCurrentItem(m_combo->count()-1);
63 m_pluginlist.append((*it).name);
64 }
65
66 connect(m_combo, TQ_SIGNAL(activated(int)), TQ_SLOT(slotActivated(int)));
67 configChanged();
68}
69
70void PluginComboBox::slotActivated(int index)
71{
72 TQString plugin = m_pluginlist[index];
73 if (!plugin.isEmpty())
74 {
75 // the factory will notify all registered objects of the change
76 KMFactory::self()->reload(plugin, true);
77 }
78}
79
80void PluginComboBox::reload()
81{
82 TQString syst = KMFactory::self()->printSystem();
83 int index(-1);
84 if ((index=m_pluginlist.findIndex(syst)) != -1)
85 m_combo->setCurrentItem(index);
86 configChanged();
87}
88
89void PluginComboBox::configChanged()
90{
91 TQString whatsThisCurrentConnection = i18n(" <qt><b>Current Connection</b>"
92 " <p>This line shows which CUPS server your PC is"
93 " currently connected to for printing and retrieving"
94 " printer info. To switch to a different CUPS server,"
95 " click \"System Options\", then select \"Cups server\""
96 " and fill in the required info."
97 " </qt>" );
98
99 m_plugininfo->setText(KMManager::self()->stateInformation());
100 TQWhatsThis::add(m_plugininfo, whatsThisCurrentConnection);
101
102}
103
104#include "plugincombobox.moc"

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.