Commit 133b180b authored by Boudewijn Rempt's avatar Boudewijn Rempt

Make KoText kdelibs4support-free

* added qcdebug
* ported away from kmimetype
* added kf5::windowsystem as a dependency
parent cffe6d83
......@@ -196,14 +196,32 @@ include(KDECMakeSettings)
include(KDECompilerSettings)
include(FeatureSummary)
find_package(KF5 5.7.0 REQUIRED COMPONENTS Archive Codecs Config CoreAddons
GuiAddons I18n ItemModels ItemViews
WidgetsAddons ThreadWeaver
Completion IconThemes Sonnet
Parts
XmlGui Kross Wallet GlobalAccel
Emoticons ConfigWidgets KDELibs4Support
TextWidgets TextEditor KIO
find_package(KF5 5.7.0 REQUIRED COMPONENTS
Archive
Codecs
Completion
Config
ConfigWidgets
CoreAddons
Emoticons
GlobalAccel
GuiAddons
I18n
IconThemes
ItemModels
ItemViews
KDELibs4Support
KIO
Kross
Parts
Sonnet
TextEditor
TextWidgets
ThreadWeaver
Wallet
WidgetsAddons
WindowSystem
XmlGui
OPTIONAL_COMPONENTS
NotifyConfig
Activities
......
......@@ -21,8 +21,6 @@
#include "KoInlineCite.h"
#include <klocalizedstring.h>
#include <kdebug.h>
#include <KoOdfBibliographyConfiguration.h>
#include <KoInlineTextObjectManager.h>
#include <KoParagraphStyle.h>
......@@ -131,7 +129,6 @@ void BibliographyGenerator::generate()
bibEntryTemplate.styleName = bibTemplateStyle->name();
}
} else {
qDebug() << "Bibliography meta-data has not BibliographyEntryTemplate for " << cite->bibliographyType();
continue;
}
......@@ -174,7 +171,6 @@ void BibliographyGenerator::generate()
break;
}
default:{
qDebug() << "New or unknown index entry";
break;
}
}
......
......@@ -124,6 +124,8 @@ set(kotext_LIB_SRCS
KoTextDrag.cpp
KoTextCommandBase.cpp
TextDebug.cpp
)
if( SHOULD_BUILD_FEATURE_RDF )
......@@ -135,11 +137,11 @@ endif()
add_library(kotext SHARED ${kotext_LIB_SRCS})
# generate_export_header(kotext BASE_NAME kotext)
target_link_libraries(kotext flake)
target_link_libraries(kotext flake KF5::TextWidgets KF5::XmlGui KF5::WindowSystem)
if( SHOULD_BUILD_FEATURE_RDF )
target_link_libraries(kotext ${SOPRANO_LIBRARIES})
endif()
target_link_libraries(kotext LINK_INTERFACE_LIBRARIES flake)
target_link_libraries(kotext LINK_INTERFACE_LIBRARIES flake KF5::TextWidgets)
if( FONTCONFIG_FOUND )
target_link_libraries(kotext ${FONTCONFIG_LIBRARIES})
......
......@@ -24,7 +24,7 @@
#include <KoCanvasBase.h>
#include <kdebug.h>
#include "TextDebug.h"
InsertInlineObjectActionBase::InsertInlineObjectActionBase(KoCanvasBase *canvas, const QString &name)
: QAction(name, canvas->canvasWidget()),
......
......@@ -30,7 +30,7 @@
#include <QTextInlineObject>
#include <QFontMetricsF>
#include <kdebug.h>
#include "TextDebug.h"
// #define DEBUG_PAINTING
......
......@@ -26,7 +26,7 @@
#include <KoShapeSavingContext.h>
#include <KoShape.h>
#include <kdebug.h>
#include "TextDebug.h"
class KoAnchorTextRangePrivate
......
......@@ -32,7 +32,7 @@
#include <QTextDocument>
#include <QTextBlock>
#include <QTextCursor>
#include <kdebug.h>
#include "TextDebug.h"
// Include Q_UNSUSED classes, for building on Windows
#include <KoShapeLoadingContext.h>
......@@ -92,7 +92,7 @@ bool KoAnnotation::loadOdf(const KoXmlElement &element, KoShapeLoadingContext &c
return false;
}
//kDebug(32500) << "****** Start Load odf ******";
//debugText << "****** Start Load odf ******";
QString annotationName = element.attribute("name");
if (manager()) {
......@@ -114,7 +114,7 @@ bool KoAnnotation::loadOdf(const KoXmlElement &element, KoShapeLoadingContext &c
inlineRdf = 0;
}
}
//kDebug(32500) << "****** End Load ******";
//debugText << "****** End Load ******";
return true;
}
......
......@@ -22,7 +22,7 @@
#include "KoAnnotationManager.h"
#include "KoAnnotation.h"
#include <kdebug.h>
#include "TextDebug.h"
#include <QHash>
class KoAnnotationManagerPrivate
......
......@@ -31,7 +31,7 @@
#include <QTextDocument>
#include <QTextBlock>
#include <QTextCursor>
#include <kdebug.h>
#include "TextDebug.h"
// Include Q_UNSUSED classes, for building on Windows
#include <KoShapeLoadingContext.h>
......
......@@ -21,7 +21,7 @@
#include "KoBookmarkManager.h"
#include "KoBookmark.h"
#include <kdebug.h>
#include "TextDebug.h"
#include <QHash>
class KoBookmarkManagerPrivate
......
......@@ -26,7 +26,7 @@
#include <Soprano/Soprano>
#endif
#include <kdebug.h>
#include "TextDebug.h"
KoDocumentRdfBase::KoDocumentRdfBase(QObject *parent)
: QObject(parent)
......
......@@ -23,7 +23,7 @@
#include <KoCanvasResourceManager.h>
#include <KWindowSystem>
#include <kwindowsystem.h>
#include <kfinddialog.h>
#include <kfind.h>
#include <klocalizedstring.h>
......@@ -32,7 +32,7 @@
#include <QTextCursor>
#include <QTimer>
#include <QAction>
#include <kdebug.h>
#include "TextDebug.h"
#include "KoFind.h"
#include "KoText.h"
......@@ -217,7 +217,7 @@ void KoFindPrivate::parseSettingsAndFind()
endPosition = lastKnownPosition;
startPosition = lastKnownPosition;
}
//kDebug() << "start" << lastKnownPosition.position();
//debugText << "start" << lastKnownPosition.position();
}
QRegExp regExp;
......@@ -233,7 +233,7 @@ void KoFindPrivate::parseSettingsAndFind()
cursor = document->find(pattern, lastKnownPosition, flags);
}
//kDebug() << "r" << restarted << "c > e" << ( document == startDocument && cursor > endPosition ) << ( startDocument == document && findDirection->positionReached( cursor, endPosition ) )<< "e" << cursor.atEnd() << "n" << cursor.isNull();
//debugText << "r" << restarted << "c > e" << ( document == startDocument && cursor > endPosition ) << ( startDocument == document && findDirection->positionReached( cursor, endPosition ) )<< "e" << cursor.atEnd() << "n" << cursor.isNull();
if ((((document == startDocument) && restarted) || selectedText)
&& (cursor.isNull() || findDirection->positionReached(cursor, endPosition))) {
restarted = false;
......
......@@ -25,7 +25,7 @@
#include <KoTextDocument.h>
#include <KoOdfBibliographyConfiguration.h>
#include <KoStyleManager.h>
#include <kdebug.h>
#include "TextDebug.h"
#include <QTextDocument>
#include <QTextInlineObject>
......
......@@ -29,7 +29,7 @@
#include <KoText.h>
#include <KoStyleManager.h>
#include <KoParagraphStyle.h>
#include <kdebug.h>
#include "TextDebug.h"
#include <writeodf/writeodftext.h>
#include <writeodf/writeodfoffice.h>
#include <writeodf/writeodfdc.h>
......
......@@ -22,8 +22,7 @@
#include "KoInlineTextObjectManager.h"
#include "KoTextInlineRdf.h"
#include <kdebug.h>
#include <QDebug>
#include "TextDebug.h"
QDebug KoInlineObjectPrivate::printDebug(QDebug dbg) const
{
......
......@@ -27,7 +27,7 @@
#include <KoPluginLoader.h>
#include <kglobal.h>
#include <kdebug.h>
#include "TextDebug.h"
class Q_DECL_HIDDEN KoInlineObjectRegistry::Private
{
......@@ -50,12 +50,12 @@ void KoInlineObjectRegistry::Private::init(KoInlineObjectRegistry *q)
foreach (KoInlineObjectFactoryBase *factory, q->values()) {
QString nameSpace = factory->odfNameSpace();
if (nameSpace.isEmpty() || factory->odfElementNames().isEmpty()) {
kDebug(32500) << "Variable factory" << factory->id() << " does not have odfNameSpace defined, ignoring";
debugText << "Variable factory" << factory->id() << " does not have odfNameSpace defined, ignoring";
} else {
foreach (const QString &elementName, factory->odfElementNames()) {
factories.insert(QPair<QString, QString>(nameSpace, elementName), factory);
kDebug(32500) << "Inserting variable factory" << factory->id() << " for"
debugText << "Inserting variable factory" << factory->id() << " for"
<< nameSpace << ":" << elementName;
}
}
......@@ -82,7 +82,7 @@ QList<QAction*> KoInlineObjectRegistry::createInsertVariableActions(KoCanvasBase
}
#ifndef NDEBUG
if (factory->templates().isEmpty()) {
kWarning(32500) << "Variable factory" << factory->id() << "has no templates, skipping.";
warnText << "Variable factory" << factory->id() << "has no templates, skipping.";
}
#endif
}
......@@ -95,7 +95,7 @@ KoInlineObject *KoInlineObjectRegistry::createFromOdf(const KoXmlElement &elemen
KoInlineObjectFactoryBase *factory = d->factories.value(
QPair<QString, QString>(element.namespaceURI(), element.tagName()));
if (factory == 0) {
kDebug(32500) << "No factory for" << element.namespaceURI() << ":" << element.tagName();
debugText << "No factory for" << element.namespaceURI() << ":" << element.tagName();
return 0;
}
......
......@@ -20,7 +20,7 @@
#ifndef KOINLINEOBJECT_P_H
#define KOINLINEOBJECT_P_H
#include <QDebug>
#include "TextDebug.h"
class KoTextInlineRdf;
class KoInlineObjectPrivate
......
......@@ -26,7 +26,7 @@
#include "styles/KoParagraphStyle.h"
#include "styles/KoStyleManager.h"
#include <kdebug.h>
#include "TextDebug.h"
#include <QTextCursor>
......
......@@ -31,10 +31,10 @@
#include <KoTextDocument.h>
#include <KoTextInlineRdf.h>
#include <KDebug>
#include <QTextBlock>
#include "TextDebug.h"
class KoSectionPrivate
{
public:
......@@ -128,12 +128,12 @@ bool KoSection::loadOdf(const KoXmlElement &element, KoTextSharedLoadingData *sh
d->display = element.attributeNS(KoXmlNS::text, "display");
if (d->display == "condition" && d->condition.isEmpty()) {
kWarning(32500) << "Section display is set to \"condition\", but condition is empty.";
warnText << "Section display is set to \"condition\", but condition is empty.";
}
QString newName = element.attributeNS(KoXmlNS::text, "name");
if (!KoTextDocument(d->document).sectionModel()->setName(this, newName)) {
kWarning(32500) << "Section name \"" << newName
warnText << "Section name \"" << newName
<< "\" must be unique or is invalid. Resetting it to " << name();
}
......
......@@ -28,7 +28,7 @@
#include <QVariant>
#include <QTextTable>
#include <QDebug>
#include "TextDebug.h"
class Q_DECL_HIDDEN KoTableColumnAndRowStyleManager::Private : public QSharedData
{
......
......@@ -50,13 +50,13 @@ int KoTableOfContentsGeneratorInfo::styleNameToStyleId(KoTextSharedLoadingData *
KoTableOfContentsGeneratorInfo::KoTableOfContentsGeneratorInfo(bool generateEntryTemplate)
:
m_indexScope("document")
, m_outlineLevel(10)
, m_relativeTabStopPosition(true)
, m_useIndexMarks(true)
, m_useIndexSourceStyles(false)
, m_useOutlineLevel(true)
:
m_indexScope("document")
, m_outlineLevel(10)
, m_relativeTabStopPosition(true)
, m_useIndexMarks(true)
, m_useIndexSourceStyles(false)
, m_useOutlineLevel(true)
{
// index-title-template
// m_indexTitleTemplate.text = "title";
......@@ -137,7 +137,7 @@ void KoTableOfContentsGeneratorInfo::loadOdf(KoTextSharedLoadingData *sharedLoad
m_indexTitleTemplate.styleName = p.attribute("style-name");
m_indexTitleTemplate.styleId = styleNameToStyleId(sharedLoadingData, m_indexTitleTemplate.styleName);
m_indexTitleTemplate.text = p.text();
// second child
// second child
} else if (p.localName() == "table-of-content-entry-template") {
TocEntryTemplate tocEntryTemplate;
tocEntryTemplate.outlineLevel = p.attribute("outline-level").toInt();
......@@ -153,8 +153,8 @@ void KoTableOfContentsGeneratorInfo::loadOdf(KoTextSharedLoadingData *sharedLoad
if (indexEntry.localName() == "index-entry-chapter") {
// use null String if the style name is not present, it means that we inherit it from the parent
IndexEntryChapter *entryChapter = new IndexEntryChapter(
indexEntry.attribute("style-name", QString())
);
indexEntry.attribute("style-name", QString())
);
// display can be "name", "number", "number-and-name", "plain-number" or "plain-number-and-name"
// "number" is default according the specs ODF v1.2
......@@ -198,22 +198,21 @@ void KoTableOfContentsGeneratorInfo::loadOdf(KoTextSharedLoadingData *sharedLoad
}
m_entryTemplate.append(tocEntryTemplate);
// third child
// third child
} else if (p.localName() == "index-source-styles" && p.namespaceURI() == KoXmlNS::text) {
qDebug() <<"index-source-styles";
IndexSourceStyles indexStyles;
indexStyles.outlineLevel = p.attribute("outline-level").toInt();
IndexSourceStyle indexStyle;
KoXmlElement sourceElement;
forEachElement(sourceElement, p) {
if (sourceElement.localName() == "index-source-style") {
indexStyle.styleName = sourceElement.attribute("style-name");
indexStyle.styleId = styleNameToStyleId(sharedLoadingData, indexStyle.styleName);
indexStyles.styles.append(indexStyle);
}
IndexSourceStyles indexStyles;
indexStyles.outlineLevel = p.attribute("outline-level").toInt();
IndexSourceStyle indexStyle;
KoXmlElement sourceElement;
forEachElement(sourceElement, p) {
if (sourceElement.localName() == "index-source-style") {
indexStyle.styleName = sourceElement.attribute("style-name");
indexStyle.styleId = styleNameToStyleId(sharedLoadingData, indexStyle.styleName);
indexStyles.styles.append(indexStyle);
}
m_indexSourceStyles.append(indexStyles);
}
m_indexSourceStyles.append(indexStyles);
}
}// forEachElement
}
......@@ -222,22 +221,22 @@ void KoTableOfContentsGeneratorInfo::loadOdf(KoTextSharedLoadingData *sharedLoad
void KoTableOfContentsGeneratorInfo::saveOdf(KoXmlWriter * writer) const
{
writer->startElement("text:table-of-content-source");
writer->addAttribute("text:index-scope", m_indexScope);
writer->addAttribute("text:outline-level", m_outlineLevel);
writer->addAttribute("text:relative-tab-stop-position", m_relativeTabStopPosition);
writer->addAttribute("text:use-index-marks", m_useIndexMarks);
writer->addAttribute("text:use-index-source-styles", m_useIndexSourceStyles);
writer->addAttribute("text:use-outline-level", m_useOutlineLevel);
writer->addAttribute("text:index-scope", m_indexScope);
writer->addAttribute("text:outline-level", m_outlineLevel);
writer->addAttribute("text:relative-tab-stop-position", m_relativeTabStopPosition);
writer->addAttribute("text:use-index-marks", m_useIndexMarks);
writer->addAttribute("text:use-index-source-styles", m_useIndexSourceStyles);
writer->addAttribute("text:use-outline-level", m_useOutlineLevel);
m_indexTitleTemplate.saveOdf(writer);
m_indexTitleTemplate.saveOdf(writer);
foreach (const TocEntryTemplate &entry, m_entryTemplate) {
entry.saveOdf(writer);
}
foreach (const TocEntryTemplate &entry, m_entryTemplate) {
entry.saveOdf(writer);
}
foreach (const IndexSourceStyles &sourceStyle, m_indexSourceStyles) {
sourceStyle.saveOdf(writer);
}
foreach (const IndexSourceStyles &sourceStyle, m_indexSourceStyles) {
sourceStyle.saveOdf(writer);
}
writer->endElement(); // text:table-of-content-source
}
......
......@@ -24,7 +24,6 @@
#define ppVar( var ) #var << "=" << var
//#define DEBUG_TOC_STRUCTURE
#include <QDebug>
#include <QList>
#include <QString>
......
......@@ -22,7 +22,7 @@
#include <QPainter>
#include <kdebug.h>
#include "TextDebug.h"
struct Edge {
Edge() : distance(0.0) { }
......
......@@ -27,7 +27,7 @@
#include <QVariant>
#include <QVariantList>
#include <kdebug.h>
#include "TextDebug.h"
#include <KoTextDebug.h>
#include <kundo2stack.h>
......
......@@ -25,8 +25,6 @@
#include <QMimeData>
#include <QString>
#include <kdebug.h>
#include <KoStore.h>
#include <KoGenStyles.h>
#include <KoGenChanges.h>
......@@ -44,6 +42,8 @@
#include "KoTextRdfCore.h"
#endif
#include "TextDebug.h"
KoTextDrag::KoTextDrag()
: m_mimeData(0)
{
......@@ -90,12 +90,12 @@ bool KoTextDrag::setOdf(const char * mimeType, KoTextOdfSaveHelper &helper)
if (!sharedData) {
context->addSharedData(KOTEXT_SHARED_SAVING_ID, textSharedData);
} else {
kWarning(32500) << "A different type of sharedData was found under the" << KOTEXT_SHARED_SAVING_ID;
warnText << "A different type of sharedData was found under the" << KOTEXT_SHARED_SAVING_ID;
Q_ASSERT(false);
}
}
#ifdef SHOULD_BUILD_RDF
kDebug(30015) << "helper.model:" << helper.rdfModel();
debugText << "helper.model:" << helper.rdfModel();
textSharedData->setRdfModel(helper.rdfModel());
#endif
if (!helper.writeBody()) {
......@@ -114,13 +114,13 @@ bool KoTextDrag::setOdf(const char * mimeType, KoTextOdfSaveHelper &helper)
//add manifest line for content.xml
manifestWriter->addManifestEntry("content.xml", "text/xml");
kDebug(30015) << "testing to see if we should add rdf to odf file?";
debugText << "testing to see if we should add rdf to odf file?";
#ifdef SHOULD_BUILD_RDF
kDebug(30015) << "helper has model" << ( helper.rdfModel() != 0 );
debugText << "helper has model" << ( helper.rdfModel() != 0 );
// RDF: Copy relevant RDF to output ODF
if (QSharedPointer<Soprano::Model> m = helper.rdfModel()) {
kDebug(30015) << "rdf model size:" << m->statementCount();
debugText << "rdf model size:" << m->statementCount();
KoTextRdfCore::createAndSaveManifest(m, textSharedData->getRdfIdMapping(),
store.data(), manifestWriter);
}
......@@ -131,14 +131,14 @@ bool KoTextDrag::setOdf(const char * mimeType, KoTextOdfSaveHelper &helper)
}
if (!context->saveDataCenter(store.data(), manifestWriter)) {
kDebug(32500) << "save data centers failed";
debugText << "save data centers failed";
return false;
}
// Save embedded objects
KoDocumentBase::SavingContext documentContext(odfStore, embeddedSaver);
if (!embeddedSaver.saveEmbeddedDocuments(documentContext)) {
kDebug(32500) << "save embedded documents failed";
debugText << "save embedded documents failed";
return false;
}
......
......@@ -23,7 +23,7 @@
#include <QTextBlock>
#include <QTextCursor>
#include <kdebug.h>
#include "TextDebug.h"
class Q_DECL_HIDDEN KoTextEditingPlugin::Private
{
......
......@@ -83,7 +83,7 @@
#include <QTextTableCell>
#include <kundo2command.h>
#include <kdebug.h>
#include "TextDebug.h"
#include "KoTextDebug.h"
Q_DECLARE_METATYPE(QTextFrame*)
......
......@@ -38,7 +38,7 @@
#include <QTextFormat>
#include <QTextList>
#include <kdebug.h>
#include "TextDebug.h"
#include "KoTextDebug.h"
......
......@@ -30,7 +30,6 @@
#include "changetracker/KoChangeTracker.h"
#include <klocalizedstring.h>
#include <kdebug.h>
#include <kundo2magicstring.h>
#include <QStack>
......
This diff is collapsed.
......@@ -33,7 +33,7 @@
#include <KoXmlNS.h>
#include <KoElementReference.h>
// KDE
#include <kdebug.h>
#include "TextDebug.h"
// Qt
#include <QTextCursor>
#include <QTextDocument>
......@@ -175,7 +175,7 @@ KoTextInlineRdf::KoTextInlineRdf(const QTextDocument *doc, KoSection *s)
KoTextInlineRdf::~KoTextInlineRdf()
{
kDebug(30015) << " this:" << (void*)this;
debugText << " this:" << (void*)this;
delete d;
}
......@@ -198,7 +198,7 @@ bool KoTextInlineRdf::loadOdf(const KoXmlElement &e)
bool KoTextInlineRdf::saveOdf(KoShapeSavingContext &context, KoXmlWriter *writer, KoElementReference id) const
{
kDebug(30015) << " this:" << (void*)this << " xmlid:" << d->id << "passed id" << id.toString();
debugText << " this:" << (void*)this << " xmlid:" << d->id << "passed id" << id.toString();
QString oldID = d->id;
if (!id.isValid()) {
......@@ -210,7 +210,7 @@ bool KoTextInlineRdf::saveOdf(KoShapeSavingContext &context, KoXmlWriter *writer
dynamic_cast<KoTextSharedSavingData *>(context.sharedData(KOTEXT_SHARED_SAVING_ID))) {
sharedData->addRdfIdMapping(oldID, newID);
}
kDebug(30015) << "oldID:" << oldID << " newID:" << newID;
debugText << "oldID:" << oldID << " newID:" << newID;
writer->addAttribute("xml:id", newID);
if (!d->subject.isEmpty()) {
writer->addAttribute("xhtml:about", d->subject);
......@@ -224,7 +224,7 @@ bool KoTextInlineRdf::saveOdf(KoShapeSavingContext &context, KoXmlWriter *writer
if (d->isObjectAttributeUsed) {
writer->addAttribute("xhtml:content", d->object);
}
kDebug(30015) << "done..";
debugText << "done..";
return true;
}
......@@ -259,7 +259,7 @@ QPair<int, int> KoTextInlineRdf::findExtent() const
if (!e) {
return QPair<int, int>(0, 0);
}
// kDebug(30015) << "(Semantic)meta... start:" << d->kotextmeta.data()->position() << " end:" << e->position();
// debugText << "(Semantic)meta... start:" << d->kotextmeta.data()->position() << " end:" << e->position();
return QPair<int, int>(d->kotextmeta.data()->position(), e->position());
}
if (d->cell.isValid() && d->document) {
......@@ -291,7 +291,7 @@ QString KoTextInlineRdf::object() const
// FIXME: Need to do something with endAnnotation?
KoTextMeta *e = d->kotextmeta.data()->endBookmark();
if (!e) {
kDebug(30015) << "Broken KoTextMeta, no end tag found!";
debugText << "Broken KoTextMeta, no end tag found!";
return QString();
} else {
KoTextEditor *editor = textDocument.textEditor();
......
......@@ -25,7 +25,7 @@
#include <KoShape.h>
#include <kdebug.h>
#include "TextDebug.h"
#include <QTextDocument>
#include <QTextList>
#include <QTextInlineObject>
......@@ -107,7 +107,7 @@ void KoTextLocator::updatePosition(const QTextDocument *document, int posInDocum
d->dirty = true;
d->document = document;