kwritemain.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., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef __KWRITE_MAIN_H__ 00022 #define __KWRITE_MAIN_H__ 00023 00024 #include <tdetexteditor/view.h> 00025 #include <tdetexteditor/document.h> 00026 00027 #include <tdeparts/mainwindow.h> 00028 00029 #include <kdialogbase.h> 00030 00031 namespace KTextEditor { class EditorChooser; } 00032 00033 class TDEAction; 00034 class TDEToggleAction; 00035 class TDESelectAction; 00036 class TDERecentFilesAction; 00037 00038 class KWrite : public KParts::MainWindow 00039 { 00040 Q_OBJECT 00041 00042 00043 public: 00044 KWrite(KTextEditor::Document * = 0L); 00045 ~KWrite(); 00046 00047 void loadURL(const KURL &url); 00048 00049 KTextEditor::View *view() const { return m_view; } 00050 00051 static bool noWindows () { return winList.isEmpty(); } 00052 00053 private: 00054 void setupActions(); 00055 void setupStatusBar(); 00056 00057 bool queryClose(); 00058 00059 void dragEnterEvent( TQDragEnterEvent * ); 00060 void dropEvent( TQDropEvent * ); 00061 00062 public slots: 00063 void slotNew(); 00064 void slotFlush (); 00065 void slotOpen(); 00066 void slotOpen( const KURL& url); 00067 void newView(); 00068 void toggleStatusBar(); 00069 void editKeys(); 00070 void editToolbars(); 00071 void changeEditor(); 00072 00073 private slots: 00074 void slotNewToolbarConfig(); 00075 00076 public slots: 00077 void printNow(); 00078 void printDlg(); 00079 00080 void newStatus(const TQString &msg); 00081 void newCaption(); 00082 00083 void slotDropEvent(TQDropEvent *); 00084 00085 void slotEnableActions( bool enable ); 00086 00090 void slotFileNameChanged(); 00091 00092 //config file functions 00093 public: 00094 void readConfig (TDEConfig *); 00095 void writeConfig (TDEConfig *); 00096 00097 void readConfig (); 00098 void writeConfig (); 00099 00100 //session management 00101 public: 00102 void restore(TDEConfig *,int); 00103 static void restore(); 00104 00105 private: 00106 void readProperties(TDEConfig *); 00107 void saveProperties(TDEConfig *); 00108 void saveGlobalProperties(TDEConfig *); 00109 00110 private: 00111 KTextEditor::View * m_view; 00112 00113 TDERecentFilesAction * m_recentFiles; 00114 TDEToggleAction * m_paShowPath; 00115 TDEToggleAction * m_paShowStatusBar; 00116 00117 TQString encoding; 00118 00119 static TQPtrList<KTextEditor::Document> docList; 00120 static TQPtrList<KWrite> winList; 00121 }; 00122 00123 class KWriteEditorChooser: public KDialogBase 00124 { 00125 Q_OBJECT 00126 00127 00128 public: 00129 KWriteEditorChooser(TQWidget *parent); 00130 virtual ~KWriteEditorChooser(); 00131 00132 private: 00133 KTextEditor::EditorChooser *m_chooser; 00134 00135 protected slots: 00136 void slotOk(); 00137 }; 00138 00139 #endif 00140 // kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off;