Diffstat (limited to 'noncore/settings/packagemanager/installdlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 205d7ed..15d88ad 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp | |||
@@ -22,27 +22,27 @@ | |||
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "installdlg.h" | 31 | #include "installdlg.h" |
32 | 32 | ||
33 | #include <opie2/ofiledialog.h> | 33 | #include <opie2/ofiledialog.h> |
34 | #include <opie2/oresource.h> | ||
34 | 35 | ||
35 | #include <qpe/fileselector.h> | 36 | #include <qpe/fileselector.h> |
36 | #include <qpe/resource.h> | ||
37 | #include <qpe/storage.h> | 37 | #include <qpe/storage.h> |
38 | 38 | ||
39 | #include <qapplication.h> | 39 | #include <qapplication.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qfileinfo.h> | 41 | #include <qfileinfo.h> |
42 | #include <qgroupbox.h> | 42 | #include <qgroupbox.h> |
43 | #include <qlabel.h> | 43 | #include <qlabel.h> |
44 | #include <qlayout.h> | 44 | #include <qlayout.h> |
45 | #include <qmap.h> | 45 | #include <qmap.h> |
46 | #include <qmultilineedit.h> | 46 | #include <qmultilineedit.h> |
47 | #include <qpushbutton.h> | 47 | #include <qpushbutton.h> |
48 | 48 | ||
@@ -121,33 +121,32 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap | |||
121 | } | 121 | } |
122 | 122 | ||
123 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); | 123 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); |
124 | groupBox->layout()->setSpacing( 0 ); | 124 | groupBox->layout()->setSpacing( 0 ); |
125 | groupBox->layout()->setMargin( 4 ); | 125 | groupBox->layout()->setMargin( 4 ); |
126 | 126 | ||
127 | QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() ); | 127 | QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() ); |
128 | m_output = new QMultiLineEdit( groupBox ); | 128 | m_output = new QMultiLineEdit( groupBox ); |
129 | m_output->setReadOnly( true ); | 129 | m_output->setReadOnly( true ); |
130 | groupBoxLayout->addWidget( m_output ); | 130 | groupBoxLayout->addWidget( m_output ); |
131 | layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); | 131 | layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); |
132 | 132 | ||
133 | QPixmap pic; | 133 | m_btnStart = new QPushButton( Opie::Core::OResource::loadPixmap( "packagemanager/apply", |
134 | pic.convertFromImage( Resource::loadImage( "packagemanager/apply" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 134 | Opie::Core::OResource::SmallIcon ), tr( "Start" ), this ); |
135 | m_btnStart = new QPushButton( pic, tr( "Start" ), this ); | ||
136 | m_btnStart->setMinimumHeight( AppLnk::smallIconSize() ); | 135 | m_btnStart->setMinimumHeight( AppLnk::smallIconSize() ); |
137 | layout->addWidget( m_btnStart, 3, 0 ); | 136 | layout->addWidget( m_btnStart, 3, 0 ); |
138 | connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); | 137 | connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); |
139 | 138 | ||
140 | pic.convertFromImage( Resource::loadImage( "SettingsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 139 | m_btnOptions = new QPushButton( Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), |
141 | m_btnOptions = new QPushButton( pic, tr( "Options" ), this ); | 140 | tr( "Options" ), this ); |
142 | m_btnOptions->setMinimumHeight( AppLnk::smallIconSize() ); | 141 | m_btnOptions->setMinimumHeight( AppLnk::smallIconSize() ); |
143 | layout->addWidget( m_btnOptions, 3, 1 ); | 142 | layout->addWidget( m_btnOptions, 3, 1 ); |
144 | connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); | 143 | connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); |
145 | 144 | ||
146 | // Display packages being acted upon in output widget | 145 | // Display packages being acted upon in output widget |
147 | for( int i = 0; i < m_numCommands; i++ ) | 146 | for( int i = 0; i < m_numCommands; i++ ) |
148 | { | 147 | { |
149 | if ( !m_packages[ i ].isEmpty() ) | 148 | if ( !m_packages[ i ].isEmpty() ) |
150 | { | 149 | { |
151 | QString lineStr = tr( "Packages to " ); | 150 | QString lineStr = tr( "Packages to " ); |
152 | 151 | ||
153 | switch( m_command[ i ] ) | 152 | switch( m_command[ i ] ) |
@@ -214,75 +213,68 @@ void InstallDlg::slotDisplayAvailSpace( const QString &destination ) | |||
214 | } | 213 | } |
215 | 214 | ||
216 | void InstallDlg::slotBtnStart() | 215 | void InstallDlg::slotBtnStart() |
217 | { | 216 | { |
218 | QString btnText = m_btnStart->text(); | 217 | QString btnText = m_btnStart->text(); |
219 | if ( btnText == tr( "Abort" ) ) | 218 | if ( btnText == tr( "Abort" ) ) |
220 | { | 219 | { |
221 | // Prevent unexecuted commands from executing | 220 | // Prevent unexecuted commands from executing |
222 | m_currCommand = 999; | 221 | m_currCommand = 999; |
223 | 222 | ||
224 | // Allow user to close dialog | 223 | // Allow user to close dialog |
225 | m_btnStart->setText( tr( "Close" ) ); | 224 | m_btnStart->setText( tr( "Close" ) ); |
226 | QPixmap pic; | 225 | m_btnStart->setIconSet( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) ); |
227 | pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
228 | m_btnStart->setIconSet( pic ); | ||
229 | return; | 226 | return; |
230 | } | 227 | } |
231 | else if ( btnText == tr( "Close" ) ) | 228 | else if ( btnText == tr( "Close" ) ) |
232 | { | 229 | { |
233 | // TODO - force reload of package data | 230 | // TODO - force reload of package data |
234 | emit closeInstallDlg(); | 231 | emit closeInstallDlg(); |
235 | return; | 232 | return; |
236 | } | 233 | } |
237 | 234 | ||
238 | // Start was clicked, start executing | 235 | // Start was clicked, start executing |
239 | QString dest; | 236 | QString dest; |
240 | if ( m_installFound ) | 237 | if ( m_installFound ) |
241 | { | 238 | { |
242 | dest = m_destination->currentText(); | 239 | dest = m_destination->currentText(); |
243 | m_destination->setEnabled( false ); | 240 | m_destination->setEnabled( false ); |
244 | } | 241 | } |
245 | 242 | ||
246 | m_btnOptions->setEnabled( false ); | 243 | m_btnOptions->setEnabled( false ); |
247 | if ( m_numCommands > 1 ) | 244 | if ( m_numCommands > 1 ) |
248 | { | 245 | { |
249 | m_btnStart->setText( tr( "Abort" ) ); | 246 | m_btnStart->setText( tr( "Abort" ) ); |
250 | QPixmap pic; | 247 | m_btnStart->setIconSet( Opie::Core::OResource::loadPixmap( "reset", Opie::Core::OResource::SmallIcon ) ); |
251 | pic.convertFromImage( Resource::loadImage( "reset" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
252 | m_btnStart->setIconSet( pic ); | ||
253 | } | 248 | } |
254 | else | 249 | else |
255 | { | 250 | { |
256 | m_btnStart->setEnabled( false ); | 251 | m_btnStart->setEnabled( false ); |
257 | } | 252 | } |
258 | 253 | ||
259 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) | 254 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) |
260 | { | 255 | { |
261 | // Execute next command | 256 | // Execute next command |
262 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, | 257 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, |
263 | this, SLOT(slotOutput(const QString &)), true ); | 258 | this, SLOT(slotOutput(const QString &)), true ); |
264 | } | 259 | } |
265 | 260 | ||
266 | // All commands executed, allow user to close dialog | 261 | // All commands executed, allow user to close dialog |
267 | m_btnStart->setEnabled( true ); | 262 | m_btnStart->setEnabled( true ); |
268 | m_btnStart->setText( tr( "Close" ) ); | 263 | m_btnStart->setText( tr( "Close" ) ); |
269 | QPixmap pic; | 264 | m_btnStart->setIconSet( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) ); |
270 | pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
271 | m_btnStart->setIconSet( pic ); | ||
272 | 265 | ||
273 | m_btnOptions->setEnabled( true ); | 266 | m_btnOptions->setEnabled( true ); |
274 | m_btnOptions->setText( tr( "Save output" ) ); | 267 | m_btnOptions->setText( tr( "Save output" ) ); |
275 | pic.convertFromImage( Resource::loadImage( "save" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 268 | m_btnOptions->setIconSet( Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ) ); |
276 | m_btnOptions->setIconSet( pic ); | ||
277 | } | 269 | } |
278 | 270 | ||
279 | void InstallDlg::slotBtnOptions() | 271 | void InstallDlg::slotBtnOptions() |
280 | { | 272 | { |
281 | QString btnText = m_btnOptions->text(); | 273 | QString btnText = m_btnOptions->text(); |
282 | if ( btnText == tr( "Options" ) ) | 274 | if ( btnText == tr( "Options" ) ) |
283 | { | 275 | { |
284 | // Display configuration dialog (only options tab is enabled) | 276 | // Display configuration dialog (only options tab is enabled) |
285 | m_packman->configureDlg( true ); | 277 | m_packman->configureDlg( true ); |
286 | return; | 278 | return; |
287 | } | 279 | } |
288 | 280 | ||