00001 /* Copyright (C) 2005 Jan Wedekind. 00002 This file is part of the recipe database application AnyMeal. 00003 00004 AnyMeal is free software; you can redistribute it and/or modify it under 00005 the terms of the GNU GENERAL PUBLIC LICENSE as published by the Free 00006 Software Foundation; either version 3 of the License, or (at your option) 00007 any later version. 00008 00009 AnyMeal is distributed in the hope that it will be useful, but WITHOUT ANY 00010 WARRANTY; without even the implied warranty of MERCHANTIBILITY or FITNESS 00011 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00012 details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00016 #include <qfile.h> 00017 #include <klocale.h> 00018 #include <kmessagebox.h> 00019 #include "checkOverWrite.hpp" 00020 00021 QString checkOverWrite( const QString &fileName, QWidget *parent ) 00022 { 00023 QString retVal; 00024 if( QFile::exists( fileName )) 00025 if ( KMessageBox::warningContinueCancel 00026 ( parent, 00027 i18n( "The file %1 already exists and it will be overwritten!" ). 00028 arg( fileName ) ) != 00029 KMessageBox::Continue ) 00030 retVal = QString::null; 00031 else 00032 retVal = fileName; 00033 else 00034 retVal = fileName; 00035 return retVal; 00036 }