-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index 9339086..1f0bb5f 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp | |||
@@ -28,32 +28,36 @@ | |||
28 | #include <qcombobox.h> | 28 | #include <qcombobox.h> |
29 | #include <qdialog.h> | 29 | #include <qdialog.h> |
30 | #include <qgroupbox.h> | 30 | #include <qgroupbox.h> |
31 | #include <qmultilineedit.h> | 31 | #include <qmultilineedit.h> |
32 | #include <qlabel.h> | 32 | #include <qlabel.h> |
33 | #include <qlayout.h> | 33 | #include <qlayout.h> |
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | 35 | ||
36 | #include "datamgr.h" | 36 | #include "datamgr.h" |
37 | #include "destination.h" | 37 | #include "destination.h" |
38 | #include "instoptionsimpl.h" | 38 | #include "instoptionsimpl.h" |
39 | #include "installdlgimpl.h" | 39 | #include "installdlgimpl.h" |
40 | #include "ipkg.h" | 40 | #include "ipkg.h" |
41 | #include "utils.h" | 41 | #include "utils.h" |
42 | #include "global.h" | 42 | #include "global.h" |
43 | 43 | ||
44 | enum { | ||
45 | MAXLINES = 100, | ||
46 | }; | ||
47 | |||
44 | InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title ) | 48 | InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title ) |
45 | : QWidget( 0, 0, 0 ) | 49 | : QWidget( 0, 0, 0 ) |
46 | { | 50 | { |
47 | setCaption( title ); | 51 | setCaption( title ); |
48 | init( TRUE ); | 52 | init( TRUE ); |
49 | 53 | ||
50 | pIpkg = 0; | 54 | pIpkg = 0; |
51 | upgradePackages = false; | 55 | upgradePackages = false; |
52 | dataMgr = dataManager; | 56 | dataMgr = dataManager; |
53 | 57 | ||
54 | QString defaultDest = "root"; | 58 | QString defaultDest = "root"; |
55 | #ifdef QWS | 59 | #ifdef QWS |
56 | Config cfg( "aqpkg" ); | 60 | Config cfg( "aqpkg" ); |
57 | cfg.setGroup( "settings" ); | 61 | cfg.setGroup( "settings" ); |
58 | defaultDest = cfg.readEntry( "dest", "root" ); | 62 | defaultDest = cfg.readEntry( "dest", "root" ); |
59 | 63 | ||
@@ -306,32 +310,38 @@ void InstallDlgImpl :: installSelected() | |||
306 | pIpkg = 0; | 310 | pIpkg = 0; |
307 | } | 311 | } |
308 | 312 | ||
309 | btnOptions->setEnabled( true ); | 313 | btnOptions->setEnabled( true ); |
310 | // btnInstall->setEnabled( true ); | 314 | // btnInstall->setEnabled( true ); |
311 | btnInstall->setText( tr( "Close" ) ); | 315 | btnInstall->setText( tr( "Close" ) ); |
312 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); | 316 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); |
313 | 317 | ||
314 | if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) | 318 | if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) |
315 | displayAvailableSpace( destination->currentText() ); | 319 | displayAvailableSpace( destination->currentText() ); |
316 | } | 320 | } |
317 | 321 | ||
318 | 322 | ||
319 | void InstallDlgImpl :: displayText(const QString &text ) | 323 | void InstallDlgImpl :: displayText(const QString &text ) |
320 | { | 324 | { |
321 | QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); | 325 | QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); |
326 | |||
327 | /* Set a max line count for the QMultiLineEdit, as users have reported | ||
328 | * performance issues when line count gets extreme. | ||
329 | */ | ||
330 | if(output->numLines() >= MAXLINES) | ||
331 | output->removeLine(0); | ||
322 | output->setText( newtext ); | 332 | output->setText( newtext ); |
323 | output->setCursorPosition( output->numLines(), 0 ); | 333 | output->setCursorPosition( output->numLines(), 0 ); |
324 | } | 334 | } |
325 | 335 | ||
326 | 336 | ||
327 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) | 337 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) |
328 | { | 338 | { |
329 | Destination *d = dataMgr->getDestination( text ); | 339 | Destination *d = dataMgr->getDestination( text ); |
330 | QString destDir = d->getDestinationPath(); | 340 | QString destDir = d->getDestinationPath(); |
331 | 341 | ||
332 | long blockSize = 0; | 342 | long blockSize = 0; |
333 | long totalBlocks = 0; | 343 | long totalBlocks = 0; |
334 | long availBlocks = 0; | 344 | long availBlocks = 0; |
335 | QString space; | 345 | QString space; |
336 | if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) | 346 | if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) |
337 | { | 347 | { |