summaryrefslogtreecommitdiffstats
path: root/kxmleditor/kxmleditorshell.h
blob: b5f47e0f8b6a26b6bbf0fc2639413e3570bdcc52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/***************************************************************************
                          kxmleditorshell.h  -  description
                             -------------------
    begin                : Thu Oct 18 2001
    copyright            : (C) 2001, 2002, 2003 by The KXMLEditor Team
    email                : lvanek@users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
 /**
 @file
 */


#ifndef KXMLEDITORSHELL_H
#define KXMLEDITORSHELL_H

#include <tdeparts/mainwindow.h>

class KParts::ReadWritePart;
class KXMLEditorShellIface;
class TDEAction;
class KXEShellManager;


/**
	@short The shell, which can contain our #KXMLEditorPart.

	It is the window that owns main user interface elements.
*/
class KXMLEditorShell : public KParts::MainWindow
{
	Q_OBJECT
	public:
		/** @short Constructor

		Creates shell and adds it into one global instance of KXEShellManager.
		@sa KXEShellManager
		*/
		KXMLEditorShell( const char * name = 0L, WFlags f = WDestructiveClose );

		/** @short Destructor

                Destroys shell. Performs also removing given shell from global instance
		of KXEShellManager.
		*/
		virtual ~KXMLEditorShell();

		/** @short Opens new file and shows it in the current shell. */
		bool openURL( const KURL & url ) ;

		/** @short Closes this shell. */
		virtual void close();

                /** @short Returns part manager object */
		KXEShellManager* manager();

		/** @short Creates new part which can be shown in the shell.
			@param parent parent object for the part*/
		static KParts::ReadWritePart* createXMLPart(TQObject *parent) ;

		static KParts::ReadWritePart* createPart(TQObject *parent, const TQString& libName, const TQString& className);

		/** @short Changes currenly shown part. */
		void setPart(KParts::ReadWritePart* pPart);

	public slots:
		/** @short Slot connected to File->New action. */
		void slotActFileNew();

		/** @short Slot connected to File->Open action. */
		void slotFileOpen();

		void slotFileOpenRecent( const KURL & url );

		/** @short Slot connected to File->Reload action. */
		void slotFileReload();

		/** @short Slot connected to action responsible for showing and hiding main toolbar.*/
		void slotToggleMainToolBar();

		/** @short Slot connected to action responsible for showing and hiding status bar.*/
		void slotToggleStatusBar();

                /** @short Slot connected to action. Shows shortcut configuration dialog.*/
		void slotConfigureKeys();

		/** @short Slot connected to action. Shows toolbar configuration dialog.*/
		void slotConfigureToolbars();

		/** @short Changes shell caption.*/
		virtual void setCaption( const TQString & strCaption );

		/** @short Sends currently opened XML file over e-mail.

		The application will try to start default mail client and prepare
		new empty mail with currently opened file as an attachment.
		The file have to be saved first on a disc.
			@sa TDEApplication::invokeMailer()
		*/
		void mail();

		/** @short Connected to File->Close action

                Closes currently opened file, but not the shell itself. The shell
		remaines empty but active, so it's possible for the user
		to open another file in it.*/
		void slotActClose();

		/** @short slot connected to Window->Close action.
			@sa close()	*/
		void slotActWindowClose();

		/** @short slot connected to Window->Close All action. */
		void slotActWindowCloseAll();

		/** @short slot connected to Window->Close All Others action. */
    void slotActWindowCloseAllOthers();
    
		void slotActivate();

	protected:
		virtual bool queryClose();
		virtual void saveProperties( TDEConfig * );
		virtual void readProperties( TDEConfig * );

		/** @short Stores pointer to currenly shown part. */
		KParts::ReadWritePart * m_pPart;

		/** @short Action for recently opened files. */
		TDERecentFilesAction * m_pActFileOpenRecent;

		/** @short Action for reloading the document currently open. */
		TDEAction * m_pActReload;

		/** @short Action for printing complete XML files.*/
		// L.V. moved to part. TDEAction* pActPrint;

		TDEAction* pActCloseW;
		TDEAction* pActCloseAllW;
		TDEAction* pActCloseAllO;

		/** @short DCOP interface pointer (if no such iface pointer == 0).*/
		KXMLEditorShellIface * m_pKXEShellIface;

		/** @short Stores pointer to window menu.

		 This menu is expanded everytime new shell is shown. */
		TDEPopupMenu* m_windowMenu;

		/** @short Returns currently shown part. */
		KParts::ReadWritePart* part() const {return m_pPart;}

		/** @short Adds this shell window to part manager for monitoring */
//		void addToManager();

	protected slots:
		/** To enable/disable actions, the way the parts browser extension wishes. */
		void slotEnableBrowserExtActions( const char * pszName, bool bEnabled );
    
		void slotBeforeWindowMenuShown();
		
		// Add URL to recent file list
		void slotAddRecentURL(const KURL &);

	private:
		/** @short Stores pointer to global instance of #KParts::PartManager */
		static KXEShellManager *s_manager;
};

#endif