summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfmMenu.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/advancedfm/advancedfmMenu.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp591
1 files changed, 256 insertions, 335 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 544350c..c0be948 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -48,11 +48,16 @@
-void AdvancedFm::doDirChange()
-{
- ListClicked( CurrentView()->currentItem());
+void AdvancedFm::doDirChange() {
+ QString pathItem = CurrentView()->currentItem()->text(0);
+ if( pathItem == "../") {
+ ListClicked( CurrentView()->currentItem());
+ } else {
+ if( pathItem.find(" -> ",0,TRUE) != -1)
+ pathItem = dealWithSymName((const QString&)pathItem)+"/";
+// qWarning(pathItem);
+ gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) );
+ }
}
-void AdvancedFm::showMenuHidden()
-{
- if (b)
- {
+void AdvancedFm::showMenuHidden() {
+ if (b) {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
@@ -60,7 +65,3 @@ void AdvancedFm::showMenuHidden()
fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
-// b=FALSE;
-
- }
- else
- {
+ } else {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
@@ -68,6 +69,4 @@ void AdvancedFm::showMenuHidden()
fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
-// b=TRUE;
}
rePopulate();
-// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true");
b = !b;
@@ -75,18 +74,9 @@ void AdvancedFm::showMenuHidden()
-void AdvancedFm::showHidden()
-{
- if (b)
- {
+void AdvancedFm::showHidden() {
+ if (b) {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
-// fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
-// b=FALSE;
-
- }
- else
- {
+ } else {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
-// fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
-// b=TRUE;
}
@@ -95,10 +85,9 @@ void AdvancedFm::showHidden()
-QString AdvancedFm::dealWithSymName(const QString &fileName)
-{
- QString strItem = fileName;
- return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
+QString AdvancedFm::dealWithSymName(const QString &fileName) {
+ QString strItem = fileName;
+ return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
}
-void AdvancedFm::runThis()
-{
+void AdvancedFm::runThis() {
+ if( !CurrentView()->currentItem()) return;
QString fs;
@@ -113,4 +102,3 @@ void AdvancedFm::runThis()
- if(curFile != "../")
- {
+ if(curFile != "../") {
@@ -118,3 +106,3 @@ void AdvancedFm::runThis()
QFileInfo fileInfo( path + "/" + curFile);
- qDebug( fileInfo.owner());
+// qDebug( fileInfo.owner());
@@ -126,5 +114,3 @@ void AdvancedFm::runThis()
e << curFile;
- }
- else
- {
+ } else {
curFile = path + "/" + curFile;
@@ -132,8 +118,5 @@ void AdvancedFm::runThis()
QString execStr = nf.exec();
- qDebug( execStr);
- if( execStr.isEmpty() )
- {
- }
- else
- {
+// qDebug( execStr);
+ if( execStr.isEmpty() ) {
+ } else {
nf.execute();
@@ -144,7 +127,6 @@ void AdvancedFm::runThis()
-void AdvancedFm::runText()
-{
+void AdvancedFm::runText() {
+ if( !CurrentView()->currentItem()) return;
QString curFile = CurrentView()->currentItem()->text(0);
- if(curFile != "../")
- {
+ if(curFile != "../") {
if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
@@ -157,4 +139,3 @@ void AdvancedFm::runText()
-void AdvancedFm::makeDir()
-{
+void AdvancedFm::makeDir() {
InputDialog *fileDlg;
@@ -162,4 +143,3 @@ void AdvancedFm::makeDir()
fileDlg->exec();
- if( fileDlg->result() == 1 )
- {
+ if( fileDlg->result() == 1 ) {
QDir *thisDir = CurrentDir();
@@ -171,4 +151,3 @@ void AdvancedFm::makeDir()
-void AdvancedFm::doDelete()
-{
+void AdvancedFm::doDelete() {
QStringList curFileList = getPath();
@@ -237,3 +216,3 @@ void AdvancedFm::doDelete()
if( fi.fileName().find("../",0,TRUE)==-1) {
- qDebug("remove link files "+myFile);
+// qDebug("remove link files "+myFile);
@@ -242,3 +221,3 @@ void AdvancedFm::doDelete()
lnk = new DocLnk(f);
- qDebug("Deleting doclnk " + lnk->linkFile());
+// qDebug("Deleting doclnk " + lnk->linkFile());
if(lnk->isValid())
@@ -254,11 +233,9 @@ void AdvancedFm::doDelete()
-void AdvancedFm::filePerms()
-{
- QStringList curFileList = getPath();
- QString filePath;
+void AdvancedFm::filePerms() {
+ QStringList curFileList = getPath();
+ QString filePath;
- filePath = CurrentDir()->canonicalPath()+"/";
+ filePath = CurrentDir()->canonicalPath()+"/";
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
filePermissions *filePerm;
@@ -268,26 +245,24 @@ void AdvancedFm::filePerms()
if( filePerm)
- delete filePerm;
- }
- populateView();
+ delete filePerm;
+ }
+ populateView();
}
-void AdvancedFm::doProperties()
-{
+void AdvancedFm::doProperties() {
#if defined(QT_QWS_OPIE)
- QStringList curFileList = getPath();
+ QStringList curFileList = getPath();
- QString filePath;
- filePath = CurrentDir()->canonicalPath()+"/";
+ QString filePath;
+ filePath = CurrentDir()->canonicalPath()+"/";
- qDebug("%d",curFileList.count());
+// qDebug("%d",curFileList.count());
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
- qDebug((filePath+*it));
- DocLnk lnk( (filePath+*it));
- LnkProperties prop( &lnk );
- prop.showMaximized();
- prop.exec();
- }
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+// qDebug((filePath+*it));
+ DocLnk lnk( (filePath+*it));
+ LnkProperties prop( &lnk );
+ prop.showMaximized();
+ prop.exec();
+ }
#endif
@@ -296,4 +271,3 @@ void AdvancedFm::doProperties()
-void AdvancedFm::upDir()
-{
+void AdvancedFm::upDir() {
QDir *thisDir = CurrentDir();
@@ -310,59 +284,54 @@ void AdvancedFm::upDir()
-void AdvancedFm::copy()
-{
- qApp->processEvents();
- QStringList curFileList = getPath();
+void AdvancedFm::copy() {
+ qApp->processEvents();
+ QStringList curFileList = getPath();
- QDir *thisDir = CurrentDir();
- QDir *thatDir = OtherDir();
-
- bool doMsg=true;
- int count=curFileList.count();
- if( count > 0) {
- if(count > 1 ){
- QString msg;
- msg=tr("Really copy\n%1 files?").arg(count);
- switch ( QMessageBox::warning(this,tr("Copy"),msg
- ,tr("Yes"),tr("No"),0,0,1) )
- {
- case 0:
- doMsg=false;
- break;
- case 1:
- return;
- break;
- };
- }
+ QDir *thisDir = CurrentDir();
+ QDir *thatDir = OtherDir();
- QString curFile, item, destFile;
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
- item=(*it);
- if(item.find("->",0,TRUE)) //symlink
- item = item.left(item.find("->",0,TRUE));
-
- curFile = thisDir->canonicalPath()+"/"+ item;
- destFile = thatDir->canonicalPath()+"/"+ item;
-
- qDebug("Destination file is "+destFile);
- qDebug("CurrentFile file is " + curFile);
-
- QFile f(destFile);
- if( f.exists())
- {
- if(doMsg)
- {
- switch ( QMessageBox::warning(this,tr("File Exists!"),
- tr("%1 exists. Ok to overwrite?").arg( item ),
- tr("Yes"),tr("No"),0,0,1) )
- {
- case 1:
- return;
- break;
- };
- }
+ bool doMsg=true;
+ int count=curFileList.count();
+ if( count > 0) {
+ if(count > 1 ){
+ QString msg;
+ msg=tr("Really copy\n%1 files?").arg(count);
+ switch ( QMessageBox::warning(this,tr("Copy"),msg
+ ,tr("Yes"),tr("No"),0,0,1) )
+ {
+ case 0:
+ doMsg=false;
+ break;
+ case 1:
+ return;
+ break;
+ };
+ }
+
+ QString curFile, item, destFile;
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+ item=(*it);
+ if(item.find("->",0,TRUE)) //symlink
+ item = item.left(item.find("->",0,TRUE));
+
+ curFile = thisDir->canonicalPath()+"/"+ item;
+ destFile = thatDir->canonicalPath()+"/"+ item;
+
+// qDebug("Destination file is "+destFile);
+// qDebug("CurrentFile file is " + curFile);
+
+ QFile f(destFile);
+ if( f.exists()) {
+ if(doMsg) {
+ switch ( QMessageBox::warning(this,tr("File Exists!"),
+ tr("%1 exists. Ok to overwrite?").arg( item ),
+ tr("Yes"),tr("No"),0,0,1) ) {
+ case 1:
+ return;
+ break;
+ };
+ }
f.remove();
- }
+ }
- if( !copyFile( curFile, destFile) ) {
+ if( !copyFile( curFile, destFile) ) {
QMessageBox::message("AdvancedFm",
@@ -370,6 +339,6 @@ void AdvancedFm::copy()
return;
- }
+ }
}
- setOtherTabCurrent();
- populateView();
+ rePopulate();
+ setOtherTabCurrent();
}
@@ -377,15 +346,13 @@ void AdvancedFm::copy()
-void AdvancedFm::copyAs()
-{
- qApp->processEvents();
+void AdvancedFm::copyAs() {
+ qApp->processEvents();
- QStringList curFileList = getPath();
- QString curFile, item;
- InputDialog *fileDlg;
+ QStringList curFileList = getPath();
+ QString curFile, item;
+ InputDialog *fileDlg;
- QDir *thisDir = CurrentDir();
- QDir *thatDir = OtherDir();
+ QDir *thisDir = CurrentDir();
+ QDir *thatDir = OtherDir();
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
QString destFile;
@@ -398,37 +365,33 @@ void AdvancedFm::copyAs()
- if( fileDlg->result() == 1 )
- {
- QString filename = fileDlg->LineEdit1->text();
- destFile = thatDir->canonicalPath()+"/"+filename;
+ if( fileDlg->result() == 1 ) {
+ QString filename = fileDlg->LineEdit1->text();
+ destFile = thatDir->canonicalPath()+"/"+filename;
- QFile f( destFile);
- if( f.exists())
- {
- switch (QMessageBox::warning(this,tr("File Exists!"),
- item+tr("\nexists. Ok to overwrite?"),
- tr("Yes"),tr("No"),0,0,1) )
- {
- case 0:
- f.remove();
- break;
- case 1:
- return;
- break;
- };
- }
- if( !copyFile( curFile, destFile) ) {
- QMessageBox::message("AdvancedFm",tr("Could not copy\n")
- +curFile +tr("to\n")+destFile);
- return;
- }
- }
+ QFile f( destFile);
+ if( f.exists()) {
+ switch (QMessageBox::warning(this,tr("File Exists!"),
+ item+tr("\nexists. Ok to overwrite?"),
+ tr("Yes"),tr("No"),0,0,1) ) {
+ case 0:
+ f.remove();
+ break;
+ case 1:
+ return;
+ break;
+ };
+ }
+ if( !copyFile( curFile, destFile) ) {
+ QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+ +curFile +tr("to\n")+destFile);
+ return;
+ }
+ }
delete fileDlg;
- }
- setOtherTabCurrent();
- populateView();
+ }
+ rePopulate();
+ setOtherTabCurrent();
}
-void AdvancedFm::copySameDir()
-{
+void AdvancedFm::copySameDir() {
qApp->processEvents();
@@ -440,4 +403,3 @@ void AdvancedFm::copySameDir()
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
item=(*it);
@@ -449,4 +411,3 @@ void AdvancedFm::copySameDir()
- if( fileDlg->result() == 1 )
- {
+ if( fileDlg->result() == 1 ) {
@@ -456,4 +417,3 @@ void AdvancedFm::copySameDir()
QFile f(destFile);
- if( f.exists())
- {
+ if( f.exists()) {
switch (QMessageBox::warning(this,tr("Delete"),
@@ -476,3 +436,3 @@ void AdvancedFm::copySameDir()
- qDebug("copy "+curFile+" as "+destFile);
+// qDebug("copy "+curFile+" as "+destFile);
}
@@ -483,4 +443,3 @@ void AdvancedFm::copySameDir()
-void AdvancedFm::move()
-{
+void AdvancedFm::move() {
qApp->processEvents();
@@ -488,4 +447,3 @@ void AdvancedFm::move()
QStringList curFileList = getPath();
- if( curFileList.count() > 0)
- {
+ if( curFileList.count() > 0) {
QString curFile, destFile, item;
@@ -494,4 +452,3 @@ void AdvancedFm::move()
QDir *thatDir = OtherDir();
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
item=(*it);
@@ -502,3 +459,3 @@ void AdvancedFm::move()
destFile += item;
- qDebug("Destination file is "+destFile);
+// qDebug("Destination file is "+destFile);
@@ -508,3 +465,3 @@ void AdvancedFm::move()
curFile+= item;
- qDebug("CurrentFile file is " + curFile);
+// qDebug("CurrentFile file is " + curFile);
@@ -520,10 +477,8 @@ void AdvancedFm::move()
- }
- populateView();
+ }
+ rePopulate();
setOtherTabCurrent();
- populateView();
}
-bool AdvancedFm::copyFile( const QString & src, const QString & dest )
-{
+bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
bool success = true;
@@ -538,3 +493,3 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest )
if(!srcFile.open( IO_ReadOnly|IO_Raw)) {
- qWarning("open failed");
+// qWarning("open failed");
return success = false;
@@ -545,3 +500,3 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest )
if( !destFile.open( IO_WriteOnly|IO_Raw ) ) {
- qWarning("destfile open failed");
+// qWarning("destfile open failed");
return success = false;
@@ -550,3 +505,3 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest )
if(write_fd != -1) {
- err =sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
+ err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
if( err == -1) {
@@ -560,3 +515,3 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest )
success = false;
- qWarning(msg);
+// qWarning(msg);
}
@@ -578,18 +533,17 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest )
-void AdvancedFm::runCommand()
-{
- QDir *thisDir = CurrentDir();
+void AdvancedFm::runCommand() {
+ if( !CurrentView()->currentItem()) return;
+ QDir *thisDir = CurrentDir();
- QString curFile;
- curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0);
+ QString curFile;
+ curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0);
- InputDialog *fileDlg;
- fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
- fileDlg->setInputText(curFile);
- fileDlg->exec();
- //QString command;
+ InputDialog *fileDlg;
+ fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
+ fileDlg->setInputText(curFile);
+ fileDlg->exec();
+ //QString command;
- if( fileDlg->result() == 1 )
- {
- qDebug(fileDlg->LineEdit1->text());
+ if( fileDlg->result() == 1 ) {
+// qDebug(fileDlg->LineEdit1->text());
QStringList command;
@@ -605,40 +559,39 @@ void AdvancedFm::runCommand()
- }
+ }
}
-void AdvancedFm::runCommandStd()
-{
- QString curFile;
- QDir *thisDir = CurrentDir();
- QListView *thisView = CurrentView();
- if( thisView->currentItem())
- curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0);
+void AdvancedFm::runCommandStd() {
+ if( !CurrentView()->currentItem()) return;
+ QString curFile;
+ QDir *thisDir = CurrentDir();
+ QListView *thisView = CurrentView();
+ if( thisView->currentItem())
+ curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0);
- InputDialog *fileDlg;
- fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
- fileDlg->setInputText(curFile);
- fileDlg->exec();
+ InputDialog *fileDlg;
+ fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
+ fileDlg->setInputText(curFile);
+ fileDlg->exec();
- if( fileDlg->result() == 1 )
- {
+ if( fileDlg->result() == 1 ) {
qApp->processEvents();
startProcess( (const QString)fileDlg->LineEdit1->text().latin1());
- }
+ }
}
-void AdvancedFm::fileStatus()
-{
- QString curFile;
- curFile = CurrentView()->currentItem()->text(0);
+void AdvancedFm::fileStatus() {
+ if( !CurrentView()->currentItem()) return;
+ QString curFile;
+ curFile = CurrentView()->currentItem()->text(0);
- QStringList command;
- command << "/bin/sh";
- command << "-c";
- command << "stat -l "+ curFile;
+ QStringList command;
+ command << "/bin/sh";
+ command << "-c";
+ command << "stat -l "+ curFile;
- Output *outDlg;
- outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
- outDlg->showMaximized();
- outDlg->exec();
- qApp->processEvents();
+ Output *outDlg;
+ outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
+ outDlg->showMaximized();
+ outDlg->exec();
+ qApp->processEvents();
}
@@ -646,4 +599,3 @@ void AdvancedFm::fileStatus()
-void AdvancedFm::mkDir()
-{
+void AdvancedFm::mkDir() {
makeDir();
@@ -651,4 +603,3 @@ void AdvancedFm::mkDir()
-void AdvancedFm::rn()
-{
+void AdvancedFm::rn() {
renameIt();
@@ -656,4 +607,3 @@ void AdvancedFm::rn()
-void AdvancedFm::del()
-{
+void AdvancedFm::del() {
doDelete();
@@ -661,8 +611,6 @@ void AdvancedFm::del()
-void AdvancedFm::mkSym()
-{
+void AdvancedFm::mkSym() {
QString cmd;
QStringList curFileList = getPath();
- if( curFileList.count() > 0)
- {
+ if( curFileList.count() > 0) {
QDir *thisDir = CurrentDir();
@@ -670,8 +618,6 @@ void AdvancedFm::mkSym()
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
QString destName = thatDir->canonicalPath()+"/"+(*it);
- if(destName.right(1) == "/")
- {
+ if(destName.right(1) == "/") {
destName = destName.left( destName.length() -1);
@@ -681,4 +627,3 @@ void AdvancedFm::mkSym()
- if( curFile.right(1) == "/")
- {
+ if( curFile.right(1) == "/") {
curFile = curFile.left( curFile.length() -1);
@@ -687,7 +632,7 @@ void AdvancedFm::mkSym()
cmd = "ln -s "+curFile+" "+destName;
- qDebug(cmd);
+// qDebug(cmd);
startProcess( (const QString)cmd );
}
+ rePopulate();
setOtherTabCurrent();
- populateView();
}
@@ -695,4 +640,3 @@ void AdvancedFm::mkSym()
-void AdvancedFm::doBeam()
-{
+void AdvancedFm::doBeam() {
Ir ir;
@@ -716,4 +660,3 @@ void AdvancedFm::doBeam()
-void AdvancedFm::fileBeamFinished( Ir *)
-{
+void AdvancedFm::fileBeamFinished( Ir *) {
QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
@@ -721,5 +664,3 @@ void AdvancedFm::fileBeamFinished( Ir *)
-void AdvancedFm::selectAll()
-{
-// if (TabWidget->currentTab() == 0) {
+void AdvancedFm::selectAll() {
QListView *thisView = CurrentView();
@@ -727,10 +668,5 @@ void AdvancedFm::selectAll()
thisView->setSelected( thisView->firstChild(),false);
-// } else {
-// Remote_View->selectAll(true);
-// Remote_View->setSelected( Remote_View->firstChild(),false);
-// }
}
-void AdvancedFm::startProcess(const QString & cmd)
-{
+void AdvancedFm::startProcess(const QString & cmd) {
QStringList command;
@@ -752,5 +688,3 @@ void AdvancedFm::startProcess(const QString & cmd)
-void AdvancedFm::processEnded(OProcess *)
-{
-// populateLocalView();
+void AdvancedFm::processEnded(OProcess *) {
populateView();
@@ -758,23 +692,15 @@ void AdvancedFm::processEnded(OProcess *)
-void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int buflen) {
- qWarning("received stderrt %d bytes", buflen);
+void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
+// qWarning("received stderrt %d bytes", buflen);
QString lineStr = buffer;
-// lineStr=lineStr.left(lineStr.length()-1);
QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
-
-// OutputEdit->append(lineStr);
-// OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
}
-bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
-{
- if ( o->inherits( "QLineEdit" ) )
- {
- if ( e->type() == QEvent::KeyPress )
- {
+bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
+ if ( o->inherits( "QLineEdit" ) ) {
+ if ( e->type() == QEvent::KeyPress ) {
QKeyEvent *ke = (QKeyEvent*)e;
if ( ke->key() == Key_Return ||
- ke->key() == Key_Enter )
- {
+ ke->key() == Key_Enter ) {
okRename();
@@ -782,4 +708,3 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
}
- else if ( ke->key() == Key_Escape )
- {
+ else if ( ke->key() == Key_Escape ) {
cancelRename();
@@ -788,4 +713,3 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
}
- else if ( e->type() == QEvent::FocusOut )
- {
+ else if ( e->type() == QEvent::FocusOut ) {
cancelRename();
@@ -794,10 +718,13 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
}
- if ( o->inherits( "QListView" ) )
- {
- if ( e->type() == QEvent::FocusOut )
- {
- printf("focusIn\n");
-
- }
- }
+ if ( o->inherits( "QListView" ) ) {
+ if ( e->type() == QEvent::FocusIn ) {
+ if( o == Local_View) { //keep track of which view
+ whichTab=1;
+ }
+ else {
+ whichTab=2;
+ }
+ }
+ OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection
+ }
@@ -807,5 +734,4 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
-void AdvancedFm::cancelRename()
-{
- qDebug("cancel rename");
+void AdvancedFm::cancelRename() {
+// qDebug("cancel rename");
QListView * view;
@@ -816,4 +742,3 @@ void AdvancedFm::cancelRename()
renameBox = 0;
- if ( resetFocus )
- {
+ if ( resetFocus ) {
view->viewport()->setFocusProxy( view);
@@ -823,4 +748,4 @@ void AdvancedFm::cancelRename()
-void AdvancedFm::doRename(QListView * view)
-{
+void AdvancedFm::doRename(QListView * view) {
+ if( !CurrentView()->currentItem()) return;
@@ -844,3 +769,2 @@ void AdvancedFm::doRename(QListView * view)
renameBox->show();
-
}
@@ -848,5 +772,5 @@ void AdvancedFm::doRename(QListView * view)
-void AdvancedFm::renameIt()
-{
- QListView *thisView = CurrentView();
+void AdvancedFm::renameIt() {
+ if( !CurrentView()->currentItem()) return;
+ QListView *thisView = CurrentView();
oldName = thisView->currentItem()->text(0);
@@ -856,22 +780,19 @@ void AdvancedFm::renameIt()
-void AdvancedFm::okRename()
-{
- QString newName = renameBox->text();
- cancelRename();
-// int tabs=0;
- QListView * view = CurrentView();
- QString path = CurrentDir()->canonicalPath() + "/";
- oldName = path + oldName;
- newName = path + newName;
-
- if( view->currentItem() == NULL)
- return;
- if( rename( oldName.latin1(), newName.latin1())== -1)
- QMessageBox::message(tr("Note"),tr("Could not rename"));
- else
- oldName = "";
-
- view->takeItem( view->currentItem() );
- delete view->currentItem();
- populateView();
+void AdvancedFm::okRename() {
+ if( !CurrentView()->currentItem()) return;
+ QString newName = renameBox->text();
+ cancelRename();
+ QListView * view = CurrentView();
+ QString path = CurrentDir()->canonicalPath() + "/";
+ oldName = path + oldName;
+ newName = path + newName;
+
+ if( rename( oldName.latin1(), newName.latin1())== -1)
+ QMessageBox::message(tr("Note"),tr("Could not rename"));
+ else
+ oldName = "";
+
+ view->takeItem( view->currentItem() );
+ delete view->currentItem();
+ populateView();
}
@@ -879,3 +800,3 @@ void AdvancedFm::okRename()
void AdvancedFm::openSearch() {
-
+ QMessageBox::message(tr("Note"),tr("Not Yet Implemented"));
}