[yast-commit] r63270 - in /trunk/ncurses-pkg/src: NCPackageSelector.cc NCPackageSelector.h NCPkgPackageDetails.cc NCPkgPopupDescr.cc NCPkgTable.cc
Author: gs Date: Wed Jan 26 14:23:54 2011 New Revision: 63270 URL: http://svn.opensuse.org/viewcvs/yast?rev=63270&view=rev Log: code cleanup: obsolete lines removed, createDescrText renamed to createLicenseText (because only used for licenses) Modified: trunk/ncurses-pkg/src/NCPackageSelector.cc trunk/ncurses-pkg/src/NCPackageSelector.h trunk/ncurses-pkg/src/NCPkgPackageDetails.cc trunk/ncurses-pkg/src/NCPkgPopupDescr.cc trunk/ncurses-pkg/src/NCPkgTable.cc Modified: trunk/ncurses-pkg/src/NCPackageSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelector.cc?rev=63270&r1=63269&r2=63270&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPackageSelector.cc (original) +++ trunk/ncurses-pkg/src/NCPackageSelector.cc Wed Jan 26 14:23:54 2011 @@ -373,31 +373,6 @@ packageList->createPatchEntry ( patchPtr, *it); } - /*// get the patch list and sort it - list<ZyppSel> patchList( zyppPatchesBegin (), zyppPatchesEnd () ); - patchList.sort( sortByName ); - list<ZyppSel>::iterator listIt = patchList.begin(); - - while ( listIt != patchList.end() ) - { - ZyppPatch patchPtr = tryCastToZyppPatch( ( *listIt)->theObj() ); - - if ( patchPtr ) - { - string name = patchPtr->name(); - - string::iterator pos = search( name.begin(), name.end(), - expr.begin(), expr.end(), - ic_compare ); - - if ( pos != name.end() ) - { - // search sucessful - packageList->createPatchEntry( patchPtr, *listIt ); - } - } - ++listIt; - }*/ // show the patch list with search result packageList->drawList(); @@ -1255,7 +1230,7 @@ NCPopupInfo * info = new NCPopupInfo ( wpos( NCurses::lines()/10, NCurses::cols()/10), NCPkgStrings::NotifyLabel(), "<i>" + pkgName + "</i><br><br>" - + createDescrText( licenseText ), + + createLicenseText( licenseText ), NCPkgStrings::AcceptLabel(), NCPkgStrings::CancelLabel() ); @@ -1327,81 +1302,24 @@ /////////////////////////////////////////////////////////////////// // -// createDescrText -// -#define DOCTYPETAG "<!-- DT:Rich -->" +// createLicenseText +// -string NCPackageSelector::createDescrText( string value ) +#define DOCTYPETAG "<!-- DT:Rich -->" // Special doctype for preformatted HTML + +string NCPackageSelector::createLicenseText( string value ) { string html_text = ""; + const string htmlIdent(DOCTYPETAG); -#ifdef FIXME - bool author_format = false; - bool htmlFormat = false; /* Is the description coming in html? */ - /* By default, this is false and the text is plain text. But if the - * description contains DOCTYPETAG in the first line, it is considered - * to be formatted in html. The yast (this method here) needs not to - * do further formatting for the text part. - */ - - list<string>::const_iterator it = value.begin(); - - string line; - - /* Check if the first line is the html tag */ - if( it != value.end() ) + if ( value.find( htmlIdent ) != string::npos ) { - line = (*it); - const string htmlIdent(DOCTYPETAG); - - if ( line.length() >= htmlIdent.length() && /* Avoid exception if stringlen < len of tag */ - line.substr( 0, htmlIdent.length() ) == htmlIdent ) /* first line == DOCTYPETAG ? */ - { - htmlFormat = true; /* indicate that the text is already html formatted */ - } - else - { - html_text += line + " "; - } - ++it; + html_text = value; // HTML text } - - /** Loop over the remaining text. **/ - const string authors("Authors:"); - while ( it != value.end() ) + else { - line = (*it); - - /* Check if authors-line starts */ - if ( line.length() >= authors.length() && /* Avoid exception if stringlen < len of Authors */ - line.substr( 0, authors.length() ) == authors ) - { - line = "<br><b>" + line + "</b>"; - author_format = true; - } - if ( author_format ) - { - /* every author in his own line */ - html_text += line + "<br>"; - } - else - { - html_text += " " + line; - if( (! htmlFormat) && (line.length() == 0) ) - { - html_text += "<br>"; - } - else - { - html_text += " "; - } - } - - ++it; + html_text = "<pre>" + value + "</pre>"; // add <pre> to preserve newlines and spaces } -#else - html_text = value; -#endif return html_text; } Modified: trunk/ncurses-pkg/src/NCPackageSelector.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelector.h?rev=63270&r1=63269&r2=63270&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPackageSelector.h (original) +++ trunk/ncurses-pkg/src/NCPackageSelector.h Wed Jan 26 14:23:54 2011 @@ -395,11 +395,11 @@ bool autoChecking() { return autoCheck; } /** - * Creates a text from a list of strings which may contain HTML tags - * @param t used to be list, now a single string. but what does it contain? + * Creates a the license text + * @param t the license string * @return string The text */ - string createDescrText( string t ); + string createLicenseText( string t ); /** * Calls the package mananager (updateDu()) and shows the required disk space Modified: trunk/ncurses-pkg/src/NCPkgPackageDetails.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgPackageDetails.cc?rev=63270&r1=63269&r2=63270&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPkgPackageDetails.cc (original) +++ trunk/ncurses-pkg/src/NCPkgPackageDetails.cc Wed Jan 26 14:23:54 2011 @@ -277,7 +277,7 @@ // get and format the patch description string value = patchPtr->description(); - //descr += createDescrText( value ); + descr += "<p>"; descr += value; descr += "</p>"; Modified: trunk/ncurses-pkg/src/NCPkgPopupDescr.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgPopupDescr.cc?rev=63270&r1=63269&r2=63270&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPkgPopupDescr.cc (original) +++ trunk/ncurses-pkg/src/NCPkgPopupDescr.cc Wed Jan 26 14:23:54 2011 @@ -134,7 +134,7 @@ headline->setLabel( pkgPtr->summary() ); - descrText->setText( packager->createDescrText(pkgPtr->description()) ); + descrText->setText( pkgPtr->description() ); return true; } Modified: trunk/ncurses-pkg/src/NCPkgTable.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgTable.cc?rev=63270&r1=63269&r2=63270&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPkgTable.cc (original) +++ trunk/ncurses-pkg/src/NCPkgTable.cc Wed Jan 26 14:23:54 2011 @@ -213,7 +213,7 @@ if ( objPtr ) { notify = objPtr->delnotify(); - yuiDebug() << "DELETE message: " << notify << endl; + yuiMilestone() << "DELETE message: " << notify << endl; header = NCPkgStrings::WarningLabel(); } break; @@ -223,7 +223,7 @@ if ( objPtr ) { notify = objPtr->insnotify(); - yuiDebug() << "NOTIFY message: " << notify << endl; + yuiMilestone() << "NOTIFY message: " << notify << endl; header = NCPkgStrings::NotifyLabel(); } case S_Update: @@ -248,8 +248,8 @@ { NCPopupInfo * info = new NCPopupInfo( wpos( (lines * 10)/100, (cols * 10) /100), NCPkgStrings::NotifyLabel(), - string( _("End User License Agreement") + - "<i>" + pkgName + "</i><br><br>" + packager->createDescrText( license ) ), + string( _("End User License Agreement") + " " + + "<i>" + pkgName + "</i><br><br>" + packager->createLicenseText( license ) ), NCPkgStrings::AcceptLabel(), NCPkgStrings::CancelLabel() ); @@ -291,7 +291,7 @@ { NCPopupInfo * info = new NCPopupInfo( wpos( (lines * 35)/100, (cols * 25)/100), header, - "<i>" + pkgName + "</i><br><br>" + packager->createDescrText( notify ) + "<i>" + pkgName + "</i><br><br>" + notify ); info->setPreferredSize( (NCurses::cols() * 50)/100, (NCurses::lines() * 30)/100); info->showInfoPopup( ); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
gs@svn2.opensuse.org