summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp267
-rw-r--r--noncore/apps/advancedfm/advancedfm.h6
2 files changed, 230 insertions, 43 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 5f47b9b..bb932c5 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -152,4 +152,5 @@ AdvancedFm::AdvancedFm( )
Local_View->setAllColumnsShowFocus(TRUE);
-// Local_View->setMultiSelection( TRUE );
-// Local_View->setSelectionMode(QListView::Extended);
+ Local_View->setMultiSelection( TRUE );
+ Local_View->setSelectionMode(QListView::Extended);
+
QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
@@ -177,4 +178,5 @@ AdvancedFm::AdvancedFm( )
Remote_View->setAllColumnsShowFocus(TRUE);
-// Remote_View->setMultiSelection( TRUE );
-// Remote_View->setSelectionMode(QListView::Extended);
+ Remote_View->setMultiSelection( TRUE );
+ Remote_View->setSelectionMode(QListView::Extended);
+
QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
@@ -371,2 +373,3 @@ void AdvancedFm::populateLocalView()
+
void AdvancedFm::populateRemoteView()
@@ -566,5 +569,6 @@ void AdvancedFm::showHidden()
currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
+ fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
// localMenu->setItemChecked(localMenu->idAt(0),TRUE);
// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
- b=TRUE;
+ b=FALSE;
@@ -572,7 +576,9 @@ void AdvancedFm::showHidden()
currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
+ fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
- b=FALSE;
+ b=TRUE;
}
populateLocalView();
+
}
@@ -632,2 +638,4 @@ void AdvancedFm::showLocalMenu(QListViewItem * item)
m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
+ m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
+ m.insertSeparator();
m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
@@ -665,2 +673,4 @@ void AdvancedFm::showRemoteMenu(QListViewItem * item)
m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
+ m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
+ m.insertSeparator();
m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
@@ -754,9 +764,15 @@ void AdvancedFm::localDelete()
{
- QString f = Local_View->currentItem()->text(0);
- if(QDir(f).exists() ) {
- switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
- tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
+ QStringList curFileList = getPath();
+ QString myFile;
+ 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()+"/"+myFile;
+ if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
+ switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+" ?"
+ ,tr("Yes"),tr("No"),0,0,1) ) {
case 0: {
- f=currentDir.canonicalPath()+"/"+f;
- QString cmd="rmdir "+f;
+ QString cmd="rmdir -rf "+f;
system( cmd.latin1());
@@ -774,5 +790,6 @@ void AdvancedFm::localDelete()
case 0: {
- f=currentDir.canonicalPath()+"/"+f;
QString cmd="rm "+f;
- system( cmd.latin1());
+ QFile file(f);
+ file.remove();
+// system( cmd.latin1());
populateLocalView();
@@ -785,2 +802,4 @@ void AdvancedFm::localDelete()
}
+
+ }
}
@@ -789,9 +808,15 @@ void AdvancedFm::remoteDelete()
{
- QString f = Remote_View->currentItem()->text(0);
- if(QDir(f).exists() ) {
- switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
- tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
+ QStringList curFileList = getPath();
+ QString myFile;
+
+ 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 = currentRemoteDir.canonicalPath()+"/"+myFile;
+ if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
+ switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+" ?",
+ tr("Yes"),tr("No"),0,0,1) ) {
case 0: {
- f = currentRemoteDir.canonicalPath()+"/"+f;
- QString cmd="rmdir "+f;
+ QString cmd="rmdir -rf "+f;
system( cmd.latin1());
@@ -809,5 +834,6 @@ void AdvancedFm::remoteDelete()
case 0: {
- f = currentRemoteDir.canonicalPath()+"/"+f;
QString cmd="rm "+f;
- system( cmd.latin1());
+ QFile file(f);
+ file.remove();
+// system( cmd.latin1());
populateRemoteView();
@@ -821,2 +847,3 @@ void AdvancedFm::remoteDelete()
}
+}
@@ -857,2 +884,3 @@ void AdvancedFm::switchToLocalTab()
TabWidget->setCurrentPage(0);
+ Local_View->setFocus();
}
@@ -862,2 +890,3 @@ void AdvancedFm::switchToRemoteTab()
TabWidget->setCurrentPage(1);
+ Remote_View->setFocus();
}
@@ -928,5 +957,15 @@ void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
void AdvancedFm::filePerms() {
- QString curFile = getPath();
+
+ QStringList curFileList = getPath();
+ QString filePath;
+
+ if (TabWidget->currentPageIndex() == 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 &)(curFile));
+ filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
filePerm->showMaximized();
@@ -936,6 +975,14 @@ void AdvancedFm::filePerms() {
}
+}
void AdvancedFm::doProperties() {
-
- DocLnk lnk( getPath());
+ QStringList curFileList = getPath();
+ QString filePath;
+ if (TabWidget->currentPageIndex() == 0) {
+ filePath = currentDir.canonicalPath()+"/";
+ } else {
+ filePath= currentRemoteDir.canonicalPath()+"/";
+ }
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+ DocLnk lnk( (filePath+*it));
LnkProperties prop( &lnk );
@@ -945,10 +992,27 @@ void AdvancedFm::doProperties() {
}
+}
-QString AdvancedFm::getPath() {
+QStringList AdvancedFm::getPath() {
+ QStringList strList;
if (TabWidget->currentPageIndex() == 0) {
- return currentDir.canonicalPath()+"/"+ Local_View->currentItem()->text(0);
+ QList<QListViewItem> * getSelectedItems( QListView * Local_View );
+ QListViewItemIterator it( Local_View );
+ for ( ; it.current(); ++it ) {
+ if ( it.current()->isSelected() ) {
+ strList << it.current()->text(0);
+ }
+ }
+ return strList;
} else {
- return currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0);
+ QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
+ QListViewItemIterator it( Remote_View );
+ for ( ; it.current(); ++it ) {
+ if ( it.current()->isSelected() ) {
+ strList << currentDir.canonicalPath()+"/"+ it.current()->text(0);
}
}
+ return strList;
+ }
+ return "";
+}
@@ -1034,5 +1098,9 @@ void AdvancedFm::copy()
{
- QString curFile = getPath();
+ QStringList curFileList = getPath();
+ QString curFile;
if (TabWidget->currentPageIndex() == 0) {
- QString destFile = currentRemoteDir.canonicalPath()+"/"+Local_View->currentItem()->text(0);
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+
+ QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
+ curFile = currentDir.canonicalPath()+"/"+(*it);
QFile f(destFile);
@@ -1042,6 +1110,11 @@ void AdvancedFm::copy()
qWarning("nothin doing");
+ }
populateRemoteView();
TabWidget->setCurrentPage(1);
+
} else {
- QString destFile = currentDir.canonicalPath()+"/"+Remote_View->currentItem()->text(0);
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+
+ QString destFile = currentDir.canonicalPath()+"/"+(*it);
+ curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
QFile f(destFile);
@@ -1051,2 +1124,3 @@ void AdvancedFm::copy()
qWarning("nothin doing");
+ }
populateLocalView();
@@ -1058,7 +1132,13 @@ void AdvancedFm::copyAs()
{
- QString curFile = getPath();
- if (TabWidget->currentPageIndex() == 0) {
- QString destFile = Local_View->currentItem()->text(0);
+ QStringList curFileList = getPath();
+ QString curFile;
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
+
+ if (TabWidget->currentPageIndex() == 0) {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+ QString destFile = *it;
+ curFile = currentDir.canonicalPath()+"/"+(*it);
+// InputDialog *fileDlg;
+// fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
fileDlg->setInputText((const QString &) destFile );
@@ -1075,2 +1155,4 @@ void AdvancedFm::copyAs()
}
+ }
+
populateRemoteView();
@@ -1078,5 +1160,7 @@ void AdvancedFm::copyAs()
} else {
- QString destFile = Remote_View->currentItem()->text(0);
- InputDialog *fileDlg;
- fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
+ if (TabWidget->currentPageIndex() == 0) {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+
+ curFile = currentDir.canonicalPath()+"/"+(*it);
+ QString destFile = *it;
fileDlg->setInputText((const QString &) destFile);
@@ -1093,2 +1177,3 @@ void AdvancedFm::copyAs()
}
+ }
populateLocalView();
@@ -1097,9 +1182,15 @@ void AdvancedFm::copyAs()
}
+}
void AdvancedFm::move() {
- QString curFile = getPath();
+
+ QStringList curFileList = getPath();
+ QString curFile;
// qDebug(curFile);
QString destFile;
+
if (TabWidget->currentPageIndex() == 0) {
- QString destFile = currentRemoteDir.canonicalPath() + "/" + Local_View->currentItem()->text(0);
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+ QString destFile = currentRemoteDir.canonicalPath() + "/" + *it;
+ curFile = currentDir.canonicalPath()+"/"+(*it);
qDebug("Destination file is "+destFile);
@@ -1114,6 +1205,9 @@ void AdvancedFm::move() {
QFile::remove(curFile);
+ }
TabWidget->setCurrentPage(1);
} else {
- QString destFile = currentDir.canonicalPath() + "/" + Remote_View->currentItem()->text(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);
@@ -1129,2 +1223,3 @@ void AdvancedFm::move() {
}
+ }
populateRemoteView();
@@ -1295 +1390,91 @@ void AdvancedFm::doAbout() {
}
+
+void AdvancedFm::keyReleaseEvent( QKeyEvent *e)
+{
+ switch ( e->key() ) {
+ case Key_Delete:
+ del();
+ break;
+ case Key_H:
+ showHidden();
+ break;
+ case Key_E:
+ runThis();
+ break;
+ case Key_C:
+ copy();
+ break;
+ case Key_A:
+ copyAs();
+ break;
+ case Key_M:
+ move();
+ break;
+ case Key_R:
+ rn();
+ break;
+ case Key_I:
+ fileStatus();
+ break;
+ case Key_U:
+ upDir();
+ break;
+ case Key_P:
+ filePerms();
+ break;
+ case Key_N:
+ mkDir();
+ break;
+ case Key_1:
+ switchToLocalTab();
+ break;
+ case Key_2:
+ switchToRemoteTab();
+ break;
+ case Key_3:
+ CFButtonPushed();
+ break;
+ case Key_4:
+ SDButtonPushed();
+ break;
+ case Key_5:
+ homeButtonPushed();
+ break;
+ case Key_6:
+ docButtonPushed();
+ break;
+ case Key_7:
+ break;
+ case Key_8:
+ break;
+ case Key_9:
+ break;
+ case Key_0:
+ break;
+
+
+
+ }
+
+}
+
+void AdvancedFm::mkSym() {
+ QString cmd;
+ if (TabWidget->currentPageIndex() == 0) {
+ QString curFile = Local_View->currentItem()->text(0);
+ if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1);
+ QString destName = currentRemoteDir.canonicalPath()+"/"+curFile;
+ curFile = currentDir.canonicalPath()+"/"+curFile;
+ cmd = "ln -s "+curFile+" "+destName;
+ system(cmd.latin1() );
+ populateRemoteView();
+ } else {
+ QString curFile = Remote_View->currentItem()->text(0);
+ if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1);
+ QString destName = currentDir.canonicalPath()+"/"+curFile;
+ curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
+ cmd = "ln -s "+curFile+" "+destName;
+ system(cmd.latin1() );
+ populateLocalView();
+ }
+}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index a5f26a7..c00713f 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -20,2 +20,3 @@
#include <qpoint.h>
+#include <qstringlist.h>
@@ -95,3 +96,4 @@ protected slots:
void runCommandStd();
- QString getPath();
+ QStringList getPath();
+ void mkSym();
void switchToLocalTab();
@@ -102,3 +104,3 @@ protected:
QStringList remoteDirPathStringList, localDirPathStringList;
-
+ void keyReleaseEvent( QKeyEvent *);
protected slots: