42 #define YUILogComponent "qt-pkg" 45 #include <QApplication> 48 #include <QPushButton> 52 #include "YQPkgDiskUsageWarningDialog.h" 53 #include "YQPkgDiskUsageList.h" 54 #include "QY2LayoutUtils.h" 59 #define SPACING 2 // between subwidgets 60 #define MARGIN 4 // around the widget 64 const QString & message,
66 const QString & acceptButtonLabel,
67 const QString & rejectButtonLabel )
71 setWindowTitle( _(
"Disk Space Warning" ) );
74 setSizeGripEnabled(
true );
78 QVBoxLayout * layout =
new QVBoxLayout();
79 Q_CHECK_PTR( layout );
80 layout->setSpacing( SPACING );
81 layout->setMargin ( MARGIN );
85 QHBoxLayout * hbox =
new QHBoxLayout();
87 layout->addLayout( hbox );
93 QLabel * iconLabel =
new QLabel(
this );
94 Q_CHECK_PTR( iconLabel );
95 hbox->addWidget(iconLabel);
96 iconLabel->setPixmap( YQUI::ui()->loadIcon(
"dialog-warning" ).pixmap(64) );
97 iconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
101 QLabel * label =
new QLabel( message,
this);
102 Q_CHECK_PTR( label );
103 hbox->addWidget(label);
104 label->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
105 label->setTextFormat( Qt::RichText );
106 label->setWordWrap(
true );
112 Q_CHECK_PTR( duList );
113 layout->addWidget( duList );
118 hbox =
new QHBoxLayout();
120 hbox->setSpacing( SPACING );
121 hbox->setMargin ( MARGIN );
122 layout->addLayout( hbox );
129 QPushButton * button =
new QPushButton( acceptButtonLabel,
this );
130 Q_CHECK_PTR( button );
131 hbox->addWidget(button);
133 connect( button, SIGNAL( clicked() ),
134 this, SLOT ( accept() ) );
139 if ( ! rejectButtonLabel.isEmpty() )
143 button =
new QPushButton( rejectButtonLabel,
this );
144 Q_CHECK_PTR( button );
145 hbox->addWidget(button);
147 connect( button, SIGNAL( clicked() ),
148 this, SLOT ( reject() ) );
157 button->setDefault(
true );
163 int thresholdPercent,
164 const QString & acceptButtonLabel,
165 const QString & rejectButtonLabel )
172 YQUI::ui()->normalCursor();
175 return dialog.result() == QDialog::Accepted;
YQPkgDiskUsageWarningDialog(QWidget *parent, const QString &message, int thresholdPercent, const QString &acceptButtonLabel, const QString &rejectButtonLabel=QString::null)
Constructor: Creates a disk usage warning dialog with text 'message' on top, a list of partitions tha...
Warning dialog about partitions that are getting full or overflowing.
static bool diskUsageWarning(const QString &message, int thresholdPercent, const QString &acceptButtonLabel, const QString &rejectButtonLabel=QString::null)
Static convenience method: Post a disk usage warning with text 'message', a list of partitions that a...
List of disk usage of all attached partitions.