kate Library API Documentation

katemainwindow.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
00003    Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
00004    Copyright (C) 2001 Anders Lund <anders.lund@lund.tdcadsl.dk>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License version 2 as published by the Free Software Foundation.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef __KATE_MAINWINDOW_H__
00022 #define __KATE_MAINWINDOW_H__
00023 
00024 #include "katemain.h"
00025 #include "../interfaces/mainwindow.h"
00026 #include "../interfaces/toolviewmanager.h"
00027 
00028 #include "kateviewmanager.h"
00029 #include "kateprojectmanager.h"
00030 
00031 #include <kate/view.h>
00032 #include <kate/document.h>
00033 
00034 #include <kparts/part.h>
00035 #include <kparts/dockmainwindow.h>
00036 #include <kmdi/mainwindow.h>
00037 
00038 #include <qguardedptr.h>
00039 
00040 #include <scriptmanager.h>
00041 #include <kaction.h>
00042 
00043 class GrepTool;
00044 
00045 class KFileItem;
00046 class KRecentFilesAction;
00047 class DCOPObject;
00048 
00049 class KateExternalToolsMenuAction;
00050 class KateProjectList;
00051 class KateProjectViews;
00052 
00053 class KateMainWindow : public KMDI::MainWindow, virtual public KParts::PartBase
00054 {
00055   Q_OBJECT
00056 
00057   friend class KateConfigDialog;
00058   friend class KateViewManager;
00059 
00060   public:
00061     KateMainWindow ();
00062     ~KateMainWindow();
00063 
00067   public:
00068     Kate::MainWindow *mainWindow () { return m_mainWindow; }
00069     Kate::ViewManager *viewManager () {return m_viewManager->viewManager(); }
00070     Kate::ToolViewManager *toolViewManager () { return m_toolViewManager; }
00071 
00072     KateViewManager *kateViewManager () { return m_viewManager; }
00073 
00074     DCOPObject *dcopObject () { return m_dcop; }
00075 
00079   public:
00080     KMDI::ToolViewAccessor *addToolView(KDockWidget::DockPosition position, QWidget *widget, const QPixmap &icon, const QString &sname, const QString &tabToolTip = 0, const QString &tabCaption = 0);
00081 
00082     bool removeToolView(QWidget *);
00083     bool removeToolView(KMDI::ToolViewAccessor *);
00084 
00085     bool showToolView(QWidget *);
00086     bool showToolView(KMDI::ToolViewAccessor *);
00087 
00088     bool hideToolView(QWidget *);
00089     bool hideToolView(KMDI::ToolViewAccessor *);
00090 
00094   public:
00099     Kate::Project *activeProject () { return m_project; }
00100 
00108     Kate::Project *createProject (const QString &type, const QString &name, const QString &filename);
00109 
00114     Kate::Project *openProject (const QString &filename);
00115 
00120     void activateProject (Kate::Project *project);
00121 
00125   public:
00128     KURL activeDocumentUrl();
00129 
00130     uint mainWindowNumber () const { return myID; }
00131 
00139     bool showModOnDiskPrompt();
00140 
00141   public:
00142     void readProperties(KConfig *config);
00143     void saveProperties(KConfig *config);
00144     void saveGlobalProperties( KConfig* sessionConfig );
00145 
00146   private:
00147     void setupMainWindow();
00148     void setupActions();
00149     void setupScripts();
00150     bool queryClose();
00151     bool queryClose_internal();
00152 
00153     void readOptions(KConfig *);
00154     void saveOptions(KConfig *);
00155 
00156     void dragEnterEvent( QDragEnterEvent * );
00157     void dropEvent( QDropEvent * );
00158 
00163   private slots:
00164     void newWindow ();
00165 
00166     void slotConfigure();
00167 
00168     void slotOpenWithMenuAction(int idx);
00169 
00170     void slotPipeToConsole ();
00171 
00172     void slotGrepToolItemSelected ( const QString &filename, int linenumber );
00173     void runScript( int menuItemId);
00174     void slotMail();
00175 
00176     void slotFileQuit();
00177     void slotEditToolbars();
00178     void slotWindowActivated ();
00179     void slotUpdateOpenWith();
00180     void documentMenuAboutToShow();
00181     void slotDropEvent(QDropEvent *);
00182     void editKeys();
00183     void mSlotFixOpenWithMenu();
00184 
00185     void fileSelected(const KFileItem *file);
00186 
00187     void tipOfTheDay();
00188 
00189     /* to update the caption */
00190     void slotDocumentCreated (Kate::Document *doc);
00191     void updateCaption (Kate::Document *doc);
00192 
00193     void pluginHelp ();
00194     void slotFullScreen(bool);
00195 
00196   public:
00197     void openURL (const QString &name=0L);
00198 
00199   protected:
00200     bool eventFilter( QObject*, QEvent * );
00201     bool event( QEvent * );
00202 
00203   // slots for the project GUI actions: new/open/save/close
00204   public slots:
00205     void slotProjectNew ();
00206     void slotProjectOpen ();
00207     void slotProjectSave ();
00208     void slotProjectClose ();
00209 
00210     // recent files
00211     void openConstURLProject (const KURL&);
00212 
00213   private slots:
00214     void projectDeleted (uint projectNumber);
00215     void slotDocumentCloseAll();
00216 
00217   private:
00218     static uint uniqueID;
00219     uint myID;
00220 
00221     Kate::MainWindow *m_mainWindow;
00222     Kate::ToolViewManager *m_toolViewManager;
00223 
00224     bool syncKonsole;
00225     bool modNotification;
00226 
00227     DCOPObject *m_dcop;
00228 
00229     // console
00230     KateConsole *console;
00231 
00232     // management items
00233     KateViewManager *m_viewManager;
00234 
00235     KRecentFilesAction *fileOpenRecent;
00236 
00237     KateFileList *filelist;
00238     KateProjectList *projectlist;
00239     KateProjectViews *projectviews;
00240     KateFileSelector *fileselector;
00241 
00242     QGuardedPtr<Kate::Project> m_project;
00243     uint m_projectNumber;
00244 
00245     KAction *saveProject;
00246     KAction *closeProject;
00247     KRecentFilesAction *recentProjects;
00248 
00249     KActionMenu* documentOpenWith;
00250 
00251     QPopupMenu *documentMenu;
00252 
00253     KToggleAction* settingsShowFilelist;
00254     KToggleAction* settingsShowFileselector;
00255     KToggleAction* showFullScreenAction;
00256 
00257     KAction* settingsConfigure;
00258 
00259     KActionMenu *scriptMenu;
00260     KScriptManager* kscript;
00261 
00262     KateExternalToolsMenuAction *externalTools;
00263     GrepTool * greptool;
00264     bool m_modignore, m_grrr;
00265 };
00266 
00267 #endif
00268 // kate: space-indent on; indent-width 2; replace-tabs on;
00269 
00270 
KDE Logo
This file is part of the documentation for kate Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jun 14 19:05:33 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003