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.cpp102
1 files changed, 41 insertions, 61 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 13dad33..c553017 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -59,46 +59,46 @@ void AdvancedFm::showMenuHidden()
currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
// b=FALSE;
}
else
{
currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
// b=TRUE;
}
- populateLocalView();
- populateRemoteView();
+ populateView();
+// populateRemoteView();
// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true");
if(b) b = false; else b = true;
}
void AdvancedFm::showHidden()
{
if (b)
{
CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
// fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
// b=FALSE;
}
else
{
CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
// fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
// b=TRUE;
}
- PopulateView();
+ populateView();
}
QString AdvancedFm::dealWithSymName(const QString &fileName)
{
QString strItem = fileName;
return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
}
void AdvancedFm::runThis()
{
QString fs;
QDir *thisDir = CurrentDir();
@@ -156,25 +156,25 @@ void AdvancedFm::runText()
void AdvancedFm::makeDir()
{
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 )
{
QDir *thisDir = CurrentDir();
QString filename = fileDlg->LineEdit1->text();
thisDir->mkdir( thisDir->canonicalPath()+"/"+filename);
}
- PopulateView();
+ populateView();
}
void AdvancedFm::doDelete()
{
QStringList curFileList = getPath();
bool doMsg=true;
int count = curFileList.count();
if( count > 0)
{
if(count > 1 )
{
@@ -205,68 +205,68 @@ void AdvancedFm::doDelete()
f += myFile;
if(QDir(f).exists() && !QFileInfo(f).isSymLink() )
{
switch ( QMessageBox::warning( this, tr("Delete Directory?"), tr("Really delete\n") + f +
"\nand all it's contents ?"
,tr("Yes"),tr("No"),0,0,1) )
{
case 0:
{
f=f.left(f.length()-1);
QString cmd="rm -rf "+f;
startProcess( (const QString)cmd.latin1() );
- PopulateView();
+ populateView();
}
break;
case 1:
// exit
break;
};
} else {
if(doMsg) {
switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f
+" ?",tr("Yes"),tr("No"),0,0,1) ) {
case 1:
return;
break;
};
}
QString cmd="rm "+f;
QFile file(f);
if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1)
file.remove();
}
}
}
- PopulateView();
+ populateView();
}
void AdvancedFm::filePerms()
{
QStringList curFileList = getPath();
QString filePath;
filePath = CurrentDir()->canonicalPath()+"/";
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
{
filePermissions *filePerm;
filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
filePerm->showMaximized();
filePerm->exec();
if( filePerm)
delete filePerm;
}
- PopulateView();
+ populateView();
}
void AdvancedFm::doProperties()
{
#if defined(QT_QWS_OPIE)
QStringList curFileList = getPath();
QString filePath;
filePath = CurrentDir()->canonicalPath()+"/";
qDebug("%d",curFileList.count());
@@ -284,25 +284,25 @@ void AdvancedFm::doProperties()
}
void AdvancedFm::upDir()
{
QDir *thisDir = CurrentDir();
QString current = thisDir->canonicalPath();
QDir dir(current);
dir.cdUp();
current = dir.canonicalPath();
chdir( current.latin1() );
thisDir->cd( current, TRUE);
- PopulateView();
+ populateView();
update();
}
void AdvancedFm::copy()
{
qApp->processEvents();
QStringList curFileList = getPath();
QDir *thisDir = CurrentDir();
QDir *thatDir = OtherDir();
bool doMsg=true;
@@ -351,27 +351,26 @@ void AdvancedFm::copy()
};
}
f.remove();
}
if( !copyFile( curFile, destFile) )
{
QMessageBox::message("AdvancedFm",
tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) );
return;
}
}
-
- PopulateView();
-// TabWidget->setCurrentTab(1);
+ setOtherTabCurrent();
+ populateView();
}
}
void AdvancedFm::copyAs()
{
qApp->processEvents();
QStringList curFileList = getPath();
QString curFile, item;
InputDialog *fileDlg;
QDir *thisDir = CurrentDir();
@@ -408,25 +407,26 @@ void AdvancedFm::copyAs()
};
}
if( !copyFile( curFile, destFile) )
{
QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+curFile +tr("to\n")+destFile);
return;
}
}
delete fileDlg;
}
- PopulateView();
+ setOtherTabCurrent();
+ populateView();
}
void AdvancedFm::copySameDir()
{
qApp->processEvents();
QStringList curFileList = getPath();
QString curFile, item, destFile;
InputDialog *fileDlg;
QDir *thisDir = CurrentDir();
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
@@ -461,25 +461,25 @@ void AdvancedFm::copySameDir()
}
if(!copyFile( curFile,destFile) )
{
QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+curFile +tr("to\n")+destFile);
return;
}
qDebug("copy "+curFile+" as "+destFile);
}
delete fileDlg;
}
- PopulateView();
+ populateView();
}
void AdvancedFm::move()
{
qApp->processEvents();
QStringList curFileList = getPath();
if( curFileList.count() > 0)
{
QString curFile, destFile, item;
QDir *thisDir = CurrentDir();
@@ -503,26 +503,27 @@ void AdvancedFm::move()
QFile f( curFile);
if( f.exists()) {
if( !copyFile( curFile, destFile) )
{
QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile);
return;
} else
QFile::remove(curFile);
}
}
}
- populateRemoteView();
- populateLocalView();
+ setOtherTabCurrent();
+ populateView();
+// populateLocalView();
}
bool AdvancedFm::copyFile( const QString & src, const QString & dest )
{
char bf[ 50000 ];
int bytesRead;
bool success = TRUE;
struct stat status;
QFile s( src );
QFile d( dest );
@@ -634,81 +635,60 @@ void AdvancedFm::rn()
void AdvancedFm::del()
{
doDelete();
}
void AdvancedFm::mkSym()
{
QString cmd;
QStringList curFileList = getPath();
if( curFileList.count() > 0)
{
- if ( whichTab == 1)
- {
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
+ QDir *thisDir = CurrentDir();
+ QDir * thatDir = OtherDir();
- QString destName = currentRemoteDir.canonicalPath()+"/"+(*it);
- if(destName.right(1) == "/")
- {
- destName = destName.left( destName.length() -1);
- }
- QString curFile = currentDir.canonicalPath()+"/"+(*it);
- if( curFile.right(1) == "/")
- {
- curFile = curFile.left( curFile.length() -1);
- }
- cmd = "ln -s "+curFile+" "+destName;
- qDebug(cmd);
- startProcess( (const QString)cmd );
- }
- populateRemoteView();
- TabWidget->setCurrentTab(1);
- }
- else
+ 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) == "/")
{
+ destName = destName.left( destName.length() -1);
+ }
- QString destName = currentDir.canonicalPath()+"/"+(*it);
- if(destName.right(1) == "/")
- {
- destName = destName.left( destName.length() -1);
- }
- QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
- if( curFile.right(1) == "/")
- {
- curFile = curFile.left( curFile.length() -1);
- }
+ QString curFile = thisDir->canonicalPath()+"/"+(*it);
- cmd = "ln -s "+curFile+" "+destName;
- qDebug(cmd);
- startProcess( (const QString)cmd );
- }
- populateLocalView();
- TabWidget->setCurrentTab(0);
- }
- }
+ if( curFile.right(1) == "/")
+ {
+ curFile = curFile.left( curFile.length() -1);
+ }
+
+ cmd = "ln -s "+curFile+" "+destName;
+ qDebug(cmd);
+ startProcess( (const QString)cmd );
+ }
+ setOtherTabCurrent();
+ populateView();
+ }
}
void AdvancedFm::doBeam()
{
Ir ir;
if(!ir.supported())
{
}
else
{
-
QStringList curFileList = getPath();
if( curFileList.count() > 0)
{
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
{
QString curFile = CurrentDir()->canonicalPath()+"/"+(*it);
if( curFile.right(1) == "/")
{
curFile = curFile.left( curFile.length() -1);
}
Ir *file = new Ir(this, "IR");
@@ -746,26 +726,26 @@ void AdvancedFm::startProcess(const QString & cmd)
this, SLOT( processEnded()));
command << "/bin/sh";
command << "-c";
command << cmd.latin1();
*process << command;
if(!process->start(OProcess::NotifyOnExit) )
qDebug("could not start process");
}
void AdvancedFm::processEnded()
{
- populateLocalView();
- populateRemoteView();
+// populateLocalView();
+ populateView();
}
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 )
{
@@ -834,36 +814,36 @@ void AdvancedFm::doRename(QListView * view)
view->viewport()->setFocusProxy( renameBox );
renameBox->setFocus();
renameBox->show();
}
void AdvancedFm::renameIt()
{
QListView *thisView = CurrentView();
oldName = thisView->currentItem()->text(0);
doRename( thisView );
- PopulateView();
+ populateView();
}
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();
+ populateView();
}