libyui-ncurses-pkg  2.43.4.1
 All Classes Functions
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 
47 using std::endl;
48 
49 /*
50  Textdomain "ncurses-pkg"
51 */
52 
53 NCPkgFilterMain::NCPkgFilterMain (YWidget *parent, std::string label, NCPackageSelector *pkger )
54  :NCComboBox(parent, label, false)
55  ,pkg (pkger)
56 {
57  createLayout();
58  setNotify( true );
59 }
60 
61 NCPkgFilterMain::~NCPkgFilterMain()
62 {
63 
64 }
65 
66 void NCPkgFilterMain::createLayout()
67 {
68  patterns = new YItem( _( "Patterns" ) );
69  items.push_back( patterns );
70 
71  languages = new YItem( _( "Languages" ) );
72  items.push_back( languages );
73 
74  rpmgroups = new YItem( _( "RPM Groups" ) );
75  items.push_back( rpmgroups );
76 
77  repositories = new YItem( _( "Repositories" ) );
78  items.push_back( repositories );
79 
80  search = new YItem( _( "Search" ) );
81  search->setSelected();
82  items.push_back( search );
83 
84  inst_summary = new YItem( _( "Installation Summary" ) );
85  items.push_back( inst_summary );
86 
87  pkg_class = new YItem( _( "Package Classification" ) );
88  items.push_back( pkg_class );
89 
90  addItems( items );
91 
92 }
93 
94 bool NCPkgFilterMain::handleEvent ( )
95 {
96 
97  YItem *currentItem = selectedItem();
98 
99  if ( currentItem == rpmgroups )
100  pkg->replaceFilter ( NCPackageSelector::RPMGroups );
101  else if ( currentItem == patterns )
102  pkg->replaceFilter ( NCPackageSelector::Patterns );
103  else if ( currentItem == languages )
104  pkg->replaceFilter ( NCPackageSelector::Languages );
105  else if ( currentItem == repositories )
106  pkg->replaceFilter ( NCPackageSelector::Repositories );
107  else if ( currentItem == search )
108  pkg->replaceFilter ( NCPackageSelector::Search );
109  else if ( currentItem == inst_summary )
110  pkg->replaceFilter ( NCPackageSelector::Summary );
111  else if ( currentItem == pkg_class )
112  pkg->replaceFilter ( NCPackageSelector::PkgClassification );
113  else
114  yuiError() << "zatim nic" << endl;
115  return true;
116 }