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

tdeprint

  • tdeprint
  • management
kmconfiggeneral.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 "kmconfiggeneral.h"
21
22#include <tqlayout.h>
23#include <tqgroupbox.h>
24#include <tqcheckbox.h>
25#include <tqlabel.h>
26#include <tqwhatsthis.h>
27
28#include <kpushbutton.h>
29#include <tdelocale.h>
30#include <kurlrequester.h>
31#include <krun.h>
32#include <kmimemagic.h>
33#include <tdeconfig.h>
34#include <knuminput.h>
35#include <tdemessagebox.h>
36#include <kcursor.h>
37#include <klineedit.h>
38#include <kguiitem.h>
39#include <kdialog.h>
40
41KMConfigGeneral::KMConfigGeneral(TQWidget *parent)
42: KMConfigPage(parent,"ConfigTimer")
43{
44 setPageName(i18n("General"));
45 setPageHeader(i18n("General Settings"));
46 setPagePixmap("document-print");
47
48 TQGroupBox *m_timerbox = new TQGroupBox(0, TQt::Vertical, i18n("Refresh Interval"), this);
49 m_timer = new KIntNumInput(m_timerbox,"Timer");
50 m_timer->setRange(0,30);
51 m_timer->setSuffix( i18n( " sec" ) );
52 m_timer->setSpecialValueText(i18n("Disabled"));
53 TQWhatsThis::add(m_timer, i18n("This time setting controls the refresh rate of various "
54 "<b>TDE Print</b> components like the print manager "
55 "and the job viewer."));
56
57 TQGroupBox *m_testpagebox = new TQGroupBox(0, TQt::Vertical, i18n("Test Page"), this);
58 m_defaulttestpage = new TQCheckBox(i18n("&Specify personal test page"), m_testpagebox, "TestPageCheck");
59 m_testpage = new KURLRequester(m_testpagebox,"TestPage");
60 m_preview = new KPushButton(KGuiItem(i18n("Preview..."), "filefind"), m_testpagebox);
61 connect(m_defaulttestpage,TQ_SIGNAL(toggled(bool)),m_testpage,TQ_SLOT(setEnabled(bool)));
62 connect(m_defaulttestpage,TQ_SIGNAL(toggled(bool)),this,TQ_SLOT(setEnabledPreviewButton(bool)));
63 connect(m_preview,TQ_SIGNAL(clicked()),TQ_SLOT(slotTestPagePreview()));
64 connect(m_testpage->lineEdit(),TQ_SIGNAL(textChanged ( const TQString & )),this,TQ_SLOT(testPageChanged(const TQString & )));
65 m_testpage->setDisabled(true);
66 m_preview->setDisabled(true);
67 m_defaulttestpage->setCursor(KCursor::handCursor());
68
69 TQGroupBox *m_statusbox = new TQGroupBox(0, TQt::Vertical, i18n("Miscellaneous"), this);
70 m_statusmsg = new TQCheckBox(i18n("Sho&w printing status message box"), m_statusbox);
71 m_uselast = new TQCheckBox(i18n("De&faults to the last printer used in the application"), m_statusbox);
72
73 //layout
74 TQVBoxLayout *lay0 = new TQVBoxLayout(this, 0, KDialog::spacingHint());
75 lay0->addWidget(m_timerbox);
76 lay0->addWidget(m_testpagebox);
77 lay0->addWidget(m_statusbox);
78 lay0->addStretch(1);
79 TQVBoxLayout *lay1 = new TQVBoxLayout(m_timerbox->layout(),
80 KDialog::spacingHint());
81 lay1->addWidget(m_timer);
82 TQVBoxLayout *lay2 = new TQVBoxLayout(m_testpagebox->layout(),
83 KDialog::spacingHint());
84 TQHBoxLayout *lay3 = new TQHBoxLayout(0, 0, 0);
85 lay2->addWidget(m_defaulttestpage);
86 lay2->addWidget(m_testpage);
87 lay2->addLayout(lay3);
88 lay3->addStretch(1);
89 lay3->addWidget(m_preview);
90 TQVBoxLayout *lay4 = new TQVBoxLayout(m_statusbox->layout(),
91 KDialog::spacingHint());
92 lay4->addWidget(m_statusmsg);
93 lay4->addWidget(m_uselast);
94 m_preview->setEnabled( !m_testpage->url().isEmpty());
95}
96
97void KMConfigGeneral::testPageChanged(const TQString &test )
98{
99 m_preview->setEnabled( !test.isEmpty());
100}
101
102void KMConfigGeneral::setEnabledPreviewButton(bool b)
103{
104 m_preview->setEnabled(!m_testpage->url().isEmpty() && b);
105}
106
107void KMConfigGeneral::loadConfig(TDEConfig *conf)
108{
109 conf->setGroup("General");
110 m_timer->setValue(conf->readNumEntry("TimerDelay",5));
111 TQString tpage = conf->readPathEntry("TestPage");
112 if (!tpage.isEmpty())
113 {
114 m_defaulttestpage->setChecked(true);
115 m_testpage->setURL(tpage);
116 }
117 m_statusmsg->setChecked(conf->readBoolEntry("ShowStatusMsg", true));
118 m_uselast->setChecked(conf->readBoolEntry("UseLast", true));
119}
120
121void KMConfigGeneral::saveConfig(TDEConfig *conf)
122{
123 conf->setGroup("General");
124 conf->writeEntry("TimerDelay",m_timer->value());
125 conf->writePathEntry("TestPage",(m_defaulttestpage->isChecked() ? m_testpage->url() : TQString::null));
126 if (m_defaulttestpage->isChecked() && KMimeMagic::self()->findFileType(m_testpage->url())->mimeType() != "application/postscript")
127 KMessageBox::sorry(this, i18n("The selected test page is not a PostScript file. You may not "
128 "be able to test your printer anymore."));
129 conf->writeEntry("ShowStatusMsg", m_statusmsg->isChecked());
130 conf->writeEntry("UseLast", m_uselast->isChecked());
131}
132
133void KMConfigGeneral::slotTestPagePreview()
134{
135 TQString tpage = m_testpage->url();
136 if (tpage.isEmpty())
137 KMessageBox::error(this, i18n("Empty file name."));
138 else
139 KRun::runURL(KURL( tpage ), KMimeMagic::self()->findFileType(tpage)->mimeType());
140}
141
142#include "kmconfiggeneral.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.