summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp31
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
2 files changed, 4 insertions, 28 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 3bfec7d..3cd2067 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -89,735 +89,712 @@ void AdvancedFm::tabChanged(QWidget *wd) {
89 QString fs= getFileSystemType( (const QString &) path); 89 QString fs= getFileSystemType( (const QString &) path);
90 90
91 setCaption(tr("AdvancedFm :: ")+fs+" :: " 91 setCaption(tr("AdvancedFm :: ")+fs+" :: "
92 +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); 92 +checkDiskSpace( (const QString &) path )+ tr(" kB free") );
93 chdir( path.latin1()); 93 chdir( path.latin1());
94 currentPathCombo->lineEdit()->setText(path); 94 currentPathCombo->lineEdit()->setText(path);
95} 95}
96 96
97 97
98void AdvancedFm::populateView() { 98void AdvancedFm::populateView() {
99 99
100 QPixmap pm; 100 QPixmap pm;
101 QListView *thisView = CurrentView(); 101 QListView *thisView = CurrentView();
102 QDir *thisDir = CurrentDir(); 102 QDir *thisDir = CurrentDir();
103 QString path = thisDir->canonicalPath(); 103 QString path = thisDir->canonicalPath();
104 104
105 thisView->clear(); 105 thisView->clear();
106 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 106 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
107 thisDir->setMatchAllDirs(TRUE); 107 thisDir->setMatchAllDirs(TRUE);
108 thisDir->setNameFilter(filterStr); 108 thisDir->setNameFilter(filterStr);
109 QString fileL, fileS, fileDate; 109 QString fileL, fileS, fileDate;
110 QString fs= getFileSystemType((const QString &) path); 110 QString fs= getFileSystemType((const QString &) path);
111 setCaption(tr("AdvancedFm :: ")+fs+" :: " 111 setCaption(tr("AdvancedFm :: ")+fs+" :: "
112 +checkDiskSpace((const QString &) path)+ tr(" kB free") ); 112 +checkDiskSpace((const QString &) path)+ tr(" kB free") );
113 bool isDir=FALSE; 113 bool isDir=FALSE;
114 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 114 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
115 QFileInfoListIterator it(*list); 115 QFileInfoListIterator it(*list);
116 QFileInfo *fi; 116 QFileInfo *fi;
117 while ( (fi=it.current()) ) { 117 while ( (fi=it.current()) ) {
118 if (fi->isSymLink() ) { 118 if (fi->isSymLink() ) {
119 QString symLink=fi->readLink(); 119 QString symLink=fi->readLink();
120 QFileInfo sym( symLink); 120 QFileInfo sym( symLink);
121 fileS.sprintf( "%10i", sym.size() ); 121 fileS.sprintf( "%10i", sym.size() );
122 fileL = fi->fileName() +" -> " + sym.filePath().data(); 122 fileL = fi->fileName() +" -> " + sym.filePath().data();
123 fileDate = sym.lastModified().toString(); 123 fileDate = sym.lastModified().toString();
124 } else { 124 } else {
125 fileS.sprintf( "%10i", fi->size() ); 125 fileS.sprintf( "%10i", fi->size() );
126 fileL = fi->fileName(); 126 fileL = fi->fileName();
127 fileDate= fi->lastModified().toString(); 127 fileDate= fi->lastModified().toString();
128 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { 128 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) {
129// if(fileL == "..") 129// if(fileL == "..")
130 fileL += "/"; 130 fileL += "/";
131 isDir=TRUE; 131 isDir=TRUE;
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("That directory does not exist")); 300 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
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) { 324void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
325 chdir( currentPath.latin1() ); 325 chdir( currentPath.latin1() );
326 CurrentDir()->cd( currentPath, TRUE); 326 CurrentDir()->cd( currentPath, TRUE);
327 populateView(); 327 populateView();
328 update(); 328 update();
329} 329}
330 330
331QStringList AdvancedFm::getPath() { 331QStringList AdvancedFm::getPath() {
332 QStringList strList; 332 QStringList strList;
333 QListView *thisView=CurrentView(); 333 QListView *thisView=CurrentView();
334 QList<QListViewItem> * getSelectedItems( QListView * thisView ); 334 QList<QListViewItem> * getSelectedItems( QListView * thisView );
335 QListViewItemIterator it( thisView ); 335 QListViewItemIterator it( thisView );
336 for ( ; it.current(); ++it ) { 336 for ( ; it.current(); ++it ) {
337 if ( it.current()->isSelected() ) { 337 if ( it.current()->isSelected() ) {
338 strList << it.current()->text(0); 338 strList << it.current()->text(0);
339// odebug << it.current()->text(0) << oendl; 339// odebug << it.current()->text(0) << oendl;
340 } 340 }
341 } 341 }
342 return strList; 342 return strList;
343} 343}
344 344
345void AdvancedFm::changeTo(QString dir) { 345void AdvancedFm::changeTo(const QString dir) {
346 chdir( dir.latin1()); 346 chdir( dir.latin1());
347 CurrentDir()->cd(dir, TRUE); 347 CurrentDir()->cd(dir, TRUE);
348 populateView(); 348 populateView();
349 update(); 349 update();
350} 350}
351 351
352void AdvancedFm::homeButtonPushed() { 352void AdvancedFm::homeButtonPushed() {
353 changeTo(QDir::homeDirPath()); 353 changeTo(QDir::homeDirPath());
354} 354}
355 355
356void AdvancedFm::docButtonPushed() { 356void AdvancedFm::docButtonPushed() {
357 changeTo(QPEApplication::documentDir()); 357 changeTo(QPEApplication::documentDir());
358} 358}
359 359
360void AdvancedFm::SDButtonPushed() { 360void AdvancedFm::SDButtonPushed() {
361 changeTo("/mnt/card");// this can change so fix 361 changeTo("/mnt/card");// this can change so fix
362} 362}
363 363
364void AdvancedFm::CFButtonPushed() { 364void AdvancedFm::CFButtonPushed() {
365 if(zaurusDevice) 365 if(zaurusDevice)
366 changeTo("/mnt/cf"); //zaurus 366 changeTo("/mnt/cf"); //zaurus
367 else 367 else
368 changeTo("/mnt/hda"); //ipaq 368 changeTo("/mnt/hda"); //ipaq
369} 369}
370 370
371void AdvancedFm::QPEButtonPushed() { 371void AdvancedFm::QPEButtonPushed() {
372 changeTo(QPEApplication::qpeDir()); 372 changeTo(QPEApplication::qpeDir());
373} 373}
374 374
375void AdvancedFm::doAbout() { 375void 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>")); 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>"));
377} 377}
378 378
379void AdvancedFm::keyPressEvent( QKeyEvent *e) { 379void AdvancedFm::keyPressEvent( QKeyEvent *e) {
380 Q_UNUSED(e); 380 Q_UNUSED(e);
381} 381}
382 382
383void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { 383void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
384 if( CurrentView()->hasFocus() ) 384 if( CurrentView()->hasFocus() )
385 e->ignore(); 385 e->ignore();
386 if( e->key() == Key_Left ) 386 if( e->key() == Key_Left )
387 upDir(); 387 upDir();
388 else if( e->key() == Key_Return || e->key() == Key_Enter) 388 else if( e->key() == Key_Return || e->key() == Key_Enter)
389 navigateToSelected(); 389 navigateToSelected();
390 else if( e->key() == Key_Tab) 390 else if( e->key() == Key_Tab)
391 setOtherTabCurrent(); 391 setOtherTabCurrent();
392 else if( e->key() == Key_Delete ) 392 else if( e->key() == Key_Delete )
393 del(); 393 del();
394 else if( e->key() == Key_A) 394 else if( e->key() == Key_A)
395 copyAs(); 395 copyAs();
396 else if( e->key() == Key_C) 396 else if( e->key() == Key_C)
397 copy(); 397 copy();
398 else if( e->key() == Key_E) 398 else if( e->key() == Key_E)
399 runThis(); 399 runThis();
400 else if( e->key() == Key_G) 400 else if( e->key() == Key_G)
401 currentPathCombo->lineEdit()->setFocus(); 401 currentPathCombo->lineEdit()->setFocus();
402 else if( e->key() == Key_H ) 402 else if( e->key() == Key_H )
403 showHidden(); 403 showHidden();
404 else if( e->key() == Key_I) 404 else if( e->key() == Key_I)
405 fileStatus(); 405 fileStatus();
406 else if( e->key() == Key_M) 406 else if( e->key() == Key_M)
407 move(); 407 move();
408 else if( e->key() == Key_N ) 408 else if( e->key() == Key_N )
409 mkDir(); 409 mkDir();
410 else if( e->key() == Key_P) 410 else if( e->key() == Key_P)
411 filePerms(); 411 filePerms();
412 else if( e->key() == Key_R ) 412 else if( e->key() == Key_R )
413 rn(); 413 rn();
414 else if( e->key() == Key_U ) 414 else if( e->key() == Key_U )
415 upDir(); 415 upDir();
416 else if( e->key() == Key_1) 416 else if( e->key() == Key_1)
417 switchToLocalTab(); 417 switchToLocalTab();
418 else if( e->key() == Key_2) 418 else if( e->key() == Key_2)
419 switchToRemoteTab(); 419 switchToRemoteTab();
420 else if( e->key() == Key_3) 420 else if( e->key() == Key_3)
421 CFButtonPushed(); 421 CFButtonPushed();
422 else if( e->key() == Key_4) 422 else if( e->key() == Key_4)
423 SDButtonPushed(); 423 SDButtonPushed();
424 else if( e->key() == Key_5 ) 424 else if( e->key() == Key_5 )
425 homeButtonPushed(); 425 homeButtonPushed();
426 else if( e->key() == Key_6 ) 426 else if( e->key() == Key_6 )
427 docButtonPushed(); 427 docButtonPushed();
428 else 428 else
429 e->accept(); 429 e->accept();
430} 430}
431 431
432 432
433void AdvancedFm::parsetab(const QString &fileName) { 433void AdvancedFm::parsetab(const QString &fileName) {
434 434
435 fileSystemTypeList.clear(); 435 fileSystemTypeList.clear();
436 fsList.clear(); 436 fsList.clear();
437 struct mntent *me; 437 struct mntent *me;
438 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 438 FILE *mntfp = setmntent( fileName.latin1(), "r" );
439 if ( mntfp ) { 439 if ( mntfp ) {
440 while ( (me = getmntent( mntfp )) != 0 ) { 440 while ( (me = getmntent( mntfp )) != 0 ) {
441 QString deviceName = me->mnt_fsname; 441 QString deviceName = me->mnt_fsname;
442 QString filesystemType = me->mnt_type; 442 QString filesystemType = me->mnt_type;
443 QString mountDir = me->mnt_dir; 443 QString mountDir = me->mnt_dir;
444 if(deviceName != "none") { 444 if(deviceName != "none") {
445 if( fsList.contains(filesystemType) == 0 445 if( fsList.contains(filesystemType) == 0
446 & filesystemType.find("proc",0,TRUE) == -1 446 & filesystemType.find("proc",0,TRUE) == -1
447 & filesystemType.find("cramfs",0,TRUE) == -1 447 & filesystemType.find("cramfs",0,TRUE) == -1
448 & filesystemType.find("auto",0,TRUE) == -1) 448 & filesystemType.find("auto",0,TRUE) == -1)
449 fsList << filesystemType; 449 fsList << filesystemType;
450 fileSystemTypeList << mountDir+"::"+filesystemType; 450 fileSystemTypeList << mountDir+"::"+filesystemType;
451 } 451 }
452 } 452 }
453 } 453 }
454 endmntent( mntfp ); 454 endmntent( mntfp );
455} 455}
456 456
457QString AdvancedFm::getFileSystemType(const QString &currentText) { 457QString AdvancedFm::getFileSystemType(const QString &currentText) {
458 parsetab("/etc/mtab"); //why did TT forget filesystem type? 458 parsetab("/etc/mtab"); //why did TT forget filesystem type?
459 QString current = currentText;//.right( currentText.length()-1); 459 QString current = currentText;//.right( currentText.length()-1);
460 QString baseFs; 460 QString baseFs;
461 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 461 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
462 QString temp = (*it); 462 QString temp = (*it);
463 QString path = temp.left(temp.find("::",0,TRUE) ); 463 QString path = temp.left(temp.find("::",0,TRUE) );
464 path = path.right( path.length()-1); 464 path = path.right( path.length()-1);
465 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 465 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
466 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 466 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
467 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 467 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
468 } 468 }
469 } 469 }
470 return baseFs; 470 return baseFs;
471} 471}
472 472
473QString AdvancedFm::getDiskSpace( const QString &path) { 473QString AdvancedFm::getDiskSpace( const QString &path) {
474 struct statfs fss; 474 struct statfs fss;
475 if ( !statfs( path.latin1(), &fss ) ) { 475 if ( !statfs( path.latin1(), &fss ) ) {
476 int blkSize = fss.f_bsize; 476 int blkSize = fss.f_bsize;
477 // int totalBlks = fs.f_blocks; 477 // int totalBlks = fs.f_blocks;
478 int availBlks = fss.f_bavail; 478 int availBlks = fss.f_bavail;
479 479
480 long mult = blkSize / 1024; 480 long mult = blkSize / 1024;
481 long div = 1024 / blkSize; 481 long div = 1024 / blkSize;
482 if ( !mult ) mult = 1; 482 if ( !mult ) mult = 1;
483 if ( !div ) div = 1; 483 if ( !div ) div = 1;
484 484
485 return QString::number(availBlks * mult / div); 485 return QString::number(availBlks * mult / div);
486 } 486 }
487 return ""; 487 return "";
488} 488}
489 489
490 490
491void AdvancedFm::showFileMenu() { 491void AdvancedFm::showFileMenu() {
492 QString curApp; 492 QString curApp;
493 curApp = CurrentView()->currentItem()->text(0); 493 curApp = CurrentView()->currentItem()->text(0);
494 494
495 MimeType mt(curApp); 495 MimeType mt(curApp);
496 const AppLnk* app = mt.application(); 496 const AppLnk* app = mt.application();
497 QFile fi(curApp); 497 QFile fi(curApp);
498 QPopupMenu *m = new QPopupMenu(0); 498 QPopupMenu *m = new QPopupMenu(0);
499 QPopupMenu *n = new QPopupMenu(0); 499 QPopupMenu *n = new QPopupMenu(0);
500 // QPopupMenu *o = new QPopupMenu(0); 500 // QPopupMenu *o = new QPopupMenu(0);
501 m->insertItem(tr("Show Hidden Files"),this,SLOT(showHidden())); 501 m->insertItem(tr("Show Hidden Files"),this,SLOT(showHidden()));
502 502
503 if ( QFileInfo(fi).isDir()) { 503 if ( QFileInfo(fi).isDir()) {
504 m->insertSeparator(); 504 m->insertSeparator();
505 m->insertItem(tr("Change Directory"),this,SLOT(doDirChange())); 505 m->insertItem(tr("Change Directory"),this,SLOT(doDirChange()));
506 } else { 506 } else {
507 507
508 if (app) 508 if (app)
509 m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis())); 509 m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis()));
510 else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this 510 else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this
511 m->insertItem(tr("Execute"),this,SLOT(runThis())); 511 m->insertItem(tr("Execute"),this,SLOT(runThis()));
512 m->insertItem(Resource::loadPixmap("txt"),tr("Open as text"),this,SLOT(runText())); 512 m->insertItem(Resource::loadPixmap("txt"),tr("Open as text"),this,SLOT(runText()));
513 } 513 }
514 514
515 m->insertItem(tr("Actions"),n); 515 m->insertItem(tr("Actions"),n);
516 n->insertItem(tr("Make Directory"),this,SLOT(makeDir())); 516 n->insertItem(tr("Make Directory"),this,SLOT(makeDir()));
517 517
518 n->insertItem(tr("Make Symlink"),this,SLOT(mkSym())); 518 n->insertItem(tr("Make Symlink"),this,SLOT(mkSym()));
519 519
520 n->insertSeparator(); 520 n->insertSeparator();
521 n->insertItem(tr("Rename"),this,SLOT(renameIt())); 521 n->insertItem(tr("Rename"),this,SLOT(renameIt()));
522 522
523 n->insertItem(tr("Copy"),this,SLOT(copyTimer())); 523 n->insertItem(tr("Copy"),this,SLOT(copyTimer()));
524 n->insertItem(tr("Copy As"),this,SLOT(copyAsTimer())); 524 n->insertItem(tr("Copy As"),this,SLOT(copyAsTimer()));
525 n->insertItem(tr("Copy Same Dir"),this,SLOT(copySameDirTimer())); 525 n->insertItem(tr("Copy Same Dir"),this,SLOT(copySameDirTimer()));
526 n->insertItem(tr("Move"),this,SLOT(moveTimer())); 526 n->insertItem(tr("Move"),this,SLOT(moveTimer()));
527 527
528 n->insertSeparator(); 528 n->insertSeparator();
529 n->insertItem(tr("Delete"),this,SLOT(doDelete())); 529 n->insertItem(tr("Delete"),this,SLOT(doDelete()));
530 m->insertItem(tr("Add To Documents"),this,SLOT(addToDocs())); 530 m->insertItem(tr("Add To Documents"),this,SLOT(addToDocs()));
531 531
532 m->insertItem(tr("Run Command"),this,SLOT(runCommand())); 532 m->insertItem(tr("Run Command"),this,SLOT(runCommand()));
533 m->insertItem(tr("File Info"),this,SLOT(fileStatus())); 533 m->insertItem(tr("File Info"),this,SLOT(fileStatus()));
534 534
535 m->insertSeparator(); 535 m->insertSeparator();
536 m->insertItem(tr("Set Permissions"),this,SLOT(filePerms())); 536 m->insertItem(tr("Set Permissions"),this,SLOT(filePerms()));
537 537
538#if defined(QT_QWS_OPIE) 538#if defined(QT_QWS_OPIE)
539 m->insertItem(tr("Properties"),this,SLOT(doProperties())); 539 m->insertItem(tr("Properties"),this,SLOT(doProperties()));
540#endif 540#endif
541 m->setCheckable(TRUE); 541 m->setCheckable(TRUE);
542 if (!b) 542 if (!b)
543 m->setItemChecked(m->idAt(0),TRUE); 543 m->setItemChecked(m->idAt(0),TRUE);
544 else 544 else
545 m->setItemChecked(m->idAt(0),FALSE); 545 m->setItemChecked(m->idAt(0),FALSE);
546 546
547 if(Ir::supported()) 547 if(Ir::supported())
548 m->insertItem(tr("Beam File"),this,SLOT(doBeam())); 548 m->insertItem(tr("Beam File"),this,SLOT(doBeam()));
549 m->setFocus(); 549 m->setFocus();
550 550
551 m->exec(QPoint(QCursor::pos().x(),QCursor::pos().y())); 551 m->exec(QPoint(QCursor::pos().x(),QCursor::pos().y()));
552 552
553 if(m) delete m; 553 if(m) delete m;
554} 554}
555 555
556 556
557QString AdvancedFm::checkDiskSpace(const QString &path) { 557QString AdvancedFm::checkDiskSpace(const QString &path) {
558 struct statfs fss; 558 struct statfs fss;
559 if ( !statfs( path.latin1(), &fss ) ) { 559 if ( !statfs( path.latin1(), &fss ) ) {
560 int blkSize = fss.f_bsize; 560 int blkSize = fss.f_bsize;
561// int totalBlks = fs.f_blocks; 561// int totalBlks = fs.f_blocks;
562 int availBlks = fss.f_bavail; 562 int availBlks = fss.f_bavail;
563 563
564 long mult = blkSize / 1024; 564 long mult = blkSize / 1024;
565 long div = 1024 / blkSize; 565 long div = 1024 / blkSize;
566 if ( !mult ) mult = 1; 566 if ( !mult ) mult = 1;
567 if ( !div ) div = 1; 567 if ( !div ) div = 1;
568 568
569 569
570 return QString::number(availBlks * mult / div); 570 return QString::number(availBlks * mult / div);
571 } 571 }
572 return ""; 572 return "";
573} 573}
574 574
575void AdvancedFm::addToDocs() { 575void AdvancedFm::addToDocs() {
576 QStringList strListPaths = getPath(); 576 QStringList strListPaths = getPath();
577 QDir *thisDir = CurrentDir(); 577 QDir *thisDir = CurrentDir();
578 578
579 if( strListPaths.count() > 0) { 579 if( strListPaths.count() > 0) {
580 QString curFile; 580 QString curFile;
581 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 581 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
582 curFile = thisDir->canonicalPath()+"/"+(*it); 582 curFile = thisDir->canonicalPath()+"/"+(*it);
583// odebug << curFile << oendl; 583// odebug << curFile << oendl;
584 QFileInfo fi(curFile); 584 QFileInfo fi(curFile);
585 DocLnk f; 585 DocLnk f;
586// curFile.replace(QRegExp("\\..*"),""); 586// curFile.replace(QRegExp("\\..*"),"");
587 f.setName(fi.baseName() ); 587 f.setName(fi.baseName() );
588 f.setFile( curFile); 588 f.setFile( curFile);
589 f.writeLink(); 589 f.writeLink();
590 } 590 }
591 } 591 }
592} 592}
593 593
594 594
595void AdvancedFm::customDirsToMenu() { 595void AdvancedFm::customDirsToMenu() {
596 596
597 Config cfg("AdvancedFm"); 597 Config cfg("AdvancedFm");
598 cfg.setGroup("Menu"); 598 cfg.setGroup("Menu");
599 599
600 QStringList list = cfg.readListEntry( "CustomDir", ','); 600 QStringList list = cfg.readListEntry( "CustomDir", ',');
601 menuButton->insertItems(list ); 601 menuButton->insertItems(list );
602 602
603// for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) 603// for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
604// { 604// {
605// customDirMenu->insertItem(*it ); 605// customDirMenu->insertItem(*it );
606// } 606// }
607} 607}
608 608
609void AdvancedFm::dirMenuSelected(int item) { 609void AdvancedFm::dirMenuSelected(int item) {
610 switch(item) 610 switch(item)
611 { 611 {
612 612
613 case -21: 613 case -21:
614 case 0: 614 case 0:
615 addCustomDir(); 615 addCustomDir();
616 break; 616 break;
617 case -22: 617 case -22:
618 case 1: 618 case 1:
619 removeCustomDir(); 619 removeCustomDir();
620 break; 620 break;
621 default: 621 default:
622 { 622 {
623// gotoCustomDir( menuButton->text(item)); 623// gotoCustomDir( menuButton->text(item));
624// gotoCustomDir( customDirMenu->text(item)); 624// gotoCustomDir( customDirMenu->text(item));
625 } 625 }
626 break; 626 break;
627 627
628 }; 628 };
629} 629}
630 630
631void AdvancedFm::addCustomDir() { 631void AdvancedFm::addCustomDir() {
632 Config cfg("AdvancedFm"); 632 Config cfg("AdvancedFm");
633 cfg.setGroup("Menu"); 633 cfg.setGroup("Menu");
634 QString dir; 634 QString dir;
635 QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); 635 QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)',');
636 636
637 dir = CurrentDir()->canonicalPath(); 637 dir = CurrentDir()->canonicalPath();
638 638
639 bool addIt=true; 639 bool addIt=true;
640 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 640 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
641 if( dir == (*it)) { 641 if( dir == (*it)) {
642 addIt=false; 642 addIt=false;
643 } 643 }
644 } 644 }
645 if(addIt) { 645 if(addIt) {
646 menuButton->insertItem(dir); 646 menuButton->insertItem(dir);
647// customDirMenu->insertItem(dir); 647// customDirMenu->insertItem(dir);
648 list << dir; 648 list << dir;
649 } 649 }
650 650
651 cfg.writeEntry("CustomDir", list, ','); 651 cfg.writeEntry("CustomDir", list, ',');
652 cfg.write(); 652 cfg.write();
653} 653}
654 654
655void AdvancedFm::removeCustomDir() { 655void AdvancedFm::removeCustomDir() {
656// odebug << "remove custom dir" << oendl; 656// odebug << "remove custom dir" << oendl;
657 Config cfg("AdvancedFm"); 657 Config cfg("AdvancedFm");
658 cfg.setGroup("Menu"); 658 cfg.setGroup("Menu");
659 QString dir; 659 QString dir;
660 QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); 660 QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)',');
661 QStringList list2; 661 QStringList list2;
662 dir = CurrentDir()->canonicalPath(); 662 dir = CurrentDir()->canonicalPath();
663 int ramble=2; 663 int ramble=2;
664// int ramble=-24; 664// int ramble=-24;
665//first remove list 665//first remove list
666 if(list.grep(dir,true).isEmpty()) { 666 if(list.grep(dir,true).isEmpty()) {
667 QMessageBox::message(tr( "AdvancedFm" ), 667 QMessageBox::message(tr( "AdvancedFm" ),
668 tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); 668 tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!"));
669 } else { 669 } else {
670 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 670 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
671 if((*it) != dir) { 671 if((*it) != dir) {
672//current item is not our current dir, so add it to temp list 672//current item is not our current dir, so add it to temp list
673 list2 <<(*it); 673 list2 <<(*it);
674 } else { 674 } else {
675// customDirMenu->removeItem( ramble); 675// customDirMenu->removeItem( ramble);
676 menuButton->remove( ramble); 676 menuButton->remove( ramble);
677 677
678 } 678 }
679 ramble++; 679 ramble++;
680// ramble--; 680// ramble--;
681 } 681 }
682 682
683 cfg.writeEntry("CustomDir", list2, ','); 683 cfg.writeEntry("CustomDir", list2, ',');
684 cfg.write(); 684 cfg.write();
685 } 685 }
686// customDirsToMenu(); 686// customDirsToMenu();
687 687
688} 688}
689 689
690void AdvancedFm::gotoCustomDir(const QString &dir) { 690void AdvancedFm::gotoCustomDir(const QString &dir) {
691// odebug << "gotoCustomDir(const QString &dir) " +dir << oendl; 691// odebug << "gotoCustomDir(const QString &dir) " +dir << oendl;
692// QString curDir = dir; 692// QString curDir = dir;
693// QDir *thisDir = CurrentDir(); 693// QDir *thisDir = CurrentDir();
694// if( curDir.isEmpty()) { 694// if( curDir.isEmpty()) {
695// } 695// }
696 if( dir == s_addBookmark) { 696 if( dir == s_addBookmark) {
697 addCustomDir(); 697 addCustomDir();
698 } 698 }
699 if( dir == s_removeBookmark) { 699 if( dir == s_removeBookmark) {
700 removeCustomDir( ); 700 removeCustomDir( );
701 } else { 701 } else {
702 gotoDirectory( dir); 702 changeTo( dir);
703// if(QDir( curDir).exists() ) 703// if(QDir( curDir).exists() )
704// { 704// {
705// thisDir->setPath( curDir ); 705// thisDir->setPath( curDir );
706// chdir( curDir.latin1() ); 706// chdir( curDir.latin1() );
707// thisDir->cd( curDir, TRUE); 707// thisDir->cd( curDir, TRUE);
708// populateView(); 708// populateView();
709// } 709// }
710 } 710 }
711} 711}
712 712
713QDir *AdvancedFm::CurrentDir() { 713QDir *AdvancedFm::CurrentDir() {
714 if ( whichTab == 1) { 714 if ( whichTab == 1) {
715 // qDebug("CurrentTab is Local"); 715 // qDebug("CurrentTab is Local");
716 return &currentDir; 716 return &currentDir;
717 } else { 717 } else {
718 // qDebug("CurrentTab is Remote"); 718 // qDebug("CurrentTab is Remote");
719 return &currentRemoteDir; 719 return &currentRemoteDir;
720 } 720 }
721} 721}
722 722
723QDir *AdvancedFm::OtherDir() { 723QDir *AdvancedFm::OtherDir() {
724 // if ( TabWidget->currentWidget() == tab) { 724 // if ( TabWidget->currentWidget() == tab) {
725 if ( whichTab == 1) { 725 if ( whichTab == 1) {
726 return &currentRemoteDir; 726 return &currentRemoteDir;
727 } else { 727 } else {
728 return &currentDir; 728 return &currentDir;
729 } 729 }
730} 730}
731 731
732QListView * AdvancedFm::CurrentView() { 732QListView * AdvancedFm::CurrentView() {
733 // if ( TabWidget->currentWidget() == tab) { 733 // if ( TabWidget->currentWidget() == tab) {
734 if ( whichTab == 1) { 734 if ( whichTab == 1) {
735 // qDebug("CurrentView: local"); 735 // qDebug("CurrentView: local");
736 return Local_View; 736 return Local_View;
737 } else { 737 } else {
738// owarn << "CurrentView Tab 2" << oendl; 738// owarn << "CurrentView Tab 2" << oendl;
739 // qDebug("CurrentView: remote"); 739 // qDebug("CurrentView: remote");
740 return Remote_View; 740 return Remote_View;
741 } 741 }
742} 742}
743 743
744QListView * AdvancedFm::OtherView() { 744QListView * AdvancedFm::OtherView() {
745 if ( whichTab == 1) 745 if ( whichTab == 1)
746 return Remote_View; 746 return Remote_View;
747 else 747 else
748 return Local_View; 748 return Local_View;
749} 749}
750 750
751void AdvancedFm::setOtherTabCurrent() { 751void AdvancedFm::setOtherTabCurrent() {
752 // qDebug("setOtherTabCurrent() %d",whichTab); 752 // qDebug("setOtherTabCurrent() %d",whichTab);
753 if ( whichTab == 1) { 753 if ( whichTab == 1) {
754 TabWidget->setCurrentWidget(1); 754 TabWidget->setCurrentWidget(1);
755 } else { 755 } else {
756 TabWidget->setCurrentWidget(0); 756 TabWidget->setCurrentWidget(0);
757 } 757 }
758 OtherView()->setFocus(); 758 OtherView()->setFocus();
759 OtherView()->setSelected( CurrentView()->firstChild(), true); 759 OtherView()->setSelected( CurrentView()->firstChild(), true);
760} 760}
761 761
762void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { 762void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
763// odebug << "qcop message "+msg << oendl; 763// odebug << "qcop message "+msg << oendl;
764 QDataStream stream ( data, IO_ReadOnly ); 764 QDataStream stream ( data, IO_ReadOnly );
765 if ( msg == "openDirectory(QString)" ) { 765 if ( msg == "openDirectory(QString)" ) {
766// odebug << "received" << oendl; 766// odebug << "received" << oendl;
767 QString file; 767 QString file;
768 stream >> file; 768 stream >> file;
769 gotoDirectory( (const QString &) file); 769 changeTo( (const QString &) file);
770 } 770 }
771} 771}
772 772
773void AdvancedFm::setDocument(const QString &file) { 773void AdvancedFm::setDocument(const QString &file) {
774 gotoDirectory( file); 774 changeTo( file);
775 775
776} 776}
777 777
778void AdvancedFm::gotoDirectory(const QString &file) {
779// qDebug("goto dir "+file);
780 QString curDir = file;
781 QDir *thisDir = CurrentDir();
782 if(QDir( curDir).exists() ) {
783 thisDir->setPath( curDir );
784 chdir( curDir.latin1() );
785 thisDir->cd( curDir, TRUE);
786 populateView();
787 }
788 else if(QFileInfo(curDir).exists()) {
789 QFileInfo fileInfo(curDir);
790 curDir=fileInfo.dirPath();
791 if(QDir( curDir).exists() ) {
792 thisDir->setPath( curDir );
793 chdir( curDir.latin1() );
794 thisDir->cd( curDir, TRUE);
795 populateView();
796 }
797 findFile(file);
798 }
799
800}
801 778
802void AdvancedFm::findFile(const QString &fileName) { 779void AdvancedFm::findFile(const QString &fileName) {
803 QFileInfo fi(fileName); 780 QFileInfo fi(fileName);
804 QListView *thisView = CurrentView(); 781 QListView *thisView = CurrentView();
805 QListViewItemIterator it( thisView ); 782 QListViewItemIterator it( thisView );
806 for ( ; it.current(); ++it ) { 783 for ( ; it.current(); ++it ) {
807 if(it.current()->text(0) == fi.fileName()) { 784 if(it.current()->text(0) == fi.fileName()) {
808 it.current()->setSelected(true); 785 it.current()->setSelected(true);
809 thisView->ensureItemVisible(it.current()); 786 thisView->ensureItemVisible(it.current());
810 } 787 }
811 } 788 }
812} 789}
813 790
814void AdvancedFm::slotSwitchMenu(int item) { 791void AdvancedFm::slotSwitchMenu(int item) {
815 Q_UNUSED(item); 792 Q_UNUSED(item);
816 // qDebug( "Switch %d",item); 793 // qDebug( "Switch %d",item);
817 // viewMenu->setItemChecked(item, true); 794 // viewMenu->setItemChecked(item, true);
818} 795}
819 796
820void AdvancedFm::navigateToSelected() { 797void AdvancedFm::navigateToSelected() {
821 if( !CurrentView()->currentItem()) return; 798 if( !CurrentView()->currentItem()) return;
822 doDirChange(); 799 doDirChange();
823} 800}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 9dbdc70..00ab909 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -1,194 +1,193 @@
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 &); 156 void currentPathComboActivated(const QString &);
157 void fillCombo(const QString &); 157 void fillCombo(const QString &);
158 bool copyFile( const QString & , const QString & ); 158 bool copyFile( const QString & , const QString & );
159 void fileStatus(); 159 void fileStatus();
160 void doAbout(); 160 void doAbout();
161 void doBeam(); 161 void doBeam();
162 void fileBeamFinished( Ir *); 162 void fileBeamFinished( Ir *);
163 bool copyDirectory( const QString & , const QString & ); 163 bool copyDirectory( const QString & , const QString & );
164// void navigateToSelected(); 164// void navigateToSelected();
165 bool moveDirectory( const QString & , const QString & ); 165 bool moveDirectory( const QString & , const QString & );
166 166
167// void slotSwitchtoLocal(int); 167// void slotSwitchtoLocal(int);
168 168
169private: 169private:
170 MenuButton *menuButton; 170 MenuButton *menuButton;
171 QString oldName, localViewDir, remoteViewDir; 171 QString oldName, localViewDir, remoteViewDir;
172 void startProcess(const QString &); 172 void startProcess(const QString &);
173 bool eventFilter( QObject * , QEvent * ); 173 bool eventFilter( QObject * , QEvent * );
174 void cancelRename(); 174 void cancelRename();
175 void doRename(QListView *); 175 void doRename(QListView *);
176 void okRename(); 176 void okRename();
177 void customDirsToMenu(); 177 void customDirsToMenu();
178 void addCustomDir(); 178 void addCustomDir();
179 void removeCustomDir(); 179 void removeCustomDir();
180 void gotoDirectory(const QString &);
181 void navigateToSelected(); 180 void navigateToSelected();
182 void findFile(const QString &); 181 void findFile(const QString &);
183 182
184private slots: 183private slots:
185 void processEnded(Opie::Core::OProcess *); 184 void processEnded(Opie::Core::OProcess *);
186 void oprocessStderr(Opie::Core::OProcess *, char *, int); 185 void oprocessStderr(Opie::Core::OProcess *, char *, int);
187 void gotoCustomDir(const QString &); 186 void gotoCustomDir(const QString &);
188 void qcopReceive(const QCString&, const QByteArray&); 187 void qcopReceive(const QCString&, const QByteArray&);
189 void setDocument(const QString &); 188 void setDocument(const QString &);
190 // void doMenu(int 189 // void doMenu(int
191 190
192}; 191};
193 192
194#endif // ADVANCEDFM_H 193#endif // ADVANCEDFM_H