libyui-ncurses-pkg
NCPkgPopupDeps.h
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: NCPkgPopupDeps.h
37 
38  Author: Gabriele Strattner <gs@suse.de>
39  Maintainer: Bubli <kmachalkova@suse.cz>
40 
41 /-*/
42 #ifndef NCPkgPopupDeps_h
43 #define NCPkgPopupDeps_h
44 
45 #include <iosfwd>
46 #include <string>
47 #include <vector>
48 
49 #include <zypp/Resolver.h>
50 
51 #include <yui/ncurses/NCPopup.h>
52 #include <yui/ncurses/NCLabel.h>
53 
54 #include "NCZypp.h"
55 
56 
57 class NCPushButton;
58 class NCSelectionBox;
59 class NCPackageSelector;
60 class NCRichText;
62 
63 
64 namespace PkgDep
65 {
66  class ErrorResult;
67  class ErrorResultList;
68  class ResultList;
69 };
70 
72 //
73 // CLASS NAME : NCPkgPopupDeps
74 //
75 // DESCRIPTION :
76 //
77 class NCPkgPopupDeps : public NCPopup
78 {
79  NCPkgPopupDeps & operator=( const NCPkgPopupDeps & );
80  NCPkgPopupDeps ( const NCPkgPopupDeps & );
81 
82 public:
83  enum NCPkgSolverAction
84  {
85  S_Solve,
86  S_Verify,
87  S_Unknown
88  };
89 
90 private:
91 
92  typedef std::vector<std::pair<
93  zypp::ResolverProblem_Ptr,
94  zypp::ProblemSolution_Ptr> > ProblemSolutionCorrespondence;
95  // indexed by widget position,
96  // keeps the user selected solution (or 0) for each problem
97  ProblemSolutionCorrespondence problems;
98 
99  NCPushButton * cancelButton;
100  NCPushButton * solveButton;
101 
102  NCSolutionSelectionBox * solutionw; // resolver problem solutions
103 
104  NCLabel * head; // the headline
105 
106  NCLabel *details; // problem details
107  NCRichText *solDetails; // solution details
108 
109  NCPackageSelector * packager; // connection to the package selector
110 
111  void createLayout();
112 
113 protected:
114 
115  NCSelectionBox * problemw; // resolver problems
116 
117  virtual bool postAgain( NCPkgSolverAction action );
118 
119  virtual NCursesEvent wHandleInput( wint_t ch );
120 
121 public:
122 
123  NCPkgPopupDeps( const wpos at, NCPackageSelector * pkger );
124  virtual ~NCPkgPopupDeps();
125 
126  virtual int preferredWidth();
127  virtual int preferredHeight();
128 
129  NCursesEvent showDependencyPopup( NCPkgSolverAction action );
130 
131  bool showDependencies( NCPkgSolverAction action, bool * ok );
132 
133  bool solve( NCSelectionBox * problemw, NCPkgSolverAction action );
134 
135  bool showSolutions( int index );
136  // for the currently selected problem, choose this solution
137  void setSolution (int index);
138  // show details
139  void showSolutionDetails( std::string details );
140 };
141 
143 
144 
145 #endif // NCPkgPopupDeps_h
Definition: NCPkgPopupDeps.cc:90
Definition: NCPkgPopupDeps.h:77
Definition: NCPkgPopupDeps.h:64
Definition: NCPackageSelector.h:109