Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 284 |
1 files changed, 178 insertions, 106 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index ecc97b2..9f6429a 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -8,8 +8,9 @@ | |||
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 <qmultilineedit.h> | 13 | #include <qmultilineedit.h> |
13 | #include <qstring.h> | 14 | #include <qstring.h> |
14 | #include <qcheckbox.h> | 15 | #include <qcheckbox.h> |
15 | #include <qtextstream.h> | 16 | #include <qtextstream.h> |
@@ -56,10 +57,17 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
56 | cmd += " -dest "+ dest; | 57 | cmd += " -dest "+ dest; |
57 | 58 | ||
58 | cmd += " -force-defaults "; | 59 | cmd += " -force-defaults "; |
59 | 60 | ||
60 | // if (runwindow->forcedepends->isChecked()) | 61 | if (_force_depends) |
61 | // cmd += " -force-depends "; | 62 | { |
63 | if (_force_depends->isChecked()) | ||
64 | cmd += " -force-depends "; | ||
65 | if (_force_reinstall->isChecked()) | ||
66 | cmd += " -force-reinstall "; | ||
67 | if (_force_remove->isChecked()) | ||
68 | cmd += " -force-removal-of-essential-packages "; | ||
69 | } | ||
62 | 70 | ||
63 | out( "<hr><br>Starting to "+ args+"<br>\n"); | 71 | out( "<hr><br>Starting to "+ args+"<br>\n"); |
64 | cmd += args; | 72 | cmd += args; |
65 | int r = 0; | 73 | int r = 0; |
@@ -75,16 +83,14 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
75 | out( "running:<br>\n"+cmd+"<br>\n" ); | 83 | out( "running:<br>\n"+cmd+"<br>\n" ); |
76 | QString redirect = "/tmp/oipkg.pipe"; | 84 | QString redirect = "/tmp/oipkg.pipe"; |
77 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; | 85 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; |
78 | pvDebug(2, "running >"+cmd+"<"); | 86 | pvDebug(2, "running >"+cmd+"<"); |
79 | r = system(cmd.latin1()); | 87 | r = system(cmd.latin1()); |
80 | QFile f( redirect ); | 88 | QFile f( redirect ); |
81 | QString line; | 89 | QString line; |
82 | QString oldLine; | 90 | QString oldLine; |
83 | while ( ! f.open(IO_ReadOnly) ) {}; | 91 | while ( ! f.open(IO_ReadOnly) ) {}; |
84 | // { | ||
85 | QTextStream t( &f ); | 92 | QTextStream t( &f ); |
86 | // QString fp; | ||
87 | while ( !t.eof() ) | 93 | while ( !t.eof() ) |
88 | { | 94 | { |
89 | line = t.readLine(); | 95 | line = t.readLine(); |
90 | if ( line != oldLine ) | 96 | if ( line != oldLine ) |
@@ -92,9 +98,8 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
92 | out( line +"<br>" ); | 98 | out( line +"<br>" ); |
93 | oldLine = line; | 99 | oldLine = line; |
94 | } | 100 | } |
95 | } | 101 | } |
96 | // } | ||
97 | f.close(); | 102 | f.close(); |
98 | out( "Finished!<br>"); | 103 | out( "Finished!<br>"); |
99 | #endif | 104 | #endif |
100 | 105 | ||
@@ -103,70 +108,106 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
103 | 108 | ||
104 | void PmIpkg::makeLinks(Package *pack) | 109 | void PmIpkg::makeLinks(Package *pack) |
105 | { | 110 | { |
106 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 111 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
107 | QString dest = settings->getDestinationUrlByName( pack->dest() ); | 112 | linkPackage( pack->name(), pack->dest() ); |
108 | if (dest == "/" ) return; | 113 | } |
114 | |||
115 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | ||
116 | { | ||
117 | QString dest = settings->getDestinationUrlByName( d ); | ||
118 | dest = dest==""?d:dest; | ||
119 | if (dest == "/" ) return 0; | ||
109 | { | 120 | { |
110 | Config cfg( "oipkg", Config::User ); | 121 | Config cfg( "oipkg", Config::User ); |
111 | cfg.setGroup( "Common" ); | 122 | cfg.setGroup( "Common" ); |
112 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 123 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
113 | } | 124 | } |
114 | QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; | 125 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
115 | linkPackage( fn, dest ); | 126 | QFile f( packFileName ); |
116 | } | 127 | if ( ! f.open(IO_ReadOnly) ) |
117 | |||
118 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | ||
119 | { | ||
120 | QFile f( packFileName ); | ||
121 | if ( ! f.open(IO_ReadOnly) ) | ||
122 | { | 128 | { |
129 | pvDebug(1," Panik! Could not open"); | ||
123 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); | 130 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); |
124 | return; | 131 | return (QStringList*)0; |
125 | }; | 132 | } |
126 | out( "<br>creating links<br>" ); | 133 | QStringList *fileList = new QStringList(); |
127 | out("for package "+packFileName+" in "+dest+"<br>"); | ||
128 | QTextStream t( &f ); | 134 | QTextStream t( &f ); |
129 | QString fp; | ||
130 | while ( !t.eof() ) | 135 | while ( !t.eof() ) |
131 | { | 136 | { |
132 | fp = t.readLine(); | 137 | *fileList += t.readLine(); |
133 | processLinkDir( fp, dest ); | ||
134 | } | 138 | } |
135 | f.close(); | 139 | return fileList; |
136 | } | 140 | } |
137 | 141 | ||
142 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | ||
143 | { | ||
144 | QStringList *fileList = getList( packFileName, dest ); | ||
145 | processFileList( fileList, dest ); | ||
146 | delete fileList; | ||
147 | } | ||
148 | |||
149 | void PmIpkg::processFileList( QStringList *fileList, QString d ) | ||
150 | { | ||
151 | if (!fileList) return; | ||
152 | for (uint i=0; i < fileList->count(); i++) | ||
153 | { | ||
154 | QString dest = settings->getDestinationUrlByName( d ); | ||
155 | dest = dest==""?d:dest; | ||
156 | processLinkDir( (*fileList)[i], dest ); | ||
157 | } | ||
158 | } | ||
159 | |||
160 | |||
138 | void PmIpkg::processLinkDir( QString file, QString dest ) | 161 | void PmIpkg::processLinkDir( QString file, QString dest ) |
139 | { | 162 | { |
140 | pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); | 163 | pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); |
141 | if ( dest == "???" ) return; | 164 | if (linkOpp==createLink) pvDebug( 2,"opp: createLink"); |
165 | if (linkOpp==removeLink) pvDebug( 2,"opp:removeLink"); | ||
166 | if ( dest == "???" || dest == "" ) return; | ||
142 | QString destFile = file; | 167 | QString destFile = file; |
143 | file = dest+"/"+file; | 168 | file = dest+"/"+file; |
144 | if (file == dest) return; | 169 | if (file == dest) return; |
145 | QFileInfo fileInfo( file ); | 170 | QFileInfo fileInfo( file ); |
146 | if ( fileInfo.isDir() ) | 171 | if ( fileInfo.isDir() ) |
147 | { | 172 | { |
148 | QDir destDir( destFile ); | 173 | QDir destDir( destFile ); |
149 | destDir.mkdir( destFile, true ); | 174 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); |
150 | QDir d( file ); | 175 | QDir d( file ); |
151 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 176 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
152 | const QFileInfoList *list = d.entryInfoList(); | 177 | const QFileInfoList *list = d.entryInfoList(); |
153 | QFileInfoListIterator it( *list ); | 178 | QFileInfoListIterator it( *list ); |
154 | QFileInfo *fi; | 179 | QFileInfo *fi; |
155 | while ( (fi=it.current()) ) | 180 | while ( (fi=it.current()) ) |
156 | { | 181 | { |
157 | // out( "<b>"+fi->absFilePath()+"</b>" ); | 182 | pvDebug(4, "process dir "+fi->absFilePath()); |
158 | processLinkDir( fi->absFilePath(), dest ); | 183 | processLinkDir( fi->absFilePath(), dest ); |
159 | ++it; | 184 | ++it; |
160 | } | 185 | } |
186 | // if (linkOpp==removeLink) | ||
187 | // { | ||
188 | // pvDebug(2,"remove destDir "+ destFile ); | ||
189 | // destDir.remove( destFile, true ); | ||
190 | // } | ||
161 | } else | 191 | } else |
162 | if ( fileInfo.isFile() ) | 192 | if ( fileInfo.isFile() ) |
163 | { | 193 | { |
164 | const char *instFile = strdup( (file).ascii() ); | 194 | const char *instFile = strdup( (file).ascii() ); |
165 | const char *linkFile = strdup( (destFile).ascii()); | 195 | const char *linkFile = strdup( (destFile).ascii()); |
166 | // out( "linking: "+file+" -> "+destFile ); | 196 | if( linkOpp==createLink ) |
167 | qDebug( "linking: %s -> %s", instFile, linkFile ); | 197 | { |
168 | symlink( instFile, linkFile ); | 198 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
199 | symlink( instFile, linkFile ); | ||
200 | } | ||
201 | } else { | ||
202 | const char *linkFile = strdup( (destFile).ascii()); | ||
203 | if( linkOpp==removeLink ) | ||
204 | { | ||
205 | pvDebug(4,"removing "+destFile+" no "+file); | ||
206 | QFileInfo toRemoveLink( destFile ); | ||
207 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | ||
208 | unlink( linkFile ); | ||
209 | } | ||
169 | } | 210 | } |
170 | } | 211 | } |
171 | 212 | ||
172 | void PmIpkg::commit( PackageList pl ) | 213 | void PmIpkg::commit( PackageList pl ) |
@@ -175,9 +216,8 @@ void PmIpkg::commit( PackageList pl ) | |||
175 | to_install.clear(); | 216 | to_install.clear(); |
176 | to_remove.clear(); | 217 | to_remove.clear(); |
177 | QString rem="<b>"+tr("To remove:")+"</b><br>\n"; | 218 | QString rem="<b>"+tr("To remove:")+"</b><br>\n"; |
178 | QString inst="<b>"+tr("To install:")+"</b><br>\n"; | 219 | QString inst="<b>"+tr("To install:")+"</b><br>\n"; |
179 | pl.allPackages(); | ||
180 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) | 220 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) |
181 | { | 221 | { |
182 | if ( pack && (pack->name() != "") && pack) | 222 | if ( pack && (pack->name() != "") && pack) |
183 | { | 223 | { |
@@ -206,133 +246,147 @@ void PmIpkg::startDialog() | |||
206 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); | 246 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); |
207 | RunWindowLayout->setSpacing( 2 ); | 247 | RunWindowLayout->setSpacing( 2 ); |
208 | RunWindowLayout->setMargin( 2 ); | 248 | RunWindowLayout->setMargin( 2 ); |
209 | 249 | ||
210 | QHBoxLayout *buttons = new QHBoxLayout; | ||
211 | buttons->setSpacing( 6 ); | ||
212 | buttons->setMargin( 0 ); | ||
213 | |||
214 | PackageListView *plv = new PackageListView(installDialog, "install",settings); | 250 | PackageListView *plv = new PackageListView(installDialog, "install",settings); |
251 | plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) ); | ||
215 | RunWindowLayout->addWidget( plv, 1, 0 ); | 252 | RunWindowLayout->addWidget( plv, 1, 0 ); |
253 | QCheckListItem *toRemoveItem; | ||
254 | toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") ); | ||
255 | toRemoveItem->setOpen( true ); | ||
216 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 256 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
217 | { | 257 | { |
218 | plv->insertItem( new PackageListItem(plv, it,settings) ); | 258 | toRemoveItem->insertItem( new PackageListItem(plv, it,settings) ); |
219 | } | 259 | } |
260 | QCheckListItem *toInstallItem; | ||
261 | toInstallItem = new QCheckListItem( plv, QObject::tr("To install") ); | ||
262 | toInstallItem->setOpen( true ); | ||
220 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 263 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
221 | { | 264 | { |
222 | plv->insertItem( new PackageListItem(plv, it,settings) ); | 265 | toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); |
223 | } | 266 | } |
224 | QPushButton *doItButton = new QPushButton( installDialog, "doItButton" ); | 267 | |
225 | doItButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, doItButton->sizePolicy().hasHeightForWidth() ) ); | 268 | QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" ); |
226 | QFont doItButton_font( doItButton->font() ); | 269 | GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().hasHeightForWidth() ) ); |
227 | doItButton_font.setPointSize( 8 ); | 270 | GroupBox1->setTitle( tr( "Ipkg options" ) ); |
228 | doItButton->setFont( doItButton_font ); | 271 | GroupBox1->setColumnLayout(0, Qt::Vertical ); |
229 | doItButton->setText( tr( "Do all " ) ); | 272 | GroupBox1->layout()->setSpacing( 0 ); |
230 | doItButton->setAutoResize( FALSE ); | 273 | GroupBox1->layout()->setMargin( 0 ); |
231 | buttons->addWidget( doItButton ); | 274 | QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); |
232 | 275 | GroupBox1Layout->setAlignment( Qt::AlignTop ); | |
233 | QPushButton *installButton = new QPushButton( installDialog, "installButton" ); | 276 | GroupBox1Layout->setSpacing( 3 ); |
234 | QFont installButton_font( installButton->font() ); | 277 | GroupBox1Layout->setMargin( 3 ); |
235 | installButton_font.setPointSize( 8 ); | 278 | |
236 | installButton->setFont( installButton_font ); | 279 | _force_depends = new QCheckBox( GroupBox1, "_force_depends" ); |
237 | installButton->setText( tr( "Install" ) ); | 280 | _force_depends->setText( tr( "-force-depends" ) ); |
238 | installButton->setAutoResize( TRUE ); | 281 | _force_depends->setAutoResize( TRUE ); |
239 | buttons->addWidget( installButton ); | 282 | GroupBox1Layout->addWidget( _force_depends, 0, 0 ); |
240 | 283 | _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" ); | |
241 | QPushButton *removeButton = new QPushButton( installDialog, "removeButton" ); | 284 | _force_reinstall->setText( tr( "-force-reinstall" ) ); |
242 | QFont removeButton_font( removeButton->font() ); | 285 | _force_reinstall->setAutoResize( TRUE ); |
243 | removeButton_font.setPointSize( 7 ); | 286 | GroupBox1Layout->addWidget( _force_reinstall, 1, 0 ); |
244 | removeButton->setFont( removeButton_font ); | 287 | _force_remove = new QCheckBox( GroupBox1, "_force_remove" ); |
245 | removeButton->setText( tr( "Remove" ) ); | 288 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); |
246 | removeButton->setAutoResize( TRUE ); | 289 | _force_remove->setAutoResize( TRUE ); |
247 | buttons->addWidget( removeButton ); | 290 | GroupBox1Layout->addWidget( _force_remove, 1, 0 ); |
248 | 291 | RunWindowLayout->addWidget( GroupBox1 , 3, 0 ); | |
249 | QPushButton *cancelButton = new QPushButton( installDialog, "cancelButton" ); | 292 | |
250 | QFont cancelButton_font( cancelButton->font() ); | 293 | // connect( doItButton, SIGNAL( clicked() ), |
251 | cancelButton_font.setPointSize( 8 ); | 294 | // this, SLOT( doIt() ) ); |
252 | cancelButton->setFont( cancelButton_font ); | 295 | // connect( installButton, SIGNAL( clicked() ), |
253 | cancelButton->setText( tr( "Cancel" ) ); | 296 | // this, SLOT( install() ) ); |
254 | cancelButton->setAutoResize( TRUE ); | 297 | // connect( removeButton, SIGNAL( clicked() ), |
255 | buttons->addWidget( cancelButton ); | 298 | // this, SLOT( remove() ) ); |
256 | 299 | // connect( cancelButton, SIGNAL( clicked() ), | |
257 | RunWindowLayout->addLayout( buttons, 3, 0 ); | 300 | // installDialog, SLOT( close() ) ); |
258 | |||
259 | connect( doItButton, SIGNAL( clicked() ), | ||
260 | this, SLOT( doIt() ) ); | ||
261 | connect( installButton, SIGNAL( clicked() ), | ||
262 | this, SLOT( install() ) ); | ||
263 | connect( removeButton, SIGNAL( clicked() ), | ||
264 | this, SLOT( remove() ) ); | ||
265 | connect( cancelButton, SIGNAL( clicked() ), | ||
266 | installDialog, SLOT( close() ) ); | ||
267 | installDialog->showMaximized(); | 301 | installDialog->showMaximized(); |
268 | if ( installDialog->exec() ) doIt(); | 302 | if ( installDialog->exec() ) doIt(); |
269 | installDialog->close(); | 303 | installDialog->close(); |
304 | out(tr("<b>All done.</b>")); | ||
270 | } | 305 | } |
271 | 306 | ||
272 | void PmIpkg::doIt() | 307 | void PmIpkg::doIt() |
273 | { | 308 | { |
309 | show( true ); | ||
274 | remove(); | 310 | remove(); |
275 | install(); | 311 | install(); |
276 | } | 312 | } |
277 | 313 | ||
278 | 314 | ||
279 | void PmIpkg::remove() | 315 | void PmIpkg::remove() |
280 | { | 316 | { |
281 | if ( to_remove.count() == 0 ) return; | 317 | if ( to_remove.count() == 0 ) return; |
282 | installDialog->close(); | ||
283 | show( true ); | ||
284 | 318 | ||
285 | out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>"); | 319 | out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); |
286 | 320 | ||
321 | QStringList *fileList; | ||
287 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 322 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
288 | { | 323 | { |
324 | if ( it->link() )fileList = getList( it->name(), it->dest() ); | ||
289 | if ( runIpkg("remove " + it->name()) == 0) | 325 | if ( runIpkg("remove " + it->name()) == 0) |
290 | { | 326 | { |
291 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 327 | runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); |
292 | it->processed(); | 328 | linkOpp = removeLink; |
293 | runwindow->progress->setProgress( 1 ); | 329 | if ( it->link() ) |
330 | { | ||
331 | out( "<br>removing links<br>" ); | ||
332 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); | ||
333 | processFileList( fileList, it->dest() ); | ||
334 | } | ||
335 | it->processed(); | ||
336 | out("<br><hr>"); | ||
294 | }else{ | 337 | }else{ |
295 | out("<b>"+tr("Error while removing")+"</b>"+it->name()); | 338 | out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); |
296 | } | 339 | } |
340 | pvDebug(2,"delete File List"); | ||
341 | if ( it->link() )delete fileList; | ||
297 | } | 342 | } |
343 | out("<br>"); | ||
298 | } | 344 | } |
299 | 345 | ||
300 | 346 | ||
301 | void PmIpkg::install() | 347 | void PmIpkg::install() |
302 | { | 348 | { |
303 | if ( to_install.count() == 0 ) return; | 349 | if ( to_install.count() == 0 ) return; |
304 | installDialog->close(); | 350 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); |
305 | show( true ); | ||
306 | out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); | ||
307 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 351 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
308 | { | 352 | { |
309 | 353 | ||
310 | if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 ) | 354 | if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 ) |
311 | { | 355 | { |
312 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 356 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); |
357 | linkOpp = createLink; | ||
313 | if ( it->link() ) | 358 | if ( it->link() ) |
359 | { | ||
360 | out( "<br>creating links<br>" ); | ||
361 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); | ||
314 | makeLinks( it ); | 362 | makeLinks( it ); |
363 | } | ||
315 | it->processed(); | 364 | it->processed(); |
365 | out("<br><hr>"); | ||
316 | }else{ | 366 | }else{ |
317 | out("<b>"+tr("Error while installing")+"</b>"+it->name()); | 367 | out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); |
318 | } | 368 | } |
319 | } | 369 | } |
370 | out("<br>"); | ||
320 | } | 371 | } |
321 | 372 | ||
322 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) | 373 | void PmIpkg::createLinks( const QString &dest ) |
323 | { | 374 | { |
324 | qDebug("msg="+msg+" -- "+QString(dest) ); | 375 | pvDebug(2,"PmIpkg::createLinks "+dest); |
325 | // QDir d( src ); | 376 | linkOpp=createLink; |
326 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 377 | QString url = settings->getDestinationUrlByName( dest ); |
327 | //// if (! d.exists() ) return; | 378 | url = url==""?dest:url; |
328 | // const QFileInfoList *list = d.entryInfoList(); | 379 | processLinkDir( "/", url ); |
329 | // QFileInfoListIterator it( *list ); | 380 | } |
330 | // QFileInfo *fi; | 381 | |
331 | // while ( (fi=it.current()) ) { | 382 | void PmIpkg::removeLinks( const QString &dest ) |
332 | // processLinkDir( fi->absFilePath(), dest ); | 383 | { |
333 | // ++it; | 384 | pvDebug(2,"PmIpkg::removeLinks "+dest); |
334 | // } | 385 | linkOpp=removeLink; |
386 | QString url = settings->getDestinationUrlByName( dest ); | ||
387 | url = url==""?dest:url; | ||
388 | processLinkDir( "/", url ); | ||
335 | } | 389 | } |
336 | 390 | ||
337 | void PmIpkg::update() | 391 | void PmIpkg::update() |
338 | { | 392 | { |
@@ -342,9 +396,11 @@ void PmIpkg::update() | |||
342 | } | 396 | } |
343 | 397 | ||
344 | void PmIpkg::out( QString o ) | 398 | void PmIpkg::out( QString o ) |
345 | { | 399 | { |
346 | runwindow->outPut->setText( runwindow->outPut->text()+o ); | 400 | runwindow->outPut->append(o); |
401 | //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight()); | ||
402 | //runwindow->outPut->setText( runwindow->outPut->text()+o ); | ||
347 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); | 403 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); |
348 | } | 404 | } |
349 | 405 | ||
350 | 406 | ||
@@ -375,14 +431,30 @@ void PmIpkg::show(bool b) | |||
375 | else | 431 | else |
376 | runwindow->progress->show(); | 432 | runwindow->progress->show(); |
377 | } | 433 | } |
378 | 434 | ||
379 | void PmIpkg::installFile(const QString &fileName) | 435 | void PmIpkg::installFile(const QString &fileName, const QString &dest) |
380 | { | 436 | { |
381 | 437 | ||
382 | to_install.clear(); | 438 | to_install.clear(); |
383 | to_remove.clear(); | 439 | to_remove.clear(); |
384 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | 440 | pvDebug( 2,"PmIpkg::installFile "+ fileName); |
385 | to_install.append( new Package(fileName,settings) ); | 441 | Package *p = new Package(fileName,settings); |
442 | if ( dest!="") p->setDest( dest ); | ||
443 | to_install.append( p ); | ||
444 | startDialog(); | ||
445 | delete p; | ||
446 | } | ||
447 | |||
448 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) | ||
449 | { | ||
450 | |||
451 | to_install.clear(); | ||
452 | to_remove.clear(); | ||
453 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); | ||
454 | Package *p = new Package(fileName,settings); | ||
455 | if ( dest!="") p->setDest( dest ); | ||
456 | to_remove.append( p ); | ||
386 | startDialog(); | 457 | startDialog(); |
458 | delete p; | ||
387 | } | 459 | } |
388 | 460 | ||