summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfmMenu.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/advancedfm/advancedfmMenu.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp80
1 files changed, 48 insertions, 32 deletions
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
@@ -11,12 +11,14 @@
***************************************************************************/
#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>
@@ -50,29 +52,43 @@ void AdvancedFm::doLocalCd() {
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() {
@@ -86,13 +102,13 @@ void AdvancedFm::showRemoteHidden() {
}
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());
@@ -138,13 +154,13 @@ void AdvancedFm::runThis() {
}
}
}
}
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;
}
@@ -320,13 +336,13 @@ void AdvancedFm::remoteRename()
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 ) {
@@ -334,26 +350,26 @@ void AdvancedFm::filePerms() {
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());
@@ -366,13 +382,13 @@ void AdvancedFm::doProperties() {
}
#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);
@@ -392,13 +408,13 @@ void AdvancedFm::upDir() {
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));
@@ -424,13 +440,13 @@ void AdvancedFm::copy() {
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
@@ -460,25 +476,25 @@ void AdvancedFm::copy() {
+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);
@@ -509,13 +525,13 @@ void AdvancedFm::copyAs() {
}
}
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);
@@ -549,23 +565,23 @@ void AdvancedFm::copyAs() {
}
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);
@@ -646,13 +662,13 @@ 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)
@@ -675,13 +691,13 @@ void AdvancedFm::move() {
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();
@@ -705,13 +721,13 @@ void AdvancedFm::move() {
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();
}
}
@@ -746,13 +762,13 @@ bool AdvancedFm::copyFile( const QString & dest, const QString & src ) {
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);
}
@@ -792,13 +808,13 @@ void AdvancedFm::runCommand() {
}
}
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);
@@ -815,13 +831,13 @@ void AdvancedFm::runCommandStd() {
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;
@@ -847,52 +863,52 @@ void AdvancedFm::fileStatus() {
}
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);
@@ -900,26 +916,26 @@ void AdvancedFm::mkSym() {
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 * )));