-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 65 |
1 files changed, 61 insertions, 4 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index 06e2a03..0bc01df 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp | |||
@@ -11,48 +11,49 @@ | |||
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include <fstream> | 18 | #include <fstream> |
19 | #include <iostream> | 19 | #include <iostream> |
20 | using namespace std; | 20 | using namespace std; |
21 | 21 | ||
22 | #include <unistd.h> | 22 | #include <unistd.h> |
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include <linux/limits.h> | 24 | #include <linux/limits.h> |
25 | 25 | ||
26 | #ifdef QWS | 26 | #ifdef QWS |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/qcopenvelope_qws.h> | 28 | #include <qpe/qcopenvelope_qws.h> |
29 | #include <qpe/config.h> | 29 | #include <qpe/config.h> |
30 | #else | 30 | #else |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | #endif | 32 | #endif |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qmessagebox.h> | ||
35 | 36 | ||
36 | #include "datamgr.h" | 37 | #include "datamgr.h" |
37 | #include "networkpkgmgr.h" | 38 | #include "networkpkgmgr.h" |
38 | #include "installdlgimpl.h" | 39 | #include "installdlgimpl.h" |
39 | #include "ipkg.h" | 40 | #include "ipkg.h" |
40 | #include "inputdlg.h" | 41 | #include "inputdlg.h" |
41 | 42 | ||
42 | #include "global.h" | 43 | #include "global.h" |
43 | 44 | ||
44 | NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) | 45 | NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) |
45 | : QWidget(parent, name) | 46 | : QWidget(parent, name) |
46 | { | 47 | { |
47 | dataMgr = dataManager; | 48 | dataMgr = dataManager; |
48 | 49 | ||
49 | initGui(); | 50 | initGui(); |
50 | setupConnections(); | 51 | setupConnections(); |
51 | 52 | ||
52 | progressDlg = 0; | 53 | progressDlg = 0; |
53 | timerId = startTimer( 100 ); | 54 | timerId = startTimer( 100 ); |
54 | } | 55 | } |
55 | 56 | ||
56 | NetworkPackageManager::~NetworkPackageManager() | 57 | NetworkPackageManager::~NetworkPackageManager() |
57 | { | 58 | { |
58 | } | 59 | } |
@@ -76,77 +77,80 @@ void NetworkPackageManager :: updateData() | |||
76 | vector<Server>::iterator it; | 77 | vector<Server>::iterator it; |
77 | int activeItem = -1; | 78 | int activeItem = -1; |
78 | int i; | 79 | int i; |
79 | for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) | 80 | for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) |
80 | { | 81 | { |
81 | serversList->insertItem( it->getServerName() ); | 82 | serversList->insertItem( it->getServerName() ); |
82 | if ( it->getServerName() == dataMgr->getActiveServer() ) | 83 | if ( it->getServerName() == dataMgr->getActiveServer() ) |
83 | activeItem = i; | 84 | activeItem = i; |
84 | } | 85 | } |
85 | 86 | ||
86 | // set selected server to be active server | 87 | // set selected server to be active server |
87 | if ( activeItem != -1 ) | 88 | if ( activeItem != -1 ) |
88 | serversList->setCurrentItem( activeItem ); | 89 | serversList->setCurrentItem( activeItem ); |
89 | serverSelected( 0 ); | 90 | serverSelected( 0 ); |
90 | } | 91 | } |
91 | 92 | ||
92 | 93 | ||
93 | void NetworkPackageManager :: initGui() | 94 | void NetworkPackageManager :: initGui() |
94 | { | 95 | { |
95 | QLabel *l = new QLabel( "Servers", this ); | 96 | QLabel *l = new QLabel( "Servers", this ); |
96 | serversList = new QComboBox( this ); | 97 | serversList = new QComboBox( this ); |
97 | packagesList = new QListView( this ); | 98 | packagesList = new QListView( this ); |
98 | update = new QPushButton( "Refresh List", this ); | 99 | update = new QPushButton( "Refresh List", this ); |
99 | download = new QPushButton( "Download", this ); | 100 | download = new QPushButton( "Download", this ); |
101 | upgrade = new QPushButton( "Upgrade", this ); | ||
100 | apply = new QPushButton( "Apply", this ); | 102 | apply = new QPushButton( "Apply", this ); |
101 | 103 | ||
102 | QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" ); | 104 | QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" ); |
103 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" ); | 105 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" ); |
104 | hbox1->addWidget( l ); | 106 | hbox1->addWidget( l ); |
105 | hbox1->addWidget( serversList ); | 107 | hbox1->addWidget( serversList ); |
106 | 108 | ||
107 | vbox->addWidget( packagesList ); | 109 | vbox->addWidget( packagesList ); |
108 | packagesList->addColumn( "Packages" ); | 110 | packagesList->addColumn( "Packages" ); |
109 | 111 | ||
110 | QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" ); | 112 | QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" ); |
111 | hbox2->addWidget( update ); | 113 | hbox2->addWidget( update ); |
112 | hbox2->addWidget( download ); | 114 | hbox2->addWidget( download ); |
115 | hbox2->addWidget( upgrade ); | ||
113 | hbox2->addWidget( apply ); | 116 | hbox2->addWidget( apply ); |
114 | } | 117 | } |
115 | 118 | ||
116 | void NetworkPackageManager :: setupConnections() | 119 | void NetworkPackageManager :: setupConnections() |
117 | { | 120 | { |
118 | connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); | 121 | connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); |
119 | connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) ); | 122 | connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) ); |
120 | connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) ); | 123 | connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) ); |
124 | connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) ); | ||
121 | connect( update, SIGNAL(released()), this, SLOT(updateServer()) ); | 125 | connect( update, SIGNAL(released()), this, SLOT(updateServer()) ); |
122 | } | 126 | } |
123 | 127 | ||
124 | void NetworkPackageManager :: showProgressDialog() | 128 | void NetworkPackageManager :: showProgressDialog( char *initialText ) |
125 | { | 129 | { |
126 | if ( !progressDlg ) | 130 | if ( !progressDlg ) |
127 | progressDlg = new ProgressDlg( this, "Progress", false ); | 131 | progressDlg = new ProgressDlg( this, "Progress", false ); |
128 | progressDlg->setText( "Reading installed packages" ); | 132 | progressDlg->setText( initialText ); |
129 | progressDlg->show(); | 133 | progressDlg->show(); |
130 | } | 134 | } |
131 | 135 | ||
132 | 136 | ||
133 | void NetworkPackageManager :: serverSelected( int ) | 137 | void NetworkPackageManager :: serverSelected( int ) |
134 | { | 138 | { |
135 | packagesList->clear(); | 139 | packagesList->clear(); |
136 | 140 | ||
137 | // display packages | 141 | // display packages |
138 | QString serverName = serversList->currentText(); | 142 | QString serverName = serversList->currentText(); |
139 | Server *s = dataMgr->getServer( serverName ); | 143 | Server *s = dataMgr->getServer( serverName ); |
140 | dataMgr->setActiveServer( serverName ); | 144 | dataMgr->setActiveServer( serverName ); |
141 | 145 | ||
142 | vector<Package> &list = s->getPackageList(); | 146 | vector<Package> &list = s->getPackageList(); |
143 | vector<Package>::iterator it; | 147 | vector<Package>::iterator it; |
144 | for ( it = list.begin() ; it != list.end() ; ++it ) | 148 | for ( it = list.begin() ; it != list.end() ; ++it ) |
145 | { | 149 | { |
146 | QString text = ""; | 150 | QString text = ""; |
147 | 151 | ||
148 | // If the local server, only display installed packages | 152 | // If the local server, only display installed packages |
149 | if ( serverName == LOCAL_SERVER && !it->isInstalled() ) | 153 | if ( serverName == LOCAL_SERVER && !it->isInstalled() ) |
150 | continue; | 154 | continue; |
151 | 155 | ||
152 | text += it->getPackageName(); | 156 | text += it->getPackageName(); |
@@ -154,98 +158,134 @@ void NetworkPackageManager :: serverSelected( int ) | |||
154 | { | 158 | { |
155 | text += " (installed)"; | 159 | text += " (installed)"; |
156 | 160 | ||
157 | // If a different version of package is available, postfix it with an * | 161 | // If a different version of package is available, postfix it with an * |
158 | if ( it->getVersion() != it->getInstalledVersion() ) | 162 | if ( it->getVersion() != it->getInstalledVersion() ) |
159 | text += "*"; | 163 | text += "*"; |
160 | } | 164 | } |
161 | 165 | ||
162 | QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); | 166 | QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); |
163 | if ( !it->isPackageStoredLocally() ) | 167 | if ( !it->isPackageStoredLocally() ) |
164 | new QCheckListItem( item, QString( "Description - " ) + it->getDescription() ); | 168 | new QCheckListItem( item, QString( "Description - " ) + it->getDescription() ); |
165 | else | 169 | else |
166 | new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() ); | 170 | new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() ); |
167 | 171 | ||
168 | new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() ); | 172 | new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() ); |
169 | if ( it->getLocalPackage() ) | 173 | if ( it->getLocalPackage() ) |
170 | { | 174 | { |
171 | if ( it->isInstalled() ) | 175 | if ( it->isInstalled() ) |
172 | new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() ); | 176 | new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() ); |
173 | } | 177 | } |
174 | packagesList->insertItem( item ); | 178 | packagesList->insertItem( item ); |
175 | } | 179 | } |
176 | 180 | ||
177 | // If the local server or the local ipkgs server disable the download button | 181 | // If the local server or the local ipkgs server disable the download button |
178 | download->setText( "Download" ); | ||
179 | if ( serverName == LOCAL_SERVER ) | 182 | if ( serverName == LOCAL_SERVER ) |
183 | { | ||
184 | upgrade->setEnabled( false ); | ||
185 | download->setText( "Download" ); | ||
180 | download->setEnabled( false ); | 186 | download->setEnabled( false ); |
187 | } | ||
181 | else if ( serverName == LOCAL_IPKGS ) | 188 | else if ( serverName == LOCAL_IPKGS ) |
182 | { | 189 | { |
190 | upgrade->setEnabled( false ); | ||
183 | download->setEnabled( true ); | 191 | download->setEnabled( true ); |
184 | download->setText( "Remove" ); | 192 | download->setText( "Remove" ); |
185 | } | 193 | } |
186 | else | 194 | else |
195 | { | ||
196 | upgrade->setEnabled( true ); | ||
187 | download->setEnabled( true ); | 197 | download->setEnabled( true ); |
198 | download->setText( "Download" ); | ||
199 | } | ||
188 | } | 200 | } |
189 | 201 | ||
190 | void NetworkPackageManager :: updateServer() | 202 | void NetworkPackageManager :: updateServer() |
191 | { | 203 | { |
192 | QString serverName = serversList->currentText(); | 204 | QString serverName = serversList->currentText(); |
193 | 205 | ||
194 | // Update the current server | 206 | // Update the current server |
195 | // Display dialog | 207 | // Display dialog |
196 | ProgressDlg *dlg = new ProgressDlg( this ); | 208 | ProgressDlg *dlg = new ProgressDlg( this ); |
197 | QString status = "Updating package list for "; | 209 | QString status = "Updating package list for "; |
198 | status += serverName; | 210 | status += serverName; |
199 | dlg->show(); | 211 | dlg->show(); |
200 | dlg->setText( status ); | 212 | dlg->setText( status ); |
201 | 213 | ||
202 | // Disable buttons to stop silly people clicking lots on them :) | 214 | // Disable buttons to stop silly people clicking lots on them :) |
203 | 215 | ||
204 | // First, write out ipkg_conf file so that ipkg can use it | 216 | // First, write out ipkg_conf file so that ipkg can use it |
205 | dataMgr->writeOutIpkgConf(); | 217 | dataMgr->writeOutIpkgConf(); |
206 | 218 | ||
207 | if ( serverName == LOCAL_SERVER ) | 219 | if ( serverName == LOCAL_SERVER ) |
208 | ; | 220 | ; |
209 | else if ( serverName == LOCAL_IPKGS ) | 221 | else if ( serverName == LOCAL_IPKGS ) |
210 | ; | 222 | ; |
211 | else | 223 | else |
212 | { | 224 | { |
213 | QString option = "update"; | 225 | QString option = "update"; |
214 | QString dummy = ""; | 226 | QString dummy = ""; |
215 | Ipkg ipkg; | 227 | Ipkg ipkg; |
216 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | 228 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
217 | ipkg.setOption( option ); | 229 | ipkg.setOption( option ); |
218 | 230 | ||
219 | ipkg.runIpkg( ); | 231 | ipkg.runIpkg( ); |
220 | } | 232 | } |
221 | 233 | ||
222 | // Reload data | 234 | // Reload data |
223 | dataMgr->reloadServerData( serversList->currentText() ); | 235 | dataMgr->reloadServerData( serversList->currentText() ); |
224 | serverSelected(-1); | 236 | serverSelected(-1); |
225 | delete dlg; | 237 | delete dlg; |
226 | } | 238 | } |
227 | 239 | ||
240 | void NetworkPackageManager :: upgradePackages() | ||
241 | { | ||
242 | // We're gonna do an upgrade of all packages | ||
243 | // First warn user that this isn't recommended | ||
244 | QString text = "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n"; | ||
245 | QMessageBox warn("Warning", text, QMessageBox::Warning, | ||
246 | QMessageBox::Yes, | ||
247 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , | ||
248 | 0, this ); | ||
249 | warn.adjustSize(); | ||
250 | |||
251 | if ( warn.exec() == QMessageBox::Yes ) | ||
252 | { | ||
253 | // First, write out ipkg_conf file so that ipkg can use it | ||
254 | dataMgr->writeOutIpkgConf(); | ||
255 | |||
256 | // Now run upgrade | ||
257 | InstallDlgImpl dlg( this, "Upgrade", true ); | ||
258 | dlg.showDlg(); | ||
259 | |||
260 | // Reload data | ||
261 | dataMgr->reloadServerData( LOCAL_SERVER ); | ||
262 | |||
263 | dataMgr->reloadServerData( serversList->currentText() ); | ||
264 | serverSelected(-1); | ||
265 | } | ||
266 | } | ||
267 | |||
228 | 268 | ||
229 | void NetworkPackageManager :: downloadPackage() | 269 | void NetworkPackageManager :: downloadPackage() |
230 | { | 270 | { |
231 | if ( download->text() == "Download" ) | 271 | if ( download->text() == "Download" ) |
232 | { | 272 | { |
233 | // First, write out ipkg_conf file so that ipkg can use it | 273 | // First, write out ipkg_conf file so that ipkg can use it |
234 | dataMgr->writeOutIpkgConf(); | 274 | dataMgr->writeOutIpkgConf(); |
235 | 275 | ||
236 | // Display dialog to user asking where to download the files to | 276 | // Display dialog to user asking where to download the files to |
237 | bool ok = FALSE; | 277 | bool ok = FALSE; |
238 | QString dir = ""; | 278 | QString dir = ""; |
239 | #ifdef QWS | 279 | #ifdef QWS |
240 | // read download directory from config file | 280 | // read download directory from config file |
241 | Config cfg( "aqpkg" ); | 281 | Config cfg( "aqpkg" ); |
242 | cfg.setGroup( "settings" ); | 282 | cfg.setGroup( "settings" ); |
243 | dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); | 283 | dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); |
244 | #endif | 284 | #endif |
245 | 285 | ||
246 | QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); | 286 | QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); |
247 | if ( ok && !text.isEmpty() ) | 287 | if ( ok && !text.isEmpty() ) |
248 | dir = text; // user entered something and pressed ok | 288 | dir = text; // user entered something and pressed ok |
249 | else | 289 | else |
250 | return; // user entered nothing or pressed cancel | 290 | return; // user entered nothing or pressed cancel |
251 | 291 | ||
@@ -322,75 +362,92 @@ void NetworkPackageManager :: applyChanges() | |||
322 | dataMgr->writeOutIpkgConf(); | 362 | dataMgr->writeOutIpkgConf(); |
323 | 363 | ||
324 | // Now for each selected item | 364 | // Now for each selected item |
325 | // deal with it | 365 | // deal with it |
326 | 366 | ||
327 | vector<QString> workingPackages; | 367 | vector<QString> workingPackages; |
328 | QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 368 | QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
329 | do | 369 | do |
330 | { | 370 | { |
331 | if ( item->isOn() ) | 371 | if ( item->isOn() ) |
332 | { | 372 | { |
333 | QString p = dealWithItem( item ); | 373 | QString p = dealWithItem( item ); |
334 | workingPackages.push_back( p ); | 374 | workingPackages.push_back( p ); |
335 | } | 375 | } |
336 | 376 | ||
337 | item = (QCheckListItem *)item->nextSibling(); | 377 | item = (QCheckListItem *)item->nextSibling(); |
338 | } while ( item ); | 378 | } while ( item ); |
339 | 379 | ||
340 | // do the stuff | 380 | // do the stuff |
341 | InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true ); | 381 | InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true ); |
342 | dlg.showDlg(); | 382 | dlg.showDlg(); |
343 | 383 | ||
344 | // Reload data | 384 | // Reload data |
345 | dataMgr->reloadServerData( LOCAL_SERVER ); | 385 | dataMgr->reloadServerData( LOCAL_SERVER ); |
386 | |||
346 | dataMgr->reloadServerData( serversList->currentText() ); | 387 | dataMgr->reloadServerData( serversList->currentText() ); |
347 | serverSelected(-1); | 388 | serverSelected(-1); |
348 | 389 | ||
349 | #ifdef QWS | 390 | #ifdef QWS |
350 | // Finally let the main system update itself | 391 | // Finally let the main system update itself |
351 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 392 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
352 | QString lf = QString::null; | 393 | QString lf = QString::null; |
353 | e << lf; | 394 | e << lf; |
354 | #endif | 395 | #endif |
355 | } | 396 | } |
356 | 397 | ||
357 | // decide what to do - either remove, upgrade or install | 398 | // decide what to do - either remove, upgrade or install |
358 | // Current rules: | 399 | // Current rules: |
359 | // If not installed - install | 400 | // If not installed - install |
360 | // If installed and different version available - upgrade | 401 | // If installed and different version available - upgrade |
361 | // If installed and version up to date - remove | 402 | // If installed and version up to date - remove |
362 | QString NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | 403 | QString NetworkPackageManager :: dealWithItem( QCheckListItem *item ) |
363 | { | 404 | { |
364 | QString name = item->text(); | 405 | QString name = item->text(); |
365 | int pos = name.find( "*" ); | 406 | int pos = name.find( "*" ); |
366 | name.truncate( pos ); | 407 | name.truncate( pos ); |
367 | 408 | ||
368 | // if (there is a (installed), remove it | 409 | // if (there is a (installed), remove it |
369 | pos = name.find( "(installed)" ); | 410 | pos = name.find( "(installed)" ); |
370 | if ( pos > 0 ) | 411 | if ( pos > 0 ) |
371 | name.truncate( pos - 1 ); | 412 | name.truncate( pos - 1 ); |
372 | 413 | ||
373 | // Get package | 414 | // Get package |
374 | Server *s = dataMgr->getServer( serversList->currentText() ); | 415 | Server *s = dataMgr->getServer( serversList->currentText() ); |
375 | Package *p = s->getPackage( name ); | 416 | Package *p = s->getPackage( name ); |
376 | 417 | ||
377 | // If the package has a filename then it is a local file | 418 | // If the package has a filename then it is a local file |
378 | if ( p->isPackageStoredLocally() ) | 419 | if ( p->isPackageStoredLocally() ) |
379 | name = p->getFilename(); | 420 | name = p->getFilename(); |
380 | QString option; | 421 | QString option; |
381 | QString dest = "root"; | 422 | QString dest = "root"; |
382 | if ( !p->isInstalled() ) | 423 | if ( !p->isInstalled() ) |
383 | return QString( "I" ) + name; | 424 | return QString( "I" ) + name; |
384 | else | 425 | else |
385 | { | 426 | { |
386 | if ( p->getVersion() == p->getInstalledVersion() ) | 427 | if ( p->getVersion() == p->getInstalledVersion() ) |
387 | return QString( "D" ) + name; | 428 | { |
429 | QString msgtext; | ||
430 | msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name ); | ||
431 | switch( QMessageBox::information( this, "Remove or ReInstall", | ||
432 | msgtext, "Remove", "ReInstall" ) ) | ||
433 | { | ||
434 | case 0: // Try again or Enter | ||
435 | return QString( "D" ) + name; | ||
436 | break; | ||
437 | case 1: // Quit or Escape | ||
438 | return QString( "U" ) + name; | ||
439 | break; | ||
440 | } | ||
441 | |||
442 | // User hit cancel (on dlg - assume remove) | ||
443 | return QString( "D" ) + name; | ||
444 | } | ||
388 | else | 445 | else |
389 | return QString( "U" ) + name; | 446 | return QString( "U" ) + name; |
390 | } | 447 | } |
391 | } | 448 | } |
392 | 449 | ||
393 | void NetworkPackageManager :: displayText( const QString &t ) | 450 | void NetworkPackageManager :: displayText( const QString &t ) |
394 | { | 451 | { |
395 | cout << t << endl; | 452 | cout << t << endl; |
396 | } | 453 | } |