libyui-qt-pkg  2.44.7
 All Classes Functions Variables Enumerations
YQPackageSelectorPluginImpl.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 Linux AG |
32 \----------------------------------------------------------------------/
33 
34  File: YQPackageSelectorPluginImpl.cc
35 
36  Author: Stefan Hundhammer
37  \\\'>
38 
39 /-*/
40 
41 #include "YQPackageSelectorPluginImpl.h"
42 #include "YQPackageSelector.h"
43 #include "YQPatternSelector.h"
44 #include "YQSimplePatchSelector.h"
45 
46 #define YUILogComponent "qt-pkg"
47 #include <YUILog.h>
48 
49 using std::endl;
50 
51 // Create YQPackageSelectorStart which reads the layout
52 // term of the package selection dialog, creates the widget
53 // tree and creates the YQPackageSelector.
54 
55 extern "C"
56 {
57  // Important to locate this symbol - see YQPackageSelectorPluginStub.cc in package yast2-qt
59 }
60 
61 YPackageSelector * YQPackageSelectorPluginImpl::createPackageSelector( YWidget * parent,
62  long modeFlags )
63 {
64  /* if ( error() )
65  return 0; */
66 
67  YQPackageSelector * packageSelector = 0;
68 
69  try
70  {
71  packageSelector = new YQPackageSelector( parent, modeFlags );
72  }
73  catch (const std::exception & e)
74  {
75  yuiError() << "Caught std::exception: " << e.what() << endl;
76  yuiError() << "This is a libzypp problem. Do not file a bug against the UI!" << endl;
77  }
78  catch (...)
79  {
80  yuiError() << "Caught unspecified exception." << endl;
81  yuiError() << "This is a libzypp problem. Do not file a bug against the UI!" << endl;
82  }
83 
84  YUI_CHECK_NEW( packageSelector );
85 
86  return packageSelector;
87 }
88 
89 
90 YWidget *YQPackageSelectorPluginImpl::createPatternSelector( YWidget * parent, long modeFlags )
91 {
92  /* if ( error() )
93  return 0; */
94 
95  YQPatternSelector * patternSelector = 0;
96 
97  try
98  {
99  patternSelector = new YQPatternSelector( parent, modeFlags );
100  }
101  catch (const std::exception & e)
102  {
103  yuiError() << "Caught std::exception: " << e.what() << endl;
104  yuiError() << "This is a libzypp problem. Do not file a bug against the UI!" << endl;
105  }
106  catch (...)
107  {
108  yuiError() << "Caught unspecified exception." << endl;
109  yuiError() << "This is a libzypp problem. Do not file a bug against the UI!" << endl;
110  }
111 
112  YUI_CHECK_NEW( patternSelector );
113 
114  return patternSelector;
115 
116 }
117 
118 YWidget *YQPackageSelectorPluginImpl::createSimplePatchSelector( YWidget * parent, long modeFlags )
119 {
120  /* if ( error() )
121  return 0; */
122 
123  YQSimplePatchSelector * simplePatchSelector = 0;
124 
125  try
126  {
127  simplePatchSelector = new YQSimplePatchSelector( parent, modeFlags );
128  }
129  catch (const std::exception & e)
130  {
131  yuiError() << "Caught std::exception: " << e.what() << endl;
132  yuiError() << "This is a libzypp problem. Do not file a bug against the UI!" << endl;
133  }
134  catch (...)
135  {
136  yuiError() << "Caught unspecified exception." << endl;
137  yuiError() << "This is a libzypp problem. Do not file a bug against the UI!" << endl;
138  }
139 
140  YUI_CHECK_NEW( simplePatchSelector );
141 
142  return simplePatchSelector;
143 
144 }