summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp7
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp2
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp220
4 files changed, 108 insertions, 122 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 9721f84..6f017b4 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -132,391 +132,384 @@ void AdvancedFm::populateView() {
132 } 132 }
133 } 133 }
134 QFileInfo fileInfo( path + "/" + fileL); 134 QFileInfo fileInfo( path + "/" + fileL);
135 135
136 if(fileL !="./" && fi->exists()) { 136 if(fileL !="./" && fi->exists()) {
137 item = new QListViewItem( thisView, fileL, fileS , fileDate); 137 item = new QListViewItem( thisView, fileL, fileS , fileDate);
138 138
139 if(isDir || fileL.find("/",0,TRUE) != -1) { 139 if(isDir || fileL.find("/",0,TRUE) != -1) {
140 140
141 if( !QDir( fi->filePath() ).isReadable()) //is directory 141 if( !QDir( fi->filePath() ).isReadable()) //is directory
142 pm = Resource::loadPixmap( "lockedfolder" ); 142 pm = Resource::loadPixmap( "lockedfolder" );
143 else 143 else
144 pm= Resource::loadPixmap( "folder" ); 144 pm= Resource::loadPixmap( "folder" );
145 } 145 }
146 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 146 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
147 pm = Resource::loadPixmap( "exec"); 147 pm = Resource::loadPixmap( "exec");
148 } 148 }
149 else if( (fileInfo.permission( QFileInfo::ExeUser) 149 else if( (fileInfo.permission( QFileInfo::ExeUser)
150 | fileInfo.permission( QFileInfo::ExeGroup) 150 | fileInfo.permission( QFileInfo::ExeGroup)
151 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 151 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
152 pm = Resource::loadPixmap( "exec"); 152 pm = Resource::loadPixmap( "exec");
153 } 153 }
154 else if( !fi->isReadable() ) { 154 else if( !fi->isReadable() ) {
155 pm = Resource::loadPixmap( "locked" ); 155 pm = Resource::loadPixmap( "locked" );
156 } 156 }
157 else { //everything else goes by mimetype 157 else { //everything else goes by mimetype
158 MimeType mt(fi->filePath()); 158 MimeType mt(fi->filePath());
159 pm=mt.pixmap(); //sets the correct pixmap for mimetype 159 pm=mt.pixmap(); //sets the correct pixmap for mimetype
160 if(pm.isNull()) { 160 if(pm.isNull()) {
161 pm = unknownXpm; 161 pm = unknownXpm;
162 } 162 }
163 } 163 }
164 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { 164 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
165 // odebug << " overlay link image" << oendl; 165 // odebug << " overlay link image" << oendl;
166 pm= Resource::loadPixmap( "advancedfm/symlink" ); 166 pm= Resource::loadPixmap( "advancedfm/symlink" );
167 // pm= Resource::loadPixmap( "folder" ); 167 // pm= Resource::loadPixmap( "folder" );
168// QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 168// QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
169// QPainter painter( &pm ); 169// QPainter painter( &pm );
170// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 170// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
171// pm.setMask( pm.createHeuristicMask( FALSE ) ); 171// pm.setMask( pm.createHeuristicMask( FALSE ) );
172 } 172 }
173 item->setPixmap( 0,pm); 173 item->setPixmap( 0,pm);
174 174
175 } 175 }
176 isDir=FALSE; 176 isDir=FALSE;
177 ++it; 177 ++it;
178 } 178 }
179 179
180 if( path.find("dev",0,TRUE) != -1) { 180 if( path.find("dev",0,TRUE) != -1) {
181 struct stat buf; 181 struct stat buf;
182 dev_t devT; 182 dev_t devT;
183 DIR *dir; 183 DIR *dir;
184 struct dirent *mydirent; 184 struct dirent *mydirent;
185 185
186 if((dir = opendir( path.latin1())) != NULL) 186 if((dir = opendir( path.latin1())) != NULL)
187 while ((mydirent = readdir(dir)) != NULL) { 187 while ((mydirent = readdir(dir)) != NULL) {
188 lstat( mydirent->d_name, &buf); 188 lstat( mydirent->d_name, &buf);
189// odebug << mydirent->d_name << oendl; 189// odebug << mydirent->d_name << oendl;
190 fileL.sprintf("%s", mydirent->d_name); 190 fileL.sprintf("%s", mydirent->d_name);
191 devT = buf.st_dev; 191 devT = buf.st_dev;
192 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 192 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
193 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 193 fileDate.sprintf("%s", ctime( &buf.st_mtime));
194 if( fileL.find(".") == -1 ) { 194 if( fileL.find(".") == -1 ) {
195 item= new QListViewItem( thisView, fileL, fileS, fileDate); 195 item= new QListViewItem( thisView, fileL, fileS, fileDate);
196 pm = unknownXpm; 196 pm = unknownXpm;
197 item->setPixmap( 0,pm); 197 item->setPixmap( 0,pm);
198 } 198 }
199 } 199 }
200 200
201 closedir(dir); 201 closedir(dir);
202 } 202 }
203 203
204 thisView->setSorting( 3,FALSE); 204 thisView->setSorting( 3,FALSE);
205 fillCombo( (const QString &) path ); 205 fillCombo( (const QString &) path );
206} 206}
207 207
208void AdvancedFm::rePopulate() { 208void AdvancedFm::rePopulate() {
209 // qDebug("repopulate views"); 209 // qDebug("repopulate views");
210 populateView(); 210 populateView();
211 setOtherTabCurrent(); 211 setOtherTabCurrent();
212 populateView(); 212 populateView();
213 213
214// int tmpTab = whichTab; 214// int tmpTab = whichTab;
215// // odebug << "" << tmpTab << "" << oendl; 215// // odebug << "" << tmpTab << "" << oendl;
216 216
217// for(int i =1; i < 3; i++) { 217// for(int i =1; i < 3; i++) {
218// TabWidget->setCurrentWidget(i - 1); 218// TabWidget->setCurrentWidget(i - 1);
219// populateView(); 219// populateView();
220// } 220// }
221// TabWidget->setCurrentWidget( tmpTab - 1); 221// TabWidget->setCurrentWidget( tmpTab - 1);
222} 222}
223 223
224void AdvancedFm::ListClicked(QListViewItem *selectedItem) { 224void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
225 // if ( TabWidget->currentWidget() == tab) 225 // if ( TabWidget->currentWidget() == tab)
226 // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local"); 226 // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local");
227 // else 227 // else
228 // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote"); 228 // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote");
229 229
230 230
231 if(selectedItem) { 231 if(selectedItem) {
232 QString strItem=selectedItem->text(0); 232 QString strItem=selectedItem->text(0);
233// owarn << strItem << oendl; 233// owarn << strItem << oendl;
234 QString strSize=selectedItem->text(1); 234 QString strSize=selectedItem->text(1);
235 strSize=strSize.stripWhiteSpace(); 235 strSize=strSize.stripWhiteSpace();
236 bool isDirectory = false; 236 bool isDirectory = false;
237 QString strItem2; 237 QString strItem2;
238 238
239 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink 239 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink
240 strItem2 = dealWithSymName((const QString&)strItem); 240 strItem2 = dealWithSymName((const QString&)strItem);
241 if(QDir(strItem2).exists() ) 241 if(QDir(strItem2).exists() )
242 strItem = strItem2; 242 strItem = strItem2;
243 } 243 }
244 244
245 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 245 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
246 246
247 if(QDir(strItem).exists()) 247 if(QDir(strItem).exists())
248 isDirectory = true; 248 isDirectory = true;
249 } 249 }
250 250
251 if( isDirectory ) { 251 if( isDirectory ) {
252 CurrentDir()->cd( strItem, TRUE); 252 CurrentDir()->cd( strItem, TRUE);
253 populateView(); 253 populateView();
254 CurrentView()->ensureItemVisible( CurrentView()->firstChild()); 254 CurrentView()->ensureItemVisible( CurrentView()->firstChild());
255 } 255 }
256 chdir( strItem.latin1()); 256 chdir( strItem.latin1());
257 } 257 }
258} 258}
259 259
260void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { 260void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) {
261 Q_UNUSED(item); 261 Q_UNUSED(item);
262 switch (mouse) { 262 switch (mouse) {
263 case 1: 263 case 1:
264 { 264 {
265 if(renameBox != 0 ) { 265 if(renameBox != 0 ) {
266 cancelRename(); 266 cancelRename();
267 } 267 }
268 } 268 }
269 break; 269 break;
270// case 2: 270// case 2:
271// menuTimer.start( 50, TRUE ); 271// menuTimer.start( 50, TRUE );
272// break; 272// break;
273 }; 273 };
274} 274}
275 275
276 276
277void AdvancedFm::refreshCurrentTab() { 277void AdvancedFm::refreshCurrentTab() {
278 populateView(); 278 populateView();
279 // if ( TabWidget->currentWidget() == tab) { 279 // if ( TabWidget->currentWidget() == tab) {
280 280
281} 281}
282 282
283void AdvancedFm::switchToLocalTab() { 283void AdvancedFm::switchToLocalTab() {
284 TabWidget->setCurrentWidget(0); 284 TabWidget->setCurrentWidget(0);
285 // Local_View->setFocus(); 285 // Local_View->setFocus();
286 whichTab = 1; 286 whichTab = 1;
287} 287}
288 288
289void AdvancedFm::switchToRemoteTab() { 289void AdvancedFm::switchToRemoteTab() {
290 TabWidget->setCurrentWidget(1); 290 TabWidget->setCurrentWidget(1);
291 // Remote_View->setFocus(); 291 // Remote_View->setFocus();
292 whichTab = 2; 292 whichTab = 2;
293} 293}
294 294
295void AdvancedFm::currentPathComboChanged() { 295void AdvancedFm::currentPathComboChanged() {
296 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 296 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
297 CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); 297 CurrentDir()->setPath( currentPathCombo->lineEdit()->text() );
298 populateView(); 298 populateView();
299 } else { 299 } else {
300 QMessageBox::message(tr("Note"),tr("<p>That directory does not exist</p>")); 300 QMessageBox::message(tr("Note"),tr("<p>That directory does not exist</p>"));
301 } 301 }
302} 302}
303 303
304void AdvancedFm::fillCombo(const QString &currentPath) { 304void AdvancedFm::fillCombo(const QString &currentPath) {
305 305
306 if ( TabWidget->currentWidget() == tab) { 306 if ( TabWidget->currentWidget() == tab) {
307// if ( whichTab == 1) { 307// if ( whichTab == 1) {
308 currentPathCombo->lineEdit()->setText( currentPath); 308 currentPathCombo->lineEdit()->setText( currentPath);
309 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 309 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
310 currentPathCombo->clear(); 310 currentPathCombo->clear();
311 localDirPathStringList.prepend( currentPath ); 311 localDirPathStringList.prepend( currentPath );
312 currentPathCombo->insertStringList( localDirPathStringList,-1); 312 currentPathCombo->insertStringList( localDirPathStringList,-1);
313 } 313 }
314 } else { 314 } else {
315 currentPathCombo->lineEdit()->setText( currentPath); 315 currentPathCombo->lineEdit()->setText( currentPath);
316 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 316 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
317 currentPathCombo->clear(); 317 currentPathCombo->clear();
318 remoteDirPathStringList.prepend( currentPath ); 318 remoteDirPathStringList.prepend( currentPath );
319 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 319 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
320 } 320 }
321 } 321 }
322} 322}
323 323
324void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
325 chdir( currentPath.latin1() );
326 CurrentDir()->cd( currentPath, TRUE);
327 populateView();
328 update();
329}
330
331QStringList AdvancedFm::getPath() { 324QStringList AdvancedFm::getPath() {
332 QStringList strList; 325 QStringList strList;
333 QListView *thisView=CurrentView(); 326 QListView *thisView=CurrentView();
334 QList<QListViewItem> * getSelectedItems( QListView * thisView ); 327 QList<QListViewItem> * getSelectedItems( QListView * thisView );
335 QListViewItemIterator it( thisView ); 328 QListViewItemIterator it( thisView );
336 for ( ; it.current(); ++it ) { 329 for ( ; it.current(); ++it ) {
337 if ( it.current()->isSelected() ) { 330 if ( it.current()->isSelected() ) {
338 strList << it.current()->text(0); 331 strList << it.current()->text(0);
339// odebug << it.current()->text(0) << oendl; 332// odebug << it.current()->text(0) << oendl;
340 } 333 }
341 } 334 }
342 return strList; 335 return strList;
343} 336}
344 337
345void AdvancedFm::changeTo(const QString dir) { 338void AdvancedFm::changeTo(const QString dir) {
346 chdir( dir.latin1()); 339 chdir( dir.latin1());
347 CurrentDir()->cd(dir, TRUE); 340 CurrentDir()->cd(dir, TRUE);
348 populateView(); 341 populateView();
349 update(); 342 update();
350} 343}
351 344
352void AdvancedFm::homeButtonPushed() { 345void AdvancedFm::homeButtonPushed() {
353 changeTo(QDir::homeDirPath()); 346 changeTo(QDir::homeDirPath());
354} 347}
355 348
356void AdvancedFm::docButtonPushed() { 349void AdvancedFm::docButtonPushed() {
357 changeTo(QPEApplication::documentDir()); 350 changeTo(QPEApplication::documentDir());
358} 351}
359 352
360void AdvancedFm::SDButtonPushed() { 353void AdvancedFm::SDButtonPushed() {
361 changeTo("/mnt/card");// this can change so fix 354 changeTo("/mnt/card");// this can change so fix
362} 355}
363 356
364void AdvancedFm::CFButtonPushed() { 357void AdvancedFm::CFButtonPushed() {
365 if(zaurusDevice) 358 if(zaurusDevice)
366 changeTo("/mnt/cf"); //zaurus 359 changeTo("/mnt/cf"); //zaurus
367 else 360 else
368 changeTo("/mnt/hda"); //ipaq 361 changeTo("/mnt/hda"); //ipaq
369} 362}
370 363
371void AdvancedFm::QPEButtonPushed() { 364void AdvancedFm::QPEButtonPushed() {
372 changeTo(QPEApplication::qpeDir()); 365 changeTo(QPEApplication::qpeDir());
373} 366}
374 367
375void AdvancedFm::doAbout() { 368void AdvancedFm::doAbout() {
376 QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); 369 QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>"));
377} 370}
378 371
379void AdvancedFm::keyPressEvent( QKeyEvent *e) { 372void AdvancedFm::keyPressEvent( QKeyEvent *e) {
380 Q_UNUSED(e); 373 Q_UNUSED(e);
381} 374}
382 375
383void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { 376void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
384// if( CurrentView()->hasFocus() ) 377// if( CurrentView()->hasFocus() )
385// e->ignore(); 378// e->ignore();
386 if( currentPathCombo->lineEdit()->hasFocus()) { 379 if( currentPathCombo->lineEdit()->hasFocus()) {
387 // qDebug("shout!"); 380 // qDebug("shout!");
388 } 381 }
389 382
390 else if( e->key() == Key_Left ) 383 else if( e->key() == Key_Left )
391 upDir(); 384 upDir();
392 else if( e->key() == Key_Return || e->key() == Key_Enter) 385 else if( e->key() == Key_Return || e->key() == Key_Enter)
393 navigateToSelected(); 386 navigateToSelected();
394 else if( e->key() == Key_Tab) 387 else if( e->key() == Key_Tab)
395 setOtherTabCurrent(); 388 setOtherTabCurrent();
396 else if( e->key() == Key_Delete ) 389 else if( e->key() == Key_Delete )
397 del(); 390 del();
398 else if( e->key() == Key_A) 391 else if( e->key() == Key_A)
399 copyAs(); 392 copyAs();
400 else if( e->key() == Key_C) 393 else if( e->key() == Key_C)
401 copy(); 394 copy();
402 else if( e->key() == Key_E) 395 else if( e->key() == Key_E)
403 runThis(); 396 runThis();
404 else if( e->key() == Key_G) 397 else if( e->key() == Key_G)
405 currentPathCombo->lineEdit()->setFocus(); 398 currentPathCombo->lineEdit()->setFocus();
406 else if( e->key() == Key_H ) 399 else if( e->key() == Key_H )
407 showHidden(); 400 showHidden();
408 else if( e->key() == Key_I) 401 else if( e->key() == Key_I)
409 fileStatus(); 402 fileStatus();
410 else if( e->key() == Key_M) 403 else if( e->key() == Key_M)
411 move(); 404 move();
412 else if( e->key() == Key_N ) 405 else if( e->key() == Key_N )
413 mkDir(); 406 mkDir();
414 else if( e->key() == Key_P) 407 else if( e->key() == Key_P)
415 filePerms(); 408 filePerms();
416 else if( e->key() == Key_R ) 409 else if( e->key() == Key_R )
417 rn(); 410 rn();
418 else if( e->key() == Key_U ) 411 else if( e->key() == Key_U )
419 upDir(); 412 upDir();
420 else if( e->key() == Key_1) 413 else if( e->key() == Key_1)
421 switchToLocalTab(); 414 switchToLocalTab();
422 else if( e->key() == Key_2) 415 else if( e->key() == Key_2)
423 switchToRemoteTab(); 416 switchToRemoteTab();
424 else if( e->key() == Key_3) 417 else if( e->key() == Key_3)
425 CFButtonPushed(); 418 CFButtonPushed();
426 else if( e->key() == Key_4) 419 else if( e->key() == Key_4)
427 SDButtonPushed(); 420 SDButtonPushed();
428 else if( e->key() == Key_5 ) 421 else if( e->key() == Key_5 )
429 homeButtonPushed(); 422 homeButtonPushed();
430 else if( e->key() == Key_6 ) 423 else if( e->key() == Key_6 )
431 docButtonPushed(); 424 docButtonPushed();
432 else 425 else
433 e->accept(); 426 e->accept();
434} 427}
435 428
436 429
437void AdvancedFm::parsetab(const QString &fileName) { 430void AdvancedFm::parsetab(const QString &fileName) {
438 431
439 fileSystemTypeList.clear(); 432 fileSystemTypeList.clear();
440 fsList.clear(); 433 fsList.clear();
441 struct mntent *me; 434 struct mntent *me;
442 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 435 FILE *mntfp = setmntent( fileName.latin1(), "r" );
443 if ( mntfp ) { 436 if ( mntfp ) {
444 while ( (me = getmntent( mntfp )) != 0 ) { 437 while ( (me = getmntent( mntfp )) != 0 ) {
445 QString deviceName = me->mnt_fsname; 438 QString deviceName = me->mnt_fsname;
446 QString filesystemType = me->mnt_type; 439 QString filesystemType = me->mnt_type;
447 QString mountDir = me->mnt_dir; 440 QString mountDir = me->mnt_dir;
448 if(deviceName != "none") { 441 if(deviceName != "none") {
449 if( fsList.contains(filesystemType) == 0 442 if( fsList.contains(filesystemType) == 0
450 & filesystemType.find("proc",0,TRUE) == -1 443 & filesystemType.find("proc",0,TRUE) == -1
451 & filesystemType.find("cramfs",0,TRUE) == -1 444 & filesystemType.find("cramfs",0,TRUE) == -1
452 & filesystemType.find("auto",0,TRUE) == -1) 445 & filesystemType.find("auto",0,TRUE) == -1)
453 fsList << filesystemType; 446 fsList << filesystemType;
454 fileSystemTypeList << mountDir+"::"+filesystemType; 447 fileSystemTypeList << mountDir+"::"+filesystemType;
455 } 448 }
456 } 449 }
457 } 450 }
458 endmntent( mntfp ); 451 endmntent( mntfp );
459} 452}
460 453
461QString AdvancedFm::getFileSystemType(const QString &currentText) { 454QString AdvancedFm::getFileSystemType(const QString &currentText) {
462 parsetab("/etc/mtab"); //why did TT forget filesystem type? 455 parsetab("/etc/mtab"); //why did TT forget filesystem type?
463 QString current = currentText;//.right( currentText.length()-1); 456 QString current = currentText;//.right( currentText.length()-1);
464 QString baseFs; 457 QString baseFs;
465 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 458 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
466 QString temp = (*it); 459 QString temp = (*it);
467 QString path = temp.left(temp.find("::",0,TRUE) ); 460 QString path = temp.left(temp.find("::",0,TRUE) );
468 path = path.right( path.length()-1); 461 path = path.right( path.length()-1);
469 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 462 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
470 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 463 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
471 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 464 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
472 } 465 }
473 } 466 }
474 return baseFs; 467 return baseFs;
475} 468}
476 469
477QString AdvancedFm::getDiskSpace( const QString &path) { 470QString AdvancedFm::getDiskSpace( const QString &path) {
478 struct statfs fss; 471 struct statfs fss;
479 if ( !statfs( path.latin1(), &fss ) ) { 472 if ( !statfs( path.latin1(), &fss ) ) {
480 int blkSize = fss.f_bsize; 473 int blkSize = fss.f_bsize;
481 // int totalBlks = fs.f_blocks; 474 // int totalBlks = fs.f_blocks;
482 int availBlks = fss.f_bavail; 475 int availBlks = fss.f_bavail;
483 476
484 long mult = blkSize / 1024; 477 long mult = blkSize / 1024;
485 long div = 1024 / blkSize; 478 long div = 1024 / blkSize;
486 if ( !mult ) mult = 1; 479 if ( !mult ) mult = 1;
487 if ( !div ) div = 1; 480 if ( !div ) div = 1;
488 481
489 return QString::number(availBlks * mult / div); 482 return QString::number(availBlks * mult / div);
490 } 483 }
491 return ""; 484 return "";
492} 485}
493 486
494 487
495void AdvancedFm::showFileMenu() { 488void AdvancedFm::showFileMenu() {
496 QString curApp; 489 QString curApp;
497 curApp = CurrentView()->currentItem()->text(0); 490 curApp = CurrentView()->currentItem()->text(0);
498 491
499 MimeType mt(curApp); 492 MimeType mt(curApp);
500 const AppLnk* app = mt.application(); 493 const AppLnk* app = mt.application();
501 QFile fi(curApp); 494 QFile fi(curApp);
502 QPopupMenu *m = new QPopupMenu(0); 495 QPopupMenu *m = new QPopupMenu(0);
503 QPopupMenu *n = new QPopupMenu(0); 496 QPopupMenu *n = new QPopupMenu(0);
504 // QPopupMenu *o = new QPopupMenu(0); 497 // QPopupMenu *o = new QPopupMenu(0);
505 m->insertItem(tr("Show Hidden Files"),this,SLOT(showHidden())); 498 m->insertItem(tr("Show Hidden Files"),this,SLOT(showHidden()));
506 499
507 if ( QFileInfo(fi).isDir()) { 500 if ( QFileInfo(fi).isDir()) {
508 m->insertSeparator(); 501 m->insertSeparator();
509 m->insertItem(tr("Change Directory"),this,SLOT(doDirChange())); 502 m->insertItem(tr("Change Directory"),this,SLOT(doDirChange()));
510 } else { 503 } else {
511 504
512 if (app) 505 if (app)
513 m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis())); 506 m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis()));
514 else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this 507 else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this
515 m->insertItem(tr("Execute"),this,SLOT(runThis())); 508 m->insertItem(tr("Execute"),this,SLOT(runThis()));
516 m->insertItem(Resource::loadPixmap("txt"),tr("Open as text"),this,SLOT(runText())); 509 m->insertItem(Resource::loadPixmap("txt"),tr("Open as text"),this,SLOT(runText()));
517 } 510 }
518 511
519 m->insertItem(tr("Actions"),n); 512 m->insertItem(tr("Actions"),n);
520 n->insertItem(tr("Make Directory"),this,SLOT(makeDir())); 513 n->insertItem(tr("Make Directory"),this,SLOT(makeDir()));
521 514
522 n->insertItem(tr("Make Symlink"),this,SLOT(mkSym())); 515 n->insertItem(tr("Make Symlink"),this,SLOT(mkSym()));
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 00ab909..6f7eb96 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -1,193 +1,192 @@
1/*************************************************************************** 1/***************************************************************************
2 advancedfm.h 2 advancedfm.h
3 ------------------- 3 -------------------
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#ifndef ADVANCEDFM_H 12#ifndef ADVANCEDFM_H
13#define ADVANCEDFM_H 13#define ADVANCEDFM_H
14#define QTOPIA_INTERNAL_FSLP // to get access to fileproperties 14#define QTOPIA_INTERNAL_FSLP // to get access to fileproperties
15#define QT_QWS_OPIE 15#define QT_QWS_OPIE
16 16
17#include <opie2/oprocess.h> 17#include <opie2/oprocess.h>
18#include <opie2/osplitter.h> 18#include <opie2/osplitter.h>
19 19
20#include <qpe/ir.h> 20#include <qpe/ir.h>
21#include <qpe/qcopenvelope_qws.h> 21#include <qpe/qcopenvelope_qws.h>
22 22
23#include <qvariant.h> 23#include <qvariant.h>
24#include <qdialog.h> 24#include <qdialog.h>
25#include <qmainwindow.h> 25#include <qmainwindow.h>
26#include <qstringlist.h> 26#include <qstringlist.h>
27#include <qdir.h> 27#include <qdir.h>
28#include <qstring.h> 28#include <qstring.h>
29#include <qpoint.h> 29#include <qpoint.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qpixmap.h> 31#include <qpixmap.h>
32 32
33 33
34class QVBoxLayout; 34class QVBoxLayout;
35class QHBoxLayout; 35class QHBoxLayout;
36class QGridLayout; 36class QGridLayout;
37class QComboBox; 37class QComboBox;
38class QListView; 38class QListView;
39class QListviewItem; 39class QListviewItem;
40class QLabel; 40class QLabel;
41class QProgressBar; 41class QProgressBar;
42class QSpinBox; 42class QSpinBox;
43class QWidget; 43class QWidget;
44class QPopupMenu; 44class QPopupMenu;
45class QFile; 45class QFile;
46class QListViewItem; 46class QListViewItem;
47class QLineEdit; 47class QLineEdit;
48class MenuButton; 48class MenuButton;
49 49
50class QToolButton; 50class QToolButton;
51class Ir; 51class Ir;
52 52
53class AdvancedFm : public QMainWindow 53class AdvancedFm : public QMainWindow
54{ 54{
55 Q_OBJECT 55 Q_OBJECT
56public: 56public:
57 static QString appName() { return QString::fromLatin1("advancedfm"); } 57 static QString appName() { return QString::fromLatin1("advancedfm"); }
58 AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0); 58 AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0);
59 ~AdvancedFm(); 59 ~AdvancedFm();
60protected: 60protected:
61 61
62 Opie::Ui::OSplitter *TabWidget; 62 Opie::Ui::OSplitter *TabWidget;
63 QCopChannel * channel; 63 QCopChannel * channel;
64 QPixmap unknownXpm; 64 QPixmap unknownXpm;
65 int whichTab; 65 int whichTab;
66// QTabWidget *TabWidget; 66// QTabWidget *TabWidget;
67 QWidget *tab, *tab_2, *tab_3; 67 QWidget *tab, *tab_2, *tab_3;
68 QListView *Local_View, *Remote_View; 68 QListView *Local_View, *Remote_View;
69 69
70 QLineEdit *currentPathEdit; 70 QLineEdit *currentPathEdit;
71 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; 71 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/;
72 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 72 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
73// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 73// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
74 QDir currentDir, currentRemoteDir; 74 QDir currentDir, currentRemoteDir;
75 QComboBox *currentPathCombo; 75 QComboBox *currentPathCombo;
76 QString filterStr, s_addBookmark, s_removeBookmark; 76 QString filterStr, s_addBookmark, s_removeBookmark;
77 QListViewItem * item; 77 QListViewItem * item;
78 bool b; 78 bool b;
79 QStringList fileSystemTypeList, fsList; 79 QStringList fileSystemTypeList, fsList;
80 int currentServerConfig; 80 int currentServerConfig;
81 bool zaurusDevice; 81 bool zaurusDevice;
82 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 82 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
83 QStringList remoteDirPathStringList, localDirPathStringList; 83 QStringList remoteDirPathStringList, localDirPathStringList;
84 QLineEdit *renameBox; 84 QLineEdit *renameBox;
85 85
86 void init(); 86 void init();
87 void initConnections(); 87 void initConnections();
88 void keyReleaseEvent( QKeyEvent *); 88 void keyReleaseEvent( QKeyEvent *);
89 void keyPressEvent( QKeyEvent *); 89 void keyPressEvent( QKeyEvent *);
90 QString getFileSystemType(const QString &); 90 QString getFileSystemType(const QString &);
91 QString getDiskSpace(const QString &); 91 QString getDiskSpace(const QString &);
92 void parsetab(const QString &fileName); 92 void parsetab(const QString &fileName);
93 QString checkDiskSpace(const QString &); 93 QString checkDiskSpace(const QString &);
94 QString dealWithSymName(const QString &); 94 QString dealWithSymName(const QString &);
95 QDir *CurrentDir(); 95 QDir *CurrentDir();
96 QDir *OtherDir(); 96 QDir *OtherDir();
97 QListView *CurrentView(); 97 QListView *CurrentView();
98 QListView *OtherView(); 98 QListView *OtherView();
99 void setOtherTabCurrent(); 99 void setOtherTabCurrent();
100 void changeTo(const QString dir); 100 void changeTo(const QString dir);
101 101
102//protected signals: 102//protected signals:
103 // void newPath(QString); 103 // void newPath(QString);
104 104
105protected slots: 105protected slots:
106 void slotSwitchMenu(int); 106 void slotSwitchMenu(int);
107 void selectAll(); 107 void selectAll();
108 void addToDocs(); 108 void addToDocs();
109 void doDirChange(); 109 void doDirChange();
110 void mkDir(); 110 void mkDir();
111 void del(); 111 void del();
112 void rn(); 112 void rn();
113 void populateView(); 113 void populateView();
114 void rePopulate(); 114 void rePopulate();
115 void showHidden(); 115 void showHidden();
116 void showMenuHidden(); 116 void showMenuHidden();
117 void ListClicked(QListViewItem *); 117 void ListClicked(QListViewItem *);
118 void ListPressed( int, QListViewItem *, const QPoint&, int); 118 void ListPressed( int, QListViewItem *, const QPoint&, int);
119 void makeDir(); 119 void makeDir();
120 void doDelete(); 120 void doDelete();
121 void tabChanged(QWidget*); 121 void tabChanged(QWidget*);
122 void cleanUp(); 122 void cleanUp();
123 void renameIt(); 123 void renameIt();
124 void runThis(); 124 void runThis();
125 void runText(); 125 void runText();
126 void filePerms(); 126 void filePerms();
127 void doProperties(); 127 void doProperties();
128 void runCommand(); 128 void runCommand();
129 void runCommandStd(); 129 void runCommandStd();
130 QStringList getPath(); 130 QStringList getPath();
131 void mkSym(); 131 void mkSym();
132 void switchToLocalTab(); 132 void switchToLocalTab();
133 void switchToRemoteTab(); 133 void switchToRemoteTab();
134 void refreshCurrentTab(); 134 void refreshCurrentTab();
135 135
136 void openSearch(); 136 void openSearch();
137 void dirMenuSelected(int); 137 void dirMenuSelected(int);
138 void showFileMenu(); 138 void showFileMenu();
139 void homeButtonPushed(); 139 void homeButtonPushed();
140 void docButtonPushed(); 140 void docButtonPushed();
141 void SDButtonPushed(); 141 void SDButtonPushed();
142 void CFButtonPushed(); 142 void CFButtonPushed();
143 void QPEButtonPushed(); 143 void QPEButtonPushed();
144 void upDir(); 144 void upDir();
145 void currentPathComboChanged(); 145 void currentPathComboChanged();
146 146
147 void copy(); 147 void copy();
148 void copyTimer(); 148 void copyTimer();
149 void copyAs(); 149 void copyAs();
150 void copyAsTimer(); 150 void copyAsTimer();
151 void copySameDir(); 151 void copySameDir();
152 void copySameDirTimer(); 152 void copySameDirTimer();
153 void move(); 153 void move();
154 void moveTimer(); 154 void moveTimer();
155 155
156 void currentPathComboActivated(const QString &);
157 void fillCombo(const QString &); 156 void fillCombo(const QString &);
158 bool copyFile( const QString & , const QString & ); 157 bool copyFile( const QString & , const QString & );
159 void fileStatus(); 158 void fileStatus();
160 void doAbout(); 159 void doAbout();
161 void doBeam(); 160 void doBeam();
162 void fileBeamFinished( Ir *); 161 void fileBeamFinished( Ir *);
163 bool copyDirectory( const QString & , const QString & ); 162 bool copyDirectory( const QString & , const QString & );
164// void navigateToSelected(); 163// void navigateToSelected();
165 bool moveDirectory( const QString & , const QString & ); 164 bool moveDirectory( const QString & , const QString & );
166 165
167// void slotSwitchtoLocal(int); 166// void slotSwitchtoLocal(int);
168 167
169private: 168private:
170 MenuButton *menuButton; 169 MenuButton *menuButton;
171 QString oldName, localViewDir, remoteViewDir; 170 QString oldName, localViewDir, remoteViewDir;
172 void startProcess(const QString &); 171 void startProcess(const QString &);
173 bool eventFilter( QObject * , QEvent * ); 172 bool eventFilter( QObject * , QEvent * );
174 void cancelRename(); 173 void cancelRename();
175 void doRename(QListView *); 174 void doRename(QListView *);
176 void okRename(); 175 void okRename();
177 void customDirsToMenu(); 176 void customDirsToMenu();
178 void addCustomDir(); 177 void addCustomDir();
179 void removeCustomDir(); 178 void removeCustomDir();
180 void navigateToSelected(); 179 void navigateToSelected();
181 void findFile(const QString &); 180 void findFile(const QString &);
182 181
183private slots: 182private slots:
184 void processEnded(Opie::Core::OProcess *); 183 void processEnded(Opie::Core::OProcess *);
185 void oprocessStderr(Opie::Core::OProcess *, char *, int); 184 void oprocessStderr(Opie::Core::OProcess *, char *, int);
186 void gotoCustomDir(const QString &); 185 void gotoCustomDir(const QString &);
187 void qcopReceive(const QCString&, const QByteArray&); 186 void qcopReceive(const QCString&, const QByteArray&);
188 void setDocument(const QString &); 187 void setDocument(const QString &);
189 // void doMenu(int 188 // void doMenu(int
190 189
191}; 190};
192 191
193#endif // ADVANCEDFM_H 192#endif // ADVANCEDFM_H
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index fe565a0..1047c5a 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -66,215 +66,215 @@ void AdvancedFm::init() {
66 cfButton = new QToolButton( 0, "CFButton"); 66 cfButton = new QToolButton( 0, "CFButton");
67 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); 67 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
68 cfButton->setAutoRaise( true ); 68 cfButton->setAutoRaise( true );
69 menuBar->insertItem( cfButton ); 69 menuBar->insertItem( cfButton );
70 70
71 sdButton = new QToolButton( 0, "SDButton"); 71 sdButton = new QToolButton( 0, "SDButton");
72 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); 72 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard"));
73 sdButton->setAutoRaise( true ); 73 sdButton->setAutoRaise( true );
74 menuBar->insertItem( sdButton ); 74 menuBar->insertItem( sdButton );
75 75
76 docButton = new QToolButton( 0,"docsButton"); 76 docButton = new QToolButton( 0,"docsButton");
77 docButton->setPixmap(Resource::loadPixmap("DocsIcon")); 77 docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
78 docButton->setAutoRaise( true ); 78 docButton->setAutoRaise( true );
79 menuBar->insertItem( docButton ); 79 menuBar->insertItem( docButton );
80 80
81 homeButton = new QToolButton( 0, "homeButton"); 81 homeButton = new QToolButton( 0, "homeButton");
82 homeButton->setPixmap(Resource::loadPixmap("home")); 82 homeButton->setPixmap(Resource::loadPixmap("home"));
83 homeButton->setAutoRaise( true ); 83 homeButton->setAutoRaise( true );
84 menuBar->insertItem( homeButton ); 84 menuBar->insertItem( homeButton );
85 85
86 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); 86 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
87 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 87 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
88 fileMenu->insertSeparator(); 88 fileMenu->insertSeparator();
89 fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); 89 fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() ));
90 fileMenu->insertSeparator(); 90 fileMenu->insertSeparator();
91 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 91 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
92 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); 92 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
93 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 93 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
94 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 94 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
95 fileMenu->insertSeparator(); 95 fileMenu->insertSeparator();
96 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 96 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
97 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); 97 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() ));
98 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); 98 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
99 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); 99 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
100 fileMenu->setCheckable(TRUE); 100 fileMenu->setCheckable(TRUE);
101 101
102 viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); 102 viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab()));
103 viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); 103 viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab()));
104 viewMenu->insertItem( tr( "Refresh" ), this, SLOT( refreshCurrentTab())); 104 viewMenu->insertItem( tr( "Refresh" ), this, SLOT( refreshCurrentTab()));
105// viewMenu->insertSeparator(); 105// viewMenu->insertSeparator();
106// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 106// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
107 viewMenu->setCheckable(true); 107 viewMenu->setCheckable(true);
108 viewMenu->setItemChecked( viewMenu->idAt(0), true); 108 viewMenu->setItemChecked( viewMenu->idAt(0), true);
109 viewMenu->setItemChecked( viewMenu->idAt(1), false); 109 viewMenu->setItemChecked( viewMenu->idAt(1), false);
110 110
111 s_addBookmark = tr("Bookmark Directory"); 111 s_addBookmark = tr("Bookmark Directory");
112 s_removeBookmark = tr("Remove Current Directory from Bookmarks"); 112 s_removeBookmark = tr("Remove Current Directory from Bookmarks");
113 113
114// menuButton->insertItem(""); 114// menuButton->insertItem("");
115 115
116// customDirMenu->insertItem(tr("Add This Directory")); 116// customDirMenu->insertItem(tr("Add This Directory"));
117// customDirMenu->insertItem(tr("Remove This Directory")); 117// customDirMenu->insertItem(tr("Remove This Directory"));
118// customDirMenu->insertSeparator(); 118// customDirMenu->insertSeparator();
119 119
120 QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later 120 QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later
121 CBHB->setMargin( 0 ); 121 CBHB->setMargin( 0 );
122 CBHB->setSpacing( 1 ); 122 CBHB->setSpacing( 1 );
123 123
124 menuButton = new MenuButton( this ); 124 menuButton = new MenuButton( this );
125 125
126 menuButton->setUseLabel(false); 126 menuButton->setUseLabel(false);
127 menuButton->setMaximumWidth( 20 ); 127 menuButton->setMaximumWidth( 20 );
128 menuButton->insertItem( s_addBookmark); 128 menuButton->insertItem( s_addBookmark);
129 menuButton->insertItem( s_removeBookmark); 129 menuButton->insertItem( s_removeBookmark);
130 menuButton->insertSeparator(); 130 menuButton->insertSeparator();
131// menuButton->setFocusPolicy(NoFocus); 131// menuButton->setFocusPolicy(NoFocus);
132 CBHB->addWidget( menuButton ); 132 CBHB->addWidget( menuButton );
133 133
134 customDirsToMenu(); 134 customDirsToMenu();
135 135
136 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 136 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
137 currentPathCombo->setEditable(TRUE); 137 currentPathCombo->setEditable(TRUE);
138 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 138 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
139 // currentPathCombo->setFocusPolicy(NoFocus); 139 // currentPathCombo->setFocusPolicy(NoFocus);
140 CBHB->addWidget( currentPathCombo ); 140 CBHB->addWidget( currentPathCombo );
141 141
142 layout->addLayout( CBHB ); 142 layout->addLayout( CBHB );
143 143
144 TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); 144 TabWidget = new OSplitter( Horizontal, this, "TabWidget" );
145// TabWidget = new QTabWidget( this, "TabWidget" ); 145// TabWidget = new QTabWidget( this, "TabWidget" );
146 layout->addWidget( TabWidget, 4 ); 146 layout->addWidget( TabWidget, 4 );
147 147
148 tab = new QWidget( TabWidget, "tab" ); 148 tab = new QWidget( TabWidget, "tab" );
149 tabLayout = new QGridLayout( tab ); 149 tabLayout = new QGridLayout( tab );
150 tabLayout->setSpacing( 2); 150 tabLayout->setSpacing( 2);
151 tabLayout->setMargin( 2); 151 tabLayout->setMargin( 2);
152 152
153 Local_View = new QListView( tab, "Local_View" ); 153 Local_View = new QListView( tab, "Local_View" );
154 Local_View->addColumn( tr("File"),130); 154 Local_View->addColumn( tr("File"),130);
155 Local_View->addColumn( tr("Size"),-1); 155 Local_View->addColumn( tr("Size"),-1);
156 Local_View->setColumnAlignment(1,QListView::AlignRight); 156 Local_View->setColumnAlignment(1,QListView::AlignRight);
157 Local_View->addColumn( tr("Date"),-1); 157 Local_View->addColumn( tr("Date"),-1);
158 Local_View->setColumnAlignment(2,QListView::AlignRight); 158 Local_View->setColumnAlignment(2,QListView::AlignRight);
159 Local_View->setAllColumnsShowFocus(TRUE); 159 Local_View->setAllColumnsShowFocus(TRUE);
160 Local_View->setMultiSelection( TRUE ); 160 Local_View->setMultiSelection( TRUE );
161 Local_View->setSelectionMode(QListView::Extended); 161 Local_View->setSelectionMode(QListView::Extended);
162 Local_View->setFocusPolicy(StrongFocus); 162 Local_View->setFocusPolicy(StrongFocus);
163 Local_View->installEventFilter( this ); 163 Local_View->installEventFilter( this );
164 164
165 QPEApplication::setStylusOperation( Local_View->viewport() , QPEApplication::RightOnHold); 165 QPEApplication::setStylusOperation( Local_View->viewport() , QPEApplication::RightOnHold);
166 166
167 tabLayout->addWidget( Local_View, 0, 0 ); 167 tabLayout->addWidget( Local_View, 0, 0 );
168 168
169 TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); 169 TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1"));
170// TabWidget->insertTab( tab, tr("1")); 170// TabWidget->insertTab( tab, tr("1"));
171 171
172 tab_2 = new QWidget( TabWidget, "tab_2" ); 172 tab_2 = new QWidget( TabWidget, "tab_2" );
173 tabLayout_2 = new QGridLayout( tab_2 ); 173 tabLayout_2 = new QGridLayout( tab_2 );
174 tabLayout_2->setSpacing( 2); 174 tabLayout_2->setSpacing( 2);
175 tabLayout_2->setMargin( 2); 175 tabLayout_2->setMargin( 2);
176 176
177 Remote_View = new QListView( tab_2, "Remote_View" ); 177 Remote_View = new QListView( tab_2, "Remote_View" );
178 Remote_View->addColumn( tr("File"),130); 178 Remote_View->addColumn( tr("File"),130);
179 Remote_View->addColumn( tr("Size"),-1); 179 Remote_View->addColumn( tr("Size"),-1);
180 Remote_View->setColumnAlignment(1,QListView::AlignRight); 180 Remote_View->setColumnAlignment(1,QListView::AlignRight);
181 Remote_View->addColumn( tr("Date"),-1); 181 Remote_View->addColumn( tr("Date"),-1);
182 Remote_View->setColumnAlignment(2,QListView::AlignRight); 182 Remote_View->setColumnAlignment(2,QListView::AlignRight);
183 Remote_View->setAllColumnsShowFocus(TRUE); 183 Remote_View->setAllColumnsShowFocus(TRUE);
184 Remote_View->setMultiSelection( TRUE ); 184 Remote_View->setMultiSelection( TRUE );
185 Remote_View->setSelectionMode(QListView::Extended); 185 Remote_View->setSelectionMode(QListView::Extended);
186 Remote_View->setFocusPolicy(StrongFocus); 186 Remote_View->setFocusPolicy(StrongFocus);
187 Remote_View->installEventFilter( this ); 187 Remote_View->installEventFilter( this );
188 188
189 QPEApplication::setStylusOperation( Remote_View->viewport(), QPEApplication::RightOnHold); 189 QPEApplication::setStylusOperation( Remote_View->viewport(), QPEApplication::RightOnHold);
190 190
191 tabLayout_2->addWidget( Remote_View, 0, 0 ); 191 tabLayout_2->addWidget( Remote_View, 0, 0 );
192 192
193 TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); 193 TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2"));
194 TabWidget->setSizeChange( 370 ); 194 TabWidget->setSizeChange( 370 );
195// TabWidget->insertTab( tab_2, tr( "2")); 195// TabWidget->insertTab( tab_2, tr( "2"));
196 196
197 /* tab_3 = new QWidget( TabWidget, "tab_3" ); 197 /* tab_3 = new QWidget( TabWidget, "tab_3" );
198 tabLayout_3 = new QGridLayout( tab_3 ); 198 tabLayout_3 = new QGridLayout( tab_3 );
199 tabLayout_3->setSpacing( 2); 199 tabLayout_3->setSpacing( 2);
200 tabLayout_3->setMargin( 2); 200 tabLayout_3->setMargin( 2);
201 201
202 202
203 // OFileDialog fileDialog; 203 // OFileDialog fileDialog;
204 // fileDialog; 204 // fileDialog;
205 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy 205 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy
206 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); 206 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow");
207 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); 207 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/");
208 208
209 QListView *fileTree; 209 QListView *fileTree;
210 fileTree = new QListView( tab_3, "tree" ); 210 fileTree = new QListView( tab_3, "tree" );
211 211
212 212
213 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); 213 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
214 214
215 TabWidget->insertTab( tab_3, tr( "Remote" ) ); 215 TabWidget->insertTab( tab_3, tr( "Remote" ) );
216 */ 216 */
217 217
218 /////////////// 218 ///////////////
219 219
220 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) 220 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
221 zaurusDevice=TRUE; 221 zaurusDevice=TRUE;
222 else 222 else
223 zaurusDevice=FALSE; 223 zaurusDevice=FALSE;
224 224
225 225
226 if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { 226 if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) {
227 odebug << "not have sd" << oendl; 227 odebug << "not have sd" << oendl;
228 sdButton->hide(); 228 sdButton->hide();
229 } 229 }
230 if( !StorageInfo::hasCf() ) { 230 if( !StorageInfo::hasCf() ) {
231 odebug << "not have cf" << oendl; 231 odebug << "not have cf" << oendl;
232 cfButton->hide(); 232 cfButton->hide();
233 } 233 }
234 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 234 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
235 currentDir.setPath( QDir::currentDirPath()); 235 currentDir.setPath( QDir::currentDirPath());
236 236
237 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 237 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
238 currentRemoteDir.setPath( QDir::currentDirPath()); 238 currentRemoteDir.setPath( QDir::currentDirPath());
239 239
240 // b = TRUE; 240 // b = TRUE;
241 241
242 filterStr="*"; 242 filterStr="*";
243 showMenuHidden(); 243 showMenuHidden();
244 TabWidget->setCurrentWidget(0); 244 TabWidget->setCurrentWidget(0);
245 245
246} 246}
247 247
248void AdvancedFm::initConnections() 248void AdvancedFm::initConnections()
249{ 249{
250 250
251 connect(qApp,SIGNAL(aboutToQuit()),this,SLOT(cleanUp())); 251 connect(qApp,SIGNAL(aboutToQuit()),this,SLOT(cleanUp()));
252 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); 252 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) );
253 connect( cfButton ,SIGNAL(released()), this,SLOT( CFButtonPushed()) ); 253 connect( cfButton ,SIGNAL(released()), this,SLOT( CFButtonPushed()) );
254 connect( sdButton ,SIGNAL(released()), this,SLOT( SDButtonPushed()) ); 254 connect( sdButton ,SIGNAL(released()), this,SLOT( SDButtonPushed()) );
255 connect( cdUpButton ,SIGNAL(released()), this,SLOT( upDir()) ); 255 connect( cdUpButton ,SIGNAL(released()), this,SLOT( upDir()) );
256 connect( docButton,SIGNAL(released()), this,SLOT( docButtonPushed()) ); 256 connect( docButton,SIGNAL(released()), this,SLOT( docButtonPushed()) );
257 connect( homeButton,SIGNAL(released()), this,SLOT( homeButtonPushed()) ); 257 connect( homeButton,SIGNAL(released()), this,SLOT( homeButtonPushed()) );
258 connect( currentPathCombo, SIGNAL( activated(const QString&) ), this, SLOT( currentPathComboActivated(const QString&) ) ); 258 connect( currentPathCombo, SIGNAL( activated(const QString&) ), this, SLOT( changeTo(const QString&) ) );
259 259
260 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), this,SLOT(currentPathComboChanged())); 260 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), this,SLOT(currentPathComboChanged()));
261 261
262 connect( Local_View, SIGNAL( clicked(QListViewItem*)), this,SLOT( ListClicked(QListViewItem*)) ); 262 connect( Local_View, SIGNAL( clicked(QListViewItem*)), this,SLOT( ListClicked(QListViewItem*)) );
263 263
264 connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); 264 connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) );
265 265
266 connect( Remote_View, SIGNAL( clicked(QListViewItem*)), this,SLOT( ListClicked(QListViewItem*)) ); 266 connect( Remote_View, SIGNAL( clicked(QListViewItem*)), this,SLOT( ListClicked(QListViewItem*)) );
267 connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); 267 connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) );
268 268
269 connect( TabWidget,SIGNAL(currentChanged(QWidget*)), this,SLOT(tabChanged(QWidget*))); 269 connect( TabWidget,SIGNAL(currentChanged(QWidget*)), this,SLOT(tabChanged(QWidget*)));
270 270
271 connect( Remote_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&, int)), this, SLOT(showFileMenu())); 271 connect( Remote_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&, int)), this, SLOT(showFileMenu()));
272 connect( Local_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&,int)), this, SLOT(showFileMenu())); 272 connect( Local_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&,int)), this, SLOT(showFileMenu()));
273 273
274 connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&))); 274 connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&)));
275// connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int))); 275// connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int)));
276 connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int))); 276 connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int)));
277// connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); 277// connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int)));
278 278
279} 279}
280 280
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 706658e..7b3dcf6 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -1,527 +1,521 @@
1/*************************************************************************** 1/***************************************************************************
2 AdvancedFm.cpp 2 AdvancedFm.cpp
3 ------------------- 3 -------------------
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12 12
13#include "advancedfm.h" 13#include "advancedfm.h"
14#include "output.h" 14#include "output.h"
15#include "filePermissions.h" 15#include "filePermissions.h"
16 16
17/* OPIE */ 17/* OPIE */
18#include <opie2/odebug.h> 18#include <opie2/odebug.h>
19#include <qpe/lnkproperties.h> 19#include <qpe/lnkproperties.h>
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/applnk.h> 21#include <qpe/applnk.h>
22using namespace Opie::Core; 22using namespace Opie::Core;
23 23
24/* QT*/ 24/* QT*/
25 25
26#include <qmessagebox.h> 26#include <qmessagebox.h>
27#include <qpopupmenu.h> 27#include <qpopupmenu.h>
28#include <qlistview.h> 28#include <qlistview.h>
29 29
30/* STD */ 30/* STD */
31 31
32#include <errno.h> 32#include <errno.h>
33#include <stdlib.h> 33#include <stdlib.h>
34#include <unistd.h> 34#include <unistd.h>
35#include <sys/stat.h> 35#include <sys/stat.h>
36#include <dirent.h> 36#include <dirent.h>
37#include <sys/sendfile.h> 37#include <sys/sendfile.h>
38#include <fcntl.h> 38#include <fcntl.h>
39 39
40void AdvancedFm::doDirChange() { 40void AdvancedFm::doDirChange() {
41 QString pathItem = CurrentView()->currentItem()->text(0); 41 QString pathItem = CurrentView()->currentItem()->text(0);
42 if( pathItem == "../") { 42 if( pathItem == "../") {
43 ListClicked( CurrentView()->currentItem()); 43 ListClicked( CurrentView()->currentItem());
44 } else { 44 } else {
45 if( pathItem.find(" -> ",0,TRUE) != -1) 45 if( pathItem.find(" -> ",0,TRUE) != -1)
46 pathItem = dealWithSymName((const QString&)pathItem)+"/"; 46 pathItem = dealWithSymName((const QString&)pathItem)+"/";
47// owarn << pathItem << oendl; 47// owarn << pathItem << oendl;
48 changeTo( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); 48 changeTo( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) );
49 } 49 }
50} 50}
51 51
52void AdvancedFm::showMenuHidden() { 52void AdvancedFm::showMenuHidden() {
53 if (b) { 53 if (b) {
54 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 54 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
55 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 55 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
56 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 56 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
57 } else { 57 } else {
58 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 58 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
59 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 59 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
60 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 60 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
61 } 61 }
62 b = !b; 62 b = !b;
63 populateView(); 63 populateView();
64} 64}
65 65
66void AdvancedFm::showHidden() { 66void AdvancedFm::showHidden() {
67 if (b) { 67 if (b) {
68 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 68 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
69 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 69 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
70 } else { 70 } else {
71 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 71 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
72 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 72 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
73 } 73 }
74 populateView(); 74 populateView();
75} 75}
76 76
77QString AdvancedFm::dealWithSymName(const QString &fileName) { 77QString AdvancedFm::dealWithSymName(const QString &fileName) {
78 QString strItem = fileName; 78 QString strItem = fileName;
79 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 79 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
80} 80}
81 81
82void AdvancedFm::runThis() { 82void AdvancedFm::runThis() {
83 if( !CurrentView()->currentItem()) return; 83 if( !CurrentView()->currentItem()) return;
84 QString fs; 84 QString fs;
85 QDir *thisDir = CurrentDir(); 85 QDir *thisDir = CurrentDir();
86 86
87 QString curFile = CurrentView()->currentItem()->text(0); 87 QString curFile = CurrentView()->currentItem()->text(0);
88 QString path = thisDir->canonicalPath(); 88 QString path = thisDir->canonicalPath();
89 89
90 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink 90 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
91 91
92 curFile = dealWithSymName((const QString&)curFile); 92 curFile = dealWithSymName((const QString&)curFile);
93 93
94 if(curFile != "../") { 94 if(curFile != "../") {
95 95
96 fs = getFileSystemType((const QString &) path); 96 fs = getFileSystemType((const QString &) path);
97 QFileInfo fileInfo( path + "/" + curFile); 97 QFileInfo fileInfo( path + "/" + curFile);
98// odebug << fileInfo.owner() << oendl; 98// odebug << fileInfo.owner() << oendl;
99 99
100 if( (fileInfo.permission( QFileInfo::ExeUser) 100 if( (fileInfo.permission( QFileInfo::ExeUser)
101 | fileInfo.permission( QFileInfo::ExeGroup) 101 | fileInfo.permission( QFileInfo::ExeGroup)
102 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 102 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
103 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 103 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
104 QCopEnvelope e("QPE/System", "execute(QString)" ); 104 QCopEnvelope e("QPE/System", "execute(QString)" );
105 e << curFile; 105 e << curFile;
106 } else { 106 } else {
107 curFile = path + "/" + curFile; 107 curFile = path + "/" + curFile;
108 DocLnk nf(curFile); 108 DocLnk nf(curFile);
109 QString execStr = nf.exec(); 109 QString execStr = nf.exec();
110// odebug << execStr << oendl; 110// odebug << execStr << oendl;
111 if( execStr.isEmpty() ) { 111 if( execStr.isEmpty() ) {
112 } else { 112 } else {
113 nf.execute(); 113 nf.execute();
114 } 114 }
115 } 115 }
116 } 116 }
117} 117}
118 118
119void AdvancedFm::runText() { 119void AdvancedFm::runText() {
120 if( !CurrentView()->currentItem()) return; 120 if( !CurrentView()->currentItem()) return;
121 QString curFile = CurrentView()->currentItem()->text(0); 121 QString curFile = CurrentView()->currentItem()->text(0);
122 if(curFile != "../") { 122 if(curFile != "../") {
123 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink 123 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
124 curFile = dealWithSymName((const QString&)curFile); 124 curFile = dealWithSymName((const QString&)curFile);
125 curFile = CurrentDir()->canonicalPath()+"/"+curFile; 125 curFile = CurrentDir()->canonicalPath()+"/"+curFile;
126 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 126 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
127 e << curFile; 127 e << curFile;
128 } 128 }
129} 129}
130 130
131void AdvancedFm::makeDir() { 131void AdvancedFm::makeDir() {
132 InputDialog *fileDlg; 132 InputDialog *fileDlg;
133 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 133 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
134 fileDlg->exec(); 134 fileDlg->exec();
135 if( fileDlg->result() == 1 ) { 135 if( fileDlg->result() == 1 ) {
136 QDir *thisDir = CurrentDir(); 136 QDir *thisDir = CurrentDir();
137 QString filename = fileDlg->LineEdit1->text(); 137 QString filename = fileDlg->LineEdit1->text();
138 thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); 138 thisDir->mkdir( thisDir->canonicalPath()+"/"+filename);
139 } 139 }
140 populateView(); 140 populateView();
141} 141}
142 142
143void AdvancedFm::doDelete() { 143void AdvancedFm::doDelete() {
144 QStringList curFileList = getPath(); 144 QStringList curFileList = getPath();
145 bool doMsg=true; 145 bool doMsg=true;
146 int count = curFileList.count(); 146 int count = curFileList.count();
147 if( count > 0) { 147 if( count > 0) {
148 if(count > 1 ) { 148 if(count > 1 ) {
149 QString msg; 149 QString msg;
150 msg=tr("<p>Really delete %1 files?</p>").arg(count); 150 msg=tr("<p>Really delete %1 files?</p>").arg(count);
151 switch ( QMessageBox::warning(this,tr("Delete"),msg 151 switch ( QMessageBox::warning(this,tr("Delete"),msg
152 ,tr("Yes"),tr("No"),0,0,1) ) 152 ,tr("Yes"),tr("No"),0,0,1) )
153 { 153 {
154 case 0: 154 case 0:
155 doMsg=false; 155 doMsg=false;
156 break; 156 break;
157 case 1: 157 case 1:
158 return; 158 return;
159 break; 159 break;
160 }; 160 };
161 } 161 }
162 162
163 QString myFile; 163 QString myFile;
164 164
165 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 165 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
166 myFile = (*it); 166 myFile = (*it);
167 if( myFile.find(" -> ",0,TRUE) != -1) 167 if( myFile.find(" -> ",0,TRUE) != -1)
168 myFile = myFile.left( myFile.find(" -> ",0,TRUE)); 168 myFile = myFile.left( myFile.find(" -> ",0,TRUE));
169 169
170 QString f = CurrentDir()->canonicalPath(); 170 QString f = CurrentDir()->canonicalPath();
171 if(f.right(1).find("/",0,TRUE) == -1) 171 if(f.right(1).find("/",0,TRUE) == -1)
172 f += "/"; 172 f += "/";
173 f += myFile; 173 f += myFile;
174 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 174 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
175 //if file is a directory 175 //if file is a directory
176 176
177 switch ( QMessageBox::warning( this, tr("Delete Directory?"), 177 switch ( QMessageBox::warning( this, tr("Delete Directory?"),
178 tr("<p>Really delete %1 and all it's contents?</p>" ).arg( f ) , 178 tr("<p>Really delete %1 and all it's contents?</p>" ).arg( f ) ,
179 tr("Yes"), tr("No"), 0, 0, 1) ) { 179 tr("Yes"), tr("No"), 0, 0, 1) ) {
180 case 0: 180 case 0:
181 { 181 {
182 f=f.left(f.length()-1); 182 f=f.left(f.length()-1);
183 QString cmd="rm -rf "+f; 183 QString cmd="rm -rf "+f;
184 startProcess( (const QString)cmd.latin1() ); 184 startProcess( (const QString)cmd.latin1() );
185 populateView(); 185 populateView();
186 } 186 }
187 break; 187 break;
188 case 1: 188 case 1:
189 // exit 189 // exit
190 break; 190 break;
191 }; 191 };
192 192
193 } else { 193 } else {
194 if(doMsg) { 194 if(doMsg) {
195 switch ( QMessageBox::warning(this,tr("Delete"), 195 switch ( QMessageBox::warning(this,tr("Delete"),
196 tr("<p>Really delete %1?</p>").arg( myFile ), 196 tr("<p>Really delete %1?</p>").arg( myFile ),
197 tr("Yes"), tr("No"), 0, 0, 1) ) { 197 tr("Yes"), tr("No"), 0, 0, 1) ) {
198 case 1: 198 case 1:
199 return; 199 return;
200 break; 200 break;
201 }; 201 };
202 } 202 }
203 203
204 QString cmd="rm "+f; 204 QString cmd="rm "+f;
205 QFile file(f); 205 QFile file(f);
206 QFileInfo fi(myFile); 206 QFileInfo fi(myFile);
207 if( fi.fileName().find("../",0,TRUE)==-1) { 207 if( fi.fileName().find("../",0,TRUE)==-1) {
208// odebug << "remove link files "+myFile << oendl; 208// odebug << "remove link files "+myFile << oendl;
209 209
210// DocLnk lnk(f); 210// DocLnk lnk(f);
211 DocLnk *lnk; 211 DocLnk *lnk;
212 lnk = new DocLnk(f); 212 lnk = new DocLnk(f);
213// odebug << "Deleting doclnk " + lnk->linkFile() << oendl; 213// odebug << "Deleting doclnk " + lnk->linkFile() << oendl;
214 if(lnk->isValid()) 214 if(lnk->isValid())
215 lnk->removeLinkFile(); 215 lnk->removeLinkFile();
216 // delete lnk; 216 // delete lnk;
217 file.remove(); 217 file.remove();
218 } 218 }
219 } 219 }
220 } 220 }
221 } 221 }
222 populateView(); 222 populateView();
223} 223}
224 224
225void AdvancedFm::filePerms() { 225void AdvancedFm::filePerms() {
226 QStringList curFileList = getPath(); 226 QStringList curFileList = getPath();
227 QString filePath; 227 QString filePath;
228 228
229 filePath = CurrentDir()->canonicalPath()+"/"; 229 filePath = CurrentDir()->canonicalPath()+"/";
230 230
231 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 231 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
232 filePermissions *filePerm; 232 filePermissions *filePerm;
233 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 233 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
234 QPEApplication::execDialog( filePerm ); 234 QPEApplication::execDialog( filePerm );
235 if( filePerm ) 235 if( filePerm )
236 delete filePerm; 236 delete filePerm;
237 } 237 }
238 populateView(); 238 populateView();
239} 239}
240 240
241void AdvancedFm::doProperties() { 241void AdvancedFm::doProperties() {
242#if defined(QT_QWS_OPIE) 242#if defined(QT_QWS_OPIE)
243 243
244 QStringList curFileList = getPath(); 244 QStringList curFileList = getPath();
245 245
246 QString filePath; 246 QString filePath;
247 filePath = CurrentDir()->canonicalPath()+"/"; 247 filePath = CurrentDir()->canonicalPath()+"/";
248 248
249// odebug << "" << curFileList.count() << "" << oendl; 249// odebug << "" << curFileList.count() << "" << oendl;
250 250
251 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 251 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
252// odebug << (filePath+*it) << oendl; 252// odebug << (filePath+*it) << oendl;
253 DocLnk lnk( (filePath+*it)); 253 DocLnk lnk( (filePath+*it));
254 LnkProperties prop( &lnk ); 254 LnkProperties prop( &lnk );
255 QPEApplication::execDialog( &prop ); 255 QPEApplication::execDialog( &prop );
256 } 256 }
257#endif 257#endif
258 258
259} 259}
260 260
261void AdvancedFm::upDir() { 261void AdvancedFm::upDir() {
262 QDir *thisDir = CurrentDir();
263 QString current = thisDir->canonicalPath();
264 QDir dir(current);
265 dir.cdUp();
266 current = dir.canonicalPath();
267 chdir( current.latin1() );
268 thisDir->cd( current, TRUE);
269 262
270 populateView(); 263 QDir dir( CurrentDir()->canonicalPath());
271 update(); 264 dir.cdUp();
265 changeTo(dir.canonicalPath());
272} 266}
273 267
274void AdvancedFm::copyTimer() { 268void AdvancedFm::copyTimer() {
275 QTimer::singleShot(125,this,SLOT(copy())); 269 QTimer::singleShot(125,this,SLOT(copy()));
276} 270}
277 271
278void AdvancedFm::copy() { 272void AdvancedFm::copy() {
279 QStringList curFileList = getPath(); 273 QStringList curFileList = getPath();
280
281 QDir *thisDir = CurrentDir();
282 QDir *thatDir = OtherDir();
283 274
284 bool doMsg=true; 275 QDir *thisDir = CurrentDir();
285 int count=curFileList.count(); 276 QDir *thatDir = OtherDir();
286 if( count > 0) { 277
287 if(count > 1 ){ 278 bool doMsg = true;
288 QString msg; 279 int count = curFileList.count();
289 msg=tr("<p>Really copy %1 files?</p>").arg(count); 280 if( count > 0) {
290 switch ( QMessageBox::warning(this,tr("Copy"),msg 281 if(count > 1 ){
291 ,tr("Yes"),tr("No"),0,0,1) ) 282 QString msg;
292 { 283 msg=tr("<p>Really copy %1 files?</p>").arg(count);
293 case 0: 284 switch ( QMessageBox::warning(this,tr("Copy"),msg
294 doMsg=false; 285 ,tr("Yes"),tr("No"),0,0,1) )
295 break; 286 {
296 case 1: 287 case 0:
297 return; 288 doMsg=false;
298 break; 289 break;
299 }; 290 case 1:
300 } 291 return;
292 break;
293 };
294 }
301 295
302 QString curFile, item, destFile; 296 QString curFile, item, destFile;
303 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 297 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
304 item=(*it); 298 item=(*it);
305 if(item.find("->",0,TRUE)) //symlink 299 if(item.find("->",0,TRUE)) //symlink
306 item = item.left(item.find("->",0,TRUE)); 300 item = item.left(item.find("->",0,TRUE));
307 301
308 curFile = thisDir->canonicalPath()+"/"+ item; 302 curFile = thisDir->canonicalPath()+"/"+ item;
309 destFile = thatDir->canonicalPath()+"/"+ item; 303 destFile = thatDir->canonicalPath()+"/"+ item;
310 304
311// odebug << "Destination file is "+destFile << oendl; 305// odebug << "Destination file is "+destFile << oendl;
312// odebug << "CurrentFile file is " + curFile << oendl; 306// odebug << "CurrentFile file is " + curFile << oendl;
313 307
314 QFile f(destFile); 308 QFile f(destFile);
315 if( f.exists()) { 309 if( f.exists()) {
316 if(doMsg) { 310 if(doMsg) {
317 switch ( QMessageBox::warning(this,tr("File Exists!"), 311 switch ( QMessageBox::warning(this,tr("File Exists!"),
318 tr("<p>%1 already exists. Ok to overwrite?</P>").arg(item), 312 tr("<p>%1 already exists. Ok to overwrite?</P>").arg(item),
319 tr("Yes"),tr("No"),0,0,1)) { 313 tr("Yes"),tr("No"),0,0,1)) {
320 case 1: 314 case 1:
321 return; 315 return;
322 break; 316 break;
323 }; 317 };
324 } 318 }
325 f.remove(); 319 f.remove();
326 } 320 }
327 321
328 if( !copyFile( curFile, destFile) ) { 322 if( !copyFile( curFile, destFile) ) {
329 QMessageBox::message("AdvancedFm", 323 QMessageBox::message("AdvancedFm",
330 tr( "<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); 324 tr( "<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile));
331 return; 325 return;
332 } 326 }
333 } 327 }
334 rePopulate(); 328 rePopulate();
335 } 329 }
336} 330}
337 331
338void AdvancedFm::copyAsTimer() { 332void AdvancedFm::copyAsTimer() {
339 QTimer::singleShot(125,this,SLOT(copyAs())); 333 QTimer::singleShot(125,this,SLOT(copyAs()));
340} 334}
341 335
342void AdvancedFm::copyAs() { 336void AdvancedFm::copyAs() {
343 337
344 QStringList curFileList = getPath(); 338 QStringList curFileList = getPath();
345 QString curFile, item; 339 QString curFile, item;
346 InputDialog *fileDlg; 340 InputDialog *fileDlg;
347 341
348 QDir *thisDir = CurrentDir(); 342 QDir *thisDir = CurrentDir();
349 QDir *thatDir = OtherDir(); 343 QDir *thatDir = OtherDir();
350 344
351 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 345 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
352 QString destFile; 346 QString destFile;
353 item=(*it); 347 item=(*it);
354 curFile = thisDir->canonicalPath()+"/"+(*it); 348 curFile = thisDir->canonicalPath()+"/"+(*it);
355 fileDlg = new InputDialog( this, tr("Copy %1 As").arg(curFile), TRUE, 0); 349 fileDlg = new InputDialog( this, tr("Copy %1 As").arg(curFile), TRUE, 0);
356 350
357 fileDlg->setInputText((const QString &) destFile ); 351 fileDlg->setInputText((const QString &) destFile );
358 fileDlg->exec(); 352 fileDlg->exec();
359 353
360 if( fileDlg->result() == 1 ) { 354 if( fileDlg->result() == 1 ) {
361 QString filename = fileDlg->LineEdit1->text(); 355 QString filename = fileDlg->LineEdit1->text();
362 destFile = thatDir->canonicalPath()+"/"+filename; 356 destFile = thatDir->canonicalPath()+"/"+filename;
363 357
364 QFile f( destFile); 358 QFile f( destFile);
365 if( f.exists()) { 359 if( f.exists()) {
366 switch (QMessageBox::warning(this,tr("File Exists!"), 360 switch (QMessageBox::warning(this,tr("File Exists!"),
367 tr("<P> %1 already exists. Ok to overwrite?</p>").arg(item), 361 tr("<P> %1 already exists. Ok to overwrite?</p>").arg(item),
368 tr("Yes"),tr("No"),0,0,1) ) { 362 tr("Yes"),tr("No"),0,0,1) ) {
369 case 0: 363 case 0:
370 f.remove(); 364 f.remove();
371 break; 365 break;
372 case 1: 366 case 1:
373 return; 367 return;
374 break; 368 break;
375 }; 369 };
376 } 370 }
377 if( !copyFile( curFile, destFile) ) { 371 if( !copyFile( curFile, destFile) ) {
378 QMessageBox::message("AdvancedFm",tr("<p>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); 372 QMessageBox::message("AdvancedFm",tr("<p>Could not copy %1 to %2</P>").arg(curFile).arg(destFile));
379 return; 373 return;
380 } 374 }
381 } 375 }
382 delete fileDlg; 376 delete fileDlg;
383 377
384 } 378 }
385 rePopulate(); 379 rePopulate();
386 // setOtherTabCurrent(); 380 // setOtherTabCurrent();
387 qApp->processEvents(); 381 qApp->processEvents();
388 382
389} 383}
390 384
391void AdvancedFm::copySameDirTimer() { 385void AdvancedFm::copySameDirTimer() {
392 QTimer::singleShot(125,this,SLOT(copySameDir())); 386 QTimer::singleShot(125,this,SLOT(copySameDir()));
393} 387}
394 388
395void AdvancedFm::copySameDir() { 389void AdvancedFm::copySameDir() {
396 qApp->processEvents(); 390 qApp->processEvents();
397 QStringList curFileList = getPath(); 391 QStringList curFileList = getPath();
398 QString curFile, item, destFile; 392 QString curFile, item, destFile;
399 InputDialog *fileDlg; 393 InputDialog *fileDlg;
400 394
401 QDir *thisDir = CurrentDir(); 395 QDir *thisDir = CurrentDir();
402 396
403 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 397 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
404 item=(*it); 398 item=(*it);
405 curFile = thisDir->canonicalPath()+"/"+ item; 399 curFile = thisDir->canonicalPath()+"/"+ item;
406 400
407 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); 401 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0);
408 fileDlg->setInputText((const QString &) destFile ); 402 fileDlg->setInputText((const QString &) destFile );
409 fileDlg->exec(); 403 fileDlg->exec();
410 404
411 if( fileDlg->result() == 1 ) { 405 if( fileDlg->result() == 1 ) {
412 406
413 QString filename = fileDlg->LineEdit1->text(); 407 QString filename = fileDlg->LineEdit1->text();
414 destFile = thisDir->canonicalPath()+"/"+filename; 408 destFile = thisDir->canonicalPath()+"/"+filename;
415 409
416 QFile f(destFile); 410 QFile f(destFile);
417 if( f.exists()) { 411 if( f.exists()) {
418 switch (QMessageBox::warning(this,tr("Delete"), 412 switch (QMessageBox::warning(this,tr("Delete"),
419 tr("<p> %1 already exists. Do you really want to delete it?</P>").arg(destFile), 413 tr("<p> %1 already exists. Do you really want to delete it?</P>").arg(destFile),
420 tr("Yes"),tr("No"),0,0,1) ) { 414 tr("Yes"),tr("No"),0,0,1) ) {
421 case 0: 415 case 0:
422 416
423 f.remove(); 417 f.remove();
424 break; 418 break;
425 case 1: 419 case 1:
426 return; 420 return;
427 break; 421 break;
428 }; 422 };
429 } 423 }
430 if(!copyFile( curFile,destFile) ) { 424 if(!copyFile( curFile,destFile) ) {
431 QMessageBox::message("AdvancedFm",tr("<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); 425 QMessageBox::message("AdvancedFm",tr("<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile));
432 return; 426 return;
433 } 427 }
434 428
435// odebug << "copy "+curFile+" as "+destFile << oendl; 429// odebug << "copy "+curFile+" as "+destFile << oendl;
436 } 430 }
437 delete fileDlg; 431 delete fileDlg;
438 } 432 }
439 rePopulate(); 433 rePopulate();
440} 434}
441 435
442void AdvancedFm::moveTimer() { 436void AdvancedFm::moveTimer() {
443 QTimer::singleShot(125,this,SLOT(move())); 437 QTimer::singleShot(125,this,SLOT(move()));
444} 438}
445 439
446void AdvancedFm::move() { 440void AdvancedFm::move() {
447 441
448 QStringList curFileList = getPath(); 442 QStringList curFileList = getPath();
449 if( curFileList.count() > 0) { 443 if( curFileList.count() > 0) {
450 QString curFile, destFile, item; 444 QString curFile, destFile, item;
451 445
452 QDir *thisDir = CurrentDir(); 446 QDir *thisDir = CurrentDir();
453 QDir *thatDir = OtherDir(); 447 QDir *thatDir = OtherDir();
454 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 448 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
455 item=(*it); 449 item=(*it);
456 QString destFile = thatDir->canonicalPath(); 450 QString destFile = thatDir->canonicalPath();
457 451
458 if(destFile.right(1).find("/",0,TRUE) == -1) 452 if(destFile.right(1).find("/",0,TRUE) == -1)
459 destFile+="/"; 453 destFile+="/";
460 destFile += item; 454 destFile += item;
461// odebug << "Destination file is "+destFile << oendl; 455// odebug << "Destination file is "+destFile << oendl;
462 456
463 curFile = thisDir->canonicalPath(); 457 curFile = thisDir->canonicalPath();
464 if(curFile.right(1).find("/",0,TRUE) == -1) 458 if(curFile.right(1).find("/",0,TRUE) == -1)
465 curFile +="/"; 459 curFile +="/";
466 curFile+= item; 460 curFile+= item;
467// odebug << "CurrentFile file is " + curFile << oendl; 461// odebug << "CurrentFile file is " + curFile << oendl;
468 462
469 if(QFileInfo(curFile).isDir()) { 463 if(QFileInfo(curFile).isDir()) {
470 moveDirectory( curFile, destFile ); 464 moveDirectory( curFile, destFile );
471 rePopulate(); 465 rePopulate();
472 return; 466 return;
473 } 467 }
474 QFile f( destFile); 468 QFile f( destFile);
475 if( f.exists()) { 469 if( f.exists()) {
476 switch ( QMessageBox::warning(this,tr("File Exists!"), 470 switch ( QMessageBox::warning(this,tr("File Exists!"),
477 tr("<p>%1 already exists. Ok to overwrite?</P>").arg(destFile), 471 tr("<p>%1 already exists. Ok to overwrite?</P>").arg(destFile),
478 tr("Yes"),tr("No"),0,0,1)) { 472 tr("Yes"),tr("No"),0,0,1)) {
479 case 1: 473 case 1:
480 return; 474 return;
481 break; 475 break;
482 }; 476 };
483 if( !copyFile( curFile, destFile) ) { 477 if( !copyFile( curFile, destFile) ) {
484 QMessageBox::message(tr("Note"),tr("<p>Could not move %1</p>").arg(curFile)); 478 QMessageBox::message(tr("Note"),tr("<p>Could not move %1</p>").arg(curFile));
485 return; 479 return;
486 } else 480 } else
487 QFile::remove(curFile); 481 QFile::remove(curFile);
488 } 482 }
489 } 483 }
490 } 484 }
491 rePopulate(); 485 rePopulate();
492 //setOtherTabCurrent(); 486 //setOtherTabCurrent();
493} 487}
494 488
495bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { 489bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) {
496 int err = 0; 490 int err = 0;
497 if( copyDirectory( src, dest ) ) { 491 if( copyDirectory( src, dest ) ) {
498 QString cmd = "rm -rf " + src; 492 QString cmd = "rm -rf " + src;
499 err = system((const char*)cmd); 493 err = system((const char*)cmd);
500 } else 494 } else
501 err = -1; 495 err = -1;
502 496
503 if(err!=0) { 497 if(err!=0) {
504 QMessageBox::message(tr("Note"),tr("<p>Could not move %1</p>").arg( src)); 498 QMessageBox::message(tr("Note"),tr("<p>Could not move %1</p>").arg( src));
505 return false; 499 return false;
506 } 500 }
507 return true; 501 return true;
508} 502}
509 503
510bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { 504bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) {
511 505
512 QString cmd = "/bin/cp -fpR " + src + " " + dest; 506 QString cmd = "/bin/cp -fpR " + src + " " + dest;
513 owarn << cmd << oendl; 507 owarn << cmd << oendl;
514 int err = system( (const char *) cmd ); 508 int err = system( (const char *) cmd );
515 if ( err != 0 ) { 509 if ( err != 0 ) {
516 QMessageBox::message("AdvancedFm", tr( "<p>Could not copy %1 to %2</p>").arg( src ).arg( dest ) ); 510 QMessageBox::message("AdvancedFm", tr( "<p>Could not copy %1 to %2</p>").arg( src ).arg( dest ) );
517 return false; 511 return false;
518 } 512 }
519 513
520 return true; 514 return true;
521} 515}
522 516
523 517
524bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { 518bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
525 if(QFileInfo(src).isDir()) { 519 if(QFileInfo(src).isDir()) {
526 if( copyDirectory( src, dest )) { 520 if( copyDirectory( src, dest )) {
527 // setOtherTabCurrent(); 521 // setOtherTabCurrent();