/***************************************************************************
                          kkeyleddtlcfg.h  -  description
                             -------------------
    begin                : Tue Aug 14 2001
    copyright            : (C) 2001 by Dieter Landolt
    email                : dieter.landolt@secs.ch
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KKEYLEDDTLCFG_H
#define KKEYLEDDTLCFG_H

#include <qwidget.h>
#include <kstandarddirs.h>
#include <qpushbutton.h>
#include <qfileinfo.h>
#include "ledcfgdia.h"
#include "kdndbutton.h"

/**Implementation for the dialog
  *@author Dieter Landolt
  */

class kkeyleddtlcfg : public ledcfgdia  {
   Q_OBJECT
public: 
	kkeyleddtlcfg(QWidget *parent=0, const char *name=0,bool modal=FALSE, WFlags fl=0);
	~kkeyleddtlcfg();
private:
  /** Handler for all buttons */
   void lockbutton_click(kDndButton *button);
  /** read a spezific configuration. for active or theme */
  void readConfig(QString confName);
  /** Loads a them to activate */
  void loadTheme(QString theme,bool display=true);
  /** Function witch saves a spezific theme */
  void saveTheme(QString theme);
  /** delete a theme width this name (theme) i must be esisting in the combobox */
  void delTheme(QString theme);

    /*!
        \fn kkeyleddtlcfg::locate(QString type, QString filename)
	I build the funktion with the return QString::null if file is not found
     */
    QString locate(QString type, QString filename)
    {
	QFileInfo fi;
	fi.setFile(KGlobal::dirs()->findResource(type,filename));
	if ( fi.isFile() ) {
		return fi.absFilePath();
	} else {
		return QString::null;
	}
    }

protected slots:
  /** If the checkbox is clicked apply must be enabled */
  void enableApply() { ApplyButton->setEnabled(true); }
  /** If the checkbox is clicked save must be enabled */
  void enableSave() { ThemeSave->setEnabled(true); }

public slots: // Public slots
  /** button click */
  void numlockon_click(){
     lockbutton_click(numlockon);
  };
  /** button click */
  void capslockon_click(){
     lockbutton_click(capslockon);
  };
  /** button click */
  void scrollockon_click(){
     lockbutton_click(scrollockon);
  };
  /** button click */
  void numlockoff_click(){
     lockbutton_click(numlockoff);
  };
  /** button click */
  void capslockoff_click(){
    lockbutton_click(capslockoff);
  };
  /** button click */
  void scrollockoff_click(){
    lockbutton_click(scrollockoff);
  };
  void setNumOnPath(QString s) { 
     numlockon->path = s; 
     ApplyButton->setEnabled(true);
     ThemeSave->setEnabled(true);
  }
  void setNumOffPath(QString s) { 
     numlockoff->path = s; 
     ApplyButton->setEnabled(true);
     ThemeSave->setEnabled(true);
  }
  void setCapsOnPath(QString s) { 
     capslockon->path = s; 
     ApplyButton->setEnabled(true);
     ThemeSave->setEnabled(true);
  }
  void setCapsOffPath(QString s) { 
     capslockoff->path = s; 
     ApplyButton->setEnabled(true);
     ThemeSave->setEnabled(true);
  }
  void setScrollOnPath(QString s) { 
     scrollockon->path = s; 
     ApplyButton->setEnabled(true);
     ThemeSave->setEnabled(true);
  }
  void setScrollOffPath(QString s) { 
     scrollockoff->path = s; 
     ApplyButton->setEnabled(true);
     ThemeSave->setEnabled(true);
  }
  /** if a soundpath changes do this */
  void setSoundPath(QString s) {
    ApplyButton->setEnabled(true);
    ThemeSave->setEnabled(true);
  };
  
private slots: // Private slots
  /** Apply Configuration */
  void applyConfig();
  /** clear the scrollockbuttons */
  void clearscroll();
  /** clear the capslock button */
  void clearcaps();
  /** clear the path of the numlock buttons */
  void clearnum();
  /** set the them from the combobox */
  void setCurrentTheme();
  /** save the them under the Name and into the list of the box */
  void saveThisTheme();
  /** Called to activate the them selected in the Combobox */
  void activateTheme(int themeNr);
  /** Notfy's that the displayed Theme should be deleted */
  void delThisTheme();
  /** For renaming a displayed Theme */
  void renThisTheme();
signals: // Signals
  /** Notify' s if the configuration was changed
 */
  void configChanged();
};

#endif


syntax highlighted by Code2HTML, v. 0.9.1