author | llornkcor <llornkcor> | 2003-07-17 19:51:45 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-07-17 19:51:45 (UTC) |
commit | cf3921fe77f87e94ff821df65bb80b02487a9f9b (patch) (unidiff) | |
tree | f7109c1df836035b73226ac64837c76e467f19a3 | |
parent | 6140e0d6a131ac127ebfc583990cb6ceefdd30ad (diff) | |
download | opie-cf3921fe77f87e94ff821df65bb80b02487a9f9b.zip opie-cf3921fe77f87e94ff821df65bb80b02487a9f9b.tar.gz opie-cf3921fe77f87e94ff821df65bb80b02487a9f9b.tar.bz2 |
show no hidden default. fix for nonfresh after move, via patch. thanks
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 9 |
2 files changed, 6 insertions, 6 deletions
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index a120f35..45dc0c4 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -182,100 +182,101 @@ void AdvancedFm::init() { | |||
182 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 182 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
183 | tabLayout_3 = new QGridLayout( tab_3 ); | 183 | tabLayout_3 = new QGridLayout( tab_3 ); |
184 | tabLayout_3->setSpacing( 2); | 184 | tabLayout_3->setSpacing( 2); |
185 | tabLayout_3->setMargin( 2); | 185 | tabLayout_3->setMargin( 2); |
186 | 186 | ||
187 | 187 | ||
188 | // OFileDialog fileDialog; | 188 | // OFileDialog fileDialog; |
189 | // fileDialog; | 189 | // fileDialog; |
190 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 190 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
191 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 191 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
192 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 192 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
193 | 193 | ||
194 | QListView *fileTree; | 194 | QListView *fileTree; |
195 | fileTree = new QListView( tab_3, "tree" ); | 195 | fileTree = new QListView( tab_3, "tree" ); |
196 | 196 | ||
197 | 197 | ||
198 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 198 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
199 | 199 | ||
200 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 200 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
201 | */ | 201 | */ |
202 | 202 | ||
203 | /////////////// | 203 | /////////////// |
204 | 204 | ||
205 | 205 | ||
206 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 206 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
207 | if (uname(&name) != -1) { | 207 | if (uname(&name) != -1) { |
208 | QString release=name.release; | 208 | QString release=name.release; |
209 | if(release.find("embedix",0,TRUE) !=-1) { | 209 | if(release.find("embedix",0,TRUE) !=-1) { |
210 | zaurusDevice=TRUE; | 210 | zaurusDevice=TRUE; |
211 | } else { | 211 | } else { |
212 | zaurusDevice=FALSE; | 212 | zaurusDevice=FALSE; |
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||
216 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { | 216 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { |
217 | qDebug("not have sd"); | 217 | qDebug("not have sd"); |
218 | sdButton->hide(); | 218 | sdButton->hide(); |
219 | } | 219 | } |
220 | if( !StorageInfo::hasCf() ) { | 220 | if( !StorageInfo::hasCf() ) { |
221 | qDebug("not have cf"); | 221 | qDebug("not have cf"); |
222 | cfButton->hide(); | 222 | cfButton->hide(); |
223 | } | 223 | } |
224 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 224 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
225 | currentDir.setPath( QDir::currentDirPath()); | 225 | currentDir.setPath( QDir::currentDirPath()); |
226 | 226 | ||
227 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 227 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
228 | currentRemoteDir.setPath( QDir::currentDirPath()); | 228 | currentRemoteDir.setPath( QDir::currentDirPath()); |
229 | 229 | ||
230 | b = TRUE; | 230 | // b = TRUE; |
231 | 231 | ||
232 | filterStr="*"; | 232 | filterStr="*"; |
233 | b=FALSE; | 233 | b=FALSE; |
234 | showMenuHidden(); | ||
234 | TabWidget->setCurrentTab(0); | 235 | TabWidget->setCurrentTab(0); |
235 | 236 | ||
236 | } | 237 | } |
237 | 238 | ||
238 | void AdvancedFm::initConnections() | 239 | void AdvancedFm::initConnections() |
239 | { | 240 | { |
240 | 241 | ||
241 | connect( qApp,SIGNAL( aboutToQuit()), | 242 | connect( qApp,SIGNAL( aboutToQuit()), |
242 | this, SLOT( cleanUp()) ); | 243 | this, SLOT( cleanUp()) ); |
243 | connect( qpeDirButton ,SIGNAL(released()), | 244 | connect( qpeDirButton ,SIGNAL(released()), |
244 | this,SLOT( QPEButtonPushed()) ); | 245 | this,SLOT( QPEButtonPushed()) ); |
245 | connect( cfButton ,SIGNAL(released()), | 246 | connect( cfButton ,SIGNAL(released()), |
246 | this,SLOT( CFButtonPushed()) ); | 247 | this,SLOT( CFButtonPushed()) ); |
247 | connect( sdButton ,SIGNAL(released()), | 248 | connect( sdButton ,SIGNAL(released()), |
248 | this,SLOT( SDButtonPushed()) ); | 249 | this,SLOT( SDButtonPushed()) ); |
249 | connect( cdUpButton ,SIGNAL(released()), | 250 | connect( cdUpButton ,SIGNAL(released()), |
250 | this,SLOT( upDir()) ); | 251 | this,SLOT( upDir()) ); |
251 | connect( docButton,SIGNAL(released()), | 252 | connect( docButton,SIGNAL(released()), |
252 | this,SLOT( docButtonPushed()) ); | 253 | this,SLOT( docButtonPushed()) ); |
253 | connect( homeButton,SIGNAL(released()), | 254 | connect( homeButton,SIGNAL(released()), |
254 | this,SLOT( homeButtonPushed()) ); | 255 | this,SLOT( homeButtonPushed()) ); |
255 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 256 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
256 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 257 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
257 | 258 | ||
258 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 259 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
259 | this,SLOT(currentPathComboChanged())); | 260 | this,SLOT(currentPathComboChanged())); |
260 | 261 | ||
261 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 262 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
262 | this,SLOT( ListClicked(QListViewItem *)) ); | 263 | this,SLOT( ListClicked(QListViewItem *)) ); |
263 | 264 | ||
264 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 265 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
265 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 266 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
266 | 267 | ||
267 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | 268 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); |
268 | 269 | ||
269 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 270 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
270 | this,SLOT( ListClicked(QListViewItem *)) ); | 271 | this,SLOT( ListClicked(QListViewItem *)) ); |
271 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 272 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
272 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 273 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
273 | 274 | ||
274 | connect( TabWidget,SIGNAL(currentChanged(QWidget *)), | 275 | connect( TabWidget,SIGNAL(currentChanged(QWidget *)), |
275 | this,SLOT(tabChanged(QWidget*))); | 276 | this,SLOT(tabChanged(QWidget*))); |
276 | 277 | ||
277 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); | 278 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); |
278 | 279 | ||
279 | connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&))); | 280 | connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&))); |
280 | // connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int))); | 281 | // connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int))); |
281 | 282 | ||
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 00d0e07..544350c 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -1,122 +1,121 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | AdvancedFm.cpp | 2 | AdvancedFm.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #include "advancedfm.h" | 12 | #include "advancedfm.h" |
13 | #include "output.h" | 13 | #include "output.h" |
14 | #include "filePermissions.h" | 14 | #include "filePermissions.h" |
15 | 15 | ||
16 | #include <opie/otabwidget.h> | 16 | #include <opie/otabwidget.h> |
17 | #include <opie/oprocess.h> | 17 | #include <opie/oprocess.h> |
18 | 18 | ||
19 | #include <qpe/lnkproperties.h> | 19 | #include <qpe/lnkproperties.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/applnk.h> | 23 | #include <qpe/applnk.h> |
24 | #include <qpe/ir.h> | 24 | #include <qpe/ir.h> |
25 | 25 | ||
26 | #include <qmessagebox.h> | 26 | #include <qmessagebox.h> |
27 | #include <qmultilineedit.h> | 27 | #include <qmultilineedit.h> |
28 | 28 | ||
29 | #include <qstring.h> | 29 | #include <qstring.h> |
30 | 30 | ||
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | #include <qpixmap.h> | 32 | #include <qpixmap.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qtabwidget.h> | 35 | #include <qtabwidget.h> |
36 | #include <qtoolbutton.h> | 36 | #include <qtoolbutton.h> |
37 | #include <qtabwidget.h> | ||
38 | #include <qlineedit.h> | 37 | #include <qlineedit.h> |
39 | #include <qlistview.h> | 38 | #include <qlistview.h> |
40 | 39 | ||
41 | #include <errno.h> | 40 | #include <errno.h> |
42 | #include <stdlib.h> | 41 | #include <stdlib.h> |
43 | #include <unistd.h> | 42 | #include <unistd.h> |
44 | #include <sys/stat.h> | 43 | #include <sys/stat.h> |
45 | #include <dirent.h> | 44 | #include <dirent.h> |
46 | #include <sys/sendfile.h> | 45 | #include <sys/sendfile.h> |
47 | #include <fcntl.h> | 46 | #include <fcntl.h> |
48 | 47 | ||
49 | 48 | ||
50 | void AdvancedFm::doDirChange() | 49 | void AdvancedFm::doDirChange() |
51 | { | 50 | { |
52 | ListClicked( CurrentView()->currentItem()); | 51 | ListClicked( CurrentView()->currentItem()); |
53 | } | 52 | } |
54 | 53 | ||
55 | void AdvancedFm::showMenuHidden() | 54 | void AdvancedFm::showMenuHidden() |
56 | { | 55 | { |
57 | if (b) | 56 | if (b) |
58 | { | 57 | { |
59 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 58 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
60 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 59 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
61 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 60 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
62 | // b=FALSE; | 61 | // b=FALSE; |
63 | 62 | ||
64 | } | 63 | } |
65 | else | 64 | else |
66 | { | 65 | { |
67 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 66 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
68 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 67 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
69 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 68 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
70 | // b=TRUE; | 69 | // b=TRUE; |
71 | } | 70 | } |
72 | rePopulate(); | 71 | rePopulate(); |
73 | // if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); | 72 | // if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); |
74 | if(b) b = false; else b = true; | 73 | b = !b; |
75 | } | 74 | } |
76 | 75 | ||
77 | void AdvancedFm::showHidden() | 76 | void AdvancedFm::showHidden() |
78 | { | 77 | { |
79 | if (b) | 78 | if (b) |
80 | { | 79 | { |
81 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 80 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
82 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 81 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
83 | // fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 82 | // fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
84 | // b=FALSE; | 83 | // b=FALSE; |
85 | 84 | ||
86 | } | 85 | } |
87 | else | 86 | else |
88 | { | 87 | { |
89 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 88 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
90 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 89 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
91 | // fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 90 | // fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
92 | // b=TRUE; | 91 | // b=TRUE; |
93 | } | 92 | } |
94 | rePopulate(); | 93 | rePopulate(); |
95 | } | 94 | } |
96 | 95 | ||
97 | QString AdvancedFm::dealWithSymName(const QString &fileName) | 96 | QString AdvancedFm::dealWithSymName(const QString &fileName) |
98 | { | 97 | { |
99 | QString strItem = fileName; | 98 | QString strItem = fileName; |
100 | return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 99 | return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
101 | } | 100 | } |
102 | 101 | ||
103 | void AdvancedFm::runThis() | 102 | void AdvancedFm::runThis() |
104 | { | 103 | { |
105 | QString fs; | 104 | QString fs; |
106 | QDir *thisDir = CurrentDir(); | 105 | QDir *thisDir = CurrentDir(); |
107 | 106 | ||
108 | QString curFile = CurrentView()->currentItem()->text(0); | 107 | QString curFile = CurrentView()->currentItem()->text(0); |
109 | QString path = thisDir->canonicalPath(); | 108 | QString path = thisDir->canonicalPath(); |
110 | 109 | ||
111 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink | 110 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink |
112 | 111 | ||
113 | curFile = dealWithSymName((const QString&)curFile); | 112 | curFile = dealWithSymName((const QString&)curFile); |
114 | 113 | ||
115 | if(curFile != "../") | 114 | if(curFile != "../") |
116 | { | 115 | { |
117 | 116 | ||
118 | fs = getFileSystemType((const QString &) path); | 117 | fs = getFileSystemType((const QString &) path); |
119 | QFileInfo fileInfo( path + "/" + curFile); | 118 | QFileInfo fileInfo( path + "/" + curFile); |
120 | qDebug( fileInfo.owner()); | 119 | qDebug( fileInfo.owner()); |
121 | 120 | ||
122 | if( (fileInfo.permission( QFileInfo::ExeUser) | 121 | if( (fileInfo.permission( QFileInfo::ExeUser) |
@@ -475,99 +474,99 @@ void AdvancedFm::copySameDir() | |||
475 | return; | 474 | return; |
476 | } | 475 | } |
477 | 476 | ||
478 | qDebug("copy "+curFile+" as "+destFile); | 477 | qDebug("copy "+curFile+" as "+destFile); |
479 | } | 478 | } |
480 | delete fileDlg; | 479 | delete fileDlg; |
481 | } | 480 | } |
482 | populateView(); | 481 | populateView(); |
483 | } | 482 | } |
484 | 483 | ||
485 | void AdvancedFm::move() | 484 | void AdvancedFm::move() |
486 | { | 485 | { |
487 | qApp->processEvents(); | 486 | qApp->processEvents(); |
488 | 487 | ||
489 | QStringList curFileList = getPath(); | 488 | QStringList curFileList = getPath(); |
490 | if( curFileList.count() > 0) | 489 | if( curFileList.count() > 0) |
491 | { | 490 | { |
492 | QString curFile, destFile, item; | 491 | QString curFile, destFile, item; |
493 | 492 | ||
494 | QDir *thisDir = CurrentDir(); | 493 | QDir *thisDir = CurrentDir(); |
495 | QDir *thatDir = OtherDir(); | 494 | QDir *thatDir = OtherDir(); |
496 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 495 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) |
497 | { | 496 | { |
498 | item=(*it); | 497 | item=(*it); |
499 | QString destFile = thatDir->canonicalPath(); | 498 | QString destFile = thatDir->canonicalPath(); |
500 | 499 | ||
501 | if(destFile.right(1).find("/",0,TRUE) == -1) | 500 | if(destFile.right(1).find("/",0,TRUE) == -1) |
502 | destFile+="/"; | 501 | destFile+="/"; |
503 | destFile += item; | 502 | destFile += item; |
504 | qDebug("Destination file is "+destFile); | 503 | qDebug("Destination file is "+destFile); |
505 | 504 | ||
506 | curFile = thisDir->canonicalPath(); | 505 | curFile = thisDir->canonicalPath(); |
507 | if(curFile.right(1).find("/",0,TRUE) == -1) | 506 | if(curFile.right(1).find("/",0,TRUE) == -1) |
508 | curFile +="/"; | 507 | curFile +="/"; |
509 | curFile+= item; | 508 | curFile+= item; |
510 | qDebug("CurrentFile file is " + curFile); | 509 | qDebug("CurrentFile file is " + curFile); |
511 | 510 | ||
512 | QFile f( curFile); | 511 | QFile f( curFile); |
513 | if( f.exists()) { | 512 | if( f.exists()) { |
514 | if( !copyFile( curFile, destFile) ) { | 513 | if( !copyFile( curFile, destFile) ) { |
515 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); | 514 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); |
516 | return; | 515 | return; |
517 | } else | 516 | } else |
518 | QFile::remove(curFile); | 517 | QFile::remove(curFile); |
519 | } | 518 | } |
520 | } | 519 | } |
521 | 520 | ||
522 | } | 521 | } |
523 | setOtherTabCurrent(); | 522 | populateView(); |
524 | populateView(); | 523 | setOtherTabCurrent(); |
525 | // populateLocalView(); | 524 | populateView(); |
526 | } | 525 | } |
527 | 526 | ||
528 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) | 527 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) |
529 | { | 528 | { |
530 | bool success = true; | 529 | bool success = true; |
531 | struct stat status; | 530 | struct stat status; |
532 | QFile srcFile(src); | 531 | QFile srcFile(src); |
533 | QFile destFile(dest); | 532 | QFile destFile(dest); |
534 | int err=0; | 533 | int err=0; |
535 | int read_fd=0; | 534 | int read_fd=0; |
536 | int write_fd=0; | 535 | int write_fd=0; |
537 | struct stat stat_buf; | 536 | struct stat stat_buf; |
538 | off_t offset = 0; | 537 | off_t offset = 0; |
539 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { | 538 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { |
540 | qWarning("open failed"); | 539 | qWarning("open failed"); |
541 | return success = false; | 540 | return success = false; |
542 | } | 541 | } |
543 | read_fd = srcFile.handle(); | 542 | read_fd = srcFile.handle(); |
544 | if(read_fd != -1) { | 543 | if(read_fd != -1) { |
545 | fstat (read_fd, &stat_buf); | 544 | fstat (read_fd, &stat_buf); |
546 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { | 545 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { |
547 | qWarning("destfile open failed"); | 546 | qWarning("destfile open failed"); |
548 | return success = false; | 547 | return success = false; |
549 | } | 548 | } |
550 | write_fd = destFile.handle(); | 549 | write_fd = destFile.handle(); |
551 | if(write_fd != -1) { | 550 | if(write_fd != -1) { |
552 | err =sendfile(write_fd, read_fd, &offset, stat_buf.st_size); | 551 | err =sendfile(write_fd, read_fd, &offset, stat_buf.st_size); |
553 | if( err == -1) { | 552 | if( err == -1) { |
554 | QString msg; | 553 | QString msg; |
555 | switch(err) { | 554 | switch(err) { |
556 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; | 555 | 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. "; | 556 | case EINVAL: msg = "Descriptor is not valid or locked. "; |
558 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; | 557 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; |
559 | case EIO: msg = "Unspecified error while reading from in_fd."; | 558 | case EIO: msg = "Unspecified error while reading from in_fd."; |
560 | }; | 559 | }; |
561 | success = false; | 560 | success = false; |
562 | qWarning(msg); | 561 | qWarning(msg); |
563 | } | 562 | } |
564 | } else { | 563 | } else { |
565 | success = false; | 564 | success = false; |
566 | } | 565 | } |
567 | } else { | 566 | } else { |
568 | success = false; | 567 | success = false; |
569 | } | 568 | } |
570 | srcFile.close(); | 569 | srcFile.close(); |
571 | destFile.close(); | 570 | destFile.close(); |
572 | // Set file permissions | 571 | // Set file permissions |
573 | if( stat( (const char *) src, &status ) == 0 ) { | 572 | if( stat( (const char *) src, &status ) == 0 ) { |