-rw-r--r-- | noncore/apps/opie-write/qrichtext.cpp | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/noncore/apps/opie-write/qrichtext.cpp b/noncore/apps/opie-write/qrichtext.cpp index 768da44..b457cd6 100644 --- a/noncore/apps/opie-write/qrichtext.cpp +++ b/noncore/apps/opie-write/qrichtext.cpp @@ -191,8 +191,5 @@ QTextCursor *QTextDeleteCommand::execute( QTextCursor *c ) QTextParagraph *s = doc ? doc->paragAt( id ) : parag; - if ( !s && doc ) { + if ( !s ) { owarn << "can't locate parag at " << id << ", last parag: " << doc->lastParagraph()->paragId() << "" << oendl; return 0; - } else if ( !doc ) { - owarn << "No valid doc" << oendl; - return 0; } @@ -222,8 +219,5 @@ QTextCursor *QTextDeleteCommand::unexecute( QTextCursor *c ) QTextParagraph *s = doc ? doc->paragAt( id ) : parag; - if ( !s && doc ) { + if ( !s ) { owarn << "can't locate parag at " << id << ", last parag: " << doc->lastParagraph()->paragId() << "" << oendl; return 0; - } else if ( !doc ) { - owarn << "No valid doc" << oendl; - return 0; } @@ -241,5 +235,2 @@ QTextCursor *QTextDeleteCommand::unexecute( QTextCursor *c ) c->gotoNextLetter(); - } else { - owarn << "No valid cursor" << oendl; - return 0; } @@ -1403,17 +1394,6 @@ struct Q_EXPORT QTextDocumentTag { -#define NEWPAR do { \ - if ( !hasNewPar) { \ - if ( !curpar ) { \ - owarn << "no current paragraph" << oendl; \ - return; \ - } \ +#define NEWPAR do{ if ( !hasNewPar) { \ if ( !textEditMode && curpar && curpar->length()>1 && curpar->at( curpar->length()-2)->c == QChar_linesep ) \ curpar->remove( curpar->length()-2, 1 ); \ - curpar = createParagraph( this, curpar, curpar->next() ); styles.append( vec ); \ - if ( !curpar ) { \ - owarn << "failed in creating a new paragraph" << oendl; \ - return; \ - } \ - vec = 0; \ - } \ + curpar = createParagraph( this, curpar, curpar->next() ); styles.append( vec ); vec = 0;} \ hasNewPar = TRUE; \ @@ -1425,4 +1405,3 @@ struct Q_EXPORT QTextDocumentTag { space = TRUE; \ - delete vec; \ - vec = new QPtrVector<QStyleSheetItem>( (uint)tags.count() + 1); \ + delete vec; vec = new QPtrVector<QStyleSheetItem>( (uint)tags.count() + 1); \ int i = 0; \ @@ -1433,2 +1412,3 @@ struct Q_EXPORT QTextDocumentTag { + void QTextDocument::setRichText( const QString &text, const QString &context ) @@ -1917,7 +1897,4 @@ void QTextDocument::setRichTextMarginsInternal( QPtrList< QPtrVector<QStyleSheet int i, mar; - QStyleSheetItem* mainStyle = (*curStyle)[curStyle->size()-1]; - if ( !mainStyle ) - return; - - if ( mainStyle->displayMode() == QStyleSheetItem::DisplayListItem ) + QStyleSheetItem* mainStyle = curStyle->size() ? (*curStyle)[curStyle->size()-1] : 0; + if ( mainStyle && mainStyle->displayMode() == QStyleSheetItem::DisplayListItem ) stylesPar->setListItem( TRUE ); @@ -3072,3 +3049,2 @@ QTextParagraph *QTextDocument::draw( QPainter *p, int cx, int cy, int cw, int ch - bool fullWidthSelection = FALSE; while ( parag ) { @@ -3079,4 +3055,2 @@ QTextParagraph *QTextDocument::draw( QPainter *p, int cx, int cy, int cw, int ch QRect pr = parag->rect(); - if ( fullWidthSelection ) - pr.setWidth( parag->document()->width() ); if ( pr.y() > cy + ch ) @@ -5366,3 +5340,3 @@ int QTextFormatterBreakWords::format( QTextDocument *doc, QTextParagraph *parag, // ### next line should not be needed - if ( c && painter ) + if ( painter ) c->format()->setPainter( painter ); |