kateprojectmanager.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 2002 Christoph Cullmann <cullmann@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef __KATE_PROJECTMANAGER_H__ 00020 #define __KATE_PROJECTMANAGER_H__ 00021 00022 #include "katemain.h" 00023 #include "../interfaces/project.h" 00024 #include "../interfaces/projectmanager.h" 00025 00026 #include <qobject.h> 00027 #include <qvaluelist.h> 00028 #include <qptrlist.h> 00029 #include <qstringlist.h> 00030 #include <ktrader.h> 00031 #include <qguardedptr.h> 00032 #include <kdialogbase.h> 00033 00034 class KComboBox; 00035 class KLineEdit; 00036 class KURLRequester; 00037 00038 class KateInternalProjectData 00039 { 00040 public: 00041 class KateProjectManager *proMan; 00042 QString fileName; 00043 }; 00044 00045 class ProjectPluginInfo 00046 { 00047 public: 00048 KService::Ptr service; 00049 QString projectType; 00050 }; 00051 00052 class ProjectInfo 00053 { 00054 public: 00055 QString type; 00056 QString name; 00057 QString fileName; 00058 }; 00059 00060 typedef QPtrList<ProjectPluginInfo> ProjectPluginList; 00061 00062 class KateProjectManager : public QObject 00063 { 00064 Q_OBJECT 00065 00066 public: 00067 KateProjectManager(QObject *parent); 00068 ~KateProjectManager(); 00069 00070 static KateProjectManager *self (); 00071 00072 Kate::ProjectManager *projectManager ()const { return m_projectManager; }; 00073 00074 Kate::Project *create (const QString &type, const QString &name, const QString &filename); 00075 00076 Kate::Project *open (const QString &filename); 00077 00078 bool close (Kate::Project *project, bool force = false); 00079 00080 Kate::Project *project (uint n = 0); 00081 00082 uint projects (); 00083 00084 Kate::ProjectPlugin *createPlugin (Kate::Project *project); 00085 00086 void enableProjectGUI (Kate::Project *project, class KateMainWindow *win); 00087 void disableProjectGUI (Kate::Project *project, class KateMainWindow *win); 00088 00089 ProjectInfo *newProjectDialog (QWidget *parent); 00090 00091 QStringList pluginStringList (); 00092 00093 void setCurrentProject (Kate::Project *project); 00094 00095 bool queryCloseAll (); 00096 bool closeAll (); 00097 00098 void saveProjectList (class KConfig *config); 00099 void restoreProjectList (class KConfig *config); 00100 00101 private: 00102 Kate::ProjectManager *m_projectManager; 00103 00104 void setupPluginList (); 00105 00106 ProjectPluginList m_pluginList; 00107 00108 // INTERNAL USE OF KateProject !!! 00109 QPtrList<Kate::Project> m_projects; 00110 QGuardedPtr<Kate::Project> m_currentProject; 00111 }; 00112 00113 class KateProjectDialogNew : public KDialogBase 00114 { 00115 Q_OBJECT 00116 public: 00117 KateProjectDialogNew (QWidget *parent); 00118 ~KateProjectDialogNew (); 00119 00120 int exec(); 00121 00122 private slots: 00123 void slotTextChanged(); 00124 00125 private: 00126 KComboBox *m_typeCombo; 00127 KLineEdit *m_nameEdit; 00128 KURLRequester *m_urlRequester; 00129 00130 public: 00131 QString type; 00132 QString name; 00133 QString fileName; 00134 }; 00135 00136 #endif