-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 @@ -70,5 +70,4 @@ void AdvancedFm::cleanUp() { void AdvancedFm::tabChanged(QWidget *wd) { -// qDebug("tabChanged"); if(wd == tab) { whichTab = 1; @@ -77,4 +76,5 @@ void AdvancedFm::tabChanged(QWidget *wd) { // qDebug("tabchanged: LOCAL VIEW SHOWN"); } + else if(wd == tab_2) { whichTab = 2; @@ -85,8 +85,4 @@ void AdvancedFm::tabChanged(QWidget *wd) { qApp->processEvents(); QString path = CurrentDir()->canonicalPath(); -// qDebug(path); - if ( TabWidget->currentWidget() == tab) { - } else { - } chdir( path.latin1()); @@ -267,13 +263,13 @@ void AdvancedFm::refreshCurrentTab() { void AdvancedFm::switchToLocalTab() { - TabWidget->setCurrentWidget(0); -// Local_View->setFocus(); - whichTab = 1; + TabWidget->setCurrentWidget(tab); + Local_View->setFocus(); +// whichTab = 1; } void AdvancedFm::switchToRemoteTab() { - TabWidget->setCurrentWidget(1); -// Remote_View->setFocus(); - whichTab = 2; + TabWidget->setCurrentWidget(tab_2); + Remote_View->setFocus(); +// whichTab = 2; } @@ -759,7 +755,13 @@ void AdvancedFm::setDocument(const QString &file) { void AdvancedFm::slotSwitchMenu(int item) { - Q_UNUSED(item); -// qDebug( "Switch %d",item); - // viewMenu->setItemChecked(item, true); + if(item == -23) { + switchToLocalTab(); + tabChanged( tab); + } + + if(item == -24) { + switchToRemoteTab(); + tabChanged( tab_2); + } } 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 @@ -45,5 +45,5 @@ void AdvancedFm::doDirChange() { if( pathItem.find(" -> ",0,TRUE) != -1) pathItem = dealWithSymName((const QString&)pathItem)+"/"; -// owarn << pathItem << oendl; +// owarn << pathItem << oendl; changeTo( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); } @@ -96,5 +96,5 @@ void AdvancedFm::runThis() { fs = getFileSystemType((const QString &) path); QFileInfo fileInfo( path + "/" + curFile); -// odebug << fileInfo.owner() << oendl; +// odebug << fileInfo.owner() << oendl; if( (fileInfo.permission( QFileInfo::ExeUser) @@ -108,5 +108,5 @@ void AdvancedFm::runThis() { DocLnk nf(curFile); QString execStr = nf.exec(); -// odebug << execStr << oendl; +// odebug << execStr << oendl; if( execStr.isEmpty() ) { } else { @@ -206,10 +206,10 @@ void AdvancedFm::doDelete() { QFileInfo fi(myFile); if( fi.fileName().find("../",0,TRUE)==-1) { -// odebug << "remove link files "+myFile << oendl; +// odebug << "remove link files "+myFile << oendl; // DocLnk lnk(f); DocLnk *lnk; lnk = new DocLnk(f); -// odebug << "Deleting doclnk " + lnk->linkFile() << oendl; +// odebug << "Deleting doclnk " + lnk->linkFile() << oendl; if(lnk->isValid()) lnk->removeLinkFile(); @@ -247,8 +247,8 @@ void AdvancedFm::doProperties() { filePath = CurrentDir()->canonicalPath()+"/"; -// odebug << "" << curFileList.count() << "" << oendl; +// odebug << "" << curFileList.count() << "" << oendl; for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { -// odebug << (filePath+*it) << oendl; +// odebug << (filePath+*it) << oendl; DocLnk lnk( (filePath+*it)); LnkProperties prop( &lnk ); @@ -303,6 +303,6 @@ void AdvancedFm::copy() { destFile = thatDir->canonicalPath()+"/"+ item; -// odebug << "Destination file is "+destFile << oendl; -// odebug << "CurrentFile file is " + curFile << oendl; +// odebug << "Destination file is "+destFile << oendl; +// odebug << "CurrentFile file is " + curFile << oendl; QFile f(destFile); @@ -427,5 +427,5 @@ void AdvancedFm::copySameDir() { } -// odebug << "copy "+curFile+" as "+destFile << oendl; +// odebug << "copy "+curFile+" as "+destFile << oendl; } delete fileDlg; @@ -453,5 +453,5 @@ void AdvancedFm::move() { destFile+="/"; destFile += item; -// odebug << "Destination file is "+destFile << oendl; +// odebug << "Destination file is "+destFile << oendl; curFile = thisDir->canonicalPath(); @@ -459,5 +459,5 @@ void AdvancedFm::move() { curFile +="/"; curFile+= item; -// odebug << "CurrentFile file is " + curFile << oendl; +// odebug << "CurrentFile file is " + curFile << oendl; if(QFileInfo(curFile).isDir()) { @@ -505,5 +505,5 @@ bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { QString cmd = "/bin/cp -fpR " + src + " " + dest; - owarn << cmd << oendl; + owarn << cmd << oendl; int err = system( (const char *) cmd ); if ( err != 0 ) { @@ -538,5 +538,5 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { off_t offset = 0; if(!srcFile.open( IO_ReadOnly|IO_Raw)) { -// owarn << "open failed" << oendl; +// owarn << "open failed" << oendl; return success = false; } @@ -545,5 +545,5 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { fstat (read_fd, &stat_buf); if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { -// owarn << "destfile open failed" << oendl; +// owarn << "destfile open failed" << oendl; return success = false; } @@ -560,5 +560,5 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { }; success = false; -// owarn << msg << oendl; +// owarn << msg << oendl; } } else { @@ -592,5 +592,5 @@ void AdvancedFm::runCommand() { if( fileDlg->result() == 1 ) { -// odebug << fileDlg->LineEdit1->text() << oendl; +// odebug << fileDlg->LineEdit1->text() << oendl; QStringList command; @@ -675,5 +675,5 @@ void AdvancedFm::mkSym() { cmd = "ln -s "+curFile+" "+destName; -// odebug << cmd << oendl; +// odebug << cmd << oendl; startProcess( (const QString)cmd ); } @@ -725,5 +725,5 @@ void AdvancedFm::startProcess(const QString & cmd) { *process << command; if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) - odebug << "could not start process" << oendl; + odebug << "could not start process" << oendl; } @@ -733,5 +733,5 @@ void AdvancedFm::processEnded(OProcess *) { void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { -// owarn << "received stderrt " << buflen << " bytes" << oendl; +// owarn << "received stderrt " << buflen << " bytes" << oendl; QString lineStr = buffer; @@ -758,17 +758,19 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { } } -/* if ( o->inherits( "QListView" ) ) { + if ( o->inherits( "QListView" ) ) { if ( e->type() == QEvent::FocusIn ) { -// if( o == Local_View) { //keep track of which view -// qDebug("local view"); -// whichTab = 1; -// } else { -// whichTab = 2; -// qDebug("remote view"); -// } + if( o == Local_View) { //keep track of which view + whichTab = 1; + viewMenu->setItemChecked(viewMenu->idAt(0), true); + viewMenu->setItemChecked(viewMenu->idAt(1), false); + } else { + whichTab = 2; + viewMenu->setItemChecked(viewMenu->idAt(0), false); + viewMenu->setItemChecked(viewMenu->idAt(1), true); + } } OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection } -*/ + return QWidget::eventFilter( o, e ); } @@ -776,5 +778,5 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { void AdvancedFm::cancelRename() { -// odebug << "cancel rename" << oendl; +// odebug << "cancel rename" << oendl; QListView * view; view = CurrentView(); |