tdeprint
driverview.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "driverview.h"
00021 #include "droptionview.h"
00022 #include "driveritem.h"
00023 #include "driver.h"
00024
00025 #include <tqlistview.h>
00026 #include <tqsplitter.h>
00027 #include <tqheader.h>
00028 #include <tqlayout.h>
00029 #include <tqwhatsthis.h>
00030 #include <tdelocale.h>
00031
00032 DrListView::DrListView(TQWidget *parent, const char *name)
00033 : TDEListView(parent,name)
00034 {
00035 addColumn("");
00036 header()->hide();
00037 setFrameStyle(TQFrame::WinPanel|TQFrame::Sunken);
00038 setSorting(-1);
00039 }
00040
00041
00042
00043 DriverView::DriverView(TQWidget *parent, const char *name)
00044 : TQWidget(parent,name)
00045 {
00046
00047 TQString whatsThisPPDOptionsDriverPage = i18n( " <qt> "
00048 " <b>List of Driver Options (from PPD)</b>. "
00049 " <p>The upper pane of this dialog page contains all printjob options as laid "
00050 " down in the printer's description file (PostScript Printer Description == 'PPD') </p>"
00051 " <p>Click on any item in the list and watch the lower pane of this dialog page "
00052 " display the available values. </p> "
00053 " <p>Set the values as needed. Then use one of the pushbuttons below to proceed:</p> "
00054 " <ul> "
00055 " <li><em>'Save'</em> your settings if you want to re-use "
00056 " them in your next job(s) too. <em>'Save'</em> will store your settings permanently until "
00057 " you change them again. </li>."
00058 " <li>Click <em>'OK'</em> (without a prior click on <em>'Save'</em>, if you want to use "
00059 " your selected settings just once, for the next print job. <em>'OK'</em> "
00060 " will forget your current settings when kprinter is closed again, and will start next time "
00061 " with the previously saved defaults. </li>"
00062 " <li><em>'Cancel'</em> will not change anything. If you proceed to print after clicking "
00063 " <em>'Cancel'</em>, the job will print with the default settings of this queue. "
00064 " </ul>"
00065 " <p><b>Note.</b> The number of available job options depends strongly on the actual "
00066 " driver used for your print queue. <em>'Raw'</em> queues do not have a driver or a "
00067 " PPD. For raw queues this tab page is not loaded by TDEPrint, and thus is not present "
00068 " in the kprinter dialog.</p> "
00069 " </qt>" );
00070
00071 TQString whatsThisOptionSettingsDriverPage = i18n( " <qt> "
00072 " <b>List of Possible Values for given Option (from PPD)</b>. "
00073 " <p>The lower pane of this dialog page contains all possible values of the printoption "
00074 " highlighted above, as laid "
00075 " down in the printer's description file (PostScript Printer Description == 'PPD') </p>"
00076 " <p>Select the value you want and proceed. </p> "
00077 " <p>Then use one of the pushbuttons below to leave this dialog:</p> "
00078 " <ul> "
00079 " <li><em>'Save'</em> your settings if you want to re-use "
00080 " them in your next job(s) too. <em>'Save'</em> will store your settings permanently until "
00081 " you change them again. </li>."
00082 " <li>Click <em>'OK'</em> if you want to use your selected settings just once, for the "
00083 " next print job. <em>'OK'</em> "
00084 " will forget your current settings when kprinter is closed again, and will start next time "
00085 " with your previous defaults. </li>"
00086 " <li><em>'Cancel'</em> will not change anything. If you proceed to print after clicking "
00087 " <em>'Cancel'</em>, the job will print with the default settings of this queue. "
00088 " </ul>"
00089 " <p><b>Note.</b> The number of available job options depends strongly on the actual "
00090 " driver used for your print queue. <em>'Raw'</em> queues do not have a driver or a "
00091 " PPD. For raw queues this tab page is not loaded by TDEPrint, and thus is not present "
00092 " in the kprinter dialog.</p> "
00093 " </qt>" );
00094
00095 m_driver = 0;
00096
00097 TQSplitter *splitter = new TQSplitter(this);
00098 splitter->setOrientation(Qt::Vertical);
00099
00100 TQVBoxLayout *vbox = new TQVBoxLayout(this, 0, 10);
00101 vbox->addWidget(splitter);
00102
00103 m_view = new DrListView(splitter);
00104 TQWhatsThis::add(m_view, whatsThisPPDOptionsDriverPage);
00105 m_optview = new DrOptionView(splitter);
00106 TQWhatsThis::add(m_optview, whatsThisOptionSettingsDriverPage);
00107
00108 connect(m_view,TQT_SIGNAL(selectionChanged(TQListViewItem*)),m_optview,TQT_SLOT(slotItemSelected(TQListViewItem*)));
00109 connect(m_optview,TQT_SIGNAL(changed()),TQT_SLOT(slotChanged()));
00110 }
00111
00112 DriverView::~DriverView()
00113 {
00114 }
00115
00116 void DriverView::setDriver(DrMain *driver)
00117 {
00118 m_driver = driver;
00119 if (m_driver)
00120 {
00121 m_view->clear();
00122 m_driver->createTreeView(m_view);
00123 slotChanged();
00124 }
00125 }
00126
00127 void DriverView::slotChanged()
00128 {
00129 if (m_driver)
00130 {
00131 m_conflict = m_driver->checkConstraints();
00132 ((DriverItem*)m_view->firstChild())->updateConflict();
00133 }
00134 }
00135
00136 void DriverView::setOptions(const TQMap<TQString,TQString>& opts)
00137 {
00138 if (m_driver)
00139 {
00140 m_driver->setOptions(opts);
00141 static_cast<DriverItem*>( m_view->firstChild() )->updateTextRecursive();
00142 slotChanged();
00143 m_optview->slotItemSelected(m_view->currentItem());
00144 }
00145 }
00146
00147 void DriverView::getOptions(TQMap<TQString,TQString>& opts, bool incldef)
00148 {
00149 if (m_driver)
00150 m_driver->getOptions(opts,incldef);
00151 }
00152
00153 void DriverView::setAllowFixed(bool on)
00154 {
00155 m_optview->setAllowFixed(on);
00156 }
00157 #include "driverview.moc"