42 #define YUILogComponent "qt-pkg"
45 #include <QApplication>
46 #include <QDesktopWidget>
47 #include <QHBoxLayout>
49 #include <QPushButton>
55 #include "YQPkgDescriptionDialog.h"
56 #include "YQPkgDescriptionView.h"
57 #include "YQPkgList.h"
58 #include "QY2LayoutUtils.h"
64 #define SPACING 2 // between subwidgets
65 #define MARGIN 4 // around the widget
72 setWindowTitle( _(
"Package Description" ) );
75 setSizeGripEnabled(
true );
79 QVBoxLayout * layout =
new QVBoxLayout();
80 Q_CHECK_PTR( layout );
82 layout->setMargin(MARGIN);
83 layout->setSpacing(SPACING);
89 QSplitter * splitter =
new QSplitter( Qt::Vertical,
this );
90 Q_CHECK_PTR( splitter );
91 layout->addWidget( splitter );
96 Q_CHECK_PTR( _pkgList );
97 _pkgList->resize( _pkgList->width(), 80 );
103 Q_CHECK_PTR( _pkgDescription );
104 _pkgDescription->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
106 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
107 _pkgDescription, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
112 QHBoxLayout * hbox =
new QHBoxLayout();
114 hbox->setSpacing( SPACING );
115 hbox->setMargin ( MARGIN );
116 layout->addLayout( hbox );
120 QPushButton * button =
new QPushButton( _(
"&OK" ),
this );
121 Q_CHECK_PTR( button );
122 hbox->addWidget(button);
123 button->setDefault(
true );
125 connect( button, SIGNAL( clicked() ),
126 this, SLOT ( accept() ) );
138 std::string pkgName( toUTF8( qPkgName ) );
139 YQUI::ui()->busyCursor();
145 for ( ZyppPoolIterator it = zyppPkgBegin();
149 ZyppObj zyppObj = (*it)->theObj();
151 if ( zyppObj && zyppObj->name() == pkgName )
152 _pkgList->
addPkgItem( *it, tryCastToZyppPkg( zyppObj ) );
163 _pkgDescription->clear();
166 YQUI::ui()->normalCursor();
174 return _pkgList->childCount() == 0;
184 QRect available = qApp->desktop()->availableGeometry( (QWidget *)
this );
185 QSize size = QDialog::sizeHint();
186 size = size.boundedTo( QSize( available.width(), available.height() ) );
202 #include "YQPkgDescriptionDialog.moc"
Display the description of a ZyppObj derived object along with its name and summary.
ZyppSel selectable() const
YQPkgDescriptionDialog(QWidget *parent, const QString &pkgName)
void addPkgItem(ZyppSel selectable, ZyppPkg zyppPkg)
virtual QSize sizeHint() const
Display a list of zypp::Package objects.
void showDetailsIfVisible(ZyppSel selectable)
static void showDescriptionDialog(const QString &pkgName)
void filter(const QString &pkgName)