summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-02-24 03:53:24 (UTC)
committer llornkcor <llornkcor>2003-02-24 03:53:24 (UTC)
commit009b85e8daa341d4a2fc62404f4a58715e775b86 (patch) (side-by-side diff)
tree754ec3b77412e22c90b1da7d68c609436189dcfd
parent04470810d71cc8aa3ddde193559312fd3ecc7a11 (diff)
downloadopie-009b85e8daa341d4a2fc62404f4a58715e775b86.zip
opie-009b85e8daa341d4a2fc62404f4a58715e775b86.tar.gz
opie-009b85e8daa341d4a2fc62404f4a58715e775b86.tar.bz2
whoops
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 062a013..f46503c 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -1,282 +1,282 @@
/***************************************************************************
AdvancedFm.cpp
-------------------
** Created: Sat Mar 9 23:33:09 2002
copyright : (C) 2002 by ljp
email : ljp@llornkcor.com
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "advancedfm.h"
#include "output.h"
#include "filePermissions.h"
#include <opie/otabwidget.h>
#include <opie/oprocess.h>
#include <qpe/lnkproperties.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpemenubar.h>
#include <qpe/qpetoolbar.h>
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/applnk.h>
#include <qpe/ir.h>
#include <qmessagebox.h>
#include <qmultilineedit.h>
#include <qstring.h>
#include <qlayout.h>
#include <qpixmap.h>
#include <qcombobox.h>
#include <qpopupmenu.h>
#include <qtabwidget.h>
#include <qtoolbutton.h>
#include <qtabwidget.h>
#include <qlineedit.h>
#include <qlistview.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
void AdvancedFm::doDirChange()
{
ListClicked( CurrentView()->currentItem());
}
void AdvancedFm::showMenuHidden()
{
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
{
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;
}
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);
OtherDir()->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);
-s OtherDir()->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;
}
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();
QString curFile = CurrentView()->currentItem()->text(0);
QString path = thisDir->canonicalPath();
if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
curFile = dealWithSymName((const QString&)curFile);
if(curFile != "../")
{
fs = getFileSystemType((const QString &) path);
QFileInfo fileInfo( path + "/" + curFile);
qDebug( fileInfo.owner());
if( (fileInfo.permission( QFileInfo::ExeUser)
| fileInfo.permission( QFileInfo::ExeGroup)
| fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
| fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
QCopEnvelope e("QPE/System", "execute(QString)" );
e << curFile;
}
else
{
curFile = path + "/" + curFile;
DocLnk nf(curFile);
QString execStr = nf.exec();
qDebug( execStr);
if( execStr.isEmpty() )
{
}
else
{
nf.execute();
}
}
}
}
void AdvancedFm::runText()
{
QString curFile = CurrentView()->currentItem()->text(0);
if(curFile != "../")
{
if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
curFile = dealWithSymName((const QString&)curFile);
curFile = CurrentDir()->canonicalPath()+"/"+curFile;
QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
e << curFile;
}
}
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();
}
void AdvancedFm::doDelete()
{
QStringList curFileList = getPath();
bool doMsg=true;
int count = curFileList.count();
if( count > 0)
{
if(count > 1 )
{
QString msg;
msg=tr("Really delete\n%1 files?").arg(count);
switch ( QMessageBox::warning(this,tr("Delete"),msg
,tr("Yes"),tr("No"),0,0,1) )
{
case 0:
doMsg=false;
break;
case 1:
return;
break;
};
}
QString myFile;
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
{
myFile = (*it);
if( myFile.find(" -> ",0,TRUE) != -1)
myFile = myFile.left( myFile.find(" -> ",0,TRUE));
QString f = CurrentDir()->canonicalPath();
if(f.right(1).find("/",0,TRUE) == -1)
f += "/";
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();
}
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();
}
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();
}
void AdvancedFm::doProperties()
{
#if defined(QT_QWS_OPIE)
QStringList curFileList = getPath();
QString filePath;
filePath = CurrentDir()->canonicalPath()+"/";
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();