summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp66
-rw-r--r--noncore/apps/advancedfm/advancedfm.h3
2 files changed, 19 insertions, 50 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 02898de..fec320d 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -23,60 +23,51 @@
#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();
-
- whichTab = 1;
- populateView();
-// rePopulate();
-// currentPathCombo->setFocus();
+ populateView();
channel = new QCopChannel( "QPE/Application/advancedfm", this );
connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&)));
-
-// if( CurrentView() == Local_View)
-// qDebug("LOCAL VIEW");
-// else
-// qDebug("REMOTE VIEW");
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");
}
@@ -269,68 +260,57 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
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() {
- qDebug("switchToLocal ");
- TabWidget->setCurrentWidget(0);
- Local_View->setFocus();
- whichTab = 1;
-
+ TabWidget->setCurrentWidget(0);
+ Local_View->setFocus();
+ whichTab = 1;
}
void AdvancedFm::switchToRemoteTab() {
- qDebug("switchToRemoteTab() ");
- TabWidget->setCurrentWidget(1);
- Remote_View->setFocus();
- whichTab = 2;
-}
-
-void AdvancedFm::readConfig() {
- Config cfg("AdvancedFm");
-}
-
-void AdvancedFm::writeConfig() {
- Config cfg("AdvancedFm");
+ TabWidget->setCurrentWidget(1);
+ Remote_View->setFocus();
+ whichTab = 2;
}
void AdvancedFm::currentPathComboChanged() {
if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
CurrentDir()->setPath( currentPathCombo->lineEdit()->text() );
populateView();
} else {
QMessageBox::message(tr("Note"),tr("That directory does not exist"));
}
}
void AdvancedFm::fillCombo(const QString &currentPath) {
if ( TabWidget->currentWidget() == tab) {
// if ( whichTab == 1) {
currentPathCombo->lineEdit()->setText( currentPath);
if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
currentPathCombo->clear();
localDirPathStringList.prepend( currentPath );
currentPathCombo->insertStringList( localDirPathStringList,-1);
}
} else {
currentPathCombo->lineEdit()->setText( currentPath);
if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
@@ -341,82 +321,72 @@ void AdvancedFm::fillCombo(const QString &currentPath) {
}
}
void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
chdir( currentPath.latin1() );
CurrentDir()->cd( currentPath, TRUE);
populateView();
update();
}
QStringList AdvancedFm::getPath() {
QStringList strList;
QListView *thisView=CurrentView();
QList<QListViewItem> * getSelectedItems( QListView * thisView );
QListViewItemIterator it( thisView );
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
strList << it.current()->text(0);
// odebug << it.current()->text(0) << oendl;
}
}
return strList;
}
-void AdvancedFm::homeButtonPushed() {
- QString current = QDir::homeDirPath();
- chdir( current.latin1() );
- CurrentDir()->cd( current, TRUE);
+void AdvancedFm::changeTo(QString dir) {
+ chdir( dir.latin1());
+ CurrentDir()->cd(dir, TRUE);
populateView();
update();
}
+void AdvancedFm::homeButtonPushed() {
+ changeTo(QDir::homeDirPath());
+}
+
void AdvancedFm::docButtonPushed() {
- QString current = QPEApplication::documentDir();
- chdir( current.latin1() );
- CurrentDir()->cd( current, TRUE);
- populateView();
- update();
+ changeTo(QPEApplication::documentDir());
}
void AdvancedFm::SDButtonPushed() {
- QString current = "/mnt/card";// this can change so fix
- chdir( current.latin1() );
- CurrentDir()->cd( current, TRUE);
- populateView();
- update();
+ changeTo("/mnt/card");// this can change so fix
}
void AdvancedFm::CFButtonPushed() {
- QString current;
if(zaurusDevice)
- current= "/mnt/cf"; //zaurus
+ changeTo("/mnt/cf"); //zaurus
else
- current = "/mnt/hda"; //ipaq
- chdir( current.latin1() );
- CurrentDir()->cd( current, TRUE);
- populateView();
- update();
+ 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:
upDir();
break;
case Key_Next:
break;
case Key_Return:
case Key_Enter:
navigateToSelected();
break;
case Key_Tab: {
setOtherTabCurrent();
}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 2234b3c..c52b853 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -76,66 +76,65 @@ protected:
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);
//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 writeConfig();
- void readConfig();
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();
void switchToRemoteTab();
void refreshCurrentTab();
void openSearch();
void dirMenuSelected(int);
void showFileMenu();
void homeButtonPushed();
void docButtonPushed();