-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 11c0f97..7682d49 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -145,49 +145,49 @@ QStringList* PmIpkg::getList( QString packFileName, QString d ) | |||
145 | out( "Could not open:\n"+packFileDir+"\n Panik!" ); | 145 | out( "Could not open:\n"+packFileDir+"\n Panik!" ); |
146 | return (QStringList*)0; | 146 | return (QStringList*)0; |
147 | } | 147 | } |
148 | } | 148 | } |
149 | QStringList *fileList = new QStringList(); | 149 | QStringList *fileList = new QStringList(); |
150 | QTextStream t( &f ); | 150 | QTextStream t( &f ); |
151 | while ( !t.eof() ) | 151 | while ( !t.eof() ) |
152 | { | 152 | { |
153 | *fileList += t.readLine(); | 153 | *fileList += t.readLine(); |
154 | } | 154 | } |
155 | f.close(); | 155 | f.close(); |
156 | return fileList; | 156 | return fileList; |
157 | } | 157 | } |
158 | 158 | ||
159 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | 159 | void PmIpkg::linkPackage( QString packFileName, QString dest ) |
160 | { | 160 | { |
161 | if (dest == "root" || dest == "/" ) return; | 161 | if (dest == "root" || dest == "/" ) return; |
162 | QStringList *fileList = getList( packFileName, dest ); | 162 | QStringList *fileList = getList( packFileName, dest ); |
163 | processFileList( fileList, dest ); | 163 | processFileList( fileList, dest ); |
164 | delete fileList; | 164 | delete fileList; |
165 | } | 165 | } |
166 | 166 | ||
167 | void PmIpkg::processFileList( QStringList *fileList, QString d ) | 167 | void PmIpkg::processFileList( QStringList *fileList, QString d ) |
168 | { | 168 | { |
169 | if (!fileList) return; | 169 | if (!fileList || fileList->isEmpty()) return; |
170 | for (uint i=0; i < fileList->count(); i++) | 170 | for (uint i=0; i < fileList->count(); i++) |
171 | { | 171 | { |
172 | QString dest = settings->getDestinationUrlByName( d ); | 172 | QString dest = settings->getDestinationUrlByName( d ); |
173 | dest = dest==""?d:dest; | 173 | dest = dest==""?d:dest; |
174 | processLinkDir( (*fileList)[i], dest ); | 174 | processLinkDir( (*fileList)[i], dest ); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | 178 | ||
179 | void PmIpkg::processLinkDir( QString file, QString dest ) | 179 | void PmIpkg::processLinkDir( QString file, QString dest ) |
180 | { | 180 | { |
181 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); | 181 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); |
182 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); | 182 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); |
183 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); | 183 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); |
184 | if ( dest == "???" || dest == "" ) return; | 184 | if ( dest == "???" || dest == "" ) return; |
185 | QString destFile = file; | 185 | QString destFile = file; |
186 | file = dest+"/"+file; | 186 | file = dest+"/"+file; |
187 | if (file == dest) return; | 187 | if (file == dest) return; |
188 | // if (linkOpp==createLink) out( "\ncreating links\n" ); | 188 | // if (linkOpp==createLink) out( "\ncreating links\n" ); |
189 | // if (linkOpp==removeLink) out( "\nremoving links\n" ); | 189 | // if (linkOpp==removeLink) out( "\nremoving links\n" ); |
190 | QFileInfo fileInfo( file ); | 190 | QFileInfo fileInfo( file ); |
191 | if ( fileInfo.isDir() ) | 191 | if ( fileInfo.isDir() ) |
192 | { | 192 | { |
193 | pvDebug(4, "process dir "+file); | 193 | pvDebug(4, "process dir "+file); |
@@ -271,49 +271,49 @@ void PmIpkg::commit() | |||
271 | installDialog->close(); | 271 | installDialog->close(); |
272 | delete installDialog; | 272 | delete installDialog; |
273 | installDialog = 0; | 273 | installDialog = 0; |
274 | out(tr("\nAll done.")); | 274 | out(tr("\nAll done.")); |
275 | } | 275 | } |
276 | 276 | ||
277 | void PmIpkg::doIt() | 277 | void PmIpkg::doIt() |
278 | { | 278 | { |
279 | runwindow->progress->setProgress(0); | 279 | runwindow->progress->setProgress(0); |
280 | show(); | 280 | show(); |
281 | remove(); | 281 | remove(); |
282 | install(); | 282 | install(); |
283 | } | 283 | } |
284 | 284 | ||
285 | 285 | ||
286 | void PmIpkg::remove() | 286 | void PmIpkg::remove() |
287 | { | 287 | { |
288 | if ( to_remove.count() == 0 ) return; | 288 | if ( to_remove.count() == 0 ) return; |
289 | 289 | ||
290 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); | 290 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); |
291 | 291 | ||
292 | QStringList *fileList; | 292 | QStringList *fileList; |
293 | for (uint i=0; i < to_remove.count(); i++) | 293 | for (uint i=0; i < to_remove.count(); i++) |
294 | { | 294 | { |
295 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); | 295 | if ( to_remove.at(i)->link() ) fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); |
296 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) | 296 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) |
297 | { | 297 | { |
298 | runwindow->progress->setProgress( 1 ); | 298 | runwindow->progress->setProgress( 1 ); |
299 | linkOpp = removeLink; | 299 | linkOpp = removeLink; |
300 | to_remove.at(i)->processed(); | 300 | to_remove.at(i)->processed(); |
301 | pvDebug(3,"link "+QString::number(i)); | 301 | pvDebug(3,"link "+QString::number(i)); |
302 | if ( to_remove.at(i)->link() ) | 302 | if ( to_remove.at(i)->link() ) |
303 | processFileList( fileList, to_remove.at(i)->dest() ); | 303 | processFileList( fileList, to_remove.at(i)->dest() ); |
304 | //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); | 304 | //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); |
305 | //if ( to_remove.at(i) ) to_remove.take( i ); | 305 | //if ( to_remove.at(i) ) to_remove.take( i ); |
306 | 306 | ||
307 | out("\n"); | 307 | out("\n"); |
308 | }else{ | 308 | }else{ |
309 | out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); | 309 | out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); |
310 | if ( to_remove.at(i)->link() ) | 310 | if ( to_remove.at(i)->link() ) |
311 | processFileList( fileList, to_remove.at(i)->dest() ); | 311 | processFileList( fileList, to_remove.at(i)->dest() ); |
312 | } | 312 | } |
313 | if ( to_remove.at(i)->link() ) | 313 | if ( to_remove.at(i)->link() ) |
314 | processFileList( fileList, to_remove.at(i)->dest() ); | 314 | processFileList( fileList, to_remove.at(i)->dest() ); |
315 | if ( to_remove.at(i)->link() )delete fileList; | 315 | if ( to_remove.at(i)->link() )delete fileList; |
316 | } | 316 | } |
317 | to_remove.clear(); | 317 | to_remove.clear(); |
318 | out("\n"); | 318 | out("\n"); |
319 | } | 319 | } |