#ifndef _KATEMAKE_H
#define _KATEMAKE_H
/* plugin_katemake.h                    Kate Plugin
**
** Copyright (C) 2003 by Adriaan de Groot
**
** This is the hader for the Make plugin.
**
** This code was mostly copied from the GPL'ed xmlcheck plugin
** by Daniel Naber.
*/

/*
** 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.
**
** 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 in a file called COPYING; if not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
** MA 02110-1301, USA.
*/

// #define TQT_NO_CAST_ASCII	(1)
// #define TQT_NO_ASCII_CAST	(1)

class TQRegExp;

#include <tqlistview.h>
#include <tqstring.h>

#include <kate/plugin.h>
#include <kate/application.h>
#include <kate/view.h>
#include <kate/document.h>
#include <kate/documentmanager.h>
#include <kate/mainwindow.h>
#include <kate/viewmanager.h>

#include <kdockwidget.h>
#include <kiconloader.h>
#include <kprocess.h>
#include <tdetempfile.h>

class PluginKateMakeView : public TQListView, public KXMLGUIClient
{
  Q_OBJECT
  

  public:
	PluginKateMakeView(TQWidget *parent,
		Kate::MainWindow *mainwin,
		const char* name);
	virtual ~PluginKateMakeView();

	Kate::MainWindow *win;

  public slots:
	void slotClicked(TQListViewItem *item);
	void slotNext();
	void slotPrev();

	bool slotValidate();
	void slotProcExited(TDEProcess*);
	void slotReceivedProcStderr(TDEProcess*, char*, int);

	void slotConfigure();

protected:
	void processLine(const TQString &);
	
  private:
	TDEProcess *m_proc;
	
	TQString output_line;
	TQString doc_name;
	TQString document_dir;
	TQString source_prefix,build_prefix;
	
	TQRegExp *filenameDetector;
	
	TQListViewItem *running_indicator;
	bool found_error;
};


class PluginKateMake : public Kate::Plugin, Kate::PluginViewInterface
{
  Q_OBJECT
  

  public:
	PluginKateMake( TQObject* parent = 0, const char* name = 0, const TQStringList& = TQStringList() );
	virtual ~PluginKateMake();

	void addView (Kate::MainWindow *win);
	void removeView (Kate::MainWindow *win);

  private:
	TQPtrList<PluginKateMakeView> m_views;
};

#endif

