1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQSimplePatchSelector.cc
15 Author: Stefan Hundhammer <sh@suse.de>
17 Textdomain "packages-qt"
21 #include <qapplication.h>
24 #include <qpushbutton.h>
25 #include <qsplitter.h>
27 #define y2log_component "qt-pkg"
28 #include <ycp/y2log.h>
30 #include "QY2LayoutUtils.h"
32 #include "YQSimplePatchSelector.h"
33 #include "YQPkgConflictDialog.h"
34 #include "YQPkgDiskUsageList.h"
35 #include "YQPkgPatchFilterView.h"
36 #include "YQPkgPatchList.h"
49 #define SHOW_DISK_USAGE 0
56 YQSimplePatchSelector::YQSimplePatchSelector( YWidget * parent, long modeFlags )
57 : YQPackageSelectorBase( parent, modeFlags )
62 _wizard = findWizard();
68 _patchList->fillList();
69 _patchList->selectSomething();
73 _diskUsageList->updateDiskUsage();
79 YQSimplePatchSelector::findWizard() const
81 YQWizard * wizard = 0;
83 YQDialog * dialog = dynamic_cast<YQDialog *> ( YDialog::currentDialog() );
86 wizard = dialog->findWizard();
94 YQSimplePatchSelector::basicLayout()
96 QSplitter * splitter = new QSplitter( Qt::Vertical, this );
97 Q_CHECK_PTR( splitter );
98 splitter->setMargin( MARGIN );
104 Q3VBox * upper_vbox = new Q3VBox( splitter );
105 Q_CHECK_PTR( upper_vbox );
106 splitter->setResizeMode( upper_vbox, QSplitter::Stretch );
108 _patchFilterView = new YQPkgPatchFilterView( upper_vbox );
109 Q_CHECK_PTR( _patchFilterView );
111 _patchList = _patchFilterView->patchList();
112 Q_CHECK_PTR( _patchList );
114 addVSpacing( upper_vbox, MARGIN );
122 Q3VBox * lower_vbox = new Q3VBox( splitter );
123 Q_CHECK_PTR( lower_vbox );
124 addVSpacing( lower_vbox, MARGIN );
126 _diskUsageList = new YQPkgDiskUsageList( lower_vbox );
127 Q_CHECK_PTR( _diskUsageList );
129 splitter->setResizeMode( lower_vbox, QSplitter::FollowSizeHint );
137 if ( _wizard ) // No button box - add "Details..." button here
143 addVSpacing( this, SPACING );
145 Q3HBox * hbox = new Q3HBox( this );
148 QPushButton * details_button = new QPushButton( _( "&Details..." ), hbox );
149 Q_CHECK_PTR( details_button );
151 connect( details_button, SIGNAL( clicked() ),
152 this, SLOT ( detailedPackageSelection() ) );
158 layoutButtons( this );
164 YQSimplePatchSelector::layoutButtons( QWidget * parent )
166 Q3HBox * button_box = new Q3HBox( parent );
167 Q_CHECK_PTR( button_box );
168 button_box->setMargin ( MARGIN );
169 button_box->setSpacing( SPACING );
172 QPushButton * details_button = new QPushButton( _( "&Details..." ), button_box );
173 Q_CHECK_PTR( details_button );
174 details_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
176 connect( details_button, SIGNAL( clicked() ),
177 this, SLOT ( detailedPackageSelection() ) );
180 addHStretch( button_box );
182 QPushButton * cancel_button = new QPushButton( _( "&Cancel" ), button_box );
183 Q_CHECK_PTR( cancel_button );
184 cancel_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
186 connect( cancel_button, SIGNAL( clicked() ),
187 this, SLOT ( reject() ) );
190 QPushButton * accept_button = new QPushButton( _( "&Accept" ), button_box );
191 Q_CHECK_PTR( accept_button );
192 accept_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
194 connect( accept_button, SIGNAL( clicked() ),
195 this, SLOT ( accept() ) );
197 button_box->setFixedHeight( button_box->sizeHint().height() );
203 YQSimplePatchSelector::makeConnections()
205 if ( _patchList && _diskUsageList )
207 connect( _patchList, SIGNAL( updatePackages() ),
208 _diskUsageList, SLOT ( updateDiskUsage() ) );
211 y2milestone( "Connection set up" );
215 connect( _wizard, SIGNAL( nextClicked() ),
216 this, SLOT ( accept() ) );
218 connect( _wizard, SIGNAL( backClicked() ),
219 this, SLOT ( reject() ) );
221 connect( _wizard, SIGNAL( abortClicked() ),
222 this, SLOT ( reject() ) );
228 YQSimplePatchSelector::detailedPackageSelection()
230 y2milestone( "\"Details..\" button clicked" );
231 YQUI::ui()->sendEvent( new YMenuEvent( YCPSymbol( "details" ) ) );
236 YQSimplePatchSelector::debugTrace()
238 y2warning( "debugTrace" );
243 #include "YQSimplePatchSelector.moc"