FileCreatePart Class Reference
FileCreatePart is a template manager and wizard system to assist with creation of new files. More...
#include <filecreate_part.h>
Inheritance diagram for FileCreatePart:

Public Slots | |
void | slotProjectOpened () |
void | slotProjectClosed () |
void | slotInitialize () |
void | slotFiletypeSelected (const FileType *) |
Called when a file type is selected from the docked widget. | |
void | slotNewFile () |
Called when a new file is required - for example, from the "New.." menu action. | |
Public Member Functions | |
FileCreatePart (QObject *parent, const char *name, const QStringList &) | |
virtual | ~FileCreatePart () |
QPtrList< FileType > | getFileTypes () const |
Returns the list of available file types. | |
virtual KDevCreateFile::CreatedFile | createNewFile (QString ext=QString::null, QString dir=QString::null, QString name=QString::null, QString subtype=QString::null) |
Call this method to create a new file, within or without the project. | |
void | setShowSideTab (bool on) |
Show file creation friendly side tab, yes or no. | |
void | selectWidget (int widgetNumber) |
Selects a docked widget. | |
TypeChooser * | typeChooserWidget () const |
Returns the current type chooser as a TypeChooser* type. | |
QWidget * | typeChooserWidgetAsQWidget () const |
Returns the current type chooser as a QWidget* type. | |
FileType * | getType (const QString &ext, const QString subtype=QString::null) |
Finds the file type object for a given extension and optionally subtype. | |
FileType * | getEnabledType (const QString &ext, const QString subtype=QString::null) |
Finds the file type object for a given extension and optionally subtype. | |
Protected Slots | |
void | slotNoteFiletype (const FileType *filetype) |
void | insertConfigWidget (const KDialogBase *dlg, QWidget *page, unsigned int) |
Private Member Functions | |
void | openCreatedFile (const KDevCreateFile::CreatedFile &createdFile) |
If a file has been successfully created, open it. | |
int | readTypes (const QDomDocument &dom, QPtrList< FileType > &m_filetypes, bool enable) |
Reads in file type definitions from a config DOM and adds them to the file type list. | |
void | addFileType (const QString &filename) |
Add a file type. | |
bool | setWidget (TypeChooser *widget) |
Set the current widget. | |
void | refresh () |
Refreshes the widget in use - i.e. | |
Private Attributes | |
int | m_selectedWidget |
The number (index to m_availableWidgets) of the widget currently in use, or -1 if none. | |
QPtrList< FileType > | m_filetypes |
List of file types from which the user can choose. | |
TypeChooser * | m_availableWidgets [2] |
List of available chooser widgets. | |
int | m_numWidgets |
Number of chooser widgets. | |
const FileType * | m_filedialogFiletype |
The file type selected by the new file dialog, if appropriate. | |
bool | m_useSideTab |
ConfigWidgetProxy * | _configProxy |
Detailed Description
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:
py ui ui-dialog ui-mainwin
Example XML:
You can also use global template definitions supplied with the FileCreate part:
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:
Usually, this XML forms part of the base .kdevelop file created by the appwizard.
- Feature(s):
- friendly sidebar listing the types of new file that can be created for your project
configurable per-project file types and global file types
- Bug:
- bugs in file create component at Bugzilla database
Arrangement of text in sidebar is not always perfect
Definition at line 37 of file filecreate_part.h.
Constructor & Destructor Documentation
|
Definition at line 57 of file filecreate_part.cpp. References GLOBALSETTINGSPAGE, KStdAction::openNew(), PROJECTSETTINGSPAGE, KAction::setToolTip(), and KAction::setWhatsThis(). |
|
Definition at line 89 of file filecreate_part.cpp. References _configProxy, m_availableWidgets, m_numWidgets, KDevPlugin::mainWindow(), and KDevMainWindow::removeView(). |
Member Function Documentation
|
Add a file type.
Definition at line 171 of file filecreate_part.cpp. References addFileType(), getType(), m_filetypes, FileCreate::FileType::setCreateMethod(), FileCreate::FileType::setEnabled(), FileCreate::FileType::setExt(), and FileCreate::FileType::setName(). Referenced by addFileType(), and slotInitialize(). |
|
|
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). Definition at line 280 of file filecreate_part.cpp. References FileCreate::FileType::enabled(), FileCreate::FileType::ext(), getEnabledType(), getFileTypes(), FileCreate::FileType::subtypeRef(), and FileCreate::FileType::subtypes(). Referenced by createNewFile(), and getEnabledType(). |
|
Returns the list of available file types.
Definition at line 49 of file filecreate_part.h. References m_filetypes. Referenced by getEnabledType(), getType(), FileCreate::ListWidget::refresh(), and FileCreate::FriendlyWidget::refresh(). |
|
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. Definition at line 253 of file filecreate_part.cpp. References FileCreate::FileType::ext(), getFileTypes(), getType(), FileCreate::FileType::subtypeRef(), and FileCreate::FileType::subtypes(). Referenced by addFileType(), getType(), FileCreate::FileDialog::slotActionTextChanged(), and slotInitialize(). |
|
Definition at line 103 of file filecreate_part.cpp. References endl(), GLOBALSETTINGSPAGE, insertConfigWidget(), k_funcinfo, kdDebug(), and PROJECTSETTINGSPAGE. Referenced by insertConfigWidget(). |
|
If a file has been successfully created, open it.
Definition at line 200 of file filecreate_part.cpp. References KDevCreateFile::CreatedFile::dir, KDevPartController::editDocument(), KDevCreateFile::CreatedFile::filename, openCreatedFile(), KDevPlugin::partController(), KDevPlugin::project(), and KDevCreateFile::CreatedFile::status. Referenced by openCreatedFile(), slotFiletypeSelected(), and slotNewFile(). |
|
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. Definition at line 207 of file filecreate_part.cpp. References FileCreate::FileType::addSubtype(), FileCreate::FileType::createMethod(), endl(), FileCreate::FileType::ext(), kdDebug(), FileCreate::FileType::name(), readTypes(), FileCreate::FileType::setCreateMethod(), FileCreate::FileType::setDescr(), FileCreate::FileType::setEnabled(), FileCreate::FileType::setExt(), FileCreate::FileType::setIcon(), FileCreate::FileType::setName(), FileCreate::FileType::setSubtypeRef(), and text(). Referenced by FCConfigWidget::loadGlobalConfig(), FCConfigWidget::loadProjectConfig(), readTypes(), and slotInitialize(). |
|
Refreshes the widget in use - i.e. updates list of filetypes in the widget. Definition at line 158 of file filecreate_part.cpp. References FileCreate::TypeChooser::refresh(), and typeChooserWidget(). Referenced by slotInitialize(), and slotProjectClosed(). |
|
Selects a docked widget.
Definition at line 125 of file filecreate_part.cpp. References m_availableWidgets, m_numWidgets, m_selectedWidget, selectWidget(), and setWidget(). Referenced by selectWidget(), and setShowSideTab(). |
|
Show file creation friendly side tab, yes or no.
Definition at line 427 of file filecreate_part.cpp. References selectWidget(), and setShowSideTab(). Referenced by FCConfigWidget::accept(), setShowSideTab(), and slotInitialize(). |
|
Set the current widget. Argument of null sets no widget. Definition at line 133 of file filecreate_part.cpp. References KDevMainWindow::embedSelectView(), endl(), kdDebug(), kdWarning(), KDevPlugin::mainWindow(), KDevMainWindow::removeView(), setWidget(), FileCreate::TypeChooser::signaller(), slotFiletypeSelected(), and typeChooserWidget(). Referenced by selectWidget(), and setWidget(). |
|
Called when a file type is selected from the docked widget.
Definition at line 188 of file filecreate_part.cpp. References createNewFile(), FileCreate::FileType::ext(), KDevMainWindow::lowerView(), KDevPlugin::mainWindow(), openCreatedFile(), slotFiletypeSelected(), FileCreate::FileType::subtypeRef(), and typeChooserWidgetAsQWidget(). Referenced by setWidget(), and slotFiletypeSelected(). |
|
Definition at line 436 of file filecreate_part.cpp. References addFileType(), endl(), getType(), kdDebug(), m_filetypes, m_useSideTab, KDevPlugin::project(), KDevPlugin::projectDom(), readTypes(), refresh(), FileCreate::FileType::setEnabled(), setShowSideTab(), FileCreate::FileType::setSubtypesEnabled(), and FileCreate::FileType::subtypes(). Referenced by slotProjectOpened(). |
|
Called when a new file is required - for example, from the "New.." menu action.
Definition at line 162 of file filecreate_part.cpp. References createNewFile(), and openCreatedFile(). |
|
Definition at line 431 of file filecreate_part.cpp. References endl(), FileCreate::FileType::ext(), kdDebug(), m_filedialogFiletype, and slotNoteFiletype(). Referenced by slotNoteFiletype(). |
|
Definition at line 183 of file filecreate_part.cpp. References m_filetypes, and refresh(). |
|
Definition at line 167 of file filecreate_part.cpp. References slotInitialize(). Referenced by FCConfigWidget::accept(). |
|
Returns the current type chooser as a TypeChooser* type.
Definition at line 75 of file filecreate_part.h. References m_availableWidgets, m_numWidgets, and m_selectedWidget. Referenced by refresh(), setWidget(), and typeChooserWidgetAsQWidget(). |
|
Returns the current type chooser as a QWidget* type.
Definition at line 83 of file filecreate_part.h. References typeChooserWidget(). Referenced by slotFiletypeSelected(). |
Member Data Documentation
|
Definition at line 175 of file filecreate_part.h. Referenced by ~FileCreatePart(). |
|
List of available chooser widgets.
Definition at line 152 of file filecreate_part.h. Referenced by selectWidget(), typeChooserWidget(), and ~FileCreatePart(). |
|
The file type selected by the new file dialog, if appropriate.
Definition at line 172 of file filecreate_part.h. Referenced by slotNoteFiletype(). |
|
List of file types from which the user can choose.
Definition at line 147 of file filecreate_part.h. Referenced by FCConfigWidget::accept(), addFileType(), createNewFile(), getFileTypes(), slotInitialize(), and slotProjectClosed(). |
|
Number of chooser widgets.
Definition at line 157 of file filecreate_part.h. Referenced by selectWidget(), typeChooserWidget(), and ~FileCreatePart(). |
|
The number (index to m_availableWidgets) of the widget currently in use, or -1 if none.
Definition at line 142 of file filecreate_part.h. Referenced by selectWidget(), and typeChooserWidget(). |
|
Definition at line 174 of file filecreate_part.h. Referenced by FCConfigWidget::accept(), FCConfigWidget::FCConfigWidget(), FCConfigWidget::saveGlobalConfig(), and slotInitialize(). |
The documentation for this class was generated from the following files:
- parts/filecreate/filecreate_part.h
- parts/filecreate/filecreate_part.cpp