libyui-ncurses-pkg  2.50.8
NCPkgFilterMain.cc
1 /****************************************************************************
2 |
3 | Copyright (c) [2002-2011] Novell, Inc.
4 | All Rights Reserved.
5 |
6 | This program is free software; you can redistribute it and/or
7 | modify it under the terms of version 2 of the GNU General Public License as
8 | published by the Free Software Foundation.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, contact Novell, Inc.
17 |
18 | To contact Novell about this file by physical or electronic mail,
19 | you may find current contact information at www.novell.com
20 |
21 |***************************************************************************/
22 
23 
24 /*---------------------------------------------------------------------\
25 | |
26 | __ __ ____ _____ ____ |
27 | \ \ / /_ _/ ___|_ _|___ \ |
28 | \ V / _` \___ \ | | __) | |
29 | | | (_| |___) || | / __/ |
30 | |_|\__,_|____/ |_| |_____| |
31 | |
32 | core system |
33 | (C) SuSE GmbH |
34 \----------------------------------------------------------------------/
35 
36  File: NCPkgFilterMain.cc
37 
38  Author: Hedgehog Painter <kmachalkova@suse.cz>
39 
40 /-*/
41 
42 #define YUILogComponent "ncurses-pkg"
43 #include <YUILog.h>
44 
45 #include "NCPkgFilterMain.h"
46 #include "NCPkgFilterService.h"
47 
48 using std::endl;
49 
50 /*
51  Textdomain "ncurses-pkg"
52 */
53 
54 NCPkgFilterMain::NCPkgFilterMain (YWidget *parent, std::string label, NCPackageSelector *pkger )
55  :NCComboBox(parent, label, false)
56  , pkg (pkger)
57 {
58  createLayout();
59  setNotify( true );
60 }
61 
62 NCPkgFilterMain::~NCPkgFilterMain()
63 {
64 
65 }
66 
67 void NCPkgFilterMain::createLayout()
68 {
69  patterns = new YItem( _( "Patterns" ) );
70  items.push_back( patterns );
71 
72  languages = new YItem( _( "Languages" ) );
73  items.push_back( languages );
74 
75  repositories = new YItem( _( "Repositories" ) );
76  items.push_back( repositories );
77 
79  {
80  services = new YItem( _( "Services" ) );
81  items.push_back( services );
82  }
83 
84  search = new YItem( _( "Search" ) );
85  search->setSelected();
86  items.push_back( search );
87 
88  inst_summary = new YItem( _( "Installation Summary" ) );
89  items.push_back( inst_summary );
90 
91  pkg_class = new YItem( _( "Package Classification" ) );
92  items.push_back( pkg_class );
93 
94  addItems( items );
95 
96 }
97 
98 bool NCPkgFilterMain::handleEvent()
99 {
100 
101  YItem *currentItem = selectedItem();
102 
103  if ( currentItem == patterns )
104  pkg->replaceFilter ( NCPackageSelector::Patterns );
105  else if ( currentItem == languages )
106  pkg->replaceFilter ( NCPackageSelector::Languages );
107  else if ( currentItem == repositories )
108  pkg->replaceFilter ( NCPackageSelector::Repositories );
109  else if ( currentItem == services )
110  pkg->replaceFilter ( NCPackageSelector::Services );
111  else if ( currentItem == search )
112  pkg->replaceFilter ( NCPackageSelector::Search );
113  else if ( currentItem == inst_summary )
114  pkg->replaceFilter ( NCPackageSelector::Summary );
115  else if ( currentItem == pkg_class )
116  pkg->replaceFilter ( NCPackageSelector::PkgClassification );
117  else
118  yuiError() << "zatim nic" << endl;
119  return true;
120 }
static bool any_service()