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