1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQSimplePatchSelector.cc
15 Author: Stefan Hundhammer <sh@suse.de>
17 Textdomain "packages-qt"
23 #include <qapplication.h>
26 #include <qpushbutton.h>
27 #include <qsplitter.h>
29 #define y2log_component "qt-pkg"
30 #include <ycp/y2log.h>
32 #include "QY2LayoutUtils.h"
34 #include "YQSimplePatchSelector.h"
35 #include "YQPkgConflictDialog.h"
36 #include "YQPkgDiskUsageList.h"
37 #include "YQPkgPatchFilterView.h"
38 #include "YQPkgPatchList.h"
51 #define SHOW_DISK_USAGE 0
58 YQSimplePatchSelector::YQSimplePatchSelector( YWidget * parent, long modeFlags )
59 : YQPackageSelectorBase( parent, modeFlags )
64 _wizard = findWizard();
70 _patchList->fillList();
71 _patchList->selectSomething();
75 _diskUsageList->updateDiskUsage();
81 YQSimplePatchSelector::findWizard() const
83 YQWizard * wizard = 0;
85 YQDialog * dialog = dynamic_cast<YQDialog *> ( YDialog::currentDialog() );
88 wizard = dialog->findWizard();
96 YQSimplePatchSelector::basicLayout()
98 QSplitter * splitter = new QSplitter( Qt::Vertical, this );
99 Q_CHECK_PTR( splitter );
100 splitter->setMargin( MARGIN );
106 Q3VBox * upper_vbox = new Q3VBox( splitter );
107 Q_CHECK_PTR( upper_vbox );
108 splitter->setResizeMode( upper_vbox, QSplitter::Stretch );
110 _patchFilterView = new YQPkgPatchFilterView( upper_vbox );
111 Q_CHECK_PTR( _patchFilterView );
113 _patchList = _patchFilterView->patchList();
114 Q_CHECK_PTR( _patchList );
116 addVSpacing( upper_vbox, MARGIN );
124 Q3VBox * lower_vbox = new Q3VBox( splitter );
125 Q_CHECK_PTR( lower_vbox );
126 addVSpacing( lower_vbox, MARGIN );
128 _diskUsageList = new YQPkgDiskUsageList( lower_vbox );
129 Q_CHECK_PTR( _diskUsageList );
131 splitter->setResizeMode( lower_vbox, QSplitter::FollowSizeHint );
139 if ( _wizard ) // No button box - add "Details..." button here
145 addVSpacing( this, SPACING );
147 Q3HBox * hbox = new Q3HBox( this );
150 QPushButton * details_button = new QPushButton( _( "&Details..." ), hbox );
151 Q_CHECK_PTR( details_button );
153 connect( details_button, SIGNAL( clicked() ),
154 this, SLOT ( detailedPackageSelection() ) );
160 layoutButtons( this );
166 YQSimplePatchSelector::layoutButtons( QWidget * parent )
168 Q3HBox * button_box = new Q3HBox( parent );
169 Q_CHECK_PTR( button_box );
170 button_box->setMargin ( MARGIN );
171 button_box->setSpacing( SPACING );
174 QPushButton * details_button = new QPushButton( _( "&Details..." ), button_box );
175 Q_CHECK_PTR( details_button );
176 details_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
178 connect( details_button, SIGNAL( clicked() ),
179 this, SLOT ( detailedPackageSelection() ) );
182 addHStretch( button_box );
184 QPushButton * cancel_button = new QPushButton( _( "&Cancel" ), button_box );
185 Q_CHECK_PTR( cancel_button );
186 cancel_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
188 connect( cancel_button, SIGNAL( clicked() ),
189 this, SLOT ( reject() ) );
192 QPushButton * accept_button = new QPushButton( _( "&Accept" ), button_box );
193 Q_CHECK_PTR( accept_button );
194 accept_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
196 connect( accept_button, SIGNAL( clicked() ),
197 this, SLOT ( accept() ) );
199 button_box->setFixedHeight( button_box->sizeHint().height() );
205 YQSimplePatchSelector::makeConnections()
207 if ( _patchList && _diskUsageList )
209 connect( _patchList, SIGNAL( updatePackages() ),
210 _diskUsageList, SLOT ( updateDiskUsage() ) );
213 y2milestone( "Connection set up" );
217 connect( _wizard, SIGNAL( nextClicked() ),
218 this, SLOT ( accept() ) );
220 connect( _wizard, SIGNAL( backClicked() ),
221 this, SLOT ( reject() ) );
223 connect( _wizard, SIGNAL( abortClicked() ),
224 this, SLOT ( reject() ) );
230 YQSimplePatchSelector::detailedPackageSelection()
232 y2milestone( "\"Details..\" button clicked" );
233 YQUI::ui()->sendEvent( new YMenuEvent( YCPSymbol( "details" ) ) );
238 YQSimplePatchSelector::debugTrace()
240 y2warning( "debugTrace" );
245 #include "YQSimplePatchSelector.moc"