/*
 * actionprogressdialog.h
 *
 * Copyright (c) 2002, 2003 Frerich Raabe <raabe@kde.org>
 *
 * 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. For licensing and distribution details, check the
 * accompanying file 'COPYING'.
 */
#ifndef ACTIONPROGRESSDIALOG_H
#define ACTIONPROGRESSDIALOG_H

#include "port.h"

#include <kdialogbase.h>

class QListViewItem;
class QTimer;

class KListView;
class KProgress;

namespace Barry
{
	class PortItem;
	class ActionProgressDialog : public KDialogBase
	{
		Q_OBJECT
		public:
			/**
			 * Constructs a progress dialog with the given parent and name.
			 * @param showProgress instructs the dialog to show a progressbar
			 * which can be useful for longer tasks, but it also makes the
			 * dialog slower since more UI events have to be processed.
			 */
			ActionProgressDialog( QWidget *parent, const char *name = 0,
			                      bool showProgress = true );

		protected:
			virtual void processPort( const Port &port ) = 0;
			virtual void enlistPort( const Port &port );
			void search( const PortList &portList );
			void stopSearch();
			void setStatus( const QString &s );
			void addColumn( const QString &s );
			virtual void setupItem( PortItem *item );

		signals:
			void portSelected( const Port &port );

		private slots:
			void getNextPort();
			void itemSelected( QListViewItem *item );

		private:
			QLabel *m_statusLabel;
			KProgress *m_progressBar;
			KListView *m_foundPackages;
			QTimer *m_searchTimer;
			PortList m_ports;
			PortList::ConstIterator m_portIt;
			PortList::ConstIterator m_portEnd;
	};
}

#endif // ACTIONPROGRESSDIALOG_H
// vim:ts=4:sw=4:noet:list


syntax highlighted by Code2HTML, v. 0.9.1