1 /***************************************************************************
2 * Copyright (C) 2003 by Sébastien Laoût *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program 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 *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
26 #include <qsimplerichtext.h>
33 #include "linklabel.h"
45 namespace KIO
{ class PreviewJob
; }
52 /** A list of numeric identifier for each note type.
53 * Declare a varible with the type NoteType::Id and assign a value like NoteType::Text...
54 * @author S�astien Laot
58 enum Id
{ Group
= 255, Text
= 1, Html
, Image
, Animation
, Sound
, File
, Link
, Launcher
, Color
, Unknown
}; // Always positive
61 /** Abstract base class for every content type of basket note.
62 * It's a base class to represent those types: Text, Html, Image, Animation, Sound, File, Link, Launcher, Color, Unknown.
63 * @author S�astien Laot
65 class NoteContent
// TODO: Mark some methods as const! and some (like typeName() as static!
68 // Constructor and destructor:
69 NoteContent(Note
*parent
, const QString
&fileName
= ""); /// << Constructor. Inherited notes should call it to initialize the parent note.
70 virtual ~NoteContent() {} /// << Virtual destructor. Reimplement it if you should destroy some data your custom types.
71 // Simple Abstract Generic Methods:
72 virtual NoteType::Id
type() = 0; /// << @return the internal number that identify that note type.
73 virtual QString
typeName() = 0; /// << @return the translated type name to display in the user interface.
74 virtual QString
lowerTypeName() = 0; /// << @return the type name in lowercase without space, for eg. saving.
75 virtual QString
toText(const QString
&cuttedFullPath
); /// << @return a plain text equivalent of the content.
76 virtual QString
toHtml(const QString
&imageName
, const QString
&cuttedFullPath
) = 0; /// << @return an HTML text equivalent of the content. @param imageName Save image in this Qt ressource.
77 virtual QPixmap
toPixmap() { return QPixmap(); } /// << @return an image equivalent of the content.
78 virtual void toLink(KURL
*url
, QString
*title
, const QString
&cuttedFullPath
); /// << Set the link to the content. By default, it set them to fullPath() if useFile().
79 virtual bool useFile() = 0; /// << @return true if it use a file to store the content.
80 virtual bool canBeSavedAs() = 0; /// << @return true if the content can be saved as a file by the user.
81 virtual QString
saveAsFilters() = 0; /// << @return the filters for the user to choose a file destination to save the note as.
82 virtual bool match(const FilterData
&data
) = 0; /// << @return true if the content match the filter criterias.
83 // Complexe Abstract Generic Methods:
84 virtual void exportToHTML(HTMLExporter
*exporter
, int indent
) = 0; /// << Export the note in an HTML file.
85 virtual QString
cssClass() = 0; /// << @return the CSS class of the note when exported to HTML
86 virtual int setWidthAndGetHeight(int width
) = 0; /// << Relayout content with @p width (never less than minWidth()). @return its new height.
87 virtual void paint(QPainter
*painter
, int width
, int height
, const QColorGroup
&colorGroup
, bool isDefaultColor
, bool isSelected
, bool isHovered
) = 0; /// << Paint the content on @p painter, at coordinate (0, 0) and with the size (@p width, @p height).
88 virtual bool loadFromFile(bool /*lazyLoad*/) { return false; } /// << Load the content from the file. The default implementation does nothing. @see fileName().
89 virtual bool finishLazyLoad() { return false; } /// << Load what was not loaded by loadFromFile() if it was lazy-loaded
90 virtual bool saveToFile() { return false; } /// << Save the content to the file. The default implementation does nothing. @see fileName().
91 virtual QString
linkAt(const QPoint
&/*pos*/) { return ""; } /// << @return the link anchor at position @p pos or "" if there is no link.
92 virtual void saveToNode(QDomDocument
&doc
, QDomElement
&content
); /// << Save the note in the basket XML file. By default it store the filename if a file is used.
93 virtual void fontChanged() = 0; /// << If your content display textual data, called when the font have changed (from tags or basket font)
94 virtual void linkLookChanged() {} /// << If your content use LinkDisplay with preview enabled, reload the preview (can have changed size)
95 virtual QString
editToolTipText() = 0; /// << @return "Edit this [text|image|...]" to put in the tooltip for the note's content zone.
96 virtual void toolTipInfos(QStringList */
*keys*/
, QStringList */
*values*/
) {} /// << Get "key: value" couples to put in the tooltip for the note's content zone.
97 // Custom Zones: /// Implement this if you want to store custom data.
98 virtual int zoneAt(const QPoint
&/*pos*/) { return 0; } /// << If your note-type have custom zones, @return the zone at @p pos or 0 if it's not a custom zone!
99 virtual QRect
zoneRect(int zone
, const QPoint
&/*pos*/); /// << Idem, @return the rect of the custom zone
100 virtual QString
zoneTip(int /*zone*/) { return ""; } /// << Idem, @return the toolTip of the custom zone
101 virtual void setCursor(QWidget */
*widget*/
, int /*zone*/) {} /// << Idem, set the mouse cursor for widget @p widget when it is over zone @p zone!
102 virtual void setHoveredZone(int /*oldZone*/, int /*newZone*/) {} /// << If your note type need some feedback, you get notified of hovering changes here.
103 virtual QString
statusBarMessage(int /*zone*/) { return ""; } /// << @return the statusBar message to show for zone @p zone, or "" if nothing special have to be said.
104 // Drag and Drop Content:
105 virtual void serialize(QDataStream
&/*stream*/) {} /// << Serialize the content in a QDragObject. If it consists of a file, it can be serialized for you.
106 virtual bool shouldSerializeFile() { return useFile(); } /// << @return true if the dragging process should serialize the filename (and move the file if cutting).
107 virtual void addAlternateDragObjects(KMultipleDrag*/
*dragObj*/
) {} /// << If you offer more than toText/Html/Image/Link(), this will be called if this is the only selected.
108 virtual QPixmap
feedbackPixmap(int width
, int height
) = 0; /// << @return the pixmap to put under the cursor while dragging this object.
109 virtual bool needSpaceForFeedbackPixmap() { return false; } /// << @return true if a space must be inserted before and after the DND feedback pixmap.
111 virtual int xEditorIndent() { return 0; } /// << If the editor should be indented (eg. to not cover an icon), return the number of pixels.
112 // Open Content or File:
113 virtual KURL
urlToOpen(bool /*with*/); /// << @return the URL to open the note, or an invalid KURL if it's not openable. If @p with if false, it's a normal "Open". If it's true, it's for an "Open with..." action. The default implementation return the fullPath() if the note useFile() and nothing if not.
115 OpenOne
, /// << Message to send to the statusbar when opening this note.
116 OpenSeveral
, /// << Message to send to the statusbar when opening several notes of this type.
117 OpenOneWith
, /// << Message to send to the statusbar when doing "Open With..." on this note.
118 OpenSeveralWith
, /// << Message to send to the statusbar when doing "Open With..." several notes of this type.
119 OpenOneWithDialog
, /// << Prompt-message of the "Open With..." dialog for this note.
120 OpenSeveralWithDialog
/// << Prompt-message of the "Open With..." dialog for several notes of this type.
122 virtual QString
messageWhenOpenning(OpenMessage
/*where*/) { return QString(); } /// << @return the message to display according to @p where or nothing if it can't be done. @see OpenMessage describing the nature of the message that should be returned... The default implementation return an empty string. NOTE: If urlToOpen() is invalid and messageWhenOpenning() is not empty, then the user will be prompted to edit the note (with the message returned by messageWhenOpenning()) for eg. being able to edit URL of a link if it's empty when opening it...
123 virtual QString
customOpenCommand() { return QString(); } /// << Reimplement this if your urlToOpen() should be opened with another application instead of the default KDE one. This choice should be left to the users in the setting (choice to use a custom app or not, and which app).
124 // Common File Management: /// (and do save changes) and optionnaly hide the toolbar.
125 virtual void setFileName(const QString
&fileName
); /// << Set the filename. Reimplement it if you eg. want to update the view when the filename is changed.
126 bool trySetFileName(const QString
&fileName
); /// << Set the new filename and return true. Can fail and return false if a file with this fileName already exists.
127 QString
fullPath(); /// << Get the absolute path of the file where this content is stored on disk.
128 QString
fileName() { return m_fileName
; } /// << Get the file name where this content is stored (relative to the basket folder). @see fullPath().
129 int minWidth() { return m_minWidth
; } /// << Get the minimum width for this content.
130 Note
*note() { return m_note
; } /// << Get the note managing this content.
131 Basket
*basket(); /// << Get the basket containing the note managing this content.
133 void setEdited(); /// << Mark the note as edited NOW: change the "last modification time and time" AND save the basket to XML file.
135 void contentChanged(int newMinWidth
); /// << When the content has changed, inherited classes should call this to specify its new minimum size and trigger a basket relayout.
141 static const int FEEDBACK_DARKING
;
144 /** Real implementation of plain text notes:
145 * @author S�astien Laot
147 class TextContent
: public NoteContent
150 // Constructor and destructor:
151 TextContent(Note
*parent
, const QString
&fileName
, bool lazyLoad
= false);
153 // Simple Generic Methods:
156 QString
lowerTypeName();
157 QString
toText(const QString
&/*cuttedFullPath*/);
158 QString
toHtml(const QString
&imageName
, const QString
&cuttedFullPath
);
161 QString
saveAsFilters();
162 bool match(const FilterData
&data
);
163 // Complexe Generic Methods:
164 void exportToHTML(HTMLExporter
*exporter
, int indent
);
166 int setWidthAndGetHeight(int width
);
167 void paint(QPainter
*painter
, int width
, int height
, const QColorGroup
&colorGroup
, bool isDefaultColor
, bool isSelected
, bool isHovered
);
168 bool loadFromFile(bool lazyLoad
);
169 bool finishLazyLoad();
171 QString
linkAt(const QPoint
&pos
);
173 QString
editToolTipText();
174 // Drag and Drop Content:
175 QPixmap
feedbackPixmap(int width
, int height
);
176 // Open Content or File:
177 QString
messageWhenOpenning(OpenMessage where
);
178 // QString customOpenCommand();
179 // Content-Specific Methods:
180 void setText(const QString
&text
, bool lazyLoad
= false); /// << Change the text note-content and relayout the note.
181 QString
text() { return m_text
; } /// << @return the text note-content.
184 QSimpleRichText
*m_simpleRichText
;
187 /** Real implementation of rich text (HTML) notes:
188 * @author S�astien Laot
190 class HtmlContent
: public NoteContent
193 // Constructor and destructor:
194 HtmlContent(Note
*parent
, const QString
&fileName
, bool lazyLoad
= false);
196 // Simple Generic Methods:
199 QString
lowerTypeName();
200 QString
toText(const QString
&/*cuttedFullPath*/);
201 QString
toHtml(const QString
&imageName
, const QString
&cuttedFullPath
);
204 QString
saveAsFilters();
205 bool match(const FilterData
&data
);
206 // Complexe Generic Methods:
207 void exportToHTML(HTMLExporter
*exporter
, int indent
);
209 int setWidthAndGetHeight(int width
);
210 void paint(QPainter
*painter
, int width
, int height
, const QColorGroup
&colorGroup
, bool isDefaultColor
, bool isSelected
, bool isHovered
);
211 bool loadFromFile(bool lazyLoad
);
212 bool finishLazyLoad();
214 QString
linkAt(const QPoint
&pos
);
216 QString
editToolTipText();
217 // Drag and Drop Content:
218 QPixmap
feedbackPixmap(int width
, int height
);
219 // Open Content or File:
220 QString
messageWhenOpenning(OpenMessage where
);
221 QString
customOpenCommand();
222 // Content-Specific Methods:
223 void setHtml(const QString
&html
, bool lazyLoad
= false); /// << Change the HTML note-content and relayout the note.
224 QString
html() { return m_html
; } /// << @return the HTML note-content.
227 QString m_textEquivalent
; //OPTIM_FILTER
228 QSimpleRichText
*m_simpleRichText
;
231 /** Real implementation of image notes:
232 * @author S�astien Laot
234 class ImageContent
: public NoteContent
237 // Constructor and destructor:
238 ImageContent(Note
*parent
, const QString
&fileName
, bool lazyLoad
= false);
239 // Simple Generic Methods:
242 QString
lowerTypeName();
243 QString
toHtml(const QString
&imageName
, const QString
&cuttedFullPath
);
247 QString
saveAsFilters();
248 bool match(const FilterData
&data
);
249 // Complexe Generic Methods:
250 void exportToHTML(HTMLExporter
*exporter
, int indent
);
252 int setWidthAndGetHeight(int width
);
253 void paint(QPainter
*painter
, int width
, int height
, const QColorGroup
&colorGroup
, bool isDefaultColor
, bool isSelected
, bool isHovered
);
254 bool loadFromFile(bool lazyLoad
);
255 bool finishLazyLoad();
258 QString
editToolTipText();
259 void toolTipInfos(QStringList
*keys
, QStringList
*values
);
260 // Drag and Drop Content:
261 QPixmap
feedbackPixmap(int width
, int height
);
262 bool needSpaceForFeedbackPixmap() { return true; }
263 // Open Content or File:
264 QString
messageWhenOpenning(OpenMessage where
);
265 QString
customOpenCommand();
266 // Content-Specific Methods:
267 void setPixmap(const QPixmap
&pixmap
); /// << Change the pixmap note-content and relayout the note.
268 QPixmap
pixmap() { return m_pixmap
; } /// << @return the pixmap note-content.
274 /** Real implementation of animated image (GIF, MNG) notes:
275 * @author S�astien Laot
277 class AnimationContent
: public QObject
, public NoteContent
// QObject to be able to receive QMovie signals
281 // Constructor and destructor:
282 AnimationContent(Note
*parent
, const QString
&fileName
, bool lazyLoad
= false);
283 // Simple Generic Methods:
286 QString
lowerTypeName();
287 QString
toHtml(const QString
&imageName
, const QString
&cuttedFullPath
);
291 QString
saveAsFilters();
292 bool match(const FilterData
&data
);
294 QString
editToolTipText();
295 // Drag and Drop Content:
296 QPixmap
feedbackPixmap(int width
, int height
);
297 bool needSpaceForFeedbackPixmap() { return true; }
298 // Complexe Generic Methods:
299 void exportToHTML(HTMLExporter
*exporter
, int indent
);
301 int setWidthAndGetHeight(int width
);
302 void paint(QPainter
*painter
, int width
, int height
, const QColorGroup
&colorGroup
, bool isDefaultColor
, bool isSelected
, bool isHovered
);
303 bool loadFromFile(bool lazyLoad
);
304 bool finishLazyLoad();
306 // Open Content or File:
307 QString
messageWhenOpenning(OpenMessage where
);
308 QString
customOpenCommand();
309 // Content-Specific Methods:
310 bool setMovie(const QMovie
&movie
); /// << Change the movie note-content and relayout the note.
311 QMovie
movie() { return m_movie
; } /// << @return the movie note-content.
313 void movieUpdated(const QRect
&);
314 void movieResized(const QSize
&);
315 void movieStatus(int status
);
319 static int INVALID_STATUS
;
322 /** Real implementation of file notes:
323 * @author S�astien Laot
325 class FileContent
: public QObject
, public NoteContent
329 // Constructor and destructor:
330 FileContent(Note
*parent
, const QString
&fileName
);
331 // Simple Generic Methods:
334 QString
lowerTypeName();
335 QString
toHtml(const QString
&imageName
, const QString
&cuttedFullPath
);
338 QString
saveAsFilters();
339 bool match(const FilterData
&data
);
340 // Complexe Generic Methods:
341 void exportToHTML(HTMLExporter
*exporter
, int indent
);
343 int setWidthAndGetHeight(int width
);
344 void paint(QPainter
*painter
, int width
, int height
, const QColorGroup
&colorGroup
, bool isDefaultColor
, bool isSelected
, bool isHovered
);
345 bool loadFromFile(bool /*lazyLoad*/);
347 void linkLookChanged();
348 QString
editToolTipText();
349 void toolTipInfos(QStringList
*keys
, QStringList
*values
);
350 // Drag and Drop Content:
351 QPixmap
feedbackPixmap(int width
, int height
);
353 int zoneAt(const QPoint
&pos
);
354 QRect
zoneRect(int zone
, const QPoint
&/*pos*/);
355 QString
zoneTip(int zone
);
356 void setCursor(QWidget
*widget
, int zone
);
359 // Open Content or File:
360 QString
messageWhenOpenning(OpenMessage where
);
361 // Content-Specific Methods:
362 void setFileName(const QString
&fileName
); /// << Reimplemented to be able to relayout the note.
363 virtual LinkLook
* linkLook() { return LinkLook::fileLook
; }
365 LinkDisplay m_linkDisplay
;
366 // File Preview Management:
368 void newPreview(const KFileItem
*, const QPixmap
&preview
);
369 void removePreview(const KFileItem
*);
370 void startFetchingUrlPreview();
372 KIO::PreviewJob
*m_previewJob
;
375 /** Real implementation of sound notes:
376 * @author S�astien Laot
378 class SoundContent
: public FileContent
// A sound is a file with just a bit different user interaction
382 // Constructor and destructor:
383 SoundContent(Note
*parent
, const QString
&fileName
);
384 // Simple Generic Methods:
387 QString
lowerTypeName();
388 QString
toHtml(const QString
&imageName
, const QString
&cuttedFullPath
);
391 QString
saveAsFilters();
392 bool match(const FilterData
&data
);
393 QString
editToolTipText();
394 // Complexe Generic Methods:
397 QString
zoneTip(int zone
);
398 void setHoveredZone(int oldZone
, int newZone
);
399 // Open Content or File:
400 QString
messageWhenOpenning(OpenMessage where
);
401 QString
customOpenCommand();
402 // Content-Specific Methods:
403 LinkLook
* linkLook() { return LinkLook::soundLook
; }
406 /** Real implementation of link notes:
407 * @author S�astien Laot
409 class LinkContent
: public QObject
, public NoteContent
413 // Constructor and destructor:
414 LinkContent(Note
*parent
, const KURL
&url
, const QString
&title
, const QString
&icon
, bool autoTitle
, bool autoIcon
);
416 // Simple Generic Methods:
419 QString
lowerTypeName();
420 QString
toText(const QString
&/*cuttedFullPath*/);
421 QString
toHtml(const QString
&imageName
, const QString
&cuttedFullPath
);
422 void toLink(KURL
*url
, QString
*title
, const QString
&cuttedFullPath
);
425 QString
saveAsFilters();
426 bool match(const FilterData
&data
);
427 // Complexe Generic Methods:
428 void exportToHTML(HTMLExporter
*exporter
, int indent
);
430 int setWidthAndGetHeight(int width
);
431 void paint(QPainter
*painter
, int width
, int height
, const QColorGroup
&colorGroup
, bool isDefaultColor
, bool isSelected
, bool isHovered
);
432 void saveToNode(QDomDocument
&doc
, QDomElement
&content
);
434 void linkLookChanged();
435 QString
editToolTipText();
436 void toolTipInfos(QStringList
*keys
, QStringList
*values
);
437 // Drag and Drop Content:
438 void serialize(QDataStream
&stream
);
439 QPixmap
feedbackPixmap(int width
, int height
);
441 int zoneAt(const QPoint
&pos
);
442 QRect
zoneRect(int zone
, const QPoint
&/*pos*/);
443 QString
zoneTip(int zone
);
444 void setCursor(QWidget
*widget
, int zone
);
445 QString
statusBarMessage(int zone
);
446 // Open Content or File:
447 KURL
urlToOpen(bool /*with*/);
448 QString
messageWhenOpenning(OpenMessage where
);
449 // Content-Specific Methods:
450 void setLink(const KURL
&url
, const QString
&title
, const QString
&icon
, bool autoTitle
, bool autoIcon
); /// << Change the link and relayout the note.
451 KURL
url() { return m_url
; } /// << @return the URL of the link note-content.
452 QString
title() { return m_title
; } /// << @return the displayed title of the link note-content.
453 QString
icon() { return m_icon
; } /// << @return the displayed icon of the link note-content.
454 bool autoTitle() { return m_autoTitle
; } /// << @return if the title is auto-computed from the URL.
455 bool autoIcon() { return m_autoIcon
; } /// << @return if the icon is auto-computed from the URL.
456 void startFetchingLinkTitle();
463 LinkDisplay m_linkDisplay
;
466 // File Preview Management:
468 void httpDone(bool err
);
469 void httpReadyRead(const QHttpResponseHeader
& resp
);
470 void newPreview(const KFileItem
*, const QPixmap
&preview
);
471 void removePreview(const KFileItem
*);
472 void startFetchingUrlPreview();
474 KIO::PreviewJob
*m_previewJob
;
477 /** Real implementation of launcher notes:
478 * @author S�astien Laot
480 class LauncherContent
: public NoteContent
483 // Constructor and destructor:
484 LauncherContent(Note
*parent
, const QString
&fileName
);
485 // Simple Generic Methods:
488 QString
lowerTypeName();
489 QString
toHtml(const QString
&imageName
, const QString
&cuttedFullPath
);
490 void toLink(KURL
*url
, QString
*title
, const QString
&cuttedFullPath
);
493 QString
saveAsFilters();
494 bool match(const FilterData
&data
);
495 // Complexe Generic Methods:
496 void exportToHTML(HTMLExporter
*exporter
, int indent
);
498 int setWidthAndGetHeight(int width
);
499 void paint(QPainter
*painter
, int width
, int height
, const QColorGroup
&colorGroup
, bool isDefaultColor
, bool isSelected
, bool isHovered
);
500 bool loadFromFile(bool /*lazyLoad*/);
502 QString
editToolTipText();
503 void toolTipInfos(QStringList
*keys
, QStringList
*values
);
504 // Drag and Drop Content:
505 QPixmap
feedbackPixmap(int width
, int height
);
507 int zoneAt(const QPoint
&pos
);
508 QRect
zoneRect(int zone
, const QPoint
&/*pos*/);
509 QString
zoneTip(int zone
);
510 void setCursor(QWidget
*widget
, int zone
);
511 // Open Content or File:
512 KURL
urlToOpen(bool with
);
513 QString
messageWhenOpenning(OpenMessage where
);
514 // Content-Specific Methods:
515 void setLauncher(const QString
&name
, const QString
&icon
, const QString
&exec
); /// << Change the launcher note-content and relayout the note. Normally called by loadFromFile (no save done).
516 QString
name() { return m_name
; } /// << @return the URL of the launcher note-content.
517 QString
icon() { return m_icon
; } /// << @return the displayed icon of the launcher note-content.
518 QString
exec() { return m_exec
; } /// << @return the execute command line of the launcher note-content.
519 // TODO: KService *service() ??? And store everything in thta service ?
521 QString m_name
; // TODO: Store them in linkDisplay to gain place (idem for Link notes)
524 LinkDisplay m_linkDisplay
;
527 /** Real implementation of color notes:
528 * @author S�astien Laot
530 class ColorContent
: public NoteContent
533 // Constructor and destructor:
534 ColorContent(Note
*parent
, const QColor
&color
);
535 // Simple Generic Methods:
538 QString
lowerTypeName();
539 QString
toText(const QString
&/*cuttedFullPath*/);
540 QString
toHtml(const QString
&imageName
, const QString
&cuttedFullPath
);
543 QString
saveAsFilters();
544 bool match(const FilterData
&data
);
545 // Complexe Generic Methods:
546 void exportToHTML(HTMLExporter
*exporter
, int indent
);
548 int setWidthAndGetHeight(int width
);
549 void paint(QPainter
*painter
, int width
, int height
, const QColorGroup
&colorGroup
, bool isDefaultColor
, bool isSelected
, bool isHovered
);
550 void saveToNode(QDomDocument
&doc
, QDomElement
&content
);
552 QString
editToolTipText();
553 void toolTipInfos(QStringList
*keys
, QStringList
*values
);
554 // Drag and Drop Content:
555 void serialize(QDataStream
&stream
);
556 QPixmap
feedbackPixmap(int width
, int height
);
557 bool needSpaceForFeedbackPixmap() { return true; }
558 void addAlternateDragObjects(KMultipleDrag
*dragObject
);
559 // Content-Specific Methods:
560 void setColor(const QColor
&color
); /// << Change the color note-content and relayout the note.
561 QColor
color() { return m_color
; } /// << @return the color note-content.
564 static const int RECT_MARGIN
;
567 /** Real implementation of unknown MIME-types dropped notes:
568 * @author S�astien Laot
570 class UnknownContent
: public NoteContent
573 // Constructor and destructor:
574 UnknownContent(Note
*parent
, const QString
&fileName
);
575 // Simple Generic Methods:
578 QString
lowerTypeName();
579 QString
toText(const QString
&/*cuttedFullPath*/);
580 QString
toHtml(const QString
&imageName
, const QString
&cuttedFullPath
);
581 void toLink(KURL
*url
, QString
*title
, const QString
&cuttedFullPath
);
584 QString
saveAsFilters();
585 bool match(const FilterData
&data
);
586 // Complexe Generic Methods:
587 void exportToHTML(HTMLExporter
*exporter
, int indent
);
589 int setWidthAndGetHeight(int width
);
590 void paint(QPainter
*painter
, int width
, int height
, const QColorGroup
&colorGroup
, bool isDefaultColor
, bool isSelected
, bool isHovered
);
591 bool loadFromFile(bool /*lazyLoad*/);
593 QString
editToolTipText();
594 // Drag and Drop Content:
595 bool shouldSerializeFile() { return false; }
596 void addAlternateDragObjects(KMultipleDrag
*dragObject
);
597 QPixmap
feedbackPixmap(int width
, int height
);
598 bool needSpaceForFeedbackPixmap() { return true; }
599 // Open Content or File:
600 KURL
urlToOpen(bool /*with*/) { return KURL(); }
601 // Content-Specific Methods:
602 QString
mimeTypes() { return m_mimeTypes
; } /// << @return the list of MIME types this note-content contains.
605 static const int DECORATION_MARGIN
;
608 void NoteFactory__loadNode(const QDomElement
&content
, const QString
&lowerTypeName
, Note
*parent
, bool lazyLoad
);
610 #endif // NOTECONTENT_H