summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/pmipkg.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 2559a51..be9d6da 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -1,400 +1,401 @@
1#include "pmipkg.h" 1#include "pmipkg.h"
2#include "pksettings.h" 2#include "pksettings.h"
3#include "package.h" 3#include "package.h"
4#include "packagelistitem.h" 4#include "packagelistitem.h"
5 5
6#include <qpe/process.h> 6#include <qpe/process.h>
7#include <qpe/resource.h> 7#include <qpe/resource.h>
8#include <qpe/config.h> 8#include <qpe/config.h>
9#include <qpe/stringutil.h> 9#include <qpe/stringutil.h>
10#include <qdir.h> 10#include <qdir.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qgroupbox.h> 12#include <qgroupbox.h>
13#include <qmultilineedit.h> 13#include <qmultilineedit.h>
14#include <qstring.h> 14#include <qstring.h>
15#include <qcheckbox.h> 15#include <qcheckbox.h>
16#include <qtextstream.h> 16#include <qtextstream.h>
17#include <qtextview.h> 17#include <qtextview.h>
18 18
19#include <qprogressbar.h> 19#include <qprogressbar.h>
20#include <qpushbutton.h> 20#include <qpushbutton.h>
21#include <qlayout.h> 21#include <qlayout.h>
22 22
23#include <stdlib.h> 23#include <stdlib.h>
24#include <unistd.h> 24#include <unistd.h>
25 25
26#include "mainwindow.h" 26#include "mainwindow.h"
27 27
28 28
29PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) 29PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
30 : QObject ( p ) 30 : QObject ( p )
31{ 31{
32 settings = s; 32 settings = s;
33 runwindowopen = false;
34 runwindow = new RunWindow( p, name, true, f ); 33 runwindow = new RunWindow( p, name, true, f );
35} 34}
36 35
37PmIpkg::~PmIpkg() 36PmIpkg::~PmIpkg()
38{ 37{
39} 38}
40 39
41//#define PROC 40//#define PROC
42#define SYSTEM 41#define SYSTEM
43int PmIpkg::runIpkg(const QString& args, const QString& dest ) 42int PmIpkg::runIpkg(const QString& args, const QString& dest )
44{ 43{
45 pvDebug(2,"PmIpkg::runIpkg "+args); 44 pvDebug(2,"PmIpkg::runIpkg "+args);
46 45
47#ifdef PROC 46#ifdef PROC
48 QStringList cmd = "/usr/bin/ipkg "; 47 QStringList cmd = "/usr/bin/ipkg ";
49#endif 48#endif
50#ifdef SYSTEM 49#ifdef SYSTEM
51 QString cmd = "/usr/bin/ipkg "; 50 QString cmd = "/usr/bin/ipkg ";
52#endif 51#endif
53 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); 52 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
54 if ( dest == "" ) 53 if ( dest == "" )
55 cmd += " -dest "+settings->getDestinationName(); 54 cmd += " -dest "+settings->getDestinationName();
56 else 55 else
57 cmd += " -dest "+ dest; 56 cmd += " -dest "+ dest;
58 57
59 cmd += " -force-defaults "; 58 cmd += " -force-defaults ";
60 59
61 if (_force_depends) 60 if (_force_depends)
62 { 61 {
63 if (_force_depends->isChecked()) 62 if (_force_depends->isChecked())
64 cmd += " -force-depends "; 63 cmd += " -force-depends ";
65 if (_force_reinstall->isChecked()) 64 if (_force_reinstall->isChecked())
66 cmd += " -force-reinstall "; 65 cmd += " -force-reinstall ";
67 if (_force_remove->isChecked()) 66 if (_force_remove->isChecked())
68 cmd += " -force-removal-of-essential-packages "; 67 cmd += " -force-removal-of-essential-packages ";
69 } 68 }
70 69
71 out( "<hr><br>Starting to "+ args+"<br>\n"); 70 out( "<hr><br>Starting to "+ args+"<br>\n");
72 cmd += args; 71 cmd += args;
73 int r = 0; 72 int r = 0;
74#ifdef PROC 73#ifdef PROC
75 QString o = "start"; 74 QString o = "start";
76 Process *ipkg = new Process( "ls");//cmd ); 75 Process *ipkg = new Process( cmd );
77 out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); 76 out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" );
78 QString description; 77 QString description;
79 ipkg->exec("",o); 78 ipkg->exec("",o);
80// out( o ); 79// out( o );
81#endif 80#endif
82#ifdef SYSTEM 81#ifdef SYSTEM
83 out( "running:<br>\n"+cmd+"<br>\n" ); 82 out( "running:<br>\n"+cmd+"<br>\n" );
84 QString redirect = "/tmp/oipkg.pipe"; 83 QString redirect = "/tmp/oipkg.pipe";
85 cmd += " 2>&1 | tee "+redirect+" 2>&1"; 84 cmd += " 2>&1 | tee "+redirect+" 2>&1";
86 pvDebug(2, "running >"+cmd+"<"); 85 pvDebug(2, "running >"+cmd+"<");
87 r = system(cmd.latin1()); 86 r = system(cmd.latin1());
88 QFile f( redirect ); 87 QFile f( redirect );
89 QString line; 88 QString line;
90 QString oldLine; 89 QString oldLine;
91 while ( ! f.open(IO_ReadOnly) ) {}; 90 while ( ! f.open(IO_ReadOnly) ) {};
92 QTextStream t( &f ); 91 QTextStream t( &f );
93 while ( !t.eof() ) 92 while ( !t.eof() )
94 { 93 {
95 line = t.readLine(); 94 line = t.readLine();
96 if ( line != oldLine ) 95 if ( line != oldLine )
97 { 96 {
98 out( line +"<br>" ); 97 out( line +"<br>" );
99 oldLine = line; 98 oldLine = line;
100 } 99 }
101 } 100 }
102 f.close(); 101 f.close();
103 out( "Finished!<br>"); 102 out( "Finished!<br>");
104#endif 103#endif
105 104
106 return r; 105 return r;
107} 106}
108 107
109void PmIpkg::makeLinks(Package *pack) 108void PmIpkg::makeLinks(Package *pack)
110{ 109{
111 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); 110 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
112 linkPackage( pack->name(), pack->dest() ); 111 linkPackage( pack->name(), pack->dest() );
113} 112}
114 113
115QStringList* PmIpkg::getList( QString packFileName, QString d ) 114QStringList* PmIpkg::getList( QString packFileName, QString d )
116{ 115{
117 QString dest = settings->getDestinationUrlByName( d ); 116 QString dest = settings->getDestinationUrlByName( d );
118 dest = dest==""?d:dest; 117 dest = dest==""?d:dest;
119 if (dest == "/" ) return 0; 118 if (dest == "/" ) return 0;
120 { 119 {
121 Config cfg( "oipkg", Config::User ); 120 Config cfg( "oipkg", Config::User );
122 cfg.setGroup( "Common" ); 121 cfg.setGroup( "Common" );
123 QString statusDir = cfg.readEntry( "statusDir", "" ); 122 QString statusDir = cfg.readEntry( "statusDir", "" );
124 } 123 }
125 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; 124 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list";
126 QFile f( packFileName ); 125 QFile f( packFileName );
127 if ( ! f.open(IO_ReadOnly) ) 126 if ( ! f.open(IO_ReadOnly) )
128 { 127 {
129 pvDebug(1," Panik! Could not open"); 128 pvDebug(1," Panik! Could not open");
130 out( "<b>Panik!</b> Could not open:<br>"+packFileName ); 129 out( "<b>Panik!</b> Could not open:<br>"+packFileName );
131 return (QStringList*)0; 130 return (QStringList*)0;
132 } 131 }
133 QStringList *fileList = new QStringList(); 132 QStringList *fileList = new QStringList();
134 QTextStream t( &f ); 133 QTextStream t( &f );
135 while ( !t.eof() ) 134 while ( !t.eof() )
136 { 135 {
137 *fileList += t.readLine(); 136 *fileList += t.readLine();
138 } 137 }
139 return fileList; 138 return fileList;
140} 139}
141 140
142void PmIpkg::linkPackage( QString packFileName, QString dest ) 141void PmIpkg::linkPackage( QString packFileName, QString dest )
143{ 142{
144 QStringList *fileList = getList( packFileName, dest ); 143 QStringList *fileList = getList( packFileName, dest );
145 processFileList( fileList, dest ); 144 processFileList( fileList, dest );
146 delete fileList; 145 delete fileList;
147} 146}
148 147
149void PmIpkg::processFileList( QStringList *fileList, QString d ) 148void PmIpkg::processFileList( QStringList *fileList, QString d )
150{ 149{
151 if (!fileList) return; 150 if (!fileList) return;
152 for (uint i=0; i < fileList->count(); i++) 151 for (uint i=0; i < fileList->count(); i++)
153 { 152 {
154 QString dest = settings->getDestinationUrlByName( d ); 153 QString dest = settings->getDestinationUrlByName( d );
155 dest = dest==""?d:dest; 154 dest = dest==""?d:dest;
156 processLinkDir( (*fileList)[i], dest ); 155 processLinkDir( (*fileList)[i], dest );
157 } 156 }
158} 157}
159 158
160 159
161void PmIpkg::processLinkDir( QString file, QString dest ) 160void PmIpkg::processLinkDir( QString file, QString dest )
162{ 161{
163 pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); 162 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest);
164 if (linkOpp==createLink) pvDebug( 2,"opp: createLink"); 163 if (linkOpp==createLink) pvDebug( 4,"opp: createLink");
165 if (linkOpp==removeLink) pvDebug( 2,"opp:removeLink"); 164 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink");
166 if ( dest == "???" || dest == "" ) return; 165 if ( dest == "???" || dest == "" ) return;
167 QString destFile = file; 166 QString destFile = file;
168 file = dest+"/"+file; 167 file = dest+"/"+file;
169 if (file == dest) return; 168 if (file == dest) return;
170 QFileInfo fileInfo( file ); 169 QFileInfo fileInfo( file );
171 if ( fileInfo.isDir() ) 170 if ( fileInfo.isDir() )
172 { 171 {
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 while ( (fi=it.current()) ) 180 while ( (fi=it.current()) )
181 { 181 {
182 pvDebug(4, "process dir "+fi->absFilePath());
183 processLinkDir( fi->absFilePath(), dest ); 182 processLinkDir( fi->absFilePath(), dest );
184 ++it; 183 ++it;
185 } 184 }
186// if (linkOpp==removeLink) 185// if (linkOpp==removeLink)
187// { 186// {
188 // pvDebug(2,"remove destDir "+ destFile ); 187 // pvDebug(2,"remove destDir "+ destFile );
189 // destDir.remove( destFile, true ); 188 // destDir.remove( destFile, true );
190// } 189// }
191 } else 190 } else
192 if ( fileInfo.isFile() ) 191 if ( fileInfo.isFile() )
193 { 192 {
194 const char *instFile = strdup( (file).ascii() ); 193 const char *instFile = strdup( (file).ascii() );
195 const char *linkFile = strdup( (destFile).ascii()); 194 const char *linkFile = strdup( (destFile).ascii());
196 if( linkOpp==createLink ) 195 if( linkOpp==createLink )
197 { 196 {
198 pvDebug(4, "linking: "+file+" -> "+destFile ); 197 pvDebug(4, "linking: "+file+" -> "+destFile );
199 symlink( instFile, linkFile ); 198 symlink( instFile, linkFile );
200 } 199 }
201 } else { 200 } else {
202 const char *linkFile = strdup( (destFile).ascii()); 201 const char *linkFile = strdup( (destFile).ascii());
203 if( linkOpp==removeLink ) 202 if( linkOpp==removeLink )
204 { 203 {
205 pvDebug(4,"removing "+destFile+" no "+file); 204 pvDebug(4,"removing "+destFile+" no "+file);
206 QFileInfo toRemoveLink( destFile ); 205 QFileInfo toRemoveLink( destFile );
207 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) 206 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
208 unlink( linkFile ); 207 unlink( linkFile );
209 } 208 }
210 } 209 }
211} 210}
212 211
213void PmIpkg::loadList( PackageList pl ) 212void PmIpkg::loadList( PackageList pl )
214 { 213 {
215 for( Package *pack = pl.first();pack ; (pack = pl.next()) ) 214 for( Package *pack = pl.first();pack ; (pack = pl.next()) )
216 { 215 {
217 if ( pack && (pack->name() != "") && pack) 216 if ( pack && (pack->name() != "") && pack)
218 { 217 {
219 if ( pack->toInstall() ) 218 if ( pack->toInstall() )
220 to_install.append( pack ); 219 to_install.append( pack );
221 if ( pack->toRemove() ) 220 if ( pack->toRemove() )
222 to_remove.append( pack ); 221 to_remove.append( pack );
223 } 222 }
224 } 223 }
225} 224}
226 225
227void PmIpkg::commit( PackageList pl ) 226void PmIpkg::commit( PackageList pl )
228 { 227 {
229 sizecount = 0; 228 int sizecount = 0;
230 QString rem="<b>"+tr("To remove:")+"</b><br>\n"; 229// QString rem="<b>"+tr("To remove:")+"</b><br>\n";
231 QString inst="<b>"+tr("To install:")+"</b><br>\n"; 230// QString inst="<b>"+tr("To install:")+"</b><br>\n";
232 loadList(pl); 231 loadList(pl);
233 for (uint i=0; i < to_remove.count(); i++) 232 for (uint i=0; i < to_remove.count(); i++)
234 sizecount += 1; 233 sizecount += 1;
235 for (uint i=0; i < to_install.count(); i++) 234 for (uint i=0; i < to_install.count(); i++)
236 sizecount += to_install.at(i)->size().toInt(); 235 sizecount += to_install.at(i)->size().toInt();
236 runwindow->progress->setTotalSteps(sizecount);
237 startDialog(); 237 startDialog();
238} 238}
239 239
240void PmIpkg::startDialog() 240void PmIpkg::startDialog()
241{ 241{
242 installDialog = new QDialog(0,0,true); 242 installDialog = new QDialog(0,0,true);
243 QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); 243 QGridLayout *RunWindowLayout = new QGridLayout( installDialog );
244 RunWindowLayout->setSpacing( 2 ); 244 RunWindowLayout->setSpacing( 2 );
245 RunWindowLayout->setMargin( 2 ); 245 RunWindowLayout->setMargin( 2 );
246 246
247 PackageListView *plv = new PackageListView(installDialog, "install",settings); 247 PackageListView *plv = new PackageListView(installDialog, "install",settings);
248 plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) ); 248 plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) );
249 RunWindowLayout->addWidget( plv, 1, 0 ); 249 RunWindowLayout->addWidget( plv, 1, 0 );
250 QCheckListItem *toRemoveItem; 250 QCheckListItem *toRemoveItem;
251 toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") ); 251 toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") );
252 toRemoveItem->setOpen( true ); 252 toRemoveItem->setOpen( true );
253 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 253 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
254 { 254 {
255 toRemoveItem->insertItem( new PackageListItem(plv, it,settings) ); 255 toRemoveItem->insertItem( new PackageListItem(plv, it,settings) );
256 } 256 }
257 QCheckListItem *toInstallItem; 257 QCheckListItem *toInstallItem;
258 toInstallItem = new QCheckListItem( plv, QObject::tr("To install") ); 258 toInstallItem = new QCheckListItem( plv, QObject::tr("To install") );
259 toInstallItem->setOpen( true ); 259 toInstallItem->setOpen( true );
260 for (Package *it=to_install.first(); it != 0; it=to_install.next() ) 260 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
261 { 261 {
262 toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); 262 toInstallItem->insertItem( new PackageListItem(plv, it,settings) );
263 } 263 }
264 264
265 QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" ); 265 QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" );
266 GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) ); 266 GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) );
267 GroupBox1->setTitle( tr( "Ipkg options" ) ); 267 GroupBox1->setTitle( tr( "Ipkg options" ) );
268 GroupBox1->setColumnLayout(0, Qt::Vertical ); 268 GroupBox1->setColumnLayout(0, Qt::Vertical );
269 GroupBox1->layout()->setSpacing( 0 ); 269 GroupBox1->layout()->setSpacing( 0 );
270 GroupBox1->layout()->setMargin( 0 ); 270 GroupBox1->layout()->setMargin( 0 );
271 QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); 271 QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
272 GroupBox1Layout->setAlignment( Qt::AlignTop ); 272 GroupBox1Layout->setAlignment( Qt::AlignTop );
273 GroupBox1Layout->setSpacing( 3 ); 273 GroupBox1Layout->setSpacing( 3 );
274 GroupBox1Layout->setMargin( 3 ); 274 GroupBox1Layout->setMargin( 3 );
275 _force_depends = new QCheckBox( GroupBox1, "_force_depends" ); 275 _force_depends = new QCheckBox( GroupBox1, "_force_depends" );
276 _force_depends->setText( tr( "-force-depends" ) ); 276 _force_depends->setText( tr( "-force-depends" ) );
277 _force_depends->setAutoResize( TRUE ); 277 _force_depends->setAutoResize( TRUE );
278 _force_depends->setChecked(true); 278 _force_depends->setChecked(true);
279 GroupBox1Layout->addWidget( _force_depends, 0, 0 ); 279 GroupBox1Layout->addWidget( _force_depends, 0, 0 );
280 _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" ); 280 _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" );
281 _force_reinstall->setText( tr( "-force-reinstall" ) ); 281 _force_reinstall->setText( tr( "-force-reinstall" ) );
282 _force_reinstall->setAutoResize( TRUE ); 282 _force_reinstall->setAutoResize( TRUE );
283 GroupBox1Layout->addWidget( _force_reinstall, 1, 0 ); 283 GroupBox1Layout->addWidget( _force_reinstall, 1, 0 );
284 _force_remove = new QCheckBox( GroupBox1, "_force_remove" ); 284 _force_remove = new QCheckBox( GroupBox1, "_force_remove" );
285 _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); 285 _force_remove->setText( tr( "-force-removal-of-essential-packages" ) );
286 _force_remove->setAutoResize( TRUE ); 286 _force_remove->setAutoResize( TRUE );
287 GroupBox1Layout->addWidget( _force_remove, 1, 0 ); 287 GroupBox1Layout->addWidget( _force_remove, 1, 0 );
288 RunWindowLayout->addWidget( GroupBox1 , 3, 0 ); 288 RunWindowLayout->addWidget( GroupBox1 , 3, 0 );
289 installDialog->showMaximized(); 289 installDialog->showMaximized();
290 if ( installDialog->exec() ) doIt(); 290 if ( installDialog->exec() ) doIt();
291 installDialog->close(); 291 installDialog->close();
292 out(tr("<b>All done.</b>")); 292 out(tr("<b>All done.</b>"));
293} 293}
294 294
295void PmIpkg::doIt() 295void PmIpkg::doIt()
296{ 296{
297 show( true ); 297 show( true );
298 remove(); 298 remove();
299 install(); 299 install();
300} 300}
301 301
302 302
303void PmIpkg::remove() 303void PmIpkg::remove()
304{ 304{
305 if ( to_remove.count() == 0 ) return; 305 if ( to_remove.count() == 0 ) return;
306 306
307 out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); 307 out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>");
308 308
309 QStringList *fileList; 309 QStringList *fileList;
310 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 310 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
311 { 311 {
312 if ( it->link() )fileList = getList( it->name(), it->dest() ); 312 if ( it->link() )fileList = getList( it->name(), it->dest() );
313 if ( runIpkg("remove " + it->name(), it->dest() ) == 0) 313 if ( runIpkg("remove " + it->name(), it->dest() ) == 0)
314 { 314 {
315 runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); 315 runwindow->progress->setProgress( 1 + runwindow->progress->progress() );
316 linkOpp = removeLink; 316 linkOpp = removeLink;
317 if ( it->link() ) 317 if ( it->link() )
318 { 318 {
319 out( "<br>removing links<br>" ); 319 out( "<br>removing links<br>" );
320 out( "for package "+it->name()+" in "+it->dest()+"<br>" ); 320 out( "for package "+it->name()+" in "+it->dest()+"<br>" );
321 processFileList( fileList, it->dest() ); 321 processFileList( fileList, it->dest() );
322 } 322 }
323 it->processed(); 323 it->processed();
324 324 // to_install.take( it );
325 out("<br><hr>"); 325 out("<br><hr>");
326 }else{ 326 }else{
327 out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); 327 out("<b>"+tr("Error while removing")+"</b><hr>"+it->name());
328 } 328 }
329 if ( it->link() )delete fileList; 329 if ( it->link() )delete fileList;
330 } 330 }
331 out("<br>"); 331 out("<br>");
332} 332}
333 333
334 334
335void PmIpkg::install() 335void PmIpkg::install()
336{ 336{
337 if ( to_install.count() == 0 ) return; 337 if ( to_install.count() == 0 ) return;
338 out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); 338 out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
339 for (Package *it=to_install.first(); it != 0; it=to_install.next() ) 339 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
340 { 340 {
341 341
342 if ( runIpkg("install " + it->installName(), it->dest() ) == 0 ) 342 if ( runIpkg("install " + it->installName(), it->dest() ) == 0 )
343 { 343 {
344 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); 344 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
345 linkOpp = createLink; 345 linkOpp = createLink;
346 if ( it->link() ) 346 if ( it->link() )
347 { 347 {
348 out( "<br>creating links<br>" ); 348 out( "<br>creating links<br>" );
349 out( "for package "+it->name()+" in "+it->dest()+"<br>" ); 349 out( "for package "+it->name()+" in "+it->dest()+"<br>" );
350 makeLinks( it ); 350 makeLinks( it );
351 } 351 }
352 it->processed(); 352 it->processed();
353 // to_install.take( it->name() );
353 out("<br><hr>"); 354 out("<br><hr>");
354 }else{ 355 }else{
355 out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); 356 out("<b>"+tr("Error while installing")+"</b><hr>"+it->name());
356 } 357 }
357 } 358 }
358 out("<br>"); 359 out("<br>");
359} 360}
360 361
361void PmIpkg::createLinks( const QString &dest ) 362void PmIpkg::createLinks( const QString &dest )
362{ 363{
363 pvDebug(2,"PmIpkg::createLinks "+dest); 364 pvDebug(2,"PmIpkg::createLinks "+dest);
364 linkOpp=createLink; 365 linkOpp=createLink;
365 QString url = settings->getDestinationUrlByName( dest ); 366 QString url = settings->getDestinationUrlByName( dest );
366 url = url==""?dest:url; 367 url = url==""?dest:url;
367 processLinkDir( "/", url ); 368 processLinkDir( "/", url );
368} 369}
369 370
370void PmIpkg::removeLinks( const QString &dest ) 371void PmIpkg::removeLinks( const QString &dest )
371{ 372{
372 pvDebug(2,"PmIpkg::removeLinks "+dest); 373 pvDebug(2,"PmIpkg::removeLinks "+dest);
373 linkOpp=removeLink; 374 linkOpp=removeLink;
374 QString url = settings->getDestinationUrlByName( dest ); 375 QString url = settings->getDestinationUrlByName( dest );
375 url = url==""?dest:url; 376 url = url==""?dest:url;
376 processLinkDir( "/", url ); 377 processLinkDir( "/", url );
377} 378}
378 379
379void PmIpkg::update() 380void PmIpkg::update()
380{ 381{
381 show( false ); 382 show( false );
382 runIpkg( "update" ); 383 runIpkg( "update" );
383 runwindow->close(); 384 runwindow->close();
384} 385}
385 386
386void PmIpkg::out( QString o ) 387void PmIpkg::out( QString o )
387{ 388{
388 runwindow->outPut->append(o); 389 runwindow->outPut->append(o);
389 //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight()); 390 //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight());
390 //runwindow->outPut->setText( runwindow->outPut->text()+o ); 391 //runwindow->outPut->setText( runwindow->outPut->text()+o );
391 runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); 392 runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight());
392} 393}
393 394
394 395
395void PmIpkg::showButtons(bool b) 396void PmIpkg::showButtons(bool b)
396{ 397{
397 if ( b ) 398 if ( b )
398 { 399 {
399 runwindow->cancelButton->hide(); 400 runwindow->cancelButton->hide();
400 runwindow->doItButton->hide(); 401 runwindow->doItButton->hide();