summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp39
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
2 files changed, 29 insertions, 11 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 7ee78c0..0f2555d 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -27,96 +27,97 @@
#include <qpe/qpemenubar.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/config.h>
#include <qpe/mimetype.h>
#include <qpe/applnk.h>
#include <qpe/ir.h>
//#include <opie/ofileselector.h>
#include <qmultilineedit.h>
#include <qtextstream.h>
#include <qpushbutton.h>
#include <qtoolbutton.h>
#include <qdatetime.h>
#include <qdir.h>
#include <qfile.h>
#include <qstring.h>
#include <qcombobox.h>
#include <qpopupmenu.h>
#include <qlistview.h>
#include <qmainwindow.h>
#include <qlabel.h>
#include <qprogressbar.h>
#include <qspinbox.h>
#include <qtabwidget.h>
#include <qwidget.h>
#include <qlayout.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qmessagebox.h>
#include <qlineedit.h>
#include <qregexp.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <dirent.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#include <mntent.h>
#include <string.h>
#include <errno.h>
#include <sys/vfs.h>
#include <mntent.h>
+#include <sys/utsname.h>
AdvancedFm::AdvancedFm( )
: QMainWindow( )
{
setCaption( tr( "AdvancedFm" ) );
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing( 2);
layout->setMargin( 2);
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
QPEMenuBar *menuBar = new QPEMenuBar(this);
fileMenu = new QPopupMenu( this );
viewMenu = new QPopupMenu( this );
layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 );
menuBar->insertItem( tr( "File" ), fileMenu);
menuBar->insertItem( tr( "View" ), viewMenu);
qpeDirButton= new QToolButton(this,"QPEButton");
qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
qpeDirButton ->setFixedSize( QSize( 20, 20 ) );
connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) );
layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2);
cfButton = new QToolButton( this,"CFButton");
cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
cfButton ->setFixedSize( QSize( 20, 20 ) );
connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) );
layout->addMultiCellWidget( cfButton , 0, 0, 3, 3);
sdButton = new QToolButton( this,"SDButton");
sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard"));
sdButton->setFixedSize( QSize( 20, 20 ) );
connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) );
layout->addMultiCellWidget( sdButton , 0, 0, 4, 4);
cdUpButton = new QToolButton( this,"cdUpButton");
cdUpButton->setPixmap(Resource::loadPixmap("up"));
cdUpButton ->setFixedSize( QSize( 20, 20 ) );
connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5);
docButton = new QToolButton( this,"docsButton");
docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
docButton->setFixedSize( QSize( 20, 20 ) );
@@ -202,97 +203,108 @@ AdvancedFm::AdvancedFm( )
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);
connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
this,SLOT( remoteListClicked(QListViewItem *)) );
connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) );
tabLayout_2->addWidget( Remote_View, 0, 0 );
TabWidget->insertTab( tab_2, tr( "2"));
connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
this,SLOT(tabChanged(QWidget*)));
/* 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,"/");
QListView *fileTree;
fileTree = new QListView( tab_3, "tree" );
tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
TabWidget->insertTab( tab_3, tr( "Remote" ) );
*/
///////////////
-
+
+ struct utsname name; /* check for embedix kernel running on the zaurus*/
+ if (uname(&name) != -1) {
+ QString release=name.release;
+ if(release.find("embedix",0,TRUE) !=-1) {
+ zaurusDevice=TRUE;
+ } else {
+ zaurusDevice=FALSE;
+ sdButton->hide();
+ }
+ }
+
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;
connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) );
populateLocalView();
populateRemoteView();
currentPathCombo->setFocus();
}
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 *w)
{
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) {
currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath());
viewMenu->setItemChecked(viewMenu->idAt(1),TRUE);
viewMenu->setItemChecked(viewMenu->idAt(0),FALSE);
@@ -1017,106 +1029,111 @@ QStringList AdvancedFm::getPath() {
}
}
return strList;
}
return "";
}
void AdvancedFm::homeButtonPushed() {
QString current = QDir::homeDirPath();
chdir( current.latin1() );
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) {
currentDir.cd( current, TRUE);
populateLocalView();
} else {
currentRemoteDir.cd( current, TRUE);
populateRemoteView();
}
update();
}
void AdvancedFm::SDButtonPushed() {
QString current = "/mnt/card";
chdir( current.latin1() );
if (TabWidget->currentPageIndex() == 0) {
currentDir.cd( current, TRUE);
populateLocalView();
} else {
currentRemoteDir.cd( current, TRUE);
populateRemoteView();
}
update();
}
void AdvancedFm::CFButtonPushed() {
- QString current = "/mnt/cf";
- chdir( current.latin1() );
- if (TabWidget->currentPageIndex() == 0) {
- currentDir.cd( current, TRUE);
- populateLocalView();
- } else {
- currentRemoteDir.cd( current, TRUE);
- populateRemoteView();
- }
- update();
+ QString current;
+ if(zaurusDevice)
+ current= "/mnt/cf";
+ else
+ current = "/mnt/hda";
+
+ chdir( current.latin1() );
+ if (TabWidget->currentPageIndex() == 0) {
+ currentDir.cd( current, TRUE);
+ populateLocalView();
+ } else {
+ currentRemoteDir.cd( current, TRUE);
+ populateRemoteView();
+ }
+ update();
}
void AdvancedFm::upDir()
{
if (TabWidget->currentPageIndex() == 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();
current = dir.canonicalPath();
chdir( current.latin1() );
currentRemoteDir.cd( current, TRUE);
populateRemoteView();
update();
}
}
void AdvancedFm::copy()
{
qApp->processEvents();
QStringList curFileList = getPath();
if( curFileList.count() > 0) {
QString curFile;
if (TabWidget->currentPageIndex() == 0) {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
qDebug("Destination file is "+destFile);
curFile = currentDir.canonicalPath()+"/"+(*it);
qDebug("CurrentFile file is " + curFile);
QFile f(destFile);
if( f.exists()) {
switch ( QMessageBox::warning(this,tr("Delete"),
destFile+tr(" already exists\nDo you really want to delete it?"),
tr("Yes"),tr("No"),0,0,1) ) {
case 0:
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 78f0bad..5b714ae 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -60,84 +60,85 @@ public:
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;
QStringList fileSystemTypeList, fsList;
int currentServerConfig;
protected slots:
void doLocalCd();
void doRemoteCd();
// void copy();
void mkDir();
void del();
void rn();
void populateLocalView();
void populateRemoteView();
void showHidden();
void showRemoteHidden();
void writeConfig();
void readConfig();
void localListClicked(QListViewItem *);
void remoteListClicked(QListViewItem *);
void localListPressed( int, QListViewItem *, const QPoint&, int);
void remoteListPressed( int, QListViewItem *, const QPoint&, int);
void localMakDir();
void localDelete();
void remoteMakDir();
void remoteDelete();
/* bool remoteDirList(const QString &); */
/* bool remoteChDir(const QString &); */
void tabChanged(QWidget*);
void cleanUp();
void remoteRename();
void localRename();
void runThis();
void runText();
void filePerms();
void doProperties();
void runCommand();
void runCommandStd();
QStringList getPath();
void mkSym();
void switchToLocalTab();
void switchToRemoteTab();
protected:
+ bool zaurusDevice;
QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
QStringList remoteDirPathStringList, localDirPathStringList;
void keyReleaseEvent( QKeyEvent *);
QString getFileSystemType(const QString &);
QString getDiskSpace(const QString &);
void parsetab(const QString &fileName);
QString checkDiskSpace(const QString &);
protected slots:
void showFileMenu();
void cancelMenuTimer();
void homeButtonPushed();
void docButtonPushed();
void SDButtonPushed();
void CFButtonPushed();
void QPEButtonPushed();
void upDir();
void currentPathComboChanged();
void copy();
void copyAs();
void copySameDir();
void currentPathComboActivated(const QString &);
void fillCombo(const QString &);
bool copyFile( const QString & , const QString & );
void move();
void fileStatus();
void doAbout();
void doBeam();
void fileBeamFinished( Ir *);
private:
QTimer menuTimer;
};
#endif // ADVANCEDFM_H