kdeprint Library API Documentation

cupslocationdialog.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 "cupslocationdialog.h"
00021 
00022 #include <klocale.h>
00023 #include <kmessagebox.h>
00024 #include <qwhatsthis.h>
00025 
00026 #include "cupslocationgeneral.h"
00027 #include "cupslocationaccess.h"
00028 #include "cupsdconf.h"
00029 
00030 CupsLocationDialog::CupsLocationDialog(CupsdConf *conf, QWidget *parent, const char *name)
00031     : QTabDialog(parent, name, true)
00032 {
00033     conf_ = conf;
00034 
00035     general_ = new CupsLocationGeneral(conf_, this);
00036     addTab(general_, i18n("General"));
00037         general_->setInfos(conf);
00038 
00039     access_ = new CupsLocationAccess(this);
00040     addTab(access_, i18n("Access"));
00041         access_->setInfos(conf);
00042 
00043     setOkButton(i18n("OK"));
00044     setCancelButton(i18n("Cancel"));
00045 
00046     setHelpButton(i18n("Short Help"));
00047         connect(this, SIGNAL(helpButtonPressed()), SLOT(slotHelp()));
00048 
00049     setCaption(i18n("Add Resource"));
00050 }
00051 
00052 CupsLocationDialog::~CupsLocationDialog()
00053 {
00054 }
00055 
00056 void CupsLocationDialog::loadLocation(CupsLocation *loc)
00057 {
00058     general_->loadLocation(loc);
00059     access_->loadLocation(loc);
00060 
00061     setCaption(i18n("Resource \"%1\"").arg(loc->resourcename_));
00062 }
00063 
00064 void CupsLocationDialog::saveLocation(CupsLocation *loc)
00065 {
00066     if (!general_->isValid())
00067         KMessageBox::error(this, i18n("You must specify a resource name!"));
00068     else
00069     {
00070         general_->saveLocation(loc);
00071         access_->saveLocation(loc);
00072     }
00073 }
00074 
00075 void CupsLocationDialog::done(int result)
00076 {
00077     if (result == Accepted)
00078     {
00079         if (!general_->isValid())
00080         {
00081             KMessageBox::error(this, i18n("You must specify a resource name!"));
00082             return;
00083         }
00084     }
00085     QTabDialog::done(result);
00086 }
00087 
00088 void CupsLocationDialog::slotHelp()
00089 {
00090     QWhatsThis::enterWhatsThisMode();
00091 }
00092 #include "cupslocationdialog.moc"
KDE Logo
This file is part of the documentation for kdeprint Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jan 22 16:49:49 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003