• 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 
30 class TDEInstance;
31 class TQWidget;
32 class TDEAction;
33 class TDEActionCollection;
34 class TQEvent;
35 struct QUnknownInterface;
36 
37 namespace TDEIO {
38  class Job;
39 }
40 
41 namespace KParts
42 {
43 
44 class PartManager;
45 class Plugin;
46 class PartPrivate;
47 class PartActivateEvent;
48 class PartSelectEvent;
49 class GUIActivateEvent;
50 class PartBasePrivate;
51 
57 class TDEPARTS_EXPORT PartBase : virtual public KXMLGUIClient
58 {
59  friend class PartBasePrivate;
60 public:
61 
65  PartBase();
66 
70  virtual ~PartBase();
71 
77  void setPartObject( TQObject *object );
78  TQObject *partObject() const;
79 
80 protected:
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 
151 private:
152  PartBasePrivate *d;
153  TQObject *m_obj;
154 };
155 
181 class TDEPARTS_EXPORT Part : public TQObject, public PartBase
182 {
183  Q_OBJECT
184 
185 public:
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 
249 signals:
254  void setWindowCaption( const TQString & caption );
259  void setStatusBarText( const TQString & text );
260 
261 protected:
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 
304 private slots:
305  void slotWidgetDestroyed();
306 
307 private:
308  TQGuardedPtr<TQWidget> m_widget;
309 
310  PartManager * m_manager;
311 
312  PartPrivate *d;
313 };
314 
315 class ReadWritePart;
316 class ReadOnlyPartPrivate;
317 
338 class TDEPARTS_EXPORT ReadOnlyPart : public Part
339 {
340  Q_OBJECT
341  friend class ReadWritePart;
342 public:
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 
373 public slots:
382  virtual bool openURL( const KURL &url );
383 
384 public:
390  KURL url() const { return m_url; }
391 
400  virtual bool closeURL();
401 
402 public:
413  bool openStream( const TQString& mimeType, const KURL& url );
414 
421  bool writeStream( const TQByteArray& data );
422 
428  bool closeStream();
429 
430 private: // 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 
452 signals:
458  void started( TDEIO::Job * );
459 
465  void completed();
466 
476  void completed( bool pendingAction );
477 
482  void canceled( const TQString &errMsg );
483 
484 protected slots:
485  void slotJobFinished( TDEIO::Job * job );
486 
487 protected:
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 
525 private:
526  ReadOnlyPartPrivate *d;
527 };
528 
544 class TDEPARTS_EXPORT ReadWritePart : public ReadOnlyPart
545 {
546  Q_OBJECT
547 public:
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 
630 signals:
638  void sigQueryClose(bool *handled, bool* abortClosing);
639 
640 public slots:
646  virtual void setModified();
647 
653  virtual bool save();
654 
659  bool waitSaveComplete();
660 
661 protected:
673  virtual bool saveFile() = 0;
674 
683  virtual bool saveToURL();
684 
685 protected slots:
689  void slotUploadFinished( TDEIO::Job * job );
690 
691 private:
692  void prepareSaving();
693 
694 private:
695  bool m_bModified;
696  bool m_bReadWrite;
697  bool m_bClosing;
698 };
699 
700 } // namespace
701 
702 #endif
KURL
KParts::ReadOnlyPart::m_url
KURL m_url
Remote (or local) url - the one displayed to the user.
Definition: part.h:515
KXMLGUIClient
KParts::ReadWritePart::isModified
bool isModified() const
Definition: part.h:577
KParts::PartActivateEvent
This event is sent by the part manager when the active part changes.
Definition: event.h:76
KParts::ReadOnlyPart::m_file
TQString m_file
Local file - the only one the part implementation should deal with.
Definition: part.h:519
KParts::Part
Base class for parts.
Definition: part.h:181
TDEIO
Definition: part.h:37
TDEActionCollection
TDEAction
KParts::ReadWritePart
Base class for an "editor" part.
Definition: part.h:544
KParts::PartBase
Base class for all parts.
Definition: part.h:57
KParts::ReadOnlyPart::url
KURL url() const
Returns the currently in part used URL.
Definition: part.h:390
KParts::GUIActivateEvent
This event is sent to a Part when its GUI has been activated or deactivated.
Definition: event.h:54
KParts::PartBase::PluginLoadingMode
PluginLoadingMode
We have three different policies, whether to load new plugins or not.
Definition: part.h:102
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::ReadWritePart::isReadWrite
bool isReadWrite() const
Definition: part.h:566
KParts::PartManager
The part manager is an object which knows about a collection of parts (even nested ones) and handles ...
Definition: partmanager.h:49
KParts
Definition: browserextension.cpp:64
TDEInstance
KParts::PartSelectEvent
This event is sent when a part is selected or deselected.
Definition: event.h:99
KParts::ReadOnlyPart
Base class for any "viewer" part.
Definition: part.h:338

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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeparts by doxygen 1.8.8
This website is maintained by Timothy Pearson.