/usr/include/kdevplatform/sublime/document.h is in kdevelop-dev 4:5.2.1-1ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /***************************************************************************
* Copyright 2006-2007 Alexander Dymo <adymo@kdevelop.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef KDEVPLATFORM_SUBLIMEDOCUMENT_H
#define KDEVPLATFORM_SUBLIMEDOCUMENT_H
#include <QObject>
#include <QList>
#include "sublimeexport.h"
class QIcon;
class QWidget;
namespace Sublime {
class Area;
class View;
class Controller;
/**
@short Abstract base class for all Sublime documents
Subclass from Document and implement createViewWidget() method
to return a new widget for a view.
*/
class KDEVPLATFORMSUBLIME_EXPORT Document: public QObject {
Q_OBJECT
public:
/**Creates a document and adds it to a @p controller.*/
Document(const QString &title, Controller *controller);
~Document() override;
/**@return the new view for this document.
@note it will not create a widget, just return a view object.*/
View *createView();
/**@return the list of all views in all areas for this document.*/
const QList<View*> &views() const;
/**@return the controller for this document.*/
Controller *controller() const;
enum TitleType { Normal, Extended};
/**@return the document title.*/
virtual QString title(TitleType type = Normal) const;
/**Set the document title.*/
void setTitle(const QString& newTitle);
void setToolTip(const QString& newToolTip);
QString toolTip() const;
/**@return the type of document which can be written to config.*/
virtual QString documentType() const = 0;
/**@return the specifics of this document which can be written to config.*/
virtual QString documentSpecifier() const = 0;
/**
* If the document is in a state where data may be lost while closking,
* asks the user whether he really wants to close the document.
*
* This function may also take actions like saving the document before closing
* if the user desires so.
*
* @return true if the document is allowed to be closed, otherwise false.
*
* The default implementation always returns true.
*
* */
virtual bool askForCloseFeedback();
/**Should try closing the document, eventually asking the user for feedback.
*
*If closing is successful, all views should be deleted, and the document itself
*be scheduled for deletion using deleteLater().
*
* @param silent If this is true, the user must not be asked.
*
* Returns whether closing was successful (The user did not push 'Cancel') */
virtual bool closeDocument(bool silent = false);
void setStatusIcon(QIcon icon);
/**
* @return The status icon of the document.
*/
QIcon statusIcon() const;
/**
* @return The status icon of the document, or, if none is present, an icon
* that resembles the document, i.e. based on its mime type.
* @see defaultIcon()
*/
QIcon icon() const;
/**
* Optionally override this to return a default icon when no status
* icon is set for the document. The default returns an invalid icon.
*/
virtual QIcon defaultIcon() const;
Q_SIGNALS:
/**Emitted when the document is about to be deleted but is still in valid state.*/
void aboutToDelete(Sublime::Document *doc);
/**Emitted when the document's title is changed.*/
void titleChanged(Sublime::Document *doc);
/**Emitted when the document status-icon has changed */
void statusIconChanged(Sublime::Document *doc);
protected:
/**Creates and returns the new view. Reimplement in subclasses to instantiate
views of derived from Sublime::View classes.*/
virtual View *newView(Document *doc);
/**Reimplement this to create and return the new widget to display
this document in the view. This method is used by View class when it
is asked for its widget.*/
virtual QWidget *createViewWidget(QWidget *parent = nullptr) = 0;
/** Closes all views associated to this document */
virtual void closeViews();
private:
const QScopedPointer<class DocumentPrivate> d;
friend class DocumentPrivate;
friend class View;
};
}
#endif
|