Skip to content

Commit

Permalink
Renamed grossly misnamed function toggleStatus() to cycleStatus()
Browse files Browse the repository at this point in the history
  • Loading branch information
shundhammer committed Feb 6, 2020
1 parent 136d609 commit 077001e
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 36 deletions.
5 changes: 3 additions & 2 deletions src/NCPkgFilterLocale.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ void NCPkgLocaleTable::showLocalePackages()
packageList->showInformation();
}

void NCPkgLocaleTable::toggleStatus()

void NCPkgLocaleTable::cycleStatus()
{
int index = getCurrentItem();
zypp::sat::LocaleSupport myLocale = getLocale( index );
Expand Down Expand Up @@ -236,7 +237,7 @@ NCursesEvent NCPkgLocaleTable::wHandleInput( wint_t ch )
case KEY_SPACE:
case KEY_RETURN:
ret = NCursesEvent::handled;
toggleStatus();
cycleStatus();
showLocalePackages();
break;

Expand Down
2 changes: 1 addition & 1 deletion src/NCPkgFilterLocale.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class NCPkgLocaleTable : public NCTable
NCPkgLocaleTag* getTag (const int & index );
zypp::sat::LocaleSupport getLocale( int index );
std::string status( zypp::Locale lang );
void toggleStatus();
void cycleStatus();
NCursesEvent wHandleInput( wint_t ch );
};

Expand Down
4 changes: 2 additions & 2 deletions src/NCPkgMenuAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void NCPkgMenuAction::createLayout()
{
// Please note: add an appropriate number of whitespaces to get a well
// formated menu (the [ ]s should be in one column) and use unique hotkeys until end:
// begin: Actions menu, toggle the status of a package, e.g. change from installed to delete
// begin: Actions menu, cycle the status of a package, e.g. change from installed to delete
toggleItem = new YMenuItem( _( "&Toggle [SPACE]" ) );
installItem = new YMenuItem( _( "&Install [+]" ) );
deleteItem = new YMenuItem( _( "&Delete [-]" ) );
Expand Down Expand Up @@ -128,7 +128,7 @@ bool NCPkgMenuAction::handleEvent ( const NCursesEvent & event)

if (event.selection == toggleItem)
{
pkgList->toggleObjStatus();
pkgList->cycleObjStatus();
}
else if (event.selection == installItem)
{
Expand Down
12 changes: 6 additions & 6 deletions src/NCPkgStatusStrategy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ bool NCPkgStatusStrategy::keyToStatus( const int & key,
//
// The function return value is 'true' if ok, 'false' if not.
//
bool NCPkgStatusStrategy::toggleStatus( ZyppSel slbPtr,
ZyppObj objPtr,
ZyppStatus & newStat_ret )
bool NCPkgStatusStrategy::cycleStatus( ZyppSel slbPtr,
ZyppObj objPtr,
ZyppStatus & newStat_ret )
{
if ( !slbPtr )
return false;
Expand Down Expand Up @@ -456,9 +456,9 @@ bool PatchStatStrategy::keyToStatus( const int & key,
//
// The function return value is 'true' if ok, 'false' if not.
//
bool PatchStatStrategy::toggleStatus( ZyppSel slbPtr,
ZyppObj objPtr,
ZyppStatus & newStat_ret )
bool PatchStatStrategy::cycleStatus( ZyppSel slbPtr,
ZyppObj objPtr,
ZyppStatus & newStat_ret )
{
if ( !slbPtr || !slbPtr->hasCandidateObj() )
return false;
Expand Down
32 changes: 14 additions & 18 deletions src/NCPkgStatusStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,20 @@ class NCPkgStatusStrategy
ZyppStatus & newStat );

/**
* Toggles the package status (e.g. from installed to delete)
* @param The object pointer
* @return bool
* Cyle the package status (e.g. from installed to delete)
*/
virtual bool toggleStatus( ZyppSel slbPtr,
ZyppObj objPtr,
ZyppStatus & newStat );
/**
* Do a "small" solver run for all "resolvable collections", i.e., for
* selections, patterns, languages, patches.
**/
void solveResolvableCollections();

virtual bool cycleStatus( ZyppSel slbPtr,
ZyppObj objPtr,
ZyppStatus & newStat_ret );
/**
* Do a "small" solver run for all "resolvable collections", i.e., for
* selections, patterns, languages, patches.
**/
void solveResolvableCollections();

};


//------------------------------------------------------------
// Class for strategies to handle status of packages
//------------------------------------------------------------
Expand Down Expand Up @@ -218,13 +216,11 @@ class PatchStatStrategy : public NCPkgStatusStrategy
ZyppStatus & newStat );

/**
* Toggles the patch status (e.g. from selected to unselected)
* @param The object pointer
* @return bool
* Cycle the patch status (e.g. from selected to unselected)
*/
virtual bool toggleStatus( ZyppSel slbPtr,
ZyppObj objPtr,
ZyppStatus & newStat );
virtual bool cycleStatus( ZyppSel slbPtr,
ZyppObj objPtr,
ZyppStatus & newStat_ret );

/**
* Sets the status of the patch AND the status of the patch packages
Expand Down
10 changes: 4 additions & 6 deletions src/NCPkgTable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -776,17 +776,15 @@ NCursesEvent NCPkgTable::wHandleInput( wint_t key )
case KEY_PPAGE:
case KEY_END:
case KEY_HOME:
// show the corresponding information
showInformation();
break;

case KEY_SPACE:
case KEY_RETURN:
// toggle status
toggleObjStatus();
cycleObjStatus();
break;

// from the parent class, to enable sorting
// Inherited from the parent class to enable sorting
case CTRL('o'):
NCTable::wHandleInput( key);
break;
Expand Down Expand Up @@ -904,7 +902,7 @@ bool NCPkgTable::SourceInstall( bool install )
#endif


bool NCPkgTable::toggleObjStatus()
bool NCPkgTable::cycleObjStatus()
{
ZyppSel slbPtr = getSelPointer( getCurrentItem() );
ZyppObj objPtr = getDataPointer( getCurrentItem() );
Expand All @@ -914,7 +912,7 @@ bool NCPkgTable::toggleObjStatus()

ZyppStatus newStatus;

bool ok = statusStrategy->toggleStatus( slbPtr, objPtr, newStatus );
bool ok = statusStrategy->cycleStatus( slbPtr, objPtr, newStatus );

if ( ok )
{
Expand Down
2 changes: 1 addition & 1 deletion src/NCPkgTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class NCPkgTable : public NCTable

bool changeListObjStatus( NCPkgTableListAction key );

bool toggleObjStatus();
bool cycleObjStatus();

/**
* Set the status information if status has changed
Expand Down

0 comments on commit 077001e

Please sign in to comment.