20 #include "plugincombobox.h"
21 #include "kmfactory.h"
22 #include "kmmanager.h"
24 #include <tqcombobox.h>
27 #include <tdelocale.h>
28 #include <tqwhatsthis.h>
30 PluginComboBox::PluginComboBox(TQWidget *parent,
const char *name)
31 :TQWidget(parent, name)
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>."
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);
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)
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);
66 connect(m_combo, TQ_SIGNAL(activated(
int)), TQ_SLOT(slotActivated(
int)));
70 void PluginComboBox::slotActivated(
int index)
72 TQString plugin = m_pluginlist[index];
73 if (!plugin.isEmpty())
76 KMFactory::self()->reload(plugin,
true);
80 void PluginComboBox::reload()
82 TQString syst = KMFactory::self()->printSystem();
84 if ((index=m_pluginlist.findIndex(syst)) != -1)
85 m_combo->setCurrentItem(index);
89 void PluginComboBox::configChanged()
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."
99 m_plugininfo->setText(KMManager::self()->stateInformation());
100 TQWhatsThis::add(m_plugininfo, whatsThisCurrentConnection);
104 #include "plugincombobox.moc"