summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp27
-rw-r--r--noncore/apps/advancedfm/advancedfm.h2
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp15
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp17
4 files changed, 54 insertions, 7 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 6b7fa1f..60558e7 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -881,32 +881,55 @@ void AdvancedFm::setOtherTabCurrent()
881 else 881 else
882 TabWidget->setCurrentTab(0); 882 TabWidget->setCurrentTab(0);
883} 883}
884 884
885void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { 885void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
886 qDebug("qcop message "+msg ); 886 qDebug("qcop message "+msg );
887 QDataStream stream ( data, IO_ReadOnly ); 887 QDataStream stream ( data, IO_ReadOnly );
888 if ( msg == "openDirectory(QString)" ) { 888 if ( msg == "openDirectory(QString)" ) {
889 qDebug("received"); 889 qDebug("received");
890 QString file; 890 QString file;
891 stream >> file; 891 stream >> file;
892 gotoDirectory( (const QString &) file); 892 gotoDirectory( (const QString &) file);
893 } 893 }
894} 894}
895 895
896 void AdvancedFm::setDocument(const QString &file) { 896 void AdvancedFm::setDocument(const QString &file) {
897 gotoDirectory( file); 897 gotoDirectory( file);
898 898
899 } 899 }
900 900
901void AdvancedFm::gotoDirectory(const QString &file) { 901void AdvancedFm::gotoDirectory(const QString &file) {
902 902
903 QString curDir = file; 903 QString curDir = file;
904 QDir *thisDir = CurrentDir(); 904 QDir *thisDir = CurrentDir();
905 905 if(QDir( curDir).exists() ) {
906 if(QDir( curDir).exists() ) {
907 thisDir->setPath( curDir ); 906 thisDir->setPath( curDir );
908 chdir( curDir.latin1() ); 907 chdir( curDir.latin1() );
909 thisDir->cd( curDir, TRUE); 908 thisDir->cd( curDir, TRUE);
910 populateView(); 909 populateView();
911 } 910 }
911 else if(QFileInfo(curDir).exists()) {
912 QFileInfo fileInfo(curDir);
913 curDir=fileInfo.dirPath();
914 if(QDir( curDir).exists() ) {
915 thisDir->setPath( curDir );
916 chdir( curDir.latin1() );
917 thisDir->cd( curDir, TRUE);
918 populateView();
919 }
920 findFile(file);
921 }
922
923}
924
925void AdvancedFm::findFile(const QString &fileName) {
926 QFileInfo fi(fileName);
927 QListView *thisView = CurrentView();
928 QListViewItemIterator it( thisView );
929 for ( ; it.current(); ++it ) {
930 if(it.current()->text(0) == fi.fileName()) {
931 it.current()->setSelected(true);
932 thisView->ensureItemVisible(it.current());
933 }
934 }
912} 935}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index c9a5525..94d7bd7 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -144,35 +144,37 @@ protected slots:
144 void copyAs(); 144 void copyAs();
145 void copySameDir(); 145 void copySameDir();
146 void currentPathComboActivated(const QString &); 146 void currentPathComboActivated(const QString &);
147 void fillCombo(const QString &); 147 void fillCombo(const QString &);
148 bool copyFile( const QString & , const QString & ); 148 bool copyFile( const QString & , const QString & );
149 void move(); 149 void move();
150 void fileStatus(); 150 void fileStatus();
151 void doAbout(); 151 void doAbout();
152 void doBeam(); 152 void doBeam();
153 void fileBeamFinished( Ir *); 153 void fileBeamFinished( Ir *);
154 154
155private: 155private:
156 MenuButton *menuButton; 156 MenuButton *menuButton;
157 QString oldName; 157 QString oldName;
158 QTimer menuTimer; 158 QTimer menuTimer;
159 void startProcess(const QString &); 159 void startProcess(const QString &);
160 bool eventFilter( QObject * , QEvent * ); 160 bool eventFilter( QObject * , QEvent * );
161 void cancelRename(); 161 void cancelRename();
162 void doRename(QListView *); 162 void doRename(QListView *);
163 void okRename(); 163 void okRename();
164 void customDirsToMenu(); 164 void customDirsToMenu();
165 void addCustomDir(); 165 void addCustomDir();
166 void removeCustomDir(); 166 void removeCustomDir();
167 void gotoDirectory(const QString &); 167 void gotoDirectory(const QString &);
168 void openSearch();
169 void findFile(const QString &);
168 170
169private slots: 171private slots:
170 void processEnded(OProcess *); 172 void processEnded(OProcess *);
171 void oprocessStderr(OProcess *, char *, int); 173 void oprocessStderr(OProcess *, char *, int);
172 void gotoCustomDir(const QString &); 174 void gotoCustomDir(const QString &);
173 void qcopReceive(const QCString&, const QByteArray&); 175 void qcopReceive(const QCString&, const QByteArray&);
174 void setDocument(const QString &); 176 void setDocument(const QString &);
175 177
176}; 178};
177 179
178#endif // ADVANCEDFM_H 180#endif // ADVANCEDFM_H
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index d0de442..a120f35 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -1,38 +1,40 @@
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/storage.h>
16
15#include <qpe/qpeapplication.h> 17#include <qpe/qpeapplication.h>
16#include <qpe/resource.h> 18#include <qpe/resource.h>
17#include <qpe/menubutton.h> 19#include <qpe/menubutton.h>
18 20
19#include <qlayout.h> 21#include <qlayout.h>
20#include <qhbox.h> 22#include <qhbox.h>
21#include <qmenubar.h> 23#include <qmenubar.h>
22#include <qcombobox.h> 24#include <qcombobox.h>
23#include <qtoolbutton.h> 25#include <qtoolbutton.h>
24#include <qlineedit.h> 26#include <qlineedit.h>
25#include <qlistview.h> 27#include <qlistview.h>
26 28
27#include <sys/utsname.h> 29#include <sys/utsname.h>
28 30
29 31
30void AdvancedFm::init() { 32void AdvancedFm::init() {
31#if defined(QT_QWS_OPIE) 33#if defined(QT_QWS_OPIE)
32 qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); 34 qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!");
33#endif 35#endif
34 setCaption( tr( "AdvancedFm" ) ); 36 setCaption( tr( "AdvancedFm" ) );
35 37
36 QVBoxLayout *layout = new QVBoxLayout( this ); 38 QVBoxLayout *layout = new QVBoxLayout( this );
37 layout->setSpacing( 2); 39 layout->setSpacing( 2);
38 layout->setMargin( 2); 40 layout->setMargin( 2);
@@ -62,48 +64,50 @@ void AdvancedFm::init() {
62 64
63 cfButton = new QToolButton( 0, "CFButton"); 65 cfButton = new QToolButton( 0, "CFButton");
64 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); 66 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
65 cfButton->setAutoRaise( true ); 67 cfButton->setAutoRaise( true );
66 menuBar->insertItem( cfButton ); 68 menuBar->insertItem( cfButton );
67 69
68 sdButton = new QToolButton( 0, "SDButton"); 70 sdButton = new QToolButton( 0, "SDButton");
69 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); 71 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard"));
70 sdButton->setAutoRaise( true ); 72 sdButton->setAutoRaise( true );
71 menuBar->insertItem( sdButton ); 73 menuBar->insertItem( sdButton );
72 74
73 docButton = new QToolButton( 0,"docsButton"); 75 docButton = new QToolButton( 0,"docsButton");
74 docButton->setPixmap(Resource::loadPixmap("DocsIcon")); 76 docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
75 docButton->setAutoRaise( true ); 77 docButton->setAutoRaise( true );
76 menuBar->insertItem( docButton ); 78 menuBar->insertItem( docButton );
77 79
78 homeButton = new QToolButton( 0, "homeButton"); 80 homeButton = new QToolButton( 0, "homeButton");
79 homeButton->setPixmap(Resource::loadPixmap("home")); 81 homeButton->setPixmap(Resource::loadPixmap("home"));
80 homeButton->setAutoRaise( true ); 82 homeButton->setAutoRaise( true );
81 menuBar->insertItem( homeButton ); 83 menuBar->insertItem( homeButton );
82 84
83 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); 85 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
84 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 86 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
85 fileMenu->insertSeparator(); 87 fileMenu->insertSeparator();
88 fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() ));
89 fileMenu->insertSeparator();
86 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 90 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
87 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); 91 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
88 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 92 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
89 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 93 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
90 fileMenu->insertSeparator(); 94 fileMenu->insertSeparator();
91 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 95 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
92 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); 96 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() ));
93 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); 97 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
94 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); 98 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
95 fileMenu->setCheckable(TRUE); 99 fileMenu->setCheckable(TRUE);
96 100
97 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 101 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
98 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 102 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
99// viewMenu->insertSeparator(); 103// viewMenu->insertSeparator();
100// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 104// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
101 viewMenu->setCheckable(TRUE); 105 viewMenu->setCheckable(TRUE);
102 106
103 s_addBookmark = tr("Bookmark Directory"); 107 s_addBookmark = tr("Bookmark Directory");
104 s_removeBookmark = tr("Remove Current Directory from Bookmarks"); 108 s_removeBookmark = tr("Remove Current Directory from Bookmarks");
105 109
106// menuButton->insertItem(""); 110// menuButton->insertItem("");
107 111
108// customDirMenu->insertItem(tr("Add This Directory")); 112// customDirMenu->insertItem(tr("Add This Directory"));
109// customDirMenu->insertItem(tr("Remove This Directory")); 113// customDirMenu->insertItem(tr("Remove This Directory"));
@@ -177,95 +181,104 @@ void AdvancedFm::init() {
177 181
178 /* tab_3 = new QWidget( TabWidget, "tab_3" ); 182 /* tab_3 = new QWidget( TabWidget, "tab_3" );
179 tabLayout_3 = new QGridLayout( tab_3 ); 183 tabLayout_3 = new QGridLayout( tab_3 );
180 tabLayout_3->setSpacing( 2); 184 tabLayout_3->setSpacing( 2);
181 tabLayout_3->setMargin( 2); 185 tabLayout_3->setMargin( 2);
182 186
183 187
184 // OFileDialog fileDialog; 188 // OFileDialog fileDialog;
185 // fileDialog; 189 // fileDialog;
186 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy 190 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy
187 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); 191 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow");
188 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); 192 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/");
189 193
190 QListView *fileTree; 194 QListView *fileTree;
191 fileTree = new QListView( tab_3, "tree" ); 195 fileTree = new QListView( tab_3, "tree" );
192 196
193 197
194 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); 198 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
195 199
196 TabWidget->insertTab( tab_3, tr( "Remote" ) ); 200 TabWidget->insertTab( tab_3, tr( "Remote" ) );
197 */ 201 */
198 202
199 /////////////// 203 ///////////////
200 204
205
201 struct utsname name; /* check for embedix kernel running on the zaurus*/ 206 struct utsname name; /* check for embedix kernel running on the zaurus*/
202 if (uname(&name) != -1) { 207 if (uname(&name) != -1) {
203 QString release=name.release; 208 QString release=name.release;
204 if(release.find("embedix",0,TRUE) !=-1) { 209 if(release.find("embedix",0,TRUE) !=-1) {
205 zaurusDevice=TRUE; 210 zaurusDevice=TRUE;
206 } else { 211 } else {
207 zaurusDevice=FALSE; 212 zaurusDevice=FALSE;
208 sdButton->hide();
209 } 213 }
210 } 214 }
211 215
216 if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) {
217 qDebug("not have sd");
218 sdButton->hide();
219 }
220 if( !StorageInfo::hasCf() ) {
221 qDebug("not have cf");
222 cfButton->hide();
223 }
212 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 224 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
213 currentDir.setPath( QDir::currentDirPath()); 225 currentDir.setPath( QDir::currentDirPath());
214 226
215 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 227 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
216 currentRemoteDir.setPath( QDir::currentDirPath()); 228 currentRemoteDir.setPath( QDir::currentDirPath());
217 229
218 b = TRUE; 230 b = TRUE;
219 231
220 filterStr="*"; 232 filterStr="*";
221 b=FALSE; 233 b=FALSE;
222 TabWidget->setCurrentTab(0); 234 TabWidget->setCurrentTab(0);
223 235
224} 236}
225 237
226void AdvancedFm::initConnections() 238void AdvancedFm::initConnections()
227{ 239{
228 240
229 connect( qApp,SIGNAL( aboutToQuit()), 241 connect( qApp,SIGNAL( aboutToQuit()),
230 this, SLOT( cleanUp()) ); 242 this, SLOT( cleanUp()) );
231 connect( qpeDirButton ,SIGNAL(released()), 243 connect( qpeDirButton ,SIGNAL(released()),
232 this,SLOT( QPEButtonPushed()) ); 244 this,SLOT( QPEButtonPushed()) );
233 connect( cfButton ,SIGNAL(released()), 245 connect( cfButton ,SIGNAL(released()),
234 this,SLOT( CFButtonPushed()) ); 246 this,SLOT( CFButtonPushed()) );
235 connect( sdButton ,SIGNAL(released()), 247 connect( sdButton ,SIGNAL(released()),
236 this,SLOT( SDButtonPushed()) ); 248 this,SLOT( SDButtonPushed()) );
237 connect( cdUpButton ,SIGNAL(released()), 249 connect( cdUpButton ,SIGNAL(released()),
238 this,SLOT( upDir()) ); 250 this,SLOT( upDir()) );
239 connect( docButton,SIGNAL(released()), 251 connect( docButton,SIGNAL(released()),
240 this,SLOT( docButtonPushed()) ); 252 this,SLOT( docButtonPushed()) );
241 connect( homeButton,SIGNAL(released()), 253 connect( homeButton,SIGNAL(released()),
242 this,SLOT( homeButtonPushed()) ); 254 this,SLOT( homeButtonPushed()) );
243 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 255 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
244 this, SLOT( currentPathComboActivated( const QString & ) ) ); 256 this, SLOT( currentPathComboActivated( const QString & ) ) );
245 257
246 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 258 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
247 this,SLOT(currentPathComboChanged())); 259 this,SLOT(currentPathComboChanged()));
248 260
249 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 261 connect( Local_View, SIGNAL( clicked( QListViewItem*)),
250 this,SLOT( ListClicked(QListViewItem *)) ); 262 this,SLOT( ListClicked(QListViewItem *)) );
263
251 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 264 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
252 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 265 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
253 266
254 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); 267 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
255 268
256 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 269 connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
257 this,SLOT( ListClicked(QListViewItem *)) ); 270 this,SLOT( ListClicked(QListViewItem *)) );
258 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 271 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
259 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 272 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
260 273
261 connect( TabWidget,SIGNAL(currentChanged(QWidget *)), 274 connect( TabWidget,SIGNAL(currentChanged(QWidget *)),
262 this,SLOT(tabChanged(QWidget*))); 275 this,SLOT(tabChanged(QWidget*)));
263 276
264 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); 277 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) );
265 278
266 connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&))); 279 connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&)));
267// connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int))); 280// connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int)));
268 281
269// connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); 282// connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int)));
270 283
271} 284}
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 575833a..2201960 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -1,30 +1,30 @@
1/*************************************************************************** 1/***************************************************************************
2 AdvancedFm.cpp 2 AdvancedFm.cpp
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#include "advancedfm.h" 12#include "advancedfm.h"
13#include "output.h" 13#include "output.h"
14#include "filePermissions.h" 14#include "filePermissions.h"
15 15
16#include <opie/otabwidget.h> 16#include <opie/otabwidget.h>
17#include <opie/oprocess.h> 17#include <opie/oprocess.h>
18 18
19#include <qpe/lnkproperties.h> 19#include <qpe/lnkproperties.h>
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/applnk.h> 23#include <qpe/applnk.h>
24#include <qpe/ir.h> 24#include <qpe/ir.h>
25 25
26#include <qmessagebox.h> 26#include <qmessagebox.h>
27#include <qmultilineedit.h> 27#include <qmultilineedit.h>
28 28
29#include <qstring.h> 29#include <qstring.h>
30 30
@@ -182,80 +182,85 @@ void AdvancedFm::doDelete()
182 msg=tr("Really delete\n%1 files?").arg(count); 182 msg=tr("Really delete\n%1 files?").arg(count);
183 switch ( QMessageBox::warning(this,tr("Delete"),msg 183 switch ( QMessageBox::warning(this,tr("Delete"),msg
184 ,tr("Yes"),tr("No"),0,0,1) ) 184 ,tr("Yes"),tr("No"),0,0,1) )
185 { 185 {
186 case 0: 186 case 0:
187 doMsg=false; 187 doMsg=false;
188 break; 188 break;
189 case 1: 189 case 1:
190 return; 190 return;
191 break; 191 break;
192 }; 192 };
193 } 193 }
194 194
195 QString myFile; 195 QString myFile;
196 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 196 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
197 { 197 {
198 myFile = (*it); 198 myFile = (*it);
199 if( myFile.find(" -> ",0,TRUE) != -1) 199 if( myFile.find(" -> ",0,TRUE) != -1)
200 myFile = myFile.left( myFile.find(" -> ",0,TRUE)); 200 myFile = myFile.left( myFile.find(" -> ",0,TRUE));
201 201
202 QString f = CurrentDir()->canonicalPath(); 202 QString f = CurrentDir()->canonicalPath();
203 if(f.right(1).find("/",0,TRUE) == -1) 203 if(f.right(1).find("/",0,TRUE) == -1)
204 f += "/"; 204 f += "/";
205 f += myFile; 205 f += myFile;
206 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) 206 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) //if file is a directory
207 { 207 {
208 switch ( QMessageBox::warning( this, tr("Delete Directory?"), tr("Really delete\n") + f + 208 switch ( QMessageBox::warning( this, tr("Delete Directory?"), tr("Really delete\n") + f +
209 "\nand all it's contents ?" 209 "\nand all it's contents ?"
210 ,tr("Yes"),tr("No"),0,0,1) ) 210 ,tr("Yes"),tr("No"),0,0,1) )
211 { 211 {
212 case 0: 212 case 0:
213 { 213 {
214 f=f.left(f.length()-1); 214 f=f.left(f.length()-1);
215 QString cmd="rm -rf "+f; 215 QString cmd="rm -rf "+f;
216 startProcess( (const QString)cmd.latin1() ); 216 startProcess( (const QString)cmd.latin1() );
217 populateView(); 217 populateView();
218 } 218 }
219 break; 219 break;
220 case 1: 220 case 1:
221 // exit 221 // exit
222 break; 222 break;
223 }; 223 };
224 224
225 } else { 225 } else {
226 if(doMsg) { 226 if(doMsg) {
227 switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f 227 switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f
228 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 228 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
229 case 1: 229 case 1:
230 return; 230 return;
231 break; 231 break;
232 }; 232 };
233 } 233 }
234 QString cmd="rm "+f; 234 QString cmd="rm "+f;
235 QFile file(f); 235 QFile file(f);
236 if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) 236 if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) {
237 file.remove(); 237 qDebug("remove link files "+f);
238// AppLnk lnk(f);
239// qDebug(lnk.linkFile());
240// lnk.removeLinkFile();
241 file.remove();
242 }
238 } 243 }
239 } 244 }
240 } 245 }
241 populateView(); 246 populateView();
242} 247}
243 248
244void AdvancedFm::filePerms() 249void AdvancedFm::filePerms()
245{ 250{
246 QStringList curFileList = getPath(); 251 QStringList curFileList = getPath();
247 QString filePath; 252 QString filePath;
248 253
249 filePath = CurrentDir()->canonicalPath()+"/"; 254 filePath = CurrentDir()->canonicalPath()+"/";
250 255
251 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 256 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
252 { 257 {
253 filePermissions *filePerm; 258 filePermissions *filePerm;
254 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 259 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
255 filePerm->showMaximized(); 260 filePerm->showMaximized();
256 filePerm->exec(); 261 filePerm->exec();
257 if( filePerm) 262 if( filePerm)
258 delete filePerm; 263 delete filePerm;
259 } 264 }
260 populateView(); 265 populateView();
261} 266}
@@ -864,24 +869,28 @@ void AdvancedFm::renameIt()
864 populateView(); 869 populateView();
865} 870}
866 871
867void AdvancedFm::okRename() 872void AdvancedFm::okRename()
868{ 873{
869 QString newName = renameBox->text(); 874 QString newName = renameBox->text();
870 cancelRename(); 875 cancelRename();
871// int tabs=0; 876// int tabs=0;
872 QListView * view = CurrentView(); 877 QListView * view = CurrentView();
873 QString path = CurrentDir()->canonicalPath() + "/"; 878 QString path = CurrentDir()->canonicalPath() + "/";
874 oldName = path + oldName; 879 oldName = path + oldName;
875 newName = path + newName; 880 newName = path + newName;
876 881
877 if( view->currentItem() == NULL) 882 if( view->currentItem() == NULL)
878 return; 883 return;
879 if( rename( oldName.latin1(), newName.latin1())== -1) 884 if( rename( oldName.latin1(), newName.latin1())== -1)
880 QMessageBox::message(tr("Note"),tr("Could not rename")); 885 QMessageBox::message(tr("Note"),tr("Could not rename"));
881 else 886 else
882 oldName = ""; 887 oldName = "";
883 888
884 view->takeItem( view->currentItem() ); 889 view->takeItem( view->currentItem() );
885 delete view->currentItem(); 890 delete view->currentItem();
886 populateView(); 891 populateView();
887} 892}
893
894void AdvancedFm::openSearch() {
895
896}