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() ) );
Display the description of a ZyppObj derived object along with its name and summary.
YQPkgDescriptionDialog(QWidget *parent, const QString &pkgName)
Constructor: Creates a description dialog for all packages that match 'pkgName'.
void addPkgItem(ZyppSel selectable, ZyppPkg zyppPkg)
Add a pkg to the list.
virtual QSize sizeHint() const
Returns the preferred size.
Display a list of zypp::Package objects.
void clear()
Clears the tree-widgets content, resets the optimal column width values.
bool isEmpty() const
Returns 'true' if the pkg list is empty.
void showDetailsIfVisible(ZyppSel selectable)
Show details for the specified package.
Pkg status and description as a standalone popup dialog.
ZyppSel selectable() const
Returns the original selectable within the package manager backend.
static void showDescriptionDialog(const QString &pkgName)
Static convenience method: Post a description dialog for pkg 'pkgName'.
void filter(const QString &pkgName)
Apply the filter criteria: Fill the pkg list with pkgs that match the specified package name...