/****************************************************************************
** $Id: quickqtdialogs.cpp  beta1   edited Dec 10 13:07 $
**
** Copyright (C) 2001-2002 Trolltech AS.  All rights reserved.
**
** This file is part of the Qt Script for Applications framework (QSA).
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding a valid QSA Beta Evaluation Version license may use
** this file in accordance with the QSA Beta Evaluation Version License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
**   information about QSA Commercial License Agreements.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
*****************************************************************************/

#include "quickqtdialogs.h"
#include <qfiledialog.h>
#include <qmessagebox.h>
#include <qcolordialog.h>
#include <qinputdialog.h>
#include <qapplication.h>

QuickFileDialogInterface::QuickFileDialogInterface()
{
}

QuickFileDialogInterface::~QuickFileDialogInterface()
{
}

QString QuickFileDialogInterface::getOpenFileName( const QString &initially,
						   const QString &filter,
						   const QString &caption )
{
    return QFileDialog::getOpenFileName( initially, filter, qApp->mainWidget(), 0, caption );
}

QString QuickFileDialogInterface::getSaveFileName( const QString &initially,
						   const QString &filter,
						   const QString &caption )
{
    return QFileDialog::getSaveFileName( initially, filter, qApp->mainWidget(), 0, caption );
}

QString QuickFileDialogInterface::getExistingDirectory( const QString &dir,
							const QString &caption,
							bool showDirOnly )
{
    return QFileDialog::getExistingDirectory( dir, qApp->mainWidget(), 0, caption, showDirOnly );
}

QStringList QuickFileDialogInterface::getOpenFileNames( const QString &filter,
						    const QString &dir,
						    const QString &caption )
{
    return QFileDialog::getOpenFileNames( filter, dir, qApp->mainWidget(), 0, caption );
}





QuickColorDialogInterface::QuickColorDialogInterface()
{
}

QuickColorDialogInterface::~QuickColorDialogInterface()
{
}

QString QuickColorDialogInterface::getColor( const QString &initColor )
{
    return QColorDialog::getColor( QColor( initColor ), qApp->mainWidget() ).name();
}




QuickInputDialogInterface::QuickInputDialogInterface()
{
}

QuickInputDialogInterface::~QuickInputDialogInterface()
{
}

QString QuickInputDialogInterface::getText( const QString &init, const QString &caption, const QString &label )
{
    return QInputDialog::getText( caption, label, QLineEdit::Normal, init );
}

int QuickInputDialogInterface::getInteger( int init, int from, int to, int step,
					   const QString &caption, const QString &label )
{
    return QInputDialog::getInteger( caption, label, init, from, to, step, 0, qApp->mainWidget() );
}

double QuickInputDialogInterface::getDouble( double init, double from, double to, int decimals,
					     const QString &caption, const QString &label )
{
    return QInputDialog::getDouble( caption, label, init, from, to, decimals, 0, qApp->mainWidget() );
}

QString QuickInputDialogInterface::getItem( const QStringList &list, int current, bool editable,
					    const QString &caption, const QString &label )
{
    return QInputDialog::getItem( caption, label, list, current, editable );
}




QuickMessageBoxInterface::QuickMessageBoxInterface()
{
}

void QuickMessageBoxInterface::information( const QString &text, const QString &title )
{
    QMessageBox::information( 0, title, text );
}

void QuickMessageBoxInterface::warning( const QString &text, const QString &title )
{
    QMessageBox::warning( 0, title, text );
}

void QuickMessageBoxInterface::critical( const QString &text, const QString &title )
{
    QMessageBox::critical( 0, title, text );
}

bool QuickMessageBoxInterface::confirm( const QString &text, const QString &title )
{
    return QMessageBox::information( 0, title, text, "&Yes", "&No" ) == 0;
}
