summaryrefslogtreecommitdiffstats
path: root/parts/filecreate
diff options
context:
space:
mode:
Diffstat (limited to 'parts/filecreate')
-rw-r--r--parts/filecreate/Makefile.am23
-rw-r--r--parts/filecreate/README3
-rw-r--r--parts/filecreate/README.dox76
-rw-r--r--parts/filecreate/addglobaldlg.cpp106
-rw-r--r--parts/filecreate/addglobaldlg.h44
-rw-r--r--parts/filecreate/fcconfigwidget.cpp709
-rw-r--r--parts/filecreate/fcconfigwidget.h72
-rw-r--r--parts/filecreate/fcconfigwidgetbase.ui540
-rw-r--r--parts/filecreate/fctemplateedit.cpp36
-rw-r--r--parts/filecreate/fctemplateedit.h30
-rw-r--r--parts/filecreate/fctemplateeditbase.ui193
-rw-r--r--parts/filecreate/fctemplateeditbase.ui.h26
-rw-r--r--parts/filecreate/fctypeedit.cpp40
-rw-r--r--parts/filecreate/fctypeedit.h30
-rw-r--r--parts/filecreate/fctypeeditbase.ui282
-rw-r--r--parts/filecreate/fctypeeditbase.ui.h26
-rw-r--r--parts/filecreate/file-templates/Makefile.am2
-rw-r--r--parts/filecreate/file-templates/dox22
-rw-r--r--parts/filecreate/file-templates/qrc5
-rw-r--r--parts/filecreate/file-templates/ts2
-rw-r--r--parts/filecreate/file-templates/ui20
-rw-r--r--parts/filecreate/file-templates/ui-confdialog165
-rw-r--r--parts/filecreate/file-templates/ui-dialog20
-rw-r--r--parts/filecreate/file-templates/ui-dialog-qt422
-rw-r--r--parts/filecreate/file-templates/ui-dialogb123
-rw-r--r--parts/filecreate/file-templates/ui-dialogb-qt4100
-rw-r--r--parts/filecreate/file-templates/ui-dialogr123
-rw-r--r--parts/filecreate/file-templates/ui-dialogr-qt4100
-rw-r--r--parts/filecreate/file-templates/ui-mainwin436
-rw-r--r--parts/filecreate/file-templates/ui-mainwin-qt434
-rw-r--r--parts/filecreate/file-templates/ui-tabdialog147
-rw-r--r--parts/filecreate/file-templates/ui-widget20
-rw-r--r--parts/filecreate/file-templates/ui-widget-qt422
-rw-r--r--parts/filecreate/file-templates/ui-wizard28
-rw-r--r--parts/filecreate/filecreate_filedialog.cpp65
-rw-r--r--parts/filecreate/filecreate_filedialog.h46
-rw-r--r--parts/filecreate/filecreate_filetype.cpp21
-rw-r--r--parts/filecreate/filecreate_filetype.h63
-rw-r--r--parts/filecreate/filecreate_listitem.cpp101
-rw-r--r--parts/filecreate/filecreate_listitem.h49
-rw-r--r--parts/filecreate/filecreate_newfile.cpp162
-rw-r--r--parts/filecreate/filecreate_newfile.h59
-rw-r--r--parts/filecreate/filecreate_part.cpp562
-rw-r--r--parts/filecreate/filecreate_part.h144
-rw-r--r--parts/filecreate/filecreate_typechooser.h47
-rw-r--r--parts/filecreate/filecreate_typechoosersig.h28
-rw-r--r--parts/filecreate/filecreate_widget2.cpp228
-rw-r--r--parts/filecreate/filecreate_widget2.h113
-rw-r--r--parts/filecreate/filecreate_widget3.cpp119
-rw-r--r--parts/filecreate/filecreate_widget3.h50
-rw-r--r--parts/filecreate/kdevfilecreate.desktop77
-rw-r--r--parts/filecreate/kdevpart_filecreate.rc11
-rw-r--r--parts/filecreate/template-info.xml181
53 files changed, 5753 insertions, 0 deletions
diff --git a/parts/filecreate/Makefile.am b/parts/filecreate/Makefile.am
new file mode 100644
index 00000000..462a8543
--- /dev/null
+++ b/parts/filecreate/Makefile.am
@@ -0,0 +1,23 @@
+#
+
+SUBDIRS = file-templates
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevfilecreate.la
+libkdevfilecreate_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevfilecreate_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevfilecreate_la_SOURCES = filecreate_part.cpp filecreate_listitem.cpp \
+ filecreate_filetype.cpp filecreate_filedialog.cpp fcconfigwidgetbase.ui fcconfigwidget.cpp \
+ fctypeeditbase.ui fctypeedit.cpp fctemplateeditbase.ui fctemplateedit.cpp \
+ filecreate_newfile.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevfilecreate.desktop
+
+rcdir = $(kde_datadir)/kdevfilecreate
+rc_DATA = kdevpart_filecreate.rc template-info.xml
diff --git a/parts/filecreate/README b/parts/filecreate/README
new file mode 100644
index 00000000..731741e1
--- /dev/null
+++ b/parts/filecreate/README
@@ -0,0 +1,3 @@
+Please read the on-line, automaticaly updated KDevelop API documentation at:
+http://www.kdevelop.org
+or read the README.dox file.
diff --git a/parts/filecreate/README.dox b/parts/filecreate/README.dox
new file mode 100644
index 00000000..50e267e8
--- /dev/null
+++ b/parts/filecreate/README.dox
@@ -0,0 +1,76 @@
+/** \class FileCreatePart
+FileCreatePart is a template manager and wizard system to assist with creation of new files.
+
+Assists with creation of new files.
+
+For those who want to look beyond the GUI, the following illustrates the XML to configure the FileCreate part for a project. It simply consists of a list of filetypes that the user may wish to create for a particular project. At present, the "create" attribute is ignored.
+
+The file create part looks for a file template called \@ext (i.e. the value of the ext attribute) in the *project's* templates directory (see the PyQT appwizard template for an example).
+
+For subtypes, it looks for a template called \@ext-\@ref, so in the example below the following files would need to be present in the project's templates directory:
+
+<code>
+py
+ui
+ui-dialog
+ui-mainwin
+</code>
+
+Example XML:
+
+<code>
+\verbatim
+ <kdevfilecreate>
+ <filetypes>
+ <type ext="py" name="Python" create="template"/>
+ <type ext="ui" name="QT Designer" create="template">
+ <subtype ref="dialog" name="Dialog"/>
+ <subtype ref="mainwin" name="Main window"/>
+ </type>
+ </filetypes>
+ </kdevfilecreate>
+\endverbatim
+</code>
+
+You can also use global template definitions supplied with the FileCreate part:
+
+<code>
+\verbatim
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="ui" />
+ </useglobaltypes>
+ <filetypes>
+ <type ext="py" name="Python" create="template"/>
+ </filetypes>
+ </kdevfilecreate>
+\endverbatim
+</code>
+
+If a type has subtypes, and no subtypes are specified, then all subtypes are assumed to be required (as in the example above). Otherwise, specific subtypes should be specified:
+
+<code>
+\verbatim
+<useglobaltypes>
+ <type ext="ui">
+ <subtype ref="dialog"/>
+ </type>
+</useglobaltypes>
+\endverbatim
+</code>
+
+Usually, this XML forms part of the base .kdevelop file created by the appwizard.
+
+\authors <a href="mailto:kde AT jrockey.com">Julian Rockey</a>
+\authors <a href="mailto:cloudtemple AT mksat.net">Alexander Dymo</a>
+
+\maintainer <a href="mailto:kde AT jrockey.com">Julian Rockey</a>
+
+\feature friendly sidebar listing the types of new file that can be created for your project
+\feature configurable per-project file types and global file types
+
+\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=file+create&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number">file create component at Bugzilla database</a>
+\bug Arrangement of text in sidebar is not always perfect
+
+
+*/
diff --git a/parts/filecreate/addglobaldlg.cpp b/parts/filecreate/addglobaldlg.cpp
new file mode 100644
index 00000000..0757d220
--- /dev/null
+++ b/parts/filecreate/addglobaldlg.cpp
@@ -0,0 +1,106 @@
+#include <klocale.h>
+/****************************************************************************
+** Form implementation generated from reading ui file './addglobaldlg.ui'
+**
+** Created: Сбт Лют 8 20:51:03 2003
+** by: The User Interface Compiler ($Id$)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#include "addglobaldlg.h"
+
+#include <qvariant.h>
+#include <qheader.h>
+#include <qlistview.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+#include <klocale.h>
+
+/*
+ * Constructs a AddGlobalDlg as a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog.
+ */
+AddGlobalDlg::AddGlobalDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
+ : QDialog( parent, name, modal, fl )
+
+{
+ if ( !name )
+ setName( "AddGlobalDlg" );
+ setSizeGripEnabled( TRUE );
+ AddGlobalDlgLayout = new QGridLayout( this, 1, 1, 11, 6, "AddGlobalDlgLayout");
+
+ Layout1 = new QHBoxLayout( 0, 0, 6, "Layout1");
+
+ buttonHelp = new KPushButton( this, "buttonHelp" );
+ buttonHelp->setAutoDefault( TRUE );
+ Layout1->addWidget( buttonHelp );
+ QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ Layout1->addItem( spacer );
+
+ buttonOk = new KPushButton( this, "buttonOk" );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ Layout1->addWidget( buttonOk );
+
+ buttonCancel = new KPushButton( this, "buttonCancel" );
+ buttonCancel->setAutoDefault( TRUE );
+ Layout1->addWidget( buttonCancel );
+
+ AddGlobalDlgLayout->addLayout( Layout1, 1, 0 );
+
+ fcglobal_view = new QListView( this, "fcglobal_view" );
+ fcglobal_view->addColumn( i18n( "Type Extension" ) );
+ fcglobal_view->addColumn( i18n( "Type Name" ) );
+ fcglobal_view->addColumn( i18n( "Template Location" ) );
+ fcglobal_view->addColumn( i18n( "Icon" ) );
+ fcglobal_view->addColumn( i18n( "Description" ) );
+ fcglobal_view->setResizePolicy( QListView::AutoOne );
+ fcglobal_view->setAllColumnsShowFocus( TRUE );
+ fcglobal_view->setRootIsDecorated( TRUE );
+ fcglobal_view->setResizeMode( QListView::AllColumns );
+
+ AddGlobalDlgLayout->addWidget( fcglobal_view, 0, 0 );
+ languageChange();
+ resize( QSize(511, 282).expandedTo(minimumSizeHint()) );
+
+ // signals and slots connections
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+AddGlobalDlg::~AddGlobalDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * Sets the strings of the subwidgets using the current
+ * language.
+ */
+void AddGlobalDlg::languageChange()
+{
+ setCaption( i18n( "Select Global File Types" ) );
+ buttonHelp->setGuiItem( KStdGuiItem::help() );
+ buttonHelp->setAccel( QKeySequence( tr2i18n( "F1" ) ) );
+ buttonOk->setGuiItem( KStdGuiItem::ok() );
+ buttonOk->setAccel( QKeySequence( QString::null ) );
+ buttonCancel->setGuiItem( KStdGuiItem::cancel() );
+ buttonCancel->setAccel( QKeySequence( QString::null ) );
+ fcglobal_view->header()->setLabel( 0, i18n( "Type extension:" ) );
+ fcglobal_view->header()->setLabel( 1, i18n( "Type name:" ) );
+ fcglobal_view->header()->setLabel( 2, i18n( "Template location:" ) );
+ fcglobal_view->header()->setLabel( 3, i18n( "Icon:" ) );
+ fcglobal_view->header()->setLabel( 4, i18n( "Description:" ) );
+}
+
+#include "addglobaldlg.moc"
diff --git a/parts/filecreate/addglobaldlg.h b/parts/filecreate/addglobaldlg.h
new file mode 100644
index 00000000..0ec8e588
--- /dev/null
+++ b/parts/filecreate/addglobaldlg.h
@@ -0,0 +1,44 @@
+/****************************************************************************
+** Form interface generated from reading ui file './addglobaldlg.ui'
+**
+** Created: Сбт Лют 8 20:48:22 2003
+** by: The User Interface Compiler ($Id$)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#ifndef ADDGLOBALDLG_H
+#define ADDGLOBALDLG_H
+
+#include <qvariant.h>
+#include <qdialog.h>
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QListView;
+class QListViewItem;
+class QPushButton;
+
+class AddGlobalDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ AddGlobalDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~AddGlobalDlg();
+
+ QPushButton* buttonHelp;
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QListView* fcglobal_view;
+
+protected:
+ QGridLayout* AddGlobalDlgLayout;
+ QHBoxLayout* Layout1;
+
+protected slots:
+ virtual void languageChange();
+};
+
+#endif // ADDGLOBALDLG_H
diff --git a/parts/filecreate/fcconfigwidget.cpp b/parts/filecreate/fcconfigwidget.cpp
new file mode 100644
index 00000000..480d38e0
--- /dev/null
+++ b/parts/filecreate/fcconfigwidget.cpp
@@ -0,0 +1,709 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include <qlistview.h>
+#include <qpushbutton.h>
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qtabwidget.h>
+#include <qdom.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qcheckbox.h>
+#include <klineedit.h>
+#include <qlabel.h>
+
+#include <kstandarddirs.h>
+#include <kio/netaccess.h>
+#include <kurlrequester.h>
+#include <kicondialog.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kiconloader.h>
+#include <kdeversion.h>
+
+#include "fctypeedit.h"
+#include "fctemplateedit.h"
+#include "domutil.h"
+#include "fcconfigwidget.h"
+#include "filecreate_part.h"
+#include "filecreate_filetype.h"
+#include "kdevproject.h"
+#include "kdevpartcontroller.h"
+
+
+FCConfigWidget::FCConfigWidget(FileCreatePart * part, bool global, QWidget *parent, const char *name):
+ FCConfigWidgetBase(parent, name), m_part(part), m_global(global)
+{
+ fc_view->setSorting(-1, FALSE);
+ fcglobal_view->setSorting(-1, FALSE);
+
+ if (m_global)
+ {
+ loadGlobalConfig(fc_view);
+ fc_tabs->setTabLabel(tab1, i18n("Global Types") );
+ fc_tabs->setTabEnabled(tab2, false);
+ fc_tabs->setTabEnabled(tab3, false);
+ delete tab2;
+ delete tab3;
+ }
+ else
+ {
+ loadGlobalConfig(fcglobal_view, true);
+ loadProjectConfig(fc_view);
+ loadProjectTemplates(fctemplates_view);
+ templatesDir_label->setText(i18n("Project templates in ") + m_part->project()->projectDirectory() + "/templates");
+ }
+
+ m_globalfiletypes.setAutoDelete(true);
+ m_projectfiletypes.setAutoDelete(true);
+ m_projectfiletemplates.setAutoDelete(true);
+}
+
+FCConfigWidget::~FCConfigWidget()
+{
+}
+
+void FCConfigWidget::accept()
+{
+ if (m_global) {
+ saveGlobalConfig();
+ }
+ else
+ saveProjectConfig();
+
+ m_part->m_filetypes.clear();
+ m_part->slotProjectOpened();
+
+ for (QValueList<KURL>::iterator it = urlsToEdit.begin(); it != urlsToEdit.end(); ++it )
+ {
+ m_part->partController()->editDocument(*it);
+ }
+}
+
+void FCConfigWidget::loadGlobalConfig(QListView *view, bool checkmarks)
+{
+ QString globalXMLFile = ::locate("data", "kdevfilecreate/template-info.xml");
+ QDomDocument globalDom;
+ if (!globalXMLFile.isNull() &&
+ DomUtil::openDOMFile(globalDom,globalXMLFile)) {
+ m_part->readTypes(globalDom, m_globalfiletypes, false);
+ }
+
+
+ loadFileTypes(m_globalfiletypes, view, checkmarks);
+
+ if (checkmarks)
+ {
+ QDomElement useGlobalTypes =
+ DomUtil::elementByPath(*(m_part->projectDom()),"/kdevfilecreate/useglobaltypes");
+ for(QDomNode node = useGlobalTypes.firstChild(); !node.isNull();node=node.nextSibling())
+ {
+ if (node.isElement() && node.nodeName()=="type")
+ {
+ QDomElement element = node.toElement();
+ QString ext = element.attribute("ext");
+ QString subtyperef = element.attribute("subtyperef");
+ if (subtyperef.isNull())
+ {
+ QListViewItem *it = view->findItem(ext, 0);
+ if (it)
+ {
+ ((QCheckListItem*)it)->setOn(true);
+
+ QListViewItem *lastChild = it->firstChild();
+ while ( lastChild )
+ {
+ ((QCheckListItem*)lastChild)->setOn(true);
+ lastChild = lastChild->nextSibling();
+ }
+ }
+ }
+ else
+ {
+ QListViewItem *it = view->findItem(subtyperef, 0);
+ if (it)
+ ((QCheckListItem*)it)->setOn(true);
+ }
+ }
+ }
+ }
+}
+
+void FCConfigWidget::loadProjectConfig(QListView *view)
+{
+ m_part->readTypes( *(m_part->projectDom()), m_projectfiletypes, false );
+ loadFileTypes(m_projectfiletypes, view, false);
+}
+
+void FCConfigWidget::loadProjectTemplates(QListView *view)
+{
+ QDir templDir( m_part->project()->projectDirectory() + "/templates/" );
+ templDir.setFilter( QDir::Files );
+ const QFileInfoList * list = templDir.entryInfoList();
+ if( list ){
+ QFileInfoListIterator it( *list );
+ QFileInfo *fi;
+ while ( (fi = it.current()) != 0 ) {
+ FileType * filetype;
+ filetype = new FileType;
+ //name shall be "" for proper configuration
+ filetype->setName( "" );
+ filetype->setExt( fi->fileName() );
+ m_projectfiletemplates.append(filetype);
+ filetype->setEnabled(false);
+ ++it;
+ }
+ }
+ loadFileTypes(m_projectfiletemplates, view, false);
+}
+
+
+void FCConfigWidget::saveGlobalConfig()
+{
+ QDomDocument globalDom;
+ QDomElement element = globalDom.createElement("kdevelop" );
+ globalDom.appendChild(element);
+ QDomElement apPart = globalDom.createElement("kdevfilecreate");
+ element.appendChild(apPart);
+ QDomElement fileTypes = globalDom.createElement( "filetypes" );
+ apPart.appendChild( fileTypes );
+
+ saveConfiguration(globalDom, fileTypes, true);
+
+ QFile config( KGlobal::dirs()->saveLocation("data", "kdevfilecreate/", true) + "template-info.xml" );
+ config.open(IO_WriteOnly | IO_Truncate);
+ QTextStream stream(&config);
+ stream << "<?xml version = '1.0'?>";
+ stream << globalDom.toString();
+ config.close();
+}
+
+void FCConfigWidget::saveProjectConfig()
+{
+ QDomDocument dom = *m_part->projectDom( );
+ QDomElement element = dom.documentElement( );
+ QDomElement apPart = element.namedItem( "kdevfilecreate" ).toElement( );
+ if( apPart.isNull( ) )
+ {
+ apPart = dom.createElement( "kdevfilecreate" );
+ element.appendChild( apPart );
+ }
+
+
+ // project template configuration
+
+ QDomElement projectTypes = apPart.namedItem( "filetypes" ).toElement( );
+ apPart.removeChild(projectTypes);
+ projectTypes = dom.createElement( "filetypes" );
+ apPart.appendChild( projectTypes );
+
+ saveConfiguration(dom, projectTypes, false);
+
+
+ // global template usage
+
+ QDomElement globalTypes = apPart.namedItem( "useglobaltypes" ).toElement( );
+ apPart.removeChild(globalTypes);
+ globalTypes = dom.createElement( "useglobaltypes" );
+ apPart.appendChild( globalTypes );
+
+ QListViewItemIterator it( fcglobal_view );
+ for( ; it.current( ); ++it ){
+ if (!it.current()->parent())
+ {
+ QCheckListItem *chit = dynamic_cast<QCheckListItem*>(it.current());
+ if ( !chit ) continue;
+ if (chit->isOn())
+ {
+ QDomElement type = dom.createElement( "type" );
+ type.setAttribute( "ext", chit->text(0) );
+ globalTypes.appendChild( type );
+ }
+ else
+ {
+ QListViewItem *lastChild = chit->firstChild();
+ while ( lastChild )
+ {
+ QCheckListItem *chsit = dynamic_cast<QCheckListItem*>(lastChild);
+ if ( (chsit) && (chsit->isOn()))
+ {
+ QDomElement type = dom.createElement( "type" );
+ type.setAttribute( "ext", chit->text(0) );
+ type.setAttribute( "subtyperef", chsit->text(0) );
+ globalTypes.appendChild( type );
+ }
+
+ lastChild = lastChild->nextSibling();
+ }
+ }
+ }
+ }
+
+
+ // project template files
+
+ //check for new templates and those with location changed
+ QListViewItemIterator it2(fctemplates_view);
+ while (it2.current())
+ {
+ if (!it2.current()->text(1).isEmpty())
+ {
+ QString dest;
+ dest = m_part->project()->projectDirectory() + "/templates/";
+ if (it2.current()->text(1) == "create")
+ copyTemplate(QString::null, dest, it2.current()->text(0));
+ else
+ copyTemplate(it2.current()->text(1), dest, it2.current()->text(0));
+ }
+ ++it2;
+ }
+}
+
+void FCConfigWidget::saveConfiguration(QDomDocument &dom, QDomElement &element, bool global)
+{
+ QListViewItemIterator it( fc_view );
+ for( ; it.current( ); ++it ){
+ if (!it.current()->parent())
+ {
+ QDomElement type = dom.createElement( "type" );
+ type.setAttribute( "ext", it.current()->text(0) );
+ type.setAttribute( "name", it.current()->text(1) );
+ if (it.current()->childCount() > 0)
+ type.setAttribute( "create", "no");
+ else
+ type.setAttribute( "create", "template");
+ type.setAttribute( "icon", it.current()->text(2) );
+
+ QDomElement edescr = dom.createElement("descr");
+ type.appendChild(edescr);
+ QDomText descr = dom.createTextNode( it.current()->text(3) );
+ edescr.appendChild(descr);
+
+ if (!it.current()->text(4).isEmpty())
+ {
+ QString dest;
+ if (global)
+ dest = KGlobal::dirs()->saveLocation("data", "/kdevfilecreate/file-templates/", true);
+ else
+ dest = m_part->project()->projectDirectory() + "/templates/";
+ if (it.current()->text(4) == "create")
+ copyTemplate(QString::null, dest, it.current()->text(0));
+ else
+ copyTemplate(it.current()->text(4), dest, it.current()->text(0));
+ }
+
+
+ QListViewItem *lastChild = it.current()->firstChild();
+ while ( lastChild )
+ {
+ QDomElement subtype = dom.createElement( "subtype" );
+ subtype.setAttribute( "ref", lastChild->text(0) );
+ subtype.setAttribute( "name", lastChild->text(1) );
+ subtype.setAttribute( "icon", lastChild->text(2) );
+
+ QDomElement edescr = dom.createElement("descr");
+ subtype.appendChild(edescr);
+ QDomText descr = dom.createTextNode( lastChild->text(3) );
+ edescr.appendChild(descr);
+
+ if (!lastChild->text(4).isEmpty())
+ {
+ QString dest;
+ if (global)
+ dest = KGlobal::dirs()->saveLocation("data", "/kdevfilecreate/file-templates/", true);
+ else
+ dest = m_part->project()->projectDirectory() + "/templates/";
+ if (lastChild->text(4) == "create")
+ copyTemplate(QString::null, dest, it.current()->text(0) + "-" + lastChild->text(0));
+ else
+ copyTemplate(lastChild->text(4), dest, it.current()->text(0) + "-" + lastChild->text(0));
+ }
+
+ type.appendChild( subtype );
+ lastChild = lastChild->nextSibling();
+ }
+
+ element.appendChild( type );
+ }
+ }
+}
+
+void FCConfigWidget::copyTemplate(QString templateUrl, QString dest, QString destName)
+{
+ if (templateUrl.isEmpty())
+ {
+ QDir d(dest);
+ if (!d.exists())
+ d.mkdir(dest);
+
+ QFile f(dest + destName);
+ f.open(IO_WriteOnly);
+ f.close();
+ }
+ else
+ {
+ KURL destDir;
+ destDir.setPath(dest);
+ if (!KIO::NetAccess::exists(destDir, false, 0 ))
+ KIO::NetAccess::mkdir(destDir);
+
+ KURL destination;
+ destination.setPath(dest + destName);
+
+ KIO::NetAccess::upload(templateUrl, destination);
+ }
+}
+
+void FCConfigWidget::loadFileTypes(QPtrList<FileCreate::FileType> list, QListView *view, bool checkmarks)
+{
+ FileType *ft;
+
+ for( ft = list.last(); ft; ft = list.prev())
+ for( int i = list.count() - 1; i >= 0; --i)
+ {
+ if ( (ft = list.at(i)) )
+ {
+ QListViewItem *it;
+ if (!checkmarks)
+ it = new QListViewItem(view);
+ else
+ it = new QCheckListItem(view, "", QCheckListItem::CheckBox);
+
+ it->setText(0, ft->ext());
+ it->setText(1, ft->name());
+ it->setText(2, ft->icon());
+ it->setText(3, ft->descr());
+ it->setText(4, "");
+
+ FileType *sft;
+ for( int j = ft->subtypes().count() - 1; j >= 0; --j)
+ {
+ if ( (sft = ft->subtypes().at(j)) )
+ {
+ QListViewItem *sit;
+ if (!checkmarks)
+ sit = new QListViewItem(it);
+ else
+ sit = new QCheckListItem(it, "", QCheckListItem::CheckBox);
+
+ sit->setText(0, sft->subtypeRef());
+ sit->setText(1, sft->name());
+ sit->setText(2, sft->icon());
+ sit->setText(3, sft->descr());
+ sit->setText(4, "");
+ }
+ }
+ }
+ }
+}
+
+void FCConfigWidget::removetemplate_button_clicked( )
+{
+ if (fctemplates_view->currentItem())
+ {
+ KURL removedTemplate;
+ removedTemplate.setPath(m_part->project()->projectDirectory() + "/templates/" + fctemplates_view->currentItem()->text(0));
+ KIO::NetAccess::del(removedTemplate);
+ QListViewItem *it = fctemplates_view->currentItem();
+ if (it->itemBelow())
+ {
+ fc_view->setSelected(it->itemBelow(), true);
+ fc_view->setCurrentItem(it->itemBelow());
+ }
+ else if (it->itemAbove())
+ {
+ fc_view->setSelected(it->itemAbove(), true);
+ fc_view->setCurrentItem(it->itemAbove());
+ }
+ delete it;
+ }
+}
+
+void FCConfigWidget::copyToProject_button_clicked()
+{
+ QListViewItem *it = fcglobal_view->currentItem();
+ if (it)
+ {
+ QListViewItem *it_copy_parent = 0;
+ QString destParent;
+ if (it->parent())
+ {
+ it_copy_parent = new QListViewItem(fc_view, it->parent()->text(0),
+ it->parent()->text(1),
+ it->parent()->text(2),
+ it->parent()->text(3),
+ locate("data", "kdevfilecreate/file-templates/"+ it->parent()->text(0)));
+ destParent += it->parent()->text(0) + "-";
+ QCheckListItem *chk = dynamic_cast<QCheckListItem*>(it->parent());
+ if (chk)
+ chk->setOn(false);
+ }
+ QListViewItem *it_copy = 0;
+ if (it_copy_parent)
+ it_copy = new QListViewItem(it_copy_parent, it->text(0),
+ it->text(1),
+ it->text(2),
+ it->text(3),
+ locate("data", "kdevfilecreate/file-templates/"+destParent + it->text(0)));
+ else
+ it_copy = new QListViewItem(fc_view, it->text(0),
+ it->text(1),
+ it->text(2),
+ it->text(3),
+ locate("data", "kdevfilecreate/file-templates/" +destParent+ it->text(0)));
+ QCheckListItem *chk = dynamic_cast<QCheckListItem*>(it);
+ if (chk)
+ chk->setOn(false);
+ fc_view->setSelected(it_copy, true);
+ fc_view->setCurrentItem(it_copy);
+ QListViewItem * it_child = it->firstChild();
+ while( it_child ) {
+ new QListViewItem(it_copy, it_child->text(0),
+ it_child->text(1),
+ it_child->text(2),
+ it_child->text(3),
+ locate("data", "kdevfilecreate/file-templates/"+ it_copy->text(0) + "-" + it_child->text(0)));
+ QCheckListItem *chk_child = dynamic_cast<QCheckListItem*>(it_child);
+ if (chk_child)
+ chk_child->setOn(false);
+ it_child = it_child->nextSibling();
+ }
+ }
+}
+
+void FCConfigWidget::newtype_button_clicked()
+{
+ FCTypeEdit *te = new FCTypeEdit();
+ if (te->exec() == QDialog::Accepted )
+ {
+ QListViewItem *it = new QListViewItem(fc_view, te->typeext_edit->text(),
+ te->typename_edit->text(),
+ te->icon_url->icon(),
+ te->typedescr_edit->text(),
+ te->template_url->url().isEmpty() ? QString("create") : te->template_url->url());
+ fc_view->setSelected(it, true);
+ fc_view->setCurrentItem(it);
+ }
+ delete te;
+}
+
+void FCConfigWidget::newsubtype_button_clicked()
+{
+ if (fc_view->currentItem() && (!fc_view->currentItem()->parent()))
+ {
+ FCTypeEdit *te = new FCTypeEdit(this);
+ if (te->exec() == QDialog::Accepted )
+ {
+ /*QListViewItem *it =*/(void) new QListViewItem(fc_view->currentItem(),
+ te->typeext_edit->text(),
+ te->typename_edit->text(),
+ te->icon_url->icon(),
+ te->typedescr_edit->text(),
+ te->template_url->url().isEmpty() ? QString("create") : te->template_url->url());
+ fc_view->currentItem()->setOpen(true);
+ }
+ delete te;
+ }
+}
+
+void FCConfigWidget::remove_button_clicked()
+{
+ if (fc_view->currentItem())
+ {
+ QListViewItem *it = fc_view->currentItem();
+ if (it->itemBelow())
+ {
+ fc_view->setSelected(it->itemBelow(), true);
+ fc_view->setCurrentItem(it->itemBelow());
+ }
+ else if (it->itemAbove())
+ {
+ fc_view->setSelected(it->itemAbove(), true);
+ fc_view->setCurrentItem(it->itemAbove());
+ }
+ delete it;
+ }
+}
+
+
+void FCConfigWidget::moveup_button_clicked()
+{
+ QListViewItem *i = fc_view->currentItem();
+ if ( !i )
+ return;
+
+ QListViewItemIterator it( i );
+ QListViewItem *parent = i->parent();
+ --it;
+ while ( it.current() ) {
+ if ( it.current()->parent() == parent )
+ break;
+ --it;
+ }
+
+ if ( !it.current() )
+ return;
+ QListViewItem *other = it.current();
+
+ other->moveItem( i );
+}
+
+
+void FCConfigWidget::movedown_button_clicked()
+{
+ QListViewItem *i = fc_view->currentItem();
+ if ( !i )
+ return;
+
+ QListViewItemIterator it( i );
+ QListViewItem *parent = i->parent();
+ it++;
+ while ( it.current() ) {
+ if ( it.current()->parent() == parent )
+ break;
+ it++;
+ }
+
+ if ( !it.current() )
+ return;
+ QListViewItem *other = it.current();
+
+ i->moveItem( other );
+}
+
+
+void FCConfigWidget::edittype_button_clicked()
+{
+ QListViewItem *it = fc_view->currentItem();
+ if ( it )
+ {
+ FCTypeEdit *te = new FCTypeEdit(this);
+
+ te->typeext_edit->setText(it->text(0));
+ te->typename_edit->setText(it->text(1));
+ te->icon_url->setIcon(it->text(2));
+ te->typedescr_edit->setText(it->text(3));
+ if (it->text(4) != "create")
+ te->template_url->setURL(it->text(4));
+
+ if (te->exec() == QDialog::Accepted )
+ {
+ it->setText(0, te->typeext_edit->text());
+ it->setText(1, te->typename_edit->text());
+ it->setText(2, te->icon_url->icon());
+ it->setText(3, te->typedescr_edit->text());
+ if ((te->template_url->url() == "") && ((it->text(4) == "create")))
+ it->setText(4, "create");
+ else
+ it->setText(4, te->template_url->url());
+ }
+ }
+}
+
+
+void FCConfigWidget::newtemplate_button_clicked()
+{
+ FCTemplateEdit *te = new FCTemplateEdit;
+ if (te->exec() == QDialog::Accepted)
+ {
+ /*QListViewItem *it =*/(void) new QListViewItem(fctemplates_view, te->templatename_edit->text(),
+ te->template_url->url().isEmpty() ? QString("create") : te->template_url->url());
+ }
+}
+
+
+void FCConfigWidget::edittemplate_button_clicked()
+{
+ QListViewItem *it;
+ if ( (it = fctemplates_view->currentItem()) )
+ {
+ FCTemplateEdit *te = new FCTemplateEdit;
+ te->templatename_edit->setText(it->text(0));
+ te->templatename_edit->setEnabled(false);
+ if (te->exec() == QDialog::Accepted)
+ {
+ if ((te->template_url->url() == "") && ((it->text(1) == "create")))
+ it->setText(1, "create");
+ else
+ it->setText(1, te->template_url->url());
+ }
+ }
+}
+
+void FCConfigWidget::edit_template_content_button_clicked( )
+{
+ if (fctemplates_view->currentItem())
+ {
+ QFileInfo fi(m_part->project()->projectDirectory() + "/templates/" + fctemplates_view->currentItem()->text(0));
+ KURL content;
+ content.setPath(m_part->project()->projectDirectory() + "/templates/" + fctemplates_view->currentItem()->text(0));
+ if (fi.exists())
+ m_part->partController()->editDocument(content);
+ else
+ {
+ KMessageBox::information(this, i18n("Requested template does not exist yet.\nIt will be opened immediately after accepting the configuration dialog."), QString::null, "Edit template content warning");
+ fctemplates_view->currentItem()->setPixmap(0, SmallIcon("edit"));
+ urlsToEdit.append(content);
+ }
+ }
+}
+
+void FCConfigWidget::edit_type_content_button_clicked( )
+{
+ if (!fc_view->currentItem())
+ return;
+ QListViewItem *it = fc_view->currentItem();
+ QString type_name = it->text(0);
+ if (it->parent())
+ type_name.prepend(it->parent()->text(0) + "-");
+ if (!m_global)
+ {
+ QString typePath = m_part->project()->projectDirectory() + "/templates/" + type_name;
+ KURL content;
+ content.setPath(typePath);
+ if (it->text(4).isEmpty())
+ m_part->partController()->editDocument(content);
+ else
+ {
+ if (it->text(4) == "create")
+ KMessageBox::information(this, i18n("Template for the selected file type does not exist yet.\nIt will be opened immediately after accepting the configuration dialog."), QString::null, "Edit type template content warning");
+ else
+ KMessageBox::information(this, i18n("Template for the selected file type has been changed.\nIt will be opened immediately after accepting the configuration dialog."), QString::null, "Edit type template content warning");
+ fc_view->currentItem()->setPixmap(0, SmallIcon("edit"));
+ urlsToEdit.append(content);
+ }
+ }
+ else
+ {
+ QString dest = KGlobal::dirs()->saveLocation("data", "/kdevfilecreate/file-templates/", true);
+ QString typePath = dest + type_name;
+ KURL content;
+ content.setPath(typePath);
+ if (it->text(4).isEmpty())
+ {
+ QFileInfo fi(dest+type_name);
+ if (!fi.exists())
+ copyTemplate(locate("data", "kdevfilecreate/file-templates/" + type_name), dest, type_name);
+ m_part->partController()->editDocument(content);
+ }
+ else
+ {
+ if (it->text(4) == "create")
+ KMessageBox::information(this, i18n("Template for the selected file type does not exist yet.\nIt will be opened immediately after accepting the configuration dialog."), QString::null, "Edit global type template content warning");
+ else
+ KMessageBox::information(this, i18n("Template for the selected file type has been changed.\nIt will be opened immediately after accepting the configuration dialog."), QString::null, "Edit global type template content warning");
+ fc_view->currentItem()->setPixmap(0, SmallIcon("edit"));
+ urlsToEdit.append(content);
+ }
+ }
+}
+
+#include "fcconfigwidget.moc"
diff --git a/parts/filecreate/fcconfigwidget.h b/parts/filecreate/fcconfigwidget.h
new file mode 100644
index 00000000..52acd29c
--- /dev/null
+++ b/parts/filecreate/fcconfigwidget.h
@@ -0,0 +1,72 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef FCCONFIGWIDGET_H
+#define FCCONFIGWIDGET_H
+
+#include <qwidget.h>
+#include <qvaluelist.h>
+#include <kurl.h>
+
+#include "fcconfigwidgetbase.h"
+
+class FileCreatePart;
+class QListView;
+class QDomDocument;
+class QDomElement;
+
+namespace FileCreate{
+class FileType;
+}
+
+class FCConfigWidget : public FCConfigWidgetBase
+{
+Q_OBJECT
+public:
+ FCConfigWidget(FileCreatePart * part, bool global, QWidget *parent, const char *name);
+
+ ~FCConfigWidget();
+
+public slots:
+ void accept();
+ void removetemplate_button_clicked();
+ void copyToProject_button_clicked();
+ void newtype_button_clicked();
+ void newsubtype_button_clicked();
+ void remove_button_clicked();
+ void moveup_button_clicked();
+ void movedown_button_clicked();
+ void edittype_button_clicked();
+ void newtemplate_button_clicked();
+ void edittemplate_button_clicked();
+ void edit_template_content_button_clicked();
+ void edit_type_content_button_clicked();
+
+protected:
+ void loadGlobalConfig(QListView *view, bool checkmarks = false);
+ void loadProjectConfig(QListView *view);
+ void loadProjectTemplates(QListView *view);
+ void saveGlobalConfig();
+ void saveProjectConfig();
+ void loadFileTypes(QPtrList<FileCreate::FileType> list, QListView *view, bool checkmarks = false);
+ void copyTemplate(QString templateUrl, QString dest, QString destName);
+ void saveConfiguration(QDomDocument &dom, QDomElement &element, bool global);
+
+private:
+ FileCreatePart * m_part;
+ QPtrList<FileCreate::FileType> m_globalfiletypes;
+ QPtrList<FileCreate::FileType> m_projectfiletypes;
+ QPtrList<FileCreate::FileType> m_projectfiletemplates;
+ bool m_global;
+
+ QValueList<KURL> urlsToEdit;
+};
+
+#endif
diff --git a/parts/filecreate/fcconfigwidgetbase.ui b/parts/filecreate/fcconfigwidgetbase.ui
new file mode 100644
index 00000000..72f62260
--- /dev/null
+++ b/parts/filecreate/fcconfigwidgetbase.ui
@@ -0,0 +1,540 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>FCConfigWidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>FCConfigWidgetBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>505</width>
+ <height>388</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>New File Wizard Options</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>fc_tabs</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab1</cstring>
+ </property>
+ <attribute name="title">
+ <string>Pro&amp;ject Types</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="3" column="1">
+ <property name="name">
+ <cstring>remove_button</cstring>
+ </property>
+ <property name="text">
+ <string>Re&amp;move Type</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>edittype_button</cstring>
+ </property>
+ <property name="text">
+ <string>Edit T&amp;ype...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>newsubtype_button</cstring>
+ </property>
+ <property name="text">
+ <string>New &amp;Subtype...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="1">
+ <property name="name">
+ <cstring>newtype_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;New Type...</string>
+ </property>
+ </widget>
+ <widget class="QListView" row="0" column="0" rowspan="11" colspan="1">
+ <column>
+ <property name="text">
+ <string>Type Extension</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Icon</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Description</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>fc_view</cstring>
+ </property>
+ <property name="resizePolicy">
+ <enum>Manual</enum>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ <spacer row="9" column="1">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="7" column="1">
+ <property name="name">
+ <cstring>moveup_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move &amp;Up</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="8" column="1">
+ <property name="name">
+ <cstring>movedown_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move &amp;Down</string>
+ </property>
+ </widget>
+ <spacer row="6" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="4" column="1">
+ <property name="name">
+ <cstring>spacer1_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="5" column="1">
+ <property name="name">
+ <cstring>edit_type_content_button</cstring>
+ </property>
+ <property name="text">
+ <string>Ed&amp;it Template</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab2</cstring>
+ </property>
+ <attribute name="title">
+ <string>Used &amp;Global Types</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView" row="0" column="0" rowspan="1" colspan="2">
+ <column>
+ <property name="text">
+ <string>Type Extension</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Icon</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Description</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>fcglobal_view</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>spacer4_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>330</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>copyToProject_button</cstring>
+ </property>
+ <property name="text">
+ <string>Copy to Pro&amp;ject Types</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab3</cstring>
+ </property>
+ <attribute name="title">
+ <string>Proje&amp;ct Templates</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView" row="1" column="0" rowspan="6" colspan="1">
+ <column>
+ <property name="text">
+ <string>Template Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>fctemplates_view</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>edittemplate_button</cstring>
+ </property>
+ <property name="text">
+ <string>C&amp;hange Content...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>newtemplate_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;New Template...</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>templatesDir_label</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="3" column="1">
+ <property name="name">
+ <cstring>removetemplate_button</cstring>
+ </property>
+ <property name="text">
+ <string>Re&amp;move Template</string>
+ </property>
+ </widget>
+ <spacer row="6" column="1">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>150</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="5" column="1">
+ <property name="name">
+ <cstring>edit_template_content_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Edit Template</string>
+ </property>
+ </widget>
+ <spacer row="4" column="1">
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>newtype_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>newtype_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>newsubtype_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>newsubtype_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>remove_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>remove_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>moveup_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>moveup_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>movedown_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>movedown_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>edittype_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>edittype_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>newtemplate_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>newtemplate_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>edittemplate_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>edittemplate_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>removetemplate_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>removetemplate_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>copyToProject_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>copyToProject_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>edit_template_content_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>edit_template_content_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>edit_type_content_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>edit_type_content_button_clicked()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>fc_view</tabstop>
+ <tabstop>newtype_button</tabstop>
+ <tabstop>newsubtype_button</tabstop>
+ <tabstop>edittype_button</tabstop>
+ <tabstop>remove_button</tabstop>
+ <tabstop>edit_type_content_button</tabstop>
+ <tabstop>moveup_button</tabstop>
+ <tabstop>movedown_button</tabstop>
+ <tabstop>fc_tabs</tabstop>
+ <tabstop>fcglobal_view</tabstop>
+ <tabstop>copyToProject_button</tabstop>
+ <tabstop>fctemplates_view</tabstop>
+ <tabstop>newtemplate_button</tabstop>
+ <tabstop>edittemplate_button</tabstop>
+ <tabstop>removetemplate_button</tabstop>
+ <tabstop>edit_template_content_button</tabstop>
+</tabstops>
+<includes>
+ <include location="local" impldecl="in implementation">addglobaldlg.h</include>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<forwards>
+ <forward>class AddGlobalDlg;</forward>
+</forwards>
+<variables>
+ <variable>AddGlobalDlg *global_dlg;</variable>
+</variables>
+<slots>
+ <slot>removetemplate_button_clicked()</slot>
+ <slot>copyToProject_button_clicked()</slot>
+ <slot>newtype_button_clicked()</slot>
+ <slot>newsubtype_button_clicked()</slot>
+ <slot>remove_button_clicked()</slot>
+ <slot>moveup_button_clicked()</slot>
+ <slot>movedown_button_clicked()</slot>
+ <slot>edittype_button_clicked()</slot>
+ <slot>newtemplate_button_clicked()</slot>
+ <slot>edittemplate_button_clicked()</slot>
+ <slot>edit_template_contents_button_clicked()</slot>
+ <slot>edit_template_content_button_clicked()</slot>
+ <slot>edit_type_content_button_clicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/parts/filecreate/fctemplateedit.cpp b/parts/filecreate/fctemplateedit.cpp
new file mode 100644
index 00000000..fc495fd5
--- /dev/null
+++ b/parts/filecreate/fctemplateedit.cpp
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+#include <klineedit.h>
+#include "fctemplateedit.h"
+#include <qpushbutton.h>
+
+FCTemplateEdit::FCTemplateEdit(QWidget *parent, const char *name):
+ FCTemplateEditBase(parent, name)
+{
+ connect( templatename_edit, SIGNAL(textChanged ( const QString & )),
+ this, SLOT( slotTemplateNameChanged( )));
+ slotTemplateNameChanged();
+}
+
+FCTemplateEdit::~FCTemplateEdit()
+{
+}
+
+void FCTemplateEdit::slotTemplateNameChanged( )
+{
+ ok_button->setEnabled( !templatename_edit->text().isEmpty() );
+}
+
+void FCTemplateEdit::accept()
+{
+ if ( !templatename_edit->text().isEmpty() )
+ FCTemplateEditBase::accept();
+}
+#include "fctemplateedit.moc"
diff --git a/parts/filecreate/fctemplateedit.h b/parts/filecreate/fctemplateedit.h
new file mode 100644
index 00000000..0209c3b0
--- /dev/null
+++ b/parts/filecreate/fctemplateedit.h
@@ -0,0 +1,30 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef FCTEMPLATEEDIT_H
+#define FCTEMPLATEEDIT_H
+
+#include <qwidget.h>
+#include "fctemplateeditbase.h"
+
+class FCTemplateEdit : public FCTemplateEditBase
+{
+Q_OBJECT
+public:
+ FCTemplateEdit(QWidget *parent=0, const char *name=0);
+
+ ~FCTemplateEdit();
+
+protected slots:
+ virtual void accept();
+ void slotTemplateNameChanged( );
+};
+
+#endif
diff --git a/parts/filecreate/fctemplateeditbase.ui b/parts/filecreate/fctemplateeditbase.ui
new file mode 100644
index 00000000..976bff33
--- /dev/null
+++ b/parts/filecreate/fctemplateeditbase.ui
@@ -0,0 +1,193 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>FCTemplateEditBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>FCTemplateEditBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>467</width>
+ <height>149</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>File Template</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string>Template &amp;name:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignBottom</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>templatename_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>templatename_edit</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Set template content from &amp;file:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignBottom</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>template_url</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>template_url</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>26</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="0">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>ok_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancel_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>ok_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCTemplateEditBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancel_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCTemplateEditBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>templatename_edit</tabstop>
+ <tabstop>template_url</tabstop>
+ <tabstop>ok_button</tabstop>
+ <tabstop>cancel_button</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+ <include location="local" impldecl="in implementation">fctemplateeditbase.ui.h</include>
+</includes>
+<slots>
+ <slot>init()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/filecreate/fctemplateeditbase.ui.h b/parts/filecreate/fctemplateeditbase.ui.h
new file mode 100644
index 00000000..6f2b9223
--- /dev/null
+++ b/parts/filecreate/fctemplateeditbase.ui.h
@@ -0,0 +1,26 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+
+#include <qvalidator.h>
+#include <qregexp.h>
+
+void FCTemplateEditBase::init()
+{
+ templatename_edit->setValidator(new QRegExpValidator(QRegExp("^\\S*$"), this));
+}
diff --git a/parts/filecreate/fctypeedit.cpp b/parts/filecreate/fctypeedit.cpp
new file mode 100644
index 00000000..310453ea
--- /dev/null
+++ b/parts/filecreate/fctypeedit.cpp
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include <klineedit.h>
+#include <qpushbutton.h>
+#include "fctypeedit.h"
+
+
+FCTypeEdit::FCTypeEdit(QWidget *parent, char *name)
+ : FCTypeEditBase(parent, name)
+{
+ connect( typeext_edit, SIGNAL( textChanged ( const QString & )),this, SLOT( slotTypeEditTextChanged()));
+ connect( typename_edit, SIGNAL( textChanged ( const QString & )),this, SLOT( slotTypeEditTextChanged( )));
+ slotTypeEditTextChanged( );
+}
+
+FCTypeEdit::~FCTypeEdit()
+{
+}
+
+void FCTypeEdit::slotTypeEditTextChanged( )
+{
+ ok_button->setEnabled( !typeext_edit->text().isEmpty() &&
+ !typename_edit->text().isEmpty());
+}
+
+void FCTypeEdit::accept()
+{
+ if ( !typeext_edit->text().isEmpty() &&
+ !typename_edit->text().isEmpty() )
+ FCTypeEditBase::accept();
+}
+#include "fctypeedit.moc"
diff --git a/parts/filecreate/fctypeedit.h b/parts/filecreate/fctypeedit.h
new file mode 100644
index 00000000..92c34e3f
--- /dev/null
+++ b/parts/filecreate/fctypeedit.h
@@ -0,0 +1,30 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef FCTYPEEDIT_H
+#define FCTYPEEDIT_H
+
+
+#include "fctypeeditbase.h"
+
+class FCTypeEdit : public FCTypeEditBase
+{
+Q_OBJECT
+public:
+ FCTypeEdit(QWidget *parent = 0, char *name = 0);
+
+ ~FCTypeEdit();
+
+protected slots:
+ virtual void accept();
+ void slotTypeEditTextChanged( );
+};
+
+#endif
diff --git a/parts/filecreate/fctypeeditbase.ui b/parts/filecreate/fctypeeditbase.ui
new file mode 100644
index 00000000..8bc06f87
--- /dev/null
+++ b/parts/filecreate/fctypeeditbase.ui
@@ -0,0 +1,282 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>FCTypeEditBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>FCTypeEditBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>476</width>
+ <height>194</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>File Type</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string>Type &amp;extension:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignBottom</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>typename_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>typeext_edit</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Type &amp;name:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignBottom</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>typedescr_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>typename_edit</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout3_2</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Type &amp;description:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignBottom</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>typedescr_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>typedescr_edit</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="KIconButton" row="0" column="2" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>icon_url</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>80</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Set template content from &amp;file:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignBottom</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>template_url</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>template_url</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>26</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>ok_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancel_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>ok_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCTypeEditBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancel_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCTypeEditBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>typeext_edit</tabstop>
+ <tabstop>typename_edit</tabstop>
+ <tabstop>typedescr_edit</tabstop>
+ <tabstop>icon_url</tabstop>
+ <tabstop>template_url</tabstop>
+ <tabstop>ok_button</tabstop>
+ <tabstop>cancel_button</tabstop>
+</tabstops>
+<includes>
+ <include location="local" impldecl="in implementation">kicondialog.h</include>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+ <include location="local" impldecl="in implementation">fctypeeditbase.ui.h</include>
+</includes>
+<slots>
+ <slot>init()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kicondialog.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/filecreate/fctypeeditbase.ui.h b/parts/filecreate/fctypeeditbase.ui.h
new file mode 100644
index 00000000..e65a2ba7
--- /dev/null
+++ b/parts/filecreate/fctypeeditbase.ui.h
@@ -0,0 +1,26 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+
+#include <qvalidator.h>
+#include <qregexp.h>
+
+void FCTypeEditBase::init()
+{
+ typeext_edit->setValidator(new QRegExpValidator(QRegExp("^\\S*$"), this));
+}
diff --git a/parts/filecreate/file-templates/Makefile.am b/parts/filecreate/file-templates/Makefile.am
new file mode 100644
index 00000000..672a1cfa
--- /dev/null
+++ b/parts/filecreate/file-templates/Makefile.am
@@ -0,0 +1,2 @@
+rcdir = $(kde_datadir)/kdevfilecreate/file-templates
+rc_DATA = ui ui-dialog ui-mainwin ui-confdialog ui-dialogb ui-widget ui-dialogr ui-tabdialog ui-wizard dox ts ui-mainwin-qt4 ui-widget-qt4 ui-dialogb-qt4 ui-dialogr-qt4 ui-dialog-qt4 qrc
diff --git a/parts/filecreate/file-templates/dox b/parts/filecreate/file-templates/dox
new file mode 100644
index 00000000..fda0e141
--- /dev/null
+++ b/parts/filecreate/file-templates/dox
@@ -0,0 +1,22 @@
+/** \file $MODULE$.dox
+ * \brief put an explanation here
+ */
+
+/** \page $MODULE$ put the page title here
+
+\section put_sectionLabelName_here put section name here
+
+Here comes the text <code>this is code</code>, the text is continued.
+
+ - This is a item list
+ - This is the second item!
+ .
+
+Here comes the text <code>this is code</code>, the text is continued.
+
+\subsection put_subSectionLabelName_here put subsection name here
+
+Subsection text.
+
+*/
+
diff --git a/parts/filecreate/file-templates/qrc b/parts/filecreate/file-templates/qrc
new file mode 100644
index 00000000..4a4d7e46
--- /dev/null
+++ b/parts/filecreate/file-templates/qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/" >
+ <file></file>
+ </qresource>
+</RCC>
diff --git a/parts/filecreate/file-templates/ts b/parts/filecreate/file-templates/ts
new file mode 100644
index 00000000..4eb9e187
--- /dev/null
+++ b/parts/filecreate/file-templates/ts
@@ -0,0 +1,2 @@
+<!DOCTYPE TS><TS>
+</TS>
diff --git a/parts/filecreate/file-templates/ui b/parts/filecreate/file-templates/ui
new file mode 100644
index 00000000..858b4678
--- /dev/null
+++ b/parts/filecreate/file-templates/ui
@@ -0,0 +1,20 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>Form1</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-confdialog b/parts/filecreate/file-templates/ui-confdialog
new file mode 100644
index 00000000..975ba4d4
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-confdialog
@@ -0,0 +1,165 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>MyDialog1</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MyDialog1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>597</width>
+ <height>364</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MyDialog1</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QListBox" row="0" column="0">
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>listBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QTabWidget" row="0" column="1">
+ <property name="name">
+ <cstring>tabWidget</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>Widget2</cstring>
+ </property>
+ <attribute name="title">
+ <string>Tab</string>
+ </attribute>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>Widget3</cstring>
+ </property>
+ <attribute name="title">
+ <string>Tab</string>
+ </attribute>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ <property name="accel">
+ <string>F1</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-dialog b/parts/filecreate/file-templates/ui-dialog
new file mode 100644
index 00000000..fc2aefce
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-dialog
@@ -0,0 +1,20 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>Form1</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-dialog-qt4 b/parts/filecreate/file-templates/ui-dialog-qt4
new file mode 100644
index 00000000..d35cb285
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-dialog-qt4
@@ -0,0 +1,22 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/parts/filecreate/file-templates/ui-dialogb b/parts/filecreate/file-templates/ui-dialogb
new file mode 100644
index 00000000..7ccbfb94
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-dialogb
@@ -0,0 +1,123 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>MyDialog1</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MyDialog1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>511</width>
+ <height>282</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MyDialog1</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>240</y>
+ <width>476</width>
+ <height>33</height>
+ </rect>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ <property name="accel">
+ <string>F1</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-dialogb-qt4 b/parts/filecreate/file-templates/ui-dialogb-qt4
new file mode 100644
index 00000000..2413393e
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-dialogb-qt4
@@ -0,0 +1,100 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ <widget class="QWidget" name="layoutWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>20</x>
+ <y>250</y>
+ <width>351</width>
+ <height>33</height>
+ </rect>
+ </property>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>131</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="okButton" >
+ <property name="text" >
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>Dialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>278</x>
+ <y>253</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>96</x>
+ <y>254</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>Dialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>369</x>
+ <y>253</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>179</x>
+ <y>282</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/parts/filecreate/file-templates/ui-dialogr b/parts/filecreate/file-templates/ui-dialogr
new file mode 100644
index 00000000..8cf208ec
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-dialogr
@@ -0,0 +1,123 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>MyDialog1</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MyDialog1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>592</width>
+ <height>470</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MyDialog1</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout5</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>500</x>
+ <y>30</y>
+ <width>82</width>
+ <height>410</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ <property name="accel">
+ <string>F1</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-dialogr-qt4 b/parts/filecreate/file-templates/ui-dialogr-qt4
new file mode 100644
index 00000000..57d81913
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-dialogr-qt4
@@ -0,0 +1,100 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ <widget class="QWidget" name="layoutWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>300</x>
+ <y>20</y>
+ <width>77</width>
+ <height>106</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="okButton" >
+ <property name="text" >
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>Dialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>351</x>
+ <y>38</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>233</x>
+ <y>29</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>Dialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>330</x>
+ <y>66</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>197</x>
+ <y>125</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/parts/filecreate/file-templates/ui-mainwin b/parts/filecreate/file-templates/ui-mainwin
new file mode 100644
index 00000000..854da009
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-mainwin
@@ -0,0 +1,436 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>Form1</class>
+<widget class="QMainWindow">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+</widget>
+<menubar>
+ <property name="name">
+ <cstring>menubar</cstring>
+ </property>
+ <item text="&amp;File" name="fileMenu">
+ <action name="fileNewAction"/>
+ <action name="fileOpenAction"/>
+ <action name="fileSaveAction"/>
+ <action name="fileSaveAsAction"/>
+ <separator/>
+ <action name="filePrintAction"/>
+ <separator/>
+ <action name="fileExitAction"/>
+ </item>
+ <item text="&amp;Edit" name="editMenu">
+ <action name="editUndoAction"/>
+ <action name="editRedoAction"/>
+ <separator/>
+ <action name="editCutAction"/>
+ <action name="editCopyAction"/>
+ <action name="editPasteAction"/>
+ <separator/>
+ <action name="editFindAction"/>
+ </item>
+ <item text="&amp;Help" name="helpMenu">
+ <action name="helpContentsAction"/>
+ <action name="helpIndexAction"/>
+ <separator/>
+ <action name="helpAboutAction"/>
+ </item>
+</menubar>
+<toolbars>
+</toolbars>
+<actions>
+ <action>
+ <property name="name">
+ <cstring>fileNewAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image0</iconset>
+ </property>
+ <property name="text">
+ <string>New</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;New</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+N</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileOpenAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image1</iconset>
+ </property>
+ <property name="text">
+ <string>Open</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Open...</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+O</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileSaveAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image2</iconset>
+ </property>
+ <property name="text">
+ <string>Save</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Save</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+S</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileSaveAsAction</cstring>
+ </property>
+ <property name="text">
+ <string>Save As</string>
+ </property>
+ <property name="menuText">
+ <string>Save &amp;As...</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>filePrintAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image3</iconset>
+ </property>
+ <property name="text">
+ <string>Print</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Print...</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+P</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileExitAction</cstring>
+ </property>
+ <property name="text">
+ <string>Exit</string>
+ </property>
+ <property name="menuText">
+ <string>E&amp;xit</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editUndoAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image4</iconset>
+ </property>
+ <property name="text">
+ <string>Undo</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Undo</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+Z</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editRedoAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image5</iconset>
+ </property>
+ <property name="text">
+ <string>Redo</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Redo</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+Y</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editCutAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image6</iconset>
+ </property>
+ <property name="text">
+ <string>Cut</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Cut</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+X</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editCopyAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image7</iconset>
+ </property>
+ <property name="text">
+ <string>Copy</string>
+ </property>
+ <property name="menuText">
+ <string>C&amp;opy</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+C</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editPasteAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image8</iconset>
+ </property>
+ <property name="text">
+ <string>Paste</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Paste</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+V</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editFindAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image9</iconset>
+ </property>
+ <property name="text">
+ <string>Find</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Find...</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+F</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpContentsAction</cstring>
+ </property>
+ <property name="text">
+ <string>Contents</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Contents...</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpIndexAction</cstring>
+ </property>
+ <property name="text">
+ <string>Index</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Index...</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpAboutAction</cstring>
+ </property>
+ <property name="text">
+ <string>About</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;About</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+</actions>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="721">789cedd2b10ac2301405d03d5ff148b62056035241fc04c5511087f425a2432b681d44fc777ba329d6b47fe07d19dee50cc9904cd376b3229d896b6deb13131fed85b4bb95e57db75f3e8434869a93d3548e841c13d3fa5c79ecaad9d52404b540351e83caa833c6a03ad4798e41f5a86c30a816f510126ee94d14d52611fb8e2ad49070a4445ca4447ca4446ca444da07fecac7ffd2956ebe64f81ff4c873215e0583a9b0</data>
+ </image>
+ <image name="image1">
+ <data format="XPM.GZ" length="691">789cad914d0ac2301085f739c5d0d915b11a140ae211149782b898448b2e5a41eb42c4bb9b9fa6a67644045f0299978f37134896c27ab5803413979aeaa3067da033a4bb6b59de36dbf95d245282d953182703910c41c3f254ed6d8da6c69193b5dada7c924b6fc9dac2c85b156c51b83eacfe41d0c89defc4dfa2dd7c37fc44b025a179043c4152a4b055f4365414ad0e8901fd94c1ae5e19441da9211c68e7f44098d3074d86019e70a0210c089958df7ffb31134fa13797a8</data>
+ </image>
+ <image name="image2">
+ <data format="XPM.GZ" length="691">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022530543251d2e253d856405bffcbc54105b19c856360003103711c4b530b13082709340dc644310047193c1dcc424d314883958015846190b80ca24262a2721012087349964a030ba69c9c9303d403e9132087b68279388ecff4414193440948c32aa71d86470bb80863258a21b9a0eb0a7905a6b2e006d59a436</data>
+ </image>
+ <image name="image3">
+ <data format="XPM.GZ" length="2509">789c7d944973db461085effa152cf54d956a932089a55239c896572d96bcc4b253390033186ea2488aa416a7f2dfd3db0cbd44e6d340f8f8def43406209e1c742ecf4f3b074ff6d69b7a33711d37ae6f3a077e3b9f3ffcf5f71fffeced675987fecab293edffb6b77fb1e9b8ced9e2ba65c08c00baf2117e2f5c86d02d99e196b9d7ed963df53f2ab3c47789258fa7c26564688d4bf30f23673de113e6ac1719ae9459e27f4d5c893f17ae126f8d2be3ebc87d9dff4e3904f317ccfd5ef23f28b3c45f26963c7e510ec1fc9570157dd81857967f883c90cd8635f3208b8c0b6596f863e17a500fd597fe8744c35afc1be33aef8bff5ad9b5e637cc7993f7f346fca571637c1fb9d0f99f9543b07ab2df453ff9723d0551a1f3d791cb8170573904f3a5bf725034e66f133be96fa44c1246799e4a573495e461a29cfcbbc8e64f8d9df96564f5519e876a1019668975fda05c593d5c25d67a6f945d6ef3bdb08b3ed491eba1e467c6561fcf229bff4ad9b5c6c7ccf530fa8089bdf8136596703fb1f800c23ee5ff548e3e7a636f3c8ddc68bd8ab91926066596b05c5fe359c285b2cf8de5f7ed7296f050b825d6f74763dc1a0f227bcdbf60f679e29789353f5666093f4facfe857208e63f156e93df8bdc16c223e358ff28b2f939735b240eca2ce1678983f0a57208e6bf150ec96f8d83f127e650b084cf85e5a32fdf9d10b0c6c6e44835c9631dfd9ff235b618925ad1e89779278af5750df7681ea40316d8111eef876a79ad977ae773d8257ec8efead629fdeb3ca4ba9ae6e11fcdbbef6aa72b7934ef695702eddf4e631a13d2f4c73cd599e115f533a639bbc173e6788d0b5cf23a314fe915dee01a37df698bb77887f7f8805ff190e64c342fb59fe2333ca2e373d30b7c89aff035bec1634a9e904ef1417faf78866ff1fc275de03b7c4fa3a1553e50fd8f78a2ef0bfcf43fe973bcc4cff805bb74d6a3de0e31b37c9f561fe090c6583a19612e9d1dd179417db1575237191eeafb172b9cd22a7d409a7bcc8f0c4e68f01900ef44090db8547f4ee9a966456732445083078f779a8756dfdf52f19b1cd59c699254e31c46d0703f30b6fa5239a5d27faabc22b78409de838316bdd51fd1377730a531a12bd363c949aa3d936f1a6821e8fda566aef8fe011d612eba860569495a9196721ebe7d7ed0c30dac491b58d2bd21c116b634bf25ddd2fd9dd9f3f6efef7bff0111915e41</data>
+ </image>
+ <image name="image4">
+ <data format="XPM.GZ" length="661">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c8563600020b13103711c4b530b1308270f5b082019251068344848c32b23808206494a1e23015890819653db8b81e44255c0659025d460fa70c6e3d78ec814b21b90d052422fb070540f50ebaf84196a9b5e6020011bc73cc</data>
+ </image>
+ <image name="image5">
+ <data format="XPM.GZ" length="661">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54103b11c8563600020b13105719c4b530b1308270f5b0027acb28278201a64c221c4084136132ca7011885c225c06c91890542256193d98a198327a386570ea49449581bb4d2f114d0624a08c230c50fd4f5cb80da04cad351700f7fd8672</data>
+ </image>
+ <image name="image6">
+ <data format="XPM.GZ" length="661">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c856360003103711c6b53002abc40a90649491482ac92863955146d6822ca387474619c9301419a03842825819245bd064129513b1cb242602512216994430d44bc4904984c8c1a5e032897a3019a8144c26518f800c92715864d0ec81ab4dc4701b924fb0850e8a4cad351700fbd07ccb</data>
+ </image>
+ <image name="image7">
+ <data format="XPM.GZ" length="706">789c9d92cb0ac2301045f7f98aa1d915b1da8214c44f505c0ae26226b1e8a20a5a1722febb9924a5af58c19b40e77238a1842431ecb66b881371afb03a2b5027bc41ac1f65f9dc1f562f11a52998bd80793411d114146cae9723cfd2cc7266c395ea9aa75c15d74c65aad05c35d79c727215b91636f6d860c689f40910b4e92147d840b3be39d8416d877c860eb9af478d23919c4b8a7a0ed68eb628e4a04521c7fd46c07138e47448dbf1f32fc767e8d43735741af287d3ced83b782fc5075b18a5a5</data>
+ </image>
+ <image name="image8">
+ <data format="XPM.GZ" length="736">789c7d92d10a82301486eff714c3dd49649984103d42d165105dcce3465d58507611d1bbb773d674aed93f85fd7efb183ab394ef771b9e66ecdecaf60c1c4ef2c6d3fad134cfc371fd62499e7373957c9e4c5832e5c0b7d78bc2b9307331a36055ae960556c05a16656e69e5aaa5355658c202965825566d62176b57b5a64da3f188c084841e0a29a5e831910ef8885e4854501922e8a6b923586a176a8e40051ec1e63b7d0267387c6738424775091d653f98565a858e26c110447107d1886350d4a1c41c3dea7864e87c37f3ce47fc3aee7cd5207ffe90f78a7d0007c6c175</data>
+ </image>
+ <image name="image9">
+ <data format="XPM.GZ" length="2798">789cb5d5594f1b491007f0773e8545bda1d53ff81a7bb4da07830103b603b92059edc34cf78c0ff0812f3051befb5677554f56c24428d2aa78e0a7aeaeea6be0dd41e9f6aa573a78b7b75c25ab91299961b2281dd8f564b2fdfb9fbfbeefed572a25fe291f46a5cafe1f7bfbd7ab9229f567d3cc81fa0caa945d785f78c72ebc2f9dabb10bef9e73ade2c21913e77ae2c28f2fc48d6a947ab7c4b169d6bc8f9ca3aa0b3fbfaf4e35ff4c5cccdf8813db34de1def34e4c3881b3cc38fb7d5a918f78525ff46dcaca9576a23a627715cd3f53e8a131b7b63edecba69fd8d3af41b1496fa6d7153f78f86b8a86f0bcbfe9ec5493d16cfc5695dfad34c6d651ca9f7cffdbd173743fd441cd64f0f85a5fe489c6a3fd4d5613c0d4eeade43b189747c1b2ce3683abbeebadf5a702ae343716c743d53313f1febc7bfa843bf1371581f9d06ebf8581df257e2b01eba57675a5fea19177e7c109cfa712271aceba58938b13a6ec4a13fba62ee27f53fa9b51fe5c1ba7f7f1f71cd85f7545cdcf73ad8f8ef137762de9fd4ef898b7e51b0d63f52877e65b10de3c785657eacced4fe7b77b763236fab36fa3e1ec5a9d5f341b0e4d3526c42bd4ab0eee7505cf4fb28ce1aea6fc146fa7f76e6d3e115fafa5d7112cebf254eeb328e6a70967b9f8b437fba13db4ceb2fc5453f7f5ffcfac2795f046bbd0fe2a2df486c42bd2bb18dd46375e89f89b99fccf7ef2dadbbf0eea8add6bf16db4cbd1067b9de8fafc7b7a1ef13cf6213e50defadd846b9acff569c3574fe833ad7fa5fc57943cfdb9f9f894cd8cf93982748fdb9386f64dee4df97c978ff52ef4c9d69ff9938cff53cfdf7ec5627f5ae576f8fdfcf0721410ac391c222fb753e720c30c408638e3bdcf31c7a3d9fb3279862c631c70316586285f5ae1e727fd8e091f3e678c216cf68e108c768e3e4957ccb2b39e5fc337470ce71814b74d143ffe59ae4ff01ae7825d7f8c0753fe213d7ff8c2ffcfb0deccefc016ef115df380e51460555d4504784069aafe48f798f87885126a04a4409a564c8be92bfc115655cb94c395a34409d8634a231afe7c58ee5ef35d7bae3dc2eddd384a634a339c7032d90efcce7bba225ad38525aa3461b7ae478da75037a5f2758d196525ec93359aedde23882a563ae95edc8cf90529b4ee894c6bcf2844f66e2ce1239cf9afc7755c5fbc9b8479fdabcc71b3aa38ee4d039d7b9a04b1ecb5ebe677ea1964712ead2f9cf8aac1ecfd10a6f79ffdc7b4d7dee92bcfd7be1bd5ff29ccedbbf2f90dbfbfffefdfef873ef5fce01d04a</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>fileNewAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileNew()</slot>
+ </connection>
+ <connection>
+ <sender>fileOpenAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileOpen()</slot>
+ </connection>
+ <connection>
+ <sender>fileSaveAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileSave()</slot>
+ </connection>
+ <connection>
+ <sender>fileSaveAsAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileSaveAs()</slot>
+ </connection>
+ <connection>
+ <sender>filePrintAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>filePrint()</slot>
+ </connection>
+ <connection>
+ <sender>fileExitAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileExit()</slot>
+ </connection>
+ <connection>
+ <sender>editUndoAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>editUndo()</slot>
+ </connection>
+ <connection>
+ <sender>editRedoAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>editRedo()</slot>
+ </connection>
+ <connection>
+ <sender>editCutAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>editCut()</slot>
+ </connection>
+ <connection>
+ <sender>editCopyAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>editCopy()</slot>
+ </connection>
+ <connection>
+ <sender>editPasteAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>editPaste()</slot>
+ </connection>
+ <connection>
+ <sender>editFindAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>editFind()</slot>
+ </connection>
+ <connection>
+ <sender>helpIndexAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>helpIndex()</slot>
+ </connection>
+ <connection>
+ <sender>helpContentsAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>helpContents()</slot>
+ </connection>
+ <connection>
+ <sender>helpAboutAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>helpAbout()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>fileNew()</slot>
+ <slot>fileOpen()</slot>
+ <slot>fileSave()</slot>
+ <slot>fileSaveAs()</slot>
+ <slot>filePrint()</slot>
+ <slot>fileExit()</slot>
+ <slot>editUndo()</slot>
+ <slot>editRedo()</slot>
+ <slot>editCut()</slot>
+ <slot>editCopy()</slot>
+ <slot>editPaste()</slot>
+ <slot>editFind()</slot>
+ <slot>helpIndex()</slot>
+ <slot>helpContents()</slot>
+ <slot>helpAbout()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-mainwin-qt4 b/parts/filecreate/file-templates/ui-mainwin-qt4
new file mode 100644
index 00000000..814096cc
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-mainwin-qt4
@@ -0,0 +1,34 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget" />
+ <widget class="QMenuBar" name="menubar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>33</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QStatusBar" name="statusbar" />
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/parts/filecreate/file-templates/ui-tabdialog b/parts/filecreate/file-templates/ui-tabdialog
new file mode 100644
index 00000000..a28ae7c7
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-tabdialog
@@ -0,0 +1,147 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>MyDialog1</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MyDialog1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>528</width>
+ <height>368</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MyDialog1</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>Widget8</cstring>
+ </property>
+ <attribute name="title">
+ <string>Tab</string>
+ </attribute>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>Widget9</cstring>
+ </property>
+ <attribute name="title">
+ <string>Tab</string>
+ </attribute>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ <property name="accel">
+ <string>F1</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-widget b/parts/filecreate/file-templates/ui-widget
new file mode 100644
index 00000000..858b4678
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-widget
@@ -0,0 +1,20 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>Form1</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-widget-qt4 b/parts/filecreate/file-templates/ui-widget-qt4
new file mode 100644
index 00000000..2aecd3c9
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-widget-qt4
@@ -0,0 +1,22 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>Form</class>
+ <widget class="QWidget" name="Form" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/parts/filecreate/file-templates/ui-wizard b/parts/filecreate/file-templates/ui-wizard
new file mode 100644
index 00000000..7c68689b
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-wizard
@@ -0,0 +1,28 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>Form1</class>
+<widget class="QWizard">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>page</cstring>
+ </property>
+ <attribute name="title">
+ <string>Page</string>
+ </attribute>
+ </widget>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/filecreate_filedialog.cpp b/parts/filecreate/filecreate_filedialog.cpp
new file mode 100644
index 00000000..81d711cf
--- /dev/null
+++ b/parts/filecreate/filecreate_filedialog.cpp
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include "filecreate_filedialog.h"
+
+#include <qfileinfo.h>
+#include <kdeversion.h>
+#include <kurlcombobox.h>
+#include <kdebug.h>
+
+#include "filecreate_part.h"
+#include "filecreate_filetype.h"
+
+namespace FileCreate {
+
+ FileDialog::FileDialog(const QString& startDir, const QString& filter,
+ QWidget *parent, const char *name,
+ bool modal, QWidget * extraWidget) :
+ KFileDialog(startDir, filter, parent, name, modal, extraWidget) {
+
+ setOperationMode(Saving);
+
+ m_extraWidget = extraWidget;
+ m_typeChooser = dynamic_cast<TypeChooser*>(extraWidget);
+
+ connect(this, SIGNAL(filterChanged(const QString &)), this, SLOT(slotActionFilterChanged(const QString &)) );
+ connect(locationEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotActionTextChanged(const QString &)) );
+
+ }
+
+ FileDialog::~FileDialog() { }
+
+
+ void FileDialog::initGUI()
+ {
+ KFileDialog::initGUI();
+ }
+
+ void FileDialog::slotActionFilterChanged(const QString & /*filter*/) {
+ }
+
+ void FileDialog::slotActionTextChanged(const QString & text) {
+ kdDebug(9034) << "slotActionTextChanged - " << text << endl;
+ if (!m_typeChooser) return;
+ QString ext = QFileInfo(text).extension();
+ kdDebug(9034) << "Extension is: " << ext << endl;
+ FileType * filetype = m_typeChooser->part()->getType(ext);
+ if (!filetype) return;
+ kdDebug(9034) << "found matching extension: " << ext << endl;
+ kdDebug(9034) << "Description: " << filetype->descr() << endl;
+ m_typeChooser->setCurrent(filetype);
+ }
+
+
+
+}
+
+#include "filecreate_filedialog.moc"
diff --git a/parts/filecreate/filecreate_filedialog.h b/parts/filecreate/filecreate_filedialog.h
new file mode 100644
index 00000000..04e40111
--- /dev/null
+++ b/parts/filecreate/filecreate_filedialog.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+
+
+#ifndef __KDEVPART_FILECREATE_FILEDIALOG_H__
+#define __KDEVPART_FILECREATE_FILEDIALOG_H__
+
+#include <kfiledialog.h>
+
+#include "filecreate_typechooser.h"
+
+namespace FileCreate {
+
+ class FileDialog : public KFileDialog {
+ Q_OBJECT
+
+ public:
+ FileDialog(const QString& startDir, const QString& filter,
+ QWidget *parent, const char *name,
+ bool modal, QWidget * extraWidget);
+ virtual ~FileDialog();
+
+ virtual void initGUI();
+
+ protected:
+ QWidget * m_extraWidget;
+ TypeChooser * m_typeChooser;
+
+ protected slots:
+ void slotActionFilterChanged(const QString & filter);
+ void slotActionTextChanged(const QString & text);
+
+
+ };
+
+}
+
+#endif
diff --git a/parts/filecreate/filecreate_filetype.cpp b/parts/filecreate/filecreate_filetype.cpp
new file mode 100644
index 00000000..ca786565
--- /dev/null
+++ b/parts/filecreate/filecreate_filetype.cpp
@@ -0,0 +1,21 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include "filecreate_filetype.h"
+
+namespace FileCreate {
+
+void FileType::setSubtypesEnabled(bool enabled) {
+ for(FileType * subtype = m_subtypes.first();
+ subtype;subtype=m_subtypes.next())
+ subtype->setEnabled(enabled);
+}
+
+}
diff --git a/parts/filecreate/filecreate_filetype.h b/parts/filecreate/filecreate_filetype.h
new file mode 100644
index 00000000..9b8e039c
--- /dev/null
+++ b/parts/filecreate/filecreate_filetype.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef __FILECREATE_FILETYPE_H__
+#define __FILECREATE_FILETYPE_H__
+
+#include <qstring.h>
+#include <qptrlist.h>
+
+namespace FileCreate {
+
+class FileType {
+
+public:
+
+ FileType() : m_enabled(false) {
+ m_subtypes.setAutoDelete(true);
+ }
+
+ void setName(const QString & name) { m_name = name; }
+ QString name() const { return m_name; }
+ void setExt(const QString & ext) { m_ext = ext; }
+ QString ext() const { return m_ext; }
+ void setCreateMethod(const QString & createMethod) { m_createMethod = createMethod; }
+ QString createMethod() const { return m_createMethod; }
+ void setSubtypeRef(const QString & subtypeRef) { m_subtypeRef = subtypeRef; }
+ QString subtypeRef() const { return m_subtypeRef; }
+ void setIcon(const QString & iconName) { m_iconName = iconName; }
+ QString icon() const { return m_iconName; }
+ void setDescr(const QString & descr) { m_descr = descr; }
+ QString descr() const { return m_descr; }
+ void setEnabled(bool on) { m_enabled = on; }
+ bool enabled() const { return m_enabled; }
+
+ void setSubtypesEnabled(bool enabled = true);
+
+ void addSubtype(const FileType * subtype) { m_subtypes.append(subtype); }
+ QPtrList<FileType> subtypes() const { return m_subtypes; }
+
+private:
+ QString m_name;
+ QString m_ext;
+ QString m_createMethod;
+ QString m_subtypeRef;
+ QString m_iconName;
+ QString m_descr;
+
+ bool m_enabled;
+
+ QPtrList<FileType> m_subtypes;
+
+};
+
+}
+
+#endif
diff --git a/parts/filecreate/filecreate_listitem.cpp b/parts/filecreate/filecreate_listitem.cpp
new file mode 100644
index 00000000..4b33514f
--- /dev/null
+++ b/parts/filecreate/filecreate_listitem.cpp
@@ -0,0 +1,101 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * thanks: Roberto Raggi for QSimpleRichText stuff *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+
+#include "filecreate_listitem.h"
+
+#include <kglobal.h>
+#include <kiconloader.h>
+
+#include <qsimplerichtext.h>
+#include <qpixmap.h>
+
+namespace FileCreate {
+
+ ListItem::ListItem(QListView * listview, const FileType * filetype) :
+ KListViewItem(listview), m_filetype(filetype),
+ m_filetypeRenderer(NULL)
+ {
+ init();
+ }
+
+
+ ListItem::ListItem(ListItem * listitem, const FileType * filetype) :
+ KListViewItem(listitem), m_filetype(filetype),
+ m_filetypeRenderer(NULL)
+ {
+ init();
+ }
+
+ ListItem::~ListItem()
+ {
+ if (m_filetypeRenderer) delete m_filetypeRenderer;
+ }
+
+ void ListItem::setup()
+ {
+ if (m_filetypeRenderer) delete m_filetypeRenderer;
+ m_filetypeRenderer = new QSimpleRichText( text(1), listView()->font() );
+ m_filetypeRenderer->setWidth(listView()->columnWidth(1));
+ setHeight(m_filetypeRenderer->height());
+ KListViewItem::setup();
+ }
+
+ void ListItem::setHeight( int height )
+ {
+ KListViewItem::setHeight( QMAX(QMAX(height,m_iconHeight), m_filetypeRenderer->height() ) );
+ }
+
+ void ListItem::prepareResize() {
+ if (m_filetypeRenderer) {
+ m_filetypeRenderer->setWidth(listView()->columnWidth(1));
+ setHeight(m_filetypeRenderer->height());
+ }
+ }
+
+ void ListItem::paintCell( QPainter* p, const QColorGroup& cg, int column, int width, int align )
+ {
+
+ QBrush brush( isSelected() ? cg.highlight() : backgroundColor() );
+
+ if( column == 1 ){
+// m_filetypeRenderer->setWidth(width);
+// setHeight(m_filetypeRenderer->height());
+ m_filetypeRenderer->draw( p, 0, 0, QRect(0, 0, width, height()), cg, &brush );
+ return;
+ }
+
+ KListViewItem::paintCell( p, cg, column, width, align );
+ }
+
+ void ListItem::init()
+ {
+ m_iconHeight = 0;
+ setText(0, m_filetype->ext()!="" ? QString("." + m_filetype->ext()) : QString("") );
+ setText(1, "<qt><b>"+m_filetype->name()+"</b>. " + m_filetype->descr() );
+
+ KIconLoader * loader = KGlobal::iconLoader();
+ QPixmap iconPix = loader->loadIcon(m_filetype->icon(), KIcon::Desktop,
+ KIcon::SizeMedium,
+ KIcon::DefaultState, NULL,
+ true);
+ if (!iconPix.isNull()) {
+ setPixmap(0, iconPix);
+ m_iconHeight = iconPix.height();
+ }
+
+ }
+
+
+
+}
+
+
diff --git a/parts/filecreate/filecreate_listitem.h b/parts/filecreate/filecreate_listitem.h
new file mode 100644
index 00000000..3b2702d3
--- /dev/null
+++ b/parts/filecreate/filecreate_listitem.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * thanks: Roberto Raggi for QSimpleRichText stuff *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef __FILECREATE_LISTITEM_H__
+#define __FILECREATE_LISTITEM_H__
+
+#include <klistview.h>
+#include <qobject.h>
+
+#include "filecreate_filetype.h"
+
+class QSimpleRichText;
+
+namespace FileCreate {
+
+class ListItem : public KListViewItem {
+
+public:
+ ListItem(QListView *listview, const FileType *filetype);
+ ListItem(ListItem *listitem, const FileType *filetype);
+ virtual ~ListItem();
+
+ const FileType *filetype() const { return m_filetype; }
+
+ virtual void setup();
+ virtual void setHeight( int height );
+ virtual void paintCell( QPainter* p, const QColorGroup& gc, int column, int width, int align );
+ virtual void prepareResize();
+
+private:
+ const FileType *m_filetype;
+ int m_iconHeight;
+ void init();
+ QSimpleRichText *m_filetypeRenderer;
+
+};
+
+}
+
+#endif
+
diff --git a/parts/filecreate/filecreate_newfile.cpp b/parts/filecreate/filecreate_newfile.cpp
new file mode 100644
index 00000000..2077556c
--- /dev/null
+++ b/parts/filecreate/filecreate_newfile.cpp
@@ -0,0 +1,162 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include "filecreate_newfile.h"
+
+#include "filecreate_newfile.moc"
+
+#include <qvbox.h>
+#include <qgrid.h>
+
+#include <qhbox.h>
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <klineedit.h>
+#include <kurlrequester.h>
+#include <kcombobox.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kmessagebox.h>
+
+
+namespace FileCreate {
+
+ NewFileChooser::NewFileChooser(QWidget * parent) :
+ KDialogBase(KDialogBase::Plain, i18n("New file dialog (title)", "New File"), KDialogBase::Ok|KDialogBase::Cancel,
+ KDialogBase::Ok, parent, "New file", true)
+ {
+ QVBoxLayout* lay = new QVBoxLayout( plainPage(), 5, 5 );
+
+ lay->addWidget( new QLabel( i18n("<b>New File Creation</b>"), plainPage() ) );
+
+ QGridLayout* grid = new QGridLayout(lay, 2, 2, 5 );
+ QLabel * l = new QLabel(i18n("&Directory:"), plainPage() );
+ grid->addWidget(l, 0, 0);
+ m_urlreq = new KURLRequester( plainPage(), "url request" );
+ grid->addWidget(m_urlreq, 0, 1);
+ l->setBuddy(m_urlreq);
+ l = new QLabel(i18n("&File name:"), plainPage() );
+ grid->addWidget(l, 1, 0);
+ m_filename = new KLineEdit( plainPage() );
+ grid->addWidget(m_filename, 1, 1);
+ l->setBuddy(m_filename);
+// lay->addWidget( grid );
+
+ QHBoxLayout* hbox = new QHBoxLayout( lay, 5 );
+ m_filetypes = new KComboBox( plainPage(), "combo" );
+ hbox->addWidget(m_filetypes);
+ m_addToProject = new QCheckBox( i18n("Add to project (on checkbox)", "&Add to project"), plainPage(), "addproject" );
+ hbox->addWidget(m_addToProject);
+
+ lay->addStretch(20);
+
+ m_filename->setFocus();
+ m_addToProject->setChecked( true );
+
+ m_urlreq->setMode((int) KFile::Directory);
+ connect( m_filename, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotFileNameChanged(const QString & ) ) );
+ slotFileNameChanged( m_filename->text() );
+ }
+
+ NewFileChooser::~NewFileChooser() {
+ }
+
+ void NewFileChooser::slotFileNameChanged(const QString & _text)
+ {
+ enableButtonOK( !_text.isEmpty() );
+ }
+
+ void NewFileChooser::setFileTypes(QPtrList<FileType> filetypes) {
+ for(FileType * filetype = filetypes.first();
+ filetype;
+ filetype=filetypes.next()) {
+
+ if (filetype->enabled()) {
+
+ if (filetype->subtypes().count()==0)
+ addType(filetype);
+
+ QPtrList<FileType> subtypes = filetype->subtypes();
+ for(FileType * subtype = subtypes.first();
+ subtype;
+ subtype=subtypes.next()) {
+ if (subtype->enabled())
+ addType(subtype);
+
+ }
+
+ }
+
+ }
+
+ }
+
+ KURL NewFileChooser::url() const {
+
+ KURL result ( m_urlreq->url() );
+ result.cd( m_filename->text() );
+ return result;
+ }
+
+ bool NewFileChooser::addToProject() const {
+ return m_addToProject->isChecked();
+ }
+
+ const FileType *NewFileChooser::selectedType() const {
+ if (!m_filetypes->count()) return NULL;
+ return m_typeInCombo[m_filetypes->currentItem()];
+ }
+
+ void NewFileChooser::addType(const FileType * filetype) {
+ m_typeInCombo[m_filetypes->count()]=filetype;
+ m_filetypes->insertItem( filetype->name() +
+ (filetype->ext()!="" ? QString(" (." + filetype->ext() + ")") : QString("") ) );
+ }
+
+ void NewFileChooser::setCurrent(const FileType *filetype) {
+ int changeToRow = -1;
+ QMap<int,const FileType*>::Iterator it;
+ for ( it = m_typeInCombo.begin(); it != m_typeInCombo.end() && changeToRow==-1; ++it ) {
+ if (it.data()==filetype)
+ changeToRow=it.key();
+ }
+ if (changeToRow>-1) m_filetypes->setCurrentItem(changeToRow);
+ }
+
+ void NewFileChooser::setDirectory(const QString & url) {
+ m_urlreq->setURL(url);
+ }
+
+ void NewFileChooser::setName(const QString & name) {
+ m_filename->setText(name);
+ }
+
+ void NewFileChooser::setInProjectMode( bool m )
+ {
+ m_addToProject->setEnabled(m);
+ m_addToProject->setChecked(m);
+ }
+
+ void NewFileChooser::accept()
+ {
+ QString fullPath = url().path();
+ if ( !selectedType()->ext().isEmpty() && !fullPath.endsWith("." + selectedType()->ext())) fullPath+="." + selectedType()->ext();
+ QFileInfo file( fullPath );
+ if ( file.exists() )
+ {
+ KMessageBox::sorry( this, i18n("A file with this name already exists"), i18n("File Exists") );
+ return;
+ }
+ KDialogBase::accept();
+ }
+
+}
+
diff --git a/parts/filecreate/filecreate_newfile.h b/parts/filecreate/filecreate_newfile.h
new file mode 100644
index 00000000..5123c7d9
--- /dev/null
+++ b/parts/filecreate/filecreate_newfile.h
@@ -0,0 +1,59 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+#ifndef FILECREATE_NEWFILE_H
+#define FILECREATE_NEWFILE_H
+
+#include <qptrlist.h>
+#include <qmap.h>
+#include <kurl.h>
+#include <kdialogbase.h>
+
+#include "filecreate_filetype.h"
+
+class KURLRequester;
+class QGridLayout;
+class KComboBox;
+class QCheckBox;
+class KLineEdit;
+
+namespace FileCreate {
+ class NewFileChooser : public KDialogBase {
+ Q_OBJECT
+ public:
+ NewFileChooser(QWidget *parent=0);
+ virtual ~NewFileChooser();
+ void setFileTypes(QPtrList<FileType> typelist);
+ KURL url() const;
+ bool addToProject() const;
+ const FileType *selectedType() const;
+ void setCurrent(const FileType *filetype);
+ void setDirectory(const QString & url);
+ void setName(const QString & name);
+
+ void setInProjectMode(bool m);
+ private slots:
+ void slotFileNameChanged(const QString &);
+ protected:
+ void addType(const FileType * filetype);
+ void accept();
+
+ QGridLayout *m_grid;
+ KURLRequester *m_urlreq;
+ KComboBox *m_filetypes;
+ QCheckBox *m_addToProject;
+ KLineEdit *m_filename;
+
+ QMap<int,const FileType*> m_typeInCombo;
+
+ };
+
+}
+
+#endif
diff --git a/parts/filecreate/filecreate_part.cpp b/parts/filecreate/filecreate_part.cpp
new file mode 100644
index 00000000..3733753a
--- /dev/null
+++ b/parts/filecreate/filecreate_part.cpp
@@ -0,0 +1,562 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+#include "filecreate_part.h"
+
+#include <qwhatsthis.h>
+#include <qdom.h>
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qvbox.h>
+#include <qtimer.h>
+
+#include <kdeversion.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kfiledialog.h>
+#include <kdebug.h>
+#include <kstandarddirs.h>
+#include <kstdaction.h>
+#include <kaction.h>
+#include <kapplication.h>
+#include <kactionclasses.h>
+#include <kpopupmenu.h>
+#include <kmessagebox.h>
+
+#include "kdevcore.h"
+#include "kdevmainwindow.h"
+#include "kdevproject.h"
+#include "kdevpartcontroller.h"
+#include "configwidgetproxy.h"
+
+#include "filetemplate.h"
+#include "domutil.h"
+#include "urlutil.h"
+
+#include "filecreate_widget2.h"
+#include "filecreate_widget3.h"
+#include "filecreate_filetype.h"
+#include "filecreate_filedialog.h"
+#include "filecreate_newfile.h"
+#include "fcconfigwidget.h"
+
+#define PROJECTSETTINGSPAGE 1
+#define GLOBALSETTINGSPAGE 2
+
+#include "kdevplugininfo.h"
+
+#include "config.h"
+
+static const KDevPluginInfo data("kdevfilecreate");
+
+typedef KDevGenericFactory<FileCreatePart> FileCreateFactory;
+K_EXPORT_COMPONENT_FACTORY( libkdevfilecreate, FileCreateFactory( data ) )
+
+using namespace FileCreate;
+
+FileCreatePart::FileCreatePart(QObject *parent, const char *name, const QStringList & )
+// : KDevCreateFile(&data, parent, name ? name : "FileCreatePart"), m_selectedWidget(-1), m_useSideTab(true), m_subPopups(0)
+ : KDevCreateFile(&data, parent, name ? name : "FileCreatePart"), m_subPopups(0)
+{
+ setInstance(FileCreateFactory::instance());
+ setXMLFile("kdevpart_filecreate.rc");
+
+ connect( core(), SIGNAL(projectOpened()), this, SLOT(slotProjectOpened()) );
+ connect( core(), SIGNAL(projectClosed()), this, SLOT(slotProjectClosed()) );
+
+ _configProxy = new ConfigWidgetProxy( core() );
+ _configProxy->createProjectConfigPage( i18n("File Templates"), PROJECTSETTINGSPAGE, info()->icon() );
+ _configProxy->createGlobalConfigPage( i18n("File Templates"), GLOBALSETTINGSPAGE, info()->icon() );
+ connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )),
+ this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) );
+
+
+ KToolBarPopupAction * newAction = new KToolBarPopupAction( i18n("&New"), "filenew", CTRL+Qt::Key_N, this, SLOT(slotNewFile()), actionCollection(), "file_new");
+ newAction->setWhatsThis( i18n("<b>New file</b><p>Creates a new file. Also adds it the project if the <b>Add to project</b> checkbox is turned on.") );
+ newAction->setToolTip( i18n("Create a new file") );
+ m_newPopupMenu = newAction->popupMenu();
+ connect(m_newPopupMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowNewPopupMenu()));
+
+ QTimer::singleShot( 0, this, SLOT(slotGlobalInitialize()) );
+}
+
+
+FileCreatePart::~FileCreatePart()
+{
+ delete _configProxy;
+
+ m_newPopupMenu->clear();
+ delete m_subPopups;
+}
+
+void FileCreatePart::insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int pagenumber )
+{
+ kdDebug() << k_funcinfo << endl;
+
+ switch( pagenumber )
+ {
+ case PROJECTSETTINGSPAGE:
+ {
+ FCConfigWidget* w = new FCConfigWidget( this, false, page, "filecreate config widget" );
+ connect( dlg, SIGNAL( okClicked( ) ), w, SLOT( accept( ) ) );
+ }
+ break;
+
+ case GLOBALSETTINGSPAGE:
+ {
+ FCConfigWidget *w = new FCConfigWidget( this, true, page, "filecreate config widget" );
+ connect(dlg, SIGNAL(okClicked()), w, SLOT(accept()));
+ }
+ break;
+ }
+}
+
+void FileCreatePart::slotAboutToShowNewPopupMenu()
+{
+ KIconLoader * m_iconLoader = KGlobal::iconLoader();
+ m_newPopupMenu->clear();
+ delete m_subPopups;
+ m_subPopups = NULL;
+ int id = 0;
+ FileType * filetype = m_filetypes.first();
+ for(; filetype; filetype=m_filetypes.next())
+ {
+ if (filetype->enabled())
+ {
+ if (filetype->subtypes().count()==0)
+ {
+ QPixmap iconPix = m_iconLoader->loadIcon(
+ filetype->icon(), KIcon::Desktop, KIcon::SizeSmall,
+ KIcon::DefaultState, NULL, true);
+ m_newPopupMenu->insertItem(iconPix, filetype->name(), this,
+ SLOT(slotNewFilePopup(int)), 0, ++id );
+ m_newPopupMenu->setItemParameter( id, (long)filetype );
+ } else
+ {
+ KPopupMenu* subMenu = NULL;
+ QPtrList<FileType> subtypes = filetype->subtypes();
+ for(FileType * subtype = subtypes.first(); subtype; subtype=subtypes.next())
+ {
+ if (subtype->enabled()){
+ if( !subMenu )
+ subMenu = new KPopupMenu(0,0);
+ QPixmap iconPix = m_iconLoader->loadIcon(
+ subtype->icon(), KIcon::Desktop, KIcon::SizeSmall,
+ KIcon::DefaultState, NULL, true);
+ subMenu->insertItem(iconPix, subtype->name(), this,
+ SLOT(slotNewFilePopup(int)), 0, ++id );
+ subMenu->setItemParameter( id, (long)subtype );
+ }
+ }
+ if( subMenu )
+ {
+ if( !m_subPopups )
+ {
+ m_subPopups = new QPtrList<KPopupMenu>;
+ m_subPopups->setAutoDelete(true);
+ }
+ m_subPopups->append( subMenu );
+ m_newPopupMenu->insertItem( filetype->name(), subMenu );
+ }
+ }
+
+ }
+
+ }
+}
+
+void FileCreatePart::slotNewFilePopup( int pFileType )
+{
+ const FileType* filetype = (const FileType*) pFileType;
+ slotFiletypeSelected( filetype );
+}
+
+void FileCreatePart::slotNewFile() {
+ KDevCreateFile::CreatedFile createdFile = createNewFile();
+ if (createdFile.status == KDevCreateFile::CreatedFile::STATUS_NOTCREATED)
+ KMessageBox::error(0, i18n("Cannot create file. Check whether the directory and filename are valid."));
+ else if (createdFile.status != KDevCreateFile::CreatedFile::STATUS_CANCELED)
+ openCreatedFile(createdFile);
+}
+
+void FileCreatePart::slotProjectOpened() {
+ QTimer::singleShot( 0, this, SLOT(slotInitialize()) );
+}
+
+void FileCreatePart::addFileType(const QString & filename) {
+ FileType * filetype = getType(filename);
+ if (!filetype) {
+ filetype = new FileType;
+ filetype->setName( filename + " files" );
+ filetype->setExt( filename );
+ filetype->setCreateMethod("template");
+ m_filetypes.append(filetype);
+ }
+ filetype->setEnabled(true);
+}
+
+void FileCreatePart::slotProjectClosed() {
+ m_filetypes.clear();
+ QTimer::singleShot( 0, this, SLOT(slotGlobalInitialize()) );
+}
+
+void FileCreatePart::slotFiletypeSelected(const FileType * filetype) {
+
+ KDevCreateFile::CreatedFile createdFile = createNewFile(filetype->ext(),
+ QString::null,
+ QString::null,
+ filetype->subtypeRef());
+
+ openCreatedFile(createdFile);
+}
+
+void FileCreatePart::openCreatedFile(const KDevCreateFile::CreatedFile & createdFile)
+{
+ if ( createdFile.status == KDevCreateFile::CreatedFile::STATUS_OK )
+ {
+ KURL uu( createdFile.dir + "/" + createdFile.filename );
+ partController()->editDocument ( uu );
+ }
+}
+
+int FileCreatePart::readTypes(const QDomDocument & dom, QPtrList<FileType> &m_filetypes, bool enable) {
+ int numRead = 0;
+ QDomElement fileTypes = DomUtil::elementByPath(dom,"/kdevfilecreate/filetypes");
+ if (!fileTypes.isNull()) {
+ for(QDomNode node = fileTypes.firstChild();!node.isNull();node=node.nextSibling()) {
+
+ if (node.isElement() && node.nodeName()=="type") {
+ QDomElement element = node.toElement();
+ FileType * filetype = new FileType;
+ filetype->setName( element.attribute("name") );
+ filetype->setExt( element.attribute("ext") );
+ filetype->setCreateMethod( element.attribute("create") );
+
+ filetype->setIcon( element.attribute("icon") );
+ filetype->setDescr( (DomUtil::namedChildElement(element, "descr")).text() );
+ filetype->setEnabled(enable || (filetype->ext()==""));
+ m_filetypes.append(filetype);
+ numRead++;
+
+ kdDebug(9034) << "node: " << filetype->name().latin1() << endl;
+
+ if (node.hasChildNodes()) {
+ for(QDomNode subnode = node.firstChild();!subnode.isNull();subnode=subnode.nextSibling()) {
+ kdDebug(9034) << "subnode: " << subnode.nodeName().latin1() << endl;
+ if (subnode.isElement() && subnode.nodeName()=="subtype") {
+ QDomElement subelement = subnode.toElement();
+ FileType * subtype = new FileType;
+ subtype->setExt( filetype->ext() );
+ subtype->setCreateMethod( filetype->createMethod() );
+ subtype->setSubtypeRef( subelement.attribute("ref") );
+ subtype->setIcon( subelement.attribute("icon") );
+ subtype->setName( subelement.attribute("name") );
+ subtype->setDescr( (DomUtil::namedChildElement(subelement, "descr")).text() );
+ subtype->setEnabled(enable);
+ filetype->addSubtype(subtype);
+ }
+ }
+ }
+ }
+ }
+ }
+ return numRead;
+}
+
+FileType * FileCreatePart::getType(const QString & ex, const QString subtRef) {
+
+ QString subtypeRef = subtRef;
+ QString ext = ex;
+ int dashPos = ext.find('-');
+ if (dashPos>-1 && subtRef.isNull()) {
+ ext = ex.left(dashPos);
+ subtypeRef = ex.mid(dashPos+1);
+ }
+
+ QPtrList<FileType> filetypes = getFileTypes();
+ for(FileType * filetype = filetypes.first();
+ filetype;
+ filetype=filetypes.next()) {
+ if (filetype->ext()==ext) {
+ if (subtypeRef.isNull()) return filetype;
+ QPtrList<FileType> subtypes = filetype->subtypes();
+ for(FileType * subtype = subtypes.first();
+ subtype;
+ subtype=subtypes.next()) {
+ if (subtypeRef==subtype->subtypeRef()) return subtype;
+ }
+ }
+ }
+ return NULL;
+}
+
+FileType * FileCreatePart::getEnabledType(const QString & ex, const QString subtRef) {
+
+ QString subtypeRef = subtRef;
+ QString ext = ex;
+ int dashPos = ext.find('-');
+ if (dashPos>-1 && subtRef.isNull()) {
+ ext = ex.left(dashPos);
+ subtypeRef = ex.mid(dashPos+1);
+ }
+
+ QPtrList<FileType> filetypes = getFileTypes();
+ for(FileType * filetype = filetypes.first();
+ filetype;
+ filetype=filetypes.next()) {
+ if (filetype->ext()==ext) {
+ if ( (subtypeRef.isNull()) && (filetype->enabled()) ) return filetype;
+ QPtrList<FileType> subtypes = filetype->subtypes();
+ for(FileType * subtype = subtypes.first();
+ subtype;
+ subtype=subtypes.next()) {
+ if ( (subtypeRef==subtype->subtypeRef()) && (filetype->enabled()) ) return subtype;
+ }
+ }
+ }
+ return NULL;
+}
+
+// KDevFileCreate interface
+
+KDevCreateFile::CreatedFile FileCreatePart::createNewFile(QString ext, QString dir, QString name, QString subtype)
+{
+ KDevCreateFile::CreatedFile result;
+
+ KURL projectURL;
+ if ( !project() )
+ {
+ //result.status = KDevCreateFile::CreatedFile::STATUS_NOTCREATED;
+ //return result;
+ }
+ else
+ {
+ projectURL = project()->projectDirectory();
+ }
+
+ KURL selectedURL;
+
+ NewFileChooser dialog;
+ dialog.setFileTypes(m_filetypes);
+ const FileType *filetype = getEnabledType(ext,subtype);
+ kdDebug(9034) << "Looking for filetype pointer for " << ext << "/" << subtype << endl;
+ if (filetype) {
+ kdDebug(9034) << "found filetype" << endl;
+ } else {
+ kdDebug(9034) << "could not find filetype" << endl;
+ }
+ if (!project())
+ dialog.setInProjectMode(false);
+
+ if (!dir.isNull())
+ dialog.setDirectory(dir);
+ else if (!project())
+ dialog.setDirectory(QDir::currentDirPath());
+ else
+ {
+ QString activeDir = project()->activeDirectory();
+ dialog.setDirectory( project()->projectDirectory() +
+ ( activeDir[0] == '/' ? "" : "/" )
+ + activeDir );
+ }
+ if (!name.isNull()) dialog.setName(name);
+ if (filetype) dialog.setCurrent(filetype);
+
+ dialog.setInitialSize(QSize(500, 200));
+ int dialogResult = dialog.exec();
+
+ if (dialogResult == KDialogBase::Rejected) {
+ result.status = KDevCreateFile::CreatedFile::STATUS_CANCELED;
+ return result;
+ }
+
+ // OK was pressed
+
+ result.addToProject = dialog.addToProject();
+ selectedURL = dialog.url();
+ const FileType *selectedFileType = dialog.selectedType();
+
+ if (dialog.addToProject() && !projectURL.isParentOf(selectedURL) && !(project()->options() & KDevProject::UsesQMakeBuildSystem) ) {
+ result.status = KDevCreateFile::CreatedFile::STATUS_NOTWITHINPROJECT;
+ return result;
+ }
+
+ if (selectedFileType) {
+ ext = selectedFileType->ext();
+ subtype = selectedFileType->subtypeRef();
+ }
+
+ QString fullPath = selectedURL.path();
+ // add appropriate extension, if not already there
+ if ( !ext.isEmpty() && !fullPath.endsWith("." + ext)) fullPath+="." + ext;
+
+ QString filename = URLUtil::filename(fullPath);
+ kdDebug(9034) << "full path = " << fullPath << endl;
+
+ // add in subtype, if specified
+ if (!subtype.isEmpty())
+ ext += "-" + subtype;
+
+ // create file from template
+ bool created = false;
+ if (FileTemplate::exists(this, ext))
+ created = FileTemplate::copy(this, ext, fullPath);
+ else {
+ // no template, create a blank file instead
+ QFile f(fullPath);
+ created = f.open( IO_WriteOnly );
+ f.close();
+ }
+ if (!created)
+ {
+ result.status = KDevCreateFile::CreatedFile::STATUS_NOTCREATED;
+ return result;
+ }
+
+ if (dialog.addToProject())
+ {
+ // work out the path relative to the project directory
+// QString relToProj = URLUtil::relativePath(projectURL, selectedURL, URLUtil::SLASH_PREFIX );
+ QString relToProj;
+ if( project()->options() & KDevProject::UsesQMakeBuildSystem )
+ {
+ relToProj = URLUtil::relativePathToFile( project()->projectDirectory(), fullPath );
+ project()->addFile(relToProj);
+ }else
+ {
+ relToProj = URLUtil::relativePath(projectURL.path(), fullPath, URLUtil::SLASH_PREFIX );
+ project()->addFile(relToProj.mid(1));
+ }
+ }
+
+ KURL url;
+ url.setPath(fullPath);
+ partController()->editDocument(url);
+
+ QString fileName = URLUtil::filename(fullPath);
+ kdDebug(9034) << "file name = " << filename << endl;
+
+ result.filename = fileName;
+ result.dir = URLUtil::directory(fullPath);
+ result.status = KDevCreateFile::CreatedFile::STATUS_OK;
+
+ return result;
+}
+
+void FileCreatePart::slotNoteFiletype(const FileType * filetype) {
+ kdDebug(9034) << "Noting file type: " << (filetype ? filetype->ext() : QString::fromLatin1("Null") ) << endl;
+ m_filedialogFiletype = filetype;
+}
+
+void FileCreatePart::slotInitialize( )
+{
+ m_filetypes.clear();
+
+ //read global configuration
+ slotGlobalInitialize();
+
+ // read in which global templates are to be used for this project
+ QDomElement useGlobalTypes =
+ DomUtil::elementByPath(*projectDom(),"/kdevfilecreate/useglobaltypes");
+ for(QDomNode node = useGlobalTypes.firstChild();
+ !node.isNull();node=node.nextSibling()) {
+
+ if (node.isElement() && node.nodeName()=="type") {
+ QDomElement element = node.toElement();
+ QString ext = element.attribute("ext");
+ QString subtyperef = element.attribute("subtyperef");
+ // if an extension has been specified as enabled, ensure it
+ // and all its subtypes are enabled
+ if (subtyperef.isNull()) {
+ FileType * filetype = getType(ext);
+ if (filetype) {
+ filetype->setEnabled(true);
+ if (filetype->subtypes().count())
+ filetype->setSubtypesEnabled(true);
+ }
+ } else {
+ // if an extension + subtype have been specified, enable
+ // the subtype and the extension (the 'parent')
+ FileType * filetype = getType(ext);
+ FileType * subtype = getType(ext,subtyperef);
+ if (filetype && subtype) {
+ filetype->setEnabled(true);
+ subtype->setEnabled(true);
+ }
+ }
+ }
+ }
+
+ // read in the list of file types for this project
+ if ( project() && readTypes( *projectDom(), m_filetypes, true )==0 ) {
+ // default by scanning the templates directory if no template info
+ // found in project file
+ QDir templDir( project()->projectDirectory() + "/templates/" );
+ if (templDir.exists()) {
+ templDir.setFilter( QDir::Files );
+ const QFileInfoList * list = templDir.entryInfoList();
+ if( list ){
+ QFileInfoListIterator it( *list );
+ QFileInfo *fi;
+ while ( (fi = it.current()) != 0 ) {
+ addFileType(fi->fileName());
+ ++it;
+ }
+ }
+ }
+/* else { // it was probably an imported project
+ // KLUDGE: we need a better way to determine file types
+ // the current method looks a bit too restrictive
+ addFileType( "cpp" );
+ addFileType( "h" );
+ }*/
+ }
+}
+
+QString FileCreatePart::findGlobalXMLFile() const
+{
+ int version = 0;
+ QString filename;
+ QStringList filenames = KGlobal::instance()->dirs()->findAllResources("data", "kdevfilecreate/template-info.xml");
+ for( QStringList::const_iterator it = filenames.begin(); it != filenames.end(); ++it )
+ {
+ QDomDocument globalDom;
+ DomUtil::openDOMFile(globalDom,*it);
+ QDomElement e = globalDom.documentElement();
+ if( !e.hasAttribute( "version" ) && e.attribute( "version" ).toInt() < version )
+ {
+ continue;
+ }else
+ {
+ version = e.attribute( "version" ).toInt();
+ filename = *it;
+ }
+ }
+ return filename;
+}
+
+void FileCreatePart::slotGlobalInitialize( )
+{
+ // read in global template information
+ QString globalXMLFile = findGlobalXMLFile();
+ kdDebug(9034) << "Found global template info info " << globalXMLFile << endl;
+ QDomDocument globalDom;
+ if (!globalXMLFile.isNull() && DomUtil::openDOMFile(globalDom,globalXMLFile))
+ {
+ kdDebug(9034) << "Reading global template info..." << endl;
+
+ readTypes(globalDom, m_filetypes, false);
+
+ }
+}
+
+#include "filecreate_part.moc"
+
+// kate: indent-width 2; replace-tabs on; tab-width 4; space-indent on;
diff --git a/parts/filecreate/filecreate_part.h b/parts/filecreate/filecreate_part.h
new file mode 100644
index 00000000..3cbc9909
--- /dev/null
+++ b/parts/filecreate/filecreate_part.h
@@ -0,0 +1,144 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+
+
+#ifndef __KDEVPART_FILECREATE_H__
+#define __KDEVPART_FILECREATE_H__
+
+
+#include <qguardedptr.h>
+#include <qptrlist.h>
+
+#include <qwidget.h>
+#include <kdevplugin.h>
+#include <kdevcreatefile.h>
+
+#include "filecreate_typechooser.h"
+
+class KPopupMenu;
+
+namespace FileCreate {
+ class Widget;
+ class FileType;
+}
+
+class KDialogBase;
+class FCConfigWidget;
+class ConfigWidgetProxy;
+
+using namespace FileCreate;
+
+class FileCreatePart : public KDevCreateFile
+{
+ Q_OBJECT
+
+ friend class FCConfigWidget;
+public:
+ FileCreatePart(QObject *parent, const char *name, const QStringList &);
+ virtual ~FileCreatePart();
+
+ /**
+ * Returns the list of available file types.
+ */
+ QPtrList<FileType> getFileTypes() const { return m_filetypes; }
+
+ /**
+ * Call this method to create a new file, within or without the project. Supply as
+ * much information as you know. Leave what you don't know as QString::null.
+ * The user will be prompted as necessary for the missing information, and the
+ * file created, and added to the project as necessary.
+ */
+ virtual KDevCreateFile::CreatedFile createNewFile(QString ext = QString::null,
+ QString dir = QString::null,
+ QString name = QString::null,
+ QString subtype = QString::null);
+
+ /**
+ * Finds the file type object for a given extension and optionally subtype.
+ * You can omit the subtype and specify the extension as ext-subtype if you wish.
+ */
+ FileType * getType(const QString & ext, const QString subtype = QString::null);
+ /**
+ * Finds the file type object for a given extension and optionally subtype.
+ * You can omit the subtype and specify the extension as ext-subtype if you wish.
+ * Returns only enabled type (i.e. used in the project).
+ */
+ FileType * getEnabledType(const QString & ext, const QString subtype = QString::null);
+
+public slots:
+
+ void slotProjectOpened();
+ void slotProjectClosed();
+ void slotInitialize();
+ void slotGlobalInitialize();
+
+ /**
+ * Called when a file type is selected from the docked widget.
+ */
+ void slotFiletypeSelected(const FileType *);
+
+ /**
+ * Called when a new file is required - for example, from the "New.." menu action.
+ */
+ void slotNewFile();
+
+ /**
+ * Called from KToolBarPopupMenu to request a new file action
+ * @param pFileType is acutally a pointer to FileType
+ */
+ void slotNewFilePopup(int pFileType);
+
+protected slots:
+ void slotNoteFiletype(const FileType * filetype);
+ void slotAboutToShowNewPopupMenu();
+ void insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int );
+
+private:
+ /**
+ * If a file has been successfully created, open it
+ */
+ void openCreatedFile(const KDevCreateFile::CreatedFile & createdFile);
+
+ /**
+ * Reads in file type definitions from a config DOM and adds them
+ * to the file type list. If enable is true, sets them all to
+ * enabled=true by default.
+ */
+ int readTypes(const QDomDocument & dom, QPtrList<FileType> &m_filetypes, bool enable);
+
+ /**
+ * Add a file type
+ */
+ void addFileType(const QString & filename);
+
+ /**
+ * Finds the global XML file that has the same version as KDevelop
+ */
+ QString findGlobalXMLFile() const;
+
+ /**
+ * List of file types from which the user can choose
+ */
+ QPtrList<FileType> m_filetypes;
+
+ /**
+ * The file type selected by the new file dialog, if appropriate.
+ */
+ const FileType * m_filedialogFiletype;
+
+ ConfigWidgetProxy * _configProxy;
+
+ KPopupMenu* m_newPopupMenu;
+ QPtrList<KPopupMenu>* m_subPopups;
+};
+
+
+#endif
diff --git a/parts/filecreate/filecreate_typechooser.h b/parts/filecreate/filecreate_typechooser.h
new file mode 100644
index 00000000..8e1e37e8
--- /dev/null
+++ b/parts/filecreate/filecreate_typechooser.h
@@ -0,0 +1,47 @@
+#ifndef __FILECREATE_TYPECHOOSER_H__
+#define __FILECREATE_TYPECHOOSER_H__
+
+#include "filecreate_typechoosersig.h"
+
+#include <kdebug.h>
+
+class FileCreatePart;
+
+namespace FileCreate {
+
+class FileType;
+
+class TypeChooser {
+
+public:
+
+ TypeChooser(FileCreatePart * part) : m_part(part), m_current(NULL) {
+ m_signaller = new Signaller;
+ }
+ virtual ~TypeChooser() { delete m_signaller; }
+
+ virtual void setPart(FileCreatePart * part) { m_part = part; }
+ virtual FileCreatePart * part() const { return m_part; }
+ virtual void refresh() = 0;
+ virtual void setCurrent(const FileType * current) = 0;
+ virtual const FileType * current() const { return m_current; }
+
+ virtual void filetypeSelected(const FileType * filetype) {
+ m_current = filetype;
+ kdDebug(9034) << "type selected: about to signal" << endl;
+ if (filetype) m_signaller->signal(filetype);
+ kdDebug(9034) << "type selected: done signal" << endl;
+ }
+
+ const Signaller * signaller() const { return m_signaller; }
+
+protected:
+ FileCreatePart * m_part;
+ Signaller * m_signaller;
+ const FileType * m_current;
+
+};
+
+}
+
+#endif
diff --git a/parts/filecreate/filecreate_typechoosersig.h b/parts/filecreate/filecreate_typechoosersig.h
new file mode 100644
index 00000000..7f16208a
--- /dev/null
+++ b/parts/filecreate/filecreate_typechoosersig.h
@@ -0,0 +1,28 @@
+#ifndef __FILECREATE_TYPECHOOSERSIG_H__
+#define __FILECREATE_TYPECHOOSERSIG_H__
+
+#include <qobject.h>
+
+namespace FileCreate {
+
+class FileType;
+
+class Signaller : public QObject {
+ Q_OBJECT
+
+public:
+ Signaller() : QObject() { }
+ virtual ~Signaller() { }
+
+ virtual void signal(const FileType * filetype ) {
+ emit filetypeSelected(filetype);
+ }
+
+
+signals:
+ void filetypeSelected(const FileType * filetype);
+};
+
+}
+
+#endif
diff --git a/parts/filecreate/filecreate_widget2.cpp b/parts/filecreate/filecreate_widget2.cpp
new file mode 100644
index 00000000..c8e6d051
--- /dev/null
+++ b/parts/filecreate/filecreate_widget2.cpp
@@ -0,0 +1,228 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include <qptrlist.h>
+#include <qtimer.h>
+#include <qwhatsthis.h>
+
+#include <kparts/part.h>
+#include <klibloader.h>
+#include <kurl.h>
+#include <kdebug.h>
+#include <kiconloader.h>
+#include <klocale.h>
+
+#include <kdevcore.h>
+
+#include "kdevproject.h"
+#include "filecreate_part.h"
+#include "filecreate_widget2.h"
+#include "filecreate_filetype.h"
+#include "filecreate_listitem.h"
+
+namespace FileCreate {
+
+ FriendlyWidget::FriendlyWidget(FileCreatePart *part)
+ : QTable(0,4,0), TypeChooser(part), m_selected(NULL)
+ {
+
+ setReadOnly(true);
+ setShowGrid(false);
+ horizontalHeader()->hide();
+ setTopMargin(0);
+ verticalHeader()->hide();
+ setLeftMargin(0);
+ setSelectionMode(SingleRow);
+ setFocusStyle(FollowStyle);
+ setColumnStretchable(3, true);
+
+ m_iconLoader = KGlobal::iconLoader();
+
+ QWhatsThis::add(this, i18n("Use this to create new files within your project."));
+
+ setDefaultColumnWidths();
+
+ }
+
+
+ FriendlyWidget::~FriendlyWidget()
+ {
+ }
+
+ void FriendlyWidget::setCurrent(const FileType * current) {
+ int changeToRow = -1;
+ QMap<int,FileType*>::Iterator it;
+ kdDebug(9034) << "Checking " << current->descr() << " for matches in row..." << endl;
+ for ( it = typeForRow.begin(); it != typeForRow.end() && changeToRow==-1; ++it ) {
+ kdDebug(9034) << "Checking: " << it.data()->descr() << endl;
+ if (it.data()==current)
+ changeToRow=it.key();
+ else kdDebug(9034) << "No match!" << endl;
+ }
+
+ // If an exact match is not found (e.g. current points to a 'parent' type) then
+ // look instead for an extension match
+ if (changeToRow==-1) {
+ for(it = typeForRow.begin(); it!= typeForRow.end() && changeToRow==-1; ++it) {
+ if (it.data()->ext() == current->ext() )
+ changeToRow = it.key();
+ }
+ }
+
+ if (changeToRow!=-1) {
+ m_current = current;
+ kdDebug(9034) << "Found row, setting current to row " << changeToRow << endl;
+ slotCellSelected(changeToRow,0);
+ clearSelection();
+ selectRow(changeToRow);
+ }
+
+ }
+
+ void FriendlyWidget::refresh() {
+
+ disconnect( this, SIGNAL(currentChanged(int,int)), this, SLOT(slotCellSelected(int,int)) );
+
+ empty();
+
+ int row = 0;
+ QPtrList<FileType> filetypes = m_part->getFileTypes();
+ for(FileType * filetype = filetypes.first();
+ filetype;
+ filetype=filetypes.next()) {
+
+ if (filetype->enabled()) {
+
+ if (filetype->subtypes().count()==0)
+ setRow(row++, filetype);
+
+ QPtrList<FileType> subtypes = filetype->subtypes();
+ for(FileType * subtype = subtypes.first();
+ subtype;
+ subtype=subtypes.next()) {
+ if (subtype->enabled())
+ setRow(row++, subtype);
+ }
+
+ }
+
+ }
+ resizeCells();
+ if (currentSelection()>-1) removeSelection(currentSelection());
+
+ connect( this, SIGNAL(currentChanged(int,int)), this, SLOT(slotCellSelected(int,int)) );
+
+
+ }
+
+ void FriendlyWidget::setRow(int row, FileType * filetype) {
+ if (row+1>numRows()) setNumRows(row+1);
+ setText(row, 1, filetype->name() );
+ setText(row, 2, filetype->ext() );
+ setText(row, 3, filetype->descr() );
+ item(row,1)->setWordWrap(true);
+ item(row,3)->setWordWrap(true);
+ //setRowStretchable(row,true);
+ QPixmap iconPix = m_iconLoader->loadIcon(filetype->icon(), KIcon::Desktop, KIcon::SizeMedium,
+ KIcon::DefaultState, NULL,
+ true);
+ if (!iconPix.isNull()) {
+ setPixmap(row, 0, iconPix);
+ setRowHeight(row, iconPix.height()+4 );
+ if (iconPix.width()+4>columnWidth(0))
+ setColumnWidth(0, iconPix.width()+4 );
+ }
+
+ typeForRow[row]=filetype;
+
+ }
+
+ void FriendlyWidget::empty() {
+ typeForRow.clear();
+ while(numRows()) removeRow(0);
+ }
+
+ void FriendlyWidget::setDefaultColumnWidths() {
+ // set some defaults - resizeCells will later ensure that column widths
+ // and row heights are set big enough for the cell contents
+ setColumnWidth(0,1);
+ setColumnWidth(1,60);
+ setColumnWidth(2,30);
+ setColumnWidth(3,150);
+ }
+
+ void FriendlyWidget::slotCellSelected(int row, int col) {
+ if (col!=0) {
+ setCurrentCell(row, 0);
+ return;
+ }
+
+ m_selected = typeForRow.contains(row) ? typeForRow[row] : NULL;
+ QTimer::singleShot(0, this, SLOT(slotDoSelection()) );
+
+ }
+
+ void FriendlyWidget::slotDoSelection() {
+ kdDebug(9034) << "widget2: slotDoSelection" << endl;
+ if (m_selected) filetypeSelected(m_selected);
+ kdDebug(9034) << "widget2: slotDoSelection middle" << endl;
+ if (currentSelection()>-1) removeSelection(currentSelection());
+ kdDebug(9034) << "widget2: slotDoSelection ending" << endl;
+ }
+
+ void FriendlyWidget::resizeCells() {
+ for(int r=0;r<numRows();r++) resizeRow(r);
+ for(int c=0;c<numCols();c++) resizeColumn(c);
+ }
+
+ void FriendlyWidget::resizeRow(int row) {
+ if (row>=numRows() || row<0) return;
+ int maxHeight = 0;
+
+ for(int c=0;c<numCols();c++) {
+ QTableItem* i = item( row, c );
+ if( !i )
+ continue;
+
+ QSize size = i->sizeHint();
+ maxHeight = size.height()>maxHeight ? size.height() : maxHeight;
+ }
+ setRowHeight(row,maxHeight+2); // bit of extra room
+ }
+
+ void FriendlyWidget::resizeColumn(int col) {
+ if (col>=numCols() || col<0) return;
+ int maxWidth = 0;
+ for(int r=0;r<numRows();r++) {
+
+ QTableItem* i = item( r, col );
+ if( !i )
+ continue;
+
+ QSize size = item(r,col)->sizeHint();
+ maxWidth = size.width()>maxWidth ? size.width() : maxWidth;
+ }
+ setColumnWidth(col,maxWidth+2); // bit of extra room
+ }
+
+#if QT_VERSION < 0x030100
+ void FriendlyWidget::selectRow(int row) {
+ if (numCols()>0 && row<numRows()) {
+ QTableSelection sel;
+ sel.init(row,0);
+ sel.expandTo(row,numCols());
+ addSelection(sel);
+ }
+ }
+#endif
+
+}
+
+#include "filecreate_widget2.moc"
diff --git a/parts/filecreate/filecreate_widget2.h b/parts/filecreate/filecreate_widget2.h
new file mode 100644
index 00000000..8b3d14e8
--- /dev/null
+++ b/parts/filecreate/filecreate_widget2.h
@@ -0,0 +1,113 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef __FILECREATE_WIDGET2_H__
+#define __FILECREATE_WIDGET2_H__
+
+#include <kdeversion.h>
+#include <qtable.h>
+#include <qstring.h>
+#include <qmap.h>
+
+//#include <klistview.h>
+
+#include "filecreate_typechooser.h"
+
+class KIconLoader;
+class KDevProject;
+class FileCreatePart;
+
+namespace FileCreate {
+
+ class FileType;
+
+ class FriendlyWidget : public QTable, public TypeChooser
+ {
+ Q_OBJECT
+
+ public:
+
+ FriendlyWidget(FileCreatePart *part);
+ virtual ~FriendlyWidget();
+
+ /**
+ * Refreshes the widget with the part's file type list.
+ */
+ virtual void refresh();
+ /**
+ * Sets the currently highlighted file type.
+ */
+ virtual void setCurrent(const FileType * current);
+
+#if QT_VERSION < 0x030100
+ void selectRow(int row);
+#endif
+
+ protected:
+ /**
+ * Sets row <i>row</i> to filetype <i>filetype</i>.
+ */
+ virtual void setRow(int row, FileType * filetype);
+ /**
+ * Clears the table.
+ */
+ virtual void empty();
+ /**
+ * Sets some default column widths.
+ */
+ virtual void setDefaultColumnWidths();
+ /**
+ * Scans the cells in the table and adjusts their size based
+ * on their contents.
+ */
+ virtual void resizeCells();
+ /**
+ * Sets the height of a row to the highest
+ * cell in the row.
+ */
+ virtual void resizeRow(int row);
+ /**
+ * Sets the width of a column to the widest
+ * cell in the column.
+ */
+ virtual void resizeColumn(int col);
+
+ /**
+ * The default icon loader, here for convenience.
+ */
+ KIconLoader * m_iconLoader;
+ /**
+ * A mapping of each row number to a file type.
+ */
+ QMap<int,FileType*> typeForRow;
+ /**
+ * The currently selected file type, or null if none.
+ */
+ FileType * m_selected;
+
+ protected slots:
+ /**
+ * When a cell is selected by the user.
+ */
+ virtual void slotCellSelected(int row, int col);
+ /**
+ * Invoked as a single shot after slotCellSelected, with m_selected
+ * set to the selected file type, so that
+ * the GUI will be updated before the selection event
+ * takes place.
+ */
+ virtual void slotDoSelection();
+
+
+ };
+
+}
+
+#endif
diff --git a/parts/filecreate/filecreate_widget3.cpp b/parts/filecreate/filecreate_widget3.cpp
new file mode 100644
index 00000000..f766cbcf
--- /dev/null
+++ b/parts/filecreate/filecreate_widget3.cpp
@@ -0,0 +1,119 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * thanks: Roberto Raggi for QSimpleRichText stuff *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include <qptrlist.h>
+#include <qwhatsthis.h>
+
+#include <kparts/part.h>
+#include <klibloader.h>
+#include <kurl.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kdevcore.h>
+
+#include "filecreate_widget3.h"
+
+#include "kdevproject.h"
+#include "filecreate_part.h"
+#include "filecreate_filetype.h"
+#include "filecreate_listitem.h"
+
+namespace FileCreate {
+
+ ListWidget::ListWidget(FileCreatePart *part)
+ : KListView(0, "KDevFileCreate"), TypeChooser(part)
+ {
+ setIcon( SmallIcon("filenew2") );
+ setCaption(i18n("File Create"));
+ setResizeMode( AllColumns );
+ setAllColumnsShowFocus(true);
+ setRootIsDecorated(true);
+
+ addColumn("");
+ addColumn("");
+
+ QWhatsThis::add(this, i18n("<b>New file</b><p>This part makes the creation of new files easier. Select a type in the list to create a file. "
+ "The list of project file types can be configured in project settings dialog, <b>New File Wizard</b> tab. "
+ "Globally available file types are listed and can be configured in KDevelop settings dialog, <b>New File Wizard</b> tab."));
+
+
+ connect( this, SIGNAL(clicked(QListViewItem*)), this, SLOT(slotTypeSelected(QListViewItem*)) );
+ }
+
+
+ ListWidget::~ListWidget()
+ {
+ }
+
+ void ListWidget::setCurrent(const FileType * current) {
+
+ bool found = false;
+ QListViewItem * lvi = firstChild();
+ while(lvi && !found) {
+ ListItem * li = dynamic_cast<ListItem*>(lvi);
+ if (li) {
+ if (li->filetype()==current) {
+ found=true;
+ setSelected(li,true);
+ }
+ }
+ if (lvi->nextSibling())
+ lvi = lvi->nextSibling();
+ else {
+ while (lvi && !lvi->nextSibling())
+ lvi = lvi->parent();
+ }
+ }
+
+ }
+
+ void ListWidget::resizeEvent(QResizeEvent *event) {
+ ListItem *li = dynamic_cast<ListItem*>(firstChild());
+ while(li) {
+ li->prepareResize();
+ li = dynamic_cast<ListItem*>(li->nextSibling());
+ }
+ KListView::resizeEvent(event);
+ }
+
+ void ListWidget::refresh() {
+ clear();
+ QPtrList<FileType> filetypes = m_part->getFileTypes();
+ for(FileType * filetype = filetypes.first();
+ filetype!=NULL;
+ filetype=filetypes.next()) {
+ if (filetype->enabled()) {
+ QPtrList<FileType> subtypes = filetype->subtypes();
+ if (subtypes.count()==0)
+ new ListItem( this, filetype );
+ for(FileType * subtype = subtypes.first();
+ subtype!=NULL;
+ subtype=subtypes.next()) {
+ if (subtype->enabled())
+ new ListItem( this, subtype );
+ }
+ }
+ }
+ }
+
+ void ListWidget::slotTypeSelected(QListViewItem * item) {
+ ListItem * fileitem = dynamic_cast<ListItem*>(item);
+ if (!fileitem) return;
+
+ const FileType * filetype = fileitem->filetype();
+
+ TypeChooser::filetypeSelected(filetype);
+ }
+
+
+}
+#include "filecreate_widget3.moc"
diff --git a/parts/filecreate/filecreate_widget3.h b/parts/filecreate/filecreate_widget3.h
new file mode 100644
index 00000000..58fc5129
--- /dev/null
+++ b/parts/filecreate/filecreate_widget3.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef __FILECREATE_WIDGET3_H__
+#define __FILECREATE_WIDGET3_H__
+
+
+#include <qwidget.h>
+#include <qstring.h>
+
+#include <klistview.h>
+
+#include "filecreate_typechooser.h"
+
+class KDevProject;
+class FileCreatePart;
+class QResizeEvent;
+
+namespace FileCreate {
+
+ class FileType;
+
+ class ListWidget : public KListView, public TypeChooser
+ {
+ Q_OBJECT
+
+ public:
+
+ ListWidget(FileCreatePart *part);
+ virtual ~ListWidget();
+
+ virtual void refresh();
+ virtual void setCurrent(const FileType * current);
+ virtual void resizeEvent(QResizeEvent *event);
+
+ public slots:
+ void slotTypeSelected(QListViewItem * item);
+
+ };
+
+}
+
+#endif
diff --git a/parts/filecreate/kdevfilecreate.desktop b/parts/filecreate/kdevfilecreate.desktop
new file mode 100644
index 00000000..82adbb30
--- /dev/null
+++ b/parts/filecreate/kdevfilecreate.desktop
@@ -0,0 +1,77 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=FileCreate
+Comment[ca]=Creació de fitxers
+Comment[da]=Filoprettelse
+Comment[de]=Eine Komponente, die Unterstützung bei der Erstellung von Dateien bietet
+Comment[el]=ΔημιουργίαΑρχείου
+Comment[es]=Creación de archivos
+Comment[eu]=Fitxategi sorkuntza
+Comment[fa]=ایجاد پرونده
+Comment[fr]=Création de fichiers
+Comment[hi]=फ़ाइल-क्रिएट
+Comment[hu]=Fájl létrehozása
+Comment[it]=Crea file
+Comment[ja]=ファイル作成
+Comment[ms]=CiptaFail
+Comment[nds]=Dateiopstellen
+Comment[ne]=फाइल सिर्जना
+Comment[nl]=Bestand aanmaken
+Comment[pl]=Tworzenie pliku
+Comment[pt]=Criação de Ficheiros
+Comment[ru]=Мастер создания файлов
+Comment[sk]=Vytvoriť súbor
+Comment[sl]=Ustvarjanje datotek
+Comment[sr]=Направи фајл
+Comment[sr@Latn]=Napravi fajl
+Comment[sv]=Skapa filer
+Comment[ta]= கோப்பு உருவாக்கப்பட்டது
+Comment[tg]=Устои бунёд кардани файлҳо
+Comment[zh_CN]=文件创建
+Comment[zh_TW]=檔案建立
+Name=KDevFileCreate
+Name[da]=KDevelop filoprettelse
+Name[de]=Dateierstellungs-Komponente (KDevelop)
+Name[hi]=के-डेव-फ़ाइल-क्रिएट
+Name[nds]=KDevelop-Dateiopstellen
+Name[pl]=KDevTworzeniePliku
+Name[sk]=KDev vytvoriť súbor
+Name[sv]=KDevelop skapa filer
+Name[ta]=KDev உருவாக்கப்பட்ட கோப்பு
+Name[tg]=Сохткунандаи KDev
+Name[zh_TW]=KDevelop 檔案建立
+GenericName=FileCreate
+GenericName[ca]=Creació de fitxers
+GenericName[da]=Filoprettelse
+GenericName[de]=Dateierstellungs-Komponente
+GenericName[el]=ΔημιουργίαΑρχείου
+GenericName[es]=Creación de archivos
+GenericName[eu]=Fitxategi sorkuntza
+GenericName[fa]=ایجاد پرونده
+GenericName[hi]=फ़ाइल-क्रिएट
+GenericName[hu]=Fájl létrehozása
+GenericName[it]=Crea file
+GenericName[ja]=ファイル作成
+GenericName[ms]=CiptaFail
+GenericName[nds]=Dateiopstellen
+GenericName[ne]=फाइल सिर्जना
+GenericName[nl]=Bestand aanmaken
+GenericName[pl]=Tworzenie pliku
+GenericName[pt]=Criação de Ficheiros
+GenericName[ru]=Мастер создания файлов
+GenericName[sk]=Vytvoriť súbor
+GenericName[sl]=Ustvarjanje datotek
+GenericName[sr]=Направи фајл
+GenericName[sr@Latn]=Napravi fajl
+GenericName[sv]=Skapa filer
+GenericName[ta]=கோப்பு உருவாக்கம்
+GenericName[tg]=Устои бунёд кардани файлҳо
+GenericName[zh_CN]=文件创建
+GenericName[zh_TW]=檔案建立
+Icon=wizard
+ServiceTypes=KDevelop/CreateFile
+X-KDE-Library=libkdevfilecreate
+X-KDevelop-Version=5
+X-KDevelop-Properties=FileCreation
+X-KDevelop-Scope=Core
diff --git a/parts/filecreate/kdevpart_filecreate.rc b/parts/filecreate/kdevpart_filecreate.rc
new file mode 100644
index 00000000..401a1378
--- /dev/null
+++ b/parts/filecreate/kdevpart_filecreate.rc
@@ -0,0 +1,11 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="KDevFileCreate" library="libfilecreateplugin" version="3">
+<MenuBar>
+ <Menu name="file">
+ <Action name="file_new" group="new_merge" />
+ </Menu>
+</MenuBar>
+<ToolBar name="mainToolBar">
+ <Action name="file_new" group="file_operations" />
+</ToolBar>
+</kpartplugin>
diff --git a/parts/filecreate/template-info.xml b/parts/filecreate/template-info.xml
new file mode 100644
index 00000000..bddd5d65
--- /dev/null
+++ b/parts/filecreate/template-info.xml
@@ -0,0 +1,181 @@
+<?xml version = '1.0'?>
+<kdevelop version="1">
+ <kdevfilecreate>
+ <sidetab active="no">
+ </sidetab>
+ <filetypes>
+ <type ext="" name="Blank File" create="template">
+ <descr>A new blank file.</descr>
+ </type>
+ <type ext="py" name="Python" create="template" icon="source_py">
+ <descr>A new empty Python source file.</descr>
+ </type>
+ <type ext="rb" name="Ruby" create="template" icon="template_source">
+ <descr>A new empty Ruby source file.</descr>
+ </type>
+ <type ext="rhtml" name="RHTML Source" create="template" icon="template_source">
+ <descr>A new empty rhtml source file.</descr>
+ </type>
+ <type ext="html.erb" name="HTML/ERB Source" create="template" icon="template_source">
+ <descr>A new empty html.erb source file.</descr>
+ </type>
+ <type ext="rxml" name="RXML Builder Template" create="template" icon="template_source">
+ <descr>A new empty rxml builder template source file.</descr>
+ </type>
+ <type ext="xml.builder" name="XML/Builder Template" create="template" icon="template_source">
+ <descr>A new empty rxml builder template source file.</descr>
+ </type>
+ <type ext="rjs" name="Ruby JavaScript" create="template" icon="template_source">
+ <descr>A new empty Ruby JavaScript template source file.</descr>
+ </type>
+ <type ext="js.rjs" name="Ruby/JavaScript" create="template" icon="template_source">
+ <descr>A new empty Ruby JavaScript template source file.</descr>
+ </type>
+ <type ext="css" name="Cascading Style Sheet" create="template" icon="template_source">
+ <descr>A new empty cascading style sheet source file.</descr>
+ </type>
+ <type ext="js" name="JavaScript" create="template" icon="template_source">
+ <descr>A new empty JavaScript source file.</descr>
+ </type>
+ <type ext="ui" name="Qt Designer" create="no" icon="widget_doc">
+ <descr>
+ </descr>
+ <subtype ref="widget" name="Qt3 Widget" icon="widget_doc">
+ <descr>A new widget.</descr>
+ </subtype>
+ <subtype ref="dialog" name="Qt3 Dialog" icon="widget_doc">
+ <descr>A new empty Dialog box.</descr>
+ </subtype>
+ <subtype ref="tabdialog" name="Qt3 Tab Dialog" icon="widget_doc">
+ <descr>A new empty Tab Dialog box.</descr>
+ </subtype>
+ <subtype ref="dialogr" name="Qt3 Dialog with Buttons (right)" icon="widget_doc">
+ <descr>A new Dialog box with buttons on the right.</descr>
+ </subtype>
+ <subtype ref="dialogb" name="Qt3 Dialog with Buttons (bottom)" icon="widget_doc">
+ <descr>A new Dialog box with buttons on the bottom.</descr>
+ </subtype>
+ <subtype ref="confdialog" name="Qt3 Configuration Dialog" icon="widget_doc">
+ <descr>A new Configuration Dialog box.</descr>
+ </subtype>
+ <subtype ref="wizard" name="Qt3 Wizard" icon="widget_doc">
+ <descr>A new empty Wizard dialog.</descr>
+ </subtype>
+ <subtype ref="mainwin" name="Qt3 Main Window" icon="widget_doc">
+ <descr>A new empty main window.</descr>
+ </subtype>
+ <subtype ref="widget-qt4" name="Qt4 Widget" icon="widget_doc">
+ <descr>A new Qt4 widget.</descr>
+ </subtype>
+ <subtype ref="dialog-qt4" name="Qt4 Dialog" icon="widget_doc">
+ <descr>A new empty Qt4 Dialog box.</descr>
+ </subtype>
+ <subtype ref="mainwin-qt4" name="Qt4 Main Window" icon="widget_doc">
+ <descr>A new empty Qt4 main window.</descr>
+ </subtype>
+ <subtype ref="dialogr-qt4" name="Qt4 Dialog with Buttons (right)" icon="widget_doc">
+ <descr>A new Qt4 Dialog box with buttons on the right.</descr>
+ </subtype>
+ <subtype ref="dialogb-qt4" name="Qt4 Dialog with Buttons (bottom)" icon="widget_doc">
+ <descr>A new Qt4 Dialog box with buttons on the bottom.</descr>
+ </subtype>
+ </type>
+ <type ext="qrc" name="Qt4 Resource" create="template" icon="template_source">
+ <descr>A new Qt4 Resource file.</descr>
+ </type>
+ <type ext="cpp" name="C++ Source" create="template" icon="source_cpp">
+ <descr>A new empty C++ file.</descr>
+ </type>
+ <type ext="c" name="C Source" create="template" icon="source_c">
+ <descr>A new empty C file.</descr>
+ </type>
+ <type ext="h" name="C/C++ Header" create="template" icon="source_h">
+ <descr>A new empty header file for C or C++.</descr>
+ </type>
+ <type ext="php" name="PHP" create="template" icon="php">
+ <descr>A new empty PHP source file.</descr>
+ </type>
+ <type ext="java" name="Java Source" create="template" icon="source_java">
+ <descr>A new empty Java source file.</descr>
+ </type>
+ <type ext="ads" name="Ada Spec" create="template" icon="source_ads">
+ <descr>A new empty Ada spec file.</descr>
+ </type>
+ <type ext="adb" name="Ada Body" create="template" icon="source_adb">
+ <descr>A new empty Ada body file.</descr>
+ </type>
+ <type ext="F" name="Fortran Source" create="template" icon="source_f">
+ <descr>A new empty Fortran source file.</descr>
+ </type>
+ <type ext="f" name="Preprocessed Fortran" create="template" icon="source_f">
+ <descr>A new empty preprocessed Fortran file.</descr>
+ </type>
+ <type ext="f77" name="Fortran77 Source" create="template" icon="source_f">
+ <descr>A new empty Fortran77 source file.</descr>
+ </type>
+ <type ext="f90" name="Fortran90 Source" create="template" icon="source_f">
+ <descr>A new empty Fortran90 source file.</descr>
+ </type>
+ <type ext="f95" name="Fortran95 Source" create="template" icon="source_f">
+ <descr>A new empty Fortran95 source file.</descr>
+ </type>
+ <type ext="for" name="Preprocessed Fortran" create="template" icon="source_f">
+ <descr>A new empty preprocessed Fortran file.</descr>
+ </type>
+ <type ext="ftn" name="Fortran77 Source" create="template" icon="source_f">
+ <descr>A new empty Fortran77 source file.</descr>
+ </type>
+ <type ext="fpp" name="Fortran Source" create="template" icon="source_f">
+ <descr>A new empty Fortran source file.</descr>
+ </type>
+ <type ext="pl" name="Perl Script" create="template" icon="template_source">
+ <descr>A new Perl script.</descr>
+ </type>
+ <type ext="pm" name="Perl Module" create="template" icon="template_source">
+ <descr>A new perl module.</descr>
+ </type>
+ <type ext="pp" name="Pascal Source" create="no" icon="source_p">
+ <descr/>
+ <subtype ref="program" name="Pascal Program" icon="source_p">
+ <descr>A new pascal program.</descr>
+ </subtype>
+ <subtype ref="unit" name="Pascal Unit" icon="source_p">
+ <descr>A new pascal unit.</descr>
+ </subtype>
+ </type>
+ <type ext="pas" name="Pascal Source" create="no" icon="source_p">
+ <descr/>
+ <subtype ref="program" name="Pascal Program" icon="source_p">
+ <descr>A new pascal program.</descr>
+ </subtype>
+ <subtype ref="unit" name="Pascal Unit" icon="source_p">
+ <descr>A new pascal unit.</descr>
+ </subtype>
+ </type>
+ <type ext="dpr" name="Delphi Project" create="template" icon="source_p">
+ <descr>A new Delphi project.</descr>
+ </type>
+ <type ext="l" name="flex C Source" create="template" icon="source_l">
+ <descr>A new empty flex C source source file.</descr>
+ </type>
+ <type ext="ll" name="flex C++ Source" create="template" icon="source_l">
+ <descr>A new empty flex C++ source source file.</descr>
+ </type>
+ <type ext="y" name="bison C Source" create="template" icon="source_y">
+ <descr>A new empty bison C source source file.</descr>
+ </type>
+ <type ext="yy" name="bison C++ Source" create="template" icon="source_y">
+ <descr>A new empty bison C++ source source file.</descr>
+ </type>
+ <type ext="dox" name="Doxygen Documentation Page" create="template" icon="document">
+ <descr>A new empty Doxygen documentation page.</descr>
+ </type>
+ <type ext="hs" name="Haskell Source" create="template" icon="source_hs">
+ <descr>A new empty Haskell source file.</descr>
+ </type>
+ <type ext="ts" name="Qt Linguist Translation" create="template" icon="template_source">
+ <descr>A new empty Qt Linguist translation source file.</descr>
+ </type>
+ </filetypes>
+ </kdevfilecreate>
+</kdevelop>