author | llornkcor <llornkcor> | 2002-11-15 14:20:40 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-15 14:20:40 (UTC) |
commit | b35750b8fe75e055e014e0dd294c714976f5715f (patch) (unidiff) | |
tree | 3a57c481f4b416e6bfe7ce6794077a2225165839 | |
parent | ab8d331905b59a86b50cd513123cdde67e4bfb8a (diff) | |
download | opie-b35750b8fe75e055e014e0dd294c714976f5715f.zip opie-b35750b8fe75e055e014e0dd294c714976f5715f.tar.gz opie-b35750b8fe75e055e014e0dd294c714976f5715f.tar.bz2 |
added select all, and changed delete of multi files to ask only once. Changed some messagebox strings
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 1 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 220 |
3 files changed, 139 insertions, 83 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 12ebbf2..7bccce9 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -1,153 +1,154 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | advancedfm.h | 2 | advancedfm.h |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #ifndef ADVANCEDFM_H | 12 | #ifndef ADVANCEDFM_H |
13 | #define ADVANCEDFM_H | 13 | #define ADVANCEDFM_H |
14 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties | 14 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties |
15 | #define QT_QWS_OPIE | 15 | #define QT_QWS_OPIE |
16 | 16 | ||
17 | //#include <opie/otabwidget.h> | 17 | //#include <opie/otabwidget.h> |
18 | #include <qpe/ir.h> | 18 | #include <qpe/ir.h> |
19 | 19 | ||
20 | #include <qvariant.h> | 20 | #include <qvariant.h> |
21 | #include <qdialog.h> | 21 | #include <qdialog.h> |
22 | #include <qmainwindow.h> | 22 | #include <qmainwindow.h> |
23 | #include <qstringlist.h> | 23 | #include <qstringlist.h> |
24 | #include <qdir.h> | 24 | #include <qdir.h> |
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qpoint.h> | 26 | #include <qpoint.h> |
27 | #include <qtimer.h> | 27 | #include <qtimer.h> |
28 | 28 | ||
29 | class OTabWidget; | 29 | class OTabWidget; |
30 | class QVBoxLayout; | 30 | class QVBoxLayout; |
31 | class QHBoxLayout; | 31 | class QHBoxLayout; |
32 | class QGridLayout; | 32 | class QGridLayout; |
33 | class QComboBox; | 33 | class QComboBox; |
34 | class QListView; | 34 | class QListView; |
35 | class QListviewItem; | 35 | class QListviewItem; |
36 | class QLabel; | 36 | class QLabel; |
37 | class QProgressBar; | 37 | class QProgressBar; |
38 | class QSpinBox; | 38 | class QSpinBox; |
39 | class QTabWidget; | 39 | class QTabWidget; |
40 | class QWidget; | 40 | class QWidget; |
41 | class QPEToolBar; | 41 | class QPEToolBar; |
42 | class QPEMenuBar; | 42 | class QPEMenuBar; |
43 | class QPopupMenu; | 43 | class QPopupMenu; |
44 | class QFile; | 44 | class QFile; |
45 | class QListViewItem; | 45 | class QListViewItem; |
46 | class QLineEdit; | 46 | class QLineEdit; |
47 | //class QPushButton; | 47 | //class QPushButton; |
48 | class QToolButton; | 48 | class QToolButton; |
49 | class Ir; | 49 | class Ir; |
50 | 50 | ||
51 | class AdvancedFm : public QMainWindow | 51 | class AdvancedFm : public QMainWindow |
52 | { | 52 | { |
53 | Q_OBJECT | 53 | Q_OBJECT |
54 | public: | 54 | public: |
55 | AdvancedFm(); | 55 | AdvancedFm(); |
56 | ~AdvancedFm(); | 56 | ~AdvancedFm(); |
57 | 57 | ||
58 | OTabWidget *TabWidget; | 58 | OTabWidget *TabWidget; |
59 | // QTabWidget *TabWidget; | 59 | // QTabWidget *TabWidget; |
60 | QWidget *tab, *tab_2, *tab_3; | 60 | QWidget *tab, *tab_2, *tab_3; |
61 | QListView *Local_View, *Remote_View; | 61 | QListView *Local_View, *Remote_View; |
62 | 62 | ||
63 | QLineEdit *currentPathEdit; | 63 | QLineEdit *currentPathEdit; |
64 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; | 64 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; |
65 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 65 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
66 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 66 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
67 | QDir currentDir, currentRemoteDir; | 67 | QDir currentDir, currentRemoteDir; |
68 | QComboBox *currentPathCombo; | 68 | QComboBox *currentPathCombo; |
69 | QString filterStr; | 69 | QString filterStr; |
70 | QListViewItem * item; | 70 | QListViewItem * item; |
71 | bool b; | 71 | bool b; |
72 | QStringList fileSystemTypeList, fsList; | 72 | QStringList fileSystemTypeList, fsList; |
73 | int currentServerConfig; | 73 | int currentServerConfig; |
74 | protected slots: | 74 | protected slots: |
75 | void selectAll(); | ||
75 | void addToDocs(); | 76 | void addToDocs(); |
76 | void doLocalCd(); | 77 | void doLocalCd(); |
77 | void doRemoteCd(); | 78 | void doRemoteCd(); |
78 | // void copy(); | 79 | // void copy(); |
79 | void mkDir(); | 80 | void mkDir(); |
80 | void del(); | 81 | void del(); |
81 | void rn(); | 82 | void rn(); |
82 | void populateLocalView(); | 83 | void populateLocalView(); |
83 | void populateRemoteView(); | 84 | void populateRemoteView(); |
84 | void showHidden(); | 85 | void showHidden(); |
85 | void showMenuHidden(); | 86 | void showMenuHidden(); |
86 | void showRemoteHidden(); | 87 | void showRemoteHidden(); |
87 | void writeConfig(); | 88 | void writeConfig(); |
88 | void readConfig(); | 89 | void readConfig(); |
89 | void localListClicked(QListViewItem *); | 90 | void localListClicked(QListViewItem *); |
90 | void remoteListClicked(QListViewItem *); | 91 | void remoteListClicked(QListViewItem *); |
91 | void localListPressed( int, QListViewItem *, const QPoint&, int); | 92 | void localListPressed( int, QListViewItem *, const QPoint&, int); |
92 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); | 93 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); |
93 | void localMakDir(); | 94 | void localMakDir(); |
94 | void localDelete(); | 95 | void localDelete(); |
95 | void remoteMakDir(); | 96 | void remoteMakDir(); |
96 | void remoteDelete(); | 97 | void remoteDelete(); |
97 | /* bool remoteDirList(const QString &); */ | 98 | /* bool remoteDirList(const QString &); */ |
98 | /* bool remoteChDir(const QString &); */ | 99 | /* bool remoteChDir(const QString &); */ |
99 | void tabChanged(QWidget*); | 100 | void tabChanged(QWidget*); |
100 | void cleanUp(); | 101 | void cleanUp(); |
101 | void remoteRename(); | 102 | void remoteRename(); |
102 | void localRename(); | 103 | void localRename(); |
103 | void runThis(); | 104 | void runThis(); |
104 | void runText(); | 105 | void runText(); |
105 | void filePerms(); | 106 | void filePerms(); |
106 | void doProperties(); | 107 | void doProperties(); |
107 | void runCommand(); | 108 | void runCommand(); |
108 | void runCommandStd(); | 109 | void runCommandStd(); |
109 | QStringList getPath(); | 110 | QStringList getPath(); |
110 | void mkSym(); | 111 | void mkSym(); |
111 | void switchToLocalTab(); | 112 | void switchToLocalTab(); |
112 | void switchToRemoteTab(); | 113 | void switchToRemoteTab(); |
113 | 114 | ||
114 | protected: | 115 | protected: |
115 | bool zaurusDevice; | 116 | bool zaurusDevice; |
116 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 117 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
117 | QStringList remoteDirPathStringList, localDirPathStringList; | 118 | QStringList remoteDirPathStringList, localDirPathStringList; |
118 | 119 | ||
119 | void init(); | 120 | void init(); |
120 | void initConnections(); | 121 | void initConnections(); |
121 | void keyReleaseEvent( QKeyEvent *); | 122 | void keyReleaseEvent( QKeyEvent *); |
122 | QString getFileSystemType(const QString &); | 123 | QString getFileSystemType(const QString &); |
123 | QString getDiskSpace(const QString &); | 124 | QString getDiskSpace(const QString &); |
124 | void parsetab(const QString &fileName); | 125 | void parsetab(const QString &fileName); |
125 | QString checkDiskSpace(const QString &); | 126 | QString checkDiskSpace(const QString &); |
126 | 127 | ||
127 | protected slots: | 128 | protected slots: |
128 | void showFileMenu(); | 129 | void showFileMenu(); |
129 | void cancelMenuTimer(); | 130 | void cancelMenuTimer(); |
130 | void homeButtonPushed(); | 131 | void homeButtonPushed(); |
131 | void docButtonPushed(); | 132 | void docButtonPushed(); |
132 | void SDButtonPushed(); | 133 | void SDButtonPushed(); |
133 | void CFButtonPushed(); | 134 | void CFButtonPushed(); |
134 | void QPEButtonPushed(); | 135 | void QPEButtonPushed(); |
135 | void upDir(); | 136 | void upDir(); |
136 | void currentPathComboChanged(); | 137 | void currentPathComboChanged(); |
137 | void copy(); | 138 | void copy(); |
138 | void copyAs(); | 139 | void copyAs(); |
139 | void copySameDir(); | 140 | void copySameDir(); |
140 | void currentPathComboActivated(const QString &); | 141 | void currentPathComboActivated(const QString &); |
141 | void fillCombo(const QString &); | 142 | void fillCombo(const QString &); |
142 | bool copyFile( const QString & , const QString & ); | 143 | bool copyFile( const QString & , const QString & ); |
143 | void move(); | 144 | void move(); |
144 | void fileStatus(); | 145 | void fileStatus(); |
145 | void doAbout(); | 146 | void doAbout(); |
146 | void doBeam(); | 147 | void doBeam(); |
147 | void fileBeamFinished( Ir *); | 148 | void fileBeamFinished( Ir *); |
148 | 149 | ||
149 | private: | 150 | private: |
150 | QTimer menuTimer; | 151 | QTimer menuTimer; |
151 | }; | 152 | }; |
152 | 153 | ||
153 | #endif // ADVANCEDFM_H | 154 | #endif // ADVANCEDFM_H |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 7188640..f0a0a35 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -1,185 +1,186 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | advancedfmData.cpp | 2 | advancedfmData.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Mon 09-23-2002 13:24:11 | 4 | ** Created: Mon 09-23-2002 13:24:11 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #include "advancedfm.h" | 12 | #include "advancedfm.h" |
13 | 13 | ||
14 | #include <opie/otabwidget.h> | 14 | #include <opie/otabwidget.h> |
15 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
16 | #include <qpe/qpemenubar.h> | 16 | #include <qpe/qpemenubar.h> |
17 | #include <qpe/qpetoolbar.h> | 17 | #include <qpe/qpetoolbar.h> |
18 | #include <qpe/resource.h> | 18 | #include <qpe/resource.h> |
19 | 19 | ||
20 | #include <qlayout.h> | 20 | #include <qlayout.h> |
21 | #include <qpixmap.h> | 21 | #include <qpixmap.h> |
22 | #include <qcombobox.h> | 22 | #include <qcombobox.h> |
23 | #include <qpopupmenu.h> | 23 | #include <qpopupmenu.h> |
24 | #include <qtabwidget.h> | 24 | #include <qtabwidget.h> |
25 | #include <qtoolbutton.h> | 25 | #include <qtoolbutton.h> |
26 | #include <qlineedit.h> | 26 | #include <qlineedit.h> |
27 | #include <qlistview.h> | 27 | #include <qlistview.h> |
28 | 28 | ||
29 | #include <sys/utsname.h> | 29 | #include <sys/utsname.h> |
30 | 30 | ||
31 | 31 | ||
32 | void AdvancedFm::init() { | 32 | void AdvancedFm::init() { |
33 | #if defined(QT_QWS_OPIE) | 33 | #if defined(QT_QWS_OPIE) |
34 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); | 34 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); |
35 | #endif | 35 | #endif |
36 | setCaption( tr( "AdvancedFm" ) ); | 36 | setCaption( tr( "AdvancedFm" ) ); |
37 | 37 | ||
38 | QGridLayout *layout = new QGridLayout( this ); | 38 | QGridLayout *layout = new QGridLayout( this ); |
39 | layout->setSpacing( 2); | 39 | layout->setSpacing( 2); |
40 | layout->setMargin( 2); | 40 | layout->setMargin( 2); |
41 | 41 | ||
42 | 42 | ||
43 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 43 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
44 | fileMenu = new QPopupMenu( this ); | 44 | fileMenu = new QPopupMenu( this ); |
45 | viewMenu = new QPopupMenu( this ); | 45 | viewMenu = new QPopupMenu( this ); |
46 | 46 | ||
47 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 47 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
48 | 48 | ||
49 | menuBar->insertItem( tr( "File" ), fileMenu); | 49 | menuBar->insertItem( tr( "File" ), fileMenu); |
50 | menuBar->insertItem( tr( "View" ), viewMenu); | 50 | menuBar->insertItem( tr( "View" ), viewMenu); |
51 | 51 | ||
52 | qpeDirButton= new QToolButton(this,"QPEButton"); | 52 | qpeDirButton= new QToolButton(this,"QPEButton"); |
53 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 53 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
54 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | 54 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); |
55 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | 55 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); |
56 | 56 | ||
57 | cfButton = new QToolButton( this,"CFButton"); | 57 | cfButton = new QToolButton( this,"CFButton"); |
58 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 58 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
59 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 59 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
60 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); | 60 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); |
61 | 61 | ||
62 | sdButton = new QToolButton( this,"SDButton"); | 62 | sdButton = new QToolButton( this,"SDButton"); |
63 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); | 63 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); |
64 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 64 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
65 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); | 65 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); |
66 | 66 | ||
67 | cdUpButton = new QToolButton( this,"cdUpButton"); | 67 | cdUpButton = new QToolButton( this,"cdUpButton"); |
68 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 68 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
69 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 69 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
70 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); | 70 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); |
71 | 71 | ||
72 | docButton = new QToolButton( this,"docsButton"); | 72 | docButton = new QToolButton( this,"docsButton"); |
73 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 73 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
74 | docButton->setFixedSize( QSize( 20, 20 ) ); | 74 | docButton->setFixedSize( QSize( 20, 20 ) ); |
75 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); | 75 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); |
76 | 76 | ||
77 | homeButton = new QToolButton( this,"homeButton"); | 77 | homeButton = new QToolButton( this,"homeButton"); |
78 | homeButton->setPixmap(Resource::loadPixmap("home")); | 78 | homeButton->setPixmap(Resource::loadPixmap("home")); |
79 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 79 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
80 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); | 80 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); |
81 | 81 | ||
82 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 82 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); |
83 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 83 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
84 | fileMenu->insertSeparator(); | 84 | fileMenu->insertSeparator(); |
85 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 85 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
86 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 86 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
87 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 87 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
88 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 88 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
89 | fileMenu->insertSeparator(); | 89 | fileMenu->insertSeparator(); |
90 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); | ||
90 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 91 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
91 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 92 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
92 | fileMenu->setCheckable(TRUE); | 93 | fileMenu->setCheckable(TRUE); |
93 | 94 | ||
94 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 95 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
95 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 96 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
96 | viewMenu->insertSeparator(); | 97 | viewMenu->insertSeparator(); |
97 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 98 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
98 | viewMenu->setCheckable(TRUE); | 99 | viewMenu->setCheckable(TRUE); |
99 | 100 | ||
100 | 101 | ||
101 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 102 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
102 | currentPathCombo->setEditable(TRUE); | 103 | currentPathCombo->setEditable(TRUE); |
103 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 104 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
104 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 105 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
105 | 106 | ||
106 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 107 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
107 | 108 | ||
108 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 109 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
109 | 110 | ||
110 | 111 | ||
111 | TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); | 112 | TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); |
112 | // TabWidget = new QTabWidget( this, "TabWidget" ); | 113 | // TabWidget = new QTabWidget( this, "TabWidget" ); |
113 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); | 114 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); |
114 | 115 | ||
115 | tab = new QWidget( TabWidget, "tab" ); | 116 | tab = new QWidget( TabWidget, "tab" ); |
116 | tabLayout = new QGridLayout( tab ); | 117 | tabLayout = new QGridLayout( tab ); |
117 | tabLayout->setSpacing( 2); | 118 | tabLayout->setSpacing( 2); |
118 | tabLayout->setMargin( 2); | 119 | tabLayout->setMargin( 2); |
119 | 120 | ||
120 | Local_View = new QListView( tab, "Local_View" ); | 121 | Local_View = new QListView( tab, "Local_View" ); |
121 | Local_View->addColumn( tr("File"),130); | 122 | Local_View->addColumn( tr("File"),130); |
122 | Local_View->addColumn( tr("Size"),-1); | 123 | Local_View->addColumn( tr("Size"),-1); |
123 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 124 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
124 | Local_View->addColumn( tr("Date"),-1); | 125 | Local_View->addColumn( tr("Date"),-1); |
125 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 126 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
126 | Local_View->setAllColumnsShowFocus(TRUE); | 127 | Local_View->setAllColumnsShowFocus(TRUE); |
127 | Local_View->setMultiSelection( TRUE ); | 128 | Local_View->setMultiSelection( TRUE ); |
128 | Local_View->setSelectionMode(QListView::Extended); | 129 | Local_View->setSelectionMode(QListView::Extended); |
129 | 130 | ||
130 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 131 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
131 | 132 | ||
132 | tabLayout->addWidget( Local_View, 0, 0 ); | 133 | tabLayout->addWidget( Local_View, 0, 0 ); |
133 | 134 | ||
134 | TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1")); | 135 | TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1")); |
135 | // TabWidget->insertTab( tab, tr("1")); | 136 | // TabWidget->insertTab( tab, tr("1")); |
136 | 137 | ||
137 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 138 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
138 | tabLayout_2 = new QGridLayout( tab_2 ); | 139 | tabLayout_2 = new QGridLayout( tab_2 ); |
139 | tabLayout_2->setSpacing( 2); | 140 | tabLayout_2->setSpacing( 2); |
140 | tabLayout_2->setMargin( 2); | 141 | tabLayout_2->setMargin( 2); |
141 | 142 | ||
142 | Remote_View = new QListView( tab_2, "Remote_View" ); | 143 | Remote_View = new QListView( tab_2, "Remote_View" ); |
143 | Remote_View->addColumn( tr("File"),130); | 144 | Remote_View->addColumn( tr("File"),130); |
144 | Remote_View->addColumn( tr("Size"),-1); | 145 | Remote_View->addColumn( tr("Size"),-1); |
145 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 146 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
146 | Remote_View->addColumn( tr("Date"),-1); | 147 | Remote_View->addColumn( tr("Date"),-1); |
147 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 148 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
148 | Remote_View->setAllColumnsShowFocus(TRUE); | 149 | Remote_View->setAllColumnsShowFocus(TRUE); |
149 | Remote_View->setMultiSelection( TRUE ); | 150 | Remote_View->setMultiSelection( TRUE ); |
150 | Remote_View->setSelectionMode(QListView::Extended); | 151 | Remote_View->setSelectionMode(QListView::Extended); |
151 | 152 | ||
152 | 153 | ||
153 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 154 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
154 | 155 | ||
155 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 156 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
156 | 157 | ||
157 | TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); | 158 | TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); |
158 | // TabWidget->insertTab( tab_2, tr( "2")); | 159 | // TabWidget->insertTab( tab_2, tr( "2")); |
159 | 160 | ||
160 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 161 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
161 | tabLayout_3 = new QGridLayout( tab_3 ); | 162 | tabLayout_3 = new QGridLayout( tab_3 ); |
162 | tabLayout_3->setSpacing( 2); | 163 | tabLayout_3->setSpacing( 2); |
163 | tabLayout_3->setMargin( 2); | 164 | tabLayout_3->setMargin( 2); |
164 | 165 | ||
165 | 166 | ||
166 | // OFileDialog fileDialog; | 167 | // OFileDialog fileDialog; |
167 | // fileDialog; | 168 | // fileDialog; |
168 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 169 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
169 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 170 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
170 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 171 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
171 | 172 | ||
172 | QListView *fileTree; | 173 | QListView *fileTree; |
173 | fileTree = new QListView( tab_3, "tree" ); | 174 | fileTree = new QListView( tab_3, "tree" ); |
174 | 175 | ||
175 | 176 | ||
176 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 177 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
177 | 178 | ||
178 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 179 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
179 | */ | 180 | */ |
180 | 181 | ||
181 | /////////////// | 182 | /////////////// |
182 | 183 | ||
183 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 184 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
184 | if (uname(&name) != -1) { | 185 | if (uname(&name) != -1) { |
185 | QString release=name.release; | 186 | QString release=name.release; |
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 27a119f..bef701a 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -106,541 +106,585 @@ void AdvancedFm::showRemoteHidden() { | |||
106 | void AdvancedFm::runThis() { | 106 | void AdvancedFm::runThis() { |
107 | QString fs; | 107 | QString fs; |
108 | if (TabWidget->getCurrentTab() == 0) { | 108 | if (TabWidget->getCurrentTab() == 0) { |
109 | QString curFile = Local_View->currentItem()->text(0); | 109 | QString curFile = Local_View->currentItem()->text(0); |
110 | if(curFile != "../") { | 110 | if(curFile != "../") { |
111 | 111 | ||
112 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 112 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
113 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 113 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
114 | qDebug( fileInfo.owner()); | 114 | qDebug( fileInfo.owner()); |
115 | if( (fileInfo.permission( QFileInfo::ExeUser) | 115 | if( (fileInfo.permission( QFileInfo::ExeUser) |
116 | | fileInfo.permission( QFileInfo::ExeGroup) | 116 | | fileInfo.permission( QFileInfo::ExeGroup) |
117 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 117 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
118 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 118 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
119 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 119 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
120 | e << curFile; | 120 | e << curFile; |
121 | } else { | 121 | } else { |
122 | curFile = currentDir.canonicalPath()+"/"+curFile; | 122 | curFile = currentDir.canonicalPath()+"/"+curFile; |
123 | DocLnk nf(curFile); | 123 | DocLnk nf(curFile); |
124 | QString execStr = nf.exec(); | 124 | QString execStr = nf.exec(); |
125 | qDebug( execStr); | 125 | qDebug( execStr); |
126 | if( execStr.isEmpty() ) { | 126 | if( execStr.isEmpty() ) { |
127 | } else { | 127 | } else { |
128 | nf.execute(); | 128 | nf.execute(); |
129 | } | 129 | } |
130 | } | 130 | } |
131 | } | 131 | } |
132 | } else { | 132 | } else { |
133 | QString curFile = Remote_View->currentItem()->text(0); | 133 | QString curFile = Remote_View->currentItem()->text(0); |
134 | if(curFile != "../") { | 134 | if(curFile != "../") { |
135 | 135 | ||
136 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 136 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
137 | qDebug("Filesystemtype is "+fs); | 137 | qDebug("Filesystemtype is "+fs); |
138 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 138 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
139 | if( (fileInfo.permission( QFileInfo::ExeUser) | 139 | if( (fileInfo.permission( QFileInfo::ExeUser) |
140 | | fileInfo.permission( QFileInfo::ExeGroup) | 140 | | fileInfo.permission( QFileInfo::ExeGroup) |
141 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 141 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
142 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 142 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
143 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 143 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
144 | e << curFile; | 144 | e << curFile; |
145 | } else { | 145 | } else { |
146 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 146 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
147 | DocLnk nf(curFile); | 147 | DocLnk nf(curFile); |
148 | QString execStr = nf.exec(); | 148 | QString execStr = nf.exec(); |
149 | qDebug(execStr); | 149 | qDebug(execStr); |
150 | if( execStr.isEmpty() ) { | 150 | if( execStr.isEmpty() ) { |
151 | } else { | 151 | } else { |
152 | nf.execute(); | 152 | nf.execute(); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | } | 155 | } |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | void AdvancedFm::runText() { | 159 | void AdvancedFm::runText() { |
160 | if (TabWidget->getCurrentTab() == 0) { | 160 | if (TabWidget->getCurrentTab() == 0) { |
161 | QString curFile = Local_View->currentItem()->text(0); | 161 | QString curFile = Local_View->currentItem()->text(0); |
162 | if(curFile != "../") { | 162 | if(curFile != "../") { |
163 | curFile = currentDir.canonicalPath()+"/"+curFile; | 163 | curFile = currentDir.canonicalPath()+"/"+curFile; |
164 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 164 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
165 | e << curFile; | 165 | e << curFile; |
166 | } | 166 | } |
167 | } else { | 167 | } else { |
168 | QString curFile = Remote_View->currentItem()->text(0); | 168 | QString curFile = Remote_View->currentItem()->text(0); |
169 | if(curFile != "../") { | 169 | if(curFile != "../") { |
170 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 170 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
171 | DocLnk nf(curFile); | 171 | DocLnk nf(curFile); |
172 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 172 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
173 | e << curFile; | 173 | e << curFile; |
174 | } | 174 | } |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | void AdvancedFm::localMakDir() { | 178 | void AdvancedFm::localMakDir() { |
179 | InputDialog *fileDlg; | 179 | InputDialog *fileDlg; |
180 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 180 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
181 | fileDlg->exec(); | 181 | fileDlg->exec(); |
182 | if( fileDlg->result() == 1 ) { | 182 | if( fileDlg->result() == 1 ) { |
183 | QString filename = fileDlg->LineEdit1->text(); | 183 | QString filename = fileDlg->LineEdit1->text(); |
184 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 184 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
185 | } | 185 | } |
186 | populateLocalView(); | 186 | populateLocalView(); |
187 | } | 187 | } |
188 | 188 | ||
189 | void AdvancedFm::remoteMakDir() { | 189 | void AdvancedFm::remoteMakDir() { |
190 | InputDialog *fileDlg; | 190 | InputDialog *fileDlg; |
191 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 191 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
192 | fileDlg->exec(); | 192 | fileDlg->exec(); |
193 | if( fileDlg->result() == 1 ) { | 193 | if( fileDlg->result() == 1 ) { |
194 | QString filename = fileDlg->LineEdit1->text(); | 194 | QString filename = fileDlg->LineEdit1->text(); |
195 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 195 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
196 | } | 196 | } |
197 | populateRemoteView(); | 197 | populateRemoteView(); |
198 | } | 198 | } |
199 | 199 | ||
200 | void AdvancedFm::localDelete() { | 200 | void AdvancedFm::localDelete() { |
201 | QStringList curFileList = getPath(); | 201 | QStringList curFileList = getPath(); |
202 | if(curFileList.count() > 0) { | 202 | bool doMsg=true; |
203 | QString myFile; | 203 | int count=curFileList.count(); |
204 | if( count > 0) { | ||
205 | if(count > 1 ){ | ||
206 | QString msg; | ||
207 | msg=tr("Really delete\n%1 files?").arg(count); | ||
208 | switch ( QMessageBox::warning(this,tr("Delete"),msg | ||
209 | ,tr("Yes"),tr("No"),0,0,1) ) { | ||
210 | case 0: | ||
211 | doMsg=false; | ||
212 | break; | ||
213 | case 1: | ||
214 | return; | ||
215 | break; | ||
216 | }; | ||
217 | } | ||
218 | |||
219 | QString myFile; | ||
204 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 220 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
205 | myFile = (*it); | 221 | myFile = (*it); |
206 | if( myFile.find(" -> ",0,TRUE) != -1) | 222 | if( myFile.find(" -> ",0,TRUE) != -1) |
207 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 223 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
208 | 224 | ||
209 | QString f = currentDir.canonicalPath(); | 225 | QString f = currentDir.canonicalPath(); |
210 | if(f.right(1).find("/",0,TRUE) == -1) | 226 | if(f.right(1).find("/",0,TRUE) == -1) |
211 | f+="/"; | 227 | f+="/"; |
212 | f+=myFile; | 228 | f+=myFile; |
213 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 229 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
214 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 230 | switch ( QMessageBox::warning(this,tr("Delete Directory?"),tr("Really delete\n")+f+ |
215 | "\nand all it's contents ?" | 231 | "\nand all it's contents ?" |
216 | ,tr("Yes"),tr("No"),0,0,1) ) { | 232 | ,tr("Yes"),tr("No"),0,0,1) ) { |
217 | case 0: { | 233 | case 0: { |
218 | f=f.left(f.length()-1); | 234 | f=f.left(f.length()-1); |
219 | QString cmd="rm -rf "+f; | 235 | QString cmd="rm -rf "+f; |
220 | system( cmd.latin1()); | 236 | system( cmd.latin1()); |
221 | populateLocalView(); | 237 | populateLocalView(); |
222 | } | 238 | } |
223 | break; | 239 | break; |
224 | case 1: | 240 | case 1: |
225 | // exit | 241 | // exit |
226 | break; | 242 | break; |
227 | }; | 243 | }; |
228 | 244 | ||
229 | } else { | 245 | } else { |
230 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 246 | if(doMsg) { |
247 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f | ||
231 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 248 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
232 | case 0: { | 249 | case 1: |
233 | QString cmd="rm "+f; | 250 | return; |
234 | QFile file(f); | 251 | break; |
235 | file.remove(); | ||
236 | // system( cmd.latin1()); | ||
237 | populateLocalView(); | ||
238 | } | ||
239 | break; | ||
240 | case 1: | ||
241 | // exit | ||
242 | break; | ||
243 | }; | 252 | }; |
253 | } | ||
254 | QString cmd="rm "+f; | ||
255 | QFile file(f); | ||
256 | if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) | ||
257 | file.remove(); | ||
258 | // system( cmd.latin1()); | ||
244 | } | 259 | } |
245 | } | 260 | } |
246 | } | 261 | } |
262 | populateLocalView(); | ||
247 | } | 263 | } |
248 | 264 | ||
249 | void AdvancedFm::remoteDelete() { | 265 | void AdvancedFm::remoteDelete() { |
250 | QStringList curFileList = getPath(); | 266 | QStringList curFileList = getPath(); |
251 | if( curFileList.count() > 0) { | 267 | bool doMsg=true; |
252 | QString myFile; | 268 | int count=curFileList.count(); |
253 | 269 | if( count > 0) { | |
254 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 270 | if(count > 1 ){ |
255 | myFile = (*it); | 271 | QString msg; |
256 | if(myFile.find(" -> ",0,TRUE) != -1) | 272 | msg=tr("Really delete\n%1 files?").arg(count); |
257 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 273 | switch ( QMessageBox::warning(this,tr("Delete"),msg |
258 | QString f = currentRemoteDir.canonicalPath(); | 274 | ,tr("Yes"),tr("No"),0,0,1) ) { |
259 | if(f.right(1).find("/",0,TRUE) == -1) | 275 | case 0: |
260 | f+="/"; | 276 | doMsg=false; |
261 | f+=myFile; | 277 | break; |
262 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 278 | case 1: |
263 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 279 | return; |
264 | "\nand all it's contents ?", | 280 | break; |
265 | tr("Yes"),tr("No"),0,0,1) ) { | 281 | }; |
266 | case 0: { | ||
267 | f=f.left(f.length()-1); | ||
268 | QString cmd="rm -rf "+f; | ||
269 | system( cmd.latin1()); | ||
270 | populateRemoteView(); | ||
271 | } | 282 | } |
272 | break; | ||
273 | case 1: | ||
274 | // exit | ||
275 | break; | ||
276 | }; | ||
277 | 283 | ||
278 | } else { | 284 | QString myFile; |
279 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 285 | |
280 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 286 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
281 | case 0: { | 287 | myFile = (*it); |
282 | QString cmd="rm "+f; | 288 | if(myFile.find(" -> ",0,TRUE) != -1) |
283 | QFile file(f); | 289 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
284 | file.remove(); | 290 | QString f = currentRemoteDir.canonicalPath(); |
285 | // system( cmd.latin1()); | 291 | if(f.right(1).find("/",0,TRUE) == -1) |
286 | populateRemoteView(); | 292 | f+="/"; |
293 | f+=myFile; | ||
294 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | ||
295 | switch ( QMessageBox::warning(this,tr("Delete Directory"),tr("Really delete\n")+f+ | ||
296 | "\nand all it's contents ?", | ||
297 | tr("Yes"),tr("No"),0,0,1) ) { | ||
298 | case 0: { | ||
299 | f=f.left(f.length()-1); | ||
300 | QString cmd="rm -rf "+f; | ||
301 | system( cmd.latin1()); | ||
302 | populateRemoteView(); | ||
303 | } | ||
304 | break; | ||
305 | case 1: | ||
306 | // exit | ||
307 | break; | ||
308 | }; | ||
309 | |||
310 | } else { | ||
311 | if(doMsg) { | ||
312 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f | ||
313 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | ||
314 | case 1: | ||
315 | return; | ||
316 | break; | ||
317 | }; | ||
318 | } | ||
319 | QString cmd="rm "+f; | ||
320 | QFile file(f); | ||
321 | if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) | ||
322 | file.remove(); | ||
323 | // system( cmd.latin1()); | ||
324 | } | ||
287 | } | 325 | } |
288 | break; | ||
289 | case 1: | ||
290 | // exit | ||
291 | break; | ||
292 | }; | ||
293 | } | ||
294 | } | 326 | } |
295 | } | 327 | populateRemoteView(); |
296 | } | 328 | } |
297 | 329 | ||
298 | void AdvancedFm::localRename() { | 330 | void AdvancedFm::localRename() { |
299 | QString curFile = Local_View->currentItem()->text(0); | 331 | QString curFile = Local_View->currentItem()->text(0); |
300 | qDebug("currentItem "+curFile); | 332 | qDebug("currentItem "+curFile); |
301 | if( curFile !="../") { | 333 | if( curFile !="../") { |
302 | InputDialog *fileDlg; | 334 | InputDialog *fileDlg; |
303 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 335 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
304 | fileDlg->setInputText((const QString &)curFile); | 336 | fileDlg->setInputText((const QString &)curFile); |
305 | fileDlg->exec(); | 337 | fileDlg->exec(); |
306 | if( fileDlg->result() == 1 ) { | 338 | if( fileDlg->result() == 1 ) { |
307 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 339 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
308 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); | 340 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); |
309 | //+".playlist"; | 341 | //+".playlist"; |
310 | if( rename(oldname.latin1(), newName.latin1())== -1) | 342 | if( rename(oldname.latin1(), newName.latin1())== -1) |
311 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 343 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
312 | } | 344 | } |
313 | populateLocalView(); | 345 | populateLocalView(); |
314 | } | 346 | } |
315 | } | 347 | } |
316 | 348 | ||
317 | void AdvancedFm::remoteRename() | 349 | void AdvancedFm::remoteRename() |
318 | { | 350 | { |
319 | QString curFile = Remote_View->currentItem()->text(0); | 351 | QString curFile = Remote_View->currentItem()->text(0); |
320 | if( curFile !="../") { | 352 | if( curFile !="../") { |
321 | InputDialog *fileDlg; | 353 | InputDialog *fileDlg; |
322 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 354 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
323 | fileDlg->setInputText((const QString &)curFile); | 355 | fileDlg->setInputText((const QString &)curFile); |
324 | fileDlg->exec(); | 356 | fileDlg->exec(); |
325 | if( fileDlg->result() == 1 ) { | 357 | if( fileDlg->result() == 1 ) { |
326 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 358 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
327 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); | 359 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); |
328 | //+".playlist"; | 360 | //+".playlist"; |
329 | if( rename(oldname.latin1(), newName.latin1())== -1) | 361 | if( rename(oldname.latin1(), newName.latin1())== -1) |
330 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 362 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
331 | } | 363 | } |
332 | populateRemoteView(); | 364 | populateRemoteView(); |
333 | } | 365 | } |
334 | } | 366 | } |
335 | 367 | ||
336 | 368 | ||
337 | void AdvancedFm::filePerms() { | 369 | void AdvancedFm::filePerms() { |
338 | 370 | ||
339 | QStringList curFileList = getPath(); | 371 | QStringList curFileList = getPath(); |
340 | QString filePath; | 372 | QString filePath; |
341 | 373 | ||
342 | if (TabWidget->getCurrentTab() == 0) { | 374 | if (TabWidget->getCurrentTab() == 0) { |
343 | filePath = currentDir.canonicalPath()+"/"; | 375 | filePath = currentDir.canonicalPath()+"/"; |
344 | } else { | 376 | } else { |
345 | filePath= currentRemoteDir.canonicalPath()+"/"; | 377 | filePath= currentRemoteDir.canonicalPath()+"/"; |
346 | } | 378 | } |
347 | 379 | ||
348 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 380 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
349 | filePermissions *filePerm; | 381 | filePermissions *filePerm; |
350 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 382 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
351 | filePerm->showMaximized(); | 383 | filePerm->showMaximized(); |
352 | filePerm->exec(); | 384 | filePerm->exec(); |
353 | if( filePerm) | 385 | if( filePerm) |
354 | delete filePerm; | 386 | delete filePerm; |
355 | } | 387 | } |
356 | if (TabWidget->getCurrentTab() == 0) { | 388 | if (TabWidget->getCurrentTab() == 0) { |
357 | populateLocalView(); | 389 | populateLocalView(); |
358 | } else { | 390 | } else { |
359 | populateRemoteView(); | 391 | populateRemoteView(); |
360 | } | 392 | } |
361 | } | 393 | } |
362 | 394 | ||
363 | void AdvancedFm::doProperties() { | 395 | void AdvancedFm::doProperties() { |
364 | #if defined(QT_QWS_OPIE) | 396 | #if defined(QT_QWS_OPIE) |
365 | 397 | ||
366 | QStringList curFileList = getPath(); | 398 | QStringList curFileList = getPath(); |
367 | 399 | ||
368 | QString filePath; | 400 | QString filePath; |
369 | if (TabWidget->getCurrentTab() == 0) { | 401 | if (TabWidget->getCurrentTab() == 0) { |
370 | filePath = currentDir.canonicalPath()+"/"; | 402 | filePath = currentDir.canonicalPath()+"/"; |
371 | } else { | 403 | } else { |
372 | filePath= currentRemoteDir.canonicalPath()+"/"; | 404 | filePath= currentRemoteDir.canonicalPath()+"/"; |
373 | } | 405 | } |
374 | qDebug("%d",curFileList.count()); | 406 | qDebug("%d",curFileList.count()); |
375 | 407 | ||
376 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 408 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
377 | qDebug((filePath+*it)); | 409 | qDebug((filePath+*it)); |
378 | DocLnk lnk( (filePath+*it)); | 410 | DocLnk lnk( (filePath+*it)); |
379 | LnkProperties prop( &lnk ); | 411 | LnkProperties prop( &lnk ); |
380 | prop.showMaximized(); | 412 | prop.showMaximized(); |
381 | prop.exec(); | 413 | prop.exec(); |
382 | } | 414 | } |
383 | #endif | 415 | #endif |
384 | 416 | ||
385 | } | 417 | } |
386 | 418 | ||
387 | void AdvancedFm::upDir() { | 419 | void AdvancedFm::upDir() { |
388 | if (TabWidget->getCurrentTab() == 0) { | 420 | if (TabWidget->getCurrentTab() == 0) { |
389 | QString current = currentDir.canonicalPath(); | 421 | QString current = currentDir.canonicalPath(); |
390 | QDir dir(current); | 422 | QDir dir(current); |
391 | dir.cdUp(); | 423 | dir.cdUp(); |
392 | current = dir.canonicalPath(); | 424 | current = dir.canonicalPath(); |
393 | chdir( current.latin1() ); | 425 | chdir( current.latin1() ); |
394 | currentDir.cd( current, TRUE); | 426 | currentDir.cd( current, TRUE); |
395 | populateLocalView(); | 427 | populateLocalView(); |
396 | update(); | 428 | update(); |
397 | } else { | 429 | } else { |
398 | QString current = currentRemoteDir.canonicalPath(); | 430 | QString current = currentRemoteDir.canonicalPath(); |
399 | QDir dir(current); | 431 | QDir dir(current); |
400 | dir.cdUp(); | 432 | dir.cdUp(); |
401 | current = dir.canonicalPath(); | 433 | current = dir.canonicalPath(); |
402 | chdir( current.latin1() ); | 434 | chdir( current.latin1() ); |
403 | currentRemoteDir.cd( current, TRUE); | 435 | currentRemoteDir.cd( current, TRUE); |
404 | populateRemoteView(); | 436 | populateRemoteView(); |
405 | update(); | 437 | update(); |
406 | } | 438 | } |
407 | } | 439 | } |
408 | 440 | ||
409 | void AdvancedFm::copy() { | 441 | void AdvancedFm::copy() { |
410 | qApp->processEvents(); | 442 | qApp->processEvents(); |
411 | QStringList curFileList = getPath(); | 443 | QStringList curFileList = getPath(); |
412 | if( curFileList.count() > 0) { | 444 | bool doMsg=true; |
445 | int count=curFileList.count(); | ||
446 | if( count > 0) { | ||
447 | if(count > 1 ){ | ||
448 | QString msg; | ||
449 | msg=tr("Really copy\n%1 files?").arg(count); | ||
450 | switch ( QMessageBox::warning(this,tr("Delete"),msg | ||
451 | ,tr("Yes"),tr("No"),0,0,1) ) { | ||
452 | case 0: | ||
453 | doMsg=false; | ||
454 | break; | ||
455 | case 1: | ||
456 | return; | ||
457 | break; | ||
458 | }; | ||
459 | } | ||
460 | |||
413 | QString curFile, item, destFile; | 461 | QString curFile, item, destFile; |
414 | if (TabWidget->getCurrentTab() == 0) { | 462 | if (TabWidget->getCurrentTab() == 0) { |
415 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 463 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
416 | item=(*it); | 464 | item=(*it); |
417 | |||
418 | if(item.find("->",0,TRUE)) //symlink | 465 | if(item.find("->",0,TRUE)) //symlink |
419 | item = item.left(item.find("->",0,TRUE)); | 466 | item = item.left(item.find("->",0,TRUE)); |
420 | 467 | ||
421 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; | 468 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; |
422 | qDebug("Destination file is "+destFile); | 469 | qDebug("Destination file is "+destFile); |
423 | 470 | ||
424 | curFile = currentDir.canonicalPath()+"/"+ item; | 471 | curFile = currentDir.canonicalPath()+"/"+ item; |
425 | qDebug("CurrentFile file is " + curFile); | 472 | qDebug("CurrentFile file is " + curFile); |
426 | 473 | ||
427 | QFile f(destFile); | 474 | QFile f(destFile); |
428 | if( f.exists()) { | 475 | if( f.exists()) { |
429 | switch ( QMessageBox::warning(this,tr("Delete"), | 476 | if(doMsg) { |
430 | destFile+tr(" already exists\nDo you really want to delete it?"), | 477 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
431 | tr("Yes"),tr("No"),0,0,1) ) { | 478 | item+tr("\nexists. Ok to overwrite?"), |
432 | case 0: | 479 | tr("Yes"),tr("No"),0,0,1) ) { |
433 | f.remove(); | 480 | case 1: |
434 | break; | 481 | return; |
435 | case 1: | 482 | break; |
436 | return; | 483 | }; |
437 | break; | 484 | } |
438 | }; | 485 | f.remove(); |
439 | } | 486 | } |
440 | if(!copyFile(destFile, curFile) ) { | 487 | if(!copyFile(destFile, curFile) ) { |
441 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 488 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
442 | return; | 489 | return; |
443 | } | 490 | } |
444 | } | 491 | } |
445 | populateRemoteView(); | 492 | populateRemoteView(); |
446 | TabWidget->setCurrentTab(1); | 493 | TabWidget->setCurrentTab(1); |
447 | 494 | ||
448 | } else { | 495 | } else { |
449 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 496 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
450 | item= (*it); | 497 | item= (*it); |
451 | |||
452 | if(item.find("->",0,TRUE)) //symlink | 498 | if(item.find("->",0,TRUE)) //symlink |
453 | item = item.left(item.find("->",0,TRUE)); | 499 | item = item.left(item.find("->",0,TRUE)); |
454 | 500 | ||
455 | destFile = currentDir.canonicalPath()+"/"+ item; | 501 | destFile = currentDir.canonicalPath()+"/"+ item; |
456 | qDebug("Destination file is "+destFile); | 502 | qDebug("Destination file is "+destFile); |
457 | 503 | ||
458 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; | 504 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; |
459 | qDebug("CurrentFile file is " + curFile); | 505 | qDebug("CurrentFile file is " + curFile); |
460 | 506 | ||
461 | QFile f(destFile); | 507 | QFile f(destFile); |
462 | if( f.exists()) { | 508 | if( f.exists()) { |
463 | switch ( QMessageBox::warning(this,tr("Delete"), | 509 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
464 | destFile+tr(" already exists\nDo you really want to delete it?"), | 510 | item+tr("\nexists. Ok to overwrite?"), |
465 | tr("Yes"),tr("No"),0,0,1) ) { | 511 | tr("Yes"),tr("No"),0,0,1) ) { |
466 | case 0: | ||
467 | f.remove(); | ||
468 | break; | ||
469 | case 1: | 512 | case 1: |
470 | return; | 513 | return; |
471 | break; | 514 | break; |
472 | }; | 515 | }; |
516 | f.remove(); | ||
473 | } | 517 | } |
474 | if(!copyFile(destFile, curFile) ) { | 518 | if(!copyFile(destFile, curFile) ) { |
475 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 519 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
476 | +curFile +tr("to\n")+destFile); | 520 | +curFile +tr("to\n")+destFile); |
477 | return; | 521 | return; |
478 | 522 | ||
479 | } | 523 | } |
480 | } | 524 | } |
481 | populateLocalView(); | 525 | populateLocalView(); |
482 | TabWidget->setCurrentTab(0); | 526 | TabWidget->setCurrentTab(0); |
483 | } | 527 | } |
484 | 528 | ||
485 | } | 529 | } |
486 | } | 530 | } |
487 | 531 | ||
488 | void AdvancedFm::copyAs() { | 532 | void AdvancedFm::copyAs() { |
489 | qApp->processEvents(); | 533 | qApp->processEvents(); |
490 | 534 | ||
491 | QStringList curFileList = getPath(); | 535 | QStringList curFileList = getPath(); |
492 | QString curFile; | 536 | QString curFile; |
493 | InputDialog *fileDlg; | 537 | InputDialog *fileDlg; |
494 | if (TabWidget->getCurrentTab() == 0) { | 538 | if (TabWidget->getCurrentTab() == 0) { |
495 | qDebug("tab 1"); | 539 | qDebug("tab 1"); |
496 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 540 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
497 | QString destFile; | 541 | QString destFile; |
498 | curFile = currentDir.canonicalPath()+"/"+(*it); | 542 | curFile = currentDir.canonicalPath()+"/"+(*it); |
499 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 543 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
500 | 544 | ||
501 | fileDlg->setInputText((const QString &) destFile ); | 545 | fileDlg->setInputText((const QString &) destFile ); |
502 | fileDlg->exec(); | 546 | fileDlg->exec(); |
503 | 547 | ||
504 | if( fileDlg->result() == 1 ) { | 548 | if( fileDlg->result() == 1 ) { |
505 | QString filename = fileDlg->LineEdit1->text(); | 549 | QString filename = fileDlg->LineEdit1->text(); |
506 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 550 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
507 | 551 | ||
508 | QFile f(destFile); | 552 | QFile f(destFile); |
509 | if( f.exists()) { | 553 | if( f.exists()) { |
510 | switch (QMessageBox::warning(this,tr("Delete"), | 554 | switch (QMessageBox::warning(this,tr("File Exists!"), |
511 | destFile+tr(" already exists\nDo you really want to delete it?"), | 555 | item+tr("\nexists. Ok to overwrite?"), |
512 | tr("Yes"),tr("No"),0,0,1) ) { | 556 | tr("Yes"),tr("No"),0,0,1) ) { |
513 | case 0: | 557 | case 0: |
514 | f.remove(); | 558 | f.remove(); |
515 | break; | 559 | break; |
516 | case 1: | 560 | case 1: |
517 | return; | 561 | return; |
518 | break; | 562 | break; |
519 | }; | 563 | }; |
520 | } | 564 | } |
521 | if(!copyFile(destFile, curFile) ) { | 565 | if(!copyFile(destFile, curFile) ) { |
522 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 566 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
523 | +curFile +tr("to\n")+destFile); | 567 | +curFile +tr("to\n")+destFile); |
524 | return; | 568 | return; |
525 | } | 569 | } |
526 | } | 570 | } |
527 | delete fileDlg; | 571 | delete fileDlg; |
528 | 572 | ||
529 | } | 573 | } |
530 | populateRemoteView(); | 574 | populateRemoteView(); |
531 | TabWidget->setCurrentTab(1); | 575 | TabWidget->setCurrentTab(1); |
532 | 576 | ||
533 | } else { | 577 | } else { |
534 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 578 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
535 | 579 | ||
536 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 580 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
537 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 581 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
538 | 582 | ||
539 | QString destFile; | 583 | QString destFile; |
540 | fileDlg->setInputText((const QString &) destFile); | 584 | fileDlg->setInputText((const QString &) destFile); |
541 | fileDlg->exec(); | 585 | fileDlg->exec(); |
542 | 586 | ||
543 | if( fileDlg->result() == 1 ) { | 587 | if( fileDlg->result() == 1 ) { |
544 | QString filename = fileDlg->LineEdit1->text(); | 588 | QString filename = fileDlg->LineEdit1->text(); |
545 | destFile = currentDir.canonicalPath()+"/"+filename; | 589 | destFile = currentDir.canonicalPath()+"/"+filename; |
546 | 590 | ||
547 | QFile f( destFile); | 591 | QFile f( destFile); |
548 | if( f.exists()) { | 592 | if( f.exists()) { |
549 | switch ( QMessageBox::warning(this,tr("Delete"), | 593 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
550 | destFile+tr(" already exists\nDo you really want to delete it?"), | 594 | item+tr("\nexists. Ok to overwrite?"), |
551 | tr("Yes"),tr("No"),0,0,1) ) { | 595 | tr("Yes"),tr("No"),0,0,1) ) { |
552 | case 0: | 596 | case 0: |
553 | f.remove(); | 597 | f.remove(); |
554 | break; | 598 | break; |
555 | case 1: | 599 | case 1: |
556 | return; | 600 | return; |
557 | break; | 601 | break; |
558 | }; | 602 | }; |
559 | } | 603 | } |
560 | if(!copyFile(destFile, curFile) ) { | 604 | if(!copyFile(destFile, curFile) ) { |
561 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 605 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
562 | +curFile +tr("to\n")+destFile); | 606 | +curFile +tr("to\n")+destFile); |
563 | return; | 607 | return; |
564 | } | 608 | } |
565 | 609 | ||
566 | } | 610 | } |
567 | delete fileDlg; | 611 | delete fileDlg; |
568 | 612 | ||
569 | } | 613 | } |
570 | populateLocalView(); | 614 | populateLocalView(); |
571 | TabWidget->setCurrentTab(0); | 615 | TabWidget->setCurrentTab(0); |
572 | } | 616 | } |
573 | } | 617 | } |
574 | 618 | ||
575 | void AdvancedFm::copySameDir() { | 619 | void AdvancedFm::copySameDir() { |
576 | qApp->processEvents(); | 620 | qApp->processEvents(); |
577 | QStringList curFileList = getPath(); | 621 | QStringList curFileList = getPath(); |
578 | QString curFile, item, destFile; | 622 | QString curFile, item, destFile; |
579 | InputDialog *fileDlg; | 623 | InputDialog *fileDlg; |
580 | 624 | ||
581 | if (TabWidget->getCurrentTab() == 0) { | 625 | if (TabWidget->getCurrentTab() == 0) { |
582 | 626 | ||
583 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 627 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
584 | item=(*it); | 628 | item=(*it); |
585 | curFile = currentDir.canonicalPath()+"/"+ item; | 629 | curFile = currentDir.canonicalPath()+"/"+ item; |
586 | 630 | ||
587 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 631 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
588 | fileDlg->setInputText((const QString &) destFile ); | 632 | fileDlg->setInputText((const QString &) destFile ); |
589 | fileDlg->exec(); | 633 | fileDlg->exec(); |
590 | 634 | ||
591 | if( fileDlg->result() == 1 ) { | 635 | if( fileDlg->result() == 1 ) { |
592 | 636 | ||
593 | QString filename = fileDlg->LineEdit1->text(); | 637 | QString filename = fileDlg->LineEdit1->text(); |
594 | destFile = currentDir.canonicalPath()+"/"+filename; | 638 | destFile = currentDir.canonicalPath()+"/"+filename; |
595 | 639 | ||
596 | QFile f(destFile); | 640 | QFile f(destFile); |
597 | if( f.exists()) { | 641 | if( f.exists()) { |
598 | switch (QMessageBox::warning(this,tr("Delete"), | 642 | switch (QMessageBox::warning(this,tr("Delete"), |
599 | destFile+tr(" already exists\nDo you really want to delete it?"), | 643 | destFile+tr(" already exists\nDo you really want to delete it?"), |
600 | tr("Yes"),tr("No"),0,0,1) ) { | 644 | tr("Yes"),tr("No"),0,0,1) ) { |
601 | case 0: | 645 | case 0: |
602 | 646 | ||
603 | f.remove(); | 647 | f.remove(); |
604 | break; | 648 | break; |
605 | case 1: | 649 | case 1: |
606 | return; | 650 | return; |
607 | break; | 651 | break; |
608 | }; | 652 | }; |
609 | } | 653 | } |
610 | if(!copyFile(destFile, curFile) ) { | 654 | if(!copyFile(destFile, curFile) ) { |
611 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 655 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
612 | +curFile +tr("to\n")+destFile); | 656 | +curFile +tr("to\n")+destFile); |
613 | return; | 657 | return; |
614 | } | 658 | } |
615 | 659 | ||
616 | qDebug("copy "+curFile+" as "+destFile); | 660 | qDebug("copy "+curFile+" as "+destFile); |
617 | } | 661 | } |
618 | delete fileDlg; | 662 | delete fileDlg; |
619 | } | 663 | } |
620 | populateLocalView(); | 664 | populateLocalView(); |
621 | 665 | ||
622 | } else { | 666 | } else { |
623 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 667 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
624 | item=(*it); | 668 | item=(*it); |
625 | curFile = currentRemoteDir.canonicalPath()+"/"+ item; | 669 | curFile = currentRemoteDir.canonicalPath()+"/"+ item; |
626 | 670 | ||
627 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 671 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
628 | fileDlg->setInputText((const QString &) destFile); | 672 | fileDlg->setInputText((const QString &) destFile); |
629 | fileDlg->exec(); | 673 | fileDlg->exec(); |
630 | if( fileDlg->result() == 1 ) { | 674 | if( fileDlg->result() == 1 ) { |
631 | QString filename = fileDlg->LineEdit1->text(); | 675 | QString filename = fileDlg->LineEdit1->text(); |
632 | 676 | ||
633 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 677 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
634 | 678 | ||
635 | QFile f(destFile); | 679 | QFile f(destFile); |
636 | if( f.exists()) { | 680 | if( f.exists()) { |
637 | switch ( QMessageBox::warning(this,tr("Delete"), | 681 | switch ( QMessageBox::warning(this,tr("Delete"), |
638 | destFile+tr(" already exists\nDo you really want to delete it?"), | 682 | destFile+tr(" already exists\nDo you really want to delete it?"), |
639 | tr("Yes"),tr("No"),0,0,1) ) { | 683 | tr("Yes"),tr("No"),0,0,1) ) { |
640 | case 0: | 684 | case 0: |
641 | f.remove(); | 685 | f.remove(); |
642 | break; | 686 | break; |
643 | case 1: | 687 | case 1: |
644 | return; | 688 | return; |
645 | break; | 689 | break; |
646 | }; | 690 | }; |
@@ -869,96 +913,106 @@ void AdvancedFm::mkDir() { | |||
869 | if (TabWidget->getCurrentTab() == 0) | 913 | if (TabWidget->getCurrentTab() == 0) |
870 | localMakDir(); | 914 | localMakDir(); |
871 | else | 915 | else |
872 | remoteMakDir(); | 916 | remoteMakDir(); |
873 | 917 | ||
874 | } | 918 | } |
875 | 919 | ||
876 | void AdvancedFm::rn() { | 920 | void AdvancedFm::rn() { |
877 | if (TabWidget->getCurrentTab() == 0) | 921 | if (TabWidget->getCurrentTab() == 0) |
878 | localRename(); | 922 | localRename(); |
879 | else | 923 | else |
880 | remoteRename(); | 924 | remoteRename(); |
881 | 925 | ||
882 | } | 926 | } |
883 | 927 | ||
884 | void AdvancedFm::del() { | 928 | void AdvancedFm::del() { |
885 | if (TabWidget->getCurrentTab() == 0) | 929 | if (TabWidget->getCurrentTab() == 0) |
886 | localDelete(); | 930 | localDelete(); |
887 | else | 931 | else |
888 | remoteDelete(); | 932 | remoteDelete(); |
889 | } | 933 | } |
890 | 934 | ||
891 | void AdvancedFm::mkSym() { | 935 | void AdvancedFm::mkSym() { |
892 | QString cmd; | 936 | QString cmd; |
893 | QStringList curFileList = getPath(); | 937 | QStringList curFileList = getPath(); |
894 | if( curFileList.count() > 0) { | 938 | if( curFileList.count() > 0) { |
895 | 939 | ||
896 | if (TabWidget->getCurrentTab() == 0) { | 940 | if (TabWidget->getCurrentTab() == 0) { |
897 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 941 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
898 | 942 | ||
899 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); | 943 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); |
900 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 944 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
901 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 945 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
902 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 946 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
903 | cmd = "ln -s "+curFile+" "+destName; | 947 | cmd = "ln -s "+curFile+" "+destName; |
904 | qDebug(cmd); | 948 | qDebug(cmd); |
905 | system(cmd.latin1() ); | 949 | system(cmd.latin1() ); |
906 | } | 950 | } |
907 | populateRemoteView(); | 951 | populateRemoteView(); |
908 | TabWidget->setCurrentTab(1); | 952 | TabWidget->setCurrentTab(1); |
909 | } else { | 953 | } else { |
910 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 954 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
911 | 955 | ||
912 | QString destName = currentDir.canonicalPath()+"/"+(*it); | 956 | QString destName = currentDir.canonicalPath()+"/"+(*it); |
913 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 957 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
914 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 958 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
915 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 959 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
916 | 960 | ||
917 | cmd = "ln -s "+curFile+" "+destName; | 961 | cmd = "ln -s "+curFile+" "+destName; |
918 | qDebug(cmd); | 962 | qDebug(cmd); |
919 | system(cmd.latin1() ); | 963 | system(cmd.latin1() ); |
920 | } | 964 | } |
921 | populateLocalView(); | 965 | populateLocalView(); |
922 | TabWidget->setCurrentTab(0); | 966 | TabWidget->setCurrentTab(0); |
923 | } | 967 | } |
924 | } | 968 | } |
925 | } | 969 | } |
926 | 970 | ||
927 | void AdvancedFm::doBeam() { | 971 | void AdvancedFm::doBeam() { |
928 | Ir ir; | 972 | Ir ir; |
929 | if(!ir.supported()){ | 973 | if(!ir.supported()){ |
930 | } else { | 974 | } else { |
931 | 975 | ||
932 | QStringList curFileList = getPath(); | 976 | QStringList curFileList = getPath(); |
933 | if( curFileList.count() > 0) { | 977 | if( curFileList.count() > 0) { |
934 | 978 | ||
935 | if (TabWidget->getCurrentTab() == 0) { | 979 | if (TabWidget->getCurrentTab() == 0) { |
936 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 980 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
937 | 981 | ||
938 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 982 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
939 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 983 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
940 | Ir *file = new Ir(this, "IR"); | 984 | Ir *file = new Ir(this, "IR"); |
941 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 985 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
942 | file->send( curFile, curFile ); | 986 | file->send( curFile, curFile ); |
943 | } | 987 | } |
944 | 988 | ||
945 | } else { | 989 | } else { |
946 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 990 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
947 | 991 | ||
948 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 992 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
949 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 993 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
950 | Ir *file = new Ir(this, "IR"); | 994 | Ir *file = new Ir(this, "IR"); |
951 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 995 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
952 | file->send( curFile, curFile ); | 996 | file->send( curFile, curFile ); |
953 | 997 | ||
954 | } | 998 | } |
955 | } | 999 | } |
956 | } | 1000 | } |
957 | } | 1001 | } |
958 | 1002 | ||
959 | } | 1003 | } |
960 | 1004 | ||
961 | void AdvancedFm::fileBeamFinished( Ir *) { | 1005 | void AdvancedFm::fileBeamFinished( Ir *) { |
962 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 1006 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
963 | 1007 | ||
964 | } | 1008 | } |
1009 | |||
1010 | void AdvancedFm::selectAll() { | ||
1011 | if (TabWidget->getCurrentTab() == 0) { | ||
1012 | Local_View->selectAll(true); | ||
1013 | Local_View->setSelected( Local_View->firstChild(),false); | ||
1014 | } else { | ||
1015 | Remote_View->selectAll(true); | ||
1016 | Remote_View->setSelected( Remote_View->firstChild(),false); | ||
1017 | } | ||
1018 | } | ||