summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-25 18:15:30 (UTC)
committer llornkcor <llornkcor>2002-04-25 18:15:30 (UTC)
commit42cb3d115a46637f4c46f4b3f3821075a2c18f02 (patch) (side-by-side diff)
treeb11a7aebc1c5282e463e211d89ba64cccf8dae29
parent1568872bbd1c92242d7110fe931da23226ca0c55 (diff)
downloadopie-42cb3d115a46637f4c46f4b3f3821075a2c18f02.zip
opie-42cb3d115a46637f4c46f4b3f3821075a2c18f02.tar.gz
opie-42cb3d115a46637f4c46f4b3f3821075a2c18f02.tar.bz2
fixed menu items
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp37
-rw-r--r--noncore/apps/advancedfm/advancedfm.h4
2 files changed, 34 insertions, 7 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 1083f23..4289fcf 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -73,186 +73,188 @@ AdvancedFm::AdvancedFm( )
layout->setMargin( 2);
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
QPEMenuBar *menuBar = new QPEMenuBar(this);
// fileMenu = new QPopupMenu( 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);
cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton");
cfButton ->setFixedSize( QSize( 20, 20 ) );
connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) );
cfButton->setFlat(TRUE);
layout->addMultiCellWidget( cfButton , 0, 0, 2, 2);
sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton");
sdButton->setFixedSize( QSize( 20, 20 ) );
connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) );
sdButton->setFlat(TRUE);
layout->addMultiCellWidget( sdButton , 0, 0, 3, 3);
cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
cdUpButton ->setFixedSize( QSize( 20, 20 ) );
connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
cdUpButton ->setFlat(TRUE);
layout->addMultiCellWidget( cdUpButton , 0, 0, 4, 4);
docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
docButton->setFixedSize( QSize( 20, 20 ) );
connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
docButton->setFlat(TRUE);
layout->addMultiCellWidget( docButton, 0, 0, 5, 5);
homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
homeButton->setFixedSize( QSize( 20, 20 ) );
connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
homeButton->setFlat(TRUE);
layout->addMultiCellWidget( homeButton, 0, 0, 6, 6);
// fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
// fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
// fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
+ fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
fileMenu->insertSeparator();
- fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
- fileMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
+ fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
+ fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
fileMenu->insertSeparator();
- fileMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
+ fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
fileMenu->setCheckable(TRUE);
viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
viewMenu->insertSeparator();
viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
viewMenu->setCheckable(TRUE);
TabWidget = new QTabWidget( this, "TabWidget" );
layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6);
tab = new QWidget( TabWidget, "tab" );
tabLayout = new QGridLayout( tab );
tabLayout->setSpacing( 2);
tabLayout->setMargin( 2);
Local_View = new QListView( tab, "Local_View" );
// Local_View->setResizePolicy( QListView::AutoOneFit );
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 );
connect( Local_View, SIGNAL( clicked( QListViewItem*)),
this,SLOT( localListClicked(QListViewItem *)) );
connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) );
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);
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);
// OFileSelector *fileSelector;
// fileSelector = new OFileSelector(tab_3,0,0,"/","","*");
// tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 );
// TabWidget->insertTab( tab_3, tr( "Files" ) );
- currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
+ 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.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
currentRemoteDir.setPath( QDir::currentDirPath());
- currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
+b = TRUE;
+ currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
currentPathCombo->setEditable(TRUE);
layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6);
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
this, SLOT( currentPathComboActivated( const QString & ) ) );
connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
this,SLOT(currentPathComboChanged()));
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6);
filterStr="*";
b=FALSE;
populateLocalView();
populateRemoteView();
}
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);
}
if (TabWidget->currentPageIndex() == 1) {
currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath());
viewMenu->setItemChecked(viewMenu->idAt(1),TRUE);
viewMenu->setItemChecked(viewMenu->idAt(0),FALSE);
}
@@ -1217,54 +1219,77 @@ void AdvancedFm::runCommandStd() {
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) {
curFile = Local_View->currentItem()->text(0);
} else {
curFile = Remote_View->currentItem()->text(0);
}
QString command = " stat -l "+ curFile +" 2>&1";
int err=0;
Output *outDlg;
outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
outDlg->showMaximized();
outDlg->show();
qApp->processEvents();
FILE *fp;
char line[130];
sleep(1);
fp = popen( (const char *) command, "r");
if ( !fp ) {
qDebug("Could not execute '" + command + "'! err=%d", fp);
QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") );
pclose(fp);
return;
} else {
while ( fgets( line, sizeof line, fp)) {
outDlg->OutputEdit->append(line);
outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
}
}
}
+void AdvancedFm::mkDir() {
+ if (TabWidget->currentPageIndex() == 0)
+ localMakDir();
+ else
+ remoteMakDir();
+
+}
+
+void AdvancedFm::rn() {
+ if (TabWidget->currentPageIndex() == 0)
+ localRename();
+ else
+ remoteRename();
+
+}
+
+void AdvancedFm::del() {
+ if (TabWidget->currentPageIndex() == 0)
+ localDelete();
+ else
+ remoteDelete();
+}
+
void AdvancedFm::doAbout() {
QMessageBox::message("AdvancedFm","Advanced FileManager\n"
"is copyright 2002 by\n"
"L.J.Potter<llornkcor@handhelds.org>\n"
"and is licensed by the GPL");
}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 30ff28c..a5f26a7 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -19,97 +19,99 @@
#include <qstring.h>
#include <qpoint.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QComboBox;
class QListView;
class QListviewItem;
class QLabel;
class QProgressBar;
class QSpinBox;
class QTabWidget;
class QWidget;
class QPEToolBar;
class QPEMenuBar;
class QPopupMenu;
class QFile;
class QListViewItem;
class QLineEdit;
class QPushButton;
class AdvancedFm : public QMainWindow
{
Q_OBJECT
public:
AdvancedFm();
~AdvancedFm();
QTabWidget *TabWidget;
QWidget *tab, *tab_2, *tab_3;
QListView *Local_View, *Remote_View;
QLineEdit *currentPathEdit;
QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu;
QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton;
QDir currentDir, currentRemoteDir;
QComboBox *currentPathCombo;
QString filterStr;
QListViewItem * item;
bool b;
int currentServerConfig;
protected slots:
void showLocalMenu( QListViewItem *);
void showRemoteMenu( QListViewItem *);
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();
QString getPath();
void switchToLocalTab();
void switchToRemoteTab();
protected:
QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
QStringList remoteDirPathStringList, localDirPathStringList;
protected slots:
void homeButtonPushed();
void docButtonPushed();
void SDButtonPushed();
void CFButtonPushed();
void upDir();
void currentPathComboChanged();
void copy();
void copyAs();
void currentPathComboActivated(const QString &);
void fillCombo(const QString &);
bool copyFile( const QString & , const QString & );
void move();
void fileStatus();