KDevelop API Documentation

parts/filecreate/filecreate_part.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * Copyright (C) 2003 by Julian Rockey * 00003 * linux@jrockey.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 ***************************************************************************/ 00010 00011 00012 00013 #ifndef __KDEVPART_FILECREATE_H__ 00014 #define __KDEVPART_FILECREATE_H__ 00015 00016 00017 #include <qguardedptr.h> 00018 #include <qptrlist.h> 00019 00020 #include <qwidget.h> 00021 #include <kdevplugin.h> 00022 #include <kdevcreatefile.h> 00023 00024 #include "filecreate_typechooser.h" 00025 00026 namespace FileCreate { 00027 class Widget; 00028 class FileType; 00029 } 00030 00031 class KDialogBase; 00032 class FCConfigWidget; 00033 class ConfigWidgetProxy; 00034 00035 using namespace FileCreate; 00036 00037 class FileCreatePart : public KDevCreateFile 00038 { 00039 Q_OBJECT 00040 00041 friend class FCConfigWidget; 00042 public: 00043 FileCreatePart(QObject *parent, const char *name, const QStringList &); 00044 virtual ~FileCreatePart(); 00045 00049 QPtrList<FileType> getFileTypes() const { return m_filetypes; } 00050 00057 virtual KDevCreateFile::CreatedFile createNewFile(QString ext = QString::null, 00058 QString dir = QString::null, 00059 QString name = QString::null, 00060 QString subtype = QString::null); 00061 00065 void setShowSideTab(bool on); 00066 00070 void selectWidget(int widgetNumber); 00071 00075 TypeChooser * typeChooserWidget() const { 00076 return (m_selectedWidget>=0 && m_selectedWidget<m_numWidgets) ? 00077 m_availableWidgets[m_selectedWidget] : NULL; 00078 } 00079 00083 QWidget * typeChooserWidgetAsQWidget() const { 00084 TypeChooser * tc = typeChooserWidget(); 00085 return tc ? dynamic_cast<QWidget*>(tc) : NULL; 00086 } 00087 00088 00093 FileType * getType(const QString & ext, const QString subtype = QString::null); 00099 FileType * getEnabledType(const QString & ext, const QString subtype = QString::null); 00100 00101 public slots: 00102 00103 void slotProjectOpened(); 00104 void slotProjectClosed(); 00105 void slotInitialize(); 00106 00110 void slotFiletypeSelected(const FileType *); 00111 00115 void slotNewFile(); 00116 00117 protected slots: 00118 void slotNoteFiletype(const FileType * filetype); 00119 void insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int ); 00120 00121 private: 00125 void openCreatedFile(const KDevCreateFile::CreatedFile & createdFile); 00126 00132 int readTypes(const QDomDocument & dom, QPtrList<FileType> &m_filetypes, bool enable); 00133 00137 void addFileType(const QString & filename); 00138 00142 int m_selectedWidget; 00143 00147 QPtrList<FileType> m_filetypes; 00148 00152 TypeChooser * m_availableWidgets[2]; 00153 00157 int m_numWidgets; 00158 00162 bool setWidget(TypeChooser * widget); 00163 00167 void refresh(); 00168 00172 const FileType * m_filedialogFiletype; 00173 00174 bool m_useSideTab; 00175 ConfigWidgetProxy * _configProxy; 00176 }; 00177 00178 00179 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:01:51 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003