Author: gs Date: Tue Nov 6 11:32:28 2007 New Revision: 41813 URL: http://svn.opensuse.org/viewcvs/yast?rev=41813&view=rev Log: don't delete NCPkgPopups in destructor; don't create NCPpopupInfo/NCPkgPopups on the stack Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorPlugin.cc branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorPlugin.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorPlugin.cc?rev=41813&r1=41812&r2=41813&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorPlugin.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorPlugin.cc Tue Nov 6 11:32:28 2007 @@ -183,6 +183,8 @@ UIERR << "No NCPackageSelectorStart existing" << endl; } + YDialog::deleteTopmostDialog(); + if ( !event.result.isNull() ) { UIMIL << "Return value: " << event.result->toString() << endl; Modified: branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc?rev=41813&r1=41812&r2=41813&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc Tue Nov 6 11:32:28 2007 @@ -201,8 +201,7 @@ saveState (); - // creation of the popups is moved to createPopups() - + // Changed because of new libyui: the creation of the popups is moved to createPopups() } @@ -212,40 +211,21 @@ // NCPackageSelector::~NCPackageSelector() { - if ( filterPopup ) - { - delete filterPopup; - } - if ( selectionPopup ) - { - delete selectionPopup; - } - if ( patternPopup ) - { - delete patternPopup; - } - if ( languagePopup ) - { - delete languagePopup; - } - if ( depsPopup ) - { - delete depsPopup; - } - if ( diskspacePopup ) - { - delete diskspacePopup; - } - if ( searchPopup ) - { - delete searchPopup; - } - if ( _rpmGroupsTree ) - { - delete _rpmGroupsTree; - } + // Changed because of new libyui: don't call delete for the popups; + // call YDialog::deleteTopmostDialog() instead at the end of + // NCPackageSelectorPlugin::runPkgSelection } - +/////////////////////////////////////////////////////////////////// +// +// createPopups +// +// Create all popups needed for the PackageSelector +// Don't create the popups any longer in constructur because the current dialog +// wouldn't be the PackageSelector dialog then but a PopupDialog and +// NCPackageSelectorPlugin:: runPkgSelection wouldn't find the selector widget. +// Call NCPackageSelector::createPopups() instead after the PackageSelector dialog +// is created (see NCPackageSelectorStart::showDefaultList()). +// void NCPackageSelector::createPopups() { if ( !youMode ) @@ -267,7 +247,7 @@ if ( zyppPkg ) { _rpmGroupsTree->addRpmGroup (zyppPkg->group ()); - NCMIL << "Adding group: " << zyppPkg->group() << endl; + NCDBG << "Adding group: " << zyppPkg->group() << endl; } } #if 0 @@ -1605,11 +1585,11 @@ return false; } - NCPopupInfo info( wpos( (NCurses::lines()-5)/2, (NCurses::cols()-35)/2 ), YCPString( "" ), - YCPString(_( "All package dependencies are OK." )), - NCPkgNames::OKLabel() ); - info.setNiceSize( 35, 5 ); - + NCPopupInfo * info = new NCPopupInfo( wpos( (NCurses::lines()-5)/2, (NCurses::cols()-35)/2 ), YCPString( "" ), + YCPString(_( "All package dependencies are OK." )), + NCPkgNames::OKLabel() ); + info->setNiceSize( 35, 5 ); + // ( event.selection->compare( NCPkgNames::ShowDeps() ) == YO_EQUAL ) if ( event.selection->toString() == "showdeps" ) { @@ -1622,7 +1602,7 @@ } if ( ok ) - info.showInfoPopup(); + info->showInfoPopup(); // update the package list and the disk space info updatePackageList(); @@ -1833,6 +1813,8 @@ packageList->showInformation(); packageList->setKeyboardFocus(); + + YDialog::deleteTopmostDialog(); // delete NCPopupInfo dialog // return true means: don't leave the event loop in runPkgSelection return true; @@ -2009,10 +1991,13 @@ ZyppPkg pkgPtr = tryCastToZyppPkg ((*i)->theObj()); if ( pkgPtr && pkgPtr->name() == pkgName ) { - NCERR << "Package " << pkgName << " found" << endl; + NCMIL << "Package " << pkgName << " found" << endl; // open popup with package info - NCPkgPopupDescr popupDescr( wpos(1,1), this ); - popupDescr.showInfoPopup( pkgPtr, *i ); + NCPkgPopupDescr * popupDescr = new NCPkgPopupDescr( wpos(1,1), this ); + popupDescr->showInfoPopup( pkgPtr, *i ); + + YDialog::deleteTopmostDialog(); + found = true; } } @@ -2042,11 +2027,15 @@ if ( success ) { - NCPopupInfo info( wpos( (NCurses::lines()-8)/2, (NCurses::cols()-40)/2 ), - YCPString( "" ), - YCPString( _("Dependency resolver test case written to ") + "<br>" + testCaseDir ) ); - info.setNiceSize( 40, 8 ); - info.showInfoPopup( ); + NCPopupInfo * info = new NCPopupInfo( wpos( (NCurses::lines()-8)/2, (NCurses::cols()-40)/2 ), + YCPString( "" ), + YCPString( _("Dependency resolver test case written to ") + + "<br>" + testCaseDir ) + ); + info->setNiceSize( 40, 8 ); + info->showInfoPopup( ); + + YDialog::deleteTopmostDialog(); } return success; } @@ -2102,14 +2091,16 @@ (void) unlink( filename->asString()->value_cstr() ); //present error popup to the user - NCPopupInfo errorMsg ( wpos( (NCurses::lines()-5)/2, (NCurses::cols()-40)/2 ), - YCPString( NCPkgNames::ErrorLabel()), - YCPString( _("Error exporting list of packages and patterns to ") + filename->toString() ), - NCPkgNames::OKLabel(), - ""); - errorMsg.setNiceSize(40,5); - NCursesEvent input = errorMsg.showInfoPopup(); + NCPopupInfo * errorMsg = new NCPopupInfo( wpos( (NCurses::lines()-5)/2, (NCurses::cols()-40)/2 ), + YCPString( NCPkgNames::ErrorLabel()), + YCPString( _("Error exporting list of packages and patterns to ") + + filename->toString() ), + NCPkgNames::OKLabel(), + ""); + errorMsg->setNiceSize(40,5); + NCursesEvent input = errorMsg->showInfoPopup(); + YDialog::deleteTopmostDialog(); } return true; @@ -2186,14 +2177,16 @@ { NCWAR << "Error importing list of packages and patterns from" << filename->toString() << endl; - NCPopupInfo errorMsg ( wpos( (NCurses::lines()-5)/2, (NCurses::cols()-40)/2) , - YCPString( NCPkgNames::ErrorLabel()), - YCPString( _("Error importing list of packages and patterns from ") + filename->toString() ), - NCPkgNames::OKLabel(), - ""); - errorMsg.setNiceSize(40,5); - NCursesEvent input = errorMsg.showInfoPopup(); + NCPopupInfo * errorMsg = new NCPopupInfo( wpos( (NCurses::lines()-5)/2, (NCurses::cols()-40)/2) , + YCPString( NCPkgNames::ErrorLabel()), + YCPString( _("Error importing list of packages and patterns from ") + + filename->toString() ), + NCPkgNames::OKLabel(), + ""); + errorMsg->setNiceSize(40,5); + NCursesEvent input = errorMsg->showInfoPopup(); + YDialog::deleteTopmostDialog(); } } } @@ -2252,10 +2245,15 @@ } // open the popup with the help text - NCPopupInfo pkgHelp( wpos( (NCurses::lines()*8)/100, (NCurses::cols()*18)/100 ), headline, YCPString( text ) ); - pkgHelp.setNiceSize( (NCurses::cols()*65)/100, (NCurses::lines()*85)/100 ); - pkgHelp.showInfoPopup( ); + NCPopupInfo * pkgHelp = new NCPopupInfo( wpos( (NCurses::lines()*8)/100, (NCurses::cols()*18)/100 ), + headline, + YCPString( text ) + ); + pkgHelp->setNiceSize( (NCurses::cols()*65)/100, (NCurses::lines()*85)/100 ); + pkgHelp->showInfoPopup( ); + YDialog::deleteTopmostDialog(); + if ( packageList ) { packageList->setKeyboardFocus(); @@ -2280,10 +2278,15 @@ text += NCPkgNames::YouHelp3(); // open the popup with the help text - NCPopupInfo youHelp( wpos( NCurses::lines()/3, NCurses::cols()/6 ), YCPString(NCPkgNames::YouHelp()), YCPString(text) ); - youHelp.setNiceSize( (NCurses::cols()*2)/3, NCurses::lines()/3 ); - youHelp.showInfoPopup( ); + NCPopupInfo * youHelp = new NCPopupInfo( wpos( NCurses::lines()/3, NCurses::cols()/6 ), + YCPString(NCPkgNames::YouHelp()), + YCPString(text) + ); + youHelp->setNiceSize( (NCurses::cols()*2)/3, NCurses::lines()/3 ); + youHelp->showInfoPopup( ); + YDialog::deleteTopmostDialog(); + if ( packageList ) { packageList->setKeyboardFocus(); @@ -2304,13 +2307,17 @@ if (changes) { // show a popup and ask the user - NCPopupInfo cancelMsg( wpos( (NCurses::lines()-8)/2, (NCurses::cols()-45)/2 ), - YCPString( NCPkgNames::NotifyLabel() ), - YCPString( NCPkgNames::CancelText() ), - NCPkgNames::YesLabel(), - NCPkgNames::NoLabel() ); - cancelMsg.setNiceSize( 45, 8 ); - NCursesEvent input = cancelMsg.showInfoPopup( ); + NCPopupInfo * cancelMsg = new NCPopupInfo( wpos( (NCurses::lines()-8)/2, (NCurses::cols()-45)/2 ), + YCPString( NCPkgNames::NotifyLabel() ), + YCPString( NCPkgNames::CancelText() ), + NCPkgNames::YesLabel(), + NCPkgNames::NoLabel() + ); + cancelMsg->setNiceSize( 45, 8 ); + NCursesEvent input = cancelMsg->showInfoPopup( ); + + YDialog::deleteTopmostDialog(); + if ( input == NCursesEvent::cancel ) { // don't leave the package installation dialog return true; @@ -2355,8 +2362,10 @@ if ( !youMode ) // don't show automatic changes if YOU mode { // show the automatic changes list - NCPkgPopupTable autoChangePopup( wpos( 3, 8), this ); - NCursesEvent input = autoChangePopup.showInfoPopup(); + NCPkgPopupTable * autoChangePopup = new NCPkgPopupTable( wpos( 3, 8), this ); + NCursesEvent input = autoChangePopup->showInfoPopup(); + + YDialog::deleteTopmostDialog(); if ( input == NCursesEvent::cancel ) { @@ -2372,14 +2381,16 @@ if ( message != "" ) { // open the popup e.g. with the text "/usr needs 50 MB more disk space" - NCPopupInfo spaceMsg( wpos( (NCurses::lines()-10)/2, (NCurses::cols()-50)/2 ), - YCPString( NCPkgNames::ErrorLabel() ), - YCPString( NCPkgNames::DiskSpaceError() + "<br>" + message ), - NCPkgNames::OKLabel(), - NCPkgNames::CancelLabel() ); + NCPopupInfo * spaceMsg = new NCPopupInfo( wpos( (NCurses::lines()-10)/2, (NCurses::cols()-50)/2 ), + YCPString( NCPkgNames::ErrorLabel() ), + YCPString( NCPkgNames::DiskSpaceError() + "<br>" + message ), + NCPkgNames::OKLabel(), + NCPkgNames::CancelLabel() ); - spaceMsg.setNiceSize( 50, 10 ); - NCursesEvent input = spaceMsg.showInfoPopup( ); + spaceMsg->setNiceSize( 50, 10 ); + NCursesEvent input = spaceMsg->showInfoPopup( ); + + YDialog::deleteTopmostDialog(); if ( input == NCursesEvent::cancel ) { @@ -2479,14 +2490,15 @@ bool ok = true; string pkgName = slbPtr->name(); - NCPopupInfo info( wpos( NCurses::lines()/10, NCurses::cols()/10), - NCPkgNames::NotifyLabel(), - YCPString( "<i>" + pkgName + "</i><br><br>" + createDescrText( licenseText ) ), - NCPkgNames::AcceptLabel(), - NCPkgNames::CancelLabel() ); - info.setNiceSize( (NCurses::cols() * 80)/100, (NCurses::lines()*80)/100); - license_confirmed = info.showInfoPopup( ) != NCursesEvent::cancel; + NCPopupInfo * info = new NCPopupInfo ( wpos( NCurses::lines()/10, NCurses::cols()/10), + NCPkgNames::NotifyLabel(), + YCPString( "<i>" + pkgName + "</i><br><br>" + + createDescrText( licenseText ) ), + NCPkgNames::AcceptLabel(), + NCPkgNames::CancelLabel() ); + info->setNiceSize( (NCurses::cols() * 80)/100, (NCurses::lines()*80)/100); + license_confirmed = info->showInfoPopup( ) != NCursesEvent::cancel; if ( !license_confirmed ) { @@ -2514,6 +2526,8 @@ ok = true; } + YDialog::deleteTopmostDialog(); + return ok; } @@ -2627,10 +2641,12 @@ bool ok = false; bool cancel = false; - NCPopupInfo info( wpos( (NCurses::lines()-5)/2, (NCurses::cols()-30)/2 ), YCPString( "" ), - YCPString(_( "System dependencies verify OK." )), - NCPkgNames::OKLabel() ); - info.setNiceSize( 30, 5 ); + NCPopupInfo * info = new NCPopupInfo( wpos( (NCurses::lines()-5)/2, (NCurses::cols()-30)/2 ), + YCPString( "" ), + YCPString(_( "System dependencies verify OK." )), + NCPkgNames::OKLabel() + ); + info->setNiceSize( 30, 5 ); NCMIL << "Verifying system" << endl; @@ -2639,10 +2655,13 @@ saveState(); //call the solver (with S_Verify it displays no popup) cancel = depsPopup->showDependencies( NCPkgPopupDeps::S_Verify, &ok ); - //display the popup with automatic changes - NCPkgPopupTable autoChangePopup( wpos( 3, 8 ), this ); - NCursesEvent input = autoChangePopup.showInfoPopup(); + //display the popup with automatic changes + NCPkgPopupTable * autoChangePopup = new NCPkgPopupTable( wpos( 3, 8 ), this ); + NCursesEvent input = autoChangePopup->showInfoPopup(); + + YDialog::deleteTopmostDialog(); + if ( input == NCursesEvent::cancel ) { // user clicked on Cancel @@ -2652,9 +2671,12 @@ if ( ok && input == NCursesEvent::button ) { // dependencies OK, no automatic changes/the user has accepted the changes - info.showInfoPopup(); + info->showInfoPopup(); } } + + YDialog::deleteTopmostDialog(); // delete NCPopupInfo dialog + return cancel; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org