summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-22 12:16:36 (UTC)
committer llornkcor <llornkcor>2002-04-22 12:16:36 (UTC)
commitc4cbc0428d013fdd3fc5744edc416669d5564ade (patch) (unidiff)
treebec11f4abf32164731bb16e6544e6a2586f146cb
parente79c930fb498f2bc3387da7133a57cd085244346 (diff)
downloadopie-c4cbc0428d013fdd3fc5744edc416669d5564ade.zip
opie-c4cbc0428d013fdd3fc5744edc416669d5564ade.tar.gz
opie-c4cbc0428d013fdd3fc5744edc416669d5564ade.tar.bz2
bug fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index fed15b4..1083f23 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -114,93 +114,93 @@ AdvancedFm::AdvancedFm( )
114 homeButton->setFlat(TRUE); 114 homeButton->setFlat(TRUE);
115 layout->addMultiCellWidget( homeButton, 0, 0, 6, 6); 115 layout->addMultiCellWidget( homeButton, 0, 0, 6, 6);
116// fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 116// fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
117// fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 117// fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
118// fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 118// fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
119 119
120 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 120 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
121 fileMenu->insertSeparator(); 121 fileMenu->insertSeparator();
122 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 122 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
123 fileMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 123 fileMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
124 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 124 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
125 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 125 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
126 fileMenu->insertSeparator(); 126 fileMenu->insertSeparator();
127 fileMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 127 fileMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
128 fileMenu->setCheckable(TRUE); 128 fileMenu->setCheckable(TRUE);
129 129
130 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 130 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
131 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 131 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
132 viewMenu->insertSeparator(); 132 viewMenu->insertSeparator();
133 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 133 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
134 viewMenu->setCheckable(TRUE); 134 viewMenu->setCheckable(TRUE);
135 135
136 TabWidget = new QTabWidget( this, "TabWidget" ); 136 TabWidget = new QTabWidget( this, "TabWidget" );
137 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6); 137 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6);
138 138
139 tab = new QWidget( TabWidget, "tab" ); 139 tab = new QWidget( TabWidget, "tab" );
140 tabLayout = new QGridLayout( tab ); 140 tabLayout = new QGridLayout( tab );
141 tabLayout->setSpacing( 2); 141 tabLayout->setSpacing( 2);
142 tabLayout->setMargin( 2); 142 tabLayout->setMargin( 2);
143 143
144 Local_View = new QListView( tab, "Local_View" ); 144 Local_View = new QListView( tab, "Local_View" );
145// Local_View->setResizePolicy( QListView::AutoOneFit ); 145// Local_View->setResizePolicy( QListView::AutoOneFit );
146 Local_View->addColumn( tr("File"),140); 146 Local_View->addColumn( tr("File"),130);
147 Local_View->addColumn( tr("Date"),-1);
148 Local_View->setColumnAlignment(1,QListView::AlignRight);
149 Local_View->addColumn( tr("Size"),-1); 147 Local_View->addColumn( tr("Size"),-1);
148 Local_View->setColumnAlignment(1,QListView::AlignRight);
149 Local_View->addColumn( tr("Date"),-1);
150 Local_View->setColumnAlignment(2,QListView::AlignRight); 150 Local_View->setColumnAlignment(2,QListView::AlignRight);
151 Local_View->setAllColumnsShowFocus(TRUE); 151 Local_View->setAllColumnsShowFocus(TRUE);
152// Local_View->setMultiSelection( TRUE ); 152// Local_View->setMultiSelection( TRUE );
153// Local_View->setSelectionMode(QListView::Extended); 153// Local_View->setSelectionMode(QListView::Extended);
154 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 154 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
155 155
156 tabLayout->addWidget( Local_View, 0, 0 ); 156 tabLayout->addWidget( Local_View, 0, 0 );
157 157
158 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 158 connect( Local_View, SIGNAL( clicked( QListViewItem*)),
159 this,SLOT( localListClicked(QListViewItem *)) ); 159 this,SLOT( localListClicked(QListViewItem *)) );
160 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 160 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
161 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); 161 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) );
162 162
163 TabWidget->insertTab( tab, tr("1")); 163 TabWidget->insertTab( tab, tr("1"));
164 164
165 tab_2 = new QWidget( TabWidget, "tab_2" ); 165 tab_2 = new QWidget( TabWidget, "tab_2" );
166 tabLayout_2 = new QGridLayout( tab_2 ); 166 tabLayout_2 = new QGridLayout( tab_2 );
167 tabLayout_2->setSpacing( 2); 167 tabLayout_2->setSpacing( 2);
168 tabLayout_2->setMargin( 2); 168 tabLayout_2->setMargin( 2);
169 169
170 Remote_View = new QListView( tab_2, "Remote_View" ); 170 Remote_View = new QListView( tab_2, "Remote_View" );
171 Remote_View->addColumn( tr("File"),140); 171 Remote_View->addColumn( tr("File"),130);
172 Remote_View->addColumn( tr("Date"),-1);
173 Remote_View->setColumnAlignment(1,QListView::AlignRight);
174 Remote_View->addColumn( tr("Size"),-1); 172 Remote_View->addColumn( tr("Size"),-1);
173 Remote_View->setColumnAlignment(1,QListView::AlignRight);
174 Remote_View->addColumn( tr("Date"),-1);
175 Remote_View->setColumnAlignment(2,QListView::AlignRight); 175 Remote_View->setColumnAlignment(2,QListView::AlignRight);
176 Remote_View->setAllColumnsShowFocus(TRUE); 176 Remote_View->setAllColumnsShowFocus(TRUE);
177// Remote_View->setMultiSelection( TRUE ); 177// Remote_View->setMultiSelection( TRUE );
178// Remote_View->setSelectionMode(QListView::Extended); 178// Remote_View->setSelectionMode(QListView::Extended);
179 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 179 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
180 180
181 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 181 connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
182 this,SLOT( remoteListClicked(QListViewItem *)) ); 182 this,SLOT( remoteListClicked(QListViewItem *)) );
183 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 183 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
184 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 184 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) );
185 185
186 tabLayout_2->addWidget( Remote_View, 0, 0 ); 186 tabLayout_2->addWidget( Remote_View, 0, 0 );
187 187
188 TabWidget->insertTab( tab_2, tr( "2")); 188 TabWidget->insertTab( tab_2, tr( "2"));
189 189
190 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 190 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
191 this,SLOT(tabChanged(QWidget*))); 191 this,SLOT(tabChanged(QWidget*)));
192 192
193// tab_3 = new QWidget( TabWidget, "tab_3" ); 193// tab_3 = new QWidget( TabWidget, "tab_3" );
194// tabLayout_3 = new QGridLayout( tab_3 ); 194// tabLayout_3 = new QGridLayout( tab_3 );
195// tabLayout_3->setSpacing( 2); 195// tabLayout_3->setSpacing( 2);
196// tabLayout_3->setMargin( 2); 196// tabLayout_3->setMargin( 2);
197 197
198// OFileSelector *fileSelector; 198// OFileSelector *fileSelector;
199// fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); 199// fileSelector = new OFileSelector(tab_3,0,0,"/","","*");
200// tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); 200// tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 );
201 201
202// TabWidget->insertTab( tab_3, tr( "Files" ) ); 202// TabWidget->insertTab( tab_3, tr( "Files" ) );
203 203
204 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 204 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
205 currentDir.setPath( QDir::currentDirPath()); 205 currentDir.setPath( QDir::currentDirPath());
206 206
@@ -272,223 +272,223 @@ void AdvancedFm::populateLocalView()
272// } 272// }
273 QPixmap pm; 273 QPixmap pm;
274 Local_View->clear(); 274 Local_View->clear();
275 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 275 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
276 currentDir.setMatchAllDirs(TRUE); 276 currentDir.setMatchAllDirs(TRUE);
277 currentDir.setNameFilter(filterStr); 277 currentDir.setNameFilter(filterStr);
278 QString fileL, fileS, fileDate; 278 QString fileL, fileS, fileDate;
279// qDebug(currentDir.canonicalPath()); 279// qDebug(currentDir.canonicalPath());
280 280
281 bool isDir=FALSE; 281 bool isDir=FALSE;
282 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 282 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
283 QFileInfoListIterator it(*list); 283 QFileInfoListIterator it(*list);
284 QFileInfo *fi; 284 QFileInfo *fi;
285 while ( (fi=it.current()) ) { 285 while ( (fi=it.current()) ) {
286 if (fi->isSymLink() ) { 286 if (fi->isSymLink() ) {
287 QString symLink=fi->readLink(); 287 QString symLink=fi->readLink();
288// qDebug("Symlink detected "+symLink); 288// qDebug("Symlink detected "+symLink);
289 QFileInfo sym( symLink); 289 QFileInfo sym( symLink);
290 fileS.sprintf( "%10li", sym.size() ); 290 fileS.sprintf( "%10li", sym.size() );
291 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 291 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() );
292 fileDate = sym.lastModified().toString(); 292 fileDate = sym.lastModified().toString();
293 } else { 293 } else {
294 fileS.sprintf( "%10li", fi->size() ); 294 fileS.sprintf( "%10li", fi->size() );
295 fileL.sprintf( "%s",fi->fileName().data() ); 295 fileL.sprintf( "%s",fi->fileName().data() );
296 fileDate= fi->lastModified().toString(); 296 fileDate= fi->lastModified().toString();
297 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 297 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
298 fileL+="/"; 298 fileL+="/";
299 isDir=TRUE; 299 isDir=TRUE;
300// qDebug( fileL); 300// qDebug( fileL);
301 } 301 }
302 } 302 }
303 if(fileL !="./" && fi->exists()) { 303 if(fileL !="./" && fi->exists()) {
304 item= new QListViewItem( Local_View, fileL , fileDate, fileS); 304 item= new QListViewItem( Local_View, fileL, fileS , fileDate);
305 305
306 if(isDir || fileL.find("/",0,TRUE) != -1) { 306 if(isDir || fileL.find("/",0,TRUE) != -1) {
307 if( !QDir( fi->filePath() ).isReadable()) 307 if( !QDir( fi->filePath() ).isReadable())
308 pm = Resource::loadPixmap( "lockedfolder" ); 308 pm = Resource::loadPixmap( "lockedfolder" );
309 else 309 else
310 pm= Resource::loadPixmap( "folder" ); 310 pm= Resource::loadPixmap( "folder" );
311 item->setPixmap( 0,pm ); 311 item->setPixmap( 0,pm );
312 } else { 312 } else {
313 if( !fi->isReadable() ) 313 if( !fi->isReadable() )
314 pm = Resource::loadPixmap( "locked" ); 314 pm = Resource::loadPixmap( "locked" );
315 else { 315 else {
316 MimeType mt(fi->filePath()); 316 MimeType mt(fi->filePath());
317 pm=mt.pixmap(); //sets the correct pixmap for mimetype 317 pm=mt.pixmap(); //sets the correct pixmap for mimetype
318 if(pm.isNull()) 318 if(pm.isNull())
319 pm = Resource::loadPixmap( "UnknownDocument-14" ); 319 pm = Resource::loadPixmap( "UnknownDocument-14" );
320 item->setPixmap( 0,pm); 320 item->setPixmap( 0,pm);
321 } 321 }
322 } 322 }
323 if( fileL.find("->",0,TRUE) != -1) { 323 if( fileL.find("->",0,TRUE) != -1) {
324 // overlay link image 324 // overlay link image
325 pm= Resource::loadPixmap( "folder" ); 325 pm= Resource::loadPixmap( "folder" );
326 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 326 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
327 QPainter painter( &pm ); 327 QPainter painter( &pm );
328 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 328 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
329 pm.setMask( pm.createHeuristicMask( FALSE ) ); 329 pm.setMask( pm.createHeuristicMask( FALSE ) );
330 item->setPixmap( 0, pm); 330 item->setPixmap( 0, pm);
331 } 331 }
332 } isDir=FALSE; 332 } isDir=FALSE;
333 ++it; 333 ++it;
334 } 334 }
335 335
336 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { 336 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) {
337 struct stat buf; 337 struct stat buf;
338 struct stat st; 338 struct stat st;
339 dev_t devT; 339 dev_t devT;
340 mode_t mode; 340 mode_t mode;
341 DIR *dir; 341 DIR *dir;
342 int fd = 0; 342 int fd = 0;
343 struct dirent *mydirent; 343 struct dirent *mydirent;
344 int i = 1; 344 int i = 1;
345 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) 345 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL)
346 while ((mydirent = readdir(dir)) != NULL) { 346 while ((mydirent = readdir(dir)) != NULL) {
347 lstat( mydirent->d_name, &buf); 347 lstat( mydirent->d_name, &buf);
348 qDebug(mydirent->d_name); 348 qDebug(mydirent->d_name);
349// mode = buf.st_mode; 349// mode = buf.st_mode;
350 fileL.sprintf("%s", mydirent->d_name); 350 fileL.sprintf("%s", mydirent->d_name);
351// fileS.sprintf("%d, %d", ); //this isn't correct 351// fileS.sprintf("%d, %d", ); //this isn't correct
352 devT = buf.st_dev; 352 devT = buf.st_dev;
353 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 353 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
354// fileS.sprintf("%d,%d", devT, devT); 354// fileS.sprintf("%d,%d", devT, devT);
355 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 355 fileDate.sprintf("%s", ctime( &buf.st_mtime));
356 if( fileL.find(".") == -1 ){ 356 if( fileL.find(".") == -1 ){
357 item= new QListViewItem( Local_View, fileL, fileDate, fileS); 357 item= new QListViewItem( Local_View, fileL, fileS, fileDate);
358 pm = Resource::loadPixmap( "UnknownDocument-14" ); 358 pm = Resource::loadPixmap( "UnknownDocument-14" );
359 item->setPixmap( 0,pm); 359 item->setPixmap( 0,pm);
360 } 360 }
361 } 361 }
362 362
363 closedir(dir); 363 closedir(dir);
364 } 364 }
365 365
366 Local_View->setSorting( 3,FALSE); 366 Local_View->setSorting( 3,FALSE);
367 fillCombo( (const QString &) currentDir.canonicalPath()); 367 fillCombo( (const QString &) currentDir.canonicalPath());
368} 368}
369 369
370void AdvancedFm::populateRemoteView() 370void AdvancedFm::populateRemoteView()
371{ 371{
372// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 372// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
373// QListViewItemIterator it( Remote_View ); 373// QListViewItemIterator it( Remote_View );
374// for ( ; it.current(); ++it ) { 374// for ( ; it.current(); ++it ) {
375// if ( it.current()->isSelected() ) { 375// if ( it.current()->isSelected() ) {
376// QString strItem = it.current()->text(0); 376// QString strItem = it.current()->text(0);
377// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; 377// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem;
378// QFileInfo fi(localFile); 378// QFileInfo fi(localFile);
379// } 379// }
380// } 380// }
381 QPixmap pm; 381 QPixmap pm;
382 Remote_View->clear(); 382 Remote_View->clear();
383 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 383 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
384 currentRemoteDir.setMatchAllDirs(TRUE); 384 currentRemoteDir.setMatchAllDirs(TRUE);
385 currentRemoteDir.setNameFilter(filterStr); 385 currentRemoteDir.setNameFilter(filterStr);
386 QString fileL, fileS, fileDate; 386 QString fileL, fileS, fileDate;
387 bool isDir=FALSE; 387 bool isDir=FALSE;
388 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 388 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
389 QFileInfoListIterator it(*list); 389 QFileInfoListIterator it(*list);
390 QFileInfo *fi; 390 QFileInfo *fi;
391 while ( (fi=it.current()) ) { 391 while ( (fi=it.current()) ) {
392 if (fi->isSymLink() ){ 392 if (fi->isSymLink() ){
393 QString symLink=fi->readLink(); 393 QString symLink=fi->readLink();
394// qDebug("Symlink detected "+symLink); 394// qDebug("Symlink detected "+symLink);
395 QFileInfo sym( symLink); 395 QFileInfo sym( symLink);
396 fileS.sprintf( "%10li", sym.size() ); 396 fileS.sprintf( "%10li", sym.size() );
397 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 397 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() );
398 fileDate = sym.lastModified().toString(); 398 fileDate = sym.lastModified().toString();
399 } else { 399 } else {
400// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 400// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
401 fileS.sprintf( "%10li", fi->size() ); 401 fileS.sprintf( "%10li", fi->size() );
402 fileL.sprintf( "%s",fi->fileName().data() ); 402 fileL.sprintf( "%s",fi->fileName().data() );
403 fileDate= fi->lastModified().toString(); 403 fileDate= fi->lastModified().toString();
404 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { 404 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) {
405 fileL+="/"; 405 fileL+="/";
406 isDir=TRUE; 406 isDir=TRUE;
407// qDebug( fileL); 407// qDebug( fileL);
408 } 408 }
409 } 409 }
410 if(fileL !="./" && fi->exists()) { 410 if(fileL !="./" && fi->exists()) {
411 item= new QListViewItem( Remote_View, fileL, fileDate, fileS); 411 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
412 QPixmap pm; 412 QPixmap pm;
413 413
414 if(isDir || fileL.find("/",0,TRUE) != -1) { 414 if(isDir || fileL.find("/",0,TRUE) != -1) {
415 if( !QDir( fi->filePath() ).isReadable()) 415 if( !QDir( fi->filePath() ).isReadable())
416 pm = Resource::loadPixmap( "lockedfolder" ); 416 pm = Resource::loadPixmap( "lockedfolder" );
417 else 417 else
418 pm= Resource::loadPixmap( "folder" ); 418 pm= Resource::loadPixmap( "folder" );
419 item->setPixmap( 0,pm ); 419 item->setPixmap( 0,pm );
420 } else { 420 } else {
421 if( !fi->isReadable() ) 421 if( !fi->isReadable() )
422 pm = Resource::loadPixmap( "locked" ); 422 pm = Resource::loadPixmap( "locked" );
423 else { 423 else {
424 MimeType mt(fi->filePath()); 424 MimeType mt(fi->filePath());
425 pm=mt.pixmap(); //sets the correct pixmap for mimetype 425 pm=mt.pixmap(); //sets the correct pixmap for mimetype
426 if(pm.isNull()) 426 if(pm.isNull())
427 pm = Resource::loadPixmap( "UnknownDocument-14" ); 427 pm = Resource::loadPixmap( "UnknownDocument-14" );
428 item->setPixmap( 0,pm); 428 item->setPixmap( 0,pm);
429 } 429 }
430 } 430 }
431 if( fileL.find("->",0,TRUE) != -1) { 431 if( fileL.find("->",0,TRUE) != -1) {
432 // overlay link image 432 // overlay link image
433 pm= Resource::loadPixmap( "folder" ); 433 pm= Resource::loadPixmap( "folder" );
434 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 434 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
435 QPainter painter( &pm ); 435 QPainter painter( &pm );
436 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 436 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
437 pm.setMask( pm.createHeuristicMask( FALSE ) ); 437 pm.setMask( pm.createHeuristicMask( FALSE ) );
438 item->setPixmap( 0, pm); 438 item->setPixmap( 0, pm);
439 } 439 }
440 } isDir=FALSE; 440 } isDir=FALSE;
441 ++it; 441 ++it;
442 } 442 }
443 443
444 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { 444 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) {
445 struct stat buf; 445 struct stat buf;
446 struct stat st; 446 struct stat st;
447 mode_t mode; 447 mode_t mode;
448 DIR *dir; 448 DIR *dir;
449 int fd = 0; 449 int fd = 0;
450 struct dirent *mydirent; 450 struct dirent *mydirent;
451 int i = 1; 451 int i = 1;
452 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) 452 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL)
453 while ((mydirent = readdir(dir)) != NULL) { 453 while ((mydirent = readdir(dir)) != NULL) {
454 lstat( mydirent->d_name, &buf); 454 lstat( mydirent->d_name, &buf);
455 qDebug(mydirent->d_name); 455 qDebug(mydirent->d_name);
456// mode = buf.st_mode; 456// mode = buf.st_mode;
457 fileL.sprintf("%s", mydirent->d_name); 457 fileL.sprintf("%s", mydirent->d_name);
458// fileS.sprintf("%d, %d", ); //this isn't correct 458// fileS.sprintf("%d, %d", ); //this isn't correct
459 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); 459 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF);
460 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 460 fileDate.sprintf("%s", ctime( &buf.st_mtime));
461 if( fileL.find(".") == -1 ){ 461 if( fileL.find(".") == -1 ){
462 item= new QListViewItem( Remote_View, fileL, fileDate, fileS); 462 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
463 pm = Resource::loadPixmap( "UnknownDocument-14" ); 463 pm = Resource::loadPixmap( "UnknownDocument-14" );
464 item->setPixmap( 0,pm); 464 item->setPixmap( 0,pm);
465 } 465 }
466 } 466 }
467 467
468 closedir(dir); 468 closedir(dir);
469 } 469 }
470 470
471 Remote_View->setSorting( 3,FALSE); 471 Remote_View->setSorting( 3,FALSE);
472 fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); 472 fillCombo( (const QString &) currentRemoteDir.canonicalPath() );
473} 473}
474 474
475void AdvancedFm::localListClicked(QListViewItem *selectedItem) 475void AdvancedFm::localListClicked(QListViewItem *selectedItem)
476{ 476{
477 if(selectedItem) { 477 if(selectedItem) {
478 QString strItem=selectedItem->text(0); 478 QString strItem=selectedItem->text(0);
479 QString strSize=selectedItem->text(1); 479 QString strSize=selectedItem->text(1);
480 strSize=strSize.stripWhiteSpace(); 480 strSize=strSize.stripWhiteSpace();
481 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 481 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
482 // is symlink 482 // is symlink
483 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 483 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
484 if(QDir(strItem2).exists() ) { 484 if(QDir(strItem2).exists() ) {
485 currentDir.cd(strItem2, TRUE); 485 currentDir.cd(strItem2, TRUE);
486 populateLocalView(); 486 populateLocalView();
487 } 487 }
488 } else { // not a symlink 488 } else { // not a symlink
489 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 489 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
490 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 490 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
491 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 491 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
492 currentDir.cd(strItem,FALSE); 492 currentDir.cd(strItem,FALSE);
493 populateLocalView(); 493 populateLocalView();
494 } else { 494 } else {