/*
 * This file is part of DesktopBSD, see the README file.
 *
 * Author: Peter Hofer <ph@desktopbsd.net>
 *			(C) 2004, 2005
 *
 * Copyright: BSD, see the COPYING file included in this distribution
 *
 */

#include <qapplication.h>

#include "dbsdmodule.h"

DBSDModule::DBSDModule(QWidget  *parent,  const char  *name,  WFlags f)
		:  QWidget(parent, name, f)
{
	setCaption(tr("DesktopBSD Module"));
	if(name == NULL)
		setName("DBSDModule");

	modInitialized = false;
}


DBSDModule::~DBSDModule() {
}



/** Apply changes. */
void	DBSDModule::apply() {
	qDebug("DBSDModule: WARNING: apply() not implemented.");
}


/** Reset settings. */
void	DBSDModule::reset() {
	qDebug("DBSDModule: WARNING: reset() not implemented.");
}


/**
 * Returns the operations supported by this
 * module or'ed together, e.g. Apply|Reset
 *
 * @see DBSDModule::Operations
 */
int	DBSDModule::getSupportedOperations() {
	return  0;
}


/**
 * Asks the module whether it is ready to be
 * destroyed or not. This function is used in
 * module sequences, where the next module
 * depends on the previous.
 */
bool	DBSDModule::exitReady() {
	return  true;
}


/**
 * Provided for convenience; same as emitting changed(true);
 */
void	DBSDModule::changed() {
	emit  changed(true);
}


/**
 * Initialization of the module. This function
 * prevents that a module is initialized more
 * than once. In fact, it calls initModule() if
 * the module was not initialized before.
 *
 * A module can find out if it was already initialized
 * by calling wasInitialized().
 */
void	DBSDModule::initializeModule() {
	if(!modInitialized) {
		modInitialized = true;
		languageChange();
		initModule();
	}
}


/**
 * Returns whether the module was initialized or not.
 */
bool	DBSDModule::wasInitialized() {
	return  modInitialized;
}


/** Prevents LanguageChange events. */
bool	DBSDModule::event(QEvent *ev) {
	if(ev->type() != QEvent::LanguageChange)
		return QWidget::event(ev);

	return false;
}


/** Stub for languageChange() methods
  * created by the Qt Designer.
  */
void  DBSDModule::languageChange() {
}


/**
  * Put the initialization code of the derived
  * module class here instead of the constructor
  * because the time the object is created can
  * differ from the time the module should
  * initialize (e.g. in module sequences)
  *
  * Use the constructor only for initialization
  * of the user interface (e.g. icons)
  *
  * @see initializeModule()
  */
void	DBSDModule::initModule() {
}
