parts/appwizard/appwizardpart.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
#include <qdir.h>
00013
#include <qwidget.h>
00014
#include <kdebug.h>
00015
#include <klocale.h>
00016
#include <kmessagebox.h>
00017
#include <kprocess.h>
00018
#include <kdevcore.h>
00019
#include <kgenericfactory.h>
00020
#include <kstandarddirs.h>
00021
#include <kaction.h>
00022
#include <qmessagebox.h>
00023
00024
#include "importdlg.h"
00025
#include "appwizarddlg.h"
00026
#include "appwizardpart.h"
00027
#include "appwizardfactory.h"
00028
#include <kdevmakefrontend.h>
00029
#include <kdevpartcontroller.h>
00030
#include <kdevlanguagesupport.h>
00031
#include <codemodel.h>
00032
00033 AppWizardPart::AppWizardPart(
QObject *parent,
const char *name,
const QStringList &)
00034 :
KDevPlugin("AppWizard", "appwizard", parent, name ? name : "
AppWizardPart")
00035 {
00036 setInstance(AppWizardFactory::instance());
00037 setXMLFile(
"kdevappwizard.rc");
00038
00039
KAction *action;
00040
00041 action =
new KAction( i18n(
"&New Project..."),
"window_new", 0,
00042
this, SLOT(
slotNewProject()),
00043
actionCollection(),
"project_new" );
00044 action->setToolTip( i18n(
"Generate a new project from a template") );
00045 action->setWhatsThis( i18n(
"<b>New project</b><p>"
00046
"This starts KDevelop's application wizard. "
00047
"It helps you to generate a skeleton for your "
00048
"application from a set of templates.") );
00049
00050 action =
new KAction( i18n(
"&Import Existing Project..."),
"wizard", 0,
00051
this, SLOT(
slotImportProject()),
00052
actionCollection(),
"project_import" );
00053 action->setToolTip( i18n(
"Import existing project") );
00054 action->setWhatsThis( i18n(
"<b>Import existing project</b><p>Creates a project file for a given directory.") );
00055 }
00056
00057
00058 AppWizardPart::~AppWizardPart()
00059 {
00060 }
00061
00062
00063 void AppWizardPart::slotNewProject()
00064 {
00065
kdDebug(9010) <<
"new project" <<
endl;
00066
AppWizardDialog dlg(
this, 0,
"app wizard");
00067 connect(
makeFrontend(), SIGNAL(commandFinished(
const QString&)),
00068
this, SLOT(
slotCommandFinished(
const QString&)) );
00069 dlg.
templates_listview->setFocus();
00070
if (dlg.exec()) {
00071
m_creationCommand = dlg.
getCommandLine();
00072
m_projectLocation = dlg.
getProjectLocation() +
"/";
00073
m_projectFileName =
m_projectLocation + dlg.
getProjectName().lower() +
".kdevelop";
00074
m_openFilesAfterGeneration = dlg.
getFilesToOpenAfterGeneration();
00075 }
else {
00076 disconnect(
makeFrontend(), 0,
this, 0);
00077 }
00078 }
00079
00080
00081 void AppWizardPart::slotImportProject()
00082 {
00083
ImportDialog dlg(
this, 0,
"import dialog");
00084 dlg.exec();
00085 }
00086
00087 void AppWizardPart::openSpecifiedFiles()
00088 {
00089
for ( QStringList::Iterator it =
m_openFilesAfterGeneration.begin();
00090 it !=
m_openFilesAfterGeneration.end(); ++it ) {
00091
if ( !(*it).isNull() ) {
00092
KURL url(
m_projectLocation + *it);
00093
kdDebug(9010) <<
"Try to open: " << url.
url() <<
endl;
00094
partController()->
editDocument(url);
00095 }
00096 }
00097 }
00098
00099 void AppWizardPart::slotCommandFinished(
const QString &command)
00100 {
00101
if (
m_creationCommand == command){
00102
00103
core()->
openProject(
m_projectFileName);
00104
00105
openSpecifiedFiles();
00106
00107 disconnect(
makeFrontend(), 0,
this, 0);
00108 }
00109 }
00110
00111
#include "appwizardpart.moc"
This file is part of the documentation for KDevelop Version 3.0.4.