-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 8d07f69..9721f84 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -268,65 +268,65 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , in | |||
268 | } | 268 | } |
269 | break; | 269 | break; |
270 | // case 2: | 270 | // case 2: |
271 | // menuTimer.start( 50, TRUE ); | 271 | // menuTimer.start( 50, TRUE ); |
272 | // break; | 272 | // break; |
273 | }; | 273 | }; |
274 | } | 274 | } |
275 | 275 | ||
276 | 276 | ||
277 | void AdvancedFm::refreshCurrentTab() { | 277 | void AdvancedFm::refreshCurrentTab() { |
278 | populateView(); | 278 | populateView(); |
279 | // if ( TabWidget->currentWidget() == tab) { | 279 | // if ( TabWidget->currentWidget() == tab) { |
280 | 280 | ||
281 | } | 281 | } |
282 | 282 | ||
283 | void AdvancedFm::switchToLocalTab() { | 283 | void AdvancedFm::switchToLocalTab() { |
284 | TabWidget->setCurrentWidget(0); | 284 | TabWidget->setCurrentWidget(0); |
285 | // Local_View->setFocus(); | 285 | // Local_View->setFocus(); |
286 | whichTab = 1; | 286 | whichTab = 1; |
287 | } | 287 | } |
288 | 288 | ||
289 | void AdvancedFm::switchToRemoteTab() { | 289 | void AdvancedFm::switchToRemoteTab() { |
290 | TabWidget->setCurrentWidget(1); | 290 | TabWidget->setCurrentWidget(1); |
291 | // Remote_View->setFocus(); | 291 | // Remote_View->setFocus(); |
292 | whichTab = 2; | 292 | whichTab = 2; |
293 | } | 293 | } |
294 | 294 | ||
295 | void AdvancedFm::currentPathComboChanged() { | 295 | void AdvancedFm::currentPathComboChanged() { |
296 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 296 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
297 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); | 297 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); |
298 | populateView(); | 298 | populateView(); |
299 | } else { | 299 | } else { |
300 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 300 | QMessageBox::message(tr("Note"),tr("<p>That directory does not exist</p>")); |
301 | } | 301 | } |
302 | } | 302 | } |
303 | 303 | ||
304 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 304 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
305 | 305 | ||
306 | if ( TabWidget->currentWidget() == tab) { | 306 | if ( TabWidget->currentWidget() == tab) { |
307 | // if ( whichTab == 1) { | 307 | // if ( whichTab == 1) { |
308 | currentPathCombo->lineEdit()->setText( currentPath); | 308 | currentPathCombo->lineEdit()->setText( currentPath); |
309 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 309 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
310 | currentPathCombo->clear(); | 310 | currentPathCombo->clear(); |
311 | localDirPathStringList.prepend( currentPath ); | 311 | localDirPathStringList.prepend( currentPath ); |
312 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 312 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
313 | } | 313 | } |
314 | } else { | 314 | } else { |
315 | currentPathCombo->lineEdit()->setText( currentPath); | 315 | currentPathCombo->lineEdit()->setText( currentPath); |
316 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 316 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
317 | currentPathCombo->clear(); | 317 | currentPathCombo->clear(); |
318 | remoteDirPathStringList.prepend( currentPath ); | 318 | remoteDirPathStringList.prepend( currentPath ); |
319 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 319 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
320 | } | 320 | } |
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
324 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 324 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
325 | chdir( currentPath.latin1() ); | 325 | chdir( currentPath.latin1() ); |
326 | CurrentDir()->cd( currentPath, TRUE); | 326 | CurrentDir()->cd( currentPath, TRUE); |
327 | populateView(); | 327 | populateView(); |
328 | update(); | 328 | update(); |
329 | } | 329 | } |
330 | 330 | ||
331 | QStringList AdvancedFm::getPath() { | 331 | QStringList AdvancedFm::getPath() { |
332 | QStringList strList; | 332 | QStringList strList; |
@@ -640,65 +640,65 @@ void AdvancedFm::addCustomDir() { | |||
640 | 640 | ||
641 | dir = CurrentDir()->canonicalPath(); | 641 | dir = CurrentDir()->canonicalPath(); |
642 | 642 | ||
643 | bool addIt=true; | 643 | bool addIt=true; |
644 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 644 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
645 | if( dir == (*it)) { | 645 | if( dir == (*it)) { |
646 | addIt=false; | 646 | addIt=false; |
647 | } | 647 | } |
648 | } | 648 | } |
649 | if(addIt) { | 649 | if(addIt) { |
650 | menuButton->insertItem(dir); | 650 | menuButton->insertItem(dir); |
651 | // customDirMenu->insertItem(dir); | 651 | // customDirMenu->insertItem(dir); |
652 | list << dir; | 652 | list << dir; |
653 | } | 653 | } |
654 | 654 | ||
655 | cfg.writeEntry("CustomDir", list, ','); | 655 | cfg.writeEntry("CustomDir", list, ','); |
656 | cfg.write(); | 656 | cfg.write(); |
657 | } | 657 | } |
658 | 658 | ||
659 | void AdvancedFm::removeCustomDir() { | 659 | void AdvancedFm::removeCustomDir() { |
660 | // odebug << "remove custom dir" << oendl; | 660 | // odebug << "remove custom dir" << oendl; |
661 | Config cfg("AdvancedFm"); | 661 | Config cfg("AdvancedFm"); |
662 | cfg.setGroup("Menu"); | 662 | cfg.setGroup("Menu"); |
663 | QString dir; | 663 | QString dir; |
664 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); | 664 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); |
665 | QStringList list2; | 665 | QStringList list2; |
666 | dir = CurrentDir()->canonicalPath(); | 666 | dir = CurrentDir()->canonicalPath(); |
667 | int ramble=2; | 667 | int ramble=2; |
668 | // int ramble=-24; | 668 | // int ramble=-24; |
669 | //first remove list | 669 | //first remove list |
670 | if(list.grep(dir,true).isEmpty()) { | 670 | if(list.grep(dir,true).isEmpty()) { |
671 | QMessageBox::message(tr( "AdvancedFm" ), | 671 | QMessageBox::message(tr( "AdvancedFm" ), |
672 | tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); | 672 | tr("<p>Cannot remove current directory from bookmarks. It is not bookmarked!</p>")); |
673 | } else { | 673 | } else { |
674 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 674 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
675 | if((*it) != dir) { | 675 | if((*it) != dir) { |
676 | //current item is not our current dir, so add it to temp list | 676 | //current item is not our current dir, so add it to temp list |
677 | list2 <<(*it); | 677 | list2 <<(*it); |
678 | } else { | 678 | } else { |
679 | // customDirMenu->removeItem( ramble); | 679 | // customDirMenu->removeItem( ramble); |
680 | menuButton->remove( ramble); | 680 | menuButton->remove( ramble); |
681 | 681 | ||
682 | } | 682 | } |
683 | ramble++; | 683 | ramble++; |
684 | // ramble--; | 684 | // ramble--; |
685 | } | 685 | } |
686 | 686 | ||
687 | cfg.writeEntry("CustomDir", list2, ','); | 687 | cfg.writeEntry("CustomDir", list2, ','); |
688 | cfg.write(); | 688 | cfg.write(); |
689 | } | 689 | } |
690 | // customDirsToMenu(); | 690 | // customDirsToMenu(); |
691 | 691 | ||
692 | } | 692 | } |
693 | 693 | ||
694 | void AdvancedFm::gotoCustomDir(const QString &dir) { | 694 | void AdvancedFm::gotoCustomDir(const QString &dir) { |
695 | // odebug << "gotoCustomDir(const QString &dir) " +dir << oendl; | 695 | // odebug << "gotoCustomDir(const QString &dir) " +dir << oendl; |
696 | // QString curDir = dir; | 696 | // QString curDir = dir; |
697 | // QDir *thisDir = CurrentDir(); | 697 | // QDir *thisDir = CurrentDir(); |
698 | // if( curDir.isEmpty()) { | 698 | // if( curDir.isEmpty()) { |
699 | // } | 699 | // } |
700 | if( dir == s_addBookmark) { | 700 | if( dir == s_addBookmark) { |
701 | addCustomDir(); | 701 | addCustomDir(); |
702 | } | 702 | } |
703 | if( dir == s_removeBookmark) { | 703 | if( dir == s_removeBookmark) { |
704 | removeCustomDir( ); | 704 | removeCustomDir( ); |
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index f14f588..706658e 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -118,111 +118,111 @@ void AdvancedFm::runThis() { | |||
118 | 118 | ||
119 | void AdvancedFm::runText() { | 119 | void AdvancedFm::runText() { |
120 | if( !CurrentView()->currentItem()) return; | 120 | if( !CurrentView()->currentItem()) return; |
121 | QString curFile = CurrentView()->currentItem()->text(0); | 121 | QString curFile = CurrentView()->currentItem()->text(0); |
122 | if(curFile != "../") { | 122 | if(curFile != "../") { |
123 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink | 123 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink |
124 | curFile = dealWithSymName((const QString&)curFile); | 124 | curFile = dealWithSymName((const QString&)curFile); |
125 | curFile = CurrentDir()->canonicalPath()+"/"+curFile; | 125 | curFile = CurrentDir()->canonicalPath()+"/"+curFile; |
126 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 126 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
127 | e << curFile; | 127 | e << curFile; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | void AdvancedFm::makeDir() { | 131 | void AdvancedFm::makeDir() { |
132 | InputDialog *fileDlg; | 132 | InputDialog *fileDlg; |
133 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 133 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
134 | fileDlg->exec(); | 134 | fileDlg->exec(); |
135 | if( fileDlg->result() == 1 ) { | 135 | if( fileDlg->result() == 1 ) { |
136 | QDir *thisDir = CurrentDir(); | 136 | QDir *thisDir = CurrentDir(); |
137 | QString filename = fileDlg->LineEdit1->text(); | 137 | QString filename = fileDlg->LineEdit1->text(); |
138 | thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); | 138 | thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); |
139 | } | 139 | } |
140 | populateView(); | 140 | populateView(); |
141 | } | 141 | } |
142 | 142 | ||
143 | void AdvancedFm::doDelete() { | 143 | void AdvancedFm::doDelete() { |
144 | QStringList curFileList = getPath(); | 144 | QStringList curFileList = getPath(); |
145 | bool doMsg=true; | 145 | bool doMsg=true; |
146 | int count = curFileList.count(); | 146 | int count = curFileList.count(); |
147 | if( count > 0) { | 147 | if( count > 0) { |
148 | if(count > 1 ) { | 148 | if(count > 1 ) { |
149 | QString msg; | 149 | QString msg; |
150 | msg=tr("Really delete\n%1 files?").arg(count); | 150 | msg=tr("<p>Really delete %1 files?</p>").arg(count); |
151 | switch ( QMessageBox::warning(this,tr("Delete"),msg | 151 | switch ( QMessageBox::warning(this,tr("Delete"),msg |
152 | ,tr("Yes"),tr("No"),0,0,1) ) | 152 | ,tr("Yes"),tr("No"),0,0,1) ) |
153 | { | 153 | { |
154 | case 0: | 154 | case 0: |
155 | doMsg=false; | 155 | doMsg=false; |
156 | break; | 156 | break; |
157 | case 1: | 157 | case 1: |
158 | return; | 158 | return; |
159 | break; | 159 | break; |
160 | }; | 160 | }; |
161 | } | 161 | } |
162 | 162 | ||
163 | QString myFile; | 163 | QString myFile; |
164 | 164 | ||
165 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 165 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
166 | myFile = (*it); | 166 | myFile = (*it); |
167 | if( myFile.find(" -> ",0,TRUE) != -1) | 167 | if( myFile.find(" -> ",0,TRUE) != -1) |
168 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 168 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
169 | 169 | ||
170 | QString f = CurrentDir()->canonicalPath(); | 170 | QString f = CurrentDir()->canonicalPath(); |
171 | if(f.right(1).find("/",0,TRUE) == -1) | 171 | if(f.right(1).find("/",0,TRUE) == -1) |
172 | f += "/"; | 172 | f += "/"; |
173 | f += myFile; | 173 | f += myFile; |
174 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 174 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
175 | //if file is a directory | 175 | //if file is a directory |
176 | 176 | ||
177 | switch ( QMessageBox::warning( this, tr("Delete Directory?"), | 177 | switch ( QMessageBox::warning( this, tr("Delete Directory?"), |
178 | tr("Really delete %1\nand all it's contents ?" ).arg( f ) , | 178 | tr("<p>Really delete %1 and all it's contents?</p>" ).arg( f ) , |
179 | tr("Yes"), tr("No"), 0, 0, 1) ) { | 179 | tr("Yes"), tr("No"), 0, 0, 1) ) { |
180 | case 0: | 180 | case 0: |
181 | { | 181 | { |
182 | f=f.left(f.length()-1); | 182 | f=f.left(f.length()-1); |
183 | QString cmd="rm -rf "+f; | 183 | QString cmd="rm -rf "+f; |
184 | startProcess( (const QString)cmd.latin1() ); | 184 | startProcess( (const QString)cmd.latin1() ); |
185 | populateView(); | 185 | populateView(); |
186 | } | 186 | } |
187 | break; | 187 | break; |
188 | case 1: | 188 | case 1: |
189 | // exit | 189 | // exit |
190 | break; | 190 | break; |
191 | }; | 191 | }; |
192 | 192 | ||
193 | } else { | 193 | } else { |
194 | if(doMsg) { | 194 | if(doMsg) { |
195 | switch ( QMessageBox::warning(this,tr("Delete"), | 195 | switch ( QMessageBox::warning(this,tr("Delete"), |
196 | tr("Really delete\n%1?").arg( myFile ), | 196 | tr("<p>Really delete %1?</p>").arg( myFile ), |
197 | tr("Yes"), tr("No"), 0, 0, 1) ) { | 197 | tr("Yes"), tr("No"), 0, 0, 1) ) { |
198 | case 1: | 198 | case 1: |
199 | return; | 199 | return; |
200 | break; | 200 | break; |
201 | }; | 201 | }; |
202 | } | 202 | } |
203 | 203 | ||
204 | QString cmd="rm "+f; | 204 | QString cmd="rm "+f; |
205 | QFile file(f); | 205 | QFile file(f); |
206 | QFileInfo fi(myFile); | 206 | QFileInfo fi(myFile); |
207 | if( fi.fileName().find("../",0,TRUE)==-1) { | 207 | if( fi.fileName().find("../",0,TRUE)==-1) { |
208 | // odebug << "remove link files "+myFile << oendl; | 208 | // odebug << "remove link files "+myFile << oendl; |
209 | 209 | ||
210 | // DocLnk lnk(f); | 210 | // DocLnk lnk(f); |
211 | DocLnk *lnk; | 211 | DocLnk *lnk; |
212 | lnk = new DocLnk(f); | 212 | lnk = new DocLnk(f); |
213 | // odebug << "Deleting doclnk " + lnk->linkFile() << oendl; | 213 | // odebug << "Deleting doclnk " + lnk->linkFile() << oendl; |
214 | if(lnk->isValid()) | 214 | if(lnk->isValid()) |
215 | lnk->removeLinkFile(); | 215 | lnk->removeLinkFile(); |
216 | // delete lnk; | 216 | // delete lnk; |
217 | file.remove(); | 217 | file.remove(); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | } | 220 | } |
221 | } | 221 | } |
222 | populateView(); | 222 | populateView(); |
223 | } | 223 | } |
224 | 224 | ||
225 | void AdvancedFm::filePerms() { | 225 | void AdvancedFm::filePerms() { |
226 | QStringList curFileList = getPath(); | 226 | QStringList curFileList = getPath(); |
227 | QString filePath; | 227 | QString filePath; |
228 | 228 | ||
@@ -257,65 +257,65 @@ void AdvancedFm::doProperties() { | |||
257 | #endif | 257 | #endif |
258 | 258 | ||
259 | } | 259 | } |
260 | 260 | ||
261 | void AdvancedFm::upDir() { | 261 | void AdvancedFm::upDir() { |
262 | QDir *thisDir = CurrentDir(); | 262 | QDir *thisDir = CurrentDir(); |
263 | QString current = thisDir->canonicalPath(); | 263 | QString current = thisDir->canonicalPath(); |
264 | QDir dir(current); | 264 | QDir dir(current); |
265 | dir.cdUp(); | 265 | dir.cdUp(); |
266 | current = dir.canonicalPath(); | 266 | current = dir.canonicalPath(); |
267 | chdir( current.latin1() ); | 267 | chdir( current.latin1() ); |
268 | thisDir->cd( current, TRUE); | 268 | thisDir->cd( current, TRUE); |
269 | 269 | ||
270 | populateView(); | 270 | populateView(); |
271 | update(); | 271 | update(); |
272 | } | 272 | } |
273 | 273 | ||
274 | void AdvancedFm::copyTimer() { | 274 | void AdvancedFm::copyTimer() { |
275 | QTimer::singleShot(125,this,SLOT(copy())); | 275 | QTimer::singleShot(125,this,SLOT(copy())); |
276 | } | 276 | } |
277 | 277 | ||
278 | void AdvancedFm::copy() { | 278 | void AdvancedFm::copy() { |
279 | QStringList curFileList = getPath(); | 279 | QStringList curFileList = getPath(); |
280 | 280 | ||
281 | QDir *thisDir = CurrentDir(); | 281 | QDir *thisDir = CurrentDir(); |
282 | QDir *thatDir = OtherDir(); | 282 | QDir *thatDir = OtherDir(); |
283 | 283 | ||
284 | bool doMsg=true; | 284 | bool doMsg=true; |
285 | int count=curFileList.count(); | 285 | int count=curFileList.count(); |
286 | if( count > 0) { | 286 | if( count > 0) { |
287 | if(count > 1 ){ | 287 | if(count > 1 ){ |
288 | QString msg; | 288 | QString msg; |
289 | msg=tr("Really copy\n%1 files?").arg(count); | 289 | msg=tr("<p>Really copy %1 files?</p>").arg(count); |
290 | switch ( QMessageBox::warning(this,tr("Copy"),msg | 290 | switch ( QMessageBox::warning(this,tr("Copy"),msg |
291 | ,tr("Yes"),tr("No"),0,0,1) ) | 291 | ,tr("Yes"),tr("No"),0,0,1) ) |
292 | { | 292 | { |
293 | case 0: | 293 | case 0: |
294 | doMsg=false; | 294 | doMsg=false; |
295 | break; | 295 | break; |
296 | case 1: | 296 | case 1: |
297 | return; | 297 | return; |
298 | break; | 298 | break; |
299 | }; | 299 | }; |
300 | } | 300 | } |
301 | 301 | ||
302 | QString curFile, item, destFile; | 302 | QString curFile, item, destFile; |
303 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 303 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
304 | item=(*it); | 304 | item=(*it); |
305 | if(item.find("->",0,TRUE)) //symlink | 305 | if(item.find("->",0,TRUE)) //symlink |
306 | item = item.left(item.find("->",0,TRUE)); | 306 | item = item.left(item.find("->",0,TRUE)); |
307 | 307 | ||
308 | curFile = thisDir->canonicalPath()+"/"+ item; | 308 | curFile = thisDir->canonicalPath()+"/"+ item; |
309 | destFile = thatDir->canonicalPath()+"/"+ item; | 309 | destFile = thatDir->canonicalPath()+"/"+ item; |
310 | 310 | ||
311 | // odebug << "Destination file is "+destFile << oendl; | 311 | // odebug << "Destination file is "+destFile << oendl; |
312 | // odebug << "CurrentFile file is " + curFile << oendl; | 312 | // odebug << "CurrentFile file is " + curFile << oendl; |
313 | 313 | ||
314 | QFile f(destFile); | 314 | QFile f(destFile); |
315 | if( f.exists()) { | 315 | if( f.exists()) { |
316 | if(doMsg) { | 316 | if(doMsg) { |
317 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 317 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
318 | tr("<p>%1 already exists. Ok to overwrite?</P>").arg(item), | 318 | tr("<p>%1 already exists. Ok to overwrite?</P>").arg(item), |
319 | tr("Yes"),tr("No"),0,0,1)) { | 319 | tr("Yes"),tr("No"),0,0,1)) { |
320 | case 1: | 320 | case 1: |
321 | return; | 321 | return; |
@@ -472,77 +472,77 @@ void AdvancedFm::move() { | |||
472 | return; | 472 | return; |
473 | } | 473 | } |
474 | QFile f( destFile); | 474 | QFile f( destFile); |
475 | if( f.exists()) { | 475 | if( f.exists()) { |
476 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 476 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
477 | tr("<p>%1 already exists. Ok to overwrite?</P>").arg(destFile), | 477 | tr("<p>%1 already exists. Ok to overwrite?</P>").arg(destFile), |
478 | tr("Yes"),tr("No"),0,0,1)) { | 478 | tr("Yes"),tr("No"),0,0,1)) { |
479 | case 1: | 479 | case 1: |
480 | return; | 480 | return; |
481 | break; | 481 | break; |
482 | }; | 482 | }; |
483 | if( !copyFile( curFile, destFile) ) { | 483 | if( !copyFile( curFile, destFile) ) { |
484 | QMessageBox::message(tr("Note"),tr("<p>Could not move %1</p>").arg(curFile)); | 484 | QMessageBox::message(tr("Note"),tr("<p>Could not move %1</p>").arg(curFile)); |
485 | return; | 485 | return; |
486 | } else | 486 | } else |
487 | QFile::remove(curFile); | 487 | QFile::remove(curFile); |
488 | } | 488 | } |
489 | } | 489 | } |
490 | } | 490 | } |
491 | rePopulate(); | 491 | rePopulate(); |
492 | //setOtherTabCurrent(); | 492 | //setOtherTabCurrent(); |
493 | } | 493 | } |
494 | 494 | ||
495 | bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { | 495 | bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { |
496 | int err = 0; | 496 | int err = 0; |
497 | if( copyDirectory( src, dest ) ) { | 497 | if( copyDirectory( src, dest ) ) { |
498 | QString cmd = "rm -rf " + src; | 498 | QString cmd = "rm -rf " + src; |
499 | err = system((const char*)cmd); | 499 | err = system((const char*)cmd); |
500 | } else | 500 | } else |
501 | err = -1; | 501 | err = -1; |
502 | 502 | ||
503 | if(err!=0) { | 503 | if(err!=0) { |
504 | QMessageBox::message(tr("Note"),tr("Could not move\n") + src); | 504 | QMessageBox::message(tr("Note"),tr("<p>Could not move %1</p>").arg( src)); |
505 | return false; | 505 | return false; |
506 | } | 506 | } |
507 | return true; | 507 | return true; |
508 | } | 508 | } |
509 | 509 | ||
510 | bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { | 510 | bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { |
511 | 511 | ||
512 | QString cmd = "/bin/cp -fpR " + src + " " + dest; | 512 | QString cmd = "/bin/cp -fpR " + src + " " + dest; |
513 | owarn << cmd << oendl; | 513 | owarn << cmd << oendl; |
514 | int err = system( (const char *) cmd ); | 514 | int err = system( (const char *) cmd ); |
515 | if ( err != 0 ) { | 515 | if ( err != 0 ) { |
516 | QMessageBox::message("AdvancedFm", tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) ); | 516 | QMessageBox::message("AdvancedFm", tr( "<p>Could not copy %1 to %2</p>").arg( src ).arg( dest ) ); |
517 | return false; | 517 | return false; |
518 | } | 518 | } |
519 | 519 | ||
520 | return true; | 520 | return true; |
521 | } | 521 | } |
522 | 522 | ||
523 | 523 | ||
524 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { | 524 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { |
525 | if(QFileInfo(src).isDir()) { | 525 | if(QFileInfo(src).isDir()) { |
526 | if( copyDirectory( src, dest )) { | 526 | if( copyDirectory( src, dest )) { |
527 | // setOtherTabCurrent(); | 527 | // setOtherTabCurrent(); |
528 | rePopulate(); | 528 | rePopulate(); |
529 | return true; | 529 | return true; |
530 | } | 530 | } |
531 | else | 531 | else |
532 | return false; | 532 | return false; |
533 | } | 533 | } |
534 | 534 | ||
535 | 535 | ||
536 | bool success = true; | 536 | bool success = true; |
537 | struct stat status; | 537 | struct stat status; |
538 | QFile srcFile(src); | 538 | QFile srcFile(src); |
539 | QFile destFile(dest); | 539 | QFile destFile(dest); |
540 | int err=0; | 540 | int err=0; |
541 | int read_fd=0; | 541 | int read_fd=0; |
542 | int write_fd=0; | 542 | int write_fd=0; |
543 | struct stat stat_buf; | 543 | struct stat stat_buf; |
544 | off_t offset = 0; | 544 | off_t offset = 0; |
545 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { | 545 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { |
546 | // owarn << "open failed" << oendl; | 546 | // owarn << "open failed" << oendl; |
547 | return success = false; | 547 | return success = false; |
548 | } | 548 | } |