]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/YQPackageSelectorPlugin.cc
compile some more
[duncan/yast2-qt4.git] / src / YQPackageSelectorPlugin.cc
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                    (c) SuSE Linux AG |
11 \----------------------------------------------------------------------/
12
13   File:         YQPackageSelectorPlugin.cc
14
15   Author:       Stefan Hundhammer <sh@suse.de>
16
17   Textdomain    "packages-qt"
18
19 /-*/
20
21 #define QT3_SUPPORT 1
22
23 #include "YQPackageSelectorPlugin.h"
24 #define y2log_component "qt-ui"
25 #include <ycp/y2log.h>
26 #include "YQPackageSelector.h"
27 #include "YQPatternSelector.h"
28 #include "YQSimplePatchSelector.h"
29 #include "YUIException.h"
30
31 #define PLUGIN_BASE_NAME "qt4_pkg"
32
33
34 YQPackageSelectorPlugin::YQPackageSelectorPlugin()
35     : YPackageSelectorPlugin( PLUGIN_BASE_NAME )
36 {
37     if ( success() )
38     {
39         y2milestone( "Loaded %s plugin successfully from %s",
40                      PLUGIN_BASE_NAME, pluginLibFullPath().c_str() );
41     }
42     else
43         YUI_THROW( YUIPluginException( PLUGIN_BASE_NAME ) );
44 }
45
46
47 YQPackageSelectorPlugin::~YQPackageSelectorPlugin()
48 {
49     // NOP
50 }
51
52
53 YQPackageSelector *
54 YQPackageSelectorPlugin::createPackageSelector( YWidget * parent, long modeFlags )
55 {
56     if ( error() )
57         return 0;
58     
59     YQPackageSelector * packageSelector = 0;
60     
61     try
62     {
63         packageSelector = new YQPackageSelector( parent, modeFlags );
64     }
65     catch (const std::exception & e)
66     {
67         y2error( "Caught std::exception: %s", e.what() );
68         y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
69     }
70     catch (...)
71     {
72         y2error( "Caught unspecified exception." );
73         y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
74     }
75
76     YUI_CHECK_NEW( packageSelector );
77     
78     return packageSelector;
79 }
80
81
82 YQPatternSelector *
83 YQPackageSelectorPlugin::createPatternSelector( YWidget * parent, long modeFlags )
84 {
85     if ( error() )
86         return 0;
87     
88     YQPatternSelector * patternSelector = 0;
89     
90     try
91     {
92         patternSelector = new YQPatternSelector( parent, modeFlags );
93     }
94     catch (const std::exception & e)
95     {
96         y2error( "Caught std::exception: %s", e.what() );
97         y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
98     }
99     catch (...)
100     {
101         y2error( "Caught unspecified exception." );
102         y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
103     }
104
105     YUI_CHECK_NEW( patternSelector );
106     
107     return patternSelector;
108 }
109
110
111 YQSimplePatchSelector *
112 YQPackageSelectorPlugin::createSimplePatchSelector( YWidget * parent, long modeFlags )
113 {
114     if ( error() )
115         return 0;
116     
117     YQSimplePatchSelector * simplePatchSelector = 0;
118     
119     try
120     {
121         simplePatchSelector = new YQSimplePatchSelector( parent, modeFlags );
122     }
123     catch (const std::exception & e)
124     {
125         y2error( "Caught std::exception: %s", e.what() );
126         y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
127     }
128     catch (...)
129     {
130         y2error( "Caught unspecified exception." );
131         y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
132     }
133
134     YUI_CHECK_NEW( simplePatchSelector );
135     
136     return simplePatchSelector;
137 }
138