Commit aaee832b authored by Kelvie Wong's avatar Kelvie Wong
Browse files

Deprecate and remove the Text-based notes.

These are completely replaced by the more flexible HTML-based notes; it
hasn't been possible to create (easily) a text note, anyways.  The
conversion mechanism also has been removed.

This was done so that the TextContent and related classes/methods no longer
need to be maintained.
parent 13ea673f
......@@ -729,8 +729,6 @@ void Basket::loadNotes(const QDomElement &notes, Note *parent)
if (e.tagName() == "note" || e.tagName() == "item") { // Keep compatible with 0.6.0 Alpha 1
note = new Note(this); // Create the note...
NoteFactory__loadNode(XMLWork::getElement(e, "content"), e.attribute("type"), note, /*lazyLoad=*/m_finishLoadOnFirstShow); // ... Populate it with content...
if (e.attribute("type") == "text")
m_shouldConvertPlainTextNotes = true; // Convert Pre-0.6.0 baskets: plain text notes should be converted to rich text ones once all is loaded!
appendNoteIn(note, parent); // ... And insert it.
// Load dates:
if (e.hasAttribute("added"))
......@@ -1204,7 +1202,6 @@ void Basket::load()
if (notes.isNull())
notes = XMLWork::getElement(docElem, "items");
m_watcher->stopScan();
m_shouldConvertPlainTextNotes = false; // Convert Pre-0.6.0 baskets: plain text notes should be converted to rich text ones once all is loaded!
// StopWatch::check(0);
// StopWatch::start(1);
......@@ -1213,8 +1210,6 @@ void Basket::load()
// StopWatch::check(1);
// StopWatch::start(2);
if (m_shouldConvertPlainTextNotes)
convertTexts();
m_watcher->startScan();
//loadNotes(XMLWork::getElement(docElem, "notes"), 0L);
//END
......@@ -4432,24 +4427,6 @@ Note* Basket::lastSelected()
return last;
}
bool Basket::convertTexts()
{
m_watcher->stopScan();
bool convertedNotes = false;
if (!isLoaded())
load();
FOR_EACH_NOTE (note)
if (note->convertTexts())
convertedNotes = true;
if (convertedNotes)
save();
m_watcher->startScan();
return convertedNotes;
}
void Basket::noteGroup()
{
/* // Nothing to do?
......
......@@ -314,7 +314,6 @@ class Basket : public Q3ScrollView
bool m_loaded;
bool m_loadingLaunched;
bool m_locked;
bool m_shouldConvertPlainTextNotes;
Q3Frame* m_decryptBox;
QPushButton* m_button;
int m_encryptionType;
......@@ -647,8 +646,6 @@ public slots:
/// REIMPLEMENTED:
public:
void deleteFiles();
bool convertTexts();
public:
void wheelEvent(QWheelEvent *event);
......
......@@ -402,15 +402,6 @@ void BNPView::setupGlobalShortcuts()
a->setStatusTip(
i18n("Grab a screen zone as an image in the current basket without "
"having to open the main window."));
#if 0
a = ac->addAction("global_note_add_text", Global::bnpView,
SLOT(addNoteText()));
a->setText(i18n("Insert plain text note"));
a->setStatusTip(
i18n("Add a plain text note to the current basket without having to "
"open the main window."));
#endif
}
void BNPView::initialize()
......@@ -656,14 +647,6 @@ void BNPView::setupActions()
connect( insertEmptyMapper, SIGNAL(mapped(int)), this, SLOT(insertEmpty(int)) );
connect( insertWizardMapper, SIGNAL(mapped(int)), this, SLOT(insertWizard(int)) );
#if 0
a = ac->addAction("insert_text");
a->setText(i18n("Plai&n Text"));
a->setIcon(KIcon("text"));
a->setShortcut(KShortcut("Ctrl+T"));
m_actInsertText = a;
#endif
a = ac->addAction("insert_html");
a->setText(i18n("&Text"));
a->setIcon(KIcon("html"));
......@@ -706,13 +689,11 @@ void BNPView::setupActions()
a->setIcon(KIcon("document-import"));
m_actLoadFile = a;
// connect( m_actInsertText, SIGNAL(activated()), insertEmptyMapper, SLOT(map()) );
connect( m_actInsertHtml, SIGNAL(activated()), insertEmptyMapper, SLOT(map()) );
connect( m_actInsertImage, SIGNAL(activated()), insertEmptyMapper, SLOT(map()) );
connect( m_actInsertLink, SIGNAL(activated()), insertEmptyMapper, SLOT(map()) );
connect( m_actInsertColor, SIGNAL(activated()), insertEmptyMapper, SLOT(map()) );
connect( m_actInsertLauncher, SIGNAL(activated()), insertEmptyMapper, SLOT(map()) );
// insertEmptyMapper->setMapping(m_actInsertText, NoteType::Text );
insertEmptyMapper->setMapping(m_actInsertHtml, NoteType::Html );
insertEmptyMapper->setMapping(m_actInsertImage, NoteType::Image );
insertEmptyMapper->setMapping(m_actInsertLink, NoteType::Link );
......@@ -746,7 +727,6 @@ void BNPView::setupActions()
//connect( m_actGrabScreenshot, SIGNAL(regionGrabbed(const QPixmap&)), this, SLOT(screenshotGrabbed(const QPixmap&)) );
//connect( m_colorPicker, SIGNAL(canceledPick()), this, SLOT(colorPickingCanceled()) );
// m_insertActions.append( m_actInsertText );
m_insertActions.append( m_actInsertHtml );
m_insertActions.append( m_actInsertLink );
m_insertActions.append( m_actInsertImage );
......@@ -878,14 +858,6 @@ void BNPView::setupActions()
a->setShortcut(KShortcut("Alt+Right"));
m_actExpandBasket = a;
#if 0
// FOR_BETA_PURPOSE:
a = ac->addAction("beta_convert_texts", this, SLOT(convertTexts()));
a->setText(i18n("Convert text notes to rich text notes"));
a->setIcon(KIcon("run-build-file"));
m_convertTexts = a;
#endif
InlineEditors::instance()->initToolBars(actionCollection());
/** Help : ****************************************************************/
......@@ -1208,35 +1180,6 @@ void BNPView::closeAllEditors()
}
}
bool BNPView::convertTexts()
{
bool convertedNotes = false;
KProgressDialog dialog(
/*parent=*/0,
/*caption=*/i18n("Plain Text Notes Conversion"),
/*text=*/i18n("Converting plain text notes to rich text ones...")
);
dialog.setModal(true);
dialog.progressBar()->setRange(0, basketCount());
dialog.show(); //setMinimumDuration(50/*ms*/);
Q3ListViewItemIterator it(m_tree);
while (it.current()) {
BasketListViewItem *item = (BasketListViewItem*)(it.current());
if (item->basket()->convertTexts())
convertedNotes = true;
QProgressBar *pb = dialog.progressBar();
pb->setValue(pb->value() + 1);
if (dialog.wasCancelled())
break;
++it;
}
return convertedNotes;
}
void BNPView::toggleFilterAllBaskets(bool doFilter)
{
// Set the state:
......@@ -1740,39 +1683,6 @@ void BNPView::colorPickingCanceled()
showMainWindow();
}
void BNPView::slotConvertTexts()
{
/*
int result = KMessageBox::questionYesNoCancel(
this,
i18n(
"<p>This will convert every text notes into rich text notes.<br>"
"The content of the notes will not change and you will be able to apply formating to those notes.</p>"
"<p>This process cannot be reverted back: you will not be able to convert the rich text notes to plain text ones later.</p>"
"<p>As a beta-tester, you are strongly encouraged to do the convert process because it is to test if plain text notes are still needed.<br>"
"If nobody complain about not having plain text notes anymore, then the final version is likely to not support plain text notes anymore.</p>"
"<p><b>Which basket notes do you want to convert?</b></p>"
),
i18n("Convert Text Notes"),
KGuiItem(i18n("Only in the Current Basket")),
KGuiItem(i18n("In Every Baskets"))
);
if (result == KMessageBox::Cancel)
return;
*/
bool conversionsDone;
// if (result == KMessageBox::Yes)
// conversionsDone = currentBasket()->convertTexts();
// else
conversionsDone = convertTexts();
if (conversionsDone)
KMessageBox::information(this, i18n("The plain text notes have been converted to rich text."), i18n("Conversion Finished"));
else
KMessageBox::information(this, i18n("There are no plain text notes to convert."), i18n("Conversion Finished"));
}
KMenu* BNPView::popupMenu(const QString &menuName)
{
KMenu *menu = 0;
......@@ -2307,7 +2217,6 @@ void BNPView::showPassiveLoading(Basket *basket)
m_passivePopup->show();
}
void BNPView::addNoteText() { showMainWindow(); currentBasket()->insertEmptyNote(NoteType::Text); }
void BNPView::addNoteHtml() { showMainWindow(); currentBasket()->insertEmptyNote(NoteType::Html); }
void BNPView::addNoteImage() { showMainWindow(); currentBasket()->insertEmptyNote(NoteType::Image); }
void BNPView::addNoteLink() { showMainWindow(); currentBasket()->insertEmptyNote(NoteType::Link); }
......
......@@ -97,7 +97,6 @@ class BASKET_EXPORT BNPView : public QSplitter
public slots:
void countsChanged(Basket *basket);
void notesStateChanged();
bool convertTexts();
void updateBasketListViewItem(Basket *basket);
void save();
......@@ -151,10 +150,8 @@ class BASKET_EXPORT BNPView : public QSplitter
void slotColorFromScreenGlobal();
void colorPicked(const QColor &color);
void colorPickingCanceled();
void slotConvertTexts();
/** Global shortcuts */
void addNoteText();
void addNoteHtml();
void addNoteImage();
void addNoteLink();
......@@ -276,7 +273,6 @@ class BASKET_EXPORT BNPView : public QSplitter
KAction *m_actNextBasket;
KAction *m_actFoldBasket;
KAction *m_actExpandBasket;
// KAction *m_convertTexts; // FOR_BETA_PURPOSE
void setupActions();
void setupGlobalShortcuts();
......
......@@ -2773,22 +2773,3 @@ bool Note::saveAgain()
}
return true;
}
bool Note::convertTexts()
{
bool convertedNotes = false;
if (content() && content()->lowerTypeName() == "text") {
QString text = ((TextContent*)content())->text();
QString html = "<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>" + Tools::textToHTMLWithoutP(text) + "</body></html>";
basket()->saveToFile(fullPath(), html, /*isLocalEncoding=*/true);
setContent( new HtmlContent(this, content()->fileName()) );
convertedNotes = true;
}
FOR_EACH_CHILD (child)
if (child->convertTexts())
convertedNotes = true;
return convertedNotes;
}
......@@ -45,7 +45,6 @@ class Q3SimpleRichText;
* as constructor parameter to transform it to a note with content. eg:
* @code
* Note *note = new Note(basket); // note is a group!
* new TextContent(note, fileName); // note is now a note with a text content!
* new ColorContent(note, Qt::red); // Should never be done!!!!! the old Content should be deleted...
* @endcode
* @author Sébastien Laoût
......@@ -331,8 +330,6 @@ class Note
int distanceOnLeftRight(Note *note, int side);
int distanceOnTopBottom(Note *note, int side);
bool convertTexts();
void debug();
/// SPEED OPTIMIZATION
......
......@@ -163,7 +163,6 @@ void NoteContent::setEdited()
/** All the Content Classes:
*/
NoteType::Id TextContent::type() const { return NoteType::Text; }
NoteType::Id HtmlContent::type() const { return NoteType::Html; }
NoteType::Id ImageContent::type() const { return NoteType::Image; }
NoteType::Id AnimationContent::type() const { return NoteType::Animation; }
......@@ -174,7 +173,6 @@ NoteType::Id LauncherContent::type() const { return NoteType::Launcher; }
NoteType::Id ColorContent::type() const { return NoteType::Color; }
NoteType::Id UnknownContent::type() const { return NoteType::Unknown; }
QString TextContent::typeName() const { return i18n("Plain Text"); }
QString HtmlContent::typeName() const { return i18n("Text"); }
QString ImageContent::typeName() const { return i18n("Image"); }
QString AnimationContent::typeName() const { return i18n("Animation"); }
......@@ -185,7 +183,6 @@ QString LauncherContent::typeName() const { return i18n("Launcher"); }
QString ColorContent::typeName() const { return i18n("Color"); }
QString UnknownContent::typeName() const { return i18n("Unknown"); }
QString TextContent::lowerTypeName() const { return "text"; }
QString HtmlContent::lowerTypeName() const { return "html"; }
QString ImageContent::lowerTypeName() const { return "image"; }
QString AnimationContent::lowerTypeName() const { return "animation"; }
......@@ -201,7 +198,6 @@ QString NoteContent::toText(const QString &cuttedFullPath)
return (cuttedFullPath.isEmpty() ? fullPath() : cuttedFullPath);
}
QString TextContent::toText(const QString &/*cuttedFullPath*/) { return text(); }
QString HtmlContent::toText(const QString &/*cuttedFullPath*/) { return Tools::htmlToText(html()); }
QString LinkContent::toText(const QString &/*cuttedFullPath*/)
{
......@@ -219,10 +215,6 @@ QString LinkContent::toText(const QString &/*cuttedFullPath*/)
QString ColorContent::toText(const QString &/*cuttedFullPath*/) { return color().name(); }
QString UnknownContent::toText(const QString &/*cuttedFullPath*/) { return ""; }
// TODO: If imageName.isEmpty() return fullPath() because it's for external use, else return fileName() because it's to display in a tooltip
QString TextContent::toHtml(const QString &/*imageName*/, const QString &/*cuttedFullPath*/)
{ return Tools::textToHTMLWithoutP(text()); }
QString HtmlContent::toHtml(const QString &/*imageName*/, const QString &/*cuttedFullPath*/)
{ return Tools::htmlToParagraph(html()); }
......@@ -280,7 +272,6 @@ void UnknownContent::toLink(KUrl *url, QString *title, const QString &/*cuttedFu
*title = QString();
}
bool TextContent::useFile() const { return true; }
bool HtmlContent::useFile() const { return true; }
bool ImageContent::useFile() const { return true; }
bool AnimationContent::useFile() const { return true; }
......@@ -291,7 +282,6 @@ bool LauncherContent::useFile() const { return true; }
bool ColorContent::useFile() const { return false; }
bool UnknownContent::useFile() const { return true; }
bool TextContent::canBeSavedAs() const { return true; }
bool HtmlContent::canBeSavedAs() const { return true; }
bool ImageContent::canBeSavedAs() const { return true; }
bool AnimationContent::canBeSavedAs() const { return true; }
......@@ -302,7 +292,6 @@ bool LauncherContent::canBeSavedAs() const { return true; }
bool ColorContent::canBeSavedAs() const { return false; }
bool UnknownContent::canBeSavedAs() const { return false; }
QString TextContent::saveAsFilters() const { return "text/plain"; }
QString HtmlContent::saveAsFilters() const { return "text/html"; }
QString ImageContent::saveAsFilters() const { return "image/png"; } // TODO: Offer more types
QString AnimationContent::saveAsFilters() const { return "image/gif"; } // TODO: MNG...
......@@ -313,7 +302,6 @@ QString LauncherContent::saveAsFilters() const { return "application/x-desktop"
QString ColorContent::saveAsFilters() const { return ""; }
QString UnknownContent::saveAsFilters() const { return ""; }
bool TextContent::match(const FilterData &data) { return (text().find(data.string, /*index=*/0, /*cs=*/false) != -1); }
bool HtmlContent::match(const FilterData &data) { return (m_textEquivalent/*toText("")*/.find(data.string, /*index=*/0, /*cs=*/false) != -1); } //OPTIM_FILTER
bool ImageContent::match(const FilterData &/*data*/) { return false; }
bool AnimationContent::match(const FilterData &/*data*/) { return false; }
......@@ -324,7 +312,6 @@ bool LauncherContent::match(const FilterData &data) { return (exec().find(d
bool ColorContent::match(const FilterData &data) { return (color().name().find(data.string, /*index=*/0, /*cs=*/false) != -1); }
bool UnknownContent::match(const FilterData &data) { return (mimeTypes().find(data.string, /*index=*/0, /*cs=*/false) != -1); }
QString TextContent::editToolTipText() const { return i18n("Edit this plain text"); }
QString HtmlContent::editToolTipText() const { return i18n("Edit this text"); }
QString ImageContent::editToolTipText() const { return i18n("Edit this image"); }
QString AnimationContent::editToolTipText() const { return i18n("Edit this animation"); }
......@@ -335,7 +322,6 @@ QString LauncherContent::editToolTipText() const { return i18n("Edit this launc
QString ColorContent::editToolTipText() const { return i18n("Edit this color"); }
QString UnknownContent::editToolTipText() const { return i18n("Edit this unknown object"); }
QString TextContent::cssClass() const { return ""; }
QString HtmlContent::cssClass() const { return ""; }
QString ImageContent::cssClass() const { return ""; }
QString AnimationContent::cssClass() const { return ""; }
......@@ -346,7 +332,6 @@ QString LauncherContent::cssClass() const { return "launcher"; }
QString ColorContent::cssClass() const { return "" ; }
QString UnknownContent::cssClass() const { return ""; }
void TextContent::fontChanged() { setText(text()); }
void HtmlContent::fontChanged() { setHtml(html()); }
void ImageContent::fontChanged() { setPixmap(pixmap()); }
void AnimationContent::fontChanged() { updateMovie(); }
......@@ -356,7 +341,6 @@ void LauncherContent::fontChanged() { setLauncher(name(), icon(), exec());
void ColorContent::fontChanged() { setColor(color()); }
void UnknownContent::fontChanged() { loadFromFile(/*lazyLoad=*/false); } // TODO: Optimize: setMimeTypes()
//QString TextContent::customOpenCommand() { return (Settings::isTextUseProg() && ! Settings::textProg().isEmpty() ? Settings::textProg() : QString()); }
QString HtmlContent::customOpenCommand() { return (Settings::isHtmlUseProg() && ! Settings::htmlProg().isEmpty() ? Settings::htmlProg() : QString()); }
QString ImageContent::customOpenCommand() { return (Settings::isImageUseProg() && ! Settings::imageProg().isEmpty() ? Settings::imageProg() : QString()); }
QString AnimationContent::customOpenCommand() { return (Settings::isAnimationUseProg() && ! Settings::animationProg().isEmpty() ? Settings::animationProg() : QString()); }
......@@ -365,19 +349,6 @@ QString SoundContent::customOpenCommand() { return (Settings::isSoundUseProg
void LinkContent::serialize(QDataStream &stream) { stream << url() << title() << icon() << (quint64)autoTitle() << (quint64)autoIcon(); }
void ColorContent::serialize(QDataStream &stream) { stream << color(); }
QPixmap TextContent::feedbackPixmap(int width, int height)
{
QRect textRect = QFontMetrics(note()->font()).boundingRect(0, 0, width, height, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, text());
QPixmap pixmap( qMin(width, textRect.width()), qMin(height, textRect.height()) );
pixmap.fill(note()->backgroundColor().dark(FEEDBACK_DARKING));
QPainter painter(&pixmap);
painter.setPen(note()->textColor());
painter.setFont(note()->font());
painter.drawText(0, 0, pixmap.width(), pixmap.height(), Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, text());
painter.end();
return pixmap;
}
QPixmap HtmlContent::feedbackPixmap(int width, int height)
{
Q3SimpleRichText richText(html(), note()->font());
......@@ -500,116 +471,6 @@ QPixmap UnknownContent::feedbackPixmap(int width, int height)
return pixmap;
}
/** class TextContent:
*/
TextContent::TextContent(Note *parent, const QString &fileName, bool lazyLoad)
: NoteContent(parent, fileName), m_simpleRichText(0)
{
basket()->addWatchedFile(fullPath());
loadFromFile(lazyLoad);
}
TextContent::~TextContent()
{
delete m_simpleRichText;
}
int TextContent::setWidthAndGetHeight(int width)
{
if (m_simpleRichText) {
width -= 1;
m_simpleRichText->setWidth(width);
return m_simpleRichText->height();
} else
return 10; // Lazy loaded
}
void TextContent::paint(QPainter *painter, int width, int height, const QColorGroup &colorGroup, bool /*isDefaultColor*/, bool /*isSelected*/, bool /*isHovered*/)
{
if (m_simpleRichText) {
width -= 1;
m_simpleRichText->draw(painter, 0, 0, QRect(0, 0, width, height), colorGroup);
}
}
bool TextContent::loadFromFile(bool lazyLoad)
{
DEBUG_WIN << "Loading TextContent From " + basket()->folderName() + fileName();
QString content;
bool success = basket()->loadFromFile(fullPath(), &content, /*isLocalEncoding=*/true);
if (success)
setText(content, lazyLoad);
else {
kDebug() << "FAILED TO LOAD TextContent: " << fullPath();
setText("", lazyLoad);
if (!QFile::exists(fullPath()))
saveToFile(); // Reserve the fileName so no new note will have the same name!
}
return success;
}
bool TextContent::finishLazyLoad()
{
int width = (m_simpleRichText ? m_simpleRichText->width() : 1);
delete m_simpleRichText;
QString html = "<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>" + Tools::tagURLs(Tools::textToHTML(m_text)); // Don't collapse multiple spaces!
m_simpleRichText = new Q3SimpleRichText(html, note()->font());
m_simpleRichText->setWidth(1); // We put a width of 1 pixel, so usedWidth() is egual to the minimum width
int minWidth = m_simpleRichText->widthUsed();
m_simpleRichText->setWidth(width);
contentChanged(minWidth + 1);
return true;
}
bool TextContent::saveToFile()
{
return basket()->saveToFile(fullPath(), text(), /*isLocalEncoding=*/true);
}
QString TextContent::linkAt(const QPoint &pos)
{
if (m_simpleRichText)
return m_simpleRichText->anchorAt(pos);
else
return ""; // Lazy loaded
}
QString TextContent::messageWhenOpening(OpenMessage where)
{
switch (where) {
case OpenOne: return i18n("Opening plain text...");
case OpenSeveral: return i18n("Opening plain texts...");
case OpenOneWith: return i18n("Opening plain text with...");
case OpenSeveralWith: return i18n("Opening plain texts with...");
case OpenOneWithDialog: return i18n("Open plain text with:");
case OpenSeveralWithDialog: return i18n("Open plain texts with:");
default: return "";
}
}
void TextContent::setText(const QString &text, bool lazyLoad)
{
m_text = text;
if (!lazyLoad)
finishLazyLoad();
else
contentChanged(10);
}
void TextContent::exportToHTML(HTMLExporter *exporter, int indent)
{
QString spaces;
QString html = "<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>" +
Tools::tagURLs(Tools::textToHTMLWithoutP(text().replace("\t", " "))); // Don't collapse multiple spaces!
exporter->stream << html.replace(" ", " &nbsp;").replace("\n", "\n" + spaces.fill(' ', indent + 1));
}
/** class HtmlContent:
*/
......@@ -1971,8 +1832,7 @@ void UnknownContent::exportToHTML(HTMLExporter *exporter, int indent)
void NoteFactory__loadNode(const QDomElement &content, const QString &lowerTypeName, Note *parent, bool lazyLoad)
{
if (lowerTypeName == "text") new TextContent( parent, content.text(), lazyLoad );
else if (lowerTypeName == "html") new HtmlContent( parent, content.text(), lazyLoad );
if (lowerTypeName == "html") new HtmlContent( parent, content.text(), lazyLoad );
else if (lowerTypeName == "image") new ImageContent( parent, content.text(), lazyLoad );
else if (lowerTypeName == "animation") new AnimationContent( parent, content.text(), lazyLoad );
else if (lowerTypeName == "sound") new SoundContent( parent, content.text() );
......
......@@ -61,7 +61,7 @@ class HtmlExporter;
*/
namespace NoteType
{
enum Id { Group = 255, Text = 1, Html, Image, Animation, Sound, File, Link, Launcher, Color, Unknown }; // Always positive
enum Id { Group = 255, Html = 1, Image, Animation, Sound, File, Link, Launcher, Color, Unknown }; // Always positive
}
/** Abstract base class for every content type of basket note.
......@@ -147,50 +147,6 @@ class NoteContent
static const int FEEDBACK_DARKING;
};
/** Real implementation of plain text notes:
* @author Sébastien Laoût
*/
class TextContent : public NoteContent
{
public:
// Constructor and destructor:
TextContent(Note *parent, const QString &fileName, bool lazyLoad = false);
~TextContent();
// Simple Generic Methods:
NoteType::Id type() const;
QString typeName() const;
QString lowerTypeName() const;
QString toText(const QString &/*cuttedFullPath*/);
QString toHtml(const QString &imageName, const QString &cuttedFullPath);
bool useFile() const;
bool canBeSavedAs() const;
QString saveAsFilters() const;
bool match(const FilterData &data);
// Complexe Generic Methods:
void exportToHTML(HTMLExporter *exporter, int indent);
QString cssClass() const;
int setWidthAndGetHeight(int width);
void paint(QPainter *painter, int width, int height, const QColorGroup &colorGroup, bool isDefaultColor, bool isSelected, bool isHovered);
bool loadFromFile(bool lazyLoad);
bool finishLazyLoad();
bool saveToFile();
QString linkAt(const QPoint &pos);
void fontChanged();
QString editToolTipText() const;
// Drag and Drop Content:
QPixmap feedbackPixmap(int width, int height);
// Open Content or File:
QString messageWhenOpening(OpenMessage where);
// QString customOpenCommand();
// Content-Specific Methods:
void setText(const QString &text, bool lazyLoad = false); /// << Change the text note-content and relayout the note.
QString text() { return m_text; } /// << @return the text note-content.
QByteArray data() { return text().toLocal8Bit(); }
protected:
QString m_text;
Q3SimpleRichText *m_simpleRichText;
};
/** Real implementation of rich text (HTML) notes:
* @author Sébastien Laoût
*/
......
......@@ -74,10 +74,6 @@ Note* NoteEditor::note()
NoteEditor* NoteEditor::editNoteContent(NoteContent *noteContent, QWidget *parent)
{
TextContent *textContent = dynamic_cast<TextContent*>(noteContent);
if (textContent)
return new TextEditor(textContent, parent);
HtmlContent *htmlContent = dynamic_cast<HtmlContent*>(noteContent);
if (htmlContent)
return new HtmlEditor(htmlContent, parent);
......@@ -129,78 +125,6 @@ void NoteEditor::setInlineEditor(QWidget *inlineEditor)
}
}
/** class TextEditor: */
TextEditor::TextEditor(TextContent *textContent, QWidget *parent)
: NoteEditor(textContent), m_textContent(textContent)
{
FocusedTextEdit *textEdit = new FocusedTextEdit(/*disableUpdatesOnKeyPress=*/true, parent);