| # kdeprint Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kmwfile.cpp

    00001 /*
    00002  *  This file is part of the KDE libraries
    00003  *  Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be>
    00004  *
    00005  *  This library is free software; you can redistribute it and/or
    00006  *  modify it under the terms of the GNU Library General Public
    00007  *  License version 2 as published by the Free Software Foundation.
    00008  *
    00009  *  This library is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012  *  Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Library General Public License
    00015  *  along with this library; see the file COPYING.LIB.  If not, write to
    00016  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017  *  Boston, MA 02111-1307, USA.
    00018  **/
    00019
    00020 #include "kmwfile.h"
    00021 #include "kmwizard.h"
    00022 #include "kmprinter.h"
    00023
    00024 #include <qlabel.h>
    00025 #include <qlayout.h>
    00026
    00027 #include <kurlrequester.h>
    00028 #include <klocale.h>
    00029 #include <kfiledialog.h>
    00030
    00031 KMWFile::KMWFile(QWidget *parent, const char *name)
    00032 : KMWizardPage(parent,name)
    00033 {
    00034     m_ID = KMWizard::File;
    00035     m_title = i18n("File Selection");
    00036     m_nextpage = KMWizard::Driver;
    00037
    00038     m_url = new KURLRequester(this);
    00039     m_url->setMode((KFile::Mode)(KFile::File|KFile::LocalOnly));
    00040     QLabel  *l1 = new QLabel(this);
    00041     l1->setText(i18n("<p>The printing will be redirected to a file. Enter here the path "
    00042              "of the file you want to use for redirection. Use an absolute path or "
    00043              "the browse button for graphical selection.</p>"));
    00044     QLabel  *l2 = new QLabel(i18n("Print to file:"), this);
    00045
    00046     QVBoxLayout *lay1 = new QVBoxLayout(this, 0, 30);
    00047     QVBoxLayout *lay2 = new QVBoxLayout(0, 0, 5);
    00048     lay1->addWidget(l1);
    00049     lay1->addLayout(lay2);
    00050     lay1->addStretch(1);
    00051     lay2->addWidget(l2);
    00052     lay2->addWidget(m_url);
    00053 }
    00054
    00055 bool KMWFile::isValid(QString& msg)
    00056 {
    00057     QFileInfo   fi(m_url->url());
    00058     if (fi.fileName().isEmpty())
    00059     {
    00060         msg = i18n("Empty file name.");
    00061         return false;
    00062     }
    00063
    00064     if (!fi.dir().exists())
    00065     {
    00066         msg = i18n("Directory does not exist.");
    00067         return false;
    00068     }
    00069
    00070     return true;
    00071 }
    00072
    00073 void KMWFile::updatePrinter(KMPrinter *p)
    00074 {
    00075     QString dev = QString::fromLatin1("file:%1").arg(m_url->url());
    00076     p->setDevice(dev);
    00077 }

This file is part of the documentation for kdeprint Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:31:03 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003