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