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

tdeparts

  • KParts
  • ReadWritePart
Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
KParts::ReadWritePart Class Referenceabstract

#include <part.h>

Inheritance diagram for KParts::ReadWritePart:
KParts::ReadOnlyPart KParts::Part KParts::PartBase KXMLGUIClient

Public Slots

virtual void setModified ()
 
virtual bool save ()
 
bool waitSaveComplete ()
 
- Public Slots inherited from KParts::ReadOnlyPart
virtual bool openURL (const KURL &url)
 

Signals

void sigQueryClose (bool *handled, bool *abortClosing)
 
- Signals inherited from KParts::ReadOnlyPart
void started (TDEIO::Job *)
 
void completed ()
 
void completed (bool pendingAction)
 
void canceled (const TQString &errMsg)
 
- Signals inherited from KParts::Part
void setWindowCaption (const TQString &caption)
 
void setStatusBarText (const TQString &text)
 

Public Member Functions

 ReadWritePart (TQObject *parent=0, const char *name=0)
 
virtual ~ReadWritePart ()
 
bool isReadWrite () const
 
virtual void setReadWrite (bool readwrite=true)
 
bool isModified () const
 
bool queryClose ()
 
virtual bool closeURL ()
 
bool closeURL (bool promptToSave)
 
virtual bool saveAs (const KURL &url)
 
virtual void setModified (bool modified)
 
- Public Member Functions inherited from KParts::ReadOnlyPart
 ReadOnlyPart (TQObject *parent=0, const char *name=0)
 
virtual ~ReadOnlyPart ()
 
void setProgressInfoEnabled (bool show)
 
bool isProgressInfoEnabled () const
 
void showProgressInfo (bool show)
 
KURL url () const
 
virtual bool closeURL ()
 
bool openStream (const TQString &mimeType, const KURL &url)
 
bool writeStream (const TQByteArray &data)
 
bool closeStream ()
 
- Public Member Functions inherited from KParts::Part
 Part (TQObject *parent=0, const char *name=0)
 
virtual ~Part ()
 
virtual void embed (TQWidget *parentWidget)
 
virtual TQWidget * widget ()
 
virtual void setManager (PartManager *manager)
 
PartManager * manager () const
 
virtual Part * hitTest (TQWidget *widget, const TQPoint &globalPos)
 
virtual void setSelectable (bool selectable)
 
bool isSelectable () const
 
- Public Member Functions inherited from KParts::PartBase
 PartBase ()
 
virtual ~PartBase ()
 
void setPartObject (TQObject *object)
 
TQObject * partObject () const
 
- Public Member Functions inherited from KXMLGUIClient
 KXMLGUIClient (KXMLGUIClient *parent)
 
TDEAction * action (const char *name) const
 
virtual TDEAction * action (const TQDomElement &element) const
 
virtual TDEActionCollection * actionCollection () const
 
virtual TDEInstance * instance () const
 
virtual TQDomDocument domDocument () const
 
virtual TQString xmlFile () const
 
void setXMLGUIBuildDocument (const TQDomDocument &doc)
 
TQDomDocument xmlguiBuildDocument () const
 
void setFactory (KXMLGUIFactory *factory)
 
KXMLGUIFactory * factory () const
 
KXMLGUIClient * parentClient () const
 
void insertChildClient (KXMLGUIClient *child)
 
void removeChildClient (KXMLGUIClient *child)
 
const TQPtrList< KXMLGUIClient > * childClients ()
 
void setClientBuilder (KXMLGUIBuilder *builder)
 
KXMLGUIBuilder * clientBuilder () const
 
void reloadXML ()
 
void plugActionList (const TQString &name, const TQPtrList< TDEAction > &actionList)
 
void unplugActionList (const TQString &name)
 
void beginXMLPlug (TQWidget *)
 
void endXMLPlug ()
 
void prepareXMLUnplug (TQWidget *)
 

Protected Slots

void slotUploadFinished (TDEIO::Job *job)
 
- Protected Slots inherited from KParts::ReadOnlyPart
void slotJobFinished (TDEIO::Job *job)
 

Protected Member Functions

virtual bool saveFile ()=0
 
virtual bool saveToURL ()
 
- Protected Member Functions inherited from KParts::ReadOnlyPart
virtual bool openFile ()=0
 
void abortLoad ()
 
virtual void guiActivateEvent (GUIActivateEvent *event)
 
- Protected Member Functions inherited from KParts::Part
virtual void setWidget (TQWidget *widget)
 
virtual void customEvent (TQCustomEvent *event)
 
virtual void partActivateEvent (PartActivateEvent *event)
 
virtual void partSelectEvent (PartSelectEvent *event)
 
virtual void guiActivateEvent (GUIActivateEvent *event)
 
TQWidget * hostContainer (const TQString &containerName)
 
- Protected Member Functions inherited from KParts::PartBase
virtual void setInstance (TDEInstance *instance)
 
virtual void setInstance (TDEInstance *instance, bool loadPlugins)
 
void loadPlugins (TQObject *parent, KXMLGUIClient *parentGUIClient, TDEInstance *instance)
 
void setPluginLoadingMode (PluginLoadingMode loadingMode)
 
- Protected Member Functions inherited from KXMLGUIClient
virtual void setInstance (TDEInstance *instance)
 
virtual void setXMLFile (const TQString &file, bool merge=false, bool setXMLDoc=true)
 
virtual void setXML (const TQString &document, bool merge=false)
 
virtual void setDOMDocument (const TQDomDocument &document, bool merge=false)
 
virtual void conserveMemory ()
 
virtual void stateChanged (const TQString &newstate, ReverseStateChange reverse=StateNoReverse)
 

Additional Inherited Members

- Protected Types inherited from KParts::PartBase
enum  PluginLoadingMode { DoNotLoadPlugins = 0 , LoadPlugins = 1 , LoadPluginsIfEnabled = 2 }
 
- Protected Attributes inherited from KParts::ReadOnlyPart
KURL m_url
 
TQString m_file
 
bool m_bTemp
 

Detailed Description

Base class for an "editor" part.

This class handles network transparency for you. Anything that can open a URL, allow modifications, and save (to the same URL or a different one).

A read-write part can be set to read-only mode, using setReadWrite().

Part writers : Any part inheriting ReadWritePart should check isReadWrite() before allowing any action that modifies the part. The part probably wants to reimplement setReadWrite, disable those actions. Don't forget to call the parent setReadWrite().

Definition at line 544 of file part.h.

Constructor & Destructor Documentation

◆ ReadWritePart()

ReadWritePart::ReadWritePart ( TQObject *  parent = 0,
const char *  name = 0 
)

Constructor.

See parent constructor for instructions.

Definition at line 447 of file part.cpp.

◆ ~ReadWritePart()

ReadWritePart::~ReadWritePart ( )
virtual

Destructor.

Applications using a ReadWritePart should make sure, before destroying it, to call closeURL(). In TDEMainWindow::queryClose(), for instance, they should allow closing only if the return value of closeURL() was true. This allows to cancel.

Definition at line 453 of file part.cpp.

Member Function Documentation

◆ closeURL() [1/2]

bool ReadWritePart::closeURL ( )
virtual

Called when closing the current url (e.g.

document), for instance when switching to another url (note that openURL() calls it automatically in this case).

If the current URL is not fully loaded yet, aborts loading.

If isModified(), queryClose() will be called.

Returns
false on cancel

Reimplemented from KParts::ReadOnlyPart.

Definition at line 525 of file part.cpp.

◆ closeURL() [2/2]

bool ReadWritePart::closeURL ( bool  promptToSave)

Call this method instead of the above if you need control if the save prompt is shown.

For example, if you call queryClose() from TDEMainWindow::queryClose(), you would not want to prompt again when closing the url.

Equivalent to promptToSave ? closeURL() : ReadOnlyPart::closeURL()

Since
3.2

Definition at line 537 of file part.cpp.

◆ isModified()

bool KParts::ReadWritePart::isModified ( ) const
inline
Returns
true if the document has been modified.

Definition at line 577 of file part.h.

◆ isReadWrite()

bool KParts::ReadWritePart::isReadWrite ( ) const
inline
Returns
true if the part is in read-write mode

Definition at line 566 of file part.h.

◆ queryClose()

bool ReadWritePart::queryClose ( )

If the document has been modified, ask the user to save changes.

This method is meant to be called from TDEMainWindow::queryClose(). It will also be called from closeURL().

Returns
true if closeURL() can be called without the user losing important data, false if the user chooses to cancel.
Since
3.2

Definition at line 483 of file part.cpp.

◆ save

bool ReadWritePart::save ( )
virtualslot

Save the file in the location from which it was opened.

You can connect this to the "save" action. Calls saveFile() and saveToURL(), no need to reimplement.

Definition at line 542 of file part.cpp.

◆ saveAs()

bool ReadWritePart::saveAs ( const KURL &  url)
virtual

Save the file to a new location.

Calls save(), no need to reimplement

Definition at line 554 of file part.cpp.

◆ saveFile()

virtual bool KParts::ReadWritePart::saveFile ( )
protectedpure virtual

Save to a local file.

You need to implement it, to save to m_file. The framework takes care of re-uploading afterwards.

Returns
true on success, false on failure. On failure the function should inform the user about the problem with an appropriate message box. Standard error messages can be constructed using TDEIO::buildErrorString() in combination with the error codes defined in tdeio/global.h

◆ saveToURL()

bool ReadWritePart::saveToURL ( )
protectedvirtual

Save the file.

Uploads the file, if m_url is remote. This will emit started(), and either completed() or canceled(), in case you want to provide feedback.

Returns
true on success, false on failure.

Definition at line 607 of file part.cpp.

◆ setModified [1/2]

void ReadWritePart::setModified ( )
virtualslot

Call setModified() whenever the contents get modified.

This is a slot for convenience, so that you can connect it to a signal, like textChanged().

Definition at line 478 of file part.cpp.

◆ setModified() [2/2]

void ReadWritePart::setModified ( bool  modified)
virtual

Sets the modified flag of the part.

Definition at line 467 of file part.cpp.

◆ setReadWrite()

void ReadWritePart::setReadWrite ( bool  readwrite = true)
virtual

Changes the behavior of this part to readonly or readwrite.

Parameters
readwriteset to true to enable readwrite mode

Definition at line 461 of file part.cpp.

◆ sigQueryClose

void KParts::ReadWritePart::sigQueryClose ( bool *  handled,
bool *  abortClosing 
)
signal
Since
3.2, remove in KDE 4, when queryClose is made virtual

set handled to true, if you don't want the default handling set abortClosing to true, if you handled the request, but for any reason don't want to allow closing the document

◆ slotUploadFinished

void ReadWritePart::slotUploadFinished ( TDEIO::Job *  job)
protectedslot

Definition at line 647 of file part.cpp.

◆ waitSaveComplete

bool ReadWritePart::waitSaveComplete ( )
slot

Waits for any pending upload job to finish and returns whether the last save() action was successful.

Definition at line 685 of file part.cpp.


The documentation for this class was generated from the following files:
  • part.h
  • part.cpp

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.