/*
 * kxtodvd.cpp
 *
 * Copyright (C) 2008 Drake Justice <djustice.kde@gmail.com>
 *
 * GPL n such
 *
 */

#include "kxtodvd.h"
#include "kxtodvdview.h"
#include "settings.h"

#include <QtGui/QDropEvent>
#include <QtGui/QPainter>

#include <kconfigdialog.h>
#include <kstatusbar.h>

#include <kaction.h>
#include <kactioncollection.h>
#include <kstandardaction.h>

#include <KDE/KLocale>

KxToDvd::KxToDvd()
    : KXmlGuiWindow(),
      m_view(new KxToDvdView(this))
{
    setAcceptDrops(true);

    setCentralWidget(m_view);

    setupActions();

    setupGUI(Keys | Save | Create);
}

KxToDvd::~KxToDvd()
{
}

void KxToDvd::setupActions()
{
    KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollection());

    KStandardAction::preferences(this, SLOT(optionsPreferences()), actionCollection());
}

void KxToDvd::optionsPreferences()
{
    if ( KConfigDialog::showDialog( "settings" ) )  {
        return;
    }
    KConfigDialog *dialog = new KConfigDialog(this, "settings", Settings::self());
    QWidget *generalSettingsDlg = new QWidget;
    ui_prefs_base.setupUi(generalSettingsDlg);
    dialog->addPage(generalSettingsDlg, i18n("General"), "package_setting");
    connect(dialog, SIGNAL(settingsChanged(QString)), m_view, SLOT(settingsChanged()));
    dialog->setAttribute( Qt::WA_DeleteOnClose );
    dialog->show();
}

#include "kxtodvd.moc"
