summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2005-03-24 20:14:38 (UTC)
committer llornkcor <llornkcor>2005-03-24 20:14:38 (UTC)
commit1e6c3181dcc7ec4edbe99db0d886ce7a9c483056 (patch) (unidiff)
tree38e98006c0bb49bb6b1008dddb840e961bb2b775
parent38ace7e9b3c9665336c0e6d2350895b147858f1f (diff)
downloadopie-1e6c3181dcc7ec4edbe99db0d886ce7a9c483056.zip
opie-1e6c3181dcc7ec4edbe99db0d886ce7a9c483056.tar.gz
opie-1e6c3181dcc7ec4edbe99db0d886ce7a9c483056.tar.bz2
cd to sd or mmc
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index fd81313..979549d 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -144,386 +144,391 @@ void AdvancedFm::populateView() {
144 pm.convertFromImage( Resource::loadImage( "exec" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 144 pm.convertFromImage( Resource::loadImage( "exec" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
145 } 145 }
146 else if( (fileInfo.permission( QFileInfo::ExeUser) 146 else if( (fileInfo.permission( QFileInfo::ExeUser)
147 | fileInfo.permission( QFileInfo::ExeGroup) 147 | fileInfo.permission( QFileInfo::ExeGroup)
148 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 148 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
149 pm.convertFromImage( Resource::loadImage( "exec" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 149 pm.convertFromImage( Resource::loadImage( "exec" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
150 } 150 }
151 else if( !fi->isReadable() ) { 151 else if( !fi->isReadable() ) {
152 pm.convertFromImage( Resource::loadImage( "locked" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 152 pm.convertFromImage( Resource::loadImage( "locked" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
153 } 153 }
154 else { //everything else goes by mimetype 154 else { //everything else goes by mimetype
155 MimeType mt(fi->filePath()); 155 MimeType mt(fi->filePath());
156 pm=mt.pixmap(); //sets the correct pixmap for mimetype 156 pm=mt.pixmap(); //sets the correct pixmap for mimetype
157 if(pm.isNull()) { 157 if(pm.isNull()) {
158 pm = unknownXpm; 158 pm = unknownXpm;
159 } 159 }
160 } 160 }
161 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { 161 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
162 // odebug << " overlay link image" << oendl; 162 // odebug << " overlay link image" << oendl;
163 pm.convertFromImage( Resource::loadImage( "advancedfm/symlink" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 163 pm.convertFromImage( Resource::loadImage( "advancedfm/symlink" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
164 // pm= Resource::loadPixmap( "folder" ); 164 // pm= Resource::loadPixmap( "folder" );
165// QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 165// QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
166// QPainter painter( &pm ); 166// QPainter painter( &pm );
167// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 167// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
168// pm.setMask( pm.createHeuristicMask( FALSE ) ); 168// pm.setMask( pm.createHeuristicMask( FALSE ) );
169 } 169 }
170 item->setPixmap( 0, pm ); 170 item->setPixmap( 0, pm );
171 171
172 } 172 }
173 isDir=FALSE; 173 isDir=FALSE;
174 ++it; 174 ++it;
175 } 175 }
176 176
177 if( path.find("dev",0,TRUE) != -1) { 177 if( path.find("dev",0,TRUE) != -1) {
178 struct stat buf; 178 struct stat buf;
179 dev_t devT; 179 dev_t devT;
180 DIR *dir; 180 DIR *dir;
181 struct dirent *mydirent; 181 struct dirent *mydirent;
182 182
183 if((dir = opendir( path.latin1())) != NULL) 183 if((dir = opendir( path.latin1())) != NULL)
184 while ((mydirent = readdir(dir)) != NULL) { 184 while ((mydirent = readdir(dir)) != NULL) {
185 lstat( mydirent->d_name, &buf); 185 lstat( mydirent->d_name, &buf);
186// odebug << mydirent->d_name << oendl; 186// odebug << mydirent->d_name << oendl;
187 fileL.sprintf("%s", mydirent->d_name); 187 fileL.sprintf("%s", mydirent->d_name);
188 devT = buf.st_dev; 188 devT = buf.st_dev;
189 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 189 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
190 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 190 fileDate.sprintf("%s", ctime( &buf.st_mtime));
191 if( fileL.find(".") == -1 ) { 191 if( fileL.find(".") == -1 ) {
192 item= new QListViewItem( thisView, fileL, fileS, fileDate); 192 item= new QListViewItem( thisView, fileL, fileS, fileDate);
193 pm = unknownXpm; 193 pm = unknownXpm;
194 item->setPixmap( 0,pm); 194 item->setPixmap( 0,pm);
195 } 195 }
196 } 196 }
197 197
198 closedir(dir); 198 closedir(dir);
199 } 199 }
200 200
201 thisView->setSorting( 3,FALSE); 201 thisView->setSorting( 3,FALSE);
202 fillCombo( (const QString &) path ); 202 fillCombo( (const QString &) path );
203} 203}
204 204
205void AdvancedFm::rePopulate() { 205void AdvancedFm::rePopulate() {
206 // qDebug("repopulate views"); 206 // qDebug("repopulate views");
207 populateView(); 207 populateView();
208 setOtherTabCurrent(); 208 setOtherTabCurrent();
209 populateView(); 209 populateView();
210} 210}
211 211
212void AdvancedFm::ListClicked(QListViewItem *selectedItem) { 212void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
213 if(selectedItem) { 213 if(selectedItem) {
214 QString strItem=selectedItem->text(0); 214 QString strItem=selectedItem->text(0);
215// owarn << strItem << oendl; 215// owarn << strItem << oendl;
216 QString strSize=selectedItem->text(1); 216 QString strSize=selectedItem->text(1);
217 strSize=strSize.stripWhiteSpace(); 217 strSize=strSize.stripWhiteSpace();
218 bool isDirectory = false; 218 bool isDirectory = false;
219 QString strItem2; 219 QString strItem2;
220 220
221 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink 221 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink
222 strItem2 = dealWithSymName((const QString&)strItem); 222 strItem2 = dealWithSymName((const QString&)strItem);
223 if(QDir(strItem2).exists() ) 223 if(QDir(strItem2).exists() )
224 strItem = strItem2; 224 strItem = strItem2;
225 } 225 }
226 226
227 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 227 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
228 228
229 if(QDir(strItem).exists()) 229 if(QDir(strItem).exists())
230 isDirectory = true; 230 isDirectory = true;
231 } 231 }
232 232
233 if( isDirectory ) { 233 if( isDirectory ) {
234 CurrentDir()->cd( strItem, TRUE); 234 CurrentDir()->cd( strItem, TRUE);
235 populateView(); 235 populateView();
236 CurrentView()->ensureItemVisible( CurrentView()->firstChild()); 236 CurrentView()->ensureItemVisible( CurrentView()->firstChild());
237 } 237 }
238 chdir( strItem.latin1()); 238 chdir( strItem.latin1());
239 } 239 }
240} 240}
241 241
242void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { 242void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) {
243 Q_UNUSED(item); 243 Q_UNUSED(item);
244 switch (mouse) { 244 switch (mouse) {
245 case 1: 245 case 1:
246 { 246 {
247 if(renameBox != 0 ) { 247 if(renameBox != 0 ) {
248 cancelRename(); 248 cancelRename();
249 } 249 }
250 } 250 }
251 break; 251 break;
252// case 2: 252// case 2:
253// menuTimer.start( 50, TRUE ); 253// menuTimer.start( 50, TRUE );
254// break; 254// break;
255 }; 255 };
256} 256}
257 257
258 258
259void AdvancedFm::refreshCurrentTab() { 259void AdvancedFm::refreshCurrentTab() {
260 populateView(); 260 populateView();
261 // if ( TabWidget->currentWidget() == tab) { 261 // if ( TabWidget->currentWidget() == tab) {
262} 262}
263 263
264void AdvancedFm::switchToLocalTab() { 264void AdvancedFm::switchToLocalTab() {
265 TabWidget->setCurrentWidget(tab); 265 TabWidget->setCurrentWidget(tab);
266 Local_View->setFocus(); 266 Local_View->setFocus();
267 // whichTab = 1; 267 // whichTab = 1;
268} 268}
269 269
270void AdvancedFm::switchToRemoteTab() { 270void AdvancedFm::switchToRemoteTab() {
271 TabWidget->setCurrentWidget(tab_2); 271 TabWidget->setCurrentWidget(tab_2);
272 Remote_View->setFocus(); 272 Remote_View->setFocus();
273 // whichTab = 2; 273 // whichTab = 2;
274} 274}
275 275
276void AdvancedFm::currentPathComboChanged() { 276void AdvancedFm::currentPathComboChanged() {
277 QString pDir = currentPathCombo->lineEdit()->text(); 277 QString pDir = currentPathCombo->lineEdit()->text();
278 if(QDir(pDir).exists()) { 278 if(QDir(pDir).exists()) {
279 CurrentDir()->setPath(pDir ); 279 CurrentDir()->setPath(pDir );
280 populateView(); 280 populateView();
281 } else { 281 } else {
282 QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir)); 282 QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir));
283 } 283 }
284} 284}
285 285
286void AdvancedFm::fillCombo(const QString &currentPath) { 286void AdvancedFm::fillCombo(const QString &currentPath) {
287 287
288 if ( TabWidget->currentWidget() == tab) { 288 if ( TabWidget->currentWidget() == tab) {
289// if ( whichTab == 1) { 289// if ( whichTab == 1) {
290 currentPathCombo->lineEdit()->setText( currentPath); 290 currentPathCombo->lineEdit()->setText( currentPath);
291 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 291 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
292 currentPathCombo->clear(); 292 currentPathCombo->clear();
293 localDirPathStringList.prepend( currentPath ); 293 localDirPathStringList.prepend( currentPath );
294 currentPathCombo->insertStringList( localDirPathStringList,-1); 294 currentPathCombo->insertStringList( localDirPathStringList,-1);
295 } 295 }
296 } else { 296 } else {
297 currentPathCombo->lineEdit()->setText( currentPath); 297 currentPathCombo->lineEdit()->setText( currentPath);
298 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 298 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
299 currentPathCombo->clear(); 299 currentPathCombo->clear();
300 remoteDirPathStringList.prepend( currentPath ); 300 remoteDirPathStringList.prepend( currentPath );
301 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 301 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
302 } 302 }
303 } 303 }
304} 304}
305 305
306QStringList AdvancedFm::getPath() { 306QStringList AdvancedFm::getPath() {
307 QStringList strList; 307 QStringList strList;
308 QListView *thisView=CurrentView(); 308 QListView *thisView=CurrentView();
309 QList<QListViewItem> * getSelectedItems( QListView * thisView ); 309 QList<QListViewItem> * getSelectedItems( QListView * thisView );
310 QListViewItemIterator it( thisView ); 310 QListViewItemIterator it( thisView );
311 for ( ; it.current(); ++it ) { 311 for ( ; it.current(); ++it ) {
312 if ( it.current()->isSelected() ) { 312 if ( it.current()->isSelected() ) {
313 strList << it.current()->text(0); 313 strList << it.current()->text(0);
314// odebug << it.current()->text(0) << oendl; 314// odebug << it.current()->text(0) << oendl;
315 } 315 }
316 } 316 }
317 return strList; 317 return strList;
318} 318}
319 319
320void AdvancedFm::changeTo(const QString &dir) { 320void AdvancedFm::changeTo(const QString &dir) {
321 chdir( dir.latin1()); 321 chdir( dir.latin1());
322 CurrentDir()->cd(dir, TRUE); 322 CurrentDir()->cd(dir, TRUE);
323 populateView(); 323 populateView();
324 update(); 324 update();
325} 325}
326 326
327void AdvancedFm::homeButtonPushed() { 327void AdvancedFm::homeButtonPushed() {
328 changeTo(QDir::homeDirPath()); 328 changeTo(QDir::homeDirPath());
329} 329}
330 330
331void AdvancedFm::docButtonPushed() { 331void AdvancedFm::docButtonPushed() {
332 changeTo(QPEApplication::documentDir()); 332 changeTo(QPEApplication::documentDir());
333} 333}
334 334
335void AdvancedFm::SDButtonPushed() { 335void AdvancedFm::SDButtonPushed() {
336 Opie::Core::OStorageInfo info; 336 Opie::Core::OStorageInfo info;
337 changeTo(info.sdPath()); 337 if(StorageInfo::hasSd() ) {
338 changeTo(info.sdPath());
339 }
340 else if(StorageInfo::hasMmc()) {
341 changeTo(info.mmcPath());
342 }
338} 343}
339 344
340void AdvancedFm::CFButtonPushed() { 345void AdvancedFm::CFButtonPushed() {
341 Opie::Core::OStorageInfo info; 346 Opie::Core::OStorageInfo info;
342 changeTo(info.cfPath()); 347 changeTo(info.cfPath());
343} 348}
344 349
345void AdvancedFm::QPEButtonPushed() { 350void AdvancedFm::QPEButtonPushed() {
346 changeTo(QPEApplication::qpeDir()); 351 changeTo(QPEApplication::qpeDir());
347} 352}
348 353
349void AdvancedFm::doAbout() { 354void AdvancedFm::doAbout() {
350 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>")); 355 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>"));
351} 356}
352 357
353void AdvancedFm::keyPressEvent( QKeyEvent *e) { 358void AdvancedFm::keyPressEvent( QKeyEvent *e) {
354 Q_UNUSED(e); 359 Q_UNUSED(e);
355} 360}
356 361
357void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { 362void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
358// if( CurrentView()->hasFocus() ) 363// if( CurrentView()->hasFocus() )
359// e->ignore(); 364// e->ignore();
360 365
361 if( currentPathCombo->lineEdit()->hasFocus()) { 366 if( currentPathCombo->lineEdit()->hasFocus()) {
362 // qDebug("shout!"); 367 // qDebug("shout!");
363 } 368 }
364 369
365 else if( e->key() == Key_Left ) 370 else if( e->key() == Key_Left )
366 upDir(); 371 upDir();
367 else if( e->key() == Key_Return || e->key() == Key_Enter) 372 else if( e->key() == Key_Return || e->key() == Key_Enter)
368 navigateToSelected(); 373 navigateToSelected();
369 else if( e->key() == Key_Tab) 374 else if( e->key() == Key_Tab)
370 setOtherTabCurrent(); 375 setOtherTabCurrent();
371 else if( e->key() == Key_Delete ) 376 else if( e->key() == Key_Delete )
372 del(); 377 del();
373 else 378 else
374 e->accept(); 379 e->accept();
375 380
376} 381}
377 382
378 383
379void AdvancedFm::parsetab(const QString &fileName) { 384void AdvancedFm::parsetab(const QString &fileName) {
380 385
381 fileSystemTypeList.clear(); 386 fileSystemTypeList.clear();
382 fsList.clear(); 387 fsList.clear();
383 struct mntent *me; 388 struct mntent *me;
384 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 389 FILE *mntfp = setmntent( fileName.latin1(), "r" );
385 if ( mntfp ) { 390 if ( mntfp ) {
386 while ( (me = getmntent( mntfp )) != 0 ) { 391 while ( (me = getmntent( mntfp )) != 0 ) {
387 QString deviceName = me->mnt_fsname; 392 QString deviceName = me->mnt_fsname;
388 QString filesystemType = me->mnt_type; 393 QString filesystemType = me->mnt_type;
389 QString mountDir = me->mnt_dir; 394 QString mountDir = me->mnt_dir;
390 if(deviceName != "none") { 395 if(deviceName != "none") {
391 if( fsList.contains(filesystemType) == 0 396 if( fsList.contains(filesystemType) == 0
392 & filesystemType.find("proc",0,TRUE) == -1 397 & filesystemType.find("proc",0,TRUE) == -1
393 & filesystemType.find("cramfs",0,TRUE) == -1 398 & filesystemType.find("cramfs",0,TRUE) == -1
394 & filesystemType.find("auto",0,TRUE) == -1) 399 & filesystemType.find("auto",0,TRUE) == -1)
395 fsList << filesystemType; 400 fsList << filesystemType;
396 fileSystemTypeList << mountDir+"::"+filesystemType; 401 fileSystemTypeList << mountDir+"::"+filesystemType;
397 } 402 }
398 } 403 }
399 } 404 }
400 endmntent( mntfp ); 405 endmntent( mntfp );
401} 406}
402 407
403QString AdvancedFm::getFileSystemType(const QString &currentText) { 408QString AdvancedFm::getFileSystemType(const QString &currentText) {
404 parsetab("/etc/mtab"); //why did TT forget filesystem type? 409 parsetab("/etc/mtab"); //why did TT forget filesystem type?
405 QString current = currentText;//.right( currentText.length()-1); 410 QString current = currentText;//.right( currentText.length()-1);
406 QString baseFs; 411 QString baseFs;
407 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 412 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
408 QString temp = (*it); 413 QString temp = (*it);
409 QString path = temp.left(temp.find("::",0,TRUE) ); 414 QString path = temp.left(temp.find("::",0,TRUE) );
410 path = path.right( path.length()-1); 415 path = path.right( path.length()-1);
411 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 416 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
412 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 417 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
413 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 418 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
414 } 419 }
415 } 420 }
416 return baseFs; 421 return baseFs;
417} 422}
418 423
419QString AdvancedFm::getDiskSpace( const QString &path) { 424QString AdvancedFm::getDiskSpace( const QString &path) {
420 struct statfs fss; 425 struct statfs fss;
421 if ( !statfs( path.latin1(), &fss ) ) { 426 if ( !statfs( path.latin1(), &fss ) ) {
422 int blkSize = fss.f_bsize; 427 int blkSize = fss.f_bsize;
423 // int totalBlks = fs.f_blocks; 428 // int totalBlks = fs.f_blocks;
424 int availBlks = fss.f_bavail; 429 int availBlks = fss.f_bavail;
425 430
426 long mult = blkSize / 1024; 431 long mult = blkSize / 1024;
427 long div = 1024 / blkSize; 432 long div = 1024 / blkSize;
428 if ( !mult ) mult = 1; 433 if ( !mult ) mult = 1;
429 if ( !div ) div = 1; 434 if ( !div ) div = 1;
430 435
431 return QString::number(availBlks * mult / div); 436 return QString::number(availBlks * mult / div);
432 } 437 }
433 return ""; 438 return "";
434} 439}
435 440
436 441
437void AdvancedFm::showFileMenu() { 442void AdvancedFm::showFileMenu() {
438 QString curApp; 443 QString curApp;
439 curApp = CurrentView()->currentItem()->text(0); 444 curApp = CurrentView()->currentItem()->text(0);
440 445
441 MimeType mt(curApp); 446 MimeType mt(curApp);
442 const AppLnk* app = mt.application(); 447 const AppLnk* app = mt.application();
443 QFile fi(curApp); 448 QFile fi(curApp);
444 QPopupMenu *m = new QPopupMenu(0); 449 QPopupMenu *m = new QPopupMenu(0);
445 QPopupMenu *n = new QPopupMenu(0); 450 QPopupMenu *n = new QPopupMenu(0);
446 // QPopupMenu *o = new QPopupMenu(0); 451 // QPopupMenu *o = new QPopupMenu(0);
447 m->insertItem(tr("Show Hidden Files"),this,SLOT(showHidden())); 452 m->insertItem(tr("Show Hidden Files"),this,SLOT(showHidden()));
448 453
449 if ( QFileInfo(fi).isDir()) { 454 if ( QFileInfo(fi).isDir()) {
450 m->insertSeparator(); 455 m->insertSeparator();
451 m->insertItem(tr("Change Directory"),this,SLOT(doDirChange())); 456 m->insertItem(tr("Change Directory"),this,SLOT(doDirChange()));
452 } else { 457 } else {
453 458
454 if (app) 459 if (app)
455 m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis())); 460 m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis()));
456 else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this 461 else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this
457 m->insertItem(tr("Execute"),this,SLOT(runThis())); 462 m->insertItem(tr("Execute"),this,SLOT(runThis()));
458 m->insertItem(Resource::loadPixmap("txt"),tr("Open as text"),this,SLOT(runText())); 463 m->insertItem(Resource::loadPixmap("txt"),tr("Open as text"),this,SLOT(runText()));
459 } 464 }
460 465
461 m->insertItem(tr("Actions"),n); 466 m->insertItem(tr("Actions"),n);
462 n->insertItem(tr("Make Directory"),this,SLOT(makeDir())); 467 n->insertItem(tr("Make Directory"),this,SLOT(makeDir()));
463 468
464 n->insertItem(tr("Make Symlink"),this,SLOT(mkSym())); 469 n->insertItem(tr("Make Symlink"),this,SLOT(mkSym()));
465 470
466 n->insertSeparator(); 471 n->insertSeparator();
467 n->insertItem(tr("Rename"),this,SLOT(renameIt())); 472 n->insertItem(tr("Rename"),this,SLOT(renameIt()));
468 473
469 n->insertItem(tr("Copy"),this,SLOT(copyTimer())); 474 n->insertItem(tr("Copy"),this,SLOT(copyTimer()));
470 n->insertItem(tr("Copy As"),this,SLOT(copyAsTimer())); 475 n->insertItem(tr("Copy As"),this,SLOT(copyAsTimer()));
471 n->insertItem(tr("Copy Same Dir"),this,SLOT(copySameDirTimer())); 476 n->insertItem(tr("Copy Same Dir"),this,SLOT(copySameDirTimer()));
472 n->insertItem(tr("Move"),this,SLOT(moveTimer())); 477 n->insertItem(tr("Move"),this,SLOT(moveTimer()));
473 478
474 n->insertSeparator(); 479 n->insertSeparator();
475 n->insertItem(tr("Delete"),this,SLOT(doDelete())); 480 n->insertItem(tr("Delete"),this,SLOT(doDelete()));
476 m->insertItem(tr("Add To Documents"),this,SLOT(addToDocs())); 481 m->insertItem(tr("Add To Documents"),this,SLOT(addToDocs()));
477 482
478 m->insertItem(tr("Run Command"),this,SLOT(runCommand())); 483 m->insertItem(tr("Run Command"),this,SLOT(runCommand()));
479 m->insertItem(tr("File Info"),this,SLOT(fileStatus())); 484 m->insertItem(tr("File Info"),this,SLOT(fileStatus()));
480 485
481 m->insertSeparator(); 486 m->insertSeparator();
482 m->insertItem(tr("Set Permissions"),this,SLOT(filePerms())); 487 m->insertItem(tr("Set Permissions"),this,SLOT(filePerms()));
483 488
484#if defined(QT_QWS_OPIE) 489#if defined(QT_QWS_OPIE)
485 m->insertItem(tr("Properties"),this,SLOT(doProperties())); 490 m->insertItem(tr("Properties"),this,SLOT(doProperties()));
486#endif 491#endif
487 m->setCheckable(TRUE); 492 m->setCheckable(TRUE);
488 if (!b) 493 if (!b)
489 m->setItemChecked(m->idAt(0),TRUE); 494 m->setItemChecked(m->idAt(0),TRUE);
490 else 495 else
491 m->setItemChecked(m->idAt(0),FALSE); 496 m->setItemChecked(m->idAt(0),FALSE);
492 497
493 if(Ir::supported()) 498 if(Ir::supported())
494 m->insertItem(tr("Beam File"),this,SLOT(doBeam())); 499 m->insertItem(tr("Beam File"),this,SLOT(doBeam()));
495 m->setFocus(); 500 m->setFocus();
496 501
497 m->exec(QPoint(QCursor::pos().x(),QCursor::pos().y())); 502 m->exec(QPoint(QCursor::pos().x(),QCursor::pos().y()));
498 503
499 if(m) delete m; 504 if(m) delete m;
500} 505}
501 506
502 507
503QString AdvancedFm::checkDiskSpace(const QString &path) { 508QString AdvancedFm::checkDiskSpace(const QString &path) {
504 struct statfs fss; 509 struct statfs fss;
505 if ( !statfs( path.latin1(), &fss ) ) { 510 if ( !statfs( path.latin1(), &fss ) ) {
506 int blkSize = fss.f_bsize; 511 int blkSize = fss.f_bsize;
507// int totalBlks = fs.f_blocks; 512// int totalBlks = fs.f_blocks;
508 int availBlks = fss.f_bavail; 513 int availBlks = fss.f_bavail;
509 514
510 long mult = blkSize / 1024; 515 long mult = blkSize / 1024;
511 long div = 1024 / blkSize; 516 long div = 1024 / blkSize;
512 if ( !mult ) mult = 1; 517 if ( !mult ) mult = 1;
513 if ( !div ) div = 1; 518 if ( !div ) div = 1;
514 519
515 520
516 return QString::number(availBlks * mult / div); 521 return QString::number(availBlks * mult / div);
517 } 522 }
518 return ""; 523 return "";
519} 524}
520 525
521void AdvancedFm::addToDocs() { 526void AdvancedFm::addToDocs() {
522 QStringList strListPaths = getPath(); 527 QStringList strListPaths = getPath();
523 QDir *thisDir = CurrentDir(); 528 QDir *thisDir = CurrentDir();
524 529
525 if( strListPaths.count() > 0) { 530 if( strListPaths.count() > 0) {
526 QString curFile; 531 QString curFile;
527 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 532 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
528 curFile = thisDir->canonicalPath()+"/"+(*it); 533 curFile = thisDir->canonicalPath()+"/"+(*it);
529// odebug << curFile << oendl; 534// odebug << curFile << oendl;