Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 134 |
1 files changed, 86 insertions, 48 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 45c89c5..f0992f5 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,3 +1,2 @@ | |||
1 | #include "pmipkg.h" | 1 | #include "pmipkg.h" |
2 | #include "pkdesc.h" | ||
3 | #include "pksettings.h" | 2 | #include "pksettings.h" |
@@ -14,2 +13,3 @@ | |||
14 | #include <qstring.h> | 13 | #include <qstring.h> |
14 | #include <qcheckbox.h> | ||
15 | #include <qtextstream.h> | 15 | #include <qtextstream.h> |
@@ -59,2 +59,5 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
59 | 59 | ||
60 | // if (runwindow->forcedepends->isChecked()) | ||
61 | // cmd += " -force-depends "; | ||
62 | |||
60 | out( "<hr><br>Starting to "+ args+"<br>\n"); | 63 | out( "<hr><br>Starting to "+ args+"<br>\n"); |
@@ -73,3 +76,3 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
73 | QString redirect = "/tmp/oipkg.pipe"; | 76 | QString redirect = "/tmp/oipkg.pipe"; |
74 | cmd += " | tee "+redirect+" 2>&1"; | 77 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; |
75 | pvDebug(2, "running >"+cmd+"<"); | 78 | pvDebug(2, "running >"+cmd+"<"); |
@@ -105,4 +108,2 @@ void PmIpkg::makeLinks(Package *pack) | |||
105 | if (dest == "/" ) return; | 108 | if (dest == "/" ) return; |
106 | out( "<br>creating links<br>" ); | ||
107 | out("for package "+pack->name()+" in "+dest+"<br>"); | ||
108 | { | 109 | { |
@@ -124,2 +125,4 @@ void PmIpkg::linkPackage( QString packFileName, QString dest ) | |||
124 | }; | 125 | }; |
126 | out( "<br>creating links<br>" ); | ||
127 | out("for package "+packFileName+" in "+dest+"<br>"); | ||
125 | QTextStream t( &f ); | 128 | QTextStream t( &f ); |
@@ -136,2 +139,3 @@ void PmIpkg::processLinkDir( QString file, QString dest ) | |||
136 | { | 139 | { |
140 | pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); | ||
137 | if ( dest == "???" ) return; | 141 | if ( dest == "???" ) return; |
@@ -169,11 +173,7 @@ void PmIpkg::commit( PackageList pl ) | |||
169 | { | 173 | { |
170 | show( false ); | 174 | int sizecount = 0; |
171 | runwindow->outPut->setText(""); | ||
172 | out( "<h1>"+tr("Todo")+"</h1>\n"); | ||
173 | |||
174 | to_install.clear(); | 175 | to_install.clear(); |
175 | to_remove.clear(); | 176 | to_remove.clear(); |
176 | int sizecount = 0; | 177 | QString rem="<b>"+tr("To remove:")+"</b><br>\n"; |
177 | QString rem="<b>To remove:</b><br>\n"; | 178 | QString inst="<b>"+tr("To install:")+"</b><br>\n"; |
178 | QString inst="<b>To install:</b><br>\n";; | ||
179 | pl.allPackages(); | 179 | pl.allPackages(); |
@@ -187,3 +187,3 @@ void PmIpkg::commit( PackageList pl ) | |||
187 | sizecount += pack->size().toInt(); | 187 | sizecount += pack->size().toInt(); |
188 | inst += pack->name()+"\t(on "+pack->dest()+")<br>"; | 188 | inst += pack->name()+"\t("+tr("on ")+pack->dest()+")<br>"; |
189 | } | 189 | } |
@@ -198,19 +198,73 @@ void PmIpkg::commit( PackageList pl ) | |||
198 | 198 | ||
199 | out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>"); | 199 | startDialog(); |
200 | |||
201 | qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count()); | ||
202 | 200 | ||
203 | runwindow->progress->setTotalSteps( sizecount ); | 201 | } |
204 | 202 | ||
205 | connect( runwindow->doItButton, SIGNAL( clicked() ), | 203 | void PmIpkg::startDialog() |
206 | SLOT( doIt() ) ); | 204 | { |
207 | connect( runwindow->installButton, SIGNAL( clicked() ), | 205 | QDialog *d = new QDialog(); |
206 | QGridLayout *RunWindowLayout = new QGridLayout( d ); | ||
207 | RunWindowLayout->setSpacing( 2 ); | ||
208 | RunWindowLayout->setMargin( 2 ); | ||
209 | |||
210 | QHBoxLayout *buttons = new QHBoxLayout; | ||
211 | buttons->setSpacing( 6 ); | ||
212 | buttons->setMargin( 0 ); | ||
213 | |||
214 | PackageListView *plv = new PackageListView(d, "install",settings); | ||
215 | RunWindowLayout->addWidget( plv, 1, 0 ); | ||
216 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | ||
217 | { | ||
218 | plv->insertItem( new PackageListItem(plv, it,settings) ); | ||
219 | } | ||
220 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | ||
221 | { | ||
222 | plv->insertItem( new PackageListItem(plv, it,settings) ); | ||
223 | } | ||
224 | QPushButton *doItButton = new QPushButton( d, "doItButton" ); | ||
225 | doItButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, doItButton->sizePolicy().hasHeightForWidth() ) ); | ||
226 | QFont doItButton_font( doItButton->font() ); | ||
227 | doItButton_font.setPointSize( 8 ); | ||
228 | doItButton->setFont( doItButton_font ); | ||
229 | doItButton->setText( tr( "Do all " ) ); | ||
230 | doItButton->setAutoResize( FALSE ); | ||
231 | buttons->addWidget( doItButton ); | ||
232 | |||
233 | QPushButton *installButton = new QPushButton( d, "installButton" ); | ||
234 | QFont installButton_font( installButton->font() ); | ||
235 | installButton_font.setPointSize( 8 ); | ||
236 | installButton->setFont( installButton_font ); | ||
237 | installButton->setText( tr( "Install" ) ); | ||
238 | installButton->setAutoResize( TRUE ); | ||
239 | buttons->addWidget( installButton ); | ||
240 | |||
241 | QPushButton *removeButton = new QPushButton( d, "removeButton" ); | ||
242 | QFont removeButton_font( removeButton->font() ); | ||
243 | removeButton_font.setPointSize( 7 ); | ||
244 | removeButton->setFont( removeButton_font ); | ||
245 | removeButton->setText( tr( "Remove" ) ); | ||
246 | removeButton->setAutoResize( TRUE ); | ||
247 | buttons->addWidget( removeButton ); | ||
248 | |||
249 | QPushButton *cancelButton = new QPushButton( d, "cancelButton" ); | ||
250 | QFont cancelButton_font( cancelButton->font() ); | ||
251 | cancelButton_font.setPointSize( 8 ); | ||
252 | cancelButton->setFont( cancelButton_font ); | ||
253 | cancelButton->setText( tr( "Cancel" ) ); | ||
254 | cancelButton->setAutoResize( TRUE ); | ||
255 | buttons->addWidget( cancelButton ); | ||
256 | |||
257 | RunWindowLayout->addLayout( buttons, 3, 0 ); | ||
258 | |||
259 | connect( doItButton, SIGNAL( clicked() ), | ||
260 | this, SLOT( doIt() ) ); | ||
261 | connect( installButton, SIGNAL( clicked() ), | ||
208 | this, SLOT( install() ) ); | 262 | this, SLOT( install() ) ); |
209 | connect( runwindow->removeButton, SIGNAL( clicked() ), | 263 | connect( removeButton, SIGNAL( clicked() ), |
210 | this, SLOT( remove() ) ); | 264 | this, SLOT( remove() ) ); |
211 | connect( runwindow->cancelButton, SIGNAL( clicked() ), | 265 | connect( cancelButton, SIGNAL( clicked() ), |
212 | runwindow, SLOT( close() ) ); | 266 | d, SLOT( close() ) ); |
213 | 267 | d->showMaximized(); | |
214 | runwindow->exec(); | 268 | d->exec(); |
215 | out("<h1>"+tr("Its now save to close this window")+"<h1>"); | 269 | // d->close(); |
216 | } | 270 | } |
@@ -253,3 +307,3 @@ void PmIpkg::install() | |||
253 | 307 | ||
254 | if ( runIpkg("install " + it->name(), it->dest() ) == 0 ) | 308 | if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 ) |
255 | { | 309 | { |
@@ -316,3 +370,3 @@ void PmIpkg::show(bool b) | |||
316 | showButtons(b); | 370 | showButtons(b); |
317 | if ( b ) | 371 | if ( !b ) |
318 | runwindow->progress->hide(); | 372 | runwindow->progress->hide(); |
@@ -324,25 +378,9 @@ void PmIpkg::installFile(const QString &fileName) | |||
324 | { | 378 | { |
379 | |||
380 | to_install.clear(); | ||
381 | to_remove.clear(); | ||
325 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | 382 | pvDebug( 2,"PmIpkg::installFile "+ fileName); |
326 | show( false ); | 383 | to_install.append( new Package(fileName,settings) ); |
327 | runwindow->outPut->setText(""); | 384 | startDialog(); |
328 | fileNameToInstall = fileName; | ||
329 | runwindow->doItButton->hide(); | ||
330 | runwindow->removeButton->hide(); | ||
331 | out("<b>"+tr("Install: ")+fileName); | ||
332 | connect( runwindow->installButton, SIGNAL( clicked() ), | ||
333 | this, SLOT( installFileName() ) ); | ||
334 | connect( runwindow->cancelButton, SIGNAL( clicked() ), | ||
335 | runwindow, SLOT( close() ) ); | ||
336 | |||
337 | runwindow->exec(); | ||
338 | } | 385 | } |
339 | 386 | ||
340 | void PmIpkg::installFileName() | ||
341 | { | ||
342 | if ( !QFile::exists( fileNameToInstall ) ) return; | ||
343 | out(tr("Installing pacakge ")+fileNameToInstall+"<br>"+tr("please wait")+"</b><br>"); | ||
344 | runIpkg("install " + fileNameToInstall ); | ||
345 | if ( settings->createLinks() ) | ||
346 | linkPackage( fileNameToInstall, settings->getDestinationUrl() ); | ||
347 | out("<h1>"+tr("Its now save to close this window")+"<h1>"); | ||
348 | } \ No newline at end of file | ||