Diffstat (limited to 'noncore/apps/opie-write/qrichtext.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-write/qrichtext.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/noncore/apps/opie-write/qrichtext.cpp b/noncore/apps/opie-write/qrichtext.cpp index b77a0fc..c27eb1e 100644 --- a/noncore/apps/opie-write/qrichtext.cpp +++ b/noncore/apps/opie-write/qrichtext.cpp | |||
@@ -34,17 +34,23 @@ | |||
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "qrichtext_p.h" | 38 | #include "qrichtext_p.h" |
39 | 39 | ||
40 | /* OPIE */ | ||
41 | #include <opie2/odebug.h> | ||
42 | using namespace Opie::Core; | ||
43 | |||
44 | /* QT */ | ||
40 | #include "qdragobject.h" | 45 | #include "qdragobject.h" |
41 | #include "qpaintdevicemetrics.h" | 46 | #include "qpaintdevicemetrics.h" |
42 | #include "qdrawutil.h" | 47 | #include "qdrawutil.h" |
43 | #include "qcleanuphandler.h" | 48 | #include "qcleanuphandler.h" |
44 | 49 | ||
50 | /* STD */ | ||
45 | #include <stdlib.h> | 51 | #include <stdlib.h> |
46 | 52 | ||
47 | using namespace Qt3; | 53 | using namespace Qt3; |
48 | 54 | ||
49 | static QTextCursor* richTextExportStart = 0; | 55 | static QTextCursor* richTextExportStart = 0; |
50 | static QTextCursor* richTextExportEnd = 0; | 56 | static QTextCursor* richTextExportEnd = 0; |
@@ -181,13 +187,13 @@ QTextDeleteCommand::~QTextDeleteCommand() | |||
181 | } | 187 | } |
182 | 188 | ||
183 | QTextCursor *QTextDeleteCommand::execute( QTextCursor *c ) | 189 | QTextCursor *QTextDeleteCommand::execute( QTextCursor *c ) |
184 | { | 190 | { |
185 | QTextParagraph *s = doc ? doc->paragAt( id ) : parag; | 191 | QTextParagraph *s = doc ? doc->paragAt( id ) : parag; |
186 | if ( !s ) { | 192 | if ( !s ) { |
187 | qWarning( "can't locate parag at %d, last parag: %d", id, doc->lastParagraph()->paragId() ); | 193 | owarn << "can't locate parag at " << id << ", last parag: " << doc->lastParagraph()->paragId() << "" << oendl; |
188 | return 0; | 194 | return 0; |
189 | } | 195 | } |
190 | 196 | ||
191 | cursor.setParagraph( s ); | 197 | cursor.setParagraph( s ); |
192 | cursor.setIndex( index ); | 198 | cursor.setIndex( index ); |
193 | int len = text.size(); | 199 | int len = text.size(); |
@@ -209,13 +215,13 @@ QTextCursor *QTextDeleteCommand::execute( QTextCursor *c ) | |||
209 | } | 215 | } |
210 | 216 | ||
211 | QTextCursor *QTextDeleteCommand::unexecute( QTextCursor *c ) | 217 | QTextCursor *QTextDeleteCommand::unexecute( QTextCursor *c ) |
212 | { | 218 | { |
213 | QTextParagraph *s = doc ? doc->paragAt( id ) : parag; | 219 | QTextParagraph *s = doc ? doc->paragAt( id ) : parag; |
214 | if ( !s ) { | 220 | if ( !s ) { |
215 | qWarning( "can't locate parag at %d, last parag: %d", id, doc->lastParagraph()->paragId() ); | 221 | owarn << "can't locate parag at " << id << ", last parag: " << doc->lastParagraph()->paragId() << "" << oendl; |
216 | return 0; | 222 | return 0; |
217 | } | 223 | } |
218 | 224 | ||
219 | cursor.setParagraph( s ); | 225 | cursor.setParagraph( s ); |
220 | cursor.setIndex( index ); | 226 | cursor.setIndex( index ); |
221 | QString str = QTextString::toString( text ); | 227 | QString str = QTextString::toString( text ); |
@@ -1541,16 +1547,16 @@ void QTextDocument::setRichTextInternal( const QString &text, QTextCursor* curso | |||
1541 | } | 1547 | } |
1542 | if ( attr.contains( "background" ) ) { | 1548 | if ( attr.contains( "background" ) ) { |
1543 | QImage img; | 1549 | QImage img; |
1544 | QString bg = attr["background"]; | 1550 | QString bg = attr["background"]; |
1545 | const QMimeSource* m = factory_->data( bg, contxt ); | 1551 | const QMimeSource* m = factory_->data( bg, contxt ); |
1546 | if ( !m ) { | 1552 | if ( !m ) { |
1547 | qWarning("QRichText: no mimesource for %s", bg.latin1() ); | 1553 | owarn << "QRichText: no mimesource for " << bg.latin1() << "" << oendl; |
1548 | } else { | 1554 | } else { |
1549 | if ( !QImageDrag::decode( m, img ) ) { | 1555 | if ( !QImageDrag::decode( m, img ) ) { |
1550 | qWarning("QTextImage: cannot decode %s", bg.latin1() ); | 1556 | owarn << "QTextImage: cannot decode " << bg.latin1() << "" << oendl; |
1551 | } | 1557 | } |
1552 | } | 1558 | } |
1553 | if ( !img.isNull() ) { | 1559 | if ( !img.isNull() ) { |
1554 | QPixmap pm; | 1560 | QPixmap pm; |
1555 | pm.convertFromImage( img ); | 1561 | pm.convertFromImage( img ); |
1556 | QBrush *b = new QBrush( QColor(), pm ); | 1562 | QBrush *b = new QBrush( QColor(), pm ); |
@@ -2149,13 +2155,13 @@ QString QTextDocument::richText() const | |||
2149 | 2155 | ||
2150 | QStyleSheetItem* item_p = styleSheet()->item("p"); | 2156 | QStyleSheetItem* item_p = styleSheet()->item("p"); |
2151 | QStyleSheetItem* item_ul = styleSheet()->item("ul"); | 2157 | QStyleSheetItem* item_ul = styleSheet()->item("ul"); |
2152 | QStyleSheetItem* item_ol = styleSheet()->item("ol"); | 2158 | QStyleSheetItem* item_ol = styleSheet()->item("ol"); |
2153 | QStyleSheetItem* item_li = styleSheet()->item("li"); | 2159 | QStyleSheetItem* item_li = styleSheet()->item("li"); |
2154 | if ( !item_p || !item_ul || !item_ol || !item_li ) { | 2160 | if ( !item_p || !item_ul || !item_ol || !item_li ) { |
2155 | qWarning( "QTextEdit: cannot export HTML due to insufficient stylesheet (lack of p, ul, ol, or li)" ); | 2161 | owarn << "QTextEdit: cannot export HTML due to insufficient stylesheet (lack of p, ul, ol, or li)" << oendl; |
2156 | return QString::null; | 2162 | return QString::null; |
2157 | } | 2163 | } |
2158 | int pastListDepth = 0; | 2164 | int pastListDepth = 0; |
2159 | int listDepth = 0; | 2165 | int listDepth = 0; |
2160 | int futureListDepth = 0; | 2166 | int futureListDepth = 0; |
2161 | QMemArray<int> listStyles(10); | 2167 | QMemArray<int> listStyles(10); |
@@ -4093,13 +4099,13 @@ int QTextParagraph::lineHeightOfChar( int i, int *bl, int *y ) const | |||
4093 | } | 4099 | } |
4094 | if ( it == lineStarts.begin() ) | 4100 | if ( it == lineStarts.begin() ) |
4095 | break; | 4101 | break; |
4096 | --it; | 4102 | --it; |
4097 | } | 4103 | } |
4098 | 4104 | ||
4099 | qWarning( "QTextParagraph::lineHeightOfChar: couldn't find lh for %d", i ); | 4105 | owarn << "QTextParagraph::lineHeightOfChar: couldn't find lh for " << i << "" << oendl; |
4100 | return 15; | 4106 | return 15; |
4101 | } | 4107 | } |
4102 | 4108 | ||
4103 | QTextStringChar *QTextParagraph::lineStartOfChar( int i, int *index, int *line ) const | 4109 | QTextStringChar *QTextParagraph::lineStartOfChar( int i, int *index, int *line ) const |
4104 | { | 4110 | { |
4105 | if ( !isValid() ) | 4111 | if ( !isValid() ) |
@@ -4119,13 +4125,13 @@ QTextStringChar *QTextParagraph::lineStartOfChar( int i, int *index, int *line ) | |||
4119 | if ( it == lineStarts.begin() ) | 4125 | if ( it == lineStarts.begin() ) |
4120 | break; | 4126 | break; |
4121 | --it; | 4127 | --it; |
4122 | --l; | 4128 | --l; |
4123 | } | 4129 | } |
4124 | 4130 | ||
4125 | qWarning( "QTextParagraph::lineStartOfChar: couldn't find %d", i ); | 4131 | owarn << "QTextParagraph::lineStartOfChar: couldn't find " << i << "" << oendl; |
4126 | return 0; | 4132 | return 0; |
4127 | } | 4133 | } |
4128 | 4134 | ||
4129 | int QTextParagraph::lines() const | 4135 | int QTextParagraph::lines() const |
4130 | { | 4136 | { |
4131 | if ( !isValid() ) | 4137 | if ( !isValid() ) |
@@ -4146,13 +4152,13 @@ QTextStringChar *QTextParagraph::lineStartOfLine( int line, int *index ) const | |||
4146 | int i = it.key(); | 4152 | int i = it.key(); |
4147 | if ( index ) | 4153 | if ( index ) |
4148 | *index = i; | 4154 | *index = i; |
4149 | return &str->at( i ); | 4155 | return &str->at( i ); |
4150 | } | 4156 | } |
4151 | 4157 | ||
4152 | qWarning( "QTextParagraph::lineStartOfLine: couldn't find %d", line ); | 4158 | owarn << "QTextParagraph::lineStartOfLine: couldn't find " << line << "" << oendl; |
4153 | return 0; | 4159 | return 0; |
4154 | } | 4160 | } |
4155 | 4161 | ||
4156 | int QTextParagraph::leftGap() const | 4162 | int QTextParagraph::leftGap() const |
4157 | { | 4163 | { |
4158 | if ( !isValid() ) | 4164 | if ( !isValid() ) |
@@ -5694,13 +5700,13 @@ QTextFormat *QTextFormatCollection::format( const QFont &f, const QColor &c ) | |||
5694 | return defFormat; | 5700 | return defFormat; |
5695 | 5701 | ||
5696 | cachedFormat = createFormat( f, c ); | 5702 | cachedFormat = createFormat( f, c ); |
5697 | cachedFormat->collection = this; | 5703 | cachedFormat->collection = this; |
5698 | cKey.insert( cachedFormat->key(), cachedFormat ); | 5704 | cKey.insert( cachedFormat->key(), cachedFormat ); |
5699 | if ( cachedFormat->key() != key ) | 5705 | if ( cachedFormat->key() != key ) |
5700 | qWarning("ASSERT: keys for format not identical: '%s '%s'", cachedFormat->key().latin1(), key.latin1() ); | 5706 | owarn << "ASSERT: keys for format not identical: '" << cachedFormat->key().latin1() << " '" << key.latin1() << "'" << oendl; |
5701 | return cachedFormat; | 5707 | return cachedFormat; |
5702 | } | 5708 | } |
5703 | 5709 | ||
5704 | void QTextFormatCollection::remove( QTextFormat *f ) | 5710 | void QTextFormatCollection::remove( QTextFormat *f ) |
5705 | { | 5711 | { |
5706 | if ( lastFormat == f ) | 5712 | if ( lastFormat == f ) |
@@ -6080,17 +6086,17 @@ QTextImage::QTextImage( QTextDocument *p, const QMap<QString, QString> &attr, co | |||
6080 | height = pm.height(); | 6086 | height = pm.height(); |
6081 | } else { | 6087 | } else { |
6082 | QImage img; | 6088 | QImage img; |
6083 | const QMimeSource* m = | 6089 | const QMimeSource* m = |
6084 | factory.data( imageName, context ); | 6090 | factory.data( imageName, context ); |
6085 | if ( !m ) { | 6091 | if ( !m ) { |
6086 | qWarning("QTextImage: no mimesource for %s", imageName.latin1() ); | 6092 | owarn << "QTextImage: no mimesource for " << imageName.latin1() << "" << oendl; |
6087 | } | 6093 | } |
6088 | else { | 6094 | else { |
6089 | if ( !QImageDrag::decode( m, img ) ) { | 6095 | if ( !QImageDrag::decode( m, img ) ) { |
6090 | qWarning("QTextImage: cannot decode %s", imageName.latin1() ); | 6096 | owarn << "QTextImage: cannot decode " << imageName.latin1() << "" << oendl; |
6091 | } | 6097 | } |
6092 | } | 6098 | } |
6093 | 6099 | ||
6094 | if ( !img.isNull() ) { | 6100 | if ( !img.isNull() ) { |
6095 | if ( width == 0 ) { | 6101 | if ( width == 0 ) { |
6096 | width = img.width(); | 6102 | width = img.width(); |