Hello community, here is the log from the commit of package yast2-ncurses-pkg checked in at Sat May 31 12:15:25 CEST 2008. -------- --- yast2-ncurses-pkg/yast2-ncurses-pkg.changes 2008-05-21 12:28:28.000000000 +0200 +++ /mounts/work_src_done/STABLE/yast2-ncurses-pkg/yast2-ncurses-pkg.changes 2008-05-29 10:14:53.000000000 +0200 @@ -1,0 +2,15 @@ +Thu May 29 10:12:08 CEST 2008 - gs@suse.de + +- Show the status of a language pattern and make installation + possible (bnc #389722) +- 2.16.13 + +------------------------------------------------------------------- +Wed May 28 15:55:28 CEST 2008 - kmachalkova@suse.cz + +- Do not create pop-up dialogs on the stack (disk space, deps), this + may lead to segfault (bnc#384471) and/or the latest pop-up being + always on the top (bnc#384467) +- 2.16.12 + +------------------------------------------------------------------- Old: ---- yast2-ncurses-pkg-2.16.11.tar.bz2 New: ---- yast2-ncurses-pkg-2.16.13.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-ncurses-pkg.spec ++++++ --- /var/tmp/diff_new_pack.H12496/_old 2008-05-31 12:15:14.000000000 +0200 +++ /var/tmp/diff_new_pack.H12496/_new 2008-05-31 12:15:14.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package yast2-ncurses-pkg (Version 2.16.11) +# spec file for package yast2-ncurses-pkg (Version 2.16.13) # # Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -12,12 +12,12 @@ Name: yast2-ncurses-pkg -Version: 2.16.11 +Version: 2.16.13 Release: 1 License: GPL v2 or later Group: System/YaST BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source0: yast2-ncurses-pkg-2.16.11.tar.bz2 +Source0: yast2-ncurses-pkg-2.16.13.tar.bz2 Prefix: /usr BuildRequires: dejagnu doxygen gcc-c++ yast2-core-devel yast2-devtools BuildRequires: blocxx-devel libxcrypt-devel ncurses-devel yast2-ncurses-devel @@ -38,7 +38,7 @@ %prep -%setup -n yast2-ncurses-pkg-2.16.11 +%setup -n yast2-ncurses-pkg-2.16.13 %build %{prefix}/bin/y2tool y2autoconf @@ -68,6 +68,15 @@ %{_libdir}/YaST2/plugin/libpy2ncurses_pkg.so %doc %{prefix}/share/doc/packages/yast2-ncurses-pkg %changelog +* Thu May 29 2008 gs@suse.de +- Show the status of a language pattern and make installation + possible (bnc #389722) +- 2.16.13 +* Wed May 28 2008 kmachalkova@suse.cz +- Do not create pop-up dialogs on the stack (disk space, deps), this + may lead to segfault (bnc#384471) and/or the latest pop-up being + always on the top (bnc#384467) +- 2.16.12 * Wed May 21 2008 gs@suse.de - YOU: correct condition for unneeded patches - 2.16.11 ++++++ yast2-ncurses-pkg-2.16.11.tar.bz2 -> yast2-ncurses-pkg-2.16.13.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-pkg-2.16.11/configure new/yast2-ncurses-pkg-2.16.13/configure --- old/yast2-ncurses-pkg-2.16.11/configure 2008-05-21 10:50:12.000000000 +0200 +++ new/yast2-ncurses-pkg-2.16.13/configure 2008-05-29 10:22:35.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for yast2-ncurses-pkg 2.16.11. +# Generated by GNU Autoconf 2.61 for yast2-ncurses-pkg 2.16.13. # # Report bugs to <http://bugs.opensuse.org/>. # @@ -728,8 +728,8 @@ # Identity of this package. PACKAGE_NAME='yast2-ncurses-pkg' PACKAGE_TARNAME='yast2-ncurses-pkg' -PACKAGE_VERSION='2.16.11' -PACKAGE_STRING='yast2-ncurses-pkg 2.16.11' +PACKAGE_VERSION='2.16.13' +PACKAGE_STRING='yast2-ncurses-pkg 2.16.13' PACKAGE_BUGREPORT='http://bugs.opensuse.org/' ac_unique_file="RPMNAME" @@ -1439,7 +1439,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures yast2-ncurses-pkg 2.16.11 to adapt to many kinds of systems. +\`configure' configures yast2-ncurses-pkg 2.16.13 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1510,7 +1510,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of yast2-ncurses-pkg 2.16.11:";; + short | recursive ) echo "Configuration of yast2-ncurses-pkg 2.16.13:";; esac cat <<\_ACEOF @@ -1619,7 +1619,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -yast2-ncurses-pkg configure 2.16.11 +yast2-ncurses-pkg configure 2.16.13 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1633,7 +1633,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by yast2-ncurses-pkg $as_me 2.16.11, which was +It was created by yast2-ncurses-pkg $as_me 2.16.13, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2454,7 +2454,7 @@ # Define the identity of the package. PACKAGE='yast2-ncurses-pkg' - VERSION='2.16.11' + VERSION='2.16.13' cat >>confdefs.h <<_ACEOF @@ -2682,7 +2682,7 @@ -VERSION="2.16.11" +VERSION="2.16.13" RPMNAME="yast2-ncurses-pkg" MAINTAINER="Katarina Machalkova <kmachalkova@suse.cz>" @@ -21213,7 +21213,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by yast2-ncurses-pkg $as_me 2.16.11, which was +This file was extended by yast2-ncurses-pkg $as_me 2.16.13, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21266,7 +21266,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -yast2-ncurses-pkg config.status 2.16.11 +yast2-ncurses-pkg config.status 2.16.13 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-pkg-2.16.11/configure.in new/yast2-ncurses-pkg-2.16.13/configure.in --- old/yast2-ncurses-pkg-2.16.11/configure.in 2008-05-21 10:50:03.000000000 +0200 +++ new/yast2-ncurses-pkg-2.16.13/configure.in 2008-05-29 10:22:26.000000000 +0200 @@ -3,7 +3,7 @@ dnl -- This file is generated by y2autoconf 2.16.8 - DO NOT EDIT! -- dnl (edit configure.in.in instead) -AC_INIT(yast2-ncurses-pkg, 2.16.11, http://bugs.opensuse.org/, yast2-ncurses-pkg) +AC_INIT(yast2-ncurses-pkg, 2.16.13, http://bugs.opensuse.org/, yast2-ncurses-pkg) dnl Check for presence of file 'RPMNAME' AC_CONFIG_SRCDIR([RPMNAME]) @@ -18,7 +18,7 @@ AM_INIT_AUTOMAKE(tar-ustar -Wno-portability) dnl Important YaST2 variables -VERSION="2.16.11" +VERSION="2.16.13" RPMNAME="yast2-ncurses-pkg" MAINTAINER="Katarina Machalkova <kmachalkova@suse.cz>" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-pkg-2.16.11/src/NCPackageSelector.cc new/yast2-ncurses-pkg-2.16.13/src/NCPackageSelector.cc --- old/yast2-ncurses-pkg-2.16.11/src/NCPackageSelector.cc 2008-05-21 10:26:42.000000000 +0200 +++ new/yast2-ncurses-pkg-2.16.13/src/NCPackageSelector.cc 2008-05-29 09:02:23.000000000 +0200 @@ -124,8 +124,8 @@ testMode = true; saveState (); + diskspacePopup = new NCPkgDiskspace( testMode ); - // The creation of the popups is moved to createPopups() } @@ -140,33 +140,27 @@ // NCPackageSelectorPlugin::runPkgSelection } -/////////////////////////////////////////////////////////////////// -// -// createPopups() -// -// Create popups -// -// 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() +bool NCPackageSelector::checkNow( bool *ok ) { - // Patterns, Languages, Repositories, RPM Groups and Search filter are part of NCPkgFilterMain. - // NCPkgFilterPattern, NCPkgLocaleTable, NCPkgRepoTable, NCPkgFilterRPMGroups and - // NCPkgFilterSearch are created in NCPackageSelector::replaceFilter. + bool ret = false; - // the dependency popup depsPopup = new NCPkgPopupDeps( wpos( 3, 8 ), this ); - - // the disk space popup - diskspacePopup = new NCPkgPopupDiskspace( wpos( (NCurses::lines() - 15)/2, NCurses::cols()/6 ), testMode ); + ret = depsPopup->showDependencies( NCPkgPopupDeps::S_Solve, ok ); + YDialog::deleteTopmostDialog(); + return ret; } +bool NCPackageSelector::verifySystem( bool *ok ) +{ + bool ret = false; -/////////////////////////////////////////////////////////////////// + depsPopup = new NCPkgPopupDeps( wpos( 3, 8 ), this ); + ret = depsPopup->showDependencies( NCPkgPopupDeps::S_Verify, ok ); + YDialog::deleteTopmostDialog(); + return ret; +} + +////////////////////////////////////////////////////////////////// // // detection whether the user has made any changes // @@ -1246,11 +1240,10 @@ bool ok = false; bool cancel = false; - if ( depsPopup - && (doit || autoCheck) ) + if ( doit || autoCheck ) { yuiMilestone() << "Checking dependencies" << endl; - cancel = depsPopup->showDependencies( NCPkgPopupDeps::S_Solve, &ok ); + cancel = checkNow( & ok ); } return cancel; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-pkg-2.16.11/src/NCPackageSelector.h new/yast2-ncurses-pkg-2.16.13/src/NCPackageSelector.h --- old/yast2-ncurses-pkg-2.16.11/src/NCPackageSelector.h 2008-05-06 17:07:07.000000000 +0200 +++ new/yast2-ncurses-pkg-2.16.13/src/NCPackageSelector.h 2008-05-29 09:02:23.000000000 +0200 @@ -55,7 +55,7 @@ class NCPkgRepoTable; class LangCode; class NCPkgPopupDeps; -class NCPkgPopupDiskspace; +class NCPkgDiskspace; class NCPkgFilterRPMGroups; class NCPkgFilterSearch; class NCPkgPopupFile; @@ -111,7 +111,7 @@ NCPkgLocaleTable * languagePopup; // language popup NCPkgRepoTable * repoPopup; - NCPkgPopupDiskspace * diskspacePopup; // the popup showing the disk usage + NCPkgDiskspace * diskspacePopup; // the popup showing the disk usage NCPkgFilterSearch * searchPopup; // the package search popup @@ -191,12 +191,6 @@ virtual ~NCPackageSelector(); /** - * Create all NCPkgPopus - * @return void - */ - void createPopups(); - - /** * Create layout for the PackageSelector * @param parent Parent is PackageSelectorStart * @param type The package table type @@ -214,7 +208,7 @@ // returns the package table widget NCPkgTable * PackageList(); NCPkgPopupDeps *DepsPopup() { return depsPopup; } - NCPkgPopupDiskspace *diskSpacePopup() { return diskspacePopup; } + NCPkgDiskspace *diskSpacePopup() { return diskspacePopup; } YLabel *PackageLabel() { return packageLabel; } YLabel *PatternLabel() { return patternLabel; } @@ -232,9 +226,8 @@ NCPkgSearchSettings *SearchSettings() { return searchSet; } void setSearchButton( NCPushButton *pb ) { searchButton = pb; } - bool checkNow( bool *ok ) { return depsPopup->showDependencies( NCPkgPopupDeps::S_Solve, ok ); } - - bool verifySystem( bool *ok ) { return depsPopup->showDependencies( NCPkgPopupDeps::S_Verify, ok ); } + bool checkNow( bool *ok ); + bool verifySystem( bool *ok ); /** * Fills the package table with YOU patches matching the filter diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-pkg-2.16.11/src/NCPackageSelectorStart.cc new/yast2-ncurses-pkg-2.16.13/src/NCPackageSelectorStart.cc --- old/yast2-ncurses-pkg-2.16.11/src/NCPackageSelectorStart.cc 2008-05-20 11:42:59.000000000 +0200 +++ new/yast2-ncurses-pkg-2.16.13/src/NCPackageSelectorStart.cc 2008-05-29 09:02:23.000000000 +0200 @@ -131,9 +131,6 @@ if ( packager ) { - // create the NCPkgPoups - packager->createPopups(); - // always do an initial dependency solving - BEFORE filling the default list packager->showPackageDependencies( true ); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-pkg-2.16.11/src/NCPkgFilterLocale.cc new/yast2-ncurses-pkg-2.16.13/src/NCPkgFilterLocale.cc --- old/yast2-ncurses-pkg-2.16.11/src/NCPkgFilterLocale.cc 2008-04-29 12:43:26.000000000 +0200 +++ new/yast2-ncurses-pkg-2.16.13/src/NCPkgFilterLocale.cc 2008-05-29 10:00:38.000000000 +0200 @@ -20,8 +20,8 @@ #include "NCPkgFilterLocale.h" -NCPkgLocaleTag::NCPkgLocaleTag ( zypp::sat::LocaleSupport loc) - : YTableCell(string(" ")) +NCPkgLocaleTag::NCPkgLocaleTag ( zypp::sat::LocaleSupport loc, string status ) + : YTableCell( status ) , locale ( loc ) { @@ -47,13 +47,13 @@ setHeader( header); } -void NCPkgLocaleTable::addLine ( zypp::sat::LocaleSupport l, const vector <string> & cols ) +void NCPkgLocaleTable::addLine ( zypp::sat::LocaleSupport l, const vector <string> & cols, string status ) { //use default ctor, add cell in the next step YTableItem *tabItem = new YTableItem(); //place tag (with repo reference) to the 0th column - tabItem->addCell( new NCPkgLocaleTag ( l ) ); + tabItem->addCell( new NCPkgLocaleTag ( l, status ) ); // and append the rest (name, URL and stuff) for ( unsigned i = 1; i < cols.size() + 1; ++i ) { @@ -66,6 +66,27 @@ } +string NCPkgLocaleTable::status( zypp::Locale lang ) +{ + ZyppStatus status; + + if ( zypp::getZYpp()->pool().isRequestedLocale( lang ) ) + status = S_Install; + else + status = S_NoInst; + + // convert ZyppStatus to string + switch ( status ) + { + case S_NoInst: + return " "; + case S_Install: + return " :-)"; + default: + return "####"; + } +} + void NCPkgLocaleTable::fillLocaleList() { vector <string> oneLine; @@ -77,7 +98,7 @@ zypp::sat::LocaleSupport myLocale( *it ); oneLine.push_back( myLocale.locale().code() ); oneLine.push_back( myLocale.locale().name() ); - addLine( myLocale, oneLine); + addLine( myLocale, oneLine, status(*it) ); } myPad()->setOrder(1); @@ -127,6 +148,31 @@ packageList->showInformation(); } +void NCPkgLocaleTable::toggleStatus() +{ + int index = getCurrentItem(); + zypp::sat::LocaleSupport myLocale = getLocale( index ); + NCPkgLocaleTag * t = getTag ( index ); + NCTableLine *line = myPad()->ModifyLine( index ); + + if ( !t || !line ) + return; + + yuiMilestone() << "Toggle status of: " << myLocale.locale().code() << endl; + + if ( zypp::getZYpp()->pool().isRequestedLocale( myLocale.locale() ) ) + { + zypp::getZYpp()->pool().eraseRequestedLocale( myLocale.locale() ); + } + else + { + zypp::getZYpp()->pool().addRequestedLocale( myLocale.locale() ); + } + packager->showPackageDependencies( true ); + + cellChanged( index, 0, status( myLocale.locale() ) ); +} + NCursesEvent NCPkgLocaleTable::wHandleInput( wint_t ch ) { NCursesEvent ret = NCursesEvent::none; @@ -144,10 +190,17 @@ showLocalePackages(); break; } - + case KEY_SPACE: + case KEY_RETURN: { + ret = NCursesEvent::handled; + toggleStatus(); + showLocalePackages(); + break; + } + default: - ret = NCTable::wHandleInput( ch ) ; - } + ret = NCTable::wHandleInput( ch ) ; + } return ret; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-pkg-2.16.11/src/NCPkgFilterLocale.h new/yast2-ncurses-pkg-2.16.13/src/NCPkgFilterLocale.h --- old/yast2-ncurses-pkg-2.16.11/src/NCPkgFilterLocale.h 2008-04-29 12:43:26.000000000 +0200 +++ new/yast2-ncurses-pkg-2.16.13/src/NCPkgFilterLocale.h 2008-05-29 09:39:14.000000000 +0200 @@ -34,7 +34,7 @@ public: - NCPkgLocaleTag ( zypp::sat::LocaleSupport locale); + NCPkgLocaleTag ( zypp::sat::LocaleSupport locale, string status ); ~NCPkgLocaleTag() { }; @@ -57,12 +57,14 @@ virtual ~NCPkgLocaleTable() {}; void fillHeader(); - void addLine ( zypp::sat::LocaleSupport, const vector <string> & cols ); + void addLine ( zypp::sat::LocaleSupport, const vector <string> & cols, string status ); void fillLocaleList(); void showLocalePackages(); NCPkgLocaleTag* getTag (const int & index ); zypp::sat::LocaleSupport getLocale( int index ); + string status( zypp::Locale lang ); + void toggleStatus(); NCursesEvent wHandleInput( wint_t ch ); }; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-pkg-2.16.11/src/NCPkgMenuDeps.cc new/yast2-ncurses-pkg-2.16.13/src/NCPkgMenuDeps.cc --- old/yast2-ncurses-pkg-2.16.11/src/NCPkgMenuDeps.cc 2008-05-06 17:02:35.000000000 +0200 +++ new/yast2-ncurses-pkg-2.16.13/src/NCPkgMenuDeps.cc 2008-05-29 09:02:23.000000000 +0200 @@ -145,35 +145,31 @@ yuiMilestone() << "Verifying system" << endl; - if ( pkg->DepsPopup() ) + pkg->saveState(); + //call the solver (with S_Verify it displays no popup) + cancel = pkg->verifySystem ( &ok ); + + //display the popup with automatic changes + NCPkgPopupTable * autoChangePopup = new NCPkgPopupTable( wpos( 3, 8 ), pkg ); + NCursesEvent input = autoChangePopup->showInfoPopup(); + + if ( input == NCursesEvent::cancel ) { - pkg->saveState(); - //call the solver (with S_Verify it displays no popup) - //cancel = depsPopup->showDependencies( NCPkgPopupDeps::S_Verify, &ok ); - cancel = pkg->verifySystem ( &ok ); - - //display the popup with automatic changes - NCPkgPopupTable * autoChangePopup = new NCPkgPopupTable( wpos( 3, 8 ), pkg ); - NCursesEvent input = autoChangePopup->showInfoPopup(); - - if ( input == NCursesEvent::cancel ) - { - // user clicked on Cancel - pkg->restoreState(); - cancel = true; - } - if ( ok && input == NCursesEvent::button ) - { - // dependencies OK, no automatic changes/the user has accepted the changes - NCPopupInfo * info = new NCPopupInfo( wpos( (NCurses::lines()-5)/2, (NCurses::cols()-30)/2 ), - "", - _( "System dependencies verify OK." ), - NCPkgStrings::OKLabel() - ); - info->setNiceSize( 35, 5 ); - info->showInfoPopup(); - YDialog::deleteTopmostDialog(); - } + // user clicked on Cancel + pkg->restoreState(); + cancel = true; + } + if ( ok && input == NCursesEvent::button ) + { + // dependencies OK, no automatic changes/the user has accepted the changes + NCPopupInfo * info = new NCPopupInfo( wpos( (NCurses::lines()-5)/2, (NCurses::cols()-30)/2 ), + "", + _( "System dependencies verify OK." ), + NCPkgStrings::OKLabel() + ); + info->setNiceSize( 35, 5 ); + info->showInfoPopup(); + YDialog::deleteTopmostDialog(); } YDialog::deleteTopmostDialog(); // delete NCPopupInfo dialog diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-pkg-2.16.11/src/NCPkgMenuExtras.cc new/yast2-ncurses-pkg-2.16.13/src/NCPkgMenuExtras.cc --- old/yast2-ncurses-pkg-2.16.11/src/NCPkgMenuExtras.cc 2008-05-06 16:22:32.000000000 +0200 +++ new/yast2-ncurses-pkg-2.16.13/src/NCPkgMenuExtras.cc 2008-05-27 13:30:49.000000000 +0200 @@ -301,8 +301,7 @@ bool NCPkgMenuExtras::showDiskSpace() { - pkg->diskSpacePopup()->showInfoPopup( NCPkgStrings::DiskspaceLabel() ); - YDialog::deleteTopmostDialog(); + pkg->diskSpacePopup()->showInfoPopup( NCPkgStrings::DiskspaceLabel() ); //FIXME: move focus back to pkg table? return true; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-pkg-2.16.11/src/NCPkgPopupDiskspace.cc new/yast2-ncurses-pkg-2.16.13/src/NCPkgPopupDiskspace.cc --- old/yast2-ncurses-pkg-2.16.11/src/NCPkgPopupDiskspace.cc 2008-04-02 11:47:04.000000000 +0200 +++ new/yast2-ncurses-pkg-2.16.13/src/NCPkgPopupDiskspace.cc 2008-05-27 13:30:49.000000000 +0200 @@ -60,13 +60,10 @@ // // DESCRIPTION : // -NCPkgPopupDiskspace::NCPkgPopupDiskspace( const wpos at, bool testMode ) - : NCPopup( at, false ) - , partitions( 0 ) - , okButton( 0 ) - , testmode( testMode ) +NCPkgDiskspace::NCPkgDiskspace( bool testMode ) + : testmode( testMode ) + , popupWin( 0 ) { - createLayout( ); if ( testMode ) { @@ -84,38 +81,8 @@ // // DESCRIPTION : // -NCPkgPopupDiskspace::~NCPkgPopupDiskspace() -{ -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : NCPkgPopupDiskspace::createLayout -// METHOD TYPE : void -// -// DESCRIPTION : -// -void NCPkgPopupDiskspace::createLayout( ) +NCPkgDiskspace::~NCPkgDiskspace() { - // the vertical split is the (only) child of the dialog - NCLayoutBox * split = new NCLayoutBox( this, YD_VERT ); - - head = new NCLabel( split, "", true, false ); // isHeading = true - - YTableHeader * tableHeader = new YTableHeader(); - tableHeader->addColumn( NCPkgStrings::Partition(), YAlignBegin ); - tableHeader->addColumn( NCPkgStrings::UsedSpace(), YAlignBegin ); - tableHeader->addColumn( NCPkgStrings::FreeSpace(), YAlignBegin ); - tableHeader->addColumn( NCPkgStrings::TotalSpace(), YAlignBegin ); - tableHeader->addColumn( "% ", YAlignBegin ); - - // add the partition table - partitions = new NCTable( split, tableHeader ); - - // add the ok button - okButton = new NCPushButton( split, NCPkgStrings::OKLabel() ); - okButton->setFunctionKey( 10 ); } /////////////////////////////////////////////////////////////////// @@ -126,8 +93,9 @@ // // DESCRIPTION : // -void NCPkgPopupDiskspace::fillPartitionTable() +void NCPkgDiskspace::fillPartitionTable() { + NCTable * partitions = popupWin->Partitions(); partitions->deleteAllItems(); // clear table YTableItem * newItem; @@ -179,7 +147,7 @@ // // DESCRIPTION : // -string NCPkgPopupDiskspace::checkDiskSpace() +string NCPkgDiskspace::checkDiskSpace() { string text = ""; @@ -219,7 +187,7 @@ return text; } -void NCPkgPopupDiskspace::checkRemainingDiskSpace( const ZyppPartitionDu & partition ) +void NCPkgDiskspace::checkRemainingDiskSpace( const ZyppPartitionDu & partition ) { FSize usedSize ( partition.pkg_size, FSize::K ); FSize totalSize ( partition.total_size, FSize::K ); @@ -282,7 +250,7 @@ // DESCRIPTION : for testing only; called from PackageSelector // if running in testMode // -void NCPkgPopupDiskspace::setDiskSpace( wint_t ch ) +void NCPkgDiskspace::setDiskSpace( wint_t ch ) { int percent = 0; @@ -319,7 +287,7 @@ // // DESCRIPTION : // -void NCPkgPopupDiskspace::checkDiskSpaceRange( ) +void NCPkgDiskspace::checkDiskSpaceRange( ) { // see YQPkgDiskUsageList::updateDiskUsage() runningOutWarning.clear(); @@ -362,7 +330,7 @@ } -string NCPkgPopupDiskspace::usedPercent( FSize used, FSize total ) +string NCPkgDiskspace::usedPercent( FSize used, FSize total ) { int percent = 0; char percentStr[10]; @@ -383,23 +351,54 @@ // // DESCRIPTION : // -void NCPkgPopupDiskspace::showInfoPopup( string headline ) +void NCPkgDiskspace::showInfoPopup( string headline ) { - if ( head ) - head->setLabel( headline ); + popupWin = new NCPkgPopupDiskspace (wpos( (NCurses::lines() - 15)/2, NCurses::cols()/6 ), headline ); // update values in partition table fillPartitionTable(); - - postevent = NCursesEvent(); - do { - // show the popup - popupDialog( ); - } while ( postAgain() ); - - popdownDialog(); + popupWin->doit(); + YDialog::deleteTopmostDialog(); + } + + +NCPkgPopupDiskspace::NCPkgPopupDiskspace( const wpos at, string headline ) + : NCPopup( at, false ) + , partitions( 0 ) + , okButton( 0 ) + , head( 0 ) +{ + createLayout( headline ); +} + +NCPkgPopupDiskspace::~NCPkgPopupDiskspace() +{ } +void NCPkgPopupDiskspace::createLayout( string headline ) +{ + // the vertical split is the (only) child of the dialog + NCLayoutBox * split = new NCLayoutBox( this, YD_VERT ); + + head = new NCLabel( split, "", true, false ); // isHeading = true + head->setLabel( headline ); + + YTableHeader * tableHeader = new YTableHeader(); + tableHeader->addColumn( NCPkgStrings::Partition(), YAlignBegin ); + tableHeader->addColumn( NCPkgStrings::UsedSpace(), YAlignBegin ); + tableHeader->addColumn( NCPkgStrings::FreeSpace(), YAlignBegin ); + tableHeader->addColumn( NCPkgStrings::TotalSpace(), YAlignBegin ); + tableHeader->addColumn( "% ", YAlignBegin ); + + // add the partition table + partitions = new NCTable( split, tableHeader ); + + // add the ok button + okButton = new NCPushButton( split, NCPkgStrings::OKLabel() ); + okButton->setFunctionKey( 10 ); +} + + /////////////////////////////////////////////////////////////////// // // @@ -425,6 +424,17 @@ return NCurses::lines()-4; } +void NCPkgPopupDiskspace::doit() +{ + postevent = NCursesEvent(); + do { + // show the popup + popupDialog( ); + } while ( postAgain() ); + + popdownDialog(); + +} /////////////////////////////////////////////////////////////////// // // diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-pkg-2.16.11/src/NCPkgPopupDiskspace.h new/yast2-ncurses-pkg-2.16.13/src/NCPkgPopupDiskspace.h --- old/yast2-ncurses-pkg-2.16.11/src/NCPkgPopupDiskspace.h 2008-05-06 16:35:33.000000000 +0200 +++ new/yast2-ncurses-pkg-2.16.13/src/NCPkgPopupDiskspace.h 2008-05-27 13:30:49.000000000 +0200 @@ -132,6 +132,33 @@ bool _warningPosted; }; +class NCPkgPopupDiskspace : public NCPopup { + +private: + NCTable * partitions; + NCPushButton * okButton; + NCLabel * head; + +protected: + + virtual bool postAgain(); + + virtual NCursesEvent wHandleInput( wint_t ch ); + +public: + NCPkgPopupDiskspace( const wpos at, string headline ); + + virtual ~NCPkgPopupDiskspace(); + + void createLayout( string headline ); + void doit(); + + NCTable *Partitions() { return partitions; } + + virtual int preferredWidth(); + virtual int preferredHeight(); + +}; /////////////////////////////////////////////////////////////////// // @@ -139,17 +166,15 @@ // // DESCRIPTION : // -class NCPkgPopupDiskspace : public NCPopup { +class NCPkgDiskspace { - NCPkgPopupDiskspace & operator=( const NCPkgPopupDiskspace & ); - NCPkgPopupDiskspace ( const NCPkgPopupDiskspace & ); + NCPkgDiskspace & operator=( const NCPkgDiskspace & ); + NCPkgDiskspace ( const NCPkgDiskspace & ); private: - NCTable * partitions; - NCPushButton * okButton; - NCLabel * head; bool testmode; + NCPkgPopupDiskspace *popupWin; ZyppDuSet testDiskUsage; string usedPercent( FSize used, FSize total ); @@ -164,20 +189,13 @@ **/ NCPkgWarningRangeNotifier overflowWarning; -protected: - - virtual bool postAgain(); - - virtual NCursesEvent wHandleInput( wint_t ch ); - + public: - NCPkgPopupDiskspace( const wpos at, bool testSpaceMode ); + NCPkgDiskspace( bool testSpaceMode ); - virtual ~NCPkgPopupDiskspace(); + virtual ~NCPkgDiskspace(); - virtual int preferredWidth(); - virtual int preferredHeight(); void fillPartitionTable(); @@ -187,17 +205,12 @@ void checkDiskSpaceRange( ); - void createLayout( ); - void showInfoPopup( string headline ); - + void checkRemainingDiskSpace( const ZyppPartitionDu & partition ); }; - - - /////////////////////////////////////////////////////////////////// diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-pkg-2.16.11/VERSION new/yast2-ncurses-pkg-2.16.13/VERSION --- old/yast2-ncurses-pkg-2.16.11/VERSION 2008-05-21 10:36:56.000000000 +0200 +++ new/yast2-ncurses-pkg-2.16.13/VERSION 2008-05-29 10:11:59.000000000 +0200 @@ -1 +1 @@ -2.16.11 +2.16.13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de