]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/YQPackageSelectorPlugin.cc
picking up branches/tmp/sh/qt4-port/, merging it with trunk
[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 #include "YQPackageSelectorPlugin.h"
22 #define y2log_component "qt-ui"
23 #include <ycp/y2log.h>
24 #include "YQPackageSelector.h"
25 #include "YQPatternSelector.h"
26 #include "YQSimplePatchSelector.h"
27 #include "YUIException.h"
28
29 #define PLUGIN_BASE_NAME "qt_pkg"
30
31
32 YQPackageSelectorPlugin::YQPackageSelectorPlugin()
33     : YPackageSelectorPlugin( PLUGIN_BASE_NAME )
34 {
35     if ( success() )
36     {
37         y2milestone( "Loaded %s plugin successfully from %s",
38                      PLUGIN_BASE_NAME, pluginLibFullPath().c_str() );
39     }
40     else
41         YUI_THROW( YUIPluginException( PLUGIN_BASE_NAME ) );
42 }
43
44
45 YQPackageSelectorPlugin::~YQPackageSelectorPlugin()
46 {
47     // NOP
48 }
49
50
51 YQPackageSelector *
52 YQPackageSelectorPlugin::createPackageSelector( YWidget * parent, long modeFlags )
53 {
54     if ( error() )
55         return 0;
56     
57     YQPackageSelector * packageSelector = 0;
58     
59     try
60     {
61         packageSelector = new YQPackageSelector( parent, modeFlags );
62     }
63     catch (const std::exception & e)
64     {
65         y2error( "Caught std::exception: %s", e.what() );
66         y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
67     }
68     catch (...)
69     {
70         y2error( "Caught unspecified exception." );
71         y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
72     }
73
74     YUI_CHECK_NEW( packageSelector );
75     
76     return packageSelector;
77 }
78
79
80 YQPatternSelector *
81 YQPackageSelectorPlugin::createPatternSelector( YWidget * parent, long modeFlags )
82 {
83     if ( error() )
84         return 0;
85     
86     YQPatternSelector * patternSelector = 0;
87     
88     try
89     {
90         patternSelector = new YQPatternSelector( parent, modeFlags );
91     }
92     catch (const std::exception & e)
93     {
94         y2error( "Caught std::exception: %s", e.what() );
95         y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
96     }
97     catch (...)
98     {
99         y2error( "Caught unspecified exception." );
100         y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
101     }
102
103     YUI_CHECK_NEW( patternSelector );
104     
105     return patternSelector;
106 }
107
108
109 YQSimplePatchSelector *
110 YQPackageSelectorPlugin::createSimplePatchSelector( YWidget * parent, long modeFlags )
111 {
112     if ( error() )
113         return 0;
114     
115     YQSimplePatchSelector * simplePatchSelector = 0;
116     
117     try
118     {
119         simplePatchSelector = new YQSimplePatchSelector( parent, modeFlags );
120     }
121     catch (const std::exception & e)
122     {
123         y2error( "Caught std::exception: %s", e.what() );
124         y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
125     }
126     catch (...)
127     {
128         y2error( "Caught unspecified exception." );
129         y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
130     }
131
132     YUI_CHECK_NEW( simplePatchSelector );
133     
134     return simplePatchSelector;
135 }
136