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