kmwfile.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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.0.