summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/pmipkg.cpp
authortille <tille>2002-05-03 09:40:11 (UTC)
committer tille <tille>2002-05-03 09:40:11 (UTC)
commit6bf450ac622d22ba7e9156e474a7abb714167eba (patch) (unidiff)
treeff89dd745715e0b540e6c8f17b6af4dec4c3c84a /noncore/unsupported/oipkg/pmipkg.cpp
parent6ebb8228b660634b4ca8a2a5bf05aef828e39f31 (diff)
downloadopie-6bf450ac622d22ba7e9156e474a7abb714167eba.zip
opie-6bf450ac622d22ba7e9156e474a7abb714167eba.tar.gz
opie-6bf450ac622d22ba7e9156e474a7abb714167eba.tar.bz2
added install dialog with ipkg options (that are shown ;)
Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp78
1 files changed, 23 insertions, 55 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index be9d6da..fd8279b 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -54,19 +54,19 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest )
54 cmd += " -dest "+settings->getDestinationName(); 54 cmd += " -dest "+settings->getDestinationName();
55 else 55 else
56 cmd += " -dest "+ dest; 56 cmd += " -dest "+ dest;
57 57
58 cmd += " -force-defaults "; 58 cmd += " -force-defaults ";
59 59
60 if (_force_depends) 60 if (installDialog->_force_depends)
61 { 61 {
62 if (_force_depends->isChecked()) 62 if (installDialog->_force_depends->isChecked())
63 cmd += " -force-depends "; 63 cmd += " -force-depends ";
64 if (_force_reinstall->isChecked()) 64 if (installDialog->_force_reinstall->isChecked())
65 cmd += " -force-reinstall "; 65 cmd += " -force-reinstall ";
66 if (_force_remove->isChecked()) 66 if (installDialog->_force_remove->isChecked())
67 cmd += " -force-removal-of-essential-packages "; 67 cmd += " -force-removal-of-essential-packages ";
68 } 68 }
69 69
70 out( "<hr><br>Starting to "+ args+"<br>\n"); 70 out( "<hr><br>Starting to "+ args+"<br>\n");
71 cmd += args; 71 cmd += args;
72 int r = 0; 72 int r = 0;
@@ -170,26 +170,23 @@ void PmIpkg::processLinkDir( QString file, QString dest )
170 if ( fileInfo.isDir() ) 170 if ( fileInfo.isDir() )
171 { 171 {
172 pvDebug(4, "process dir "+file); 172 pvDebug(4, "process dir "+file);
173 QDir destDir( destFile ); 173 QDir destDir( destFile );
174 if (linkOpp==createLink) destDir.mkdir( destFile, true ); 174 if (linkOpp==createLink) destDir.mkdir( destFile, true );
175 QDir d( file ); 175 QDir d( file );
176 d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); 176// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
177 const QFileInfoList *list = d.entryInfoList(); 177 const QFileInfoList *list = d.entryInfoList();
178 QFileInfoListIterator it( *list ); 178 QFileInfoListIterator it( *list );
179 QFileInfo *fi; 179 QFileInfo *fi;
180 qDebug( "while %i",list->count());
180 while ( (fi=it.current()) ) 181 while ( (fi=it.current()) )
181 { 182 {
183 pvDebug(4, "processLinkDir "+fi->absFilePath());
182 processLinkDir( fi->absFilePath(), dest ); 184 processLinkDir( fi->absFilePath(), dest );
183 ++it; 185 ++it;
184 } 186 }
185// if (linkOpp==removeLink)
186// {
187 // pvDebug(2,"remove destDir "+ destFile );
188 // destDir.remove( destFile, true );
189// }
190 } else 187 } else
191 if ( fileInfo.isFile() ) 188 if ( fileInfo.isFile() )
192 { 189 {
193 const char *instFile = strdup( (file).ascii() ); 190 const char *instFile = strdup( (file).ascii() );
194 const char *linkFile = strdup( (destFile).ascii()); 191 const char *linkFile = strdup( (destFile).ascii());
195 if( linkOpp==createLink ) 192 if( linkOpp==createLink )
@@ -198,19 +195,21 @@ void PmIpkg::processLinkDir( QString file, QString dest )
198 symlink( instFile, linkFile ); 195 symlink( instFile, linkFile );
199 } 196 }
200 } else { 197 } else {
201 const char *linkFile = strdup( (destFile).ascii()); 198 const char *linkFile = strdup( (destFile).ascii());
202 if( linkOpp==removeLink ) 199 if( linkOpp==removeLink )
203 { 200 {
204 pvDebug(4,"removing "+destFile+" no "+file);
205 QFileInfo toRemoveLink( destFile ); 201 QFileInfo toRemoveLink( destFile );
206 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) 202 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
203 {
204 pvDebug(4,"removing "+destFile+" no "+file);
207 unlink( linkFile ); 205 unlink( linkFile );
208 } 206 }
209 } 207 }
210} 208}
209}
211 210
212void PmIpkg::loadList( PackageList pl ) 211void PmIpkg::loadList( PackageList pl )
213 { 212 {
214 for( Package *pack = pl.first();pack ; (pack = pl.next()) ) 213 for( Package *pack = pl.first();pack ; (pack = pl.next()) )
215 { 214 {
216 if ( pack && (pack->name() != "") && pack) 215 if ( pack && (pack->name() != "") && pack)
@@ -220,79 +219,45 @@ void PmIpkg::loadList( PackageList pl )
220 if ( pack->toRemove() ) 219 if ( pack->toRemove() )
221 to_remove.append( pack ); 220 to_remove.append( pack );
222 } 221 }
223 } 222 }
224} 223}
225 224
226void PmIpkg::commit( PackageList pl ) 225void PmIpkg::commit()
227 { 226 {
228 int sizecount = 0; 227 int sizecount = 0;
229// QString rem="<b>"+tr("To remove:")+"</b><br>\n";
230// QString inst="<b>"+tr("To install:")+"</b><br>\n";
231 loadList(pl);
232 for (uint i=0; i < to_remove.count(); i++) 228 for (uint i=0; i < to_remove.count(); i++)
233 sizecount += 1; 229 sizecount += 1;
234 for (uint i=0; i < to_install.count(); i++) 230 for (uint i=0; i < to_install.count(); i++)
235 sizecount += to_install.at(i)->size().toInt(); 231 sizecount += to_install.at(i)->size().toInt();
236 runwindow->progress->setTotalSteps(sizecount); 232 runwindow->progress->setTotalSteps(sizecount);
237 startDialog(); 233 startDialog();
238} 234}
239 235
240void PmIpkg::startDialog() 236void PmIpkg::startDialog()
241{ 237{
242 installDialog = new QDialog(0,0,true); 238 installDialog = new InstallDialog(settings,0,0,true);
243 QGridLayout *RunWindowLayout = new QGridLayout( installDialog );
244 RunWindowLayout->setSpacing( 2 );
245 RunWindowLayout->setMargin( 2 );
246
247 PackageListView *plv = new PackageListView(installDialog, "install",settings);
248 plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) );
249 RunWindowLayout->addWidget( plv, 1, 0 );
250 QCheckListItem *toRemoveItem; 239 QCheckListItem *toRemoveItem;
251 toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") ); 240 toRemoveItem= new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") );
252 toRemoveItem->setOpen( true ); 241 toRemoveItem->setOpen( true );
253 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 242 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
254 { 243 {
255 toRemoveItem->insertItem( new PackageListItem(plv, it,settings) ); 244 toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) );
256 } 245 }
257 QCheckListItem *toInstallItem; 246 QCheckListItem *toInstallItem;
258 toInstallItem = new QCheckListItem( plv, QObject::tr("To install") ); 247 toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") );
259 toInstallItem->setOpen( true ); 248 toInstallItem->setOpen( true );
260 for (Package *it=to_install.first(); it != 0; it=to_install.next() ) 249 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
261 { 250 {
262 toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); 251 toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) );
263 } 252 }
264
265 QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" );
266 GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) );
267 GroupBox1->setTitle( tr( "Ipkg options" ) );
268 GroupBox1->setColumnLayout(0, Qt::Vertical );
269 GroupBox1->layout()->setSpacing( 0 );
270 GroupBox1->layout()->setMargin( 0 );
271 QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
272 GroupBox1Layout->setAlignment( Qt::AlignTop );
273 GroupBox1Layout->setSpacing( 3 );
274 GroupBox1Layout->setMargin( 3 );
275 _force_depends = new QCheckBox( GroupBox1, "_force_depends" );
276 _force_depends->setText( tr( "-force-depends" ) );
277 _force_depends->setAutoResize( TRUE );
278 _force_depends->setChecked(true);
279 GroupBox1Layout->addWidget( _force_depends, 0, 0 );
280 _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" );
281 _force_reinstall->setText( tr( "-force-reinstall" ) );
282 _force_reinstall->setAutoResize( TRUE );
283 GroupBox1Layout->addWidget( _force_reinstall, 1, 0 );
284 _force_remove = new QCheckBox( GroupBox1, "_force_remove" );
285 _force_remove->setText( tr( "-force-removal-of-essential-packages" ) );
286 _force_remove->setAutoResize( TRUE );
287 GroupBox1Layout->addWidget( _force_remove, 1, 0 );
288 RunWindowLayout->addWidget( GroupBox1 , 3, 0 );
289 installDialog->showMaximized(); 253 installDialog->showMaximized();
290 if ( installDialog->exec() ) doIt(); 254 if ( installDialog->exec() ) doIt();
291 installDialog->close(); 255 installDialog->close();
292 out(tr("<b>All done.</b>")); 256 out(tr("<b>All done.</b>"));
257 to_install.clear();
293} 258}
294 259
295void PmIpkg::doIt() 260void PmIpkg::doIt()
296{ 261{
297 show( true ); 262 show( true );
298 remove(); 263 remove();
@@ -354,30 +319,33 @@ void PmIpkg::install()
354 out("<br><hr>"); 319 out("<br><hr>");
355 }else{ 320 }else{
356 out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); 321 out("<b>"+tr("Error while installing")+"</b><hr>"+it->name());
357 } 322 }
358 } 323 }
359 out("<br>"); 324 out("<br>");
325 to_install.clear();
360} 326}
361 327
362void PmIpkg::createLinks( const QString &dest ) 328void PmIpkg::createLinks( const QString &dest )
363{ 329{
364 pvDebug(2,"PmIpkg::createLinks "+dest); 330 pvDebug(2,"PmIpkg::createLinks "+dest);
365 linkOpp=createLink; 331 linkOpp=createLink;
366 QString url = settings->getDestinationUrlByName( dest ); 332 QString url = settings->getDestinationUrlByName( dest );
367 url = url==""?dest:url; 333 url = url==""?dest:url;
368 processLinkDir( "/", url ); 334 processLinkDir( "/opt", url );
335 processLinkDir( "/usr", url );
369} 336}
370 337
371void PmIpkg::removeLinks( const QString &dest ) 338void PmIpkg::removeLinks( const QString &dest )
372{ 339{
373 pvDebug(2,"PmIpkg::removeLinks "+dest); 340 pvDebug(2,"PmIpkg::removeLinks "+dest);
374 linkOpp=removeLink; 341 linkOpp=removeLink;
375 QString url = settings->getDestinationUrlByName( dest ); 342 QString url = settings->getDestinationUrlByName( dest );
376 url = url==""?dest:url; 343 url = url==""?dest:url;
377 processLinkDir( "/", url ); 344 processLinkDir( "/opt", url );
345 processLinkDir( "/usr", url );
378} 346}
379 347
380void PmIpkg::update() 348void PmIpkg::update()
381{ 349{
382 show( false ); 350 show( false );
383 runIpkg( "update" ); 351 runIpkg( "update" );