#ifndef KPAGEDIALOG2_H
#define KPAGEDIALOG2_H

#include "k9common.h"
#include <QtGui/QDialog>
#include <QTreeWidgetItem>
#include <QAbstractButton>

#include <QItemDelegate>

class k9IconItem:public QItemDelegate {
Q_OBJECT
public:
    k9IconItem(QObject *parent = 0):QItemDelegate(parent){}
protected:
    void paint(QPainter *painter,const QStyleOptionViewItem &option,const QModelIndex &index) const;

};



namespace Ui {
    class KPageDialog;
}


class KPageWidgetItem:public QObject{
Q_OBJECT
public:
    KPageWidgetItem(QObject *parent,QWidget *widget,const QString &label);
    void setHeader(const QString &text);
    const QString &getHeader() {return m_header;}
    void setIcon(const QIcon  &icon);
private:
    QString m_header;
    int m_index;


};

class KPageDialog : public QDialog {
    Q_OBJECT
    friend class KPageWidgetItem;
public:
    KPageDialog(QWidget *parent = 0);
    ~KPageDialog();
    KPageWidgetItem *addPage(QWidget *widget, const QString &label);
protected:
    void changeEvent(QEvent *e);
protected slots:
    void itemChanged(int);
    void accept();
    void clicked(QAbstractButton*);
private:
    Ui::KPageDialog *m_ui;
    QList <KPageWidgetItem*> m_pages;
signals:
    void okClicked();
    void applyClicked();
};

#endif // KPAGEDIALOG_H
