| 
									
										
										
										
											2009-02-25 09:15:00 +01:00
										 |  |  | /**************************************************************************
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | ** | 
					
						
							|  |  |  | ** This file is part of Qt Creator | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-01-11 16:28:15 +01:00
										 |  |  | ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** Contact: Nokia Corporation (info@qt.nokia.com) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2008-12-02 14:17:16 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2009-02-25 09:15:00 +01:00
										 |  |  | ** GNU Lesser General Public License Usage | 
					
						
							| 
									
										
										
										
											2008-12-02 14:17:16 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** This file may be used under the terms of the GNU Lesser General Public | 
					
						
							|  |  |  | ** License version 2.1 as published by the Free Software Foundation and | 
					
						
							|  |  |  | ** appearing in the file LICENSE.LGPL included in the packaging of this file. | 
					
						
							|  |  |  | ** Please review the following information to ensure the GNU Lesser General | 
					
						
							|  |  |  | ** Public License version 2.1 requirements will be met: | 
					
						
							|  |  |  | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 | 
					
						
							| 
									
										
										
										
											2008-12-02 14:17:16 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** In addition, as a special exception, Nokia gives you certain additional | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** rights. These rights are described in the Nokia Qt LGPL Exception | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** Other Usage | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** Alternatively, this file may be used in accordance with the terms and | 
					
						
							|  |  |  | ** conditions contained in a signed written agreement between you and Nokia. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** If you have questions regarding the use of this file, please contact | 
					
						
							|  |  |  | ** Nokia at qt-info@nokia.com. | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2009-02-25 09:15:00 +01:00
										 |  |  | **************************************************************************/ | 
					
						
							| 
									
										
										
										
											2008-12-02 14:09:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include "basefilewizard.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-23 13:03:36 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "coreconstants.h"
 | 
					
						
							|  |  |  | #include "icore.h"
 | 
					
						
							|  |  |  | #include "ifilewizardextension.h"
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include "mimedatabase.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-23 13:03:36 +01:00
										 |  |  | #include "editormanager/editormanager.h"
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 12:39:20 +01:00
										 |  |  | #include <extensionsystem/pluginmanager.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <utils/filewizarddialog.h>
 | 
					
						
							| 
									
										
										
										
											2009-11-26 18:03:16 +01:00
										 |  |  | #include <utils/qtcassert.h>
 | 
					
						
							| 
									
										
										
										
											2010-06-08 17:33:37 +02:00
										 |  |  | #include <utils/stringutils.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <QtCore/QDir>
 | 
					
						
							|  |  |  | #include <QtCore/QFile>
 | 
					
						
							|  |  |  | #include <QtCore/QFileInfo>
 | 
					
						
							|  |  |  | #include <QtCore/QVector>
 | 
					
						
							|  |  |  | #include <QtCore/QDebug>
 | 
					
						
							|  |  |  | #include <QtCore/QSharedData>
 | 
					
						
							|  |  |  | #include <QtCore/QEventLoop>
 | 
					
						
							|  |  |  | #include <QtCore/QSharedPointer>
 | 
					
						
							| 
									
										
										
										
											2010-09-07 10:07:30 +02:00
										 |  |  | #include <QtCore/QScopedPointer>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <QtGui/QMessageBox>
 | 
					
						
							|  |  |  | #include <QtGui/QWizard>
 | 
					
						
							|  |  |  | #include <QtGui/QMainWindow>
 | 
					
						
							| 
									
										
										
										
											2010-03-18 10:59:06 +01:00
										 |  |  | #include <QtGui/QIcon>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | enum { debugWizard = 0 }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \class Core::GeneratedFile | 
					
						
							|  |  |  |     \brief Represents a file generated by a wizard. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     The Wizard class will check for each file whether it already exists and will | 
					
						
							|  |  |  |     report any errors that may occur during creation of the files. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     \sa Core::BaseFileWizardParameters, Core::BaseFileWizard, Core::StandardFileWizard | 
					
						
							|  |  |  |     \sa Core::Internal::WizardEventLoop | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | namespace Core { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 14:09:21 +01:00
										 |  |  | class GeneratedFilePrivate : public QSharedData | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2009-06-29 14:47:04 +02:00
										 |  |  |     GeneratedFilePrivate() : binary(false) {} | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     explicit GeneratedFilePrivate(const QString &p); | 
					
						
							|  |  |  |     QString path; | 
					
						
							| 
									
										
										
										
											2009-06-29 14:47:04 +02:00
										 |  |  |     QByteArray contents; | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     QString editorId; | 
					
						
							| 
									
										
										
										
											2009-06-29 14:47:04 +02:00
										 |  |  |     bool binary; | 
					
						
							| 
									
										
										
										
											2010-04-16 15:55:32 +02:00
										 |  |  |     GeneratedFile::Attributes attributes; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GeneratedFilePrivate::GeneratedFilePrivate(const QString &p) : | 
					
						
							| 
									
										
										
										
											2010-09-30 16:50:59 +02:00
										 |  |  |     path(QDir::cleanPath(p)), | 
					
						
							| 
									
										
										
										
											2010-04-16 15:55:32 +02:00
										 |  |  |     binary(false), | 
					
						
							| 
									
										
										
										
											2010-09-30 14:35:44 +02:00
										 |  |  |     attributes(0) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GeneratedFile::GeneratedFile() : | 
					
						
							|  |  |  |     m_d(new GeneratedFilePrivate) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GeneratedFile::GeneratedFile(const QString &p) : | 
					
						
							|  |  |  |     m_d(new GeneratedFilePrivate(p)) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GeneratedFile::GeneratedFile(const GeneratedFile &rhs) : | 
					
						
							|  |  |  |     m_d(rhs.m_d) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GeneratedFile &GeneratedFile::operator=(const GeneratedFile &rhs) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (this != &rhs) | 
					
						
							|  |  |  |         m_d.operator=(rhs.m_d); | 
					
						
							|  |  |  |     return *this; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GeneratedFile::~GeneratedFile() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString GeneratedFile::path() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_d->path; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneratedFile::setPath(const QString &p) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-09-30 16:50:59 +02:00
										 |  |  |     m_d->path = QDir::cleanPath(p); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString GeneratedFile::contents() const | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-06-29 14:47:04 +02:00
										 |  |  |     return QString::fromUtf8(m_d->contents); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneratedFile::setContents(const QString &c) | 
					
						
							| 
									
										
										
										
											2009-06-29 14:47:04 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     m_d->contents = c.toUtf8(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QByteArray GeneratedFile::binaryContents() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_d->contents; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneratedFile::setBinaryContents(const QByteArray &c) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     m_d->contents = c; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-29 14:47:04 +02:00
										 |  |  | bool GeneratedFile::isBinary() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_d->binary; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneratedFile::setBinary(bool b) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_d->binary = b; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | QString GeneratedFile::editorId() const | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     return m_d->editorId; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | void GeneratedFile::setEditorId(const QString &k) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     m_d->editorId = k; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool GeneratedFile::write(QString *errorMessage) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     // Ensure the directory
 | 
					
						
							|  |  |  |     const QFileInfo info(m_d->path); | 
					
						
							|  |  |  |     const QDir dir = info.absoluteDir(); | 
					
						
							|  |  |  |     if (!dir.exists()) { | 
					
						
							|  |  |  |         if (!dir.mkpath(dir.absolutePath())) { | 
					
						
							|  |  |  |             *errorMessage = BaseFileWizard::tr("Unable to create the directory %1.").arg(dir.absolutePath()); | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     // Write out
 | 
					
						
							|  |  |  |     QFile file(m_d->path); | 
					
						
							| 
									
										
										
										
											2009-06-29 14:47:04 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QIODevice::OpenMode flags = QIODevice::WriteOnly|QIODevice::Truncate; | 
					
						
							|  |  |  |     if (!isBinary()) | 
					
						
							|  |  |  |         flags |= QIODevice::Text; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (!file.open(flags)) { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         *errorMessage = BaseFileWizard::tr("Unable to open %1 for writing: %2").arg(m_d->path, file.errorString()); | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-06-29 14:47:04 +02:00
										 |  |  |     if (file.write(m_d->contents) == -1) { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         *errorMessage =  BaseFileWizard::tr("Error while writing to %1: %2").arg(m_d->path, file.errorString()); | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     file.close(); | 
					
						
							|  |  |  |     return true; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2008-12-02 14:09:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-16 15:55:32 +02:00
										 |  |  | GeneratedFile::Attributes GeneratedFile::attributes() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_d->attributes; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneratedFile::setAttributes(Attributes a) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_d->attributes = a; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2008-12-02 14:09:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | // ------------ BaseFileWizardParameterData
 | 
					
						
							| 
									
										
										
										
											2008-12-02 14:09:21 +01:00
										 |  |  | class BaseFileWizardParameterData : public QSharedData | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2010-01-14 14:14:39 +01:00
										 |  |  |     explicit BaseFileWizardParameterData(IWizard::WizardKind kind = IWizard::FileWizard); | 
					
						
							| 
									
										
										
										
											2010-03-12 11:20:32 +01:00
										 |  |  |     void clear(); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-14 14:14:39 +01:00
										 |  |  |     IWizard::WizardKind kind; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QIcon icon; | 
					
						
							|  |  |  |     QString description; | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     QString displayName; | 
					
						
							| 
									
										
										
										
											2009-11-27 10:33:24 +01:00
										 |  |  |     QString id; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     QString category; | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     QString displayCategory; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-14 14:14:39 +01:00
										 |  |  | BaseFileWizardParameterData::BaseFileWizardParameterData(IWizard::WizardKind k) : | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     kind(k) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-12 11:20:32 +01:00
										 |  |  | void BaseFileWizardParameterData::clear() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     kind = IWizard::FileWizard; | 
					
						
							|  |  |  |     icon = QIcon(); | 
					
						
							|  |  |  |     description.clear(); | 
					
						
							|  |  |  |     displayName.clear(); | 
					
						
							|  |  |  |     id.clear(); | 
					
						
							|  |  |  |     category.clear(); | 
					
						
							|  |  |  |     displayCategory.clear(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \class Core::BaseFileWizardParameters | 
					
						
							|  |  |  |     \brief Parameter class for passing parameters to instances of class Wizard | 
					
						
							|  |  |  |      containing name, icon and such. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     \sa Core::GeneratedFile, Core::BaseFileWizard, Core::StandardFileWizard | 
					
						
							|  |  |  |     \sa Core::Internal::WizardEventLoop | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-14 14:14:39 +01:00
										 |  |  | BaseFileWizardParameters::BaseFileWizardParameters(IWizard::WizardKind kind) : | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |    m_d(new BaseFileWizardParameterData(kind)) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | BaseFileWizardParameters::BaseFileWizardParameters(const BaseFileWizardParameters &rhs) : | 
					
						
							|  |  |  |     m_d(rhs.m_d) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | BaseFileWizardParameters &BaseFileWizardParameters::operator=(const BaseFileWizardParameters &rhs) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (this != &rhs) | 
					
						
							|  |  |  |         m_d.operator=(rhs.m_d); | 
					
						
							|  |  |  |     return *this; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | BaseFileWizardParameters::~BaseFileWizardParameters() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-12 11:20:32 +01:00
										 |  |  | void BaseFileWizardParameters::clear() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_d->clear(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | CORE_EXPORT QDebug operator<<(QDebug d, const BaseFileWizardParameters &p) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     d.nospace() << "Kind: " << p.kind() << " Id: " << p.id() | 
					
						
							|  |  |  |                 << " Category: " << p.category() | 
					
						
							|  |  |  |                 << " DisplayName: " << p.displayName() | 
					
						
							|  |  |  |                 << " Description: " << p.description() | 
					
						
							|  |  |  |                 << " DisplayCategory: " << p.displayCategory(); | 
					
						
							|  |  |  |     return d; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-14 14:14:39 +01:00
										 |  |  | IWizard::WizardKind BaseFileWizardParameters::kind() const | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     return m_d->kind; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-14 14:14:39 +01:00
										 |  |  | void BaseFileWizardParameters::setKind(IWizard::WizardKind k) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     m_d->kind = k; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QIcon BaseFileWizardParameters::icon() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_d->icon; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void BaseFileWizardParameters::setIcon(const QIcon &icon) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_d->icon = icon; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString BaseFileWizardParameters::description() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_d->description; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void BaseFileWizardParameters::setDescription(const QString &v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_d->description = v; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | QString BaseFileWizardParameters::displayName() const | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     return m_d->displayName; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | void BaseFileWizardParameters::setDisplayName(const QString &v) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     m_d->displayName = v; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-27 10:33:24 +01:00
										 |  |  | QString BaseFileWizardParameters::id() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_d->id; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void BaseFileWizardParameters::setId(const QString &v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_d->id = v; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | QString BaseFileWizardParameters::category() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_d->category; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void BaseFileWizardParameters::setCategory(const QString &v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_d->category = v; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | QString BaseFileWizardParameters::displayCategory() const | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     return m_d->displayCategory; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | void BaseFileWizardParameters::setDisplayCategory(const QString &v) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     m_d->displayCategory = v; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \class Core::Internal::WizardEventLoop | 
					
						
							|  |  |  |     \brief Special event loop that runs a QWizard and terminates if the page changes. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Use by Core::BaseFileWizard to intercept the change from the standard wizard pages | 
					
						
							|  |  |  |     to the extension pages (as the latter require the list of Core::GeneratedFile generated). | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Synopsis: | 
					
						
							|  |  |  |     \code | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     Wizard wizard(parent); | 
					
						
							|  |  |  |     WizardEventLoop::WizardResult wr; | 
					
						
							|  |  |  |     do { | 
					
						
							|  |  |  |         wr = WizardEventLoop::execWizardPage(wizard); | 
					
						
							|  |  |  |     } while (wr == WizardEventLoop::PageChanged); | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  |     \endcode | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     \sa Core::GeneratedFile, Core::BaseFileWizardParameters, Core::BaseFileWizard, Core::StandardFileWizard | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | class WizardEventLoop : public QEventLoop | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  |     Q_DISABLE_COPY(WizardEventLoop) | 
					
						
							|  |  |  |     WizardEventLoop(QObject *parent); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     enum WizardResult { Accepted, Rejected , PageChanged }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     static WizardResult execWizardPage(QWizard &w); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private slots: | 
					
						
							|  |  |  |     void pageChanged(int); | 
					
						
							|  |  |  |     void accepted(); | 
					
						
							|  |  |  |     void rejected(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     WizardResult execWizardPageI(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     WizardResult m_result; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | WizardEventLoop::WizardEventLoop(QObject *parent) : | 
					
						
							|  |  |  |     QEventLoop(parent), | 
					
						
							|  |  |  |     m_result(Rejected) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | WizardEventLoop::WizardResult WizardEventLoop::execWizardPage(QWizard &wizard) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /* Install ourselves on the wizard. Main trick is here to connect
 | 
					
						
							|  |  |  |      * to the page changed signal and quit() on it. */ | 
					
						
							|  |  |  |     WizardEventLoop *eventLoop = wizard.findChild<WizardEventLoop *>(); | 
					
						
							|  |  |  |     if (!eventLoop) { | 
					
						
							|  |  |  |         eventLoop = new WizardEventLoop(&wizard); | 
					
						
							|  |  |  |         connect(&wizard, SIGNAL(currentIdChanged(int)), eventLoop, SLOT(pageChanged(int))); | 
					
						
							|  |  |  |         connect(&wizard, SIGNAL(accepted()), eventLoop, SLOT(accepted())); | 
					
						
							|  |  |  |         connect(&wizard, SIGNAL(rejected()), eventLoop, SLOT(rejected())); | 
					
						
							|  |  |  |         wizard.setAttribute(Qt::WA_ShowModal, true); | 
					
						
							|  |  |  |         wizard.show(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     const WizardResult result = eventLoop->execWizardPageI(); | 
					
						
							|  |  |  |     // Quitting?
 | 
					
						
							|  |  |  |     if (result != PageChanged) | 
					
						
							|  |  |  |         delete eventLoop; | 
					
						
							|  |  |  |     if (debugWizard) | 
					
						
							|  |  |  |         qDebug() << "WizardEventLoop::runWizard" << wizard.pageIds() << " returns " << result; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return result; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | WizardEventLoop::WizardResult WizardEventLoop::execWizardPageI() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_result = Rejected; | 
					
						
							|  |  |  |     exec(QEventLoop::DialogExec); | 
					
						
							|  |  |  |     return m_result; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void WizardEventLoop::pageChanged(int /*page*/) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_result = PageChanged; | 
					
						
							|  |  |  |     quit(); // !
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void WizardEventLoop::accepted() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_result = Accepted; | 
					
						
							|  |  |  |     quit(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void WizardEventLoop::rejected() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_result = Rejected; | 
					
						
							|  |  |  |     quit(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \class Core::BaseFileWizard | 
					
						
							|  |  |  |     \brief A generic wizard for creating files. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     The abstract methods: | 
					
						
							|  |  |  |     \list | 
					
						
							|  |  |  |     \o createWizardDialog(): Called to create the QWizard dialog to be shown | 
					
						
							|  |  |  |     \o generateFiles(): Generate file content | 
					
						
							|  |  |  |     \endlist | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     must be implemented. | 
					
						
							|  |  |  |     The behaviour can be further customized by overwriting the virtual method \c postGenerateFiles(), | 
					
						
							|  |  |  |     which is called after generating the files. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     \sa Core::GeneratedFile, Core::BaseFileWizardParameters, Core::StandardFileWizard | 
					
						
							|  |  |  |     \sa Core::Internal::WizardEventLoop | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 14:09:21 +01:00
										 |  |  | struct BaseFileWizardPrivate | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-01-20 15:31:33 +01:00
										 |  |  |     explicit BaseFileWizardPrivate(const Core::BaseFileWizardParameters ¶meters) | 
					
						
							|  |  |  |       : m_parameters(parameters), m_wizardDialog(0) | 
					
						
							|  |  |  |     {} | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const Core::BaseFileWizardParameters m_parameters; | 
					
						
							|  |  |  |     QWizard *m_wizardDialog; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // ---------------- Wizard
 | 
					
						
							|  |  |  | BaseFileWizard::BaseFileWizard(const BaseFileWizardParameters ¶meters, | 
					
						
							|  |  |  |                        QObject *parent) : | 
					
						
							|  |  |  |     IWizard(parent), | 
					
						
							| 
									
										
										
										
											2009-01-20 15:31:33 +01:00
										 |  |  |     m_d(new BaseFileWizardPrivate(parameters)) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | BaseFileWizard::~BaseFileWizard() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     delete m_d; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-14 14:14:39 +01:00
										 |  |  | IWizard::WizardKind  BaseFileWizard::kind() const | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     return m_d->m_parameters.kind(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QIcon BaseFileWizard::icon() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_d->m_parameters.icon(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString BaseFileWizard::description() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_d->m_parameters.description(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | QString BaseFileWizard::displayName() const | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     return m_d->m_parameters.displayName(); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-27 10:33:24 +01:00
										 |  |  | QString BaseFileWizard::id() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_d->m_parameters.id(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | QString BaseFileWizard::category() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_d->m_parameters.category(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | QString BaseFileWizard::displayCategory() const | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     return m_d->m_parameters.displayCategory(); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-16 17:09:36 +02:00
										 |  |  | void BaseFileWizard::runWizard(const QString &path, QWidget *parent) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-09-16 17:09:36 +02:00
										 |  |  |     QTC_ASSERT(!path.isEmpty(), return); | 
					
						
							| 
									
										
										
										
											2009-11-26 18:03:16 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     typedef  QList<IFileWizardExtension*> ExtensionList; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QString errorMessage; | 
					
						
							|  |  |  |     // Compile extension pages, purge out unused ones
 | 
					
						
							|  |  |  |     ExtensionList extensions = ExtensionSystem::PluginManager::instance()->getObjects<IFileWizardExtension>(); | 
					
						
							|  |  |  |     WizardPageList  allExtensionPages; | 
					
						
							|  |  |  |     for (ExtensionList::iterator it = extensions.begin(); it !=  extensions.end(); ) { | 
					
						
							|  |  |  |         const WizardPageList extensionPages = (*it)->extensionPages(this); | 
					
						
							|  |  |  |         if (extensionPages.empty()) { | 
					
						
							|  |  |  |             it = extensions.erase(it); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             allExtensionPages += extensionPages; | 
					
						
							|  |  |  |             ++it; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (debugWizard) | 
					
						
							|  |  |  |         qDebug() << Q_FUNC_INFO <<  path << parent << "exs" <<  extensions.size() << allExtensionPages.size(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QWizardPage *firstExtensionPage = 0; | 
					
						
							|  |  |  |     if (!allExtensionPages.empty()) | 
					
						
							|  |  |  |         firstExtensionPage = allExtensionPages.front(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // Create dialog and run it. Ensure that the dialog is deleted when
 | 
					
						
							|  |  |  |     // leaving the func, but not before the IFileWizardExtension::process
 | 
					
						
							|  |  |  |     // has been called
 | 
					
						
							| 
									
										
										
										
											2010-09-07 10:07:30 +02:00
										 |  |  |     const QScopedPointer<QWizard> wizard(createWizardDialog(parent, path, allExtensionPages)); | 
					
						
							| 
									
										
										
										
											2010-09-16 17:09:36 +02:00
										 |  |  |     QTC_ASSERT(!wizard.isNull(), return); | 
					
						
							| 
									
										
										
										
											2010-09-07 10:07:30 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     GeneratedFiles files; | 
					
						
							|  |  |  |     // Run the wizard: Call generate files on switching to the first extension
 | 
					
						
							|  |  |  |     // page is OR after 'Accepted' if there are no extension pages
 | 
					
						
							|  |  |  |     while (true) { | 
					
						
							|  |  |  |         const WizardEventLoop::WizardResult wr = WizardEventLoop::execWizardPage(*wizard); | 
					
						
							|  |  |  |         if (wr == WizardEventLoop::Rejected) { | 
					
						
							|  |  |  |             files.clear(); | 
					
						
							|  |  |  |             break; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         const bool accepted = wr == WizardEventLoop::Accepted; | 
					
						
							|  |  |  |         const bool firstExtensionPageHit = wr == WizardEventLoop::PageChanged | 
					
						
							|  |  |  |                                            && wizard->page(wizard->currentId()) == firstExtensionPage; | 
					
						
							|  |  |  |         const bool needGenerateFiles = firstExtensionPageHit || (accepted && allExtensionPages.empty()); | 
					
						
							|  |  |  |         if (needGenerateFiles) { | 
					
						
							|  |  |  |             QString errorMessage; | 
					
						
							|  |  |  |             files = generateFiles(wizard.data(), &errorMessage); | 
					
						
							|  |  |  |             if (files.empty()) { | 
					
						
							|  |  |  |                 QMessageBox::critical(0, tr("File Generation Failure"), errorMessage); | 
					
						
							|  |  |  |                 break; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (firstExtensionPageHit) | 
					
						
							| 
									
										
										
										
											2008-12-09 11:07:24 +01:00
										 |  |  |             foreach (IFileWizardExtension *ex, extensions) | 
					
						
							| 
									
										
										
										
											2010-09-02 12:14:27 +02:00
										 |  |  |                 ex->firstExtensionPageShown(files); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         if (accepted) | 
					
						
							|  |  |  |             break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (files.empty()) | 
					
						
							| 
									
										
										
										
											2010-09-16 17:09:36 +02:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     // Compile result list and prompt for overwrite
 | 
					
						
							|  |  |  |     QStringList result; | 
					
						
							|  |  |  |     foreach (const GeneratedFile &generatedFile, files) | 
					
						
							|  |  |  |         result.push_back(generatedFile.path()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-08 17:33:37 +02:00
										 |  |  |     switch (promptOverwrite(result, &errorMessage)) { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     case OverwriteCanceled: | 
					
						
							| 
									
										
										
										
											2010-09-16 17:09:36 +02:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     case OverwriteError: | 
					
						
							|  |  |  |         QMessageBox::critical(0, tr("Existing files"), errorMessage); | 
					
						
							| 
									
										
										
										
											2010-09-16 17:09:36 +02:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     case OverwriteOk: | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // Write
 | 
					
						
							| 
									
										
										
										
											2010-09-01 13:27:24 +02:00
										 |  |  |     if (!writeFiles(files, &errorMessage)) { | 
					
						
							|  |  |  |         QMessageBox::critical(parent, tr("File Generation Failure"), errorMessage); | 
					
						
							| 
									
										
										
										
											2010-09-16 17:09:36 +02:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-09-01 13:27:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-26 18:33:16 +02:00
										 |  |  |     bool removeOpenProjectAttribute = false; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     // Run the extensions
 | 
					
						
							| 
									
										
										
										
											2010-08-26 18:33:16 +02:00
										 |  |  |     foreach (IFileWizardExtension *ex, extensions) { | 
					
						
							|  |  |  |         bool remove; | 
					
						
							| 
									
										
										
										
											2010-09-02 12:14:27 +02:00
										 |  |  |         if (!ex->process(files, &remove, &errorMessage)) { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |             QMessageBox::critical(parent, tr("File Generation Failure"), errorMessage); | 
					
						
							| 
									
										
										
										
											2010-09-16 17:09:36 +02:00
										 |  |  |             return; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-08-26 18:33:16 +02:00
										 |  |  |         removeOpenProjectAttribute |= remove; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (removeOpenProjectAttribute) { | 
					
						
							|  |  |  |         for (int i = 0; i < files.count(); i++) { | 
					
						
							|  |  |  |             if (files[i].attributes() & Core::GeneratedFile::OpenProjectAttribute) | 
					
						
							|  |  |  |                 files[i].setAttributes(Core::GeneratedFile::OpenEditorAttribute); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // Post generation handler
 | 
					
						
							| 
									
										
										
										
											2010-09-16 17:09:36 +02:00
										 |  |  |     if (!postGenerateFiles(wizard.data(), files, &errorMessage)) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         QMessageBox::critical(0, tr("File Generation Failure"), errorMessage); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \fn virtual QWizard *Core::BaseFileWizard::createWizardDialog(QWidget *parent, | 
					
						
							|  |  |  |                                                                   const QString &defaultPath, | 
					
						
							|  |  |  |                                                                   const WizardPageList &extensionPages) const = 0 | 
					
						
							|  |  |  |     \brief Implement to create the wizard dialog on the parent, adding the extension pages. | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*!
 | 
					
						
							|  |  |  |     \fn virtual Core::GeneratedFiles Core::BaseFileWizard::generateFiles(const QWizard *w, | 
					
						
							|  |  |  |                                                                          QString *errorMessage) const = 0 | 
					
						
							|  |  |  |      \brief Overwrite to query the parameters from the dialog and generate the files. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      Note: This does not generate physical files, but merely the list of Core::GeneratedFile. | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*!
 | 
					
						
							|  |  |  |     \brief Physically write files. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Re-implement (calling the base implementation) to create files with CustomGeneratorAttribute set. | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-01 13:27:24 +02:00
										 |  |  | bool BaseFileWizard::writeFiles(const GeneratedFiles &files, QString *errorMessage) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     foreach (const GeneratedFile &generatedFile, files) | 
					
						
							|  |  |  |         if (!(generatedFile.attributes() & GeneratedFile::CustomGeneratorAttribute)) | 
					
						
							|  |  |  |             if (!generatedFile.write(errorMessage)) | 
					
						
							|  |  |  |                 return false; | 
					
						
							|  |  |  |     return true; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \brief Sets some standard options on a QWizard | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2010-09-01 13:27:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | void BaseFileWizard::setupWizard(QWizard *w) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-12-03 16:34:33 +01:00
										 |  |  |     w->setOption(QWizard::NoCancelButton, false); | 
					
						
							|  |  |  |     w->setOption(QWizard::NoDefaultButton, false); | 
					
						
							| 
									
										
										
										
											2009-05-29 13:43:34 +02:00
										 |  |  |     w->setOption(QWizard::NoBackButtonOnStartPage, true); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \brief Read "shortTitle" dynamic property of the pageId and apply it as the title | 
					
						
							|  |  |  |     of corresponding progress item | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-31 14:48:08 +02:00
										 |  |  | void BaseFileWizard::applyExtensionPageShortTitle(Utils::Wizard *wizard, int pageId) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (pageId < 0) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     QWizardPage *p = wizard->page(pageId); | 
					
						
							|  |  |  |     if (!p) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     Utils::WizardProgressItem *item = wizard->wizardProgress()->item(pageId); | 
					
						
							|  |  |  |     if (!item) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     const QString shortTitle = p->property("shortTitle").toString(); | 
					
						
							|  |  |  |     if (!shortTitle.isEmpty()) | 
					
						
							|  |  |  |       item->setTitle(shortTitle); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \brief Overwrite to perform steps to be done after files are actually created. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     The default implementation opens editors with the newly generated files. | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-16 15:55:32 +02:00
										 |  |  | bool BaseFileWizard::postGenerateFiles(const QWizard *, const GeneratedFiles &l, QString *errorMessage) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return BaseFileWizard::postGenerateOpenEditors(l, errorMessage); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \brief Utility to open the editors for the files whose attribute is set accordingly. | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-16 15:55:32 +02:00
										 |  |  | bool BaseFileWizard::postGenerateOpenEditors(const GeneratedFiles &l, QString *errorMessage) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-01-21 15:52:34 +01:00
										 |  |  |     Core::EditorManager *em = Core::EditorManager::instance(); | 
					
						
							| 
									
										
										
										
											2010-04-16 15:55:32 +02:00
										 |  |  |     foreach(const Core::GeneratedFile &file, l) { | 
					
						
							|  |  |  |         if (file.attributes() & Core::GeneratedFile::OpenEditorAttribute) { | 
					
						
							| 
									
										
										
										
											2010-09-24 12:51:58 +02:00
										 |  |  |             if (!em->openEditor(file.path(), file.editorId(), Core::EditorManager::ModeSwitch )) { | 
					
						
							| 
									
										
										
										
											2010-04-16 15:55:32 +02:00
										 |  |  |                 if (errorMessage) | 
					
						
							| 
									
										
										
										
											2010-09-30 16:50:59 +02:00
										 |  |  |                     *errorMessage = tr("Failed to open an editor for '%1'.").arg(QDir::toNativeSeparators(file.path())); | 
					
						
							| 
									
										
										
										
											2010-04-16 15:55:32 +02:00
										 |  |  |                 return false; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return true; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \brief Utility that performs an overwrite check on a set of files. It checks if | 
					
						
							|  |  |  |     the file exists, can be overwritten at all and prompts the user with a summary. | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-08 17:33:37 +02:00
										 |  |  | BaseFileWizard::OverwriteResult BaseFileWizard::promptOverwrite(const QStringList &files, | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |                                                                 QString *errorMessage) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (debugWizard) | 
					
						
							| 
									
										
										
										
											2010-06-08 17:33:37 +02:00
										 |  |  |         qDebug() << Q_FUNC_INFO << files; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-08 17:33:37 +02:00
										 |  |  |     QStringList existingFiles; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     bool oddStuffFound = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     static const QString readOnlyMsg = tr(" [read only]"); | 
					
						
							|  |  |  |     static const QString directoryMsg = tr(" [directory]"); | 
					
						
							|  |  |  |     static const QString symLinkMsg = tr(" [symbolic link]"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-08 17:33:37 +02:00
										 |  |  |     foreach (const QString &fileName, files) { | 
					
						
							|  |  |  |         const QFileInfo fi(fileName); | 
					
						
							|  |  |  |         if (fi.exists()) | 
					
						
							|  |  |  |             existingFiles.append(fileName); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     // Note: Generated files are using native separators, no need to convert.
 | 
					
						
							|  |  |  |     const QString commonExistingPath = Utils::commonPath(existingFiles); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     // Format a file list message as ( "<file1> [readonly], <file2> [directory]").
 | 
					
						
							|  |  |  |     QString fileNamesMsgPart; | 
					
						
							| 
									
										
										
										
											2010-06-08 17:33:37 +02:00
										 |  |  |     foreach (const QString &fileName, existingFiles) { | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         const QFileInfo fi(fileName); | 
					
						
							|  |  |  |         if (fi.exists()) { | 
					
						
							|  |  |  |             if (!fileNamesMsgPart.isEmpty()) | 
					
						
							|  |  |  |                 fileNamesMsgPart += QLatin1String(", "); | 
					
						
							| 
									
										
										
										
											2010-09-30 16:50:59 +02:00
										 |  |  |             fileNamesMsgPart += QDir::toNativeSeparators(fileName.mid(commonExistingPath.size() + 1)); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |             do { | 
					
						
							|  |  |  |                 if (fi.isDir()) { | 
					
						
							|  |  |  |                     oddStuffFound = true; | 
					
						
							|  |  |  |                     fileNamesMsgPart += directoryMsg; | 
					
						
							|  |  |  |                     break; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 if (fi.isSymLink()) { | 
					
						
							|  |  |  |                     oddStuffFound = true; | 
					
						
							|  |  |  |                     fileNamesMsgPart += symLinkMsg; | 
					
						
							|  |  |  |                     break; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |                 if (!fi.isWritable()) { | 
					
						
							|  |  |  |                     oddStuffFound = true; | 
					
						
							|  |  |  |                     fileNamesMsgPart += readOnlyMsg; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } while (false); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-08 17:33:37 +02:00
										 |  |  |     if (existingFiles.isEmpty()) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         return OverwriteOk; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (oddStuffFound) { | 
					
						
							| 
									
										
										
										
											2010-09-30 16:50:59 +02:00
										 |  |  |         *errorMessage = tr("The project directory %1 contains files which cannot be overwritten:\n%2.") | 
					
						
							|  |  |  |                 .arg(QDir::toNativeSeparators(commonExistingPath)).arg(fileNamesMsgPart); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         return OverwriteError; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const QString messageFormat = tr("The following files already exist in the directory %1:\n" | 
					
						
							|  |  |  |                                      "%2.\nWould you like to overwrite them?"); | 
					
						
							| 
									
										
										
										
											2010-09-30 16:50:59 +02:00
										 |  |  |     const QString message = messageFormat.arg(QDir::toNativeSeparators(commonExistingPath)).arg(fileNamesMsgPart); | 
					
						
							| 
									
										
										
										
											2009-01-20 15:31:33 +01:00
										 |  |  |     const bool yes = (QMessageBox::question(Core::ICore::instance()->mainWindow(), | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |                                             tr("Existing files"), message, | 
					
						
							|  |  |  |                                             QMessageBox::Yes | QMessageBox::No, | 
					
						
							|  |  |  |                                             QMessageBox::No) | 
					
						
							|  |  |  |                       == QMessageBox::Yes); | 
					
						
							|  |  |  |     return yes ? OverwriteOk :  OverwriteCanceled; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \brief Build a file name, adding the extension unless baseName already has one. | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | QString BaseFileWizard::buildFileName(const QString &path, | 
					
						
							|  |  |  |                                       const QString &baseName, | 
					
						
							|  |  |  |                                       const QString &extension) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QString rc = path; | 
					
						
							|  |  |  |     if (!rc.isEmpty() && !rc.endsWith(QDir::separator())) | 
					
						
							|  |  |  |         rc += QDir::separator(); | 
					
						
							|  |  |  |     rc += baseName; | 
					
						
							|  |  |  |     // Add extension unless user specified something else
 | 
					
						
							|  |  |  |     const QChar dot = QLatin1Char('.'); | 
					
						
							|  |  |  |     if (!extension.isEmpty() && !baseName.contains(dot)) { | 
					
						
							|  |  |  |         if (!extension.startsWith(dot)) | 
					
						
							|  |  |  |             rc += dot; | 
					
						
							|  |  |  |         rc += extension; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (debugWizard) | 
					
						
							|  |  |  |         qDebug() << Q_FUNC_INFO << rc; | 
					
						
							|  |  |  |     return rc; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \brief Utility that returns the preferred suffix for a mime type | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-16 14:19:34 +01:00
										 |  |  | QString BaseFileWizard::preferredSuffix(const QString &mimeType) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-01-20 15:31:33 +01:00
										 |  |  |     const QString rc = Core::ICore::instance()->mimeDatabase()->preferredSuffixByType(mimeType); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     if (rc.isEmpty()) | 
					
						
							|  |  |  |         qWarning("%s: WARNING: Unable to find a preferred suffix for %s.", | 
					
						
							|  |  |  |                  Q_FUNC_INFO, mimeType.toUtf8().constData()); | 
					
						
							|  |  |  |     return rc; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \class Core::StandardFileWizard | 
					
						
							|  |  |  |     \brief Convenience class for creating one file. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     It uses Utils::FileWizardDialog and introduces a new virtual to generate the | 
					
						
							|  |  |  |     files from path and name. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     \sa Core::GeneratedFile, Core::BaseFileWizardParameters, Core::BaseFileWizard | 
					
						
							|  |  |  |     \sa Core::Internal::WizardEventLoop | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*!
 | 
					
						
							|  |  |  |     \fn Core::GeneratedFiles Core::StandardFileWizard::generateFilesFromPath(const QString &path, | 
					
						
							|  |  |  |                                                                              const QString &name, | 
					
						
							|  |  |  |                                                                              QString *errorMessage) const = 0 | 
					
						
							|  |  |  |     \brief Newly introduced virtual that creates the files under the path. | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | StandardFileWizard::StandardFileWizard(const BaseFileWizardParameters ¶meters, | 
					
						
							|  |  |  |                                        QObject *parent) : | 
					
						
							| 
									
										
										
										
											2009-01-20 15:31:33 +01:00
										 |  |  |     BaseFileWizard(parameters, parent) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \brief Implemented to create a Utils::FileWizardDialog. | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | QWizard *StandardFileWizard::createWizardDialog(QWidget *parent, | 
					
						
							|  |  |  |                                                 const QString &defaultPath, | 
					
						
							|  |  |  |                                                 const WizardPageList &extensionPages) const | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-10-05 11:06:05 +02:00
										 |  |  |     Utils::FileWizardDialog *standardWizardDialog = new Utils::FileWizardDialog(parent); | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     standardWizardDialog->setWindowTitle(tr("New %1").arg(displayName())); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     setupWizard(standardWizardDialog); | 
					
						
							|  |  |  |     standardWizardDialog->setPath(defaultPath); | 
					
						
							|  |  |  |     foreach (QWizardPage *p, extensionPages) | 
					
						
							| 
									
										
										
										
											2010-03-31 14:48:08 +02:00
										 |  |  |         BaseFileWizard::applyExtensionPageShortTitle(standardWizardDialog, standardWizardDialog->addPage(p)); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     return standardWizardDialog; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 12:18:25 +02:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |     \brief Implemented to retrieve path and name and call generateFilesFromPath() | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | GeneratedFiles StandardFileWizard::generateFiles(const QWizard *w, | 
					
						
							|  |  |  |                                                  QString *errorMessage) const | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-10-05 11:06:05 +02:00
										 |  |  |     const Utils::FileWizardDialog *standardWizardDialog = qobject_cast<const Utils::FileWizardDialog *>(w); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     return generateFilesFromPath(standardWizardDialog->path(), | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |                                  standardWizardDialog->fileName(), | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |                                  errorMessage); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace Core
 | 
					
						
							| 
									
										
										
										
											2008-12-02 14:09:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include "basefilewizard.moc"
 |