CASA/CASA-auth-token/yast2-casa-ats/src/complex.ycp

206 lines
4.8 KiB
Plaintext
Raw Normal View History

/* ------------------------------------------------------------------------------
* Copyright (c) 2006 Novell, Inc. All Rights Reserved.
*
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of version 2 of the GNU General Public License as published by the
* Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, contact Novell, Inc.
*
* To contact Novell about this file by physical or electronic mail, you may find
* current contact information at www.novell.com.
* ------------------------------------------------------------------------------
*/
/**
* File: include/casa-ats/complex.ycp
* Package: Configuration of casa-ats
* Summary: Dialogs definitions
* Authors: Ryan Partridge <rpartridge@novell.com>
*
* $Id: complex.ycp 29363 2006-03-24 08:20:43Z mzugec $
*/
{
textdomain "casa-ats";
import "Label";
import "Popup";
import "Wizard";
import "Wizard_hw";
import "Confirm";
import "CasaAts";
include "casa-ats/helps.ycp";
/**
* Return a modification status
* @return true if data was modified
*/
boolean Modified() {
return CasaAts::Modified();
}
boolean ReallyAbort() {
return !CasaAts::Modified() || Popup::ReallyAbort(true);
}
boolean PollAbort() {
return UI::PollInput() == `abort;
}
/**
* Read settings dialog
* @return `abort if aborted and `next otherwise
*/
symbol ReadDialog() {
Wizard::RestoreHelp(HELPS["read"]:"");
// CasaAts::AbortFunction = PollAbort;
if (!Confirm::MustBeRoot()) return `abort;
boolean ret = CasaAts::Read();
return ret ? `next : `abort;
}
/**
* Write settings dialog
* @return `abort if aborted and `next otherwise
*/
symbol WriteDialog() {
Wizard::RestoreHelp(HELPS["write"]:"");
// CasaAts::AbortFunction = PollAbort;
boolean ret = CasaAts::Write();
return ret ? `next : `abort;
}
/**
* Summary dialog
* @return dialog result
*/
any SummaryDialog() {
/* CasaAts summary dialog caption */
string caption = _("CasaAts Configuration");
/* FIXME */
list summary = CasaAts::Summary();
list unconfigured = summary[1]:[];
string configured = summary[0]:"";
/* Frame label */
term contents = Wizard_hw::DetectedContent(_("CasaAts to Configure"),
unconfigured, false, configured);
Wizard::SetContentsButtons(caption, contents, HELPS["summary"]:"",
Label::BackButton(), Label::FinishButton());
any ret = nil;
while(true) {
ret = UI::UserInput();
/* abort? */
if(ret == `abort || ret == `cancel || ret == `back) {
if(ReallyAbort()) break;
else continue;
}
/* overview dialog */
else if(ret == `edit_button) {
ret = `overview;
break;
}
/* configure the selected device */
else if(ret == `configure_button) {
// TODO FIXME: check for change of the configuration
any selected = UI::QueryWidget(`id(`detected_selbox), `CurrentItem);
if(selected == `other) {
ret = `other;
}
else {
ret = `configure;
}
break;
}
else if(ret == `next) {
break;
}
else {
y2error("unexpected retcode: %1", ret);
continue;
}
}
return ret;
}
/**
* Overview dialog
* @return dialog result
*/
any OverviewDialog() {
/* CasaAts overview dialog caption */
string caption = _("CasaAts Overview");
list overview = CasaAts::Overview();
/* FIXME table header */
term contents = Wizard_hw::ConfiguredContent(
/* Table header */
`header(_("Number"), _("CasaAts")),
overview, nil, nil, nil, nil );
contents = Wizard_hw::SpacingAround(contents, 1.5, 1.5, 1.0, 1.0);
Wizard::SetContentsButtons(caption, contents, HELPS["overview"]:"",
Label::BackButton(), Label::FinishButton());
any ret = nil;
while(true) {
ret = UI::UserInput();
/* abort? */
if(ret == `abort || ret == `cancel) {
if(ReallyAbort()) break;
else continue;
}
/* add */
else if(ret == `add_button) {
/* FIXME */
ret = `add;
break;
}
/* edit */
else if(ret == `edit_button) {
/* FIXME */
ret = `edit;
break;
}
/* delete */
else if(ret == `delete_button) {
/* FIXME */
continue;
}
else if(ret == `next || ret == `back) {
break;
}
else {
y2error("unexpected retcode: %1", ret);
continue;
}
}
return ret;
}
/* EOF */
}