summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-09-25 08:22:22 (UTC)
committer llornkcor <llornkcor>2004-09-25 08:22:22 (UTC)
commitff6c55833c0cba33469f668ca158e96b409b4967 (patch) (unidiff)
tree63299a67e6f9bf1a06c8668775f95f96366efce0
parent946445e87ce74b8b28817ea63854054dbf165003 (diff)
downloadopie-ff6c55833c0cba33469f668ca158e96b409b4967.zip
opie-ff6c55833c0cba33469f668ca158e96b409b4967.tar.gz
opie-ff6c55833c0cba33469f668ca158e96b409b4967.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp20
-rw-r--r--noncore/apps/advancedfm/advancedfm.h2
-rw-r--r--noncore/apps/advancedfm/advancedfm.pro2
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp5
4 files changed, 13 insertions, 16 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index f1be471..0dc822d 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,540 +1,538 @@
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#define DEVELOPERS_VERSION 12#define DEVELOPERS_VERSION
13#include "advancedfm.h" 13#include "advancedfm.h"
14 14
15#include <opie2/odebug.h> 15#include <opie2/odebug.h>
16 16
17#include <opie2/ostorageinfo.h> 17#include <opie2/ostorageinfo.h>
18 18
19#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
20#include <qpe/config.h> 20#include <qpe/config.h>
21#include <qpe/mimetype.h> 21#include <qpe/mimetype.h>
22#include <qpe/applnk.h> 22#include <qpe/applnk.h>
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24#include <qpe/menubutton.h> 24#include <qpe/menubutton.h>
25 25
26#include <qcombobox.h> 26#include <qcombobox.h>
27#include <qpopupmenu.h> 27#include <qpopupmenu.h>
28#include <qlistview.h> 28#include <qlistview.h>
29#include <qmessagebox.h> 29#include <qmessagebox.h>
30#include <qlineedit.h> 30#include <qlineedit.h>
31 31
32 32
33#include <sys/stat.h> 33#include <sys/stat.h>
34#include <time.h> 34#include <time.h>
35#include <dirent.h> 35#include <dirent.h>
36#include <fcntl.h> 36#include <fcntl.h>
37#include <sys/vfs.h> 37#include <sys/vfs.h>
38#include <mntent.h> 38#include <mntent.h>
39 39
40using namespace Opie::Ui; 40using namespace Opie::Ui;
41 41
42AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) 42AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
43 : QMainWindow( ) { 43 : QMainWindow( ) {
44 init(); 44 init();
45 renameBox = 0; 45 renameBox = 0;
46 46 whichTab = 1;
47 unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() ); 47 unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() );
48 48
49 initConnections(); 49 initConnections();
50 rePopulate(); 50 rePopulate();
51 channel = new QCopChannel( "QPE/Application/advancedfm", this ); 51 channel = new QCopChannel( "QPE/Application/advancedfm", this );
52 connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&))); 52 connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&)));
53 switchToLocalTab(); 53 switchToLocalTab();
54} 54}
55 55
56AdvancedFm::~AdvancedFm() { 56AdvancedFm::~AdvancedFm() {
57} 57}
58 58
59 59
60void AdvancedFm::cleanUp() { 60void AdvancedFm::cleanUp() {
61 QString sfile=QDir::homeDirPath(); 61 QString sfile=QDir::homeDirPath();
62 if(sfile.right(1) != "/") 62 if(sfile.right(1) != "/")
63 sfile+="/._temp"; 63 sfile+="/._temp";
64 else 64 else
65 sfile+="._temp"; 65 sfile+="._temp";
66 QFile file( sfile); 66 QFile file( sfile);
67 if(file.exists()) 67 if(file.exists())
68 file.remove(); 68 file.remove();
69} 69}
70 70
71void AdvancedFm::tabChanged(QWidget *wd) { 71void AdvancedFm::tabChanged(QWidget *wd) {
72 // qDebug("tabChanged"); 72 // qDebug("tabChanged");
73 if(wd == tab) { 73 if(wd == tab) {
74 whichTab = 1; 74 whichTab = 1;
75 // qDebug("tabchanged: LOCAL VIEW SHOWN"); 75 // qDebug("tabchanged: LOCAL VIEW SHOWN");
76 } 76 }
77 else if(wd == tab_2) { 77 else if(wd == tab_2) {
78 whichTab = 2; 78 whichTab = 2;
79 // qDebug("tabchanged: REMOTE VIEW SHOWN"); 79 // qDebug("tabchanged: REMOTE VIEW SHOWN");
80 } 80 }
81 qApp->processEvents(); 81 qApp->processEvents();
82 QString path = CurrentDir()->canonicalPath(); 82 QString path = CurrentDir()->canonicalPath();
83 // qDebug(path); 83 // qDebug(path);
84 if ( TabWidget->currentWidget() == tab) { 84 if ( TabWidget->currentWidget() == tab) {
85 viewMenu->setItemChecked(viewMenu->idAt(0), true); 85 viewMenu->setItemChecked(viewMenu->idAt(0), true);
86 viewMenu->setItemChecked(viewMenu->idAt(1), false); 86 viewMenu->setItemChecked(viewMenu->idAt(1), false);
87 } else { 87 } else {
88 viewMenu->setItemChecked(viewMenu->idAt(0), false); 88 viewMenu->setItemChecked(viewMenu->idAt(0), false);
89 viewMenu->setItemChecked(viewMenu->idAt(1), true); 89 viewMenu->setItemChecked(viewMenu->idAt(1), true);
90 } 90 }
91 91
92 QString fs= getFileSystemType( (const QString &) path);
93
94 setCaption(tr("AdvancedFm :: ")+fs+" :: "
95 +checkDiskSpace( (const QString &) path )+ tr(" kB free") );
96 chdir( path.latin1()); 92 chdir( path.latin1());
97 currentPathCombo->lineEdit()->setText(path); 93 currentPathCombo->lineEdit()->setText(path);
98} 94}
99 95
100 96
101void AdvancedFm::populateView() { 97void AdvancedFm::populateView() {
102 98
103 QPixmap pm; 99 QPixmap pm;
104 QListView *thisView = CurrentView(); 100 QListView *thisView = CurrentView();
105 QDir *thisDir = CurrentDir(); 101 QDir *thisDir = CurrentDir();
106 QString path = thisDir->canonicalPath(); 102 QString path = thisDir->canonicalPath();
107 103
108 thisView->clear(); 104 thisView->clear();
109 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 105 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
110 thisDir->setMatchAllDirs(TRUE); 106 thisDir->setMatchAllDirs(TRUE);
111 thisDir->setNameFilter(filterStr); 107 thisDir->setNameFilter(filterStr);
112 QString fileL, fileS, fileDate; 108 QString fileL, fileS, fileDate;
113 QString fs= getFileSystemType((const QString &) path); 109
110 QString fs = getFileSystemType((const QString &) path);
114 setCaption(tr("AdvancedFm :: ")+fs+" :: " 111 setCaption(tr("AdvancedFm :: ")+fs+" :: "
115 +checkDiskSpace((const QString &) path)+ tr(" kB free") ); 112 +checkDiskSpace((const QString &) path)+ tr(" kB free") );
116 bool isDir=FALSE; 113 bool isDir = FALSE;
114
117 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 115 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
118 QFileInfoListIterator it(*list); 116 QFileInfoListIterator it(*list);
119 QFileInfo *fi; 117 QFileInfo *fi;
120 while ( (fi=it.current()) ) { 118 while ( (fi=it.current()) ) {
121 if (fi->isSymLink() ) { 119 if (fi->isSymLink() ) {
122 QString symLink=fi->readLink(); 120 QString symLink = fi->readLink();
123 QFileInfo sym( symLink); 121 QFileInfo sym( symLink);
124 fileS.sprintf( "%10i", sym.size() ); 122 fileS.sprintf( "%10i", sym.size() );
125 fileL = fi->fileName() +" -> " + sym.filePath().data(); 123 fileL = fi->fileName() +" -> " + sym.filePath().data();
126 fileDate = sym.lastModified().toString(); 124 fileDate = sym.lastModified().toString();
127 } else { 125 } else {
128 fileS.sprintf( "%10i", fi->size() ); 126 fileS.sprintf( "%10i", fi->size() );
129 fileL = fi->fileName(); 127 fileL = fi->fileName();
130 fileDate= fi->lastModified().toString(); 128 fileDate= fi->lastModified().toString();
131 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { 129 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) {
132// if(fileL == "..") 130// if(fileL == "..")
133 fileL += "/"; 131 fileL += "/";
134 isDir=TRUE; 132 isDir=TRUE;
135 } 133 }
136 } 134 }
137 QFileInfo fileInfo( path + "/" + fileL); 135 QFileInfo fileInfo( path + "/" + fileL);
138 136
139 if(fileL !="./" && fi->exists()) { 137 if(fileL !="./" && fi->exists()) {
140 item = new QListViewItem( thisView, fileL, fileS , fileDate); 138 item = new QListViewItem( thisView, fileL, fileS , fileDate);
141 139
142 if(isDir || fileL.find("/",0,TRUE) != -1) { 140 if(isDir || fileL.find("/",0,TRUE) != -1) {
143 141
144 if( !QDir( fi->filePath() ).isReadable()) //is directory 142 if( !QDir( fi->filePath() ).isReadable()) //is directory
145 pm = Resource::loadPixmap( "lockedfolder" ); 143 pm = Resource::loadPixmap( "lockedfolder" );
146 else 144 else
147 pm= Resource::loadPixmap( "folder" ); 145 pm= Resource::loadPixmap( "folder" );
148 } 146 }
149 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 147 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
150 pm = Resource::loadPixmap( "exec"); 148 pm = Resource::loadPixmap( "exec");
151 } 149 }
152 else if( (fileInfo.permission( QFileInfo::ExeUser) 150 else if( (fileInfo.permission( QFileInfo::ExeUser)
153 | fileInfo.permission( QFileInfo::ExeGroup) 151 | fileInfo.permission( QFileInfo::ExeGroup)
154 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 152 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
155 pm = Resource::loadPixmap( "exec"); 153 pm = Resource::loadPixmap( "exec");
156 } 154 }
157 else if( !fi->isReadable() ) { 155 else if( !fi->isReadable() ) {
158 pm = Resource::loadPixmap( "locked" ); 156 pm = Resource::loadPixmap( "locked" );
159 } 157 }
160 else { //everything else goes by mimetype 158 else { //everything else goes by mimetype
161 MimeType mt(fi->filePath()); 159 MimeType mt(fi->filePath());
162 pm=mt.pixmap(); //sets the correct pixmap for mimetype 160 pm=mt.pixmap(); //sets the correct pixmap for mimetype
163 if(pm.isNull()) { 161 if(pm.isNull()) {
164 pm = unknownXpm; 162 pm = unknownXpm;
165 } 163 }
166 } 164 }
167 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { 165 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
168 // odebug << " overlay link image" << oendl; 166 // odebug << " overlay link image" << oendl;
169 pm= Resource::loadPixmap( "advancedfm/symlink" ); 167 pm= Resource::loadPixmap( "advancedfm/symlink" );
170 // pm= Resource::loadPixmap( "folder" ); 168 // pm= Resource::loadPixmap( "folder" );
171// QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 169// QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
172// QPainter painter( &pm ); 170// QPainter painter( &pm );
173// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 171// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
174// pm.setMask( pm.createHeuristicMask( FALSE ) ); 172// pm.setMask( pm.createHeuristicMask( FALSE ) );
175 } 173 }
176 item->setPixmap( 0,pm); 174 item->setPixmap( 0,pm);
177 175
178 } 176 }
179 isDir=FALSE; 177 isDir=FALSE;
180 ++it; 178 ++it;
181 } 179 }
182 180
183 if( path.find("dev",0,TRUE) != -1) { 181 if( path.find("dev",0,TRUE) != -1) {
184 struct stat buf; 182 struct stat buf;
185 dev_t devT; 183 dev_t devT;
186 DIR *dir; 184 DIR *dir;
187 struct dirent *mydirent; 185 struct dirent *mydirent;
188 186
189 if((dir = opendir( path.latin1())) != NULL) 187 if((dir = opendir( path.latin1())) != NULL)
190 while ((mydirent = readdir(dir)) != NULL) { 188 while ((mydirent = readdir(dir)) != NULL) {
191 lstat( mydirent->d_name, &buf); 189 lstat( mydirent->d_name, &buf);
192// odebug << mydirent->d_name << oendl; 190// odebug << mydirent->d_name << oendl;
193 fileL.sprintf("%s", mydirent->d_name); 191 fileL.sprintf("%s", mydirent->d_name);
194 devT = buf.st_dev; 192 devT = buf.st_dev;
195 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 193 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
196 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 194 fileDate.sprintf("%s", ctime( &buf.st_mtime));
197 if( fileL.find(".") == -1 ) { 195 if( fileL.find(".") == -1 ) {
198 item= new QListViewItem( thisView, fileL, fileS, fileDate); 196 item= new QListViewItem( thisView, fileL, fileS, fileDate);
199 pm = unknownXpm; 197 pm = unknownXpm;
200 item->setPixmap( 0,pm); 198 item->setPixmap( 0,pm);
201 } 199 }
202 } 200 }
203 201
204 closedir(dir); 202 closedir(dir);
205 } 203 }
206 204
207 thisView->setSorting( 3,FALSE); 205 thisView->setSorting( 3,FALSE);
208 fillCombo( (const QString &) path ); 206 fillCombo( (const QString &) path );
209} 207}
210 208
211void AdvancedFm::rePopulate() { 209void AdvancedFm::rePopulate() {
212 // qDebug("repopulate views"); 210 // qDebug("repopulate views");
213 populateView(); 211 populateView();
214 setOtherTabCurrent(); 212 setOtherTabCurrent();
215 populateView(); 213 populateView();
216} 214}
217 215
218void AdvancedFm::ListClicked(QListViewItem *selectedItem) { 216void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
219 if(selectedItem) { 217 if(selectedItem) {
220 QString strItem=selectedItem->text(0); 218 QString strItem=selectedItem->text(0);
221// owarn << strItem << oendl; 219// owarn << strItem << oendl;
222 QString strSize=selectedItem->text(1); 220 QString strSize=selectedItem->text(1);
223 strSize=strSize.stripWhiteSpace(); 221 strSize=strSize.stripWhiteSpace();
224 bool isDirectory = false; 222 bool isDirectory = false;
225 QString strItem2; 223 QString strItem2;
226 224
227 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink 225 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink
228 strItem2 = dealWithSymName((const QString&)strItem); 226 strItem2 = dealWithSymName((const QString&)strItem);
229 if(QDir(strItem2).exists() ) 227 if(QDir(strItem2).exists() )
230 strItem = strItem2; 228 strItem = strItem2;
231 } 229 }
232 230
233 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 231 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
234 232
235 if(QDir(strItem).exists()) 233 if(QDir(strItem).exists())
236 isDirectory = true; 234 isDirectory = true;
237 } 235 }
238 236
239 if( isDirectory ) { 237 if( isDirectory ) {
240 CurrentDir()->cd( strItem, TRUE); 238 CurrentDir()->cd( strItem, TRUE);
241 populateView(); 239 populateView();
242 CurrentView()->ensureItemVisible( CurrentView()->firstChild()); 240 CurrentView()->ensureItemVisible( CurrentView()->firstChild());
243 } 241 }
244 chdir( strItem.latin1()); 242 chdir( strItem.latin1());
245 } 243 }
246} 244}
247 245
248void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { 246void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) {
249 Q_UNUSED(item); 247 Q_UNUSED(item);
250 switch (mouse) { 248 switch (mouse) {
251 case 1: 249 case 1:
252 { 250 {
253 if(renameBox != 0 ) { 251 if(renameBox != 0 ) {
254 cancelRename(); 252 cancelRename();
255 } 253 }
256 } 254 }
257 break; 255 break;
258// case 2: 256// case 2:
259// menuTimer.start( 50, TRUE ); 257// menuTimer.start( 50, TRUE );
260// break; 258// break;
261 }; 259 };
262} 260}
263 261
264 262
265void AdvancedFm::refreshCurrentTab() { 263void AdvancedFm::refreshCurrentTab() {
266 populateView(); 264 populateView();
267 // if ( TabWidget->currentWidget() == tab) { 265 // if ( TabWidget->currentWidget() == tab) {
268} 266}
269 267
270void AdvancedFm::switchToLocalTab() { 268void AdvancedFm::switchToLocalTab() {
271 TabWidget->setCurrentWidget(0); 269 TabWidget->setCurrentWidget(0);
272 // Local_View->setFocus(); 270 // Local_View->setFocus();
273 whichTab = 1; 271 whichTab = 1;
274} 272}
275 273
276void AdvancedFm::switchToRemoteTab() { 274void AdvancedFm::switchToRemoteTab() {
277 TabWidget->setCurrentWidget(1); 275 TabWidget->setCurrentWidget(1);
278 // Remote_View->setFocus(); 276 // Remote_View->setFocus();
279 whichTab = 2; 277 whichTab = 2;
280} 278}
281 279
282void AdvancedFm::currentPathComboChanged() { 280void AdvancedFm::currentPathComboChanged() {
283 QString pDir = currentPathCombo->lineEdit()->text(); 281 QString pDir = currentPathCombo->lineEdit()->text();
284 if(QDir(pDir).exists()) { 282 if(QDir(pDir).exists()) {
285 CurrentDir()->setPath(pDir ); 283 CurrentDir()->setPath(pDir );
286 populateView(); 284 populateView();
287 } else { 285 } else {
288 QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir)); 286 QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir));
289 } 287 }
290} 288}
291 289
292void AdvancedFm::fillCombo(const QString &currentPath) { 290void AdvancedFm::fillCombo(const QString &currentPath) {
293 291
294 if ( TabWidget->currentWidget() == tab) { 292 if ( TabWidget->currentWidget() == tab) {
295// if ( whichTab == 1) { 293// if ( whichTab == 1) {
296 currentPathCombo->lineEdit()->setText( currentPath); 294 currentPathCombo->lineEdit()->setText( currentPath);
297 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 295 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
298 currentPathCombo->clear(); 296 currentPathCombo->clear();
299 localDirPathStringList.prepend( currentPath ); 297 localDirPathStringList.prepend( currentPath );
300 currentPathCombo->insertStringList( localDirPathStringList,-1); 298 currentPathCombo->insertStringList( localDirPathStringList,-1);
301 } 299 }
302 } else { 300 } else {
303 currentPathCombo->lineEdit()->setText( currentPath); 301 currentPathCombo->lineEdit()->setText( currentPath);
304 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 302 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
305 currentPathCombo->clear(); 303 currentPathCombo->clear();
306 remoteDirPathStringList.prepend( currentPath ); 304 remoteDirPathStringList.prepend( currentPath );
307 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 305 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
308 } 306 }
309 } 307 }
310} 308}
311 309
312QStringList AdvancedFm::getPath() { 310QStringList AdvancedFm::getPath() {
313 QStringList strList; 311 QStringList strList;
314 QListView *thisView=CurrentView(); 312 QListView *thisView=CurrentView();
315 QList<QListViewItem> * getSelectedItems( QListView * thisView ); 313 QList<QListViewItem> * getSelectedItems( QListView * thisView );
316 QListViewItemIterator it( thisView ); 314 QListViewItemIterator it( thisView );
317 for ( ; it.current(); ++it ) { 315 for ( ; it.current(); ++it ) {
318 if ( it.current()->isSelected() ) { 316 if ( it.current()->isSelected() ) {
319 strList << it.current()->text(0); 317 strList << it.current()->text(0);
320// odebug << it.current()->text(0) << oendl; 318// odebug << it.current()->text(0) << oendl;
321 } 319 }
322 } 320 }
323 return strList; 321 return strList;
324} 322}
325 323
326void AdvancedFm::changeTo(const QString dir) { 324void AdvancedFm::changeTo(const QString &dir) {
327 chdir( dir.latin1()); 325 chdir( dir.latin1());
328 CurrentDir()->cd(dir, TRUE); 326 CurrentDir()->cd(dir, TRUE);
329 populateView(); 327 populateView();
330 update(); 328 update();
331} 329}
332 330
333void AdvancedFm::homeButtonPushed() { 331void AdvancedFm::homeButtonPushed() {
334 changeTo(QDir::homeDirPath()); 332 changeTo(QDir::homeDirPath());
335} 333}
336 334
337void AdvancedFm::docButtonPushed() { 335void AdvancedFm::docButtonPushed() {
338 changeTo(QPEApplication::documentDir()); 336 changeTo(QPEApplication::documentDir());
339} 337}
340 338
341void AdvancedFm::SDButtonPushed() { 339void AdvancedFm::SDButtonPushed() {
342 Opie::Core::OStorageInfo info; 340 Opie::Core::OStorageInfo info;
343 changeTo(info.sdPath()); 341 changeTo(info.sdPath());
344} 342}
345 343
346void AdvancedFm::CFButtonPushed() { 344void AdvancedFm::CFButtonPushed() {
347 Opie::Core::OStorageInfo info; 345 Opie::Core::OStorageInfo info;
348 changeTo(info.cfPath()); 346 changeTo(info.cfPath());
349} 347}
350 348
351void AdvancedFm::QPEButtonPushed() { 349void AdvancedFm::QPEButtonPushed() {
352 changeTo(QPEApplication::qpeDir()); 350 changeTo(QPEApplication::qpeDir());
353} 351}
354 352
355void AdvancedFm::doAbout() { 353void AdvancedFm::doAbout() {
356 QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); 354 QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>"));
357} 355}
358 356
359void AdvancedFm::keyPressEvent( QKeyEvent *e) { 357void AdvancedFm::keyPressEvent( QKeyEvent *e) {
360 Q_UNUSED(e); 358 Q_UNUSED(e);
361} 359}
362 360
363void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { 361void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
364// if( CurrentView()->hasFocus() ) 362// if( CurrentView()->hasFocus() )
365// e->ignore(); 363// e->ignore();
366 if( currentPathCombo->lineEdit()->hasFocus()) { 364 if( currentPathCombo->lineEdit()->hasFocus()) {
367 // qDebug("shout!"); 365 // qDebug("shout!");
368 } 366 }
369 367
370 else if( e->key() == Key_Left ) 368 else if( e->key() == Key_Left )
371 upDir(); 369 upDir();
372 else if( e->key() == Key_Return || e->key() == Key_Enter) 370 else if( e->key() == Key_Return || e->key() == Key_Enter)
373 navigateToSelected(); 371 navigateToSelected();
374 else if( e->key() == Key_Tab) 372 else if( e->key() == Key_Tab)
375 setOtherTabCurrent(); 373 setOtherTabCurrent();
376 else if( e->key() == Key_Delete ) 374 else if( e->key() == Key_Delete )
377 del(); 375 del();
378 else if( e->key() == Key_A) 376 else if( e->key() == Key_A)
379 copyAs(); 377 copyAs();
380 else if( e->key() == Key_C) 378 else if( e->key() == Key_C)
381 copy(); 379 copy();
382 else if( e->key() == Key_E) 380 else if( e->key() == Key_E)
383 runThis(); 381 runThis();
384 else if( e->key() == Key_G) 382 else if( e->key() == Key_G)
385 currentPathCombo->lineEdit()->setFocus(); 383 currentPathCombo->lineEdit()->setFocus();
386 else if( e->key() == Key_H ) 384 else if( e->key() == Key_H )
387 showHidden(); 385 showHidden();
388 else if( e->key() == Key_I) 386 else if( e->key() == Key_I)
389 fileStatus(); 387 fileStatus();
390 else if( e->key() == Key_M) 388 else if( e->key() == Key_M)
391 move(); 389 move();
392 else if( e->key() == Key_N ) 390 else if( e->key() == Key_N )
393 mkDir(); 391 mkDir();
394 else if( e->key() == Key_P) 392 else if( e->key() == Key_P)
395 filePerms(); 393 filePerms();
396 else if( e->key() == Key_R ) 394 else if( e->key() == Key_R )
397 rn(); 395 rn();
398 else if( e->key() == Key_U ) 396 else if( e->key() == Key_U )
399 upDir(); 397 upDir();
400 else if( e->key() == Key_1) 398 else if( e->key() == Key_1)
401 switchToLocalTab(); 399 switchToLocalTab();
402 else if( e->key() == Key_2) 400 else if( e->key() == Key_2)
403 switchToRemoteTab(); 401 switchToRemoteTab();
404 else if( e->key() == Key_3) 402 else if( e->key() == Key_3)
405 CFButtonPushed(); 403 CFButtonPushed();
406 else if( e->key() == Key_4) 404 else if( e->key() == Key_4)
407 SDButtonPushed(); 405 SDButtonPushed();
408 else if( e->key() == Key_5 ) 406 else if( e->key() == Key_5 )
409 homeButtonPushed(); 407 homeButtonPushed();
410 else if( e->key() == Key_6 ) 408 else if( e->key() == Key_6 )
411 docButtonPushed(); 409 docButtonPushed();
412 else 410 else
413 e->accept(); 411 e->accept();
414} 412}
415 413
416 414
417void AdvancedFm::parsetab(const QString &fileName) { 415void AdvancedFm::parsetab(const QString &fileName) {
418 416
419 fileSystemTypeList.clear(); 417 fileSystemTypeList.clear();
420 fsList.clear(); 418 fsList.clear();
421 struct mntent *me; 419 struct mntent *me;
422 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 420 FILE *mntfp = setmntent( fileName.latin1(), "r" );
423 if ( mntfp ) { 421 if ( mntfp ) {
424 while ( (me = getmntent( mntfp )) != 0 ) { 422 while ( (me = getmntent( mntfp )) != 0 ) {
425 QString deviceName = me->mnt_fsname; 423 QString deviceName = me->mnt_fsname;
426 QString filesystemType = me->mnt_type; 424 QString filesystemType = me->mnt_type;
427 QString mountDir = me->mnt_dir; 425 QString mountDir = me->mnt_dir;
428 if(deviceName != "none") { 426 if(deviceName != "none") {
429 if( fsList.contains(filesystemType) == 0 427 if( fsList.contains(filesystemType) == 0
430 & filesystemType.find("proc",0,TRUE) == -1 428 & filesystemType.find("proc",0,TRUE) == -1
431 & filesystemType.find("cramfs",0,TRUE) == -1 429 & filesystemType.find("cramfs",0,TRUE) == -1
432 & filesystemType.find("auto",0,TRUE) == -1) 430 & filesystemType.find("auto",0,TRUE) == -1)
433 fsList << filesystemType; 431 fsList << filesystemType;
434 fileSystemTypeList << mountDir+"::"+filesystemType; 432 fileSystemTypeList << mountDir+"::"+filesystemType;
435 } 433 }
436 } 434 }
437 } 435 }
438 endmntent( mntfp ); 436 endmntent( mntfp );
439} 437}
440 438
441QString AdvancedFm::getFileSystemType(const QString &currentText) { 439QString AdvancedFm::getFileSystemType(const QString &currentText) {
442 parsetab("/etc/mtab"); //why did TT forget filesystem type? 440 parsetab("/etc/mtab"); //why did TT forget filesystem type?
443 QString current = currentText;//.right( currentText.length()-1); 441 QString current = currentText;//.right( currentText.length()-1);
444 QString baseFs; 442 QString baseFs;
445 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 443 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
446 QString temp = (*it); 444 QString temp = (*it);
447 QString path = temp.left(temp.find("::",0,TRUE) ); 445 QString path = temp.left(temp.find("::",0,TRUE) );
448 path = path.right( path.length()-1); 446 path = path.right( path.length()-1);
449 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 447 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
450 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 448 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
451 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 449 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
452 } 450 }
453 } 451 }
454 return baseFs; 452 return baseFs;
455} 453}
456 454
457QString AdvancedFm::getDiskSpace( const QString &path) { 455QString AdvancedFm::getDiskSpace( const QString &path) {
458 struct statfs fss; 456 struct statfs fss;
459 if ( !statfs( path.latin1(), &fss ) ) { 457 if ( !statfs( path.latin1(), &fss ) ) {
460 int blkSize = fss.f_bsize; 458 int blkSize = fss.f_bsize;
461 // int totalBlks = fs.f_blocks; 459 // int totalBlks = fs.f_blocks;
462 int availBlks = fss.f_bavail; 460 int availBlks = fss.f_bavail;
463 461
464 long mult = blkSize / 1024; 462 long mult = blkSize / 1024;
465 long div = 1024 / blkSize; 463 long div = 1024 / blkSize;
466 if ( !mult ) mult = 1; 464 if ( !mult ) mult = 1;
467 if ( !div ) div = 1; 465 if ( !div ) div = 1;
468 466
469 return QString::number(availBlks * mult / div); 467 return QString::number(availBlks * mult / div);
470 } 468 }
471 return ""; 469 return "";
472} 470}
473 471
474 472
475void AdvancedFm::showFileMenu() { 473void AdvancedFm::showFileMenu() {
476 QString curApp; 474 QString curApp;
477 curApp = CurrentView()->currentItem()->text(0); 475 curApp = CurrentView()->currentItem()->text(0);
478 476
479 MimeType mt(curApp); 477 MimeType mt(curApp);
480 const AppLnk* app = mt.application(); 478 const AppLnk* app = mt.application();
481 QFile fi(curApp); 479 QFile fi(curApp);
482 QPopupMenu *m = new QPopupMenu(0); 480 QPopupMenu *m = new QPopupMenu(0);
483 QPopupMenu *n = new QPopupMenu(0); 481 QPopupMenu *n = new QPopupMenu(0);
484 // QPopupMenu *o = new QPopupMenu(0); 482 // QPopupMenu *o = new QPopupMenu(0);
485 m->insertItem(tr("Show Hidden Files"),this,SLOT(showHidden())); 483 m->insertItem(tr("Show Hidden Files"),this,SLOT(showHidden()));
486 484
487 if ( QFileInfo(fi).isDir()) { 485 if ( QFileInfo(fi).isDir()) {
488 m->insertSeparator(); 486 m->insertSeparator();
489 m->insertItem(tr("Change Directory"),this,SLOT(doDirChange())); 487 m->insertItem(tr("Change Directory"),this,SLOT(doDirChange()));
490 } else { 488 } else {
491 489
492 if (app) 490 if (app)
493 m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis())); 491 m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis()));
494 else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this 492 else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this
495 m->insertItem(tr("Execute"),this,SLOT(runThis())); 493 m->insertItem(tr("Execute"),this,SLOT(runThis()));
496 m->insertItem(Resource::loadPixmap("txt"),tr("Open as text"),this,SLOT(runText())); 494 m->insertItem(Resource::loadPixmap("txt"),tr("Open as text"),this,SLOT(runText()));
497 } 495 }
498 496
499 m->insertItem(tr("Actions"),n); 497 m->insertItem(tr("Actions"),n);
500 n->insertItem(tr("Make Directory"),this,SLOT(makeDir())); 498 n->insertItem(tr("Make Directory"),this,SLOT(makeDir()));
501 499
502 n->insertItem(tr("Make Symlink"),this,SLOT(mkSym())); 500 n->insertItem(tr("Make Symlink"),this,SLOT(mkSym()));
503 501
504 n->insertSeparator(); 502 n->insertSeparator();
505 n->insertItem(tr("Rename"),this,SLOT(renameIt())); 503 n->insertItem(tr("Rename"),this,SLOT(renameIt()));
506 504
507 n->insertItem(tr("Copy"),this,SLOT(copyTimer())); 505 n->insertItem(tr("Copy"),this,SLOT(copyTimer()));
508 n->insertItem(tr("Copy As"),this,SLOT(copyAsTimer())); 506 n->insertItem(tr("Copy As"),this,SLOT(copyAsTimer()));
509 n->insertItem(tr("Copy Same Dir"),this,SLOT(copySameDirTimer())); 507 n->insertItem(tr("Copy Same Dir"),this,SLOT(copySameDirTimer()));
510 n->insertItem(tr("Move"),this,SLOT(moveTimer())); 508 n->insertItem(tr("Move"),this,SLOT(moveTimer()));
511 509
512 n->insertSeparator(); 510 n->insertSeparator();
513 n->insertItem(tr("Delete"),this,SLOT(doDelete())); 511 n->insertItem(tr("Delete"),this,SLOT(doDelete()));
514 m->insertItem(tr("Add To Documents"),this,SLOT(addToDocs())); 512 m->insertItem(tr("Add To Documents"),this,SLOT(addToDocs()));
515 513
516 m->insertItem(tr("Run Command"),this,SLOT(runCommand())); 514 m->insertItem(tr("Run Command"),this,SLOT(runCommand()));
517 m->insertItem(tr("File Info"),this,SLOT(fileStatus())); 515 m->insertItem(tr("File Info"),this,SLOT(fileStatus()));
518 516
519 m->insertSeparator(); 517 m->insertSeparator();
520 m->insertItem(tr("Set Permissions"),this,SLOT(filePerms())); 518 m->insertItem(tr("Set Permissions"),this,SLOT(filePerms()));
521 519
522#if defined(QT_QWS_OPIE) 520#if defined(QT_QWS_OPIE)
523 m->insertItem(tr("Properties"),this,SLOT(doProperties())); 521 m->insertItem(tr("Properties"),this,SLOT(doProperties()));
524#endif 522#endif
525 m->setCheckable(TRUE); 523 m->setCheckable(TRUE);
526 if (!b) 524 if (!b)
527 m->setItemChecked(m->idAt(0),TRUE); 525 m->setItemChecked(m->idAt(0),TRUE);
528 else 526 else
529 m->setItemChecked(m->idAt(0),FALSE); 527 m->setItemChecked(m->idAt(0),FALSE);
530 528
531 if(Ir::supported()) 529 if(Ir::supported())
532 m->insertItem(tr("Beam File"),this,SLOT(doBeam())); 530 m->insertItem(tr("Beam File"),this,SLOT(doBeam()));
533 m->setFocus(); 531 m->setFocus();
534 532
535 m->exec(QPoint(QCursor::pos().x(),QCursor::pos().y())); 533 m->exec(QPoint(QCursor::pos().x(),QCursor::pos().y()));
536 534
537 if(m) delete m; 535 if(m) delete m;
538} 536}
539 537
540 538
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index c25bce2..a4f2510 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -1,190 +1,190 @@
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 <opie2/oprocess.h> 17#include <opie2/oprocess.h>
18#include <opie2/osplitter.h> 18#include <opie2/osplitter.h>
19 19
20#include <qpe/ir.h> 20#include <qpe/ir.h>
21#include <qpe/qcopenvelope_qws.h> 21#include <qpe/qcopenvelope_qws.h>
22 22
23#include <qvariant.h> 23#include <qvariant.h>
24#include <qdialog.h> 24#include <qdialog.h>
25#include <qmainwindow.h> 25#include <qmainwindow.h>
26#include <qstringlist.h> 26#include <qstringlist.h>
27#include <qdir.h> 27#include <qdir.h>
28#include <qstring.h> 28#include <qstring.h>
29#include <qpoint.h> 29#include <qpoint.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qpixmap.h> 31#include <qpixmap.h>
32 32
33 33
34class QVBoxLayout; 34class QVBoxLayout;
35class QHBoxLayout; 35class QHBoxLayout;
36class QGridLayout; 36class QGridLayout;
37class QComboBox; 37class QComboBox;
38class QListView; 38class QListView;
39class QListviewItem; 39class QListviewItem;
40class QLabel; 40class QLabel;
41class QProgressBar; 41class QProgressBar;
42class QSpinBox; 42class QSpinBox;
43class QWidget; 43class QWidget;
44class QPopupMenu; 44class QPopupMenu;
45class QFile; 45class QFile;
46class QListViewItem; 46class QListViewItem;
47class QLineEdit; 47class QLineEdit;
48class MenuButton; 48class MenuButton;
49 49
50class QToolButton; 50class QToolButton;
51class Ir; 51class Ir;
52 52
53class AdvancedFm : public QMainWindow 53class AdvancedFm : public QMainWindow
54{ 54{
55 Q_OBJECT 55 Q_OBJECT
56public: 56public:
57 static QString appName() { return QString::fromLatin1("advancedfm"); } 57 static QString appName() { return QString::fromLatin1("advancedfm"); }
58 AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0); 58 AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0);
59 ~AdvancedFm(); 59 ~AdvancedFm();
60protected: 60protected:
61 61
62 Opie::Ui::OSplitter *TabWidget; 62 Opie::Ui::OSplitter *TabWidget;
63 QCopChannel * channel; 63 QCopChannel * channel;
64 QPixmap unknownXpm; 64 QPixmap unknownXpm;
65 int whichTab; 65 int whichTab;
66// QTabWidget *TabWidget; 66// QTabWidget *TabWidget;
67 QWidget *tab, *tab_2, *tab_3; 67 QWidget *tab, *tab_2, *tab_3;
68 QListView *Local_View, *Remote_View; 68 QListView *Local_View, *Remote_View;
69 69
70 QLineEdit *currentPathEdit; 70 QLineEdit *currentPathEdit;
71 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; 71 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/;
72 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 72 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
73// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 73// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
74 QDir currentDir, currentRemoteDir; 74 QDir currentDir, currentRemoteDir;
75 QComboBox *currentPathCombo; 75 QComboBox *currentPathCombo;
76 QString filterStr, s_addBookmark, s_removeBookmark; 76 QString filterStr, s_addBookmark, s_removeBookmark;
77 QListViewItem * item; 77 QListViewItem * item;
78 bool b; 78 bool b;
79 QStringList fileSystemTypeList, fsList; 79 QStringList fileSystemTypeList, fsList;
80 int currentServerConfig; 80 int currentServerConfig;
81 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 81 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
82 QStringList remoteDirPathStringList, localDirPathStringList; 82 QStringList remoteDirPathStringList, localDirPathStringList;
83 QLineEdit *renameBox; 83 QLineEdit *renameBox;
84 84
85 void init(); 85 void init();
86 void initConnections(); 86 void initConnections();
87 void keyReleaseEvent( QKeyEvent *); 87 void keyReleaseEvent( QKeyEvent *);
88 void keyPressEvent( QKeyEvent *); 88 void keyPressEvent( QKeyEvent *);
89 QString getFileSystemType(const QString &); 89 QString getFileSystemType(const QString &);
90 QString getDiskSpace(const QString &); 90 QString getDiskSpace(const QString &);
91 void parsetab(const QString &fileName); 91 void parsetab(const QString &fileName);
92 QString checkDiskSpace(const QString &); 92 QString checkDiskSpace(const QString &);
93 QString dealWithSymName(const QString &); 93 QString dealWithSymName(const QString &);
94 QDir *CurrentDir(); 94 QDir *CurrentDir();
95 QDir *OtherDir(); 95 QDir *OtherDir();
96 QListView *CurrentView(); 96 QListView *CurrentView();
97 QListView *OtherView(); 97 QListView *OtherView();
98 void setOtherTabCurrent(); 98 void setOtherTabCurrent();
99 void changeTo(const QString dir);
100 99
101//protected signals: 100//protected signals:
102 // void newPath(QString); 101 // void newPath(QString);
103 102
104protected slots: 103protected slots:
104 void changeTo(const QString &);
105 void slotSwitchMenu(int); 105 void slotSwitchMenu(int);
106 void selectAll(); 106 void selectAll();
107 void addToDocs(); 107 void addToDocs();
108 void doDirChange(); 108 void doDirChange();
109 void mkDir(); 109 void mkDir();
110 void del(); 110 void del();
111 void rn(); 111 void rn();
112 void populateView(); 112 void populateView();
113 void rePopulate(); 113 void rePopulate();
114 void showHidden(); 114 void showHidden();
115 void showMenuHidden(); 115 void showMenuHidden();
116 void ListClicked(QListViewItem *); 116 void ListClicked(QListViewItem *);
117 void ListPressed( int, QListViewItem *, const QPoint&, int); 117 void ListPressed( int, QListViewItem *, const QPoint&, int);
118 void makeDir(); 118 void makeDir();
119 void doDelete(); 119 void doDelete();
120 void tabChanged(QWidget*); 120 void tabChanged(QWidget*);
121 void cleanUp(); 121 void cleanUp();
122 void renameIt(); 122 void renameIt();
123 void runThis(); 123 void runThis();
124 void runText(); 124 void runText();
125 void filePerms(); 125 void filePerms();
126 void doProperties(); 126 void doProperties();
127 void runCommand(); 127 void runCommand();
128 void runCommandStd(); 128 void runCommandStd();
129 QStringList getPath(); 129 QStringList getPath();
130 void mkSym(); 130 void mkSym();
131 void switchToLocalTab(); 131 void switchToLocalTab();
132 void switchToRemoteTab(); 132 void switchToRemoteTab();
133 void refreshCurrentTab(); 133 void refreshCurrentTab();
134 134
135 void openSearch(); 135 void openSearch();
136 void dirMenuSelected(int); 136 void dirMenuSelected(int);
137 void showFileMenu(); 137 void showFileMenu();
138 void homeButtonPushed(); 138 void homeButtonPushed();
139 void docButtonPushed(); 139 void docButtonPushed();
140 void SDButtonPushed(); 140 void SDButtonPushed();
141 void CFButtonPushed(); 141 void CFButtonPushed();
142 void QPEButtonPushed(); 142 void QPEButtonPushed();
143 void upDir(); 143 void upDir();
144 void currentPathComboChanged(); 144 void currentPathComboChanged();
145 145
146 void copy(); 146 void copy();
147 void copyTimer(); 147 void copyTimer();
148 void copyAs(); 148 void copyAs();
149 void copyAsTimer(); 149 void copyAsTimer();
150 void copySameDir(); 150 void copySameDir();
151 void copySameDirTimer(); 151 void copySameDirTimer();
152 void move(); 152 void move();
153 void moveTimer(); 153 void moveTimer();
154 154
155 void fillCombo(const QString &); 155 void fillCombo(const QString &);
156 bool copyFile( const QString & , const QString & ); 156 bool copyFile( const QString & , const QString & );
157 void fileStatus(); 157 void fileStatus();
158 void doAbout(); 158 void doAbout();
159 void doBeam(); 159 void doBeam();
160 void fileBeamFinished( Ir *); 160 void fileBeamFinished( Ir *);
161 bool copyDirectory( const QString & , const QString & ); 161 bool copyDirectory( const QString & , const QString & );
162// void navigateToSelected(); 162// void navigateToSelected();
163 bool moveDirectory( const QString & , const QString & ); 163 bool moveDirectory( const QString & , const QString & );
164 164
165// void slotSwitchtoLocal(int); 165// void slotSwitchtoLocal(int);
166 166
167private: 167private:
168 MenuButton *menuButton; 168 MenuButton *menuButton;
169 QString oldName, localViewDir, remoteViewDir; 169 QString oldName, localViewDir, remoteViewDir;
170 void startProcess(const QString &); 170 void startProcess(const QString &);
171 bool eventFilter( QObject * , QEvent * ); 171 bool eventFilter( QObject * , QEvent * );
172 void cancelRename(); 172 void cancelRename();
173 void doRename(QListView *); 173 void doRename(QListView *);
174 void okRename(); 174 void okRename();
175 void customDirsToMenu(); 175 void customDirsToMenu();
176 void addCustomDir(); 176 void addCustomDir();
177 void removeCustomDir(); 177 void removeCustomDir();
178 void navigateToSelected(); 178 void navigateToSelected();
179 179
180private slots: 180private slots:
181 void processEnded(Opie::Core::OProcess *); 181 void processEnded(Opie::Core::OProcess *);
182 void oprocessStderr(Opie::Core::OProcess *, char *, int); 182 void oprocessStderr(Opie::Core::OProcess *, char *, int);
183 void gotoCustomDir(const QString &); 183 void gotoCustomDir(const QString &);
184 void qcopReceive(const QCString&, const QByteArray&); 184 void qcopReceive(const QCString&, const QByteArray&);
185 void setDocument(const QString &); 185 void setDocument(const QString &);
186 // void doMenu(int 186 // void doMenu(int
187 187
188}; 188};
189 189
190#endif // ADVANCEDFM_H 190#endif // ADVANCEDFM_H
diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro
index 713f61c..01ea8f4 100644
--- a/noncore/apps/advancedfm/advancedfm.pro
+++ b/noncore/apps/advancedfm/advancedfm.pro
@@ -1,15 +1,15 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG += qte warn_on quick-app 2CONFIG += qte warn_on quick-app debug
3HEADERS = advancedfm.h filePermissions.h output.h 3HEADERS = advancedfm.h filePermissions.h output.h
4SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp 4SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp
5TARGET = advancedfm 5TARGET = advancedfm
6INCLUDEPATH += $(OPIEDIR)/include 6INCLUDEPATH += $(OPIEDIR)/include
7DEPENDPATH += $(OPIEDIR)/include 7DEPENDPATH += $(OPIEDIR)/include
8LIBS += -lqpe -lqte -lopiecore2 -lopieui2 8LIBS += -lqpe -lqte -lopiecore2 -lopieui2
9 9
10!contains(CONFIG,quick-app) { 10!contains(CONFIG,quick-app) {
11 DESTDIR = $(OPIEDIR)/bin 11 DESTDIR = $(OPIEDIR)/bin
12 DEFINES += NOQUICKLAUNCH 12 DEFINES += NOQUICKLAUNCH
13} 13}
14 14
15include ( $(OPIEDIR)/include.pro ) 15include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 7b3dcf6..171e7c4 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -527,318 +527,317 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
527 } 527 }
528 528
529 529
530 bool success = true; 530 bool success = true;
531 struct stat status; 531 struct stat status;
532 QFile srcFile(src); 532 QFile srcFile(src);
533 QFile destFile(dest); 533 QFile destFile(dest);
534 int err=0; 534 int err=0;
535 int read_fd=0; 535 int read_fd=0;
536 int write_fd=0; 536 int write_fd=0;
537 struct stat stat_buf; 537 struct stat stat_buf;
538 off_t offset = 0; 538 off_t offset = 0;
539 if(!srcFile.open( IO_ReadOnly|IO_Raw)) { 539 if(!srcFile.open( IO_ReadOnly|IO_Raw)) {
540// owarn << "open failed" << oendl; 540// owarn << "open failed" << oendl;
541 return success = false; 541 return success = false;
542 } 542 }
543 read_fd = srcFile.handle(); 543 read_fd = srcFile.handle();
544 if(read_fd != -1) { 544 if(read_fd != -1) {
545 fstat (read_fd, &stat_buf); 545 fstat (read_fd, &stat_buf);
546 if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { 546 if( !destFile.open( IO_WriteOnly|IO_Raw ) ) {
547// owarn << "destfile open failed" << oendl; 547// owarn << "destfile open failed" << oendl;
548 return success = false; 548 return success = false;
549 } 549 }
550 write_fd = destFile.handle(); 550 write_fd = destFile.handle();
551 if(write_fd != -1) { 551 if(write_fd != -1) {
552 err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); 552 err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
553 if( err == -1) { 553 if( err == -1) {
554 QString msg; 554 QString msg;
555 switch(err) { 555 switch(err) {
556 case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; 556 case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. ";
557 case EINVAL: msg = "Descriptor is not valid or locked. "; 557 case EINVAL: msg = "Descriptor is not valid or locked. ";
558 case ENOMEM: msg = "Insufficient memory to read from in_fd."; 558 case ENOMEM: msg = "Insufficient memory to read from in_fd.";
559 case EIO: msg = "Unspecified error while reading from in_fd."; 559 case EIO: msg = "Unspecified error while reading from in_fd.";
560 }; 560 };
561 success = false; 561 success = false;
562// owarn << msg << oendl; 562// owarn << msg << oendl;
563 } 563 }
564 } else { 564 } else {
565 success = false; 565 success = false;
566 } 566 }
567 } else { 567 } else {
568 success = false; 568 success = false;
569 } 569 }
570 srcFile.close(); 570 srcFile.close();
571 destFile.close(); 571 destFile.close();
572 // Set file permissions 572 // Set file permissions
573 if( stat( QFile::encodeName(src), &status ) == 0 ) { 573 if( stat( QFile::encodeName(src), &status ) == 0 ) {
574 chmod( QFile::encodeName(dest), status.st_mode ); 574 chmod( QFile::encodeName(dest), status.st_mode );
575 } 575 }
576 576
577 return success; 577 return success;
578} 578}
579 579
580void AdvancedFm::runCommand() { 580void AdvancedFm::runCommand() {
581 if( !CurrentView()->currentItem()) return; 581 if( !CurrentView()->currentItem()) return;
582 QDir *thisDir = CurrentDir(); 582 QDir *thisDir = CurrentDir();
583 583
584 QString curFile; 584 QString curFile;
585 curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); 585 curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0);
586 586
587 InputDialog *fileDlg; 587 InputDialog *fileDlg;
588 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 588 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
589 fileDlg->setInputText(curFile); 589 fileDlg->setInputText(curFile);
590 fileDlg->exec(); 590 fileDlg->exec();
591 //QString command; 591 //QString command;
592 592
593 if( fileDlg->result() == 1 ) { 593 if( fileDlg->result() == 1 ) {
594// odebug << fileDlg->LineEdit1->text() << oendl; 594// odebug << fileDlg->LineEdit1->text() << oendl;
595 QStringList command; 595 QStringList command;
596 596
597 command << "/bin/sh"; 597 command << "/bin/sh";
598 command << "-c"; 598 command << "-c";
599 command << fileDlg->LineEdit1->text(); 599 command << fileDlg->LineEdit1->text();
600 Output *outDlg; 600 Output *outDlg;
601 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 601 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
602 QPEApplication::execDialog( outDlg ); 602 QPEApplication::execDialog( outDlg );
603 qApp->processEvents(); 603 qApp->processEvents();
604 604
605 } 605 }
606} 606}
607 607
608void AdvancedFm::runCommandStd() { 608void AdvancedFm::runCommandStd() {
609 if( !CurrentView()->currentItem()) return; 609 if( !CurrentView()->currentItem()) return;
610 QString curFile; 610 QString curFile;
611 QDir *thisDir = CurrentDir(); 611 QDir *thisDir = CurrentDir();
612 QListView *thisView = CurrentView(); 612 QListView *thisView = CurrentView();
613 if( thisView->currentItem()) 613 if( thisView->currentItem())
614 curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); 614 curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0);
615 615
616 InputDialog *fileDlg; 616 InputDialog *fileDlg;
617 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 617 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
618 fileDlg->setInputText(curFile); 618 fileDlg->setInputText(curFile);
619 fileDlg->exec(); 619 fileDlg->exec();
620 620
621 if( fileDlg->result() == 1 ) { 621 if( fileDlg->result() == 1 ) {
622 qApp->processEvents(); 622 qApp->processEvents();
623 startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); 623 startProcess( (const QString)fileDlg->LineEdit1->text().latin1());
624 } 624 }
625} 625}
626 626
627void AdvancedFm::fileStatus() { 627void AdvancedFm::fileStatus() {
628 if( !CurrentView()->currentItem()) return; 628 if( !CurrentView()->currentItem()) return;
629 QString curFile; 629 QString curFile;
630 curFile = CurrentView()->currentItem()->text(0); 630 curFile = CurrentView()->currentItem()->text(0);
631 631
632 QStringList command; 632 QStringList command;
633 command << "/bin/sh"; 633 command << "/bin/sh";
634 command << "-c"; 634 command << "-c";
635 command << "stat -l "+ curFile; 635 command << "stat -l "+ curFile;
636 636
637 Output *outDlg; 637 Output *outDlg;
638 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 638 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
639 QPEApplication::execDialog( outDlg ); 639 QPEApplication::execDialog( outDlg );
640 qApp->processEvents(); 640 qApp->processEvents();
641} 641}
642 642
643 643
644void AdvancedFm::mkDir() { 644void AdvancedFm::mkDir() {
645 makeDir(); 645 makeDir();
646} 646}
647 647
648void AdvancedFm::rn() { 648void AdvancedFm::rn() {
649 renameIt(); 649 renameIt();
650} 650}
651 651
652void AdvancedFm::del() { 652void AdvancedFm::del() {
653 doDelete(); 653 doDelete();
654} 654}
655 655
656void AdvancedFm::mkSym() { 656void AdvancedFm::mkSym() {
657 QString cmd; 657 QString cmd;
658 QStringList curFileList = getPath(); 658 QStringList curFileList = getPath();
659 if( curFileList.count() > 0) { 659 if( curFileList.count() > 0) {
660 QDir *thisDir = CurrentDir(); 660 QDir *thisDir = CurrentDir();
661 QDir * thatDir = OtherDir(); 661 QDir * thatDir = OtherDir();
662 662
663 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 663 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
664 664
665 QString destName = thatDir->canonicalPath()+"/"+(*it); 665 QString destName = thatDir->canonicalPath()+"/"+(*it);
666 if(destName.right(1) == "/") { 666 if(destName.right(1) == "/") {
667 destName = destName.left( destName.length() -1); 667 destName = destName.left( destName.length() -1);
668 } 668 }
669 669
670 QString curFile = thisDir->canonicalPath()+"/"+(*it); 670 QString curFile = thisDir->canonicalPath()+"/"+(*it);
671 671
672 if( curFile.right(1) == "/") { 672 if( curFile.right(1) == "/") {
673 curFile = curFile.left( curFile.length() -1); 673 curFile = curFile.left( curFile.length() -1);
674 } 674 }
675 675
676 cmd = "ln -s "+curFile+" "+destName; 676 cmd = "ln -s "+curFile+" "+destName;
677// odebug << cmd << oendl; 677// odebug << cmd << oendl;
678 startProcess( (const QString)cmd ); 678 startProcess( (const QString)cmd );
679 } 679 }
680 rePopulate(); 680 rePopulate();
681 setOtherTabCurrent(); 681 setOtherTabCurrent();
682 } 682 }
683} 683}
684 684
685void AdvancedFm::doBeam() { 685void AdvancedFm::doBeam() {
686 Ir ir; 686 Ir ir;
687 if(!ir.supported()) { 687 if(!ir.supported()) {
688 } else { 688 } else {
689 QStringList curFileList = getPath(); 689 QStringList curFileList = getPath();
690 if( curFileList.count() > 0) { 690 if( curFileList.count() > 0) {
691 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 691 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
692 QString curFile = (*it); 692 QString curFile = (*it);
693 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; 693 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile;
694 if( curFilePath.right(1) == "/") { 694 if( curFilePath.right(1) == "/") {
695 curFilePath = curFilePath.left( curFilePath.length() -1); 695 curFilePath = curFilePath.left( curFilePath.length() -1);
696 } 696 }
697 Ir *file = new Ir(this, "IR"); 697 Ir *file = new Ir(this, "IR");
698 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); 698 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*)));
699 file->send( curFilePath, curFile ); 699 file->send( curFilePath, curFile );
700 } 700 }
701 } 701 }
702 } 702 }
703} 703}
704 704
705void AdvancedFm::fileBeamFinished( Ir *) { 705void AdvancedFm::fileBeamFinished( Ir *) {
706 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 706 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
707} 707}
708 708
709void AdvancedFm::selectAll() { 709void AdvancedFm::selectAll() {
710 QListView *thisView = CurrentView(); 710 QListView *thisView = CurrentView();
711 thisView->selectAll(true); 711 thisView->selectAll(true);
712 thisView->setSelected( thisView->firstChild(),false); 712 thisView->setSelected( thisView->firstChild(),false);
713} 713}
714 714
715void AdvancedFm::startProcess(const QString & cmd) { 715void AdvancedFm::startProcess(const QString & cmd) {
716 QStringList command; 716 QStringList command;
717 OProcess *process; 717 OProcess *process;
718 process = new OProcess(); 718 process = new OProcess();
719 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), this, SLOT( processEnded(Opie::Core::OProcess*))); 719 connect(process,SIGNAL(processExited(Opie::Core::OProcess*)),this,SLOT(processEnded(Opie::Core::OProcess*)));
720 720 connect(process,SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),this,SLOT(oprocessStderr(Opie::Core::OProcess*,char*,int)));
721 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int)));
722 721
723 command << "/bin/sh"; 722 command << "/bin/sh";
724 command << "-c"; 723 command << "-c";
725 command << cmd.latin1(); 724 command << cmd.latin1();
726 *process << command; 725 *process << command;
727 if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) 726 if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
728 odebug << "could not start process" << oendl; 727 odebug << "could not start process" << oendl;
729} 728}
730 729
731void AdvancedFm::processEnded(OProcess *) { 730void AdvancedFm::processEnded(OProcess *) {
732 rePopulate(); 731 rePopulate();
733} 732}
734 733
735void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { 734void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
736// owarn << "received stderrt " << buflen << " bytes" << oendl; 735// owarn << "received stderrt " << buflen << " bytes" << oendl;
737 736
738 QString lineStr = buffer; 737 QString lineStr = buffer;
739 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); 738 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
740} 739}
741 740
742bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { 741bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
743 if ( o->inherits( "QLineEdit" ) ) { 742 if ( o->inherits( "QLineEdit" ) ) {
744 if ( e->type() == QEvent::KeyPress ) { 743 if ( e->type() == QEvent::KeyPress ) {
745 QKeyEvent *ke = (QKeyEvent*)e; 744 QKeyEvent *ke = (QKeyEvent*)e;
746 if ( ke->key() == Key_Return || 745 if ( ke->key() == Key_Return ||
747 ke->key() == Key_Enter ) { 746 ke->key() == Key_Enter ) {
748 okRename(); 747 okRename();
749 return true; 748 return true;
750 } 749 }
751 else if ( ke->key() == Key_Escape ) { 750 else if ( ke->key() == Key_Escape ) {
752 cancelRename(); 751 cancelRename();
753 return true; 752 return true;
754 } 753 }
755 } 754 }
756 else if ( e->type() == QEvent::FocusOut ) { 755 else if ( e->type() == QEvent::FocusOut ) {
757 cancelRename(); 756 cancelRename();
758 return true; 757 return true;
759 } 758 }
760 } 759 }
761/* if ( o->inherits( "QListView" ) ) { 760/* if ( o->inherits( "QListView" ) ) {
762 if ( e->type() == QEvent::FocusIn ) { 761 if ( e->type() == QEvent::FocusIn ) {
763// if( o == Local_View) { //keep track of which view 762// if( o == Local_View) { //keep track of which view
764 // qDebug("local view"); 763 // qDebug("local view");
765// whichTab = 1; 764// whichTab = 1;
766// } else { 765// } else {
767// whichTab = 2; 766// whichTab = 2;
768 // qDebug("remote view"); 767 // qDebug("remote view");
769// } 768// }
770 } 769 }
771 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection 770 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection
772 } 771 }
773*/ 772*/
774 return QWidget::eventFilter( o, e ); 773 return QWidget::eventFilter( o, e );
775} 774}
776 775
777 776
778void AdvancedFm::cancelRename() { 777void AdvancedFm::cancelRename() {
779// odebug << "cancel rename" << oendl; 778// odebug << "cancel rename" << oendl;
780 QListView * view; 779 QListView * view;
781 view = CurrentView(); 780 view = CurrentView();
782 781
783 bool resetFocus = view->viewport()->focusProxy() == renameBox; 782 bool resetFocus = view->viewport()->focusProxy() == renameBox;
784 delete renameBox; 783 delete renameBox;
785 renameBox = 0; 784 renameBox = 0;
786 if ( resetFocus ) { 785 if ( resetFocus ) {
787 view->viewport()->setFocusProxy( view); 786 view->viewport()->setFocusProxy( view);
788 view->setFocus(); 787 view->setFocus();
789 } 788 }
790} 789}
791 790
792void AdvancedFm::doRename(QListView * view) { 791void AdvancedFm::doRename(QListView * view) {
793 if( !CurrentView()->currentItem()) return; 792 if( !CurrentView()->currentItem()) return;
794 793
795 QRect r = view->itemRect( view->currentItem( )); 794 QRect r = view->itemRect( view->currentItem( ));
796 r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); 795 r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
797 r.setX( view->contentsX() ); 796 r.setX( view->contentsX() );
798 if ( r.width() > view->visibleWidth() ) 797 if ( r.width() > view->visibleWidth() )
799 r.setWidth( view->visibleWidth() ); 798 r.setWidth( view->visibleWidth() );
800 799
801 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); 800 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" );
802 renameBox->setFrame(true); 801 renameBox->setFrame(true);
803 renameBox->setText( view->currentItem()->text(0) ); 802 renameBox->setText( view->currentItem()->text(0) );
804 renameBox->selectAll(); 803 renameBox->selectAll();
805 renameBox->installEventFilter( this ); 804 renameBox->installEventFilter( this );
806 view->addChild( renameBox, r.x(), r.y() ); 805 view->addChild( renameBox, r.x(), r.y() );
807 renameBox->resize( r.size() ); 806 renameBox->resize( r.size() );
808 view->viewport()->setFocusProxy( renameBox ); 807 view->viewport()->setFocusProxy( renameBox );
809 renameBox->setFocus(); 808 renameBox->setFocus();
810 renameBox->show(); 809 renameBox->show();
811} 810}
812 811
813 812
814void AdvancedFm::renameIt() { 813void AdvancedFm::renameIt() {
815 if( !CurrentView()->currentItem()) return; 814 if( !CurrentView()->currentItem()) return;
816 815
817 QListView *thisView = CurrentView(); 816 QListView *thisView = CurrentView();
818 oldName = thisView->currentItem()->text(0); 817 oldName = thisView->currentItem()->text(0);
819 doRename( thisView ); 818 doRename( thisView );
820} 819}
821 820
822void AdvancedFm::okRename() { 821void AdvancedFm::okRename() {
823 qDebug("okrename"); 822 qDebug("okrename");
824 if( !renameBox) return; 823 if( !renameBox) return;
825 824
826 QString newName = renameBox->text(); 825 QString newName = renameBox->text();
827 cancelRename(); 826 cancelRename();
828 QListView * view = CurrentView(); 827 QListView * view = CurrentView();
829 QString path = CurrentDir()->canonicalPath() + "/"; 828 QString path = CurrentDir()->canonicalPath() + "/";
830 oldName = path + oldName; 829 oldName = path + oldName;
831 newName = path + newName; 830 newName = path + newName;
832 if( rename( oldName.latin1(), newName.latin1())== -1) 831 if( rename( oldName.latin1(), newName.latin1())== -1)
833 QMessageBox::message(tr("Note"),tr("Could not rename")); 832 QMessageBox::message(tr("Note"),tr("Could not rename"));
834 else 833 else
835 oldName = ""; 834 oldName = "";
836 QListViewItem *item = view->currentItem(); 835 QListViewItem *item = view->currentItem();
837 view->takeItem( item ); 836 view->takeItem( item );
838 delete item; 837 delete item;
839 rePopulate(); 838 rePopulate();
840} 839}
841 840
842void AdvancedFm::openSearch() { 841void AdvancedFm::openSearch() {
843 QMessageBox::message(tr("Note"),tr("Not Yet Implemented")); 842 QMessageBox::message(tr("Note"),tr("Not Yet Implemented"));
844} 843}