summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp206
-rw-r--r--noncore/apps/advancedfm/advancedfm.h12
-rw-r--r--noncore/apps/advancedfm/advancedfm.pro10
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp10
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp161
-rw-r--r--noncore/apps/advancedfm/config.in2
-rw-r--r--noncore/apps/advancedfm/main.cpp8
-rw-r--r--noncore/apps/advancedfm/opie-advancedfm.control2
-rw-r--r--noncore/apps/advancedfm/output.cpp2
-rw-r--r--noncore/apps/advancedfm/output.h18
10 files changed, 209 insertions, 222 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 9c13e53..5148172 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -3,30 +3,24 @@
-------------------
** 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/ofileselector.h>
-// #include <opie/ofiledialog.h>
-
-#include <opie/osplitter.h>
-
#include <qpe/filemanager.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/mimetype.h>
#include <qpe/applnk.h>
#include <qpe/ir.h>
#include <qpe/resource.h>
#include <qpe/menubutton.h>
#include <qdatetime.h>
#include <qfile.h>
@@ -99,131 +93,131 @@ void AdvancedFm::tabChanged(QWidget *) {
QString fs= getFileSystemType( (const QString &) path);
setCaption(tr("AdvancedFm :: ")+fs+" :: "
+checkDiskSpace( (const QString &) path )+ tr(" kB free") );
chdir( path.latin1());
}
void AdvancedFm::populateView() {
// qWarning("PopulateView");
- QPixmap pm;
- QListView *thisView = CurrentView();
- QDir *thisDir = CurrentDir();
- QString path = thisDir->canonicalPath();
+ QPixmap pm;
+ QListView *thisView = CurrentView();
+ QDir *thisDir = CurrentDir();
+ QString path = thisDir->canonicalPath();
//qWarning("path is "+path);
- thisView->clear();
- thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
- thisDir->setMatchAllDirs(TRUE);
- thisDir->setNameFilter(filterStr);
- QString fileL, fileS, fileDate;
- QString fs= getFileSystemType((const QString &) path);
- setCaption(tr("AdvancedFm :: ")+fs+" :: "
- +checkDiskSpace((const QString &) path)+ tr(" kB free") );
- bool isDir=FALSE;
- const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
- QFileInfoListIterator it(*list);
- QFileInfo *fi;
- while ( (fi=it.current()) ) {
- if (fi->isSymLink() ) {
- QString symLink=fi->readLink();
- QFileInfo sym( symLink);
- fileS.sprintf( "%10i", sym.size() );
- fileL = fi->fileName() +" -> " + sym.filePath().data();
- fileDate = sym.lastModified().toString();
- } else {
- fileS.sprintf( "%10i", fi->size() );
- fileL = fi->fileName();
- fileDate= fi->lastModified().toString();
- if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) {
+ thisView->clear();
+ thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
+ thisDir->setMatchAllDirs(TRUE);
+ thisDir->setNameFilter(filterStr);
+ QString fileL, fileS, fileDate;
+ QString fs= getFileSystemType((const QString &) path);
+ setCaption(tr("AdvancedFm :: ")+fs+" :: "
+ +checkDiskSpace((const QString &) path)+ tr(" kB free") );
+ bool isDir=FALSE;
+ const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
+ QFileInfoListIterator it(*list);
+ QFileInfo *fi;
+ while ( (fi=it.current()) ) {
+ if (fi->isSymLink() ) {
+ QString symLink=fi->readLink();
+ QFileInfo sym( symLink);
+ fileS.sprintf( "%10i", sym.size() );
+ fileL = fi->fileName() +" -> " + sym.filePath().data();
+ fileDate = sym.lastModified().toString();
+ } else {
+ fileS.sprintf( "%10i", fi->size() );
+ fileL = fi->fileName();
+ fileDate= fi->lastModified().toString();
+ if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) {
// if(fileL == "..")
- fileL += "/";
- isDir=TRUE;
- }
- }
- QFileInfo fileInfo( path + "/" + fileL);
-
- if(fileL !="./" && fi->exists()) {
- item = new QListViewItem( thisView, fileL, fileS , fileDate);
-
- if(isDir || fileL.find("/",0,TRUE) != -1) {
-
- if( !QDir( fi->filePath() ).isReadable()) //is directory
- pm = Resource::loadPixmap( "lockedfolder" );
- else
- pm= Resource::loadPixmap( "folder" );
- }
- else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
- pm = Resource::loadPixmap( "exec");
- }
- else if( (fileInfo.permission( QFileInfo::ExeUser)
- | fileInfo.permission( QFileInfo::ExeGroup)
- | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
- pm = Resource::loadPixmap( "exec");
- }
- else if( !fi->isReadable() ) {
- pm = Resource::loadPixmap( "locked" );
- }
- else { //everything else goes by mimetype
- MimeType mt(fi->filePath());
- pm=mt.pixmap(); //sets the correct pixmap for mimetype
- if(pm.isNull()) {
- pm = unknownXpm;
- }
- }
- if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
- // qDebug(" overlay link image");
- pm= Resource::loadPixmap( "advancedfm/symlink" );
- // pm= Resource::loadPixmap( "folder" );
+ fileL += "/";
+ isDir=TRUE;
+ }
+ }
+ QFileInfo fileInfo( path + "/" + fileL);
+
+ if(fileL !="./" && fi->exists()) {
+ item = new QListViewItem( thisView, fileL, fileS , fileDate);
+
+ if(isDir || fileL.find("/",0,TRUE) != -1) {
+
+ if( !QDir( fi->filePath() ).isReadable()) //is directory
+ pm = Resource::loadPixmap( "lockedfolder" );
+ else
+ pm= Resource::loadPixmap( "folder" );
+ }
+ else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
+ pm = Resource::loadPixmap( "exec");
+ }
+ else if( (fileInfo.permission( QFileInfo::ExeUser)
+ | fileInfo.permission( QFileInfo::ExeGroup)
+ | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
+ pm = Resource::loadPixmap( "exec");
+ }
+ else if( !fi->isReadable() ) {
+ pm = Resource::loadPixmap( "locked" );
+ }
+ else { //everything else goes by mimetype
+ MimeType mt(fi->filePath());
+ pm=mt.pixmap(); //sets the correct pixmap for mimetype
+ if(pm.isNull()) {
+ pm = unknownXpm;
+ }
+ }
+ if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
+ // qDebug(" overlay link image");
+ pm= Resource::loadPixmap( "advancedfm/symlink" );
+ // pm= Resource::loadPixmap( "folder" );
// QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
// QPainter painter( &pm );
// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
// pm.setMask( pm.createHeuristicMask( FALSE ) );
- }
- item->setPixmap( 0,pm);
-
- }
- isDir=FALSE;
- ++it;
- }
-
- if( path.find("dev",0,TRUE) != -1) {
- struct stat buf;
- dev_t devT;
- DIR *dir;
- struct dirent *mydirent;
-
- if((dir = opendir( path.latin1())) != NULL)
- while ((mydirent = readdir(dir)) != NULL) {
- lstat( mydirent->d_name, &buf);
+ }
+ item->setPixmap( 0,pm);
+
+ }
+ isDir=FALSE;
+ ++it;
+ }
+
+ if( path.find("dev",0,TRUE) != -1) {
+ struct stat buf;
+ dev_t devT;
+ DIR *dir;
+ struct dirent *mydirent;
+
+ if((dir = opendir( path.latin1())) != NULL)
+ while ((mydirent = readdir(dir)) != NULL) {
+ lstat( mydirent->d_name, &buf);
// qDebug(mydirent->d_name);
- 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);
- }
- }
+ 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);
- }
+ closedir(dir);
+ }
- thisView->setSorting( 3,FALSE);
- fillCombo( (const QString &) path );
+ thisView->setSorting( 3,FALSE);
+ fillCombo( (const QString &) path );
}
void AdvancedFm::rePopulate() {
populateView();
setOtherTabCurrent();
populateView();
// int tmpTab = whichTab;
// // qDebug("%d", tmpTab);
// for(int i =1; i < 3; i++) {
// TabWidget->setCurrentWidget(i - 1);
@@ -774,25 +768,25 @@ void AdvancedFm::gotoCustomDir(const QString &dir) {
gotoDirectory( dir);
// if(QDir( curDir).exists() )
// {
// thisDir->setPath( curDir );
// chdir( curDir.latin1() );
// thisDir->cd( curDir, TRUE);
// populateView();
// }
}
}
QDir *AdvancedFm::CurrentDir() {
-
+
if ( whichTab == 1) {
return &currentDir;
} else {
return &currentRemoteDir;
}
}
QDir *AdvancedFm::OtherDir() {
if ( whichTab == 1) {
return &currentRemoteDir;
} else {
return &currentDir;
@@ -815,25 +809,25 @@ QListView * AdvancedFm::OtherView() {
else
return Local_View;
}
void AdvancedFm::setOtherTabCurrent() {
// qWarning("setOtherTabCurrent() %d", whichTab);
if ( whichTab == 1) {
TabWidget->setCurrentWidget(1);
} else {
TabWidget->setCurrentWidget(0);
}
OtherView()->setFocus();
- OtherView()->setSelected( CurrentView()->firstChild(), true);
+ OtherView()->setSelected( CurrentView()->firstChild(), true);
}
void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
// qDebug("qcop message "+msg );
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "openDirectory(QString)" ) {
// qDebug("received");
QString file;
stream >> file;
gotoDirectory( (const QString &) file);
}
}
@@ -855,25 +849,25 @@ void AdvancedFm::gotoDirectory(const QString &file) {
}
else if(QFileInfo(curDir).exists()) {
QFileInfo fileInfo(curDir);
curDir=fileInfo.dirPath();
if(QDir( curDir).exists() ) {
thisDir->setPath( curDir );
chdir( curDir.latin1() );
thisDir->cd( curDir, TRUE);
populateView();
}
findFile(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());
}
}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index bfefa77..547fa7c 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -5,51 +5,51 @@
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 <opie/oprocess.h>
+#include <opie2/oprocess.h>
+#include <opie2/osplitter.h>
#include <qpe/ir.h>
#include <qpe/qcopenvelope_qws.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>
#include <qpixmap.h>
-class OSplitter;
+using Opie::OSplitter;
+
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QComboBox;
class QListView;
class QListviewItem;
class QLabel;
class QProgressBar;
class QSpinBox;
-class QTabWidget;
class QWidget;
class QPopupMenu;
class QFile;
class QListViewItem;
class QLineEdit;
class MenuButton;
class QToolButton;
class Ir;
class AdvancedFm : public QMainWindow
{
@@ -152,41 +152,41 @@ protected slots:
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 *);
bool copyDirectory( const QString & , const QString & );
// void navigateToSelected();
- bool moveDirectory( const QString & , const QString & );
+ bool moveDirectory( const QString & , const QString & );
// void slotSwitchtoLocal(int);
private:
MenuButton *menuButton;
QString oldName;
QTimer menuTimer;
void startProcess(const QString &);
bool eventFilter( QObject * , QEvent * );
void cancelRename();
void doRename(QListView *);
void okRename();
void customDirsToMenu();
void addCustomDir();
void removeCustomDir();
void gotoDirectory(const QString &);
void navigateToSelected();
void findFile(const QString &);
private slots:
void processEnded(OProcess *);
void oprocessStderr(OProcess *, char *, int);
void gotoCustomDir(const QString &);
void qcopReceive(const QCString&, const QByteArray&);
void setDocument(const QString &);
-
+
};
#endif // ADVANCEDFM_H
diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro
index 70db018..ca9856b 100644
--- a/noncore/apps/advancedfm/advancedfm.pro
+++ b/noncore/apps/advancedfm/advancedfm.pro
@@ -1,35 +1,35 @@
TEMPLATE = app
CONFIG += qt warn_on release quick-app
# CONFIG += qt warn_on release
HEADERS = advancedfm.h filePermissions.h output.h
SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp
TARGET = advancedfm
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lopie
+LIBS += -lqpe -lopiecore2 -lopieui2
TRANSLATIONS = ../../../i18n/de/advancedfm.ts \
- ../../../i18n/nl/advancedfm.ts \
- ../../../i18n/da/advancedfm.ts \
- ../../../i18n/xx/advancedfm.ts \
+ ../../../i18n/nl/advancedfm.ts \
+ ../../../i18n/da/advancedfm.ts \
+ ../../../i18n/xx/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 \
../../../i18n/sl/advancedfm.ts \
../../../i18n/zh_CN/advancedfm.ts \
../../../i18n/zh_TW/advancedfm.ts
-!contains(CONFIG,quick-app) {
+!contains(CONFIG,quick-app) {
DESTDIR = $(OPIEDIR)/bin
DEFINES += NOQUICKLAUNCH
}
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index ddaa39a..763ae34 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -2,27 +2,25 @@
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/osplitter.h>
#include <qpe/storage.h>
-
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/menubutton.h>
#include <qlayout.h>
#include <qhbox.h>
#include <qmenubar.h>
#include <qcombobox.h>
#include <qtoolbutton.h>
#include <qlineedit.h>
#include <qlistview.h>
@@ -120,73 +118,73 @@ void AdvancedFm::init() {
menuButton->setUseLabel(false);
menuButton->setMaximumWidth( 20 );
menuButton->insertItem( s_addBookmark);
menuButton->insertItem( s_removeBookmark);
menuButton->insertSeparator();
menuButton->setFocusPolicy(NoFocus);
customDirsToMenu();
currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" );
currentPathCombo->setEditable(TRUE);
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
- currentPathCombo->setFocusPolicy(NoFocus);
+ currentPathCombo->setFocusPolicy(NoFocus);
layout->addWidget( lineBox );
TabWidget = new OSplitter( Horizontal, this, "TabWidget" );
// TabWidget = new QTabWidget( this, "TabWidget" );
layout->addWidget( TabWidget, 4 );
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);
Local_View->setFocusPolicy(StrongFocus);
Local_View->installEventFilter( this );
-
+
QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
tabLayout->addWidget( Local_View, 0, 0 );
TabWidget->addWidget( 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);
Remote_View->setFocusPolicy(StrongFocus);
Remote_View->installEventFilter( this );
-
+
QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
tabLayout_2->addWidget( Remote_View, 0, 0 );
TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2"));
TabWidget->setSizeChange( 370 );
// 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);
@@ -202,25 +200,25 @@ void AdvancedFm::init() {
fileTree = new QListView( tab_3, "tree" );
tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
TabWidget->insertTab( tab_3, tr( "Remote" ) );
*/
///////////////
if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
zaurusDevice=TRUE;
- else
+ else
zaurusDevice=FALSE;
if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) {
qDebug("not have sd");
sdButton->hide();
}
if( !StorageInfo::hasCf() ) {
qDebug("not have cf");
cfButton->hide();
}
currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 78f9da2..18bbd43 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -4,27 +4,24 @@
** 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. *
***************************************************************************/
#include "advancedfm.h"
#include "output.h"
#include "filePermissions.h"
-#include <opie/otabwidget.h>
-#include <opie/oprocess.h>
-
#include <qpe/lnkproperties.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/applnk.h>
#include <qpe/ir.h>
#include <qmessagebox.h>
#include <qmultilineedit.h>
#include <qstring.h>
@@ -60,36 +57,36 @@ void AdvancedFm::doDirChange() {
void AdvancedFm::showMenuHidden() {
if (b) {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
} else {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
}
b = !b;
- populateView();
+ populateView();
}
void AdvancedFm::showHidden() {
if (b) {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
} else {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
}
- populateView();
+ populateView();
}
QString AdvancedFm::dealWithSymName(const QString &fileName) {
QString strItem = fileName;
return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
}
void AdvancedFm::runThis() {
if( !CurrentView()->currentItem()) return;
QString fs;
QDir *thisDir = CurrentDir();
@@ -137,25 +134,25 @@ void AdvancedFm::runText() {
}
}
void AdvancedFm::makeDir() {
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QDir *thisDir = CurrentDir();
QString filename = fileDlg->LineEdit1->text();
thisDir->mkdir( thisDir->canonicalPath()+"/"+filename);
}
- populateView();
+ populateView();
}
void AdvancedFm::doDelete() {
QStringList curFileList = getPath();
bool doMsg=true;
int count = curFileList.count();
if( count > 0) {
if(count > 1 ) {
QString msg;
msg=tr("Really delete\n%1 files?").arg(count);
switch ( QMessageBox::warning(this,tr("Delete"),msg
,tr("Yes"),tr("No"),0,0,1) )
@@ -174,86 +171,86 @@ void AdvancedFm::doDelete() {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
myFile = (*it);
if( myFile.find(" -> ",0,TRUE) != -1)
myFile = myFile.left( myFile.find(" -> ",0,TRUE));
QString f = CurrentDir()->canonicalPath();
if(f.right(1).find("/",0,TRUE) == -1)
f += "/";
f += myFile;
if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
//if file is a directory
- switch ( QMessageBox::warning( this, tr("Delete Directory?"),
+ switch ( QMessageBox::warning( this, tr("Delete Directory?"),
tr("Really delete %1\nand all it's contents ?" ).arg( f ) ,
tr("Yes"), tr("No"), 0, 0, 1) ) {
case 0:
{
f=f.left(f.length()-1);
QString cmd="rm -rf "+f;
startProcess( (const QString)cmd.latin1() );
- populateView();
+ populateView();
}
break;
case 1:
// exit
break;
};
} else {
if(doMsg) {
switch ( QMessageBox::warning(this,tr("Delete"),
tr("Really delete\n%1?").arg( myFile ),
tr("Yes"), tr("No"), 0, 0, 1) ) {
case 1:
return;
break;
};
}
-
+
QString cmd="rm "+f;
QFile file(f);
QFileInfo fi(myFile);
if( fi.fileName().find("../",0,TRUE)==-1) {
// qDebug("remove link files "+myFile);
-
+
// DocLnk lnk(f);
DocLnk *lnk;
lnk = new DocLnk(f);
// qDebug("Deleting doclnk " + lnk->linkFile());
if(lnk->isValid())
lnk->removeLinkFile();
// delete lnk;
file.remove();
}
}
}
}
- populateView();
+ populateView();
}
void AdvancedFm::filePerms() {
QStringList curFileList = getPath();
QString filePath;
filePath = CurrentDir()->canonicalPath()+"/";
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
filePermissions *filePerm;
filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
QPEApplication::execDialog( filePerm );
if( filePerm )
delete filePerm;
}
- populateView();
+ populateView();
}
void AdvancedFm::doProperties() {
#if defined(QT_QWS_OPIE)
QStringList curFileList = getPath();
QString filePath;
filePath = CurrentDir()->canonicalPath()+"/";
// qDebug("%d",curFileList.count());
@@ -267,25 +264,25 @@ void AdvancedFm::doProperties() {
}
void AdvancedFm::upDir() {
QDir *thisDir = CurrentDir();
QString current = thisDir->canonicalPath();
QDir dir(current);
dir.cdUp();
current = dir.canonicalPath();
chdir( current.latin1() );
thisDir->cd( current, TRUE);
- populateView();
+ populateView();
update();
}
void AdvancedFm::copy() {
qApp->processEvents();
QStringList curFileList = getPath();
QDir *thisDir = CurrentDir();
QDir *thatDir = OtherDir();
bool doMsg=true;
int count=curFileList.count();
@@ -328,26 +325,26 @@ void AdvancedFm::copy() {
break;
};
}
f.remove();
}
if( !copyFile( curFile, destFile) ) {
QMessageBox::message("AdvancedFm",
tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) );
return;
}
}
- setOtherTabCurrent();
- rePopulate();
+ setOtherTabCurrent();
+ rePopulate();
}
}
void AdvancedFm::copyAs() {
qApp->processEvents();
QStringList curFileList = getPath();
QString curFile, item;
InputDialog *fileDlg;
QDir *thisDir = CurrentDir();
QDir *thatDir = OtherDir();
@@ -378,26 +375,26 @@ void AdvancedFm::copyAs() {
break;
};
}
if( !copyFile( curFile, destFile) ) {
QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+curFile +tr("to\n")+destFile);
return;
}
}
delete fileDlg;
}
- rePopulate();
- setOtherTabCurrent();
+ rePopulate();
+ setOtherTabCurrent();
}
void AdvancedFm::copySameDir() {
qApp->processEvents();
QStringList curFileList = getPath();
QString curFile, item, destFile;
InputDialog *fileDlg;
QDir *thisDir = CurrentDir();
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
item=(*it);
@@ -427,136 +424,136 @@ void AdvancedFm::copySameDir() {
};
}
if(!copyFile( curFile,destFile) ) {
QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+curFile +tr("to\n")+destFile);
return;
}
// qDebug("copy "+curFile+" as "+destFile);
}
delete fileDlg;
}
- rePopulate();
+ rePopulate();
}
void AdvancedFm::move() {
qApp->processEvents();
QStringList curFileList = getPath();
if( curFileList.count() > 0) {
QString curFile, destFile, item;
QDir *thisDir = CurrentDir();
QDir *thatDir = OtherDir();
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
item=(*it);
QString destFile = thatDir->canonicalPath();
if(destFile.right(1).find("/",0,TRUE) == -1)
destFile+="/";
destFile += item;
// qDebug("Destination file is "+destFile);
curFile = thisDir->canonicalPath();
if(curFile.right(1).find("/",0,TRUE) == -1)
- curFile +="/";
+ curFile +="/";
curFile+= item;
// qDebug("CurrentFile file is " + curFile);
if(QFileInfo(curFile).isDir()) {
- moveDirectory( curFile, destFile );
- rePopulate();
- return;
+ moveDirectory( curFile, destFile );
+ rePopulate();
+ return;
}
- QFile f( curFile);
+ QFile f( curFile);
if( f.exists()) {
- if( !copyFile( curFile, destFile) ) {
- QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile);
- return;
+ if( !copyFile( curFile, destFile) ) {
+ QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile);
+ return;
} else
- QFile::remove(curFile);
+ QFile::remove(curFile);
}
- }
+ }
}
- rePopulate();
- setOtherTabCurrent();
+ rePopulate();
+ setOtherTabCurrent();
}
bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) {
- int err = 0;
- if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src;
- err = system((const char*)cmd);
- } else
- err = -1;
-
- if(err!=0) {
- QMessageBox::message(tr("Note"),tr("Could not move\n") + src);
- return false;
- }
- return true;
+ int err = 0;
+ if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src;
+ err = system((const char*)cmd);
+ } else
+ err = -1;
+
+ if(err!=0) {
+ QMessageBox::message(tr("Note"),tr("Could not move\n") + src);
+ return false;
+ }
+ return true;
}
bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) {
- QString cmd = "/bin/cp -fpR " + src + " " + dest;
+ QString cmd = "/bin/cp -fpR " + src + " " + dest;
qWarning(cmd);
- int err = system( (const char *) cmd );
- if ( err != 0 ) {
- QMessageBox::message("AdvancedFm",
- tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) );
- return false;
- }
+ int err = system( (const char *) cmd );
+ if ( err != 0 ) {
+ QMessageBox::message("AdvancedFm",
+ tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) );
+ return false;
+ }
- return true;
+ return true;
}
-
+
bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
-
- if(QFileInfo(src).isDir()) {
- if( copyDirectory( src, dest )) {
- setOtherTabCurrent();
- populateView();
- return true;
- }
- else
- return false;
- }
-
-
- bool success = true;
- struct stat status;
- QFile srcFile(src);
- QFile destFile(dest);
- int err=0;
- int read_fd=0;
+
+ if(QFileInfo(src).isDir()) {
+ if( copyDirectory( src, dest )) {
+ setOtherTabCurrent();
+ populateView();
+ return true;
+ }
+ else
+ return false;
+ }
+
+
+ bool success = true;
+ struct stat status;
+ QFile srcFile(src);
+ QFile destFile(dest);
+ int err=0;
+ int read_fd=0;
int write_fd=0;
struct stat stat_buf;
off_t offset = 0;
if(!srcFile.open( IO_ReadOnly|IO_Raw)) {
// qWarning("open failed");
return success = false;
}
read_fd = srcFile.handle();
if(read_fd != -1) {
fstat (read_fd, &stat_buf);
if( !destFile.open( IO_WriteOnly|IO_Raw ) ) {
// qWarning("destfile open failed");
return success = false;
}
- write_fd = destFile.handle();
+ write_fd = destFile.handle();
if(write_fd != -1) {
err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
if( err == -1) {
QString msg;
switch(err) {
case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. ";
case EINVAL: msg = "Descriptor is not valid or locked. ";
case ENOMEM: msg = "Insufficient memory to read from in_fd.";
case EIO: msg = "Unspecified error while reading from in_fd.";
};
success = false;
// qWarning(msg);
@@ -668,27 +665,27 @@ void AdvancedFm::mkSym() {
}
QString curFile = thisDir->canonicalPath()+"/"+(*it);
if( curFile.right(1) == "/") {
curFile = curFile.left( curFile.length() -1);
}
cmd = "ln -s "+curFile+" "+destName;
// qDebug(cmd);
startProcess( (const QString)cmd );
}
- rePopulate();
- setOtherTabCurrent();
- }
+ rePopulate();
+ setOtherTabCurrent();
+ }
}
void AdvancedFm::doBeam() {
Ir ir;
if(!ir.supported()) {
} else {
QStringList curFileList = getPath();
if( curFileList.count() > 0) {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
QString curFile = (*it);
QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile;
if( curFilePath.right(1) == "/") {
@@ -722,25 +719,25 @@ void AdvancedFm::startProcess(const QString & cmd) {
connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)),
this, SLOT( oprocessStderr(OProcess *, char *, int)));
command << "/bin/sh";
command << "-c";
command << cmd.latin1();
*process << command;
if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
qDebug("could not start process");
}
void AdvancedFm::processEnded(OProcess *) {
- rePopulate();
+ rePopulate();
}
void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
// qWarning("received stderrt %d bytes", buflen);
QString lineStr = buffer;
QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
}
bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
if ( o->inherits( "QLineEdit" ) ) {
if ( e->type() == QEvent::KeyPress ) {
@@ -788,63 +785,63 @@ void AdvancedFm::cancelRename() {
view->viewport()->setFocusProxy( view);
view->setFocus();
}
}
void AdvancedFm::doRename(QListView * view) {
if( !CurrentView()->currentItem()) return;
QRect r = view->itemRect( view->currentItem( ));
r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
r.setX( view->contentsX() );
- if ( r.width() > view->visibleWidth() )
+ if ( r.width() > view->visibleWidth() )
r.setWidth( view->visibleWidth() );
renameBox = new QLineEdit( view->viewport(), "qt_renamebox" );
renameBox->setFrame(true);
renameBox->setText( view->currentItem()->text(0) );
renameBox->selectAll();
renameBox->installEventFilter( this );
view->addChild( renameBox, r.x(), r.y() );
- renameBox->resize( r.size() );
+ renameBox->resize( r.size() );
- view->viewport()->setFocusProxy( renameBox );
+ view->viewport()->setFocusProxy( renameBox );
- renameBox->setFocus();
+ renameBox->setFocus();
renameBox->show();
}
void AdvancedFm::renameIt() {
- if( !CurrentView()->currentItem()) return;
+ if( !CurrentView()->currentItem()) return;
- QListView *thisView = CurrentView();
+ QListView *thisView = CurrentView();
oldName = thisView->currentItem()->text(0);
doRename( thisView );
}
void AdvancedFm::okRename() {
if( !CurrentView()->currentItem()) return;
QString newName = renameBox->text();
- cancelRename();
- QListView * view = CurrentView();
+ cancelRename();
+ QListView * view = CurrentView();
QString path = CurrentDir()->canonicalPath() + "/";
oldName = path + oldName;
newName = path + newName;
if( rename( oldName.latin1(), newName.latin1())== -1)
QMessageBox::message(tr("Note"),tr("Could not rename"));
else
oldName = "";
view->takeItem( view->currentItem() );
delete view->currentItem();
- rePopulate();
+ rePopulate();
}
void AdvancedFm::openSearch() {
QMessageBox::message(tr("Note"),tr("Not Yet Implemented"));
}
diff --git a/noncore/apps/advancedfm/config.in b/noncore/apps/advancedfm/config.in
index 72a1f1b..0ba1487 100644
--- a/noncore/apps/advancedfm/config.in
+++ b/noncore/apps/advancedfm/config.in
@@ -1,4 +1,4 @@
config ADVANCEDFM
boolean "opie-advancedfm (advanced file manager)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI
diff --git a/noncore/apps/advancedfm/main.cpp b/noncore/apps/advancedfm/main.cpp
index 51e38dc..3c1a164 100644
--- a/noncore/apps/advancedfm/main.cpp
+++ b/noncore/apps/advancedfm/main.cpp
@@ -1,33 +1,33 @@
/***************************************************************************
main.cpp - description
-------------------
begin : March 10, 2002
copyright : (C) 2002 by llornkcor
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 <qpe/qpeapplication.h>
-
-
#include "advancedfm.h"
#ifdef NOQUICKLAUNCH
+
+#include <qpe/qpeapplication.h>
+
int main(int argc, char *argv[])
{
QPEApplication a(argc, argv);
AdvancedFm advencedFm;
a.showMainWidget( &advencedFm);
return a.exec();
}
#else
-#include <opie/oapplicationfactory.h>
+#include <opie2/oapplicationfactory.h>
OPIE_EXPORT_APP( OApplicationFactory<AdvancedFm> )
#endif
diff --git a/noncore/apps/advancedfm/opie-advancedfm.control b/noncore/apps/advancedfm/opie-advancedfm.control
index 5bab6ab..bb311c1 100644
--- a/noncore/apps/advancedfm/opie-advancedfm.control
+++ b/noncore/apps/advancedfm/opie-advancedfm.control
@@ -1,10 +1,10 @@
Package: opie-advancedfm
Files: plugins/application/libadvancedfm.so* bin/advancedfm apps/Applications/advancedfm.desktop pics/advancedfm
Priority: optional
Section: opie/applications
Maintainer: L.J. Potter <lpotter@trolltech.com>
Architecture: arm
-Depends: task-opie-minimal
+Depends: task-opie-minimal, libopiecore2, libopieui2
Description: Advanced File Manager
The advanced file manager for the Opie environment.
Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp
index 33abdfc..7dc2416 100644
--- a/noncore/apps/advancedfm/output.cpp
+++ b/noncore/apps/advancedfm/output.cpp
@@ -1,21 +1,19 @@
/****************************************************************************
** outputEdit.cpp
**
** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com>
****************************************************************************/
#include "output.h"
-#include <opie/oprocess.h>
-
#include <qpe/qpeapplication.h>
#include <qpe/applnk.h>
#include <qfile.h>
#include <qmultilineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <errno.h>
/* XPM */
static char * filesave_xpm[] = {
diff --git a/noncore/apps/advancedfm/output.h b/noncore/apps/advancedfm/output.h
index 199a684..26c0fa0 100644
--- a/noncore/apps/advancedfm/output.h
+++ b/noncore/apps/advancedfm/output.h
@@ -7,59 +7,59 @@
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef OUTPUT_H
#define OUTPUT_H
#include <qvariant.h>
#include <qdialog.h>
#include <qcstring.h>
#include <qstringlist.h>
#include <qlineedit.h>
#include <qwhatsthis.h>
-#include <opie/oprocess.h>
+#include <opie2/oprocess.h>
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
class QMultiLineEdit;
class Output : public QDialog
-{
+{
Q_OBJECT
public:
Output(const QStringList commands=0, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~Output();
QMultiLineEdit* OutputEdit;
protected:
QGridLayout* OutputLayout;
OProcess *proc;
protected slots:
void saveOutput();
void commandStdout(OProcess*, char *, int);
void commandStdin(const QByteArray &);
void commandStderr(OProcess*, char *, int);
void processFinished();
private:
QString cmmd;
-
+
};
class InputDialog : public QDialog
-{
+{
Q_OBJECT
public:
InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~InputDialog();
QString inputText;
QLineEdit* LineEdit1;
- void setInputText(const QString &);
+ void setInputText(const QString &);
private slots:
void returned();
-
+
};
#endif // OUTPUT_H