• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeparts
 

tdeparts

  • tdeparts
part.h
1/* This file is part of the KDE project
2 Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
3 (C) 1999 David Faure <faure@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20#ifndef _KPART_H
21#define _KPART_H
22
23#include <tqstring.h>
24#include <tqdom.h>
25#include <tqguardedptr.h>
26#include <kurl.h>
27
28#include <kxmlguiclient.h>
29
30class TDEInstance;
31class TQWidget;
32class TDEAction;
33class TDEActionCollection;
34class TQEvent;
35struct QUnknownInterface;
36
37namespace TDEIO {
38 class Job;
39}
40
41namespace KParts
42{
43
44class PartManager;
45class Plugin;
46class PartPrivate;
47class PartActivateEvent;
48class PartSelectEvent;
49class GUIActivateEvent;
50class PartBasePrivate;
51
57class TDEPARTS_EXPORT PartBase : virtual public KXMLGUIClient
58{
59 friend class PartBasePrivate;
60public:
61
65 PartBase();
66
70 virtual ~PartBase();
71
77 void setPartObject( TQObject *object );
78 TQObject *partObject() const;
79
80protected:
87 virtual void setInstance( TDEInstance *instance );
88
95 virtual void setInstance( TDEInstance *instance, bool loadPlugins );
96
102 enum PluginLoadingMode {
106 DoNotLoadPlugins = 0,
113 LoadPlugins = 1,
120 LoadPluginsIfEnabled = 2
121 };
122
143 void loadPlugins( TQObject *parent, KXMLGUIClient *parentGUIClient, TDEInstance *instance );
144
149 void setPluginLoadingMode( PluginLoadingMode loadingMode );
150
151private:
152 PartBasePrivate *d;
153 TQObject *m_obj;
154};
155
181class TDEPARTS_EXPORT Part : public TQObject, public PartBase
182{
183 TQ_OBJECT
184
185public:
186
193 Part( TQObject *parent = 0, const char* name = 0 );
194
198 virtual ~Part();
199
211 virtual void embed( TQWidget * parentWidget );
212
216 virtual TQWidget *widget();
217
222 virtual void setManager( PartManager * manager );
223
227 PartManager * manager() const;
228
237 virtual Part *hitTest( TQWidget *widget, const TQPoint &globalPos );
238
242 virtual void setSelectable( bool selectable );
243
247 bool isSelectable() const;
248
249signals:
254 void setWindowCaption( const TQString & caption );
259 void setStatusBarText( const TQString & text );
260
261protected:
262
268 virtual void setWidget( TQWidget * widget );
269
273 virtual void customEvent( TQCustomEvent *event );
274
280 virtual void partActivateEvent( PartActivateEvent *event );
281
288 virtual void partSelectEvent( PartSelectEvent *event );
289
296 virtual void guiActivateEvent( GUIActivateEvent *event );
297
302 TQWidget *hostContainer( const TQString &containerName );
303
304private slots:
305 void slotWidgetDestroyed();
306
307private:
308 TQGuardedPtr<TQWidget> m_widget;
309
310 PartManager * m_manager;
311
312 PartPrivate *d;
313};
314
315class ReadWritePart;
316class ReadOnlyPartPrivate;
317
338class TDEPARTS_EXPORT ReadOnlyPart : public Part
339{
340 TQ_OBJECT
341 friend class ReadWritePart;
342public:
347 ReadOnlyPart( TQObject *parent = 0, const char *name = 0 );
348
352 virtual ~ReadOnlyPart();
353
361 void setProgressInfoEnabled( bool show );
362
367 bool isProgressInfoEnabled() const;
368
369#ifndef KDE_NO_COMPAT
370 void showProgressInfo( bool show );
371#endif
372
373public slots:
382 virtual bool openURL( const KURL &url );
383
384public:
390 KURL url() const { return m_url; }
391
400 virtual bool closeURL();
401
402public:
413 bool openStream( const TQString& mimeType, const KURL& url );
414
421 bool writeStream( const TQByteArray& data );
422
428 bool closeStream();
429
430private: // Makes no sense for inherited classes to call those. But make it protected there.
431
437 virtual bool doOpenStream( const TQString& /*mimeType*/ ) { return false; }
444 virtual bool doWriteStream( const TQByteArray& /*data*/ ) { return false; }
450 virtual bool doCloseStream() { return false; }
451
452signals:
458 void started( TDEIO::Job * );
459
465 void completed();
466
476 void completed( bool pendingAction );
477
482 void canceled( const TQString &errMsg );
483
484protected slots:
485 void slotJobFinished( TDEIO::Job * job );
486
487protected:
493 virtual bool openFile() = 0;
494
498 void abortLoad();
499
510 virtual void guiActivateEvent( GUIActivateEvent *event );
511
515 KURL m_url;
519 TQString m_file;
523 bool m_bTemp;
524
525private:
526 ReadOnlyPartPrivate *d;
527};
528
544class TDEPARTS_EXPORT ReadWritePart : public ReadOnlyPart
545{
546 TQ_OBJECT
547public:
552 ReadWritePart( TQObject *parent = 0, const char *name = 0 );
561 virtual ~ReadWritePart();
562
566 bool isReadWrite() const { return m_bReadWrite; }
567
572 virtual void setReadWrite ( bool readwrite = true );
573
577 bool isModified() const { return m_bModified; }
578
589 // TODO: Make virtual for KDE 4
590 bool queryClose();
591
603 virtual bool closeURL();
604
615 // TODO: Make virtual for KDE 4
616 bool closeURL( bool promptToSave );
617
623 virtual bool saveAs( const KURL &url );
624
628 virtual void setModified( bool modified );
629
630signals:
638 void sigQueryClose(bool *handled, bool* abortClosing);
639
640public slots:
646 virtual void setModified();
647
653 virtual bool save();
654
659 bool waitSaveComplete();
660
661protected:
673 virtual bool saveFile() = 0;
674
683 virtual bool saveToURL();
684
685protected slots:
689 void slotUploadFinished( TDEIO::Job * job );
690
691private:
692 void prepareSaving();
693
694private:
695 bool m_bModified;
696 bool m_bReadWrite;
697 bool m_bClosing;
698};
699
700} // namespace
701
702#endif
KParts::GUIActivateEvent
This event is sent to a Part when its GUI has been activated or deactivated.
Definition: event.h:55
KParts::PartActivateEvent
This event is sent by the part manager when the active part changes.
Definition: event.h:77
KParts::PartBase
Base class for all parts.
Definition: part.h:58
KParts::PartBase::PluginLoadingMode
PluginLoadingMode
We have three different policies, whether to load new plugins or not.
Definition: part.h:102
KParts::PartManager
The part manager is an object which knows about a collection of parts (even nested ones) and handles ...
Definition: partmanager.h:50
KParts::PartSelectEvent
This event is sent when a part is selected or deselected.
Definition: event.h:100
KParts::Part
Base class for parts.
Definition: part.h:182
KParts::Part::setWindowCaption
void setWindowCaption(const TQString &caption)
Emitted by the part, to set the caption of the window(s) hosting this part.
KParts::Part::setStatusBarText
void setStatusBarText(const TQString &text)
Emited by the part, to set a text in the statusbar of the window(s) hosting this part.
KParts::ReadOnlyPart
Base class for any "viewer" part.
Definition: part.h:339
KParts::ReadOnlyPart::completed
void completed(bool pendingAction)
Same as the above signal except it indicates whether there is a pending action to be executed on a de...
KParts::ReadOnlyPart::m_bTemp
bool m_bTemp
If true, m_file is a temporary file that needs to be deleted later.
Definition: part.h:523
KParts::ReadOnlyPart::canceled
void canceled(const TQString &errMsg)
Emit this if loading is canceled by the user or by an error.
KParts::ReadOnlyPart::completed
void completed()
Emit this when you have completed loading data.
KParts::ReadOnlyPart::m_file
TQString m_file
Local file - the only one the part implementation should deal with.
Definition: part.h:519
KParts::ReadOnlyPart::m_url
KURL m_url
Remote (or local) url - the one displayed to the user.
Definition: part.h:515
KParts::ReadOnlyPart::started
void started(TDEIO::Job *)
The part emits this when starting data.
KParts::ReadOnlyPart::openFile
virtual bool openFile()=0
If the part uses the standard implementation of openURL(), it must reimplement this,...
KParts::ReadOnlyPart::url
KURL url() const
Returns the currently in part used URL.
Definition: part.h:390
KParts::ReadWritePart
Base class for an "editor" part.
Definition: part.h:545
KParts::ReadWritePart::saveFile
virtual bool saveFile()=0
Save to a local file.
KParts::ReadWritePart::isModified
bool isModified() const
Definition: part.h:577
KParts::ReadWritePart::isReadWrite
bool isReadWrite() const
Definition: part.h:566
KParts::ReadWritePart::sigQueryClose
void sigQueryClose(bool *handled, bool *abortClosing)
KURL
KXMLGUIClient
TDEActionCollection
TDEAction
TDEInstance

tdeparts

Skip menu "tdeparts"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeparts

Skip menu "tdeparts"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeparts by doxygen 1.9.4
This website is maintained by Timothy Pearson.