summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-09-25 04:38:48 (UTC)
committer llornkcor <llornkcor>2004-09-25 04:38:48 (UTC)
commit4eab17fb1381c938188e13ec5025b8302b159c9e (patch) (side-by-side diff)
treebb8d1c5e52e59d8e1683da3dab08d20177e684f7
parent037acb8741eabb71693104f7807ffd848ac4d1f9 (diff)
downloadopie-4eab17fb1381c938188e13ec5025b8302b159c9e.zip
opie-4eab17fb1381c938188e13ec5025b8302b159c9e.tar.gz
opie-4eab17fb1381c938188e13ec5025b8302b159c9e.tar.bz2
opti function and fix
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp87
-rw-r--r--noncore/apps/advancedfm/advancedfm.h2
2 files changed, 24 insertions, 65 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index fec320d..73d0d57 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -15,65 +15,65 @@
#include <opie2/odebug.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/mimetype.h>
#include <qpe/applnk.h>
#include <qpe/resource.h>
#include <qpe/menubutton.h>
#include <qcombobox.h>
#include <qpopupmenu.h>
#include <qlistview.h>
#include <qmessagebox.h>
#include <qlineedit.h>
#include <sys/stat.h>
#include <time.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/vfs.h>
#include <mntent.h>
using namespace Opie::Ui;
AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
: QMainWindow( ) {
init();
renameBox = 0;
unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() );
initConnections();
- populateView();
+ rePopulate();
channel = new QCopChannel( "QPE/Application/advancedfm", this );
connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&)));
switchToLocalTab();
}
AdvancedFm::~AdvancedFm() {
}
void AdvancedFm::cleanUp() {
QString sfile=QDir::homeDirPath();
if(sfile.right(1) != "/")
sfile+="/._temp";
else
sfile+="._temp";
QFile file( sfile);
if(file.exists())
file.remove();
}
void AdvancedFm::tabChanged(QWidget *wd) {
// qDebug("tabChanged");
if(wd == tab) {
whichTab = 1;
// qDebug("tabchanged: LOCAL VIEW SHOWN");
}
else if(wd == tab_2) {
whichTab = 2;
// qDebug("tabchanged: REMOTE VIEW SHOWN");
}
qApp->processEvents();
QString path = CurrentDir()->canonicalPath();
@@ -345,150 +345,109 @@ QStringList AdvancedFm::getPath() {
void AdvancedFm::changeTo(QString dir) {
chdir( dir.latin1());
CurrentDir()->cd(dir, TRUE);
populateView();
update();
}
void AdvancedFm::homeButtonPushed() {
changeTo(QDir::homeDirPath());
}
void AdvancedFm::docButtonPushed() {
changeTo(QPEApplication::documentDir());
}
void AdvancedFm::SDButtonPushed() {
changeTo("/mnt/card");// this can change so fix
}
void AdvancedFm::CFButtonPushed() {
if(zaurusDevice)
changeTo("/mnt/cf"); //zaurus
else
changeTo("/mnt/hda"); //ipaq
}
void AdvancedFm::doAbout() {
QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>"));
}
void AdvancedFm::keyPressEvent( QKeyEvent *e) {
-// owarn << "key " << e->key() << "" << oendl;
-// if( CurrentView()->hasFocus() )
- {
- switch ( e->key() ) {
- case Key_Left:
+ if( e->key() == Key_Left )
upDir();
- break;
- case Key_Next:
- break;
- case Key_Return:
- case Key_Enter:
+ else if( e->key() == Key_Return || e->key() == Key_Enter)
navigateToSelected();
- break;
- case Key_Tab: {
+ else if( e->key() == Key_Tab)
setOtherTabCurrent();
- }
- break;
- case Key_Delete:
+ else if( e->key() == Key_Delete )
del();
- break;
- case Key_A:
+ else if( e->key() == Key_A)
copyAs();
- break;
- case Key_C:
+ else if( e->key() == Key_C)
copy();
- break;
- case Key_E:
+ else if( e->key() == Key_E)
runThis();
- break;
- case Key_G:
- {
+ else if( e->key() == Key_G)
currentPathCombo->lineEdit()->setFocus();
- }
- break;
-
- case Key_H:
+ else if( e->key() == Key_H )
showHidden();
- break;
- case Key_I:
+ else if( e->key() == Key_I)
fileStatus();
- break;
- case Key_M:
+ else if( e->key() == Key_M)
move();
- break;
- case Key_N:
+ else if( e->key() == Key_N )
mkDir();
- break;
- case Key_P:
+ else if( e->key() == Key_P)
filePerms();
- break;
- case Key_R:
+ else if( e->key() == Key_R )
rn();
- break;
- case Key_U:
+ else if( e->key() == Key_U )
upDir();
- break;
- case Key_1:
+ else if( e->key() == Key_1)
switchToLocalTab();
- break;
- case Key_2:
+ else if( e->key() == Key_2)
switchToRemoteTab();
- break;
- case Key_3:
+ else if( e->key() == Key_3)
CFButtonPushed();
- break;
- case Key_4:
+ else if( e->key() == Key_4)
SDButtonPushed();
- break;
- case Key_5:
+ else if( e->key() == Key_5 )
homeButtonPushed();
- break;
- case Key_6:
+ else if( e->key() == Key_6 )
docButtonPushed();
- break;
- case Key_7:
- break;
- case Key_8:
- break;
- case Key_9:
- break;
- case Key_0:
- break;
- };
+ else
e->accept();
}
-}
void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
if( CurrentView()->hasFocus() )
e->ignore();
}
void AdvancedFm::QPEButtonPushed() {
QString current = QPEApplication::qpeDir();
chdir( current.latin1() );
CurrentDir()->cd( current, TRUE);
populateView();
update();
}
void AdvancedFm::parsetab(const QString &fileName) {
fileSystemTypeList.clear();
fsList.clear();
struct mntent *me;
FILE *mntfp = setmntent( fileName.latin1(), "r" );
if ( mntfp ) {
while ( (me = getmntent( mntfp )) != 0 ) {
QString deviceName = me->mnt_fsname;
QString filesystemType = me->mnt_type;
QString mountDir = me->mnt_dir;
if(deviceName != "none") {
if( fsList.contains(filesystemType) == 0
& filesystemType.find("proc",0,TRUE) == -1
& filesystemType.find("cramfs",0,TRUE) == -1
& filesystemType.find("auto",0,TRUE) == -1)
fsList << filesystemType;
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index c52b853..b109364 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -68,65 +68,65 @@ protected:
QListView *Local_View, *Remote_View;
QLineEdit *currentPathEdit;
QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/;
QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
QDir currentDir, currentRemoteDir;
QComboBox *currentPathCombo;
QString filterStr, s_addBookmark, s_removeBookmark;
QListViewItem * item;
bool b;
QStringList fileSystemTypeList, fsList;
int currentServerConfig;
bool zaurusDevice;
QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
QStringList remoteDirPathStringList, localDirPathStringList;
QLineEdit *renameBox;
void init();
void initConnections();
void keyReleaseEvent( QKeyEvent *);
void keyPressEvent( QKeyEvent *);
QString getFileSystemType(const QString &);
QString getDiskSpace(const QString &);
void parsetab(const QString &fileName);
QString checkDiskSpace(const QString &);
QString dealWithSymName(const QString &);
QDir *CurrentDir();
QDir *OtherDir();
QListView *CurrentView();
QListView *OtherView();
void setOtherTabCurrent();
- void changeTo(QString & dir);
+ void changeTo(QString dir);
//protected signals:
// void newPath(QString);
protected slots:
void slotSwitchMenu(int);
void selectAll();
void addToDocs();
void doDirChange();
void mkDir();
void del();
void rn();
void populateView();
void rePopulate();
void showHidden();
void showMenuHidden();
void ListClicked(QListViewItem *);
void ListPressed( int, QListViewItem *, const QPoint&, int);
void makeDir();
void doDelete();
void tabChanged(QWidget*);
void cleanUp();
void renameIt();
void runThis();
void runText();
void filePerms();
void doProperties();
void runCommand();
void runCommandStd();
QStringList getPath();
void mkSym();
void switchToLocalTab();