libyui-ncurses-pkg  2.44.4
 All Classes Functions
NCPkgMenuHelp.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: NCPkgMenuHelp.cc
37 
38  Author: Hedgehog Painter <kmachalkova@suse.cz>
39 
40 /-*/
41 #define YUILogComponent "ncurses-pkg"
42 #include <YUILog.h>
43 
44 #include "NCPkgMenuHelp.h"
45 #include "NCPkgStrings.h"
46 #include "NCPackageSelector.h"
47 
48 using std::endl;
49 
50 /*
51  Textdomain "ncurses-pkg"
52 */
53 
54 NCPkgMenuHelp::NCPkgMenuHelp (YWidget *parent, std::string label, NCPackageSelector *pkger)
55  : NCMenuButton( parent, label)
56  , pkg( pkger)
57 {
58  createLayout();
59  setFunctionKey( 1 );
60 }
61 
62 NCPkgMenuHelp::~NCPkgMenuHelp()
63 {
64 
65 }
66 
67 void NCPkgMenuHelp::createLayout()
68 {
69  if ( !pkg->isYouMode())
70  {
71  generalHelp = new YMenuItem( _( "&General Help" ) );
72  items.push_back( generalHelp );
73 
74  statusHelp = new YMenuItem( _( "&Package Status and Symbols" ) );
75  items.push_back( statusHelp );
76 
77  filterHelp = new YMenuItem( _( "&How to Use the Filters" ) );
78  items.push_back( filterHelp );
79 
80  menuHelp = new YMenuItem( _( "&Useful Functions in Menu" ) );
81  items.push_back( menuHelp );
82  }
83  else {
84  patchHelp = new YMenuItem( _( "&Patch Status and Patch Installation" ));
85  items.push_back ( patchHelp );
86  }
87 
88  addItems( items);
89 }
90 
91 bool NCPkgMenuHelp::handleEvent ( const NCursesEvent & event)
92 {
93  if (!event.selection)
94  return false;
95 
96  std::string text = "";
97  std::string headline = "";
98 
99  if ( event.selection == generalHelp )
100  {
101  headline = NCPkgStrings::PackageHelp();
102  text += NCPkgStrings::HelpPkgGen1();
103  text += NCPkgStrings::HelpPkgGen2();
104  text += NCPkgStrings::HelpPkgGen3();
105  text += NCPkgStrings::HelpPkgGen4();
106  text += NCPkgStrings::HelpPkgGen5();
107  text += NCPkgStrings::HelpPkgGen6();
108 
109  }
110  else if ( event.selection == statusHelp )
111  {
112  headline = NCPkgStrings::PackageStatusHelp();
113  text += NCPkgStrings::HelpOnStatus1();
114  text += NCPkgStrings::HelpOnStatus2();
115  text += NCPkgStrings::HelpOnStatus3();
116  text += NCPkgStrings::HelpOnStatus4();
117  text += NCPkgStrings::HelpOnStatus5();
118  }
119  else if ( event.selection == menuHelp )
120  {
121  headline = NCPkgStrings::PackageMenuHelp();
122  text += NCPkgStrings::HelpPkgMenu1();
123  text += NCPkgStrings::HelpPkgMenu2();
124  text += NCPkgStrings::HelpPkgMenu2_2();
125  text += NCPkgStrings::HelpPkgMenu2_3();
126  text += NCPkgStrings::HelpPkgMenu3();
127  text += NCPkgStrings::HelpPkgMenu4();
128  text += NCPkgStrings::HelpPkgMenu5();
129  }
130  else if ( event.selection == filterHelp )
131  {
132  headline = NCPkgStrings::PackageFiltersHelp();
133  text += NCPkgStrings::HelpOnFilters1();
134  text += NCPkgStrings::HelpOnFilters2();
135  text += NCPkgStrings::HelpOnFilters3();
136  text += NCPkgStrings::HelpOnFilters4();
137  text += NCPkgStrings::HelpOnFilters5();
138  }
139  else if ( event.selection == patchHelp )
140  {
141  headline = NCPkgStrings::YouHelp();
142  text += NCPkgStrings::YouHelp1();
143  text += NCPkgStrings::YouHelp2();
144  text += NCPkgStrings::YouHelp3();
145  text += NCPkgStrings::YouHelp4();
146  text += NCPkgStrings::YouHelp5();
147  }
148  else
149  yuiError() << "zatim nic" << endl;
150 
151  NCPopupInfo * pkgHelp = new NCPopupInfo( wpos( (NCurses::lines()*8)/100, (NCurses::cols()*18)/100 ),
152  headline,
153  text
154  );
155  pkgHelp->setPreferredSize( (NCurses::cols()*65)/100, (NCurses::lines()*85)/100 );
156  pkgHelp->showInfoPopup( );
157 
158  YDialog::deleteTopmostDialog();
159 
160  return true;
161 }
static const std::string YouHelp()
static const std::string YouHelp1()