summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-02-24 03:53:24 (UTC)
committer llornkcor <llornkcor>2003-02-24 03:53:24 (UTC)
commit009b85e8daa341d4a2fc62404f4a58715e775b86 (patch) (unidiff)
tree754ec3b77412e22c90b1da7d68c609436189dcfd
parent04470810d71cc8aa3ddde193559312fd3ecc7a11 (diff)
downloadopie-009b85e8daa341d4a2fc62404f4a58715e775b86.zip
opie-009b85e8daa341d4a2fc62404f4a58715e775b86.tar.gz
opie-009b85e8daa341d4a2fc62404f4a58715e775b86.tar.bz2
whoops
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 062a013..f46503c 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -1,851 +1,851 @@
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/qpemenubar.h> 21#include <qpe/qpemenubar.h>
22#include <qpe/qpetoolbar.h> 22#include <qpe/qpetoolbar.h>
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25#include <qpe/applnk.h> 25#include <qpe/applnk.h>
26#include <qpe/ir.h> 26#include <qpe/ir.h>
27 27
28#include <qmessagebox.h> 28#include <qmessagebox.h>
29#include <qmultilineedit.h> 29#include <qmultilineedit.h>
30 30
31#include <qstring.h> 31#include <qstring.h>
32 32
33#include <qlayout.h> 33#include <qlayout.h>
34#include <qpixmap.h> 34#include <qpixmap.h>
35#include <qcombobox.h> 35#include <qcombobox.h>
36#include <qpopupmenu.h> 36#include <qpopupmenu.h>
37#include <qtabwidget.h> 37#include <qtabwidget.h>
38#include <qtoolbutton.h> 38#include <qtoolbutton.h>
39#include <qtabwidget.h> 39#include <qtabwidget.h>
40#include <qlineedit.h> 40#include <qlineedit.h>
41#include <qlistview.h> 41#include <qlistview.h>
42 42
43#include <stdlib.h> 43#include <stdlib.h>
44#include <unistd.h> 44#include <unistd.h>
45#include <sys/stat.h> 45#include <sys/stat.h>
46#include <dirent.h> 46#include <dirent.h>
47 47
48 48
49void AdvancedFm::doDirChange() 49void AdvancedFm::doDirChange()
50{ 50{
51 ListClicked( CurrentView()->currentItem()); 51 ListClicked( CurrentView()->currentItem());
52} 52}
53 53
54void AdvancedFm::showMenuHidden() 54void AdvancedFm::showMenuHidden()
55{ 55{
56 if (b) 56 if (b)
57 { 57 {
58 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 58 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
59 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 59 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
60 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 60 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
61// b=FALSE; 61// b=FALSE;
62 62
63 } 63 }
64 else 64 else
65 { 65 {
66 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 66 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
67 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 67 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
68 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 68 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
69// b=TRUE; 69// b=TRUE;
70 } 70 }
71 populateView(); 71 populateView();
72// populateRemoteView(); 72// populateRemoteView();
73// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); 73// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true");
74 if(b) b = false; else b = true; 74 if(b) b = false; else b = true;
75} 75}
76 76
77void AdvancedFm::showHidden() 77void AdvancedFm::showHidden()
78{ 78{
79 if (b) 79 if (b)
80 { 80 {
81 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 81 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
82 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 82 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
83// fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 83// fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
84// b=FALSE; 84// b=FALSE;
85 85
86 } 86 }
87 else 87 else
88 { 88 {
89 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 89 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
90 s OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 90 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
91// fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 91// fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
92// b=TRUE; 92// b=TRUE;
93 } 93 }
94 populateView(); 94 populateView();
95} 95}
96 96
97QString AdvancedFm::dealWithSymName(const QString &fileName) 97QString AdvancedFm::dealWithSymName(const QString &fileName)
98{ 98{
99 QString strItem = fileName; 99 QString strItem = fileName;
100 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 100 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
101} 101}
102 102
103void AdvancedFm::runThis() 103void AdvancedFm::runThis()
104{ 104{
105 QString fs; 105 QString fs;
106 QDir *thisDir = CurrentDir(); 106 QDir *thisDir = CurrentDir();
107 107
108 QString curFile = CurrentView()->currentItem()->text(0); 108 QString curFile = CurrentView()->currentItem()->text(0);
109 QString path = thisDir->canonicalPath(); 109 QString path = thisDir->canonicalPath();
110 110
111 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink 111 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
112 112
113 curFile = dealWithSymName((const QString&)curFile); 113 curFile = dealWithSymName((const QString&)curFile);
114 114
115 if(curFile != "../") 115 if(curFile != "../")
116 { 116 {
117 117
118 fs = getFileSystemType((const QString &) path); 118 fs = getFileSystemType((const QString &) path);
119 QFileInfo fileInfo( path + "/" + curFile); 119 QFileInfo fileInfo( path + "/" + curFile);
120 qDebug( fileInfo.owner()); 120 qDebug( fileInfo.owner());
121 121
122 if( (fileInfo.permission( QFileInfo::ExeUser) 122 if( (fileInfo.permission( QFileInfo::ExeUser)
123 | fileInfo.permission( QFileInfo::ExeGroup) 123 | fileInfo.permission( QFileInfo::ExeGroup)
124 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 124 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
125 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 125 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
126 QCopEnvelope e("QPE/System", "execute(QString)" ); 126 QCopEnvelope e("QPE/System", "execute(QString)" );
127 e << curFile; 127 e << curFile;
128 } 128 }
129 else 129 else
130 { 130 {
131 curFile = path + "/" + curFile; 131 curFile = path + "/" + curFile;
132 DocLnk nf(curFile); 132 DocLnk nf(curFile);
133 QString execStr = nf.exec(); 133 QString execStr = nf.exec();
134 qDebug( execStr); 134 qDebug( execStr);
135 if( execStr.isEmpty() ) 135 if( execStr.isEmpty() )
136 { 136 {
137 } 137 }
138 else 138 else
139 { 139 {
140 nf.execute(); 140 nf.execute();
141 } 141 }
142 } 142 }
143 } 143 }
144} 144}
145 145
146void AdvancedFm::runText() 146void AdvancedFm::runText()
147{ 147{
148 QString curFile = CurrentView()->currentItem()->text(0); 148 QString curFile = CurrentView()->currentItem()->text(0);
149 if(curFile != "../") 149 if(curFile != "../")
150 { 150 {
151 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink 151 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
152 curFile = dealWithSymName((const QString&)curFile); 152 curFile = dealWithSymName((const QString&)curFile);
153 curFile = CurrentDir()->canonicalPath()+"/"+curFile; 153 curFile = CurrentDir()->canonicalPath()+"/"+curFile;
154 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 154 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
155 e << curFile; 155 e << curFile;
156 } 156 }
157} 157}
158 158
159void AdvancedFm::makeDir() 159void AdvancedFm::makeDir()
160{ 160{
161 InputDialog *fileDlg; 161 InputDialog *fileDlg;
162 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 162 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
163 fileDlg->exec(); 163 fileDlg->exec();
164 if( fileDlg->result() == 1 ) 164 if( fileDlg->result() == 1 )
165 { 165 {
166 QDir *thisDir = CurrentDir(); 166 QDir *thisDir = CurrentDir();
167 QString filename = fileDlg->LineEdit1->text(); 167 QString filename = fileDlg->LineEdit1->text();
168 thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); 168 thisDir->mkdir( thisDir->canonicalPath()+"/"+filename);
169 } 169 }
170 populateView(); 170 populateView();
171} 171}
172 172
173void AdvancedFm::doDelete() 173void AdvancedFm::doDelete()
174{ 174{
175 175
176 QStringList curFileList = getPath(); 176 QStringList curFileList = getPath();
177 bool doMsg=true; 177 bool doMsg=true;
178 int count = curFileList.count(); 178 int count = curFileList.count();
179 if( count > 0) 179 if( count > 0)
180 { 180 {
181 if(count > 1 ) 181 if(count > 1 )
182 { 182 {
183 QString msg; 183 QString msg;
184 msg=tr("Really delete\n%1 files?").arg(count); 184 msg=tr("Really delete\n%1 files?").arg(count);
185 switch ( QMessageBox::warning(this,tr("Delete"),msg 185 switch ( QMessageBox::warning(this,tr("Delete"),msg
186 ,tr("Yes"),tr("No"),0,0,1) ) 186 ,tr("Yes"),tr("No"),0,0,1) )
187 { 187 {
188 case 0: 188 case 0:
189 doMsg=false; 189 doMsg=false;
190 break; 190 break;
191 case 1: 191 case 1:
192 return; 192 return;
193 break; 193 break;
194 }; 194 };
195 } 195 }
196 196
197 QString myFile; 197 QString myFile;
198 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 198 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
199 { 199 {
200 myFile = (*it); 200 myFile = (*it);
201 if( myFile.find(" -> ",0,TRUE) != -1) 201 if( myFile.find(" -> ",0,TRUE) != -1)
202 myFile = myFile.left( myFile.find(" -> ",0,TRUE)); 202 myFile = myFile.left( myFile.find(" -> ",0,TRUE));
203 203
204 QString f = CurrentDir()->canonicalPath(); 204 QString f = CurrentDir()->canonicalPath();
205 if(f.right(1).find("/",0,TRUE) == -1) 205 if(f.right(1).find("/",0,TRUE) == -1)
206 f += "/"; 206 f += "/";
207 f += myFile; 207 f += myFile;
208 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) 208 if(QDir(f).exists() && !QFileInfo(f).isSymLink() )
209 { 209 {
210 switch ( QMessageBox::warning( this, tr("Delete Directory?"), tr("Really delete\n") + f + 210 switch ( QMessageBox::warning( this, tr("Delete Directory?"), tr("Really delete\n") + f +
211 "\nand all it's contents ?" 211 "\nand all it's contents ?"
212 ,tr("Yes"),tr("No"),0,0,1) ) 212 ,tr("Yes"),tr("No"),0,0,1) )
213 { 213 {
214 case 0: 214 case 0:
215 { 215 {
216 f=f.left(f.length()-1); 216 f=f.left(f.length()-1);
217 QString cmd="rm -rf "+f; 217 QString cmd="rm -rf "+f;
218 startProcess( (const QString)cmd.latin1() ); 218 startProcess( (const QString)cmd.latin1() );
219 populateView(); 219 populateView();
220 } 220 }
221 break; 221 break;
222 case 1: 222 case 1:
223 // exit 223 // exit
224 break; 224 break;
225 }; 225 };
226 226
227 } else { 227 } else {
228 if(doMsg) { 228 if(doMsg) {
229 switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f 229 switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f
230 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 230 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
231 case 1: 231 case 1:
232 return; 232 return;
233 break; 233 break;
234 }; 234 };
235 } 235 }
236 QString cmd="rm "+f; 236 QString cmd="rm "+f;
237 QFile file(f); 237 QFile file(f);
238 if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) 238 if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1)
239 file.remove(); 239 file.remove();
240 } 240 }
241 } 241 }
242 } 242 }
243 populateView(); 243 populateView();
244} 244}
245 245
246void AdvancedFm::filePerms() 246void AdvancedFm::filePerms()
247{ 247{
248 QStringList curFileList = getPath(); 248 QStringList curFileList = getPath();
249 QString filePath; 249 QString filePath;
250 250
251 filePath = CurrentDir()->canonicalPath()+"/"; 251 filePath = CurrentDir()->canonicalPath()+"/";
252 252
253 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 253 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
254 { 254 {
255 filePermissions *filePerm; 255 filePermissions *filePerm;
256 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 256 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
257 filePerm->showMaximized(); 257 filePerm->showMaximized();
258 filePerm->exec(); 258 filePerm->exec();
259 if( filePerm) 259 if( filePerm)
260 delete filePerm; 260 delete filePerm;
261 } 261 }
262 populateView(); 262 populateView();
263} 263}
264 264
265void AdvancedFm::doProperties() 265void AdvancedFm::doProperties()
266{ 266{
267#if defined(QT_QWS_OPIE) 267#if defined(QT_QWS_OPIE)
268 268
269 QStringList curFileList = getPath(); 269 QStringList curFileList = getPath();
270 270
271 QString filePath; 271 QString filePath;
272 filePath = CurrentDir()->canonicalPath()+"/"; 272 filePath = CurrentDir()->canonicalPath()+"/";
273 273
274 qDebug("%d",curFileList.count()); 274 qDebug("%d",curFileList.count());
275 275
276 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 276 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
277 { 277 {
278 qDebug((filePath+*it)); 278 qDebug((filePath+*it));
279 DocLnk lnk( (filePath+*it)); 279 DocLnk lnk( (filePath+*it));
280 LnkProperties prop( &lnk ); 280 LnkProperties prop( &lnk );
281 prop.showMaximized(); 281 prop.showMaximized();
282 prop.exec(); 282 prop.exec();
283 } 283 }
284#endif 284#endif
285 285
286} 286}
287 287
288void AdvancedFm::upDir() 288void AdvancedFm::upDir()
289{ 289{
290 QDir *thisDir = CurrentDir(); 290 QDir *thisDir = CurrentDir();
291 QString current = thisDir->canonicalPath(); 291 QString current = thisDir->canonicalPath();
292 QDir dir(current); 292 QDir dir(current);
293 dir.cdUp(); 293 dir.cdUp();
294 current = dir.canonicalPath(); 294 current = dir.canonicalPath();
295 chdir( current.latin1() ); 295 chdir( current.latin1() );
296 thisDir->cd( current, TRUE); 296 thisDir->cd( current, TRUE);
297 297
298 populateView(); 298 populateView();
299 update(); 299 update();
300} 300}
301 301
302void AdvancedFm::copy() 302void AdvancedFm::copy()
303{ 303{
304 qApp->processEvents(); 304 qApp->processEvents();
305 QStringList curFileList = getPath(); 305 QStringList curFileList = getPath();
306 306
307 QDir *thisDir = CurrentDir(); 307 QDir *thisDir = CurrentDir();
308 QDir *thatDir = OtherDir(); 308 QDir *thatDir = OtherDir();
309 309
310 bool doMsg=true; 310 bool doMsg=true;
311 int count=curFileList.count(); 311 int count=curFileList.count();
312 if( count > 0) { 312 if( count > 0) {
313 if(count > 1 ){ 313 if(count > 1 ){
314 QString msg; 314 QString msg;
315 msg=tr("Really copy\n%1 files?").arg(count); 315 msg=tr("Really copy\n%1 files?").arg(count);
316 switch ( QMessageBox::warning(this,tr("Delete"),msg 316 switch ( QMessageBox::warning(this,tr("Delete"),msg
317 ,tr("Yes"),tr("No"),0,0,1) ) 317 ,tr("Yes"),tr("No"),0,0,1) )
318 { 318 {
319 case 0: 319 case 0:
320 doMsg=false; 320 doMsg=false;
321 break; 321 break;
322 case 1: 322 case 1:
323 return; 323 return;
324 break; 324 break;
325 }; 325 };
326 } 326 }
327 327
328 QString curFile, item, destFile; 328 QString curFile, item, destFile;
329 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 329 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
330 { 330 {
331 item=(*it); 331 item=(*it);
332 if(item.find("->",0,TRUE)) //symlink 332 if(item.find("->",0,TRUE)) //symlink
333 item = item.left(item.find("->",0,TRUE)); 333 item = item.left(item.find("->",0,TRUE));
334 334
335 curFile = thisDir->canonicalPath()+"/"+ item; 335 curFile = thisDir->canonicalPath()+"/"+ item;
336 destFile = thatDir->canonicalPath()+"/"+ item; 336 destFile = thatDir->canonicalPath()+"/"+ item;
337 337
338 qDebug("Destination file is "+destFile); 338 qDebug("Destination file is "+destFile);
339 qDebug("CurrentFile file is " + curFile); 339 qDebug("CurrentFile file is " + curFile);
340 340
341 QFile f(destFile); 341 QFile f(destFile);
342 if( f.exists()) 342 if( f.exists())
343 { 343 {
344 if(doMsg) 344 if(doMsg)
345 { 345 {
346 switch ( QMessageBox::warning(this,tr("File Exists!"), 346 switch ( QMessageBox::warning(this,tr("File Exists!"),
347 tr("%1 exists. Ok to overwrite?").arg( item ), 347 tr("%1 exists. Ok to overwrite?").arg( item ),
348 tr("Yes"),tr("No"),0,0,1) ) 348 tr("Yes"),tr("No"),0,0,1) )
349 { 349 {
350 case 1: 350 case 1:
351 return; 351 return;
352 break; 352 break;
353 }; 353 };
354 } 354 }
355 f.remove(); 355 f.remove();
356 } 356 }
357 357
358 if( !copyFile( curFile, destFile) ) 358 if( !copyFile( curFile, destFile) )
359 { 359 {
360 QMessageBox::message("AdvancedFm", 360 QMessageBox::message("AdvancedFm",
361 tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) ); 361 tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) );
362 return; 362 return;
363 } 363 }
364 } 364 }
365 setOtherTabCurrent(); 365 setOtherTabCurrent();
366 populateView(); 366 populateView();
367 } 367 }
368} 368}
369 369
370void AdvancedFm::copyAs() 370void AdvancedFm::copyAs()
371{ 371{
372 qApp->processEvents(); 372 qApp->processEvents();
373 373
374 QStringList curFileList = getPath(); 374 QStringList curFileList = getPath();
375 QString curFile, item; 375 QString curFile, item;
376 InputDialog *fileDlg; 376 InputDialog *fileDlg;
377 377
378 QDir *thisDir = CurrentDir(); 378 QDir *thisDir = CurrentDir();
379 QDir *thatDir = OtherDir(); 379 QDir *thatDir = OtherDir();
380 380
381 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 381 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
382 { 382 {
383 QString destFile; 383 QString destFile;
384 item=(*it); 384 item=(*it);
385 curFile = thisDir->canonicalPath()+"/"+(*it); 385 curFile = thisDir->canonicalPath()+"/"+(*it);
386 fileDlg = new InputDialog( this, tr("Copy "+curFile+" As"), TRUE, 0); 386 fileDlg = new InputDialog( this, tr("Copy "+curFile+" As"), TRUE, 0);
387 387
388 fileDlg->setInputText((const QString &) destFile ); 388 fileDlg->setInputText((const QString &) destFile );
389 fileDlg->exec(); 389 fileDlg->exec();
390 390
391 if( fileDlg->result() == 1 ) 391 if( fileDlg->result() == 1 )
392 { 392 {
393 QString filename = fileDlg->LineEdit1->text(); 393 QString filename = fileDlg->LineEdit1->text();
394 destFile = thatDir->canonicalPath()+"/"+filename; 394 destFile = thatDir->canonicalPath()+"/"+filename;
395 395
396 QFile f( destFile); 396 QFile f( destFile);
397 if( f.exists()) 397 if( f.exists())
398 { 398 {
399 switch (QMessageBox::warning(this,tr("File Exists!"), 399 switch (QMessageBox::warning(this,tr("File Exists!"),
400 item+tr("\nexists. Ok to overwrite?"), 400 item+tr("\nexists. Ok to overwrite?"),
401 tr("Yes"),tr("No"),0,0,1) ) 401 tr("Yes"),tr("No"),0,0,1) )
402 { 402 {
403 case 0: 403 case 0:
404 f.remove(); 404 f.remove();
405 break; 405 break;
406 case 1: 406 case 1:
407 return; 407 return;
408 break; 408 break;
409 }; 409 };
410 } 410 }
411 if( !copyFile( curFile, destFile) ) 411 if( !copyFile( curFile, destFile) )
412 { 412 {
413 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 413 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
414 +curFile +tr("to\n")+destFile); 414 +curFile +tr("to\n")+destFile);
415 return; 415 return;
416 } 416 }
417 } 417 }
418 delete fileDlg; 418 delete fileDlg;
419 419
420 } 420 }
421 setOtherTabCurrent(); 421 setOtherTabCurrent();
422 populateView(); 422 populateView();
423} 423}
424 424
425void AdvancedFm::copySameDir() 425void AdvancedFm::copySameDir()
426{ 426{
427 qApp->processEvents(); 427 qApp->processEvents();
428 QStringList curFileList = getPath(); 428 QStringList curFileList = getPath();
429 QString curFile, item, destFile; 429 QString curFile, item, destFile;
430 InputDialog *fileDlg; 430 InputDialog *fileDlg;
431 431
432 QDir *thisDir = CurrentDir(); 432 QDir *thisDir = CurrentDir();
433 433
434 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 434 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
435 { 435 {
436 item=(*it); 436 item=(*it);
437 curFile = thisDir->canonicalPath()+"/"+ item; 437 curFile = thisDir->canonicalPath()+"/"+ item;
438 438
439 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); 439 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0);
440 fileDlg->setInputText((const QString &) destFile ); 440 fileDlg->setInputText((const QString &) destFile );
441 fileDlg->exec(); 441 fileDlg->exec();
442 442
443 if( fileDlg->result() == 1 ) 443 if( fileDlg->result() == 1 )
444 { 444 {
445 445
446 QString filename = fileDlg->LineEdit1->text(); 446 QString filename = fileDlg->LineEdit1->text();
447 destFile = thisDir->canonicalPath()+"/"+filename; 447 destFile = thisDir->canonicalPath()+"/"+filename;
448 448
449 QFile f(destFile); 449 QFile f(destFile);
450 if( f.exists()) 450 if( f.exists())
451 { 451 {
452 switch (QMessageBox::warning(this,tr("Delete"), 452 switch (QMessageBox::warning(this,tr("Delete"),
453 destFile+tr(" already exists.\nDo you really want to delete it?"), 453 destFile+tr(" already exists.\nDo you really want to delete it?"),
454 tr("Yes"),tr("No"),0,0,1) ) { 454 tr("Yes"),tr("No"),0,0,1) ) {
455 case 0: 455 case 0:
456 456
457 f.remove(); 457 f.remove();
458 break; 458 break;
459 case 1: 459 case 1:
460 return; 460 return;
461 break; 461 break;
462 }; 462 };
463 } 463 }
464 if(!copyFile( curFile,destFile) ) 464 if(!copyFile( curFile,destFile) )
465 { 465 {
466 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 466 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
467 +curFile +tr("to\n")+destFile); 467 +curFile +tr("to\n")+destFile);
468 return; 468 return;
469 } 469 }
470 470
471 qDebug("copy "+curFile+" as "+destFile); 471 qDebug("copy "+curFile+" as "+destFile);
472 } 472 }
473 delete fileDlg; 473 delete fileDlg;
474 } 474 }
475 populateView(); 475 populateView();
476} 476}
477 477
478void AdvancedFm::move() 478void AdvancedFm::move()
479{ 479{
480 qApp->processEvents(); 480 qApp->processEvents();
481 481
482 QStringList curFileList = getPath(); 482 QStringList curFileList = getPath();
483 if( curFileList.count() > 0) 483 if( curFileList.count() > 0)
484 { 484 {
485 QString curFile, destFile, item; 485 QString curFile, destFile, item;
486 486
487 QDir *thisDir = CurrentDir(); 487 QDir *thisDir = CurrentDir();
488 QDir *thatDir = OtherDir(); 488 QDir *thatDir = OtherDir();
489 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 489 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
490 { 490 {
491 item=(*it); 491 item=(*it);
492 QString destFile = thatDir->canonicalPath(); 492 QString destFile = thatDir->canonicalPath();
493 493
494 if(destFile.right(1).find("/",0,TRUE) == -1) 494 if(destFile.right(1).find("/",0,TRUE) == -1)
495 destFile+="/"; 495 destFile+="/";
496 destFile += item; 496 destFile += item;
497 qDebug("Destination file is "+destFile); 497 qDebug("Destination file is "+destFile);
498 498
499 curFile = thisDir->canonicalPath(); 499 curFile = thisDir->canonicalPath();
500 if(curFile.right(1).find("/",0,TRUE) == -1) 500 if(curFile.right(1).find("/",0,TRUE) == -1)
501 curFile +="/"; 501 curFile +="/";
502 curFile+= item; 502 curFile+= item;
503 qDebug("CurrentFile file is " + curFile); 503 qDebug("CurrentFile file is " + curFile);
504 504
505 QFile f( curFile); 505 QFile f( curFile);
506 if( f.exists()) { 506 if( f.exists()) {
507 if( !copyFile( curFile, destFile) ) 507 if( !copyFile( curFile, destFile) )
508 { 508 {
509 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); 509 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile);
510 return; 510 return;
511 } else 511 } else
512 QFile::remove(curFile); 512 QFile::remove(curFile);
513 } 513 }
514 } 514 }
515 515
516 } 516 }
517 setOtherTabCurrent(); 517 setOtherTabCurrent();
518 populateView(); 518 populateView();
519 // populateLocalView(); 519 // populateLocalView();
520} 520}
521 521
522bool AdvancedFm::copyFile( const QString & src, const QString & dest ) 522bool AdvancedFm::copyFile( const QString & src, const QString & dest )
523{ 523{
524 char bf[ 50000 ]; 524 char bf[ 50000 ];
525 int bytesRead; 525 int bytesRead;
526 bool success = TRUE; 526 bool success = TRUE;
527 struct stat status; 527 struct stat status;
528 528
529 QFile s( src ); 529 QFile s( src );
530 QFile d( dest ); 530 QFile d( dest );
531 531
532 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) 532 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) )
533 { 533 {
534 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) 534 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) )
535 { 535 {
536 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ 536 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){
537 success = FALSE; 537 success = FALSE;
538 break; 538 break;
539 } 539 }
540 } 540 }
541 if( success && (bytesRead > 0) ) 541 if( success && (bytesRead > 0) )
542 { 542 {
543 d.writeBlock( bf, bytesRead ); 543 d.writeBlock( bf, bytesRead );
544 } 544 }
545 } 545 }
546 else 546 else
547 { 547 {
548 success = FALSE; 548 success = FALSE;
549 } 549 }
550 550
551 // Set file permissions 551 // Set file permissions
552 if( stat( (const char *) src, &status ) == 0 ) 552 if( stat( (const char *) src, &status ) == 0 )
553 { 553 {
554 chmod( (const char *) dest, status.st_mode ); 554 chmod( (const char *) dest, status.st_mode );
555 } 555 }
556 556
557 return success; 557 return success;
558} 558}
559 559
560void AdvancedFm::runCommand() 560void AdvancedFm::runCommand()
561{ 561{
562 QDir *thisDir = CurrentDir(); 562 QDir *thisDir = CurrentDir();
563 563
564 QString curFile; 564 QString curFile;
565 curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); 565 curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0);
566 566
567 InputDialog *fileDlg; 567 InputDialog *fileDlg;
568 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 568 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
569 fileDlg->setInputText(curFile); 569 fileDlg->setInputText(curFile);
570 fileDlg->exec(); 570 fileDlg->exec();
571 //QString command; 571 //QString command;
572 572
573 if( fileDlg->result() == 1 ) 573 if( fileDlg->result() == 1 )
574 { 574 {
575 qDebug(fileDlg->LineEdit1->text()); 575 qDebug(fileDlg->LineEdit1->text());
576 QStringList command; 576 QStringList command;
577 577
578 command << "/bin/sh"; 578 command << "/bin/sh";
579 command << "-c"; 579 command << "-c";
580 command << fileDlg->LineEdit1->text(); 580 command << fileDlg->LineEdit1->text();
581 Output *outDlg; 581 Output *outDlg;
582 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 582 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
583 outDlg->showMaximized(); 583 outDlg->showMaximized();
584 outDlg->exec(); 584 outDlg->exec();
585 qApp->processEvents(); 585 qApp->processEvents();
586 586
587 } 587 }
588} 588}
589 589
590void AdvancedFm::runCommandStd() 590void AdvancedFm::runCommandStd()
591{ 591{
592 QString curFile; 592 QString curFile;
593 QDir *thisDir = CurrentDir(); 593 QDir *thisDir = CurrentDir();
594 QListView *thisView = CurrentView(); 594 QListView *thisView = CurrentView();
595 if( thisView->currentItem()) 595 if( thisView->currentItem())
596 curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); 596 curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0);
597 597
598 InputDialog *fileDlg; 598 InputDialog *fileDlg;
599 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 599 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
600 fileDlg->setInputText(curFile); 600 fileDlg->setInputText(curFile);
601 fileDlg->exec(); 601 fileDlg->exec();
602 602
603 if( fileDlg->result() == 1 ) 603 if( fileDlg->result() == 1 )
604 { 604 {
605 qApp->processEvents(); 605 qApp->processEvents();
606 startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); 606 startProcess( (const QString)fileDlg->LineEdit1->text().latin1());
607 } 607 }
608} 608}
609 609
610void AdvancedFm::fileStatus() 610void AdvancedFm::fileStatus()
611{ 611{
612 QString curFile; 612 QString curFile;
613 curFile = CurrentView()->currentItem()->text(0); 613 curFile = CurrentView()->currentItem()->text(0);
614 614
615 QStringList command; 615 QStringList command;
616 command << "/bin/sh"; 616 command << "/bin/sh";
617 command << "-c"; 617 command << "-c";
618 command << "stat -l "+ curFile; 618 command << "stat -l "+ curFile;
619 619
620 Output *outDlg; 620 Output *outDlg;
621 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 621 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
622 outDlg->showMaximized(); 622 outDlg->showMaximized();
623 outDlg->exec(); 623 outDlg->exec();
624 qApp->processEvents(); 624 qApp->processEvents();
625} 625}
626 626
627 627
628void AdvancedFm::mkDir() 628void AdvancedFm::mkDir()
629{ 629{
630 makeDir(); 630 makeDir();
631} 631}
632 632
633void AdvancedFm::rn() 633void AdvancedFm::rn()
634{ 634{
635 renameIt(); 635 renameIt();
636} 636}
637 637
638void AdvancedFm::del() 638void AdvancedFm::del()
639{ 639{
640 doDelete(); 640 doDelete();
641} 641}
642 642
643void AdvancedFm::mkSym() 643void AdvancedFm::mkSym()
644{ 644{
645 QString cmd; 645 QString cmd;
646 QStringList curFileList = getPath(); 646 QStringList curFileList = getPath();
647 if( curFileList.count() > 0) 647 if( curFileList.count() > 0)
648 { 648 {
649 QDir *thisDir = CurrentDir(); 649 QDir *thisDir = CurrentDir();
650 QDir * thatDir = OtherDir(); 650 QDir * thatDir = OtherDir();
651 651
652 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 652 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
653 { 653 {
654 654
655 QString destName = thatDir->canonicalPath()+"/"+(*it); 655 QString destName = thatDir->canonicalPath()+"/"+(*it);
656 if(destName.right(1) == "/") 656 if(destName.right(1) == "/")
657 { 657 {
658 destName = destName.left( destName.length() -1); 658 destName = destName.left( destName.length() -1);
659 } 659 }
660 660
661 QString curFile = thisDir->canonicalPath()+"/"+(*it); 661 QString curFile = thisDir->canonicalPath()+"/"+(*it);
662 662
663 if( curFile.right(1) == "/") 663 if( curFile.right(1) == "/")
664 { 664 {
665 curFile = curFile.left( curFile.length() -1); 665 curFile = curFile.left( curFile.length() -1);
666 } 666 }
667 667
668 cmd = "ln -s "+curFile+" "+destName; 668 cmd = "ln -s "+curFile+" "+destName;
669 qDebug(cmd); 669 qDebug(cmd);
670 startProcess( (const QString)cmd ); 670 startProcess( (const QString)cmd );
671 } 671 }
672 setOtherTabCurrent(); 672 setOtherTabCurrent();
673 populateView(); 673 populateView();
674 } 674 }
675} 675}
676 676
677void AdvancedFm::doBeam() 677void AdvancedFm::doBeam()
678{ 678{
679 Ir ir; 679 Ir ir;
680 if(!ir.supported()) 680 if(!ir.supported())
681 { 681 {
682 } 682 }
683 else 683 else
684 { 684 {
685 QStringList curFileList = getPath(); 685 QStringList curFileList = getPath();
686 if( curFileList.count() > 0) 686 if( curFileList.count() > 0)
687 { 687 {
688 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 688 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
689 { 689 {
690 690
691 QString curFile = CurrentDir()->canonicalPath()+"/"+(*it); 691 QString curFile = CurrentDir()->canonicalPath()+"/"+(*it);
692 if( curFile.right(1) == "/") 692 if( curFile.right(1) == "/")
693 { 693 {
694 curFile = curFile.left( curFile.length() -1); 694 curFile = curFile.left( curFile.length() -1);
695 } 695 }
696 Ir *file = new Ir(this, "IR"); 696 Ir *file = new Ir(this, "IR");
697 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 697 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
698 file->send( curFile, curFile ); 698 file->send( curFile, curFile );
699 } 699 }
700 } 700 }
701 } 701 }
702 702
703} 703}
704 704
705void AdvancedFm::fileBeamFinished( Ir *) 705void AdvancedFm::fileBeamFinished( Ir *)
706{ 706{
707 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 707 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
708} 708}
709 709
710void AdvancedFm::selectAll() 710void AdvancedFm::selectAll()
711{ 711{
712// if (TabWidget->getCurrentTab() == 0) { 712// if (TabWidget->getCurrentTab() == 0) {
713 QListView *thisView = CurrentView(); 713 QListView *thisView = CurrentView();
714 thisView->selectAll(true); 714 thisView->selectAll(true);
715 thisView->setSelected( thisView->firstChild(),false); 715 thisView->setSelected( thisView->firstChild(),false);
716// } else { 716// } else {
717// Remote_View->selectAll(true); 717// Remote_View->selectAll(true);
718// Remote_View->setSelected( Remote_View->firstChild(),false); 718// Remote_View->setSelected( Remote_View->firstChild(),false);
719// } 719// }
720} 720}
721 721
722void AdvancedFm::startProcess(const QString & cmd) 722void AdvancedFm::startProcess(const QString & cmd)
723{ 723{
724 QStringList command; 724 QStringList command;
725 OProcess *process; 725 OProcess *process;
726 process = new OProcess(); 726 process = new OProcess();
727 connect(process, SIGNAL(processExited(OProcess *)), 727 connect(process, SIGNAL(processExited(OProcess *)),
728 this, SLOT( processEnded())); 728 this, SLOT( processEnded()));
729 729
730 command << "/bin/sh"; 730 command << "/bin/sh";
731 command << "-c"; 731 command << "-c";
732 command << cmd.latin1(); 732 command << cmd.latin1();
733 *process << command; 733 *process << command;
734 if(!process->start(OProcess::NotifyOnExit) ) 734 if(!process->start(OProcess::NotifyOnExit) )
735 qDebug("could not start process"); 735 qDebug("could not start process");
736} 736}
737 737
738void AdvancedFm::processEnded() 738void AdvancedFm::processEnded()
739{ 739{
740// populateLocalView(); 740// populateLocalView();
741 populateView(); 741 populateView();
742} 742}
743 743
744bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) 744bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
745{ 745{
746 if ( o->inherits( "QLineEdit" ) ) 746 if ( o->inherits( "QLineEdit" ) )
747 { 747 {
748 if ( e->type() == QEvent::KeyPress ) 748 if ( e->type() == QEvent::KeyPress )
749 { 749 {
750 QKeyEvent *ke = (QKeyEvent*)e; 750 QKeyEvent *ke = (QKeyEvent*)e;
751 if ( ke->key() == Key_Return || 751 if ( ke->key() == Key_Return ||
752 ke->key() == Key_Enter ) 752 ke->key() == Key_Enter )
753 { 753 {
754 okRename(); 754 okRename();
755 return true; 755 return true;
756 } 756 }
757 else if ( ke->key() == Key_Escape ) 757 else if ( ke->key() == Key_Escape )
758 { 758 {
759 cancelRename(); 759 cancelRename();
760 return true; 760 return true;
761 } 761 }
762 } 762 }
763 else if ( e->type() == QEvent::FocusOut ) 763 else if ( e->type() == QEvent::FocusOut )
764 { 764 {
765 cancelRename(); 765 cancelRename();
766 return true; 766 return true;
767 } 767 }
768 } 768 }
769 if ( o->inherits( "QListView" ) ) 769 if ( o->inherits( "QListView" ) )
770 { 770 {
771 if ( e->type() == QEvent::FocusOut ) 771 if ( e->type() == QEvent::FocusOut )
772 { 772 {
773 printf("focusIn\n"); 773 printf("focusIn\n");
774 774
775 } 775 }
776 } 776 }
777 777
778 return QWidget::eventFilter( o, e ); 778 return QWidget::eventFilter( o, e );
779} 779}
780 780
781 781
782void AdvancedFm::cancelRename() 782void AdvancedFm::cancelRename()
783{ 783{
784 qDebug("cancel rename"); 784 qDebug("cancel rename");
785 QListView * view; 785 QListView * view;
786 view = CurrentView(); 786 view = CurrentView();
787 787
788 bool resetFocus = view->viewport()->focusProxy() == renameBox; 788 bool resetFocus = view->viewport()->focusProxy() == renameBox;
789 delete renameBox; 789 delete renameBox;
790 renameBox = 0; 790 renameBox = 0;
791 if ( resetFocus ) 791 if ( resetFocus )
792 { 792 {
793 view->viewport()->setFocusProxy( view); 793 view->viewport()->setFocusProxy( view);
794 view->setFocus(); 794 view->setFocus();
795 } 795 }
796} 796}
797 797
798void AdvancedFm::doRename(QListView * view) 798void AdvancedFm::doRename(QListView * view)
799{ 799{
800 800
801 QRect r = view->itemRect( view->currentItem( )); 801 QRect r = view->itemRect( view->currentItem( ));
802 r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); 802 r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
803 r.setX( view->contentsX() ); 803 r.setX( view->contentsX() );
804 if ( r.width() > view->visibleWidth() ) 804 if ( r.width() > view->visibleWidth() )
805 r.setWidth( view->visibleWidth() ); 805 r.setWidth( view->visibleWidth() );
806 806
807 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); 807 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" );
808 renameBox->setFrame(true); 808 renameBox->setFrame(true);
809 809
810 renameBox->setText( view->currentItem()->text(0) ); 810 renameBox->setText( view->currentItem()->text(0) );
811 811
812 renameBox->selectAll(); 812 renameBox->selectAll();
813 renameBox->installEventFilter( this ); 813 renameBox->installEventFilter( this );
814 view->addChild( renameBox, r.x(), r.y() ); 814 view->addChild( renameBox, r.x(), r.y() );
815 renameBox->resize( r.size() ); 815 renameBox->resize( r.size() );
816 view->viewport()->setFocusProxy( renameBox ); 816 view->viewport()->setFocusProxy( renameBox );
817 renameBox->setFocus(); 817 renameBox->setFocus();
818 renameBox->show(); 818 renameBox->show();
819 819
820} 820}
821 821
822 822
823void AdvancedFm::renameIt() 823void AdvancedFm::renameIt()
824{ 824{
825 QListView *thisView = CurrentView(); 825 QListView *thisView = CurrentView();
826 oldName = thisView->currentItem()->text(0); 826 oldName = thisView->currentItem()->text(0);
827 doRename( thisView ); 827 doRename( thisView );
828 populateView(); 828 populateView();
829} 829}
830 830
831void AdvancedFm::okRename() 831void AdvancedFm::okRename()
832{ 832{
833 QString newName = renameBox->text(); 833 QString newName = renameBox->text();
834 cancelRename(); 834 cancelRename();
835 //int tabs=0; 835 //int tabs=0;
836 QListView * view = CurrentView(); 836 QListView * view = CurrentView();
837 QString path = CurrentDir()->canonicalPath() + "/"; 837 QString path = CurrentDir()->canonicalPath() + "/";
838 oldName = path + oldName; 838 oldName = path + oldName;
839 newName = path + newName; 839 newName = path + newName;
840 840
841 if( view->currentItem() == NULL) 841 if( view->currentItem() == NULL)
842 return; 842 return;
843 if( rename( oldName.latin1(), newName.latin1())== -1) 843 if( rename( oldName.latin1(), newName.latin1())== -1)
844 QMessageBox::message(tr("Note"),tr("Could not rename")); 844 QMessageBox::message(tr("Note"),tr("Could not rename"));
845 else 845 else
846 oldName = ""; 846 oldName = "";
847 847
848 view->takeItem( view->currentItem() ); 848 view->takeItem( view->currentItem() );
849 delete view->currentItem(); 849 delete view->currentItem();
850 populateView(); 850 populateView();
851} 851}