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

tdeprint

  • tdeprint
  • management
kmwname.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 "kmwname.h"
21#include "kmwizard.h"
22#include "kmprinter.h"
23
24#include <tqlabel.h>
25#include <tqlineedit.h>
26#include <tdelocale.h>
27#include <tdemessagebox.h>
28#include <tqregexp.h>
29
30KMWName::KMWName(TQWidget *parent, const char *name)
31: KMWInfoBase(3,parent,name)
32{
33 m_ID = KMWizard::Name;
34 m_title = i18n("General Information");
35 m_nextpage = KMWizard::End;
36
37 setInfo(i18n("<p>Enter the information concerning your printer or class. <b>Name</b> is mandatory, "
38 "<b>Location</b> and <b>Description</b> are not (they may even not be used on some systems).</p>"));
39 setLabel(0,i18n("Name:"));
40 setLabel(1,i18n("Location:"));
41 setLabel(2,i18n("Description:"));
42}
43
44bool KMWName::isValid(TQString& msg)
45{
46 if (text(0).isEmpty())
47 {
48 msg = i18n("You must supply at least a name.");
49 return false;
50 }
51 else if (text(0).find(TQRegExp("\\s")) != -1)
52 {
53 TQString conv = text(0);
54 conv.replace(TQRegExp("\\s"), "");
55 int result = KMessageBox::warningYesNoCancel(this,
56 i18n("It is usually not a good idea to include spaces "
57 "in printer name: it may prevent your printer from "
58 "working correctly. The wizard can strip all spaces "
59 "from the string you entered, resulting in %1; "
60 "what do you want to do?").arg(conv),
61 TQString::null,
62 i18n("Strip"), i18n("Keep"));
63 switch (result)
64 {
65 case KMessageBox::Yes:
66 setText(0, conv);
67 case KMessageBox::No:
68 return true;
69 default:
70 return false;
71 }
72 }
73 return true;
74}
75
76void KMWName::initPrinter(KMPrinter *p)
77{
78 setText(0,p->printerName());
79 setText(1,p->location());
80 setText(2,p->description());
81 if (text(2).isEmpty())
82 if (p->option("kde-driver") == "raw")
83 setText(2,i18n("Raw printer"));
84 else
85 setText(2,p->manufacturer() + " " + p->model());
86
87 setCurrent(0);
88}
89
90void KMWName::updatePrinter(KMPrinter *p)
91{
92 p->setPrinterName(text(0));
93 p->setName(text(0));
94 p->setLocation(text(1));
95 p->setDescription(text(2));
96}

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.