libyui-qt-pkg  2.45.27
YQPackageSelectorPlugin.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: YQPackageSelectorPlugin.cc
35 
36  Author: Stefan Hundhammer <sh@suse.de>
37 
38  Textdomain "qt-pkg"
39 
40 /-*/
41 
42 #include "YQPackageSelectorPlugin.h"
43 #define YUILogComponent "qt-ui"
44 #include "YUILog.h"
45 #include "pkg/YQPackageSelector.h"
46 #include "pkg/YQPatternSelector.h"
47 #include "pkg/YQSimplePatchSelector.h"
48 #include "YUIException.h"
49 
50 #define PLUGIN_BASE_NAME "qt-pkg"
51 
52 
54  : YPackageSelectorPlugin( PLUGIN_BASE_NAME )
55 {
56  if ( success() )
57  {
58  yuiMilestone() << "Loaded " << PLUGIN_BASE_NAME
59  << " plugin successfully from " << pluginLibFullPath()
60  << endl;
61  }
62  else
63  YUI_THROW( YUIPluginException( PLUGIN_BASE_NAME ) );
64 }
65 
66 
68 {
69  // NOP
70 }
71 
72 
74 YQPackageSelectorPlugin::createPackageSelector( YWidget * parent, long modeFlags )
75 {
76  if ( error() )
77  return 0;
78 
79  YQPackageSelector * packageSelector = 0;
80 
81  try
82  {
83  packageSelector = new YQPackageSelector( parent, modeFlags );
84  }
85  catch (const std::exception & e)
86  {
87  yuiError() << "Caught std::exception: " << e.what() << endl;
88  yuiError() << "This is a libzypp problem. Do not file a bug against the UI!" << endl;
89  }
90  catch (...)
91  {
92  yuiError() << "Caught unspecified exception." << endl;
93  yuiError() << "This is a libzypp problem. Do not file a bug against the UI!" << endl;
94  }
95 
96  YUI_CHECK_NEW( packageSelector );
97 
98  return packageSelector;
99 }
100 
101 
103 YQPackageSelectorPlugin::createPatternSelector( YWidget * parent, long modeFlags )
104 {
105  if ( error() )
106  return 0;
107 
108  YQPatternSelector * patternSelector = 0;
109 
110  try
111  {
112  patternSelector = new YQPatternSelector( parent, modeFlags );
113  }
114  catch (const std::exception & e)
115  {
116  yuiError() << "Caught std::exception: " << e.what() << endl;
117  yuiError() << "This is a libzypp problem. Do not file a bug against the UI!" << endl;
118  }
119  catch (...)
120  {
121  yuiError() << "Caught unspecified exception." << endl;
122  yuiError() << "This is a libzypp problem. Do not file a bug against the UI!" << endl;
123  }
124 
125  YUI_CHECK_NEW( patternSelector );
126 
127  return patternSelector;
128 }
129 
130 
132 YQPackageSelectorPlugin::createSimplePatchSelector( YWidget * parent, long modeFlags )
133 {
134  if ( error() )
135  return 0;
136 
137  YQSimplePatchSelector * simplePatchSelector = 0;
138 
139  try
140  {
141  simplePatchSelector = new YQSimplePatchSelector( parent, modeFlags );
142  }
143  catch (const std::exception & e)
144  {
145  yuiError() << "Caught std::exception: " << e.what() << endl;
146  yuiError() << "This is a libzypp problem. Do not file a bug against the UI!" << endl;
147  }
148  catch (...)
149  {
150  yuiError() << "Caught unspecified exception." << endl;
151  yuiError() << "This is a libzypp problem. Do not file a bug against the UI!" << endl;
152  }
153 
154  YUI_CHECK_NEW( simplePatchSelector );
155 
156  return simplePatchSelector;
157 }
158 
virtual YQPackageSelector * createPackageSelector(YWidget *parent, long modeFlags=0)
Create a package selector.
virtual YQSimplePatchSelector * createSimplePatchSelector(YWidget *parent, long modeFlags=0)
Create a simple patch selector.
YQPackageSelectorPlugin()
Constructor: Load the plugin library for the Qt package selector.
virtual ~YQPackageSelectorPlugin()
Destructor.
virtual YQPatternSelector * createPatternSelector(YWidget *parent, long modeFlags=0)
Create a pattern selector.