20 #include "kmconfigpreview.h"
22 #include <tqcheckbox.h>
24 #include <tqgroupbox.h>
27 #include <tdelocale.h>
28 #include <kurlrequester.h>
29 #include <tdeconfig.h>
32 KMConfigPreview::KMConfigPreview(TQWidget *parent,
const char *name)
33 : KMConfigPage(parent, name)
35 setPageName(i18n(
"Preview"));
36 setPageHeader(i18n(
"Preview Settings"));
37 setPagePixmap(
"filefind");
39 TQGroupBox *box =
new TQGroupBox(0, TQt::Vertical, i18n(
"Preview Program"),
this);
41 m_useext =
new TQCheckBox(i18n(
"&Use external preview program"), box);
42 m_program =
new KURLRequester(box);
43 TQLabel *lab =
new TQLabel(box);
44 lab->setText(i18n(
"You can use an external preview program (PS viewer) instead of the "
45 "TDE built-in preview system. Note that if the TDE default PS viewer "
46 "(KGhostView) cannot be found, TDE tries automatically to find another "
47 "external PostScript viewer"));
48 lab->setTextFormat(TQt::RichText);
50 TQVBoxLayout *l0 =
new TQVBoxLayout(
this, 0, KDialog::spacingHint());
53 TQVBoxLayout *l1 =
new TQVBoxLayout(box->layout(), KDialog::spacingHint());
55 l1->addWidget(m_useext);
56 l1->addWidget(m_program);
58 connect(m_useext, TQ_SIGNAL(toggled(
bool)), m_program, TQ_SLOT(setEnabled(
bool)));
59 m_program->setEnabled(
false);
62 void KMConfigPreview::loadConfig(TDEConfig *conf)
64 conf->setGroup(
"General");
65 m_useext->setChecked(conf->readBoolEntry(
"ExternalPreview",
false));
66 m_program->setURL(conf->readPathEntry(
"PreviewCommand",
"gv"));
69 void KMConfigPreview::saveConfig(TDEConfig *conf)
71 conf->setGroup(
"General");
72 conf->writeEntry(
"ExternalPreview", m_useext->isChecked());
73 conf->writePathEntry(
"PreviewCommand", m_program->url());