libyui-qt-pkg  2.42.5
 All Classes Functions Variables Enumerations
YQPkgUpdateProblemFilterView.cc
1 /**************************************************************************
2 Copyright (C) 2000 - 2010 Novell, Inc.
3 All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
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 along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 
19 **************************************************************************/
20 
21 
22 /*---------------------------------------------------------------------\
23 | |
24 | __ __ ____ _____ ____ |
25 | \ \ / /_ _/ ___|_ _|___ \ |
26 | \ V / _` \___ \ | | __) | |
27 | | | (_| |___) || | / __/ |
28 | |_|\__,_|____/ |_| |_____| |
29 | |
30 | core system |
31 | (C) SuSE GmbH |
32 \----------------------------------------------------------------------/
33 
34  File: YQPkgUpdateProblemFilterView.cc
35 
36  Author: Stefan Hundhammer <sh@suse.de>
37 
38  Textdomain "qt-pkg"
39 
40 /-*/
41 
42 
43 #define YUILogComponent "qt-pkg"
44 #include "YUILog.h"
45 
46 #include "YQPkgUpdateProblemFilterView.h"
47 #include "YQi18n.h"
48 #include "utf8.h"
49 
50 #include <zypp/ZYppFactory.h>
51 #include <zypp/Resolver.h>
52 
53 using std::list;
54 using std::endl;
55 
56 
58  : QTextBrowser( parent )
59 {
60  QString html = _( "\
61 <br>\n\
62 <h2>Update Problem</h2>\n\
63 <p>\n\
64 <font color='blue'>\n\
65 The packages in this list cannot be updated automatically.\n\
66 </font>\n\
67 </p>\n\
68 <p>Possible reasons:</p>\n\
69 <ul>\n\
70 <li>They are obsoleted by other packages\n\
71 <li>There is no newer version to update to on any installation media\n\
72 <li>They are third-party packages\n\
73 </ul>\n\
74 </p>\n\
75 <p>\n\
76 Please choose manually what to do with them.\n\
77 The safest course of action is to delete them.\n\
78 </p>\
79 " );
80 
81  setHtml( html );
82 }
83 
84 
86 {
87  // NOP
88 }
89 
90 void
92 {
93  if ( isVisible() )
94  filter();
95 }
96 
97 
98 void
100 {
101  emit filterStart();
102 
103  list<zypp::PoolItem> problemList = zypp::getZYpp()->resolver()->problematicUpdateItems();
104 
105  for ( list<zypp::PoolItem>::const_iterator it = problemList.begin();
106  it != problemList.end();
107  ++it )
108  {
109  ZyppPkg pkg = tryCastToZyppPkg( (*it).resolvable() );
110 
111  if ( pkg )
112  {
113  ZyppSel sel = _selMapper.findZyppSel( pkg );
114 
115  if ( sel )
116  {
117  yuiMilestone() << "Problematic package: "
118  << pkg->name() << "-" << pkg->edition().asString()
119  << endl;
120 
121  emit filterMatch( sel, pkg );
122  }
123  }
124 
125  }
126 
127  emit filterFinished();
128 }
129 
130 
131 bool
133 {
134  return ! zypp::getZYpp()->resolver()->problematicUpdateItems().empty();
135 }
136 
137 
138 #include "YQPkgUpdateProblemFilterView.moc"