#ifndef TIMEZONECHOOSER_H
#define TIMEZONECHOOSER_H

#include "timezonemap.h"
#include <QFrame>
#include <QMap>
#include <QWidget>
#include <QLabel>
#include <QPushButton>
#include <QAbstractItemView>
#include <QPropertyAnimation>
#include <QDialog>
#include <kysdk/applications/kpushbutton.h>

#include "ksearchlineedit.h"
using namespace kdk;

class TimeZoneChooser : public QDialog
{
    Q_OBJECT
public:
    explicit TimeZoneChooser(QWidget *parent);
    void setTitle(QString title);
    void hide();

public slots:
    void setMarkedTimeZoneSlot(QString timezone);

Q_SIGNALS:
    void confirmed(QString zone, QString title);
    void cancelled();

protected:
    void keyPressEvent(QKeyEvent *event);
    void keyRealeaseEvent(QKeyEvent* event);
    void closeEvent(QCloseEvent *e);

private:
    QSize getFitSize();
    void initSize();

private:
    ZoneInfo* m_zoneinfo;

    QMap<QString, QString> m_zoneCompletion;
    QAbstractItemView      *m_popup;

    TimezoneMap* m_map;
    KSearchLineEdit* m_searchInput;
    KPushButton *m_cancelBtn;
    KPushButton *m_confirmBtn;
    bool       firstin = true;
};

#endif // TIMEZONECHOOSER_H
