You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.2 KiB
78 lines
2.2 KiB
15 years ago
|
/*
|
||
|
* This file is part of the KDE libraries
|
||
13 years ago
|
* Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
|
||
15 years ago
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Library General Public
|
||
|
* License version 2 as published by the Free Software Foundation.
|
||
|
*
|
||
|
* This library is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Library General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Library General Public License
|
||
|
* along with this library; see the file COPYING.LIB. If not, write to
|
||
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
* Boston, MA 02110-1301, USA.
|
||
|
**/
|
||
|
|
||
|
#include "kmwfile.h"
|
||
|
#include "kmwizard.h"
|
||
|
#include "kmprinter.h"
|
||
|
|
||
15 years ago
|
#include <tqlabel.h>
|
||
|
#include <tqlayout.h>
|
||
15 years ago
|
|
||
|
#include <kurlrequester.h>
|
||
|
#include <klocale.h>
|
||
|
#include <kfiledialog.h>
|
||
|
|
||
15 years ago
|
KMWFile::KMWFile(TQWidget *parent, const char *name)
|
||
15 years ago
|
: KMWizardPage(parent,name)
|
||
|
{
|
||
|
m_ID = KMWizard::File;
|
||
|
m_title = i18n("File Selection");
|
||
|
m_nextpage = KMWizard::Driver;
|
||
|
|
||
|
m_url = new KURLRequester(this);
|
||
|
m_url->setMode((KFile::Mode)(KFile::File|KFile::LocalOnly));
|
||
14 years ago
|
TQLabel *l1 = new TQLabel(this);
|
||
15 years ago
|
l1->setText(i18n("<p>The printing will be redirected to a file. Enter here the path "
|
||
|
"of the file you want to use for redirection. Use an absolute path or "
|
||
|
"the browse button for graphical selection.</p>"));
|
||
14 years ago
|
TQLabel *l2 = new TQLabel(i18n("Print to file:"), this);
|
||
15 years ago
|
|
||
14 years ago
|
TQVBoxLayout *lay1 = new TQVBoxLayout(this, 0, 30);
|
||
|
TQVBoxLayout *lay2 = new TQVBoxLayout(0, 0, 5);
|
||
15 years ago
|
lay1->addWidget(l1);
|
||
|
lay1->addLayout(lay2);
|
||
|
lay1->addStretch(1);
|
||
|
lay2->addWidget(l2);
|
||
|
lay2->addWidget(m_url);
|
||
|
}
|
||
|
|
||
15 years ago
|
bool KMWFile::isValid(TQString& msg)
|
||
15 years ago
|
{
|
||
14 years ago
|
TQFileInfo fi(m_url->url());
|
||
15 years ago
|
if (fi.fileName().isEmpty())
|
||
|
{
|
||
|
msg = i18n("Empty file name.");
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
if (!fi.dir().exists())
|
||
|
{
|
||
|
msg = i18n("Directory does not exist.");
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
void KMWFile::updatePrinter(KMPrinter *p)
|
||
|
{
|
||
14 years ago
|
TQString dev = TQString::tqfromLatin1("file:%1").arg(m_url->url());
|
||
15 years ago
|
p->setDevice(dev);
|
||
|
}
|