KDevelop API Documentation

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 class KPopupMenu;
00027 
00028 namespace FileCreate {
00029   class Widget;
00030   class FileType;
00031 }
00032 
00033 class KDialogBase;
00034 class FCConfigWidget;
00035 class ConfigWidgetProxy;
00036 
00037 using namespace FileCreate;
00038 
00039 class FileCreatePart : public KDevCreateFile
00040 {
00041   Q_OBJECT
00042 
00043   friend class FCConfigWidget;
00044 public:
00045   FileCreatePart(QObject *parent, const char *name, const QStringList &);
00046   virtual ~FileCreatePart();
00047 
00051   QPtrList<FileType> getFileTypes() const { return m_filetypes; }
00052 
00059   virtual KDevCreateFile::CreatedFile createNewFile(QString ext = QString::null,
00060                      QString dir = QString::null,
00061                      QString name = QString::null,
00062                      QString subtype = QString::null);
00063 
00067   void setShowSideTab(bool on);
00068 
00072   void selectWidget(int widgetNumber);
00073 
00077   TypeChooser * typeChooserWidget() const {
00078     return (m_selectedWidget>=0 && m_selectedWidget<m_numWidgets) ?
00079                               m_availableWidgets[m_selectedWidget] : NULL;
00080   }
00081 
00085   QWidget * typeChooserWidgetAsQWidget() const {
00086     TypeChooser * tc = typeChooserWidget();
00087     return tc ? dynamic_cast<QWidget*>(tc) : NULL;
00088   }
00089 
00090 
00095   FileType * getType(const QString & ext, const QString subtype = QString::null);
00101   FileType * getEnabledType(const QString & ext, const QString subtype = QString::null);
00102 
00103 public slots:
00104 
00105   void slotProjectOpened();
00106   void slotProjectClosed();
00107   void slotInitialize();
00108   void slotGlobalInitialize();
00109 
00113   void slotFiletypeSelected(const FileType *);
00114 
00118   void slotNewFile();
00119   
00124   void slotNewFilePopup(int pFileType);
00125 
00126 protected slots:
00127   void slotNoteFiletype(const FileType * filetype);
00128   void slotAboutToShowNewPopupMenu();
00129   void insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int );
00130 
00131 private:
00135   void openCreatedFile(const KDevCreateFile::CreatedFile & createdFile);
00136 
00142   int readTypes(const QDomDocument & dom, QPtrList<FileType> &m_filetypes, bool enable);
00143 
00147   void addFileType(const QString & filename);
00148 
00152   int m_selectedWidget;
00153 
00157   QPtrList<FileType> m_filetypes;
00158 
00162   TypeChooser * m_availableWidgets[2];
00163 
00167   int m_numWidgets;
00168 
00172   bool setWidget(TypeChooser * widget);
00173 
00177   void refresh();
00178 
00182   const FileType * m_filedialogFiletype;
00183 
00184   bool m_useSideTab;
00185   ConfigWidgetProxy * _configProxy;
00186   
00187   KPopupMenu* m_newPopupMenu;
00188   QPtrList<KPopupMenu>* m_subPopups;
00189 };
00190 
00191 
00192 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:57 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003