Author: kmachalkova
Date: Thu Mar 13 17:49:18 2008
New Revision: 45441
URL: http://svn.opensuse.org/viewcvs/yast?rev=45441&view=rev
Log:
Some basic repository filter handling
Added:
branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupRepo.h
Modified:
branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.cc
branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.h
branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.cc
branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupRepo.cc
Modified: branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.cc?rev=45441&r1=45440&r2=45441&view=diff
==============================================================================
--- branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.cc (original)
+++ branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.cc Thu Mar 13 17:49:18 2008
@@ -227,7 +227,7 @@
//languagePopup = new NCPkgPopupSelection( wpos( 1,1 ), this, NCPkgPopupSelection::S_Language );
// create repository popup
- repoPopup = new NCPkgPopupRepo( wpos( 1,1), this );
+ //repoPopup = new NCPkgRepoTable( wpos( 1,1), this );
// create the filter popup
//filterPopup = new NCPkgPopupTree( wpos( 1, 1 ), this );
@@ -886,14 +886,14 @@
//and show the whole stuff to the user
pkgList->drawList();
- if ( repoPopup && packageLabel )
- {
- ZyppProduct product = repoPopup->findProductForRepo( repo );
- if ( product )
- {
- packageLabel->setLabel( product->summary() );
- }
- }
+ //if ( repoPopup && packageLabel
+ //{
+ // ZyppProduct product = repoPopup->findProductForRepo( repo );
+ // if ( product )
+ // {
+ // packageLabel->setLabel( product->summary() );
+ // }
+ //}
return true;
@@ -1218,6 +1218,7 @@
filterPopup = 0;
patternPopup = 0;
languagePopup = 0;
+ repoPopup = 0;
}
switch (mode)
@@ -1230,7 +1231,6 @@
patternPopup->Redraw();
patternPopup->showSelectionPopup();
//show the package description of the current item
- pkgList->showInformation ();
break;
}
case Languages:
@@ -1241,10 +1241,18 @@
languagePopup->Redraw();
languagePopup->showSelectionPopup();
//show the package description of the current item
- pkgList->showInformation ();
break;
}
-
+ case Repositories:
+ {
+ YTableHeader *hhh = new YTableHeader ();
+ repoPopup = new NCPkgRepoTable( replPoint, hhh, this );
+ repoPopup->setSize( oldSize.Sze.W, oldSize.Sze.H );
+ repoPopup->Redraw();
+ repoPopup->fillRepoList();
+ repoPopup->showRepoPopup();
+ break;
+ }
case RPMGroups:
{
filterPopup = new NCPkgPopupTree ( replPoint, " ", this);
@@ -1270,6 +1278,8 @@
default:
NCINT << "zatim nic" << endl;
}
+ pkgList->setCurrentItem(0);
+ pkgList->showInformation ();
}
///////////////////////////////////////////////////////////////////
Modified: branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.h?rev=45441&r1=45440&r2=45441&view=diff
==============================================================================
--- branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.h (original)
+++ branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.h Thu Mar 13 17:49:18 2008
@@ -51,7 +51,7 @@
#include "NCPkgSelMapper.h"
class NCPkgPopupSelection;
-class NCPkgPopupRepo;
+class NCPkgRepoTable;
class LangCode;
class NCPkgPopupDeps;
class NCPkgPopupDiskspace;
@@ -103,7 +103,7 @@
NCPkgPopupSelection * selectionPopup; // the selections popup
NCPkgPopupSelection * patternPopup; // the pattern popup
NCPkgPopupSelection * languagePopup; // language popup
- NCPkgPopupRepo * repoPopup;
+ NCPkgRepoTable * repoPopup;
NCPkgPopupDiskspace * diskspacePopup; // the popup showing the disk usage
Modified: branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.cc?rev=45441&r1=45440&r2=45441&view=diff
==============================================================================
--- branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.cc (original)
+++ branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.cc Thu Mar 13 17:49:18 2008
@@ -66,6 +66,8 @@
pkg->replaceFilter ( NCPackageSelector::Patterns );
else if ( currentItem == languages )
pkg->replaceFilter ( NCPackageSelector::Languages );
+ else if ( currentItem == repositories )
+ pkg->replaceFilter ( NCPackageSelector::Repositories );
else
NCINT << "zatim nic" << endl;
return true;
Modified: branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupRepo.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupRepo.cc?rev=45441&r1=45440&r2=45441&view=diff
==============================================================================
--- branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupRepo.cc (original)
+++ branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupRepo.cc Thu Mar 13 17:49:18 2008
@@ -52,8 +52,9 @@
// DESCRIPTION :
//
-NCPkgRepoTable::NCPkgRepoTable( YWidget *parent, YTableHeader *tableHeader )
+NCPkgRepoTable::NCPkgRepoTable( YWidget *parent, YTableHeader *tableHeader, NCPackageSelector *pkg )
:NCTable( parent, tableHeader )
+ ,packager(pkg)
{
fillHeader();
}
@@ -167,76 +168,76 @@
// DESCRIPTION :
//
-NCPkgPopupRepo::NCPkgPopupRepo (const wpos at, NCPackageSelector *pkg)
- : NCPopup (at, false)
- , repolist( 0 )
- , okButton( 0 )
- , packager( pkg )
-{
- createLayout( NCPkgNames::RepoLabel() );
-
- fillRepoList( );
-}
-
-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : NCPkgPopupRepo::~NCPkgPopupRepo
-// METHOD TYPE : Destructor
-//
-// DESCRIPTION :
-//
-
-NCPkgPopupRepo::~NCPkgPopupRepo()
-{
- //NOP
-}
-
-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : NCPkgPopupRepo::createLayout
-// METHOD TYPE : void
-//
-// DESCRIPTION : Create visual layout of the popup window
-// (header label, NCPkgRepoTable, OK button)
-//
-
-void NCPkgPopupRepo::createLayout( const string & label)
-{
-
- // the vertical split is the (only) child of the dialog
- NCLayoutBox * split = new NCLayoutBox( this, YD_VERT );
-
- //the headline
- new NCLabel( split, label, true, false );
-
- // the repositories table
- YTableHeader *tableHeader = new YTableHeader();
- repolist = new NCPkgRepoTable( split, tableHeader );
- repolist->fillHeader();
-
- new NCSpacing( split, YD_VERT, false, 0.4 );
-
- //the cute button
- okButton = new NCPushButton( split, NCPkgNames::OKLabel() );
- okButton->setFunctionKey(10);
-
- new NCSpacing( split, YD_VERT, false, 0.4 );
-
-}
-
-///////////////////////////////////////////////////////////////////
+//NCPkgPopupRepo::NCPkgPopupRepo (YWidget *parent, YTableHeader *header, NCPackageSelector *pkg)
+// : NCPkgRepoTable ( parent, header )
+// //, repolist( 0 )
+// //, okButton( 0 )
+// , packager( pkg )
+//{
+// createLayout( parent );
+//
+// fillRepoList( );
+//}
+//
+/////////////////////////////////////////////////////////////////////
+////
+////
+//// METHOD NAME : NCPkgPopupRepo::~NCPkgPopupRepo
+//// METHOD TYPE : Destructor
+////
+//// DESCRIPTION :
+////
+//
+//NCPkgPopupRepo::~NCPkgPopupRepo()
+//{
+// //NOP
+//}
+//
+/////////////////////////////////////////////////////////////////////
+////
+////
+//// METHOD NAME : NCPkgPopupRepo::createLayout
+//// METHOD TYPE : void
+////
+//// DESCRIPTION : Create visual layout of the popup window
+//// (header label, NCPkgRepoTable, OK button)
+////
+//
+//void NCPkgPopupRepo::createLayout( YWidget *parent )
+//{
+//
+// // the vertical split is the (only) child of the dialog
+// // NCLayoutBox * split = new NCLayoutBox( this, YD_VERT );
+//
+// //the headline
+// //new NCLabel( split, label, true, false );
+//
+// // the repositories table
+// //YTableHeader *tableHeader = new YTableHeader();
+// //repolist = new NCPkgRepoTable( parent, tableHeader );
+// //repolist->fillHeader();
+//
+// //new NCSpacing( split, YD_VERT, false, 0.4 );
+//
+// ////the cute button
+// //okButton = new NCPushButton( split, NCPkgNames::OKLabel() );
+// //okButton->setFunctionKey(10);
+//
+// //new NCSpacing( split, YD_VERT, false, 0.4 );
+//
+//}
+//
+/////////////////////////////////////////////////////////////////////
+////
+////
+//// METHOD NAME : NCPkgPopupRepo::fillRepoList
+//// METHOD TYPE : bool
+////
+//// DESCRIPTION : Add items to the repository list (assoc.
+//// product name, if any, and URL)
+////
//
-//
-// METHOD NAME : NCPkgPopupRepo::fillRepoList
-// METHOD TYPE : bool
-//
-// DESCRIPTION : Add items to the repository list (assoc.
-// product name, if any, and URL)
-//
-
-bool NCPkgPopupRepo::fillRepoList()
+bool NCPkgRepoTable::fillRepoList()
{
NCMIL << "Filling repository list" << endl;
@@ -267,7 +268,7 @@
oneLine.push_back( srcUrl.asString() );
//add the whole stuff to the table
- repolist->addLine( (*it), oneLine);
+ addLine( (*it), oneLine);
}
return true;
@@ -283,7 +284,7 @@
// (null product if multiple products found)
//
-ZyppProduct NCPkgPopupRepo::findProductForRepo( ZyppRepo repo)
+ZyppProduct NCPkgRepoTable::findProductForRepo( ZyppRepo repo)
{
ZyppProduct product;
@@ -330,19 +331,19 @@
// DESCRIPTION : default boring setting nice size
//
-int NCPkgPopupRepo::preferredWidth()
-{
- return NCurses::cols()*2/3;
-}
-
-int NCPkgPopupRepo::preferredHeight()
-{
- if ( NCurses::lines() > 20 )
- return 20;
- else
- return NCurses::lines()-4;
-}
-
+////int NCPkgPopupRepo::preferredWidth()
+////{
+//// return NCurses::cols()*2/3;
+////}
+////
+////int NCPkgPopupRepo::preferredHeight()
+////{
+//// if ( NCurses::lines() > 20 )
+//// return 20;
+//// else
+//// return NCurses::lines()-4;
+////}
+//
///////////////////////////////////////////////////////////////////
//
//
@@ -352,12 +353,12 @@
// DESCRIPTION : default boring handle-input
//
-NCursesEvent NCPkgPopupRepo::wHandleInput( wint_t ch )
+NCursesEvent NCPkgRepoTable::wHandleInput( wint_t ch )
{
- if ( ch == 27 ) // ESC
- return NCursesEvent::cancel;
+ //if ( ch == 27 ) // ESC
+ // return NCursesEvent::cancel;
- return NCDialog::wHandleInput( ch );
+ return NCTable::wHandleInput( ch );
}
///////////////////////////////////////////////////////////////////
@@ -369,25 +370,25 @@
// DESCRIPTION : default boring postAgain
//
-bool NCPkgPopupRepo::postAgain()
-{
- if( !postevent.widget )
- return false;
-
- postevent.detail = NCursesEvent::NODETAIL;
-
- if ( postevent.widget == okButton )
- {
- postevent.detail = NCursesEvent::USERDEF ;
- // return false means: close the popup
- return false;
- }
-
- if (postevent == NCursesEvent::cancel)
- return false;
-
- return true;
-}
+//bool NCPkgPopupRepo::postAgain()
+//{
+// if( !postevent.widget )
+// return false;
+//
+// postevent.detail = NCursesEvent::NODETAIL;
+//
+// if ( postevent.widget == okButton )
+// {
+// postevent.detail = NCursesEvent::USERDEF ;
+// // return false means: close the popup
+// return false;
+// }
+//
+// if (postevent == NCursesEvent::cancel)
+// return false;
+//
+// return true;
+//}
///////////////////////////////////////////////////////////////////
//
@@ -400,30 +401,31 @@
// (calls NCPackageSelector::fillRepoFilterList)
//
-NCursesEvent & NCPkgPopupRepo::showRepoPopup()
+bool NCPkgRepoTable::showRepoPopup()
{
- postevent = NCursesEvent();
-
- if (!repolist)
- return postevent;
-
- do {
- popupDialog();
- } while ( postAgain() );
-
- popdownDialog();
+// postevent = NCursesEvent();
+//
+// if (!repolist)
+// return postevent;
+//
+// do {
+// popupDialog();
+// } while ( postAgain() );
+//
+// popdownDialog();
- if ( postevent.detail == NCursesEvent::USERDEF )
- {
+// if ( postevent.detail == NCursesEvent::USERDEF )
+// {
//get current table line and its repository reference
- int index = repolist->getCurrentItem();
- ZyppRepo repo = repolist->getRepo( index );
+ int index = getCurrentItem();
+ ZyppRepo repo = getRepo( index );
NCMIL << "Selected repository " << repo.info().alias().c_str() << endl;
//and show associated packages to the user
packager->fillRepoFilterList( repo );
- }
- return postevent;
+// }
+// return postevent;
+ return true;
}
Added: branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupRepo.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupRepo.h?rev=45441&view=auto
==============================================================================
--- branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupRepo.h (added)
+++ branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupRepo.h Thu Mar 13 17:49:18 2008
@@ -0,0 +1,181 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: NCPkgPopupRepo.h
+
+ Author: Bubli