author | drw <drw> | 2003-02-01 02:07:22 (UTC) |
---|---|---|
committer | drw <drw> | 2003-02-01 02:07:22 (UTC) |
commit | 766f09a89eef17808e77836f76371aab8ebc4c1c (patch) (unidiff) | |
tree | 3a298c40d5b688dc409a0e6d251a514d88eada48 /noncore/settings/aqpkg/installdlgimpl.cpp | |
parent | 266feac1ac442947651bf169dbf993c4d46d56ea (diff) | |
download | opie-766f09a89eef17808e77836f76371aab8ebc4c1c.zip opie-766f09a89eef17808e77836f76371aab8ebc4c1c.tar.gz opie-766f09a89eef17808e77836f76371aab8ebc4c1c.tar.bz2 |
Many updates to install dialog
Diffstat (limited to 'noncore/settings/aqpkg/installdlgimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 132 |
1 files changed, 93 insertions, 39 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index 75ce1a1..65aaa32 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp | |||
@@ -17,2 +17,4 @@ | |||
17 | 17 | ||
18 | #include <stdio.h> | ||
19 | |||
18 | #ifdef QWS | 20 | #ifdef QWS |
@@ -20,2 +22,3 @@ | |||
20 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/resource.h> | ||
21 | #include <qpe/storage.h> | 24 | #include <qpe/storage.h> |
@@ -23,14 +26,16 @@ | |||
23 | 26 | ||
24 | #include <qmultilineedit.h> | ||
25 | #include <qdialog.h> | ||
26 | #include <qcombobox.h> | ||
27 | #include <qcheckbox.h> | 27 | #include <qcheckbox.h> |
28 | #include <qpushbutton.h> | 28 | #include <qcombobox.h> |
29 | #include <qdialog.h> | ||
30 | #include <qgroupbox.h> | ||
31 | #include <qmultilineedit.h> | ||
29 | #include <qlabel.h> | 32 | #include <qlabel.h> |
30 | 33 | #include <qlayout.h> | |
34 | #include <qpushbutton.h> | ||
31 | 35 | ||
32 | #include "datamgr.h" | 36 | #include "datamgr.h" |
33 | #include "instoptionsimpl.h" | ||
34 | #include "destination.h" | 37 | #include "destination.h" |
38 | #include "instoptionsimpl.h" | ||
35 | #include "installdlgimpl.h" | 39 | #include "installdlgimpl.h" |
40 | #include "ipkg.h" | ||
36 | #include "utils.h" | 41 | #include "utils.h" |
@@ -38,5 +43,8 @@ | |||
38 | 43 | ||
39 | InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) | 44 | InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title = 0 ) |
40 | : InstallDlg( parent, name, modal, fl ) | 45 | : QWidget( 0, 0, 0 ) |
41 | { | 46 | { |
47 | setCaption( title ); | ||
48 | init( TRUE ); | ||
49 | |||
42 | pIpkg = 0; | 50 | pIpkg = 0; |
@@ -60,5 +68,5 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d | |||
60 | output->setReadOnly( true ); | 68 | output->setReadOnly( true ); |
61 | QFont f( "helvetica" ); | 69 | //QFont f( "helvetica" ); |
62 | f.setPointSize( 10 ); | 70 | //f.setPointSize( 10 ); |
63 | output->setFont( f ); | 71 | //output->setFont( f ); |
64 | 72 | ||
@@ -79,5 +87,5 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d | |||
79 | // setup package data | 87 | // setup package data |
80 | QString remove = "Remove\n"; | 88 | QString remove = tr( "Remove\n" ); |
81 | QString install = "\nInstall\n"; | 89 | QString install = tr( "Install\n" ); |
82 | QString upgrade = "\nUpgrade\n"; | 90 | QString upgrade = tr( "Upgrade\n" ); |
83 | for ( it = packageList.begin() ; it != packageList.end() ; ++it ) | 91 | for ( it = packageList.begin() ; it != packageList.end() ; ++it ) |
@@ -88,3 +96,3 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d | |||
88 | installList.push_back( item ); | 96 | installList.push_back( item ); |
89 | install += " " + item.packageName + "\n"; | 97 | install.append( QString( " %1\n" ).arg( item.packageName ) ); |
90 | } | 98 | } |
@@ -93,3 +101,3 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d | |||
93 | removeList.push_back( item ); | 101 | removeList.push_back( item ); |
94 | remove += " " + item.packageName + "\n"; | 102 | remove.append( QString( " %1\n" ).arg( item.packageName ) ); |
95 | } | 103 | } |
@@ -98,10 +106,12 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d | |||
98 | updateList.push_back( item ); | 106 | updateList.push_back( item ); |
99 | QString type = " (Upgrade)"; | 107 | QString type; |
100 | if ( item.option == "R" ) | 108 | if ( item.option == "R" ) |
101 | type = " (ReInstall)"; | 109 | type = tr( "(ReInstall)" ); |
102 | upgrade += " " + item.packageName + type + "\n"; | 110 | else |
103 | } | 111 | type = tr( "(Upgrade)" ); |
112 | upgrade.append( QString( " %1 %2\n" ).arg( item.packageName ).arg( type ) ); | ||
113 | } | ||
104 | } | 114 | } |
105 | 115 | ||
106 | output->setText( remove + install + upgrade ); | 116 | output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); |
107 | 117 | ||
@@ -110,5 +120,7 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d | |||
110 | 120 | ||
111 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl ) | 121 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 ) |
112 | : InstallDlg( parent, name, modal, fl ) | 122 | : QWidget( 0, 0, 0 ) |
113 | { | 123 | { |
124 | setCaption( title ); | ||
125 | init( FALSE ); | ||
114 | pIpkg = ipkg; | 126 | pIpkg = ipkg; |
@@ -120,10 +132,48 @@ InstallDlgImpl::~InstallDlgImpl() | |||
120 | { | 132 | { |
133 | if ( pIpkg ) | ||
134 | delete pIpkg; | ||
121 | } | 135 | } |
122 | 136 | ||
123 | bool InstallDlgImpl :: showDlg() | 137 | void InstallDlgImpl :: init( bool displayextrainfo ) |
124 | { | 138 | { |
125 | showMaximized(); | 139 | QGridLayout *layout = new QGridLayout( this ); |
126 | bool ret = exec(); | 140 | layout->setSpacing( 4 ); |
141 | layout->setMargin( 4 ); | ||
127 | 142 | ||
128 | return ret; | 143 | if ( displayextrainfo ) |
144 | { | ||
145 | QLabel *label = new QLabel( tr( "Destination" ), this ); | ||
146 | layout->addWidget( label, 0, 0 ); | ||
147 | destination = new QComboBox( FALSE, this ); | ||
148 | layout->addWidget( destination, 0, 1 ); | ||
149 | connect( destination, SIGNAL( highlighted( const QString & ) ), | ||
150 | this, SLOT( displayAvailableSpace( const QString & ) ) ); | ||
151 | |||
152 | QLabel *label2 = new QLabel( tr( "Space Avail" ), this ); | ||
153 | layout->addWidget( label2, 1, 0 ); | ||
154 | txtAvailableSpace = new QLabel( "", this ); | ||
155 | layout->addWidget( txtAvailableSpace, 1, 1 ); | ||
156 | } | ||
157 | else | ||
158 | { | ||
159 | destination = 0x0; | ||
160 | txtAvailableSpace = 0x0; | ||
161 | } | ||
162 | |||
163 | QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); | ||
164 | GroupBox2->layout()->setSpacing( 0 ); | ||
165 | GroupBox2->layout()->setMargin( 4 ); | ||
166 | |||
167 | QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() ); | ||
168 | output = new QMultiLineEdit( GroupBox2 ); | ||
169 | GroupBox2Layout->addWidget( output ); | ||
170 | layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 ); | ||
171 | |||
172 | btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this ); | ||
173 | layout->addWidget( btnInstall, 3, 0 ); | ||
174 | connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) ); | ||
175 | |||
176 | btnOptions = new QPushButton( Resource::loadPixmap( "aqpkg/config" ), tr( "Options" ), this ); | ||
177 | layout->addWidget( btnOptions, 3, 1 ); | ||
178 | connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); | ||
129 | } | 179 | } |
@@ -147,3 +197,3 @@ void InstallDlgImpl :: installSelected() | |||
147 | { | 197 | { |
148 | if ( btnInstall->text() == "Abort" ) | 198 | if ( btnInstall->text() == tr( "Abort" ) ) |
149 | { | 199 | { |
@@ -151,5 +201,5 @@ void InstallDlgImpl :: installSelected() | |||
151 | { | 201 | { |
152 | displayText( "\n**** User Clicked ABORT ***" ); | 202 | displayText( tr( "\n**** User Clicked ABORT ***" ) ); |
153 | pIpkg->abort(); | 203 | pIpkg->abort(); |
154 | displayText( "**** Process Aborted ****" ); | 204 | displayText( tr( "**** Process Aborted ****" ) ); |
155 | } | 205 | } |
@@ -157,2 +207,3 @@ void InstallDlgImpl :: installSelected() | |||
157 | btnInstall->setText( tr( "Close" ) ); | 207 | btnInstall->setText( tr( "Close" ) ); |
208 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); | ||
158 | return; | 209 | return; |
@@ -161,3 +212,3 @@ void InstallDlgImpl :: installSelected() | |||
161 | { | 212 | { |
162 | done( 1 ); | 213 | emit reloadData( this ); |
163 | return; | 214 | return; |
@@ -169,4 +220,4 @@ void InstallDlgImpl :: installSelected() | |||
169 | 220 | ||
170 | btnInstall->setText( "Abort" ); | 221 | btnInstall->setText( tr( "Abort" ) ); |
171 | 222 | btnInstall->setIconSet( Resource::loadPixmap( "close" ) ); | |
172 | if ( pIpkg ) | 223 | if ( pIpkg ) |
@@ -174,3 +225,2 @@ void InstallDlgImpl :: installSelected() | |||
174 | output->setText( "" ); | 225 | output->setText( "" ); |
175 | |||
176 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | 226 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
@@ -244,2 +294,3 @@ void InstallDlgImpl :: installSelected() | |||
244 | delete pIpkg; | 294 | delete pIpkg; |
295 | pIpkg = 0; | ||
245 | } | 296 | } |
@@ -249,4 +300,5 @@ void InstallDlgImpl :: installSelected() | |||
249 | btnInstall->setText( tr( "Close" ) ); | 300 | btnInstall->setText( tr( "Close" ) ); |
301 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); | ||
250 | 302 | ||
251 | if ( destination->currentText() != 0 && destination->currentText() != "" ) | 303 | if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) |
252 | displayAvailableSpace( destination->currentText() ); | 304 | displayAvailableSpace( destination->currentText() ); |
@@ -257,4 +309,5 @@ void InstallDlgImpl :: displayText(const QString &text ) | |||
257 | { | 309 | { |
258 | QString t = output->text() + "\n" + text; | 310 | //output->setText( QString( "%1\n%2" ).arg( output->text() ).arg( text ) ); |
259 | output->setText( t ); | 311 | QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); |
312 | output->setText( newtext ); | ||
260 | output->setCursorPosition( output->numLines(), 0 ); | 313 | output->setCursorPosition( output->numLines(), 0 ); |
@@ -286,5 +339,6 @@ void InstallDlgImpl :: displayAvailableSpace( const QString &text ) | |||
286 | else | 339 | else |
287 | space = "Unknown"; | 340 | space = tr( "Unknown" ); |
288 | 341 | ||
289 | txtAvailableSpace->setText( space ); | 342 | if ( txtAvailableSpace ) |
343 | txtAvailableSpace->setText( space ); | ||
290 | } | 344 | } |