summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp56
-rw-r--r--noncore/apps/advancedfm/advancedfm.h5
-rw-r--r--noncore/apps/advancedfm/advancedfm.pro2
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp14
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp80
5 files changed, 99 insertions, 58 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index f23fd86..08dc24e 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -3,24 +3,25 @@
-------------------
** 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 <opie/otabwidget.h>
// #include <opie/ofileselector.h>
// #include <opie/ofiledialog.h>
#include <qpe/filemanager.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpemenubar.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qpeapplication.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/config.h>
#include <qpe/mimetype.h>
#include <qpe/applnk.h>
@@ -78,34 +79,37 @@ 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 *) {
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
+// if (TabWidget->currentPageIndex() == 0) {
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
viewMenu->setItemChecked(viewMenu->idAt(0),TRUE);
viewMenu->setItemChecked(viewMenu->idAt(1),FALSE);
QString fs= getFileSystemType((const QString &) currentDir.canonicalPath());
setCaption("AdvancedFm :: "+fs+" :: "
+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" );
}
- if (TabWidget->currentPageIndex() == 1) {
+ if (TabWidget->getCurrentTab() == 1) {
+
+// if (TabWidget->currentPageIndex() == 1) {
currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath());
viewMenu->setItemChecked(viewMenu->idAt(1),TRUE);
viewMenu->setItemChecked(viewMenu->idAt(0),FALSE);
QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
setCaption("AdvancedFm :: "+fs+" :: "
+checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" );
}
}
void AdvancedFm::populateLocalView() {
QPixmap pm;
@@ -405,96 +409,101 @@ void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, in
switch (mouse) {
case 1:
break;
case 2:
menuTimer.start( 500, TRUE );
qDebug("Start menu timer");
break;
};
}
void AdvancedFm::switchToLocalTab() {
- TabWidget->setCurrentPage(0);
+ TabWidget->setCurrentTab(0);
Local_View->setFocus();
}
void AdvancedFm::switchToRemoteTab() {
- TabWidget->setCurrentPage(1);
+ TabWidget->setCurrentTab(1);
Remote_View->setFocus();
}
void AdvancedFm::readConfig() {
Config cfg("AdvancedFm");
}
void AdvancedFm::writeConfig() {
Config cfg("AdvancedFm");
}
void AdvancedFm::currentPathComboChanged() {
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
+// if (TabWidget->currentPageIndex() == 0) {
if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
currentDir.setPath( currentPathCombo->lineEdit()->text() );
populateLocalView();
} else {
QMessageBox::message(tr("Note"),tr("That directory does not exist"));
}
}
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
+// if (TabWidget->currentPageIndex() == 0) {
if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() );
populateRemoteView();
} else {
QMessageBox::message(tr("Note"),tr("That directory does not exist"));
}
}
}
void AdvancedFm::fillCombo(const QString &currentPath) {
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
+// if (TabWidget->currentPageIndex() == 0) {
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() ) {
currentPathCombo->clear();
remoteDirPathStringList.prepend( currentPath );
currentPathCombo->insertStringList( remoteDirPathStringList,-1);
}
}
}
void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
+// if (TabWidget->currentPageIndex() == 0) {
chdir( currentPath.latin1() );
currentDir.cd( currentPath, TRUE);
populateLocalView();
update();
} else {
chdir( currentPath.latin1() );
currentRemoteDir.cd( currentPath, TRUE);
populateRemoteView();
update();
}
}
QStringList AdvancedFm::getPath() {
QStringList strList;
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
+// if (TabWidget->currentPageIndex() == 0) {
QList<QListViewItem> * getSelectedItems( QListView * Local_View );
QListViewItemIterator it( Local_View );
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
strList << it.current()->text(0);
qDebug(it.current()->text(0));
}
}
return strList;
} else {
QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
QListViewItemIterator it( Remote_View );
@@ -503,70 +512,75 @@ QStringList AdvancedFm::getPath() {
strList << it.current()->text(0);
qDebug(it.current()->text(0));
}
}
return strList;
}
return "";
}
void AdvancedFm::homeButtonPushed() {
QString current = QDir::homeDirPath();
chdir( current.latin1() );
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
+// if (TabWidget->currentPageIndex() == 0) {
currentDir.cd( current, TRUE);
populateLocalView();
} else {
currentRemoteDir.cd( current, TRUE);
populateRemoteView();
}
update();
}
void AdvancedFm::docButtonPushed() {
QString current = QPEApplication::documentDir();
chdir( current.latin1() );
- if (TabWidget->currentPageIndex() == 0) {
+
+ if (TabWidget->getCurrentTab() == 0) {
+//if (TabWidget->currentPageIndex() == 0) {
currentDir.cd( current, TRUE);
populateLocalView();
} else {
currentRemoteDir.cd( current, TRUE);
populateRemoteView();
}
update();
}
void AdvancedFm::SDButtonPushed() {
QString current = "/mnt/card";// this can change so fix
chdir( current.latin1() );
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
+// if (TabWidget->currentPageIndex() == 0) {
currentDir.cd( current, TRUE);
populateLocalView();
} else {
currentRemoteDir.cd( current, TRUE);
populateRemoteView();
}
update();
}
void AdvancedFm::CFButtonPushed() {
QString current;
if(zaurusDevice)
current= "/mnt/cf"; //zaurus
else
current = "/mnt/hda"; //ipaq
chdir( current.latin1() );
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
+// if (TabWidget->currentPageIndex() == 0) {
currentDir.cd( current, TRUE);
populateLocalView();
} else {
currentRemoteDir.cd( current, TRUE);
populateRemoteView();
}
update();
}
void AdvancedFm::doAbout() {
@@ -636,25 +650,26 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
break;
case Key_9:
break;
case Key_0:
break;
}
}
void AdvancedFm::QPEButtonPushed() {
QString current = QPEApplication::qpeDir();
chdir( current.latin1() );
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
+// if (TabWidget->currentPageIndex() == 0) {
currentDir.cd( current, TRUE);
populateLocalView();
} else {
currentRemoteDir.cd( current, TRUE);
populateRemoteView();
}
update();
}
void AdvancedFm::parsetab(const QString &fileName) {
fileSystemTypeList.clear();
@@ -708,39 +723,43 @@ QString AdvancedFm::getDiskSpace( const QString &path) {
if ( !div ) div = 1;
return QString::number(availBlks * mult / div);
}
return "";
}
void AdvancedFm::showFileMenu() {
QString curApp;
bool isLocalView = false;
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
+// if (TabWidget->currentPageIndex() == 0) {
isLocalView = TRUE;
curApp = Local_View->currentItem()->text(0);
} else {
curApp = Remote_View->currentItem()->text(0);
}
MimeType mt( curApp );
const AppLnk* app = mt.application();
QFile fi(curApp);
QPopupMenu *m = new QPopupMenu(0);
QPopupMenu *n = new QPopupMenu(0);
// QPopupMenu *o = new QPopupMenu(0);
- m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
-
+ if (TabWidget->getCurrentTab() == 0)
+ m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
+ else
+ m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() ));
+
if ( QFileInfo(fi).isDir() ) {
m->insertSeparator();
m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
} else {
if ( app )
m->insertItem( app->pixmap(), tr( "Open in "
+ app->name() ), this, SLOT( runThis() ) );
else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this
m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) );
m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) );
}
@@ -820,25 +839,26 @@ QString AdvancedFm::checkDiskSpace(const QString &path) {
if ( !div ) div = 1;
return QString::number(availBlks * mult / div);
}
return "";
}
void AdvancedFm::addToDocs() {
QStringList strListPaths = getPath();
if( strListPaths.count() > 0) {
QString curFile;
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
+// if (TabWidget->currentPageIndex() == 0) {
for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
curFile = currentDir.canonicalPath()+"/"+(*it);
qDebug(curFile);
DocLnk f;
// curFile.replace(QRegExp("\\..*"),"");
f.setName((*it));
f.setFile( curFile);
f.writeLink();
}
} else {
for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index f846c66..12ebbf2 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -5,35 +5,37 @@
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. *
***************************************************************************/
#ifndef ADVANCEDFM_H
#define ADVANCEDFM_H
#define QTOPIA_INTERNAL_FSLP // to get access to fileproperties
#define QT_QWS_OPIE
+//#include <opie/otabwidget.h>
#include <qpe/ir.h>
#include <qvariant.h>
#include <qdialog.h>
#include <qmainwindow.h>
#include <qstringlist.h>
#include <qdir.h>
#include <qstring.h>
#include <qpoint.h>
#include <qtimer.h>
+class OTabWidget;
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QComboBox;
class QListView;
class QListviewItem;
class QLabel;
class QProgressBar;
class QSpinBox;
class QTabWidget;
class QWidget;
class QPEToolBar;
@@ -44,25 +46,26 @@ class QListViewItem;
class QLineEdit;
//class QPushButton;
class QToolButton;
class Ir;
class AdvancedFm : public QMainWindow
{
Q_OBJECT
public:
AdvancedFm();
~AdvancedFm();
- QTabWidget *TabWidget;
+ OTabWidget *TabWidget;
+// QTabWidget *TabWidget;
QWidget *tab, *tab_2, *tab_3;
QListView *Local_View, *Remote_View;
QLineEdit *currentPathEdit;
QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu;
QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
QDir currentDir, currentRemoteDir;
QComboBox *currentPathCombo;
QString filterStr;
QListViewItem * item;
bool b;
diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro
index eb4f122..3896f50 100644
--- a/noncore/apps/advancedfm/advancedfm.pro
+++ b/noncore/apps/advancedfm/advancedfm.pro
@@ -1,22 +1,22 @@
TEMPLATE = app
CONFIG += qt warn_on release
HEADERS = advancedfm.h inputDialog.h filePermissions.h output.h
SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp inputDialog.cpp filePermissions.cpp output.cpp main.cpp
TARGET = advancedfm
REQUIRES=medium-config
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
DESTDIR = $(OPIEDIR)/bin
-LIBS += -lqpe
+LIBS += -lqpe -lopie
TRANSLATIONS = ../../../i18n/de/advancedfm.ts \
../../../i18n/en/advancedfm.ts \
../../../i18n/es/advancedfm.ts \
../../../i18n/fr/advancedfm.ts \
../../../i18n/hu/advancedfm.ts \
../../../i18n/ja/advancedfm.ts \
../../../i18n/ko/advancedfm.ts \
../../../i18n/no/advancedfm.ts \
../../../i18n/pl/advancedfm.ts \
../../../i18n/pt/advancedfm.ts \
../../../i18n/pt_BR/advancedfm.ts \
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index 619a7a9..7188640 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -2,36 +2,36 @@
advancedfmData.cpp
-------------------
** Created: Mon 09-23-2002 13:24:11
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 <opie/otabwidget.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpemenubar.h>
#include <qpe/qpetoolbar.h>
#include <qpe/resource.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 <sys/utsname.h>
void AdvancedFm::init() {
#if defined(QT_QWS_OPIE)
qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!");
#endif
setCaption( tr( "AdvancedFm" ) );
@@ -99,70 +99,72 @@ void AdvancedFm::init() {
currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
currentPathCombo->setEditable(TRUE);
layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
- TabWidget = new QTabWidget( this, "TabWidget" );
+ TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab);
+// TabWidget = new QTabWidget( this, "TabWidget" );
layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7);
tab = new QWidget( TabWidget, "tab" );
tabLayout = new QGridLayout( tab );
tabLayout->setSpacing( 2);
tabLayout->setMargin( 2);
Local_View = new QListView( tab, "Local_View" );
Local_View->addColumn( tr("File"),130);
Local_View->addColumn( tr("Size"),-1);
Local_View->setColumnAlignment(1,QListView::AlignRight);
Local_View->addColumn( tr("Date"),-1);
Local_View->setColumnAlignment(2,QListView::AlignRight);
Local_View->setAllColumnsShowFocus(TRUE);
Local_View->setMultiSelection( TRUE );
Local_View->setSelectionMode(QListView::Extended);
QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
tabLayout->addWidget( Local_View, 0, 0 );
- TabWidget->insertTab( tab, tr("1"));
+ TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1"));
+// TabWidget->insertTab( tab, tr("1"));
tab_2 = new QWidget( TabWidget, "tab_2" );
tabLayout_2 = new QGridLayout( tab_2 );
tabLayout_2->setSpacing( 2);
tabLayout_2->setMargin( 2);
Remote_View = new QListView( tab_2, "Remote_View" );
Remote_View->addColumn( tr("File"),130);
Remote_View->addColumn( tr("Size"),-1);
Remote_View->setColumnAlignment(1,QListView::AlignRight);
Remote_View->addColumn( tr("Date"),-1);
Remote_View->setColumnAlignment(2,QListView::AlignRight);
Remote_View->setAllColumnsShowFocus(TRUE);
Remote_View->setMultiSelection( TRUE );
Remote_View->setSelectionMode(QListView::Extended);
QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
tabLayout_2->addWidget( Remote_View, 0, 0 );
-
- TabWidget->insertTab( tab_2, tr( "2"));
+ TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2"));
+// TabWidget->insertTab( tab_2, tr( "2"));
/* tab_3 = new QWidget( TabWidget, "tab_3" );
tabLayout_3 = new QGridLayout( tab_3 );
tabLayout_3->setSpacing( 2);
tabLayout_3->setMargin( 2);
// OFileDialog fileDialog;
// fileDialog;
// fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy
// fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow");
// OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/");
@@ -190,25 +192,25 @@ void AdvancedFm::init() {
}
currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
currentDir.setPath( QDir::currentDirPath());
currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
currentRemoteDir.setPath( QDir::currentDirPath());
b = TRUE;
filterStr="*";
b=FALSE;
-
+ TabWidget->setCurrentTab(0);
}
void AdvancedFm::initConnections() {
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) );
connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) );
connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) );
connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 5fa8d0c..27a119f 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -5,24 +5,26 @@
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 "inputDialog.h"
#include "output.h"
#include "filePermissions.h"
+#include <opie/otabwidget.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>
@@ -44,61 +46,75 @@
#include <dirent.h>
void AdvancedFm::doLocalCd() {
localListClicked( Local_View->currentItem());
}
void AdvancedFm::doRemoteCd() {
localListClicked( Remote_View->currentItem());
}
void AdvancedFm::showMenuHidden() {
- if(TabWidget->currentPageIndex() == 0)
- showHidden();
- else
- showRemoteHidden();
+ if (b) {
+ 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),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();
+// if(TabWidget->getCurrentTab() == 0)
+// showHidden();
+// else
+// showRemoteHidden();
// 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);
+// 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);
+// fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
// b=TRUE;
}
populateLocalView();
}
void AdvancedFm::showRemoteHidden() {
if (b) {
currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
// b=TRUE;
} else {
currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
// b=FALSE;
}
populateRemoteView();
}
void AdvancedFm::runThis() {
QString fs;
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
QString curFile = Local_View->currentItem()->text(0);
if(curFile != "../") {
fs= getFileSystemType((const QString &) currentDir.canonicalPath());
QFileInfo fileInfo( currentDir.canonicalPath()+"/"+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;
@@ -132,25 +148,25 @@ void AdvancedFm::runThis() {
QString execStr = nf.exec();
qDebug(execStr);
if( execStr.isEmpty() ) {
} else {
nf.execute();
}
}
}
}
}
void AdvancedFm::runText() {
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
QString curFile = Local_View->currentItem()->text(0);
if(curFile != "../") {
curFile = currentDir.canonicalPath()+"/"+curFile;
QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
e << curFile;
}
} else {
QString curFile = Remote_View->currentItem()->text(0);
if(curFile != "../") {
curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
DocLnk nf(curFile);
QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
@@ -314,71 +330,71 @@ void AdvancedFm::remoteRename()
QMessageBox::message(tr("Note"),tr("Could not rename"));
}
populateRemoteView();
}
}
void AdvancedFm::filePerms() {
QStringList curFileList = getPath();
QString filePath;
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
filePath = currentDir.canonicalPath()+"/";
} else {
filePath= currentRemoteDir.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;
}
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
populateLocalView();
} else {
populateRemoteView();
}
}
void AdvancedFm::doProperties() {
#if defined(QT_QWS_OPIE)
QStringList curFileList = getPath();
QString filePath;
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
filePath = currentDir.canonicalPath()+"/";
} else {
filePath= currentRemoteDir.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();
}
#endif
}
void AdvancedFm::upDir() {
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
QString current = currentDir.canonicalPath();
QDir dir(current);
dir.cdUp();
current = dir.canonicalPath();
chdir( current.latin1() );
currentDir.cd( current, TRUE);
populateLocalView();
update();
} else {
QString current = currentRemoteDir.canonicalPath();
QDir dir(current);
dir.cdUp();
@@ -386,25 +402,25 @@ void AdvancedFm::upDir() {
chdir( current.latin1() );
currentRemoteDir.cd( current, TRUE);
populateRemoteView();
update();
}
}
void AdvancedFm::copy() {
qApp->processEvents();
QStringList curFileList = getPath();
if( curFileList.count() > 0) {
QString curFile, item, destFile;
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
item=(*it);
if(item.find("->",0,TRUE)) //symlink
item = item.left(item.find("->",0,TRUE));
destFile = currentRemoteDir.canonicalPath()+"/"+ item;
qDebug("Destination file is "+destFile);
curFile = currentDir.canonicalPath()+"/"+ item;
qDebug("CurrentFile file is " + curFile);
@@ -418,25 +434,25 @@ void AdvancedFm::copy() {
break;
case 1:
return;
break;
};
}
if(!copyFile(destFile, curFile) ) {
QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
return;
}
}
populateRemoteView();
- TabWidget->setCurrentPage(1);
+ TabWidget->setCurrentTab(1);
} else {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
item= (*it);
if(item.find("->",0,TRUE)) //symlink
item = item.left(item.find("->",0,TRUE));
destFile = currentDir.canonicalPath()+"/"+ item;
qDebug("Destination file is "+destFile);
curFile = currentRemoteDir.canonicalPath()+"/"+ item;;
@@ -454,37 +470,37 @@ void AdvancedFm::copy() {
return;
break;
};
}
if(!copyFile(destFile, curFile) ) {
QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+curFile +tr("to\n")+destFile);
return;
}
}
populateLocalView();
- TabWidget->setCurrentPage(0);
+ TabWidget->setCurrentTab(0);
}
}
}
void AdvancedFm::copyAs() {
qApp->processEvents();
QStringList curFileList = getPath();
QString curFile;
InputDialog *fileDlg;
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
qDebug("tab 1");
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
QString destFile;
curFile = currentDir.canonicalPath()+"/"+(*it);
fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0);
fileDlg->setInputText((const QString &) destFile );
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString filename = fileDlg->LineEdit1->text();
destFile = currentRemoteDir.canonicalPath()+"/"+filename;
@@ -503,25 +519,25 @@ void AdvancedFm::copyAs() {
};
}
if(!copyFile(destFile, curFile) ) {
QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+curFile +tr("to\n")+destFile);
return;
}
}
delete fileDlg;
}
populateRemoteView();
- TabWidget->setCurrentPage(1);
+ TabWidget->setCurrentTab(1);
} else {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0);
QString destFile;
fileDlg->setInputText((const QString &) destFile);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
@@ -543,35 +559,35 @@ void AdvancedFm::copyAs() {
}
if(!copyFile(destFile, curFile) ) {
QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+curFile +tr("to\n")+destFile);
return;
}
}
delete fileDlg;
}
populateLocalView();
- TabWidget->setCurrentPage(0);
+ TabWidget->setCurrentTab(0);
}
}
void AdvancedFm::copySameDir() {
qApp->processEvents();
QStringList curFileList = getPath();
QString curFile, item, destFile;
InputDialog *fileDlg;
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
item=(*it);
curFile = currentDir.canonicalPath()+"/"+ item;
fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0);
fileDlg->setInputText((const QString &) destFile );
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString filename = fileDlg->LineEdit1->text();
@@ -640,25 +656,25 @@ void AdvancedFm::copySameDir() {
}
populateRemoteView();
}
}
void AdvancedFm::move() {
qApp->processEvents();
QStringList curFileList = getPath();
if( curFileList.count() > 0) {
QString curFile, destFile, item;
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
item=(*it);
QString destFile = currentRemoteDir.canonicalPath();
if(destFile.right(1).find("/",0,TRUE) == -1)
destFile+="/";
destFile += item;
curFile = currentDir.canonicalPath();
qDebug("Destination file is "+destFile);
@@ -669,25 +685,25 @@ void AdvancedFm::move() {
qDebug("CurrentFile file is " + curFile);
QFile f( curFile);
if( f.exists()) {
if(!copyFile( destFile, curFile) ) {
QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile);
return;
} else
QFile::remove(curFile);
}
}
- TabWidget->setCurrentPage(1);
+ TabWidget->setCurrentTab(1);
} else { //view 2
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
item = (*it);
QString destFile = currentDir.canonicalPath();
if(destFile.right(1).find("/",0,TRUE) == -1)
destFile+="/";
destFile += item;
@@ -699,25 +715,25 @@ void AdvancedFm::move() {
curFile +="/";
curFile+= item;
qDebug("CurrentFile file is " + curFile);
QFile f( curFile);
if( f.exists()) {
if(!copyFile( destFile, curFile) ) {
QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile);
return;
} else
QFile::remove( curFile);
}
- TabWidget->setCurrentPage(0);
+ TabWidget->setCurrentTab(0);
}
}
populateRemoteView();
populateLocalView();
}
}
bool AdvancedFm::copyFile( const QString & dest, const QString & src ) {
char bf[ 50000 ];
int bytesRead;
bool success = TRUE;
struct stat status;
@@ -740,25 +756,25 @@ bool AdvancedFm::copyFile( const QString & dest, const QString & src ) {
}
// Set file permissions
if( stat( (const char *) src, &status ) == 0 ){
chmod( (const char *) dest, status.st_mode );
}
return success;
}
void AdvancedFm::runCommand() {
QString curFile;
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
if( Local_View->currentItem())
curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0);
} else {
if(Remote_View->currentItem())
curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0);
}
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
fileDlg->setInputText(curFile);
fileDlg->exec();
QString command;
@@ -786,48 +802,48 @@ void AdvancedFm::runCommand() {
lineStr=lineStr.left(lineStr.length()-1);
outDlg->OutputEdit->append(lineStr);
outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
}
}
pclose(fp);
}
}
void AdvancedFm::runCommandStd() {
QString curFile;
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
if( Local_View->currentItem())
curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0);
} else {
if(Remote_View->currentItem())
curFile = currentRemoteDir.canonicalPath() +"/"
+ Remote_View->currentItem()->text(0);
}
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
fileDlg->setInputText(curFile);
fileDlg->exec();
QString command;
if( fileDlg->result() == 1 ) {
qApp->processEvents();
command = fileDlg->LineEdit1->text() + " &";
system(command.latin1());
}
}
void AdvancedFm::fileStatus() {
QString curFile;
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
curFile = Local_View->currentItem()->text(0);
} else {
curFile = Remote_View->currentItem()->text(0);
}
QString command = " stat -l "+ curFile +" 2>&1";
Output *outDlg;
outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
outDlg->showMaximized();
outDlg->show();
qApp->processEvents();
FILE *fp;
char line[130];
@@ -841,91 +857,91 @@ void AdvancedFm::fileStatus() {
} else {
while ( fgets( line, sizeof line, fp)) {
outDlg->OutputEdit->append(line);
outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
}
}
pclose(fp);
}
void AdvancedFm::mkDir() {
- if (TabWidget->currentPageIndex() == 0)
+ if (TabWidget->getCurrentTab() == 0)
localMakDir();
else
remoteMakDir();
}
void AdvancedFm::rn() {
- if (TabWidget->currentPageIndex() == 0)
+ if (TabWidget->getCurrentTab() == 0)
localRename();
else
remoteRename();
}
void AdvancedFm::del() {
- if (TabWidget->currentPageIndex() == 0)
+ if (TabWidget->getCurrentTab() == 0)
localDelete();
else
remoteDelete();
}
void AdvancedFm::mkSym() {
QString cmd;
QStringList curFileList = getPath();
if( curFileList.count() > 0) {
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 0) {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
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);
system(cmd.latin1() );
}
populateRemoteView();
- TabWidget->setCurrentPage(1);
+ TabWidget->setCurrentTab(1);
} else {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
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);
cmd = "ln -s "+curFile+" "+destName;
qDebug(cmd);
system(cmd.latin1() );
}
populateLocalView();
- TabWidget->setCurrentPage(0);
+ TabWidget->setCurrentTab(0);
}
}
}
void AdvancedFm::doBeam() {
Ir ir;
if(!ir.supported()){
} else {
QStringList curFileList = getPath();
if( curFileList.count() > 0) {
- if (TabWidget->currentPageIndex() == 0) {
+ if (TabWidget->getCurrentTab() == 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");
connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
file->send( curFile, curFile );
}
} else {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {