summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp41
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp2
3 files changed, 7 insertions, 37 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index ec7a08a..f1be471 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,39 +1,42 @@
/***************************************************************************
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. *
***************************************************************************/
#define DEVELOPERS_VERSION
#include "advancedfm.h"
#include <opie2/odebug.h>
+
+#include <opie2/ostorageinfo.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 )
@@ -189,66 +192,51 @@ void AdvancedFm::populateView() {
// odebug << mydirent->d_name << oendl;
fileL.sprintf("%s", mydirent->d_name);
devT = buf.st_dev;
fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
fileDate.sprintf("%s", ctime( &buf.st_mtime));
if( fileL.find(".") == -1 ) {
item= new QListViewItem( thisView, fileL, fileS, fileDate);
pm = unknownXpm;
item->setPixmap( 0,pm);
}
}
closedir(dir);
}
thisView->setSorting( 3,FALSE);
fillCombo( (const QString &) path );
}
void AdvancedFm::rePopulate() {
// qDebug("repopulate views");
populateView();
setOtherTabCurrent();
populateView();
-
-// int tmpTab = whichTab;
-// // odebug << "" << tmpTab << "" << oendl;
-
-// for(int i =1; i < 3; i++) {
-// TabWidget->setCurrentWidget(i - 1);
-// populateView();
-// }
-// TabWidget->setCurrentWidget( tmpTab - 1);
}
void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
-// if ( TabWidget->currentWidget() == tab)
-// qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local");
-// else
-// qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote");
-
-
if(selectedItem) {
QString strItem=selectedItem->text(0);
// owarn << strItem << oendl;
QString strSize=selectedItem->text(1);
strSize=strSize.stripWhiteSpace();
bool isDirectory = false;
QString strItem2;
if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink
strItem2 = dealWithSymName((const QString&)strItem);
if(QDir(strItem2).exists() )
strItem = strItem2;
}
if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
if(QDir(strItem).exists())
isDirectory = true;
}
if( isDirectory ) {
CurrentDir()->cd( strItem, TRUE);
populateView();
CurrentView()->ensureItemVisible( CurrentView()->firstChild());
@@ -256,49 +244,48 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
chdir( strItem.latin1());
}
}
void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) {
Q_UNUSED(item);
switch (mouse) {
case 1:
{
if(renameBox != 0 ) {
cancelRename();
}
}
break;
// case 2:
// menuTimer.start( 50, TRUE );
// break;
};
}
void AdvancedFm::refreshCurrentTab() {
populateView();
// if ( TabWidget->currentWidget() == tab) {
-
}
void AdvancedFm::switchToLocalTab() {
TabWidget->setCurrentWidget(0);
// Local_View->setFocus();
whichTab = 1;
}
void AdvancedFm::switchToRemoteTab() {
TabWidget->setCurrentWidget(1);
// Remote_View->setFocus();
whichTab = 2;
}
void AdvancedFm::currentPathComboChanged() {
QString pDir = currentPathCombo->lineEdit()->text();
if(QDir(pDir).exists()) {
CurrentDir()->setPath(pDir );
populateView();
} else {
QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir));
}
}
@@ -331,56 +318,55 @@ QStringList AdvancedFm::getPath() {
if ( it.current()->isSelected() ) {
strList << it.current()->text(0);
// odebug << it.current()->text(0) << oendl;
}
}
return strList;
}
void AdvancedFm::changeTo(const 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
+ Opie::Core::OStorageInfo info;
+ changeTo(info.sdPath());
}
void AdvancedFm::CFButtonPushed() {
- if(zaurusDevice)
- changeTo("/mnt/cf"); //zaurus
- else
- changeTo("/mnt/hda"); //ipaq
+ Opie::Core::OStorageInfo info;
+ changeTo(info.cfPath());
}
void AdvancedFm::QPEButtonPushed() {
changeTo(QPEApplication::qpeDir());
}
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) {
Q_UNUSED(e);
}
void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
// if( CurrentView()->hasFocus() )
// e->ignore();
if( currentPathCombo->lineEdit()->hasFocus()) {
// qDebug("shout!");
}
else if( e->key() == Key_Left )
upDir();
else if( e->key() == Key_Return || e->key() == Key_Enter)
@@ -749,50 +735,37 @@ QListView * AdvancedFm::OtherView() {
void AdvancedFm::setOtherTabCurrent() {
// qDebug("setOtherTabCurrent() %d",whichTab);
if ( whichTab == 1) {
TabWidget->setCurrentWidget(1);
} else {
TabWidget->setCurrentWidget(0);
}
// OtherView()->setFocus();
OtherView()->setSelected( CurrentView()->firstChild(), true);
}
void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
// odebug << "qcop message "+msg << oendl;
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "openDirectory(QString)" ) {
// odebug << "received" << oendl;
QString file;
stream >> file;
changeTo( (const QString &) file);
}
}
void AdvancedFm::setDocument(const QString &file) {
changeTo( file);
-
}
-void AdvancedFm::findFile(const QString &fileName) {
- QFileInfo fi(fileName);
- QListView *thisView = CurrentView();
- QListViewItemIterator it( thisView );
- for ( ; it.current(); ++it ) {
- if(it.current()->text(0) == fi.fileName()) {
- it.current()->setSelected(true);
- thisView->ensureItemVisible(it.current());
- }
- }
-}
-
void AdvancedFm::slotSwitchMenu(int item) {
Q_UNUSED(item);
// qDebug( "Switch %d",item);
// viewMenu->setItemChecked(item, true);
}
void AdvancedFm::navigateToSelected() {
if( !CurrentView()->currentItem()) return;
doDirChange();
}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 6f7eb96..42f3bc6 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -156,37 +156,36 @@ protected slots:
void fillCombo(const QString &);
bool copyFile( const QString & , const QString & );
void fileStatus();
void doAbout();
void doBeam();
void fileBeamFinished( Ir *);
bool copyDirectory( const QString & , const QString & );
// void navigateToSelected();
bool moveDirectory( const QString & , const QString & );
// void slotSwitchtoLocal(int);
private:
MenuButton *menuButton;
QString oldName, localViewDir, remoteViewDir;
void startProcess(const QString &);
bool eventFilter( QObject * , QEvent * );
void cancelRename();
void doRename(QListView *);
void okRename();
void customDirsToMenu();
void addCustomDir();
void removeCustomDir();
void navigateToSelected();
- void findFile(const QString &);
private slots:
void processEnded(Opie::Core::OProcess *);
void oprocessStderr(Opie::Core::OProcess *, char *, int);
void gotoCustomDir(const QString &);
void qcopReceive(const QCString&, const QByteArray&);
void setDocument(const QString &);
// void doMenu(int
};
#endif // ADVANCEDFM_H
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index 1047c5a..9be0ceb 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -35,50 +35,48 @@ using namespace Opie::Ui;
void AdvancedFm::init() {
b = false;
setCaption( tr( "AdvancedFm" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setSpacing( 2);
layout->setMargin( 0); // squeeze
QMenuBar *menuBar = new QMenuBar(this);
menuBar->setMargin( 0 ); // squeeze
fileMenu = new QPopupMenu( this );
viewMenu = new QPopupMenu( this );
// customDirMenu = new QPopupMenu( this );
layout->addWidget( menuBar );
menuBar->insertItem( tr( "File" ), fileMenu);
menuBar->insertItem( tr( "View" ), viewMenu);
cdUpButton = new QToolButton( 0,"cdUpButton");
cdUpButton->setPixmap(Resource::loadPixmap("up"));
cdUpButton->setAutoRaise( true );
menuBar->insertItem( cdUpButton );
-
-
qpeDirButton= new QToolButton( 0,"QPEButton");
qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
qpeDirButton->setAutoRaise( true );
menuBar->insertItem( qpeDirButton );
cfButton = new QToolButton( 0, "CFButton");
cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
cfButton->setAutoRaise( true );
menuBar->insertItem( cfButton );
sdButton = new QToolButton( 0, "SDButton");
sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard"));
sdButton->setAutoRaise( true );
menuBar->insertItem( sdButton );
docButton = new QToolButton( 0,"docsButton");
docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
docButton->setAutoRaise( true );
menuBar->insertItem( docButton );
homeButton = new QToolButton( 0, "homeButton");
homeButton->setPixmap(Resource::loadPixmap("home"));
homeButton->setAutoRaise( true );
menuBar->insertItem( homeButton );