author | llornkcor <llornkcor> | 2004-09-28 08:38:46 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-28 08:38:46 (UTC) |
commit | a1482c1dfd0f0859736716a7ce4a459a8e02728c (patch) (unidiff) | |
tree | 53b148c95d28fb0286dfccb50462b6f673067057 | |
parent | c6daaf1849427191cb449e742681629bdaee4570 (diff) | |
download | opie-a1482c1dfd0f0859736716a7ce4a459a8e02728c.zip opie-a1482c1dfd0f0859736716a7ce4a459a8e02728c.tar.gz opie-a1482c1dfd0f0859736716a7ce4a459a8e02728c.tar.bz2 |
ugly workaround for bigscreen/smallscreen widget differences
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 30 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 62 |
2 files changed, 48 insertions, 44 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 9aa0c77..8cc5d7b 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -69,13 +69,13 @@ void AdvancedFm::cleanUp() { | |||
69 | } | 69 | } |
70 | 70 | ||
71 | void AdvancedFm::tabChanged(QWidget *wd) { | 71 | void AdvancedFm::tabChanged(QWidget *wd) { |
72 | // qDebug("tabChanged"); | ||
73 | if(wd == tab) { | 72 | if(wd == tab) { |
74 | whichTab = 1; | 73 | whichTab = 1; |
75 | viewMenu->setItemChecked(viewMenu->idAt(0), true); | 74 | viewMenu->setItemChecked(viewMenu->idAt(0), true); |
76 | viewMenu->setItemChecked(viewMenu->idAt(1), false); | 75 | viewMenu->setItemChecked(viewMenu->idAt(1), false); |
77 | // qDebug("tabchanged: LOCAL VIEW SHOWN"); | 76 | // qDebug("tabchanged: LOCAL VIEW SHOWN"); |
78 | } | 77 | } |
78 | |||
79 | else if(wd == tab_2) { | 79 | else if(wd == tab_2) { |
80 | whichTab = 2; | 80 | whichTab = 2; |
81 | viewMenu->setItemChecked(viewMenu->idAt(0), false); | 81 | viewMenu->setItemChecked(viewMenu->idAt(0), false); |
@@ -84,10 +84,6 @@ void AdvancedFm::tabChanged(QWidget *wd) { | |||
84 | } | 84 | } |
85 | qApp->processEvents(); | 85 | qApp->processEvents(); |
86 | QString path = CurrentDir()->canonicalPath(); | 86 | QString path = CurrentDir()->canonicalPath(); |
87 | // qDebug(path); | ||
88 | if ( TabWidget->currentWidget() == tab) { | ||
89 | } else { | ||
90 | } | ||
91 | 87 | ||
92 | chdir( path.latin1()); | 88 | chdir( path.latin1()); |
93 | currentPathCombo->lineEdit()->setText(path); | 89 | currentPathCombo->lineEdit()->setText(path); |
@@ -266,15 +262,15 @@ void AdvancedFm::refreshCurrentTab() { | |||
266 | } | 262 | } |
267 | 263 | ||
268 | void AdvancedFm::switchToLocalTab() { | 264 | void AdvancedFm::switchToLocalTab() { |
269 | TabWidget->setCurrentWidget(0); | 265 | TabWidget->setCurrentWidget(tab); |
270 | // Local_View->setFocus(); | 266 | Local_View->setFocus(); |
271 | whichTab = 1; | 267 | // whichTab = 1; |
272 | } | 268 | } |
273 | 269 | ||
274 | void AdvancedFm::switchToRemoteTab() { | 270 | void AdvancedFm::switchToRemoteTab() { |
275 | TabWidget->setCurrentWidget(1); | 271 | TabWidget->setCurrentWidget(tab_2); |
276 | // Remote_View->setFocus(); | 272 | Remote_View->setFocus(); |
277 | whichTab = 2; | 273 | // whichTab = 2; |
278 | } | 274 | } |
279 | 275 | ||
280 | void AdvancedFm::currentPathComboChanged() { | 276 | void AdvancedFm::currentPathComboChanged() { |
@@ -758,9 +754,15 @@ void AdvancedFm::setDocument(const QString &file) { | |||
758 | 754 | ||
759 | 755 | ||
760 | void AdvancedFm::slotSwitchMenu(int item) { | 756 | void AdvancedFm::slotSwitchMenu(int item) { |
761 | Q_UNUSED(item); | 757 | if(item == -23) { |
762 | // qDebug( "Switch %d",item); | 758 | switchToLocalTab(); |
763 | // viewMenu->setItemChecked(item, true); | 759 | tabChanged( tab); |
760 | } | ||
761 | |||
762 | if(item == -24) { | ||
763 | switchToRemoteTab(); | ||
764 | tabChanged( tab_2); | ||
765 | } | ||
764 | } | 766 | } |
765 | 767 | ||
766 | void AdvancedFm::navigateToSelected() { | 768 | void AdvancedFm::navigateToSelected() { |
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 171e7c4..4802771 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -44,7 +44,7 @@ void AdvancedFm::doDirChange() { | |||
44 | } else { | 44 | } else { |
45 | if( pathItem.find(" -> ",0,TRUE) != -1) | 45 | if( pathItem.find(" -> ",0,TRUE) != -1) |
46 | pathItem = dealWithSymName((const QString&)pathItem)+"/"; | 46 | pathItem = dealWithSymName((const QString&)pathItem)+"/"; |
47 | // owarn << pathItem << oendl; | 47 | // owarn << pathItem << oendl; |
48 | changeTo( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); | 48 | changeTo( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); |
49 | } | 49 | } |
50 | } | 50 | } |
@@ -95,7 +95,7 @@ void AdvancedFm::runThis() { | |||
95 | 95 | ||
96 | fs = getFileSystemType((const QString &) path); | 96 | fs = getFileSystemType((const QString &) path); |
97 | QFileInfo fileInfo( path + "/" + curFile); | 97 | QFileInfo fileInfo( path + "/" + curFile); |
98 | // odebug << fileInfo.owner() << oendl; | 98 | // odebug << fileInfo.owner() << oendl; |
99 | 99 | ||
100 | if( (fileInfo.permission( QFileInfo::ExeUser) | 100 | if( (fileInfo.permission( QFileInfo::ExeUser) |
101 | | fileInfo.permission( QFileInfo::ExeGroup) | 101 | | fileInfo.permission( QFileInfo::ExeGroup) |
@@ -107,7 +107,7 @@ void AdvancedFm::runThis() { | |||
107 | curFile = path + "/" + curFile; | 107 | curFile = path + "/" + curFile; |
108 | DocLnk nf(curFile); | 108 | DocLnk nf(curFile); |
109 | QString execStr = nf.exec(); | 109 | QString execStr = nf.exec(); |
110 | // odebug << execStr << oendl; | 110 | // odebug << execStr << oendl; |
111 | if( execStr.isEmpty() ) { | 111 | if( execStr.isEmpty() ) { |
112 | } else { | 112 | } else { |
113 | nf.execute(); | 113 | nf.execute(); |
@@ -205,12 +205,12 @@ void AdvancedFm::doDelete() { | |||
205 | QFile file(f); | 205 | QFile file(f); |
206 | QFileInfo fi(myFile); | 206 | QFileInfo fi(myFile); |
207 | if( fi.fileName().find("../",0,TRUE)==-1) { | 207 | if( fi.fileName().find("../",0,TRUE)==-1) { |
208 | // odebug << "remove link files "+myFile << oendl; | 208 | // odebug << "remove link files "+myFile << oendl; |
209 | 209 | ||
210 | // DocLnk lnk(f); | 210 | // DocLnk lnk(f); |
211 | DocLnk *lnk; | 211 | DocLnk *lnk; |
212 | lnk = new DocLnk(f); | 212 | lnk = new DocLnk(f); |
213 | // odebug << "Deleting doclnk " + lnk->linkFile() << oendl; | 213 | // odebug << "Deleting doclnk " + lnk->linkFile() << oendl; |
214 | if(lnk->isValid()) | 214 | if(lnk->isValid()) |
215 | lnk->removeLinkFile(); | 215 | lnk->removeLinkFile(); |
216 | // delete lnk; | 216 | // delete lnk; |
@@ -246,10 +246,10 @@ void AdvancedFm::doProperties() { | |||
246 | QString filePath; | 246 | QString filePath; |
247 | filePath = CurrentDir()->canonicalPath()+"/"; | 247 | filePath = CurrentDir()->canonicalPath()+"/"; |
248 | 248 | ||
249 | // odebug << "" << curFileList.count() << "" << oendl; | 249 | // odebug << "" << curFileList.count() << "" << oendl; |
250 | 250 | ||
251 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 251 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
252 | // odebug << (filePath+*it) << oendl; | 252 | // odebug << (filePath+*it) << oendl; |
253 | DocLnk lnk( (filePath+*it)); | 253 | DocLnk lnk( (filePath+*it)); |
254 | LnkProperties prop( &lnk ); | 254 | LnkProperties prop( &lnk ); |
255 | QPEApplication::execDialog( &prop ); | 255 | QPEApplication::execDialog( &prop ); |
@@ -302,8 +302,8 @@ void AdvancedFm::copy() { | |||
302 | curFile = thisDir->canonicalPath()+"/"+ item; | 302 | curFile = thisDir->canonicalPath()+"/"+ item; |
303 | destFile = thatDir->canonicalPath()+"/"+ item; | 303 | destFile = thatDir->canonicalPath()+"/"+ item; |
304 | 304 | ||
305 | // odebug << "Destination file is "+destFile << oendl; | 305 | // odebug << "Destination file is "+destFile << oendl; |
306 | // odebug << "CurrentFile file is " + curFile << oendl; | 306 | // odebug << "CurrentFile file is " + curFile << oendl; |
307 | 307 | ||
308 | QFile f(destFile); | 308 | QFile f(destFile); |
309 | if( f.exists()) { | 309 | if( f.exists()) { |
@@ -426,7 +426,7 @@ void AdvancedFm::copySameDir() { | |||
426 | return; | 426 | return; |
427 | } | 427 | } |
428 | 428 | ||
429 | // odebug << "copy "+curFile+" as "+destFile << oendl; | 429 | // odebug << "copy "+curFile+" as "+destFile << oendl; |
430 | } | 430 | } |
431 | delete fileDlg; | 431 | delete fileDlg; |
432 | } | 432 | } |
@@ -452,13 +452,13 @@ void AdvancedFm::move() { | |||
452 | if(destFile.right(1).find("/",0,TRUE) == -1) | 452 | if(destFile.right(1).find("/",0,TRUE) == -1) |
453 | destFile+="/"; | 453 | destFile+="/"; |
454 | destFile += item; | 454 | destFile += item; |
455 | // odebug << "Destination file is "+destFile << oendl; | 455 | // odebug << "Destination file is "+destFile << oendl; |
456 | 456 | ||
457 | curFile = thisDir->canonicalPath(); | 457 | curFile = thisDir->canonicalPath(); |
458 | if(curFile.right(1).find("/",0,TRUE) == -1) | 458 | if(curFile.right(1).find("/",0,TRUE) == -1) |
459 | curFile +="/"; | 459 | curFile +="/"; |
460 | curFile+= item; | 460 | curFile+= item; |
461 | // odebug << "CurrentFile file is " + curFile << oendl; | 461 | // odebug << "CurrentFile file is " + curFile << oendl; |
462 | 462 | ||
463 | if(QFileInfo(curFile).isDir()) { | 463 | if(QFileInfo(curFile).isDir()) { |
464 | moveDirectory( curFile, destFile ); | 464 | moveDirectory( curFile, destFile ); |
@@ -504,7 +504,7 @@ bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { | |||
504 | bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { | 504 | bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { |
505 | 505 | ||
506 | QString cmd = "/bin/cp -fpR " + src + " " + dest; | 506 | QString cmd = "/bin/cp -fpR " + src + " " + dest; |
507 | owarn << cmd << oendl; | 507 | owarn << cmd << oendl; |
508 | int err = system( (const char *) cmd ); | 508 | int err = system( (const char *) cmd ); |
509 | if ( err != 0 ) { | 509 | if ( err != 0 ) { |
510 | QMessageBox::message("AdvancedFm", tr( "<p>Could not copy %1 to %2</p>").arg( src ).arg( dest ) ); | 510 | QMessageBox::message("AdvancedFm", tr( "<p>Could not copy %1 to %2</p>").arg( src ).arg( dest ) ); |
@@ -537,14 +537,14 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { | |||
537 | struct stat stat_buf; | 537 | struct stat stat_buf; |
538 | off_t offset = 0; | 538 | off_t offset = 0; |
539 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { | 539 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { |
540 | // owarn << "open failed" << oendl; | 540 | // owarn << "open failed" << oendl; |
541 | return success = false; | 541 | return success = false; |
542 | } | 542 | } |
543 | read_fd = srcFile.handle(); | 543 | read_fd = srcFile.handle(); |
544 | if(read_fd != -1) { | 544 | if(read_fd != -1) { |
545 | fstat (read_fd, &stat_buf); | 545 | fstat (read_fd, &stat_buf); |
546 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { | 546 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { |
547 | // owarn << "destfile open failed" << oendl; | 547 | // owarn << "destfile open failed" << oendl; |
548 | return success = false; | 548 | return success = false; |
549 | } | 549 | } |
550 | write_fd = destFile.handle(); | 550 | write_fd = destFile.handle(); |
@@ -559,7 +559,7 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { | |||
559 | case EIO: msg = "Unspecified error while reading from in_fd."; | 559 | case EIO: msg = "Unspecified error while reading from in_fd."; |
560 | }; | 560 | }; |
561 | success = false; | 561 | success = false; |
562 | // owarn << msg << oendl; | 562 | // owarn << msg << oendl; |
563 | } | 563 | } |
564 | } else { | 564 | } else { |
565 | success = false; | 565 | success = false; |
@@ -591,7 +591,7 @@ void AdvancedFm::runCommand() { | |||
591 | //QString command; | 591 | //QString command; |
592 | 592 | ||
593 | if( fileDlg->result() == 1 ) { | 593 | if( fileDlg->result() == 1 ) { |
594 | // odebug << fileDlg->LineEdit1->text() << oendl; | 594 | // odebug << fileDlg->LineEdit1->text() << oendl; |
595 | QStringList command; | 595 | QStringList command; |
596 | 596 | ||
597 | command << "/bin/sh"; | 597 | command << "/bin/sh"; |
@@ -674,7 +674,7 @@ void AdvancedFm::mkSym() { | |||
674 | } | 674 | } |
675 | 675 | ||
676 | cmd = "ln -s "+curFile+" "+destName; | 676 | cmd = "ln -s "+curFile+" "+destName; |
677 | // odebug << cmd << oendl; | 677 | // odebug << cmd << oendl; |
678 | startProcess( (const QString)cmd ); | 678 | startProcess( (const QString)cmd ); |
679 | } | 679 | } |
680 | rePopulate(); | 680 | rePopulate(); |
@@ -724,7 +724,7 @@ void AdvancedFm::startProcess(const QString & cmd) { | |||
724 | command << cmd.latin1(); | 724 | command << cmd.latin1(); |
725 | *process << command; | 725 | *process << command; |
726 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) | 726 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) |
727 | odebug << "could not start process" << oendl; | 727 | odebug << "could not start process" << oendl; |
728 | } | 728 | } |
729 | 729 | ||
730 | void AdvancedFm::processEnded(OProcess *) { | 730 | void AdvancedFm::processEnded(OProcess *) { |
@@ -732,7 +732,7 @@ void AdvancedFm::processEnded(OProcess *) { | |||
732 | } | 732 | } |
733 | 733 | ||
734 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { | 734 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { |
735 | // owarn << "received stderrt " << buflen << " bytes" << oendl; | 735 | // owarn << "received stderrt " << buflen << " bytes" << oendl; |
736 | 736 | ||
737 | QString lineStr = buffer; | 737 | QString lineStr = buffer; |
738 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); | 738 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); |
@@ -757,25 +757,27 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { | |||
757 | return true; | 757 | return true; |
758 | } | 758 | } |
759 | } | 759 | } |
760 | /* if ( o->inherits( "QListView" ) ) { | 760 | if ( o->inherits( "QListView" ) ) { |
761 | if ( e->type() == QEvent::FocusIn ) { | 761 | if ( e->type() == QEvent::FocusIn ) { |
762 | // if( o == Local_View) { //keep track of which view | 762 | if( o == Local_View) { //keep track of which view |
763 | // qDebug("local view"); | 763 | whichTab = 1; |
764 | // whichTab = 1; | 764 | viewMenu->setItemChecked(viewMenu->idAt(0), true); |
765 | // } else { | 765 | viewMenu->setItemChecked(viewMenu->idAt(1), false); |
766 | // whichTab = 2; | 766 | } else { |
767 | // qDebug("remote view"); | 767 | whichTab = 2; |
768 | // } | 768 | viewMenu->setItemChecked(viewMenu->idAt(0), false); |
769 | viewMenu->setItemChecked(viewMenu->idAt(1), true); | ||
770 | } | ||
769 | } | 771 | } |
770 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection | 772 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection |
771 | } | 773 | } |
772 | */ | 774 | |
773 | return QWidget::eventFilter( o, e ); | 775 | return QWidget::eventFilter( o, e ); |
774 | } | 776 | } |
775 | 777 | ||
776 | 778 | ||
777 | void AdvancedFm::cancelRename() { | 779 | void AdvancedFm::cancelRename() { |
778 | // odebug << "cancel rename" << oendl; | 780 | // odebug << "cancel rename" << oendl; |
779 | QListView * view; | 781 | QListView * view; |
780 | view = CurrentView(); | 782 | view = CurrentView(); |
781 | 783 | ||