Author: dmacvicar Date: Mon Dec 3 11:40:18 2007 New Revision: 42587 URL: http://svn.opensuse.org/viewcvs/yast?rev=42587&view=rev Log: RichText done Modified: branches/tmp/coolo/qt4-port/src/QY2ListView.cc branches/tmp/coolo/qt4-port/src/YQRichText.cc branches/tmp/coolo/qt4-port/src/YQRichText.h Modified: branches/tmp/coolo/qt4-port/src/QY2ListView.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/QY2ListView.cc?rev=42587&r1=42586&r2=42587&view=diff ============================================================================== --- branches/tmp/coolo/qt4-port/src/QY2ListView.cc (original) +++ branches/tmp/coolo/qt4-port/src/QY2ListView.cc Mon Dec 3 11:40:18 2007 @@ -67,7 +67,7 @@ { QY2ListViewItem * item = dynamic_cast<QY2ListViewItem *> (*it); - if ( item /*FIXME&& item->isSelectable() */ ) + if ( item && (item->flags() & Qt::ItemIsSelectable) ) { item->setSelected(true); // emits signal, too return; Modified: branches/tmp/coolo/qt4-port/src/YQRichText.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQRichText.cc?rev=42587&r1=42586&r2=42587&view=diff ============================================================================== --- branches/tmp/coolo/qt4-port/src/YQRichText.cc (original) +++ branches/tmp/coolo/qt4-port/src/YQRichText.cc Mon Dec 3 11:40:18 2007 @@ -16,16 +16,13 @@ /-*/ -#define QT3_SUPPORT - #define y2log_component "qt-ui" #include <ycp/y2log.h> #include <QColorGroup> -#include <qtextbrowser.h> -#include <qscrollbar.h> -#include <qregexp.h> -#include <qevent.h> +#include <QScrollBar> +#include <QRegExp> +#include <QEvent> #include <QVBoxLayout> #include "YEvent.h" @@ -55,26 +52,22 @@ if ( plainTextMode ) { - _textBrowser->setTextFormat( Qt::PlainText ); - _textBrowser->setWordWrapMode( QTextOption::NoWrap ); + _textBrowser->setPlainText(QString::fromUtf8(text.c_str())); + _textBrowser->setWordWrapMode( QTextOption::NoWrap ); } else { - _textBrowser->setTextFormat( Qt::RichText ); + _textBrowser->setHtml(QString::fromUtf8(text.c_str())); } - setValue( text ); - - // Set the text foreground color to black, regardless of its current // settings - it might be changed if this widget resides in a // warnColor dialog - which we cannot find right now out since our // parent is not set yet :-( QPalette pal( _textBrowser->palette() ); - QColorGroup normalColors( pal.normal() ); - normalColors.setColor( QColorGroup::Text, Qt::black ); - pal.setNormal( normalColors ); + pal.setColor( QPalette::Text, Qt::black ); + pal.setCurrentColorGroup( QPalette::Normal ); _textBrowser->setPalette( pal ); @@ -109,13 +102,18 @@ QString text = fromUTF8( newText ); if ( ! plainTextMode() ) - text.replace( "&product;", YQUI::ui()->productName() ); - + { + text.replace( "&product;", YQUI::ui()->productName() ); + _textBrowser->setHtml( text ); + } + else + { + _textBrowser->setPlainText( text ); + } YRichText::setValue( newText ); - _textBrowser->setText( text ); if ( autoScrollDown() && _textBrowser->verticalScrollBar() ) - _textBrowser->verticalScrollBar()->setValue( _textBrowser->verticalScrollBar()->maxValue() ); + _textBrowser->verticalScrollBar()->setValue( _textBrowser->verticalScrollBar()->maximum() ); } @@ -125,12 +123,7 @@ if ( plainTextMode() ) { - _textBrowser->setTextFormat( Qt::PlainText ); - _textBrowser->setWordWrapMode( QTextOption::NoWrap ); - } - else - { - _textBrowser->setTextFormat( Qt::RichText ); + _textBrowser->setWordWrapMode( QTextOption::NoWrap ); } } @@ -140,14 +133,14 @@ YRichText::setAutoScrollDown( newAutoScrollDown ); if ( autoScrollDown() && _textBrowser->verticalScrollBar() ) - _textBrowser->verticalScrollBar()->setValue( _textBrowser->verticalScrollBar()->maxValue() ); + _textBrowser->verticalScrollBar()->setValue( _textBrowser->verticalScrollBar()->maximum() ); } void YQRichText::linkClicked( const QUrl & url ) { // y2debug( "Selected hyperlink \"%s\"", (const char *) url ); - YQUI::ui()->sendEvent( new YMenuEvent( toUTF8( url ) ) ); + YQUI::ui()->sendEvent( new YMenuEvent(url.toString().toUtf8()) ); } @@ -158,7 +151,7 @@ QKeyEvent * event = ( QKeyEvent * ) ev; if ( ( event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter ) && - ( event->state() == 0 || event->state() == Qt::Keypad ) && + ( event->modifiers() & Qt::NoModifier || event->modifiers() & Qt::KeypadModifier ) && ! haveHyperLinks() ) { YQDialog * dia = (YQDialog *) findDialog(); @@ -180,7 +173,7 @@ if ( plainTextMode() ) return false; - return ( _textBrowser->text().contains( QRegExp( "<a\\s+href\\s*=", false ) ) > 0 ); + return ( _textBrowser->document()->toPlainText().contains( QRegExp( "<a\\s+href\\s*=", Qt::CaseInsensitive ) ) > 0 ); } Modified: branches/tmp/coolo/qt4-port/src/YQRichText.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQRichText.h?rev=42587&r1=42586&r2=42587&view=diff ============================================================================== --- branches/tmp/coolo/qt4-port/src/YQRichText.h (original) +++ branches/tmp/coolo/qt4-port/src/YQRichText.h Mon Dec 3 11:40:18 2007 @@ -21,7 +21,7 @@ #define YQRichText_h #include <QFrame> -#include <qtextbrowser.h> +#include <QTextBrowser> #include "YRichText.h" using std::string; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org