1 #ifndef __PARTCONTROLLER_H__ 2 #define __PARTCONTROLLER_H__ 4 #include "kdevpartcontroller.h" 7 #include <tqdatetime.h> 11 #include <tqguardedptr.h> 29 namespace Kate {
class Document; }
34 class TDEToolBarPopupAction;
35 class TDERecentFilesAction;
51 static void createInstance(TQWidget *parent);
56 void setEncoding(
const TQString &encoding);
57 void editDocument(
const KURL &inputUrl,
int lineNum=-1,
int col=-1);
58 void splitCurrentDocument(
const KURL &inputUrl,
int lineNum=-1,
int col=-1);
59 void scrollToLineColumn(
const KURL &url,
int lineNum=-1,
int col=-1,
bool storeHistory =
false );
60 void editDocumentInternal(
const KURL &inputUrl,
int lineNum=-1,
int col=-1,
61 bool activate =
true,
bool addToCurrentBuffer =
false );
62 void integrateTextEditorPart(KTextEditor::Document* doc);
64 void showDocument(
const KURL &url,
bool newWin =
false);
65 void showPart( KParts::Part* part,
const TQString& name,
const TQString& shortDescription );
67 KParts::ReadOnlyPart *partForURL(
const KURL &url);
68 KParts::ReadOnlyPart *qtDesignerPart();
69 KParts::Part * partForWidget(
const TQWidget * widget );
71 void activatePart( KParts::Part * part );
72 bool closePart( KParts::Part * part );
74 KURL::List openURLs();
76 bool querySaveFiles();
79 bool saveFiles(
const KURL::List & list);
80 bool saveFile(
const KURL & url,
bool force =
false );
82 void revertAllFiles();
83 void revertFiles(
const KURL::List & list );
86 bool closeFiles(
const KURL::List & list );
88 DocumentState documentState( KURL
const & );
94 bool closeFile(
const KURL & );
95 bool closeAllOthers(
const KURL & );
96 void reloadFile(
const KURL & url );
98 KTextEditor::Editor *openTextDocument(
bool activate =
true );
99 KParts::Factory *findPartFactory(
const TQString &mimeType,
100 const TQString &partType,
101 const TQString &preferredName = TQString() );
105 void slotActivePartChanged( KParts::Part* part );
106 void slotCloseWindow();
107 void slotCloseOtherWindows();
108 void slotCloseAllWindows();
119 void slotWaitForFactoryHack();
121 void slotDocumentUrlChanged();
122 void slotSaveAllFiles();
123 void slotRevertAllFiles();
126 void slotOpenRecent(
const KURL&);
130 void slotBackAboutToShow();
131 void slotForwardAboutToShow();
132 void slotBackPopupActivated(
int id );
133 void slotForwardPopupActivated(
int id );
135 void slotPartAdded( KParts::Part* );
136 void slotPartRemoved( KParts::Part* );
138 void slotUploadFinished();
140 void updateMenuItems();
142 void slotDocumentDirty( Kate::Document * doc,
bool isModified,
unsigned char reason );
143 void slotDocumentDirtyStepTwo(
void * );
144 void slotNewStatus();
145 void slotNewDesignerStatus(
const TQString &formName,
int status);
147 void gotoLastEditPos();
150 KURL findURLInProject(
const KURL& url);
151 KParts::Part* findOpenDocument(
const KURL& url);
155 bool closeFilesDialog( KURL::List
const & ignoreList );
156 bool saveFilesDialog( KURL::List
const & ignoreList );
158 void doEmitState( KURL
const & );
160 KTextEditor::Editor * createEditorPart(
bool activate,
161 bool addToCurrentBuffer =
false,
162 const KURL &url = KURL() );
164 void integratePart(KParts::Part *part,
const KURL &url, TQWidget* widget = 0,
165 bool isTextEditor=
false,
bool activate=
true,
166 bool addToCurrentBuffer =
false );
169 KURL::List modifiedDocuments();
170 void clearModified( KURL::List
const & filelist );
172 bool isDirty( KURL
const & url );
173 bool reactToDirty( KURL
const & url,
unsigned char reason );
175 KURL storedURLForPart( KParts::ReadOnlyPart * );
176 void updatePartURL( KParts::ReadOnlyPart * );
177 bool partURLHasChanged( KParts::ReadOnlyPart * );
181 TDEAction *m_closeWindowAction, *m_saveAllFilesAction, *m_revertAllFilesAction;
182 TDEAction *m_closeAllWindowsAction, *m_closeOtherWindowsAction;
183 TDERecentFilesAction *m_openRecentAction;
184 TQString m_presetEncoding;
186 TDEToolBarPopupAction* m_backAction;
187 TDEToolBarPopupAction* m_forwardAction;
188 TDEAction * m_gotoLastEditPosAction;
190 bool m_openNextAsText;
192 TQValueList<KParts::ReadWritePart*> _dirtyDocuments;
194 TQMap< KParts::ReadOnlyPart*, KURL > _partURLMap;
196 TQGuardedPtr<KParts::Factory> _editorFactory;
201 HistoryEntry(
const KURL & url,
int line,
int col );
209 void addHistoryEntry( KParts::ReadOnlyPart * part = 0 );
210 HistoryEntry createHistoryEntry( KParts::ReadOnlyPart * part = 0 );
211 void jumpTo(
const HistoryEntry & );
213 TQValueList<HistoryEntry> m_backHistory;
214 TQValueList<HistoryEntry> m_forwardHistory;
220 TQPair<unsigned int,unsigned int> pos;
222 LastEditPos() : pos( -1, -1) {}
225 LastEditPos m_lastEditPos;
227 KParts::Part * m_currentActivePart;
228 bool m_removingActivePart;
Part controler implementation.