-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index a9ba3c2..a378170 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -202,341 +202,340 @@ AdvancedFm::AdvancedFm( ) | |||
202 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 202 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
203 | this,SLOT(tabChanged(QWidget*))); | 203 | this,SLOT(tabChanged(QWidget*))); |
204 | 204 | ||
205 | // tab_3 = new QWidget( TabWidget, "tab_3" ); | 205 | // tab_3 = new QWidget( TabWidget, "tab_3" ); |
206 | // tabLayout_3 = new QGridLayout( tab_3 ); | 206 | // tabLayout_3 = new QGridLayout( tab_3 ); |
207 | // tabLayout_3->setSpacing( 2); | 207 | // tabLayout_3->setSpacing( 2); |
208 | // tabLayout_3->setMargin( 2); | 208 | // tabLayout_3->setMargin( 2); |
209 | 209 | ||
210 | // OFileSelector *fileSelector; | 210 | // OFileSelector *fileSelector; |
211 | // fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); | 211 | // fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); |
212 | // tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); | 212 | // tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); |
213 | 213 | ||
214 | // TabWidget->insertTab( tab_3, tr( "Files" ) ); | 214 | // TabWidget->insertTab( tab_3, tr( "Files" ) ); |
215 | 215 | ||
216 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 216 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
217 | currentDir.setPath( QDir::currentDirPath()); | 217 | currentDir.setPath( QDir::currentDirPath()); |
218 | 218 | ||
219 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 219 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
220 | currentRemoteDir.setPath( QDir::currentDirPath()); | 220 | currentRemoteDir.setPath( QDir::currentDirPath()); |
221 | 221 | ||
222 | b = TRUE; | 222 | b = TRUE; |
223 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 223 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
224 | currentPathCombo->setEditable(TRUE); | 224 | currentPathCombo->setEditable(TRUE); |
225 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); | 225 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); |
226 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 226 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
227 | 227 | ||
228 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 228 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
229 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 229 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
230 | 230 | ||
231 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 231 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
232 | this,SLOT(currentPathComboChanged())); | 232 | this,SLOT(currentPathComboChanged())); |
233 | 233 | ||
234 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 234 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
235 | 235 | ||
236 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); | 236 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); |
237 | 237 | ||
238 | filterStr="*"; | 238 | filterStr="*"; |
239 | b=FALSE; | 239 | b=FALSE; |
240 | populateLocalView(); | 240 | populateLocalView(); |
241 | populateRemoteView(); | 241 | populateRemoteView(); |
242 | } | 242 | } |
243 | 243 | ||
244 | AdvancedFm::~AdvancedFm() | 244 | AdvancedFm::~AdvancedFm() |
245 | { | 245 | { |
246 | } | 246 | } |
247 | 247 | ||
248 | void AdvancedFm::cleanUp() | 248 | void AdvancedFm::cleanUp() |
249 | { | 249 | { |
250 | QString sfile=QDir::homeDirPath(); | 250 | QString sfile=QDir::homeDirPath(); |
251 | if(sfile.right(1) != "/") | 251 | if(sfile.right(1) != "/") |
252 | sfile+="/._temp"; | 252 | sfile+="/._temp"; |
253 | else | 253 | else |
254 | sfile+="._temp"; | 254 | sfile+="._temp"; |
255 | QFile file( sfile); | 255 | QFile file( sfile); |
256 | if(file.exists()) | 256 | if(file.exists()) |
257 | file.remove(); | 257 | file.remove(); |
258 | } | 258 | } |
259 | 259 | ||
260 | void AdvancedFm::tabChanged(QWidget *w) | 260 | void AdvancedFm::tabChanged(QWidget *w) |
261 | { | 261 | { |
262 | if (TabWidget->currentPageIndex() == 0) { | 262 | if (TabWidget->currentPageIndex() == 0) { |
263 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 263 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
264 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 264 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
265 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 265 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
266 | } | 266 | } |
267 | if (TabWidget->currentPageIndex() == 1) { | 267 | if (TabWidget->currentPageIndex() == 1) { |
268 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 268 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
269 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 269 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
270 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 270 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
271 | } | 271 | } |
272 | } | 272 | } |
273 | 273 | ||
274 | 274 | ||
275 | void AdvancedFm::populateLocalView() | 275 | void AdvancedFm::populateLocalView() |
276 | { | 276 | { |
277 | QPixmap pm; | 277 | QPixmap pm; |
278 | Local_View->clear(); | 278 | Local_View->clear(); |
279 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 279 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
280 | currentDir.setMatchAllDirs(TRUE); | 280 | currentDir.setMatchAllDirs(TRUE); |
281 | currentDir.setNameFilter(filterStr); | 281 | currentDir.setNameFilter(filterStr); |
282 | QString fileL, fileS, fileDate; | 282 | QString fileL, fileS, fileDate; |
283 | // qDebug(currentDir.canonicalPath()); | 283 | // qDebug(currentDir.canonicalPath()); |
284 | // struct stat buf; | 284 | // struct stat buf; |
285 | // mode_t mode; | 285 | // mode_t mode; |
286 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 286 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
287 | setCaption("AdvancedFm :: "+fs); | 287 | setCaption("AdvancedFm :: "+fs); |
288 | bool isDir=FALSE; | 288 | bool isDir=FALSE; |
289 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 289 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
290 | QFileInfoListIterator it(*list); | 290 | QFileInfoListIterator it(*list); |
291 | QFileInfo *fi; | 291 | QFileInfo *fi; |
292 | while ( (fi=it.current()) ) { | 292 | while ( (fi=it.current()) ) { |
293 | if (fi->isSymLink() ) { | 293 | if (fi->isSymLink() ) { |
294 | QString symLink=fi->readLink(); | 294 | QString symLink=fi->readLink(); |
295 | // qDebug("Symlink detected "+symLink); | 295 | // qDebug("Symlink detected "+symLink); |
296 | QFileInfo sym( symLink); | 296 | QFileInfo sym( symLink); |
297 | fileS.sprintf( "%10li", sym.size() ); | 297 | fileS.sprintf( "%10li", sym.size() ); |
298 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 298 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
299 | fileDate = sym.lastModified().toString(); | 299 | fileDate = sym.lastModified().toString(); |
300 | } else { | 300 | } else { |
301 | fileS.sprintf( "%10li", fi->size() ); | 301 | fileS.sprintf( "%10li", fi->size() ); |
302 | fileL.sprintf( "%s",fi->fileName().data() ); | 302 | fileL.sprintf( "%s",fi->fileName().data() ); |
303 | fileDate= fi->lastModified().toString(); | 303 | fileDate= fi->lastModified().toString(); |
304 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 304 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
305 | fileL+="/"; | 305 | fileL+="/"; |
306 | isDir=TRUE; | 306 | isDir=TRUE; |
307 | // qDebug( fileL); | 307 | // qDebug( fileL); |
308 | } | 308 | } |
309 | } | 309 | } |
310 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | 310 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); |
311 | if(fileL !="./" && fi->exists()) { | 311 | if(fileL !="./" && fi->exists()) { |
312 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); | 312 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); |
313 | 313 | ||
314 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 314 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
315 | 315 | ||
316 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 316 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
317 | pm = Resource::loadPixmap( "lockedfolder" ); | 317 | pm = Resource::loadPixmap( "lockedfolder" ); |
318 | else | 318 | else |
319 | pm= Resource::loadPixmap( "folder" ); | 319 | pm= Resource::loadPixmap( "folder" ); |
320 | // item->setPixmap( 0,pm ); | 320 | // item->setPixmap( 0,pm ); |
321 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 321 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
322 | | fileInfo.permission( QFileInfo::ExeGroup) | 322 | | fileInfo.permission( QFileInfo::ExeGroup) |
323 | | fileInfo.permission( QFileInfo::ExeOther)) & fs.find("vfat",0,TRUE) == -1) { | 323 | | fileInfo.permission( QFileInfo::ExeOther)) & fs.find("vfat",0,TRUE) == -1) { |
324 | pm = Resource::loadPixmap( "exec"); | 324 | pm = Resource::loadPixmap( "exec"); |
325 | // else { //is exec | 325 | // else { //is exec |
326 | // pm = Resource::loadPixmap( "exec"); | 326 | // pm = Resource::loadPixmap( "exec"); |
327 | // } | 327 | // } |
328 | // // item->setPixmap( 0,pm); | 328 | // // item->setPixmap( 0,pm); |
329 | } else if( !fi->isReadable() ) { | 329 | } else if( !fi->isReadable() ) { |
330 | pm = Resource::loadPixmap( "locked" ); | 330 | pm = Resource::loadPixmap( "locked" ); |
331 | // item->setPixmap( 0,pm); | 331 | // item->setPixmap( 0,pm); |
332 | } else { //everything else goes by mimetype | 332 | } else { //everything else goes by mimetype |
333 | MimeType mt(fi->filePath()); | 333 | MimeType mt(fi->filePath()); |
334 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 334 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
335 | if(pm.isNull()) | 335 | if(pm.isNull()) |
336 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 336 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
337 | // item->setPixmap( 0,pm); | 337 | // item->setPixmap( 0,pm); |
338 | } | 338 | } |
339 | item->setPixmap( 0,pm); | 339 | item->setPixmap( 0,pm); |
340 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 340 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
341 | // overlay link image | 341 | // overlay link image |
342 | pm= Resource::loadPixmap( "folder" ); | 342 | pm= Resource::loadPixmap( "folder" ); |
343 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 343 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
344 | QPainter painter( &pm ); | 344 | QPainter painter( &pm ); |
345 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 345 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
346 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 346 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
347 | item->setPixmap( 0, pm); | 347 | item->setPixmap( 0, pm); |
348 | } | 348 | } |
349 | } | 349 | } |
350 | isDir=FALSE; | 350 | isDir=FALSE; |
351 | ++it; | 351 | ++it; |
352 | } | 352 | } |
353 | 353 | ||
354 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { | 354 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { |
355 | struct stat buf; | 355 | struct stat buf; |
356 | // struct stat st; | 356 | // struct stat st; |
357 | dev_t devT; | 357 | dev_t devT; |
358 | // mode_t mode; | 358 | // mode_t mode; |
359 | DIR *dir; | 359 | DIR *dir; |
360 | // int fd = 0; | 360 | // int fd = 0; |
361 | struct dirent *mydirent; | 361 | struct dirent *mydirent; |
362 | // int i = 1; | 362 | // int i = 1; |
363 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) | 363 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) |
364 | while ((mydirent = readdir(dir)) != NULL) { | 364 | while ((mydirent = readdir(dir)) != NULL) { |
365 | lstat( mydirent->d_name, &buf); | 365 | lstat( mydirent->d_name, &buf); |
366 | qDebug(mydirent->d_name); | 366 | qDebug(mydirent->d_name); |
367 | // mode = buf.st_mode; | 367 | // mode = buf.st_mode; |
368 | fileL.sprintf("%s", mydirent->d_name); | 368 | fileL.sprintf("%s", mydirent->d_name); |
369 | // fileS.sprintf("%d, %d", ); //this isn't correct | 369 | // fileS.sprintf("%d, %d", ); //this isn't correct |
370 | devT = buf.st_dev; | 370 | devT = buf.st_dev; |
371 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 371 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
372 | // fileS.sprintf("%d,%d", devT, devT); | 372 | // fileS.sprintf("%d,%d", devT, devT); |
373 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 373 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
374 | if( fileL.find(".") == -1 ){ | 374 | if( fileL.find(".") == -1 ){ |
375 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); | 375 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); |
376 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 376 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
377 | item->setPixmap( 0,pm); | 377 | item->setPixmap( 0,pm); |
378 | } | 378 | } |
379 | } | 379 | } |
380 | 380 | ||
381 | closedir(dir); | 381 | closedir(dir); |
382 | } | 382 | } |
383 | 383 | ||
384 | Local_View->setSorting( 3,FALSE); | 384 | Local_View->setSorting( 3,FALSE); |
385 | fillCombo( (const QString &) currentDir.canonicalPath()); | 385 | fillCombo( (const QString &) currentDir.canonicalPath()); |
386 | } | 386 | } |
387 | 387 | ||
388 | 388 | ||
389 | void AdvancedFm::populateRemoteView() | 389 | void AdvancedFm::populateRemoteView() |
390 | { | 390 | { |
391 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 391 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
392 | // QListViewItemIterator it( Remote_View ); | 392 | // QListViewItemIterator it( Remote_View ); |
393 | // for ( ; it.current(); ++it ) { | 393 | // for ( ; it.current(); ++it ) { |
394 | // if ( it.current()->isSelected() ) { | 394 | // if ( it.current()->isSelected() ) { |
395 | // QString strItem = it.current()->text(0); | 395 | // QString strItem = it.current()->text(0); |
396 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; | 396 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; |
397 | // QFileInfo fi(localFile); | 397 | // QFileInfo fi(localFile); |
398 | // } | 398 | // } |
399 | // } | 399 | // } |
400 | QPixmap pm; | 400 | QPixmap pm; |
401 | Remote_View->clear(); | 401 | Remote_View->clear(); |
402 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 402 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
403 | currentRemoteDir.setMatchAllDirs(TRUE); | 403 | currentRemoteDir.setMatchAllDirs(TRUE); |
404 | currentRemoteDir.setNameFilter(filterStr); | 404 | currentRemoteDir.setNameFilter(filterStr); |
405 | QString fileL, fileS, fileDate; | 405 | QString fileL, fileS, fileDate; |
406 | 406 | ||
407 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 407 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
408 | setCaption("AdvancedFm :: "+fs); | 408 | setCaption("AdvancedFm :: "+fs); |
409 | bool isDir=FALSE; | 409 | bool isDir=FALSE; |
410 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 410 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
411 | QFileInfoListIterator it(*list); | 411 | QFileInfoListIterator it(*list); |
412 | QFileInfo *fi; | 412 | QFileInfo *fi; |
413 | while ( (fi=it.current()) ) { | 413 | while ( (fi=it.current()) ) { |
414 | if (fi->isSymLink() ){ | 414 | if (fi->isSymLink() ){ |
415 | QString symLink=fi->readLink(); | 415 | QString symLink=fi->readLink(); |
416 | // qDebug("Symlink detected "+symLink); | 416 | // qDebug("Symlink detected "+symLink); |
417 | QFileInfo sym( symLink); | 417 | QFileInfo sym( symLink); |
418 | fileS.sprintf( "%10li", sym.size() ); | 418 | fileS.sprintf( "%10li", sym.size() ); |
419 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 419 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
420 | fileDate = sym.lastModified().toString(); | 420 | fileDate = sym.lastModified().toString(); |
421 | } else { | 421 | } else { |
422 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 422 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
423 | fileS.sprintf( "%10li", fi->size() ); | 423 | fileS.sprintf( "%10li", fi->size() ); |
424 | fileL.sprintf( "%s",fi->fileName().data() ); | 424 | fileL.sprintf( "%s",fi->fileName().data() ); |
425 | fileDate= fi->lastModified().toString(); | 425 | fileDate= fi->lastModified().toString(); |
426 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { | 426 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { |
427 | fileL+="/"; | 427 | fileL+="/"; |
428 | isDir=TRUE; | 428 | isDir=TRUE; |
429 | // qDebug( fileL); | 429 | // qDebug( fileL); |
430 | } | 430 | } |
431 | } | 431 | } |
432 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | 432 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); |
433 | if(fileL !="./" && fi->exists()) { | 433 | if(fileL !="./" && fi->exists()) { |
434 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 434 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
435 | QPixmap pm; | 435 | QPixmap pm; |
436 | 436 | ||
437 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 437 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
438 | if( !QDir( fi->filePath() ).isReadable()) | 438 | if( !QDir( fi->filePath() ).isReadable()) |
439 | pm = Resource::loadPixmap( "lockedfolder" ); | 439 | pm = Resource::loadPixmap( "lockedfolder" ); |
440 | else | 440 | else |
441 | pm= Resource::loadPixmap( "folder" ); | 441 | pm= Resource::loadPixmap( "folder" ); |
442 | // item->setPixmap( 0,pm ); | 442 | // item->setPixmap( 0,pm ); |
443 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 443 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
444 | | fileInfo.permission( QFileInfo::ExeGroup) | 444 | | fileInfo.permission( QFileInfo::ExeGroup) |
445 | | fileInfo.permission( QFileInfo::ExeOther)) & fs.find("vfat",0,TRUE) == -1) { | 445 | | fileInfo.permission( QFileInfo::ExeOther)) & fs.find("vfat",0,TRUE) == -1) { |
446 | pm = Resource::loadPixmap( "exec"); | ||
447 | ///// } else if(fileInfo.isExecutable()){ //is exec <<<< BROKEN!! | 446 | ///// } else if(fileInfo.isExecutable()){ //is exec <<<< BROKEN!! |
448 | pm = Resource::loadPixmap( "exec"); | 447 | pm = Resource::loadPixmap( "exec"); |
449 | // item->setPixmap( 0,pm); | 448 | // item->setPixmap( 0,pm); |
450 | } else if( !fi->isReadable() ) { | 449 | } else if( !fi->isReadable() ) { |
451 | pm = Resource::loadPixmap( "locked" ); | 450 | pm = Resource::loadPixmap( "locked" ); |
452 | // item->setPixmap( 0,pm); | 451 | // item->setPixmap( 0,pm); |
453 | } else { | 452 | } else { |
454 | MimeType mt(fi->filePath()); | 453 | MimeType mt(fi->filePath()); |
455 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 454 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
456 | if(pm.isNull()) | 455 | if(pm.isNull()) |
457 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 456 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
458 | // item->setPixmap( 0,pm); | 457 | // item->setPixmap( 0,pm); |
459 | } | 458 | } |
460 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 459 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
461 | // overlay link image | 460 | // overlay link image |
462 | pm= Resource::loadPixmap( "folder" ); | 461 | pm= Resource::loadPixmap( "folder" ); |
463 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 462 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
464 | QPainter painter( &pm ); | 463 | QPainter painter( &pm ); |
465 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 464 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
466 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 465 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
467 | // item->setPixmap( 0, pm); | 466 | // item->setPixmap( 0, pm); |
468 | } | 467 | } |
469 | item->setPixmap( 0, pm); | 468 | item->setPixmap( 0, pm); |
470 | } | 469 | } |
471 | isDir=FALSE; | 470 | isDir=FALSE; |
472 | ++it; | 471 | ++it; |
473 | } | 472 | } |
474 | 473 | ||
475 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 474 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
476 | struct stat buf; | 475 | struct stat buf; |
477 | // struct stat st; | 476 | // struct stat st; |
478 | // mode_t mode; | 477 | // mode_t mode; |
479 | DIR *dir; | 478 | DIR *dir; |
480 | // int fd = 0; | 479 | // int fd = 0; |
481 | struct dirent *mydirent; | 480 | struct dirent *mydirent; |
482 | // int i = 1; | 481 | // int i = 1; |
483 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 482 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
484 | while ((mydirent = readdir(dir)) != NULL) { | 483 | while ((mydirent = readdir(dir)) != NULL) { |
485 | lstat( mydirent->d_name, &buf); | 484 | lstat( mydirent->d_name, &buf); |
486 | qDebug(mydirent->d_name); | 485 | qDebug(mydirent->d_name); |
487 | // mode = buf.st_mode; | 486 | // mode = buf.st_mode; |
488 | fileL.sprintf("%s", mydirent->d_name); | 487 | fileL.sprintf("%s", mydirent->d_name); |
489 | // fileS.sprintf("%d, %d", ); //this isn't correct | 488 | // fileS.sprintf("%d, %d", ); //this isn't correct |
490 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); | 489 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); |
491 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 490 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
492 | if( fileL.find(".") == -1 ){ | 491 | if( fileL.find(".") == -1 ){ |
493 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 492 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
494 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 493 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
495 | item->setPixmap( 0,pm); | 494 | item->setPixmap( 0,pm); |
496 | } | 495 | } |
497 | } | 496 | } |
498 | 497 | ||
499 | closedir(dir); | 498 | closedir(dir); |
500 | } | 499 | } |
501 | 500 | ||
502 | Remote_View->setSorting( 3,FALSE); | 501 | Remote_View->setSorting( 3,FALSE); |
503 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); | 502 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); |
504 | } | 503 | } |
505 | 504 | ||
506 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) | 505 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) |
507 | { | 506 | { |
508 | if(selectedItem) { | 507 | if(selectedItem) { |
509 | QString strItem=selectedItem->text(0); | 508 | QString strItem=selectedItem->text(0); |
510 | QString strSize=selectedItem->text(1); | 509 | QString strSize=selectedItem->text(1); |
511 | strSize=strSize.stripWhiteSpace(); | 510 | strSize=strSize.stripWhiteSpace(); |
512 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 511 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
513 | // is symlink | 512 | // is symlink |
514 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 513 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
515 | if(QDir(strItem2).exists() ) { | 514 | if(QDir(strItem2).exists() ) { |
516 | currentDir.cd(strItem2, TRUE); | 515 | currentDir.cd(strItem2, TRUE); |
517 | populateLocalView(); | 516 | populateLocalView(); |
518 | } | 517 | } |
519 | } else { // not a symlink | 518 | } else { // not a symlink |
520 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 519 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
521 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 520 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
522 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 521 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
523 | currentDir.cd(strItem,FALSE); | 522 | currentDir.cd(strItem,FALSE); |
524 | populateLocalView(); | 523 | populateLocalView(); |
525 | } else { | 524 | } else { |
526 | currentDir.cdUp(); | 525 | currentDir.cdUp(); |
527 | populateLocalView(); | 526 | populateLocalView(); |
528 | } | 527 | } |
529 | if(QDir(strItem).exists()){ | 528 | if(QDir(strItem).exists()){ |
530 | currentDir.cd(strItem, TRUE); | 529 | currentDir.cd(strItem, TRUE); |
531 | populateLocalView(); | 530 | populateLocalView(); |
532 | } | 531 | } |
533 | } else { | 532 | } else { |
534 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 533 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
535 | if( QFile::exists(strItem ) ) { | 534 | if( QFile::exists(strItem ) ) { |
536 | // qDebug("upload "+strItem); | 535 | // qDebug("upload "+strItem); |
537 | } | 536 | } |
538 | } //end not symlink | 537 | } //end not symlink |
539 | chdir(strItem.latin1()); | 538 | chdir(strItem.latin1()); |
540 | } | 539 | } |
541 | } | 540 | } |
542 | } | 541 | } |
@@ -1254,196 +1253,196 @@ void AdvancedFm::copyAs() | |||
1254 | } | 1253 | } |
1255 | } | 1254 | } |
1256 | } | 1255 | } |
1257 | 1256 | ||
1258 | void AdvancedFm::move() { | 1257 | void AdvancedFm::move() { |
1259 | 1258 | ||
1260 | QStringList curFileList = getPath(); | 1259 | QStringList curFileList = getPath(); |
1261 | QString curFile; | 1260 | QString curFile; |
1262 | // qDebug(curFile); | 1261 | // qDebug(curFile); |
1263 | QString destFile; | 1262 | QString destFile; |
1264 | 1263 | ||
1265 | if (TabWidget->currentPageIndex() == 0) { | 1264 | if (TabWidget->currentPageIndex() == 0) { |
1266 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1265 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1267 | QString destFile = currentRemoteDir.canonicalPath(); | 1266 | QString destFile = currentRemoteDir.canonicalPath(); |
1268 | if(destFile.right(1).find("/",0,TRUE) == -1) | 1267 | if(destFile.right(1).find("/",0,TRUE) == -1) |
1269 | destFile+="/"; | 1268 | destFile+="/"; |
1270 | destFile +=(*it); | 1269 | destFile +=(*it); |
1271 | curFile = currentDir.canonicalPath(); | 1270 | curFile = currentDir.canonicalPath(); |
1272 | qDebug("Destination file is "+destFile); | 1271 | qDebug("Destination file is "+destFile); |
1273 | if(curFile.right(1).find("/",0,TRUE) == -1) | 1272 | if(curFile.right(1).find("/",0,TRUE) == -1) |
1274 | curFile +="/"; | 1273 | curFile +="/"; |
1275 | curFile+=(*it); | 1274 | curFile+=(*it); |
1276 | 1275 | ||
1277 | QFile f(destFile); | 1276 | QFile f(destFile); |
1278 | if( f.exists()) | 1277 | if( f.exists()) |
1279 | f.remove(); | 1278 | f.remove(); |
1280 | if(!copyFile( destFile, curFile) ) { | 1279 | if(!copyFile( destFile, curFile) ) { |
1281 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | 1280 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); |
1282 | return; | 1281 | return; |
1283 | } | 1282 | } |
1284 | QFile::remove(curFile); | 1283 | QFile::remove(curFile); |
1285 | } | 1284 | } |
1286 | TabWidget->setCurrentPage(1); | 1285 | TabWidget->setCurrentPage(1); |
1287 | } else { | 1286 | } else { |
1288 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1287 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1289 | QString destFile = currentRemoteDir.canonicalPath(); | 1288 | QString destFile = currentRemoteDir.canonicalPath(); |
1290 | if(destFile.right(1).find("/",0,TRUE) == -1) | 1289 | if(destFile.right(1).find("/",0,TRUE) == -1) |
1291 | destFile+="/"; | 1290 | destFile+="/"; |
1292 | destFile +=(*it); | 1291 | destFile +=(*it); |
1293 | qDebug("Destination file is "+destFile); | 1292 | qDebug("Destination file is "+destFile); |
1294 | curFile = currentDir.canonicalPath(); | 1293 | curFile = currentDir.canonicalPath(); |
1295 | if(curFile.right(1).find("/",0,TRUE) == -1) | 1294 | if(curFile.right(1).find("/",0,TRUE) == -1) |
1296 | curFile +="/"; | 1295 | curFile +="/"; |
1297 | curFile+=(*it); | 1296 | curFile+=(*it); |
1298 | 1297 | ||
1299 | QFile f(destFile); | 1298 | QFile f(destFile); |
1300 | if( f.exists()) | 1299 | if( f.exists()) |
1301 | f.remove(); | 1300 | f.remove(); |
1302 | if(!copyFile(destFile, curFile) ) { | 1301 | if(!copyFile(destFile, curFile) ) { |
1303 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | 1302 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); |
1304 | return; | 1303 | return; |
1305 | } | 1304 | } |
1306 | QFile::remove(curFile); | 1305 | QFile::remove(curFile); |
1307 | TabWidget->setCurrentPage(0); | 1306 | TabWidget->setCurrentPage(0); |
1308 | } | 1307 | } |
1309 | } | 1308 | } |
1310 | populateRemoteView(); | 1309 | populateRemoteView(); |
1311 | populateLocalView(); | 1310 | populateLocalView(); |
1312 | } | 1311 | } |
1313 | 1312 | ||
1314 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) | 1313 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) |
1315 | { | 1314 | { |
1316 | char bf[ 50000 ]; | 1315 | char bf[ 50000 ]; |
1317 | int bytesRead; | 1316 | int bytesRead; |
1318 | bool success = TRUE; | 1317 | bool success = TRUE; |
1319 | struct stat status; | 1318 | struct stat status; |
1320 | 1319 | ||
1321 | QFile s( src ); | 1320 | QFile s( src ); |
1322 | QFile d( dest ); | 1321 | QFile d( dest ); |
1323 | 1322 | ||
1324 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { | 1323 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { |
1325 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { | 1324 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { |
1326 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ | 1325 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ |
1327 | success = FALSE; | 1326 | success = FALSE; |
1328 | break; | 1327 | break; |
1329 | } | 1328 | } |
1330 | } | 1329 | } |
1331 | if( success && (bytesRead > 0) ){ | 1330 | if( success && (bytesRead > 0) ){ |
1332 | d.writeBlock( bf, bytesRead ); | 1331 | d.writeBlock( bf, bytesRead ); |
1333 | } | 1332 | } |
1334 | } else { | 1333 | } else { |
1335 | success = FALSE; | 1334 | success = FALSE; |
1336 | } | 1335 | } |
1337 | 1336 | ||
1338 | // Set file permissions | 1337 | // Set file permissions |
1339 | if( stat( (const char *) src, &status ) == 0 ){ | 1338 | if( stat( (const char *) src, &status ) == 0 ){ |
1340 | chmod( (const char *) dest, status.st_mode ); | 1339 | chmod( (const char *) dest, status.st_mode ); |
1341 | } | 1340 | } |
1342 | 1341 | ||
1343 | return success; | 1342 | return success; |
1344 | } | 1343 | } |
1345 | 1344 | ||
1346 | void AdvancedFm::runCommand() { | 1345 | void AdvancedFm::runCommand() { |
1347 | QString curFile; | 1346 | QString curFile; |
1348 | if (TabWidget->currentPageIndex() == 0) { | 1347 | if (TabWidget->currentPageIndex() == 0) { |
1349 | if( Local_View->currentItem()) | 1348 | if( Local_View->currentItem()) |
1350 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); | 1349 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
1351 | } else { | 1350 | } else { |
1352 | if(Remote_View->currentItem()) | 1351 | if(Remote_View->currentItem()) |
1353 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); | 1352 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); |
1354 | } | 1353 | } |
1355 | 1354 | ||
1356 | InputDialog *fileDlg; | 1355 | InputDialog *fileDlg; |
1357 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1356 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1358 | fileDlg->setInputText(curFile); | 1357 | fileDlg->setInputText(curFile); |
1359 | fileDlg->exec(); | 1358 | fileDlg->exec(); |
1360 | QString command; | 1359 | QString command; |
1361 | if( fileDlg->result() == 1 ) { | 1360 | if( fileDlg->result() == 1 ) { |
1362 | command = fileDlg->LineEdit1->text(); | 1361 | command = fileDlg->LineEdit1->text(); |
1363 | 1362 | ||
1364 | // int err=0; | 1363 | // int err=0; |
1365 | Output *outDlg; | 1364 | Output *outDlg; |
1366 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1365 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1367 | outDlg->showMaximized(); | 1366 | outDlg->showMaximized(); |
1368 | outDlg->show(); | 1367 | outDlg->show(); |
1369 | qApp->processEvents(); | 1368 | qApp->processEvents(); |
1370 | FILE *fp; | 1369 | FILE *fp; |
1371 | char line[130]; | 1370 | char line[130]; |
1372 | sleep(1); | 1371 | sleep(1); |
1373 | // if(command.find("2>",0,TRUE) != -1) | 1372 | // if(command.find("2>",0,TRUE) != -1) |
1374 | command +=" 2>&1"; | 1373 | command +=" 2>&1"; |
1375 | fp = popen( (const char *) command, "r"); | 1374 | fp = popen( (const char *) command, "r"); |
1376 | if ( !fp ) { | 1375 | if ( !fp ) { |
1377 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1376 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1378 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); | 1377 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); |
1379 | pclose(fp); | 1378 | pclose(fp); |
1380 | return; | 1379 | return; |
1381 | } else { | 1380 | } else { |
1382 | while ( fgets( line, sizeof line, fp)) { | 1381 | while ( fgets( line, sizeof line, fp)) { |
1383 | QString lineStr = line; | 1382 | QString lineStr = line; |
1384 | lineStr=lineStr.left(lineStr.length()-1); | 1383 | lineStr=lineStr.left(lineStr.length()-1); |
1385 | outDlg->OutputEdit->append(lineStr); | 1384 | outDlg->OutputEdit->append(lineStr); |
1386 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1385 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1387 | } | 1386 | } |
1388 | } | 1387 | } |
1389 | } | 1388 | } |
1390 | } | 1389 | } |
1391 | 1390 | ||
1392 | void AdvancedFm::runCommandStd() { | 1391 | void AdvancedFm::runCommandStd() { |
1393 | QString curFile; | 1392 | QString curFile; |
1394 | if (TabWidget->currentPageIndex() == 0) { | 1393 | if (TabWidget->currentPageIndex() == 0) { |
1395 | if( Local_View->currentItem()) | 1394 | if( Local_View->currentItem()) |
1396 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); | 1395 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); |
1397 | } else { | 1396 | } else { |
1398 | if(Remote_View->currentItem()) | 1397 | if(Remote_View->currentItem()) |
1399 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); | 1398 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); |
1400 | } | 1399 | } |
1401 | 1400 | ||
1402 | InputDialog *fileDlg; | 1401 | InputDialog *fileDlg; |
1403 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1402 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1404 | fileDlg->setInputText(curFile); | 1403 | fileDlg->setInputText(curFile); |
1405 | fileDlg->exec(); | 1404 | fileDlg->exec(); |
1406 | QString command; | 1405 | QString command; |
1407 | if( fileDlg->result() == 1 ) { | 1406 | if( fileDlg->result() == 1 ) { |
1408 | qApp->processEvents(); | 1407 | qApp->processEvents(); |
1409 | command = fileDlg->LineEdit1->text() + " &"; | 1408 | command = fileDlg->LineEdit1->text() + " &"; |
1410 | system(command.latin1()); | 1409 | system(command.latin1()); |
1411 | } | 1410 | } |
1412 | } | 1411 | } |
1413 | 1412 | ||
1414 | void AdvancedFm::fileStatus() { | 1413 | void AdvancedFm::fileStatus() { |
1415 | QString curFile; | 1414 | QString curFile; |
1416 | if (TabWidget->currentPageIndex() == 0) { | 1415 | if (TabWidget->currentPageIndex() == 0) { |
1417 | curFile = Local_View->currentItem()->text(0); | 1416 | curFile = Local_View->currentItem()->text(0); |
1418 | } else { | 1417 | } else { |
1419 | curFile = Remote_View->currentItem()->text(0); | 1418 | curFile = Remote_View->currentItem()->text(0); |
1420 | } | 1419 | } |
1421 | QString command = " stat -l "+ curFile +" 2>&1"; | 1420 | QString command = " stat -l "+ curFile +" 2>&1"; |
1422 | // int err=0; | 1421 | // int err=0; |
1423 | Output *outDlg; | 1422 | Output *outDlg; |
1424 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1423 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1425 | outDlg->showMaximized(); | 1424 | outDlg->showMaximized(); |
1426 | outDlg->show(); | 1425 | outDlg->show(); |
1427 | qApp->processEvents(); | 1426 | qApp->processEvents(); |
1428 | FILE *fp; | 1427 | FILE *fp; |
1429 | char line[130]; | 1428 | char line[130]; |
1430 | sleep(1); | 1429 | sleep(1); |
1431 | fp = popen( (const char *) command, "r"); | 1430 | fp = popen( (const char *) command, "r"); |
1432 | if ( !fp ) { | 1431 | if ( !fp ) { |
1433 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1432 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1434 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); | 1433 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); |
1435 | pclose(fp); | 1434 | pclose(fp); |
1436 | return; | 1435 | return; |
1437 | } else { | 1436 | } else { |
1438 | while ( fgets( line, sizeof line, fp)) { | 1437 | while ( fgets( line, sizeof line, fp)) { |
1439 | outDlg->OutputEdit->append(line); | 1438 | outDlg->OutputEdit->append(line); |
1440 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1439 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1441 | 1440 | ||
1442 | } | 1441 | } |
1443 | 1442 | ||
1444 | } | 1443 | } |
1445 | } | 1444 | } |
1446 | 1445 | ||
1447 | void AdvancedFm::mkDir() { | 1446 | void AdvancedFm::mkDir() { |
1448 | if (TabWidget->currentPageIndex() == 0) | 1447 | if (TabWidget->currentPageIndex() == 0) |
1449 | localMakDir(); | 1448 | localMakDir(); |