-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 1 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 10 |
4 files changed, 15 insertions, 7 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 7fba0af..d7bad51 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,141 +1,140 @@ | |||
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 | |||
14 | #include "advancedfm.h" | 13 | #include "advancedfm.h" |
15 | 14 | ||
16 | // #include <opie/ofileselector.h> | 15 | // #include <opie/ofileselector.h> |
17 | // #include <opie/ofiledialog.h> | 16 | // #include <opie/ofiledialog.h> |
18 | 17 | ||
19 | #include <qpe/filemanager.h> | 18 | #include <qpe/filemanager.h> |
20 | #include <qpe/qcopenvelope_qws.h> | 19 | #include <qpe/qcopenvelope_qws.h> |
21 | #include <qpe/qpemenubar.h> | 20 | #include <qpe/qpemenubar.h> |
22 | #include <qpe/qpetoolbar.h> | 21 | #include <qpe/qpetoolbar.h> |
23 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/qcopenvelope_qws.h> | 23 | #include <qpe/qcopenvelope_qws.h> |
25 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
26 | #include <qpe/mimetype.h> | 25 | #include <qpe/mimetype.h> |
27 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
28 | #include <qpe/ir.h> | 27 | #include <qpe/ir.h> |
29 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
30 | 29 | ||
31 | #include <qtabwidget.h> | 30 | #include <qtabwidget.h> |
32 | #include <qtextstream.h> | 31 | #include <qtextstream.h> |
33 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
34 | #include <qdatetime.h> | 33 | #include <qdatetime.h> |
35 | #include <qdir.h> | 34 | #include <qdir.h> |
36 | #include <qfile.h> | 35 | #include <qfile.h> |
37 | #include <qstring.h> | 36 | #include <qstring.h> |
38 | #include <qcombobox.h> | 37 | #include <qcombobox.h> |
39 | #include <qpopupmenu.h> | 38 | #include <qpopupmenu.h> |
40 | #include <qlistview.h> | 39 | #include <qlistview.h> |
41 | #include <qmainwindow.h> | 40 | #include <qmainwindow.h> |
42 | #include <qlabel.h> | 41 | #include <qlabel.h> |
43 | #include <qprogressbar.h> | 42 | #include <qprogressbar.h> |
44 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
45 | #include <qwidget.h> | 44 | #include <qwidget.h> |
46 | #include <qlayout.h> | 45 | #include <qlayout.h> |
47 | #include <qimage.h> | 46 | #include <qimage.h> |
48 | #include <qpixmap.h> | 47 | #include <qpixmap.h> |
49 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
50 | #include <qlineedit.h> | 49 | #include <qlineedit.h> |
51 | #include <qregexp.h> | 50 | #include <qregexp.h> |
52 | 51 | ||
53 | #include <unistd.h> | 52 | #include <unistd.h> |
54 | #include <stdlib.h> | 53 | #include <stdlib.h> |
55 | #include <sys/stat.h> | 54 | #include <sys/stat.h> |
56 | #include <dirent.h> | 55 | #include <dirent.h> |
57 | #include <stdio.h> | 56 | #include <stdio.h> |
58 | #include <time.h> | 57 | #include <time.h> |
59 | #include <fcntl.h> | 58 | #include <fcntl.h> |
60 | #include <mntent.h> | 59 | #include <mntent.h> |
61 | #include <string.h> | 60 | #include <string.h> |
62 | #include <errno.h> | 61 | #include <errno.h> |
63 | #include <sys/vfs.h> | 62 | #include <sys/vfs.h> |
64 | #include <mntent.h> | 63 | #include <mntent.h> |
65 | #include <sys/utsname.h> | 64 | #include <sys/utsname.h> |
66 | 65 | ||
67 | AdvancedFm::AdvancedFm( ) | 66 | AdvancedFm::AdvancedFm( ) |
68 | : QMainWindow( ) { | 67 | : QMainWindow( ) { |
69 | init(); | 68 | init(); |
70 | initConnections(); | 69 | initConnections(); |
71 | populateLocalView(); | 70 | populateLocalView(); |
72 | populateRemoteView(); | 71 | populateRemoteView(); |
73 | currentPathCombo->setFocus(); | 72 | currentPathCombo->setFocus(); |
74 | } | 73 | } |
75 | 74 | ||
76 | AdvancedFm::~AdvancedFm() { | 75 | AdvancedFm::~AdvancedFm() { |
77 | } | 76 | } |
78 | 77 | ||
79 | void AdvancedFm::cleanUp() { | 78 | void AdvancedFm::cleanUp() { |
80 | QString sfile=QDir::homeDirPath(); | 79 | QString sfile=QDir::homeDirPath(); |
81 | if(sfile.right(1) != "/") | 80 | if(sfile.right(1) != "/") |
82 | sfile+="/._temp"; | 81 | sfile+="/._temp"; |
83 | else | 82 | else |
84 | sfile+="._temp"; | 83 | sfile+="._temp"; |
85 | QFile file( sfile); | 84 | QFile file( sfile); |
86 | if(file.exists()) | 85 | if(file.exists()) |
87 | file.remove(); | 86 | file.remove(); |
88 | } | 87 | } |
89 | 88 | ||
90 | void AdvancedFm::tabChanged(QWidget *) { | 89 | void AdvancedFm::tabChanged(QWidget *) { |
91 | if (TabWidget->currentPageIndex() == 0) { | 90 | if (TabWidget->currentPageIndex() == 0) { |
92 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 91 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
93 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 92 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
94 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 93 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
95 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 94 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
96 | setCaption("AdvancedFm :: "+fs+" :: " | 95 | setCaption("AdvancedFm :: "+fs+" :: " |
97 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); | 96 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
98 | 97 | ||
99 | } | 98 | } |
100 | if (TabWidget->currentPageIndex() == 1) { | 99 | if (TabWidget->currentPageIndex() == 1) { |
101 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 100 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
102 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 101 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
103 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 102 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
104 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 103 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
105 | setCaption("AdvancedFm :: "+fs+" :: " | 104 | setCaption("AdvancedFm :: "+fs+" :: " |
106 | +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); | 105 | +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); |
107 | } | 106 | } |
108 | } | 107 | } |
109 | 108 | ||
110 | 109 | ||
111 | void AdvancedFm::populateLocalView() { | 110 | void AdvancedFm::populateLocalView() { |
112 | QPixmap pm; | 111 | QPixmap pm; |
113 | Local_View->clear(); | 112 | Local_View->clear(); |
114 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 113 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
115 | currentDir.setMatchAllDirs(TRUE); | 114 | currentDir.setMatchAllDirs(TRUE); |
116 | currentDir.setNameFilter(filterStr); | 115 | currentDir.setNameFilter(filterStr); |
117 | QString fileL, fileS, fileDate; | 116 | QString fileL, fileS, fileDate; |
118 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 117 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
119 | setCaption("AdvancedFm :: "+fs+" :: " | 118 | setCaption("AdvancedFm :: "+fs+" :: " |
120 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); | 119 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
121 | bool isDir=FALSE; | 120 | bool isDir=FALSE; |
122 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 121 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
123 | QFileInfoListIterator it(*list); | 122 | QFileInfoListIterator it(*list); |
124 | QFileInfo *fi; | 123 | QFileInfo *fi; |
125 | while ( (fi=it.current()) ) { | 124 | while ( (fi=it.current()) ) { |
126 | if (fi->isSymLink() ) { | 125 | if (fi->isSymLink() ) { |
127 | QString symLink=fi->readLink(); | 126 | QString symLink=fi->readLink(); |
128 | QFileInfo sym( symLink); | 127 | QFileInfo sym( symLink); |
129 | fileS.sprintf( "%10i", sym.size() ); | 128 | fileS.sprintf( "%10i", sym.size() ); |
130 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); | 129 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); |
131 | fileDate = sym.lastModified().toString(); | 130 | fileDate = sym.lastModified().toString(); |
132 | } else { | 131 | } else { |
133 | fileS.sprintf( "%10i", fi->size() ); | 132 | fileS.sprintf( "%10i", fi->size() ); |
134 | fileL.sprintf( "%s",fi->fileName().data() ); | 133 | fileL.sprintf( "%s",fi->fileName().data() ); |
135 | fileDate= fi->lastModified().toString(); | 134 | fileDate= fi->lastModified().toString(); |
136 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 135 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
137 | fileL+="/"; | 136 | fileL+="/"; |
138 | isDir=TRUE; | 137 | isDir=TRUE; |
139 | } | 138 | } |
140 | } | 139 | } |
141 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | 140 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); |
@@ -270,269 +269,269 @@ void AdvancedFm::populateRemoteView() { | |||
270 | QPainter painter( &pm ); | 269 | QPainter painter( &pm ); |
271 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 270 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
272 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 271 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
273 | } | 272 | } |
274 | item->setPixmap( 0, pm); | 273 | item->setPixmap( 0, pm); |
275 | } | 274 | } |
276 | isDir=FALSE; | 275 | isDir=FALSE; |
277 | ++it; | 276 | ++it; |
278 | } | 277 | } |
279 | 278 | ||
280 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 279 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
281 | struct stat buf; | 280 | struct stat buf; |
282 | DIR *dir; | 281 | DIR *dir; |
283 | struct dirent *mydirent; | 282 | struct dirent *mydirent; |
284 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 283 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
285 | while ((mydirent = readdir(dir)) != NULL) { | 284 | while ((mydirent = readdir(dir)) != NULL) { |
286 | lstat( mydirent->d_name, &buf); | 285 | lstat( mydirent->d_name, &buf); |
287 | qDebug(mydirent->d_name); | 286 | qDebug(mydirent->d_name); |
288 | fileL.sprintf("%s", mydirent->d_name); | 287 | fileL.sprintf("%s", mydirent->d_name); |
289 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); | 288 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); |
290 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 289 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
291 | if( fileL.find(".") == -1 ){ | 290 | if( fileL.find(".") == -1 ){ |
292 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 291 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
293 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 292 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
294 | item->setPixmap( 0,pm); | 293 | item->setPixmap( 0,pm); |
295 | } | 294 | } |
296 | } | 295 | } |
297 | 296 | ||
298 | closedir(dir); | 297 | closedir(dir); |
299 | } | 298 | } |
300 | 299 | ||
301 | Remote_View->setSorting( 3,FALSE); | 300 | Remote_View->setSorting( 3,FALSE); |
302 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); | 301 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); |
303 | } | 302 | } |
304 | 303 | ||
305 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) { | 304 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) { |
306 | if(selectedItem) { | 305 | if(selectedItem) { |
307 | QString strItem=selectedItem->text(0); | 306 | QString strItem=selectedItem->text(0); |
308 | QString strSize=selectedItem->text(1); | 307 | QString strSize=selectedItem->text(1); |
309 | strSize=strSize.stripWhiteSpace(); | 308 | strSize=strSize.stripWhiteSpace(); |
310 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 309 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
311 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 310 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
312 | if(QDir(strItem2).exists() ) { | 311 | if(QDir(strItem2).exists() ) { |
313 | currentDir.cd(strItem2, TRUE); | 312 | currentDir.cd(strItem2, TRUE); |
314 | populateLocalView(); | 313 | populateLocalView(); |
315 | 314 | ||
316 | } | 315 | } |
317 | } else { // not a symlink | 316 | } else { // not a symlink |
318 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 317 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
319 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 318 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
320 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 319 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
321 | currentDir.cd(strItem,FALSE); | 320 | currentDir.cd(strItem,FALSE); |
322 | populateLocalView(); | 321 | populateLocalView(); |
323 | Local_View->ensureItemVisible(Local_View->firstChild()); | 322 | Local_View->ensureItemVisible(Local_View->firstChild()); |
324 | 323 | ||
325 | } else { | 324 | } else { |
326 | currentDir.cdUp(); | 325 | currentDir.cdUp(); |
327 | populateLocalView(); | 326 | populateLocalView(); |
328 | Local_View->ensureItemVisible(Local_View->firstChild()); | 327 | Local_View->ensureItemVisible(Local_View->firstChild()); |
329 | } | 328 | } |
330 | if(QDir(strItem).exists()){ | 329 | if(QDir(strItem).exists()){ |
331 | currentDir.cd(strItem, TRUE); | 330 | currentDir.cd(strItem, TRUE); |
332 | Local_View->ensureItemVisible(Local_View->firstChild()); | 331 | Local_View->ensureItemVisible(Local_View->firstChild()); |
333 | populateLocalView(); | 332 | populateLocalView(); |
334 | } | 333 | } |
335 | } else { | 334 | } else { |
336 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 335 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
337 | if( QFile::exists(strItem ) ) { | 336 | if( QFile::exists(strItem ) ) { |
338 | // qDebug("clicked item "+strItem); | 337 | // qDebug("clicked item "+strItem); |
339 | // DocLnk doc( strItem, FALSE ); | 338 | // DocLnk doc( strItem, FALSE ); |
340 | // doc.execute(); | 339 | // doc.execute(); |
341 | // Local_View->clearSelection(); | 340 | // Local_View->clearSelection(); |
342 | } | 341 | } |
343 | } //end not symlink | 342 | } //end not symlink |
344 | chdir(strItem.latin1()); | 343 | chdir(strItem.latin1()); |
345 | } | 344 | } |
346 | 345 | ||
347 | } | 346 | } |
348 | } | 347 | } |
349 | 348 | ||
350 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) { | 349 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) { |
351 | 350 | ||
352 | if(selectedItem) { | 351 | if(selectedItem) { |
353 | QString strItem=selectedItem->text(0); | 352 | QString strItem=selectedItem->text(0); |
354 | QString strSize=selectedItem->text(1); | 353 | QString strSize=selectedItem->text(1); |
355 | strSize=strSize.stripWhiteSpace(); | 354 | strSize=strSize.stripWhiteSpace(); |
356 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 355 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
357 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 356 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
358 | currentRemoteDir.cd(strItem2, TRUE); | 357 | currentRemoteDir.cd(strItem2, TRUE); |
359 | populateRemoteView(); | 358 | populateRemoteView(); |
360 | } else { // not a symlink | 359 | } else { // not a symlink |
361 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 360 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
362 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { | 361 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { |
363 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 362 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
364 | currentRemoteDir.cd(strItem,FALSE); | 363 | currentRemoteDir.cd(strItem,FALSE); |
365 | populateRemoteView(); | 364 | populateRemoteView(); |
366 | Remote_View->ensureItemVisible(Remote_View->firstChild()); | 365 | Remote_View->ensureItemVisible(Remote_View->firstChild()); |
367 | } else { | 366 | } else { |
368 | currentRemoteDir.cdUp(); | 367 | currentRemoteDir.cdUp(); |
369 | populateRemoteView(); | 368 | populateRemoteView(); |
370 | Remote_View->ensureItemVisible(Remote_View->firstChild()); | 369 | Remote_View->ensureItemVisible(Remote_View->firstChild()); |
371 | } | 370 | } |
372 | if(QDir(strItem).exists()){ | 371 | if(QDir(strItem).exists()){ |
373 | currentRemoteDir.cd(strItem, TRUE); | 372 | currentRemoteDir.cd(strItem, TRUE); |
374 | populateRemoteView(); | 373 | populateRemoteView(); |
375 | Remote_View->ensureItemVisible(Remote_View->firstChild()); | 374 | Remote_View->ensureItemVisible(Remote_View->firstChild()); |
376 | } | 375 | } |
377 | } else { | 376 | } else { |
378 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 377 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
379 | if( QFile::exists(strItem ) ) { | 378 | if( QFile::exists(strItem ) ) { |
380 | // qDebug("clicked item "+strItem); | 379 | // qDebug("clicked item "+strItem); |
381 | // DocLnk doc( strItem, FALSE ); | 380 | // DocLnk doc( strItem, FALSE ); |
382 | // doc.execute(); | 381 | // doc.execute(); |
383 | // Remote_View->clearSelection(); | 382 | // Remote_View->clearSelection(); |
384 | } | 383 | } |
385 | } //end not symlink | 384 | } //end not symlink |
386 | chdir(strItem.latin1()); | 385 | chdir(strItem.latin1()); |
387 | } | 386 | } |
388 | } | 387 | } |
389 | } | 388 | } |
390 | 389 | ||
391 | 390 | ||
392 | void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 391 | void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
393 | // qDebug("list pressed"); | 392 | // qDebug("list pressed"); |
394 | switch (mouse) { | 393 | switch (mouse) { |
395 | case 1: | 394 | case 1: |
396 | break; | 395 | break; |
397 | case 2: | 396 | case 2: |
398 | menuTimer.start( 750, TRUE ); | 397 | menuTimer.start( 500, TRUE ); |
399 | qDebug("Start menu timer\n"); | 398 | qDebug("Start menu timer\n"); |
400 | break; | 399 | break; |
401 | }; | 400 | }; |
402 | } | 401 | } |
403 | 402 | ||
404 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { | 403 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { |
405 | 404 | ||
406 | switch (mouse) { | 405 | switch (mouse) { |
407 | case 1: | 406 | case 1: |
408 | break; | 407 | break; |
409 | case 2: | 408 | case 2: |
410 | menuTimer.start( 750, TRUE ); | 409 | menuTimer.start( 500, TRUE ); |
411 | qDebug("Start menu timer"); | 410 | qDebug("Start menu timer"); |
412 | break; | 411 | break; |
413 | }; | 412 | }; |
414 | } | 413 | } |
415 | 414 | ||
416 | 415 | ||
417 | void AdvancedFm::switchToLocalTab() { | 416 | void AdvancedFm::switchToLocalTab() { |
418 | TabWidget->setCurrentPage(0); | 417 | TabWidget->setCurrentPage(0); |
419 | Local_View->setFocus(); | 418 | Local_View->setFocus(); |
420 | } | 419 | } |
421 | 420 | ||
422 | void AdvancedFm::switchToRemoteTab() { | 421 | void AdvancedFm::switchToRemoteTab() { |
423 | TabWidget->setCurrentPage(1); | 422 | TabWidget->setCurrentPage(1); |
424 | Remote_View->setFocus(); | 423 | Remote_View->setFocus(); |
425 | } | 424 | } |
426 | 425 | ||
427 | void AdvancedFm::readConfig() { | 426 | void AdvancedFm::readConfig() { |
428 | Config cfg("AdvancedFm"); | 427 | Config cfg("AdvancedFm"); |
429 | } | 428 | } |
430 | 429 | ||
431 | void AdvancedFm::writeConfig() { | 430 | void AdvancedFm::writeConfig() { |
432 | Config cfg("AdvancedFm"); | 431 | Config cfg("AdvancedFm"); |
433 | } | 432 | } |
434 | 433 | ||
435 | void AdvancedFm::currentPathComboChanged() { | 434 | void AdvancedFm::currentPathComboChanged() { |
436 | if (TabWidget->currentPageIndex() == 0) { | 435 | if (TabWidget->currentPageIndex() == 0) { |
437 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 436 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
438 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 437 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
439 | populateLocalView(); | 438 | populateLocalView(); |
440 | } else { | 439 | } else { |
441 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 440 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
442 | } | 441 | } |
443 | } | 442 | } |
444 | if (TabWidget->currentPageIndex() == 0) { | 443 | if (TabWidget->currentPageIndex() == 0) { |
445 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 444 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
446 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); | 445 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); |
447 | populateRemoteView(); | 446 | populateRemoteView(); |
448 | } else { | 447 | } else { |
449 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 448 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
450 | } | 449 | } |
451 | } | 450 | } |
452 | } | 451 | } |
453 | 452 | ||
454 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 453 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
455 | 454 | ||
456 | if (TabWidget->currentPageIndex() == 0) { | 455 | if (TabWidget->currentPageIndex() == 0) { |
457 | currentPathCombo->lineEdit()->setText( currentPath); | 456 | currentPathCombo->lineEdit()->setText( currentPath); |
458 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 457 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
459 | currentPathCombo->clear(); | 458 | currentPathCombo->clear(); |
460 | localDirPathStringList.prepend( currentPath ); | 459 | localDirPathStringList.prepend( currentPath ); |
461 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 460 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
462 | } | 461 | } |
463 | } else { | 462 | } else { |
464 | currentPathCombo->lineEdit()->setText( currentPath); | 463 | currentPathCombo->lineEdit()->setText( currentPath); |
465 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 464 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
466 | currentPathCombo->clear(); | 465 | currentPathCombo->clear(); |
467 | remoteDirPathStringList.prepend( currentPath ); | 466 | remoteDirPathStringList.prepend( currentPath ); |
468 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 467 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
469 | } | 468 | } |
470 | } | 469 | } |
471 | } | 470 | } |
472 | 471 | ||
473 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 472 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
474 | if (TabWidget->currentPageIndex() == 0) { | 473 | if (TabWidget->currentPageIndex() == 0) { |
475 | chdir( currentPath.latin1() ); | 474 | chdir( currentPath.latin1() ); |
476 | currentDir.cd( currentPath, TRUE); | 475 | currentDir.cd( currentPath, TRUE); |
477 | populateLocalView(); | 476 | populateLocalView(); |
478 | update(); | 477 | update(); |
479 | } else { | 478 | } else { |
480 | chdir( currentPath.latin1() ); | 479 | chdir( currentPath.latin1() ); |
481 | currentRemoteDir.cd( currentPath, TRUE); | 480 | currentRemoteDir.cd( currentPath, TRUE); |
482 | populateRemoteView(); | 481 | populateRemoteView(); |
483 | update(); | 482 | update(); |
484 | } | 483 | } |
485 | } | 484 | } |
486 | 485 | ||
487 | QStringList AdvancedFm::getPath() { | 486 | QStringList AdvancedFm::getPath() { |
488 | QStringList strList; | 487 | QStringList strList; |
489 | if (TabWidget->currentPageIndex() == 0) { | 488 | if (TabWidget->currentPageIndex() == 0) { |
490 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 489 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
491 | QListViewItemIterator it( Local_View ); | 490 | QListViewItemIterator it( Local_View ); |
492 | for ( ; it.current(); ++it ) { | 491 | for ( ; it.current(); ++it ) { |
493 | if ( it.current()->isSelected() ) { | 492 | if ( it.current()->isSelected() ) { |
494 | strList << it.current()->text(0); | 493 | strList << it.current()->text(0); |
495 | qDebug(it.current()->text(0)); | 494 | qDebug(it.current()->text(0)); |
496 | } | 495 | } |
497 | } | 496 | } |
498 | return strList; | 497 | return strList; |
499 | } else { | 498 | } else { |
500 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 499 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
501 | QListViewItemIterator it( Remote_View ); | 500 | QListViewItemIterator it( Remote_View ); |
502 | for ( ; it.current(); ++it ) { | 501 | for ( ; it.current(); ++it ) { |
503 | if ( it.current()->isSelected() ) { | 502 | if ( it.current()->isSelected() ) { |
504 | strList << it.current()->text(0); | 503 | strList << it.current()->text(0); |
505 | qDebug(it.current()->text(0)); | 504 | qDebug(it.current()->text(0)); |
506 | } | 505 | } |
507 | } | 506 | } |
508 | return strList; | 507 | return strList; |
509 | } | 508 | } |
510 | return ""; | 509 | return ""; |
511 | } | 510 | } |
512 | 511 | ||
513 | void AdvancedFm::homeButtonPushed() { | 512 | void AdvancedFm::homeButtonPushed() { |
514 | QString current = QDir::homeDirPath(); | 513 | QString current = QDir::homeDirPath(); |
515 | chdir( current.latin1() ); | 514 | chdir( current.latin1() ); |
516 | if (TabWidget->currentPageIndex() == 0) { | 515 | if (TabWidget->currentPageIndex() == 0) { |
517 | currentDir.cd( current, TRUE); | 516 | currentDir.cd( current, TRUE); |
518 | populateLocalView(); | 517 | populateLocalView(); |
519 | } else { | 518 | } else { |
520 | currentRemoteDir.cd( current, TRUE); | 519 | currentRemoteDir.cd( current, TRUE); |
521 | populateRemoteView(); | 520 | populateRemoteView(); |
522 | } | 521 | } |
523 | update(); | 522 | update(); |
524 | } | 523 | } |
525 | 524 | ||
526 | void AdvancedFm::docButtonPushed() { | 525 | void AdvancedFm::docButtonPushed() { |
527 | QString current = QPEApplication::documentDir(); | 526 | QString current = QPEApplication::documentDir(); |
528 | chdir( current.latin1() ); | 527 | chdir( current.latin1() ); |
529 | if (TabWidget->currentPageIndex() == 0) { | 528 | if (TabWidget->currentPageIndex() == 0) { |
530 | currentDir.cd( current, TRUE); | 529 | currentDir.cd( current, TRUE); |
531 | populateLocalView(); | 530 | populateLocalView(); |
532 | } else { | 531 | } else { |
533 | currentRemoteDir.cd( current, TRUE); | 532 | currentRemoteDir.cd( current, TRUE); |
534 | populateRemoteView(); | 533 | populateRemoteView(); |
535 | } | 534 | } |
536 | update(); | 535 | update(); |
537 | } | 536 | } |
538 | 537 | ||
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 12ad474..f846c66 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -1,142 +1,143 @@ | |||
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 | 16 | ||
16 | #include <qpe/ir.h> | 17 | #include <qpe/ir.h> |
17 | 18 | ||
18 | #include <qvariant.h> | 19 | #include <qvariant.h> |
19 | #include <qdialog.h> | 20 | #include <qdialog.h> |
20 | #include <qmainwindow.h> | 21 | #include <qmainwindow.h> |
21 | #include <qstringlist.h> | 22 | #include <qstringlist.h> |
22 | #include <qdir.h> | 23 | #include <qdir.h> |
23 | #include <qstring.h> | 24 | #include <qstring.h> |
24 | #include <qpoint.h> | 25 | #include <qpoint.h> |
25 | #include <qtimer.h> | 26 | #include <qtimer.h> |
26 | 27 | ||
27 | class QVBoxLayout; | 28 | class QVBoxLayout; |
28 | class QHBoxLayout; | 29 | class QHBoxLayout; |
29 | class QGridLayout; | 30 | class QGridLayout; |
30 | class QComboBox; | 31 | class QComboBox; |
31 | class QListView; | 32 | class QListView; |
32 | class QListviewItem; | 33 | class QListviewItem; |
33 | class QLabel; | 34 | class QLabel; |
34 | class QProgressBar; | 35 | class QProgressBar; |
35 | class QSpinBox; | 36 | class QSpinBox; |
36 | class QTabWidget; | 37 | class QTabWidget; |
37 | class QWidget; | 38 | class QWidget; |
38 | class QPEToolBar; | 39 | class QPEToolBar; |
39 | class QPEMenuBar; | 40 | class QPEMenuBar; |
40 | class QPopupMenu; | 41 | class QPopupMenu; |
41 | class QFile; | 42 | class QFile; |
42 | class QListViewItem; | 43 | class QListViewItem; |
43 | class QLineEdit; | 44 | class QLineEdit; |
44 | //class QPushButton; | 45 | //class QPushButton; |
45 | class QToolButton; | 46 | class QToolButton; |
46 | class Ir; | 47 | class Ir; |
47 | 48 | ||
48 | class AdvancedFm : public QMainWindow | 49 | class AdvancedFm : public QMainWindow |
49 | { | 50 | { |
50 | Q_OBJECT | 51 | Q_OBJECT |
51 | public: | 52 | public: |
52 | AdvancedFm(); | 53 | AdvancedFm(); |
53 | ~AdvancedFm(); | 54 | ~AdvancedFm(); |
54 | 55 | ||
55 | QTabWidget *TabWidget; | 56 | QTabWidget *TabWidget; |
56 | QWidget *tab, *tab_2, *tab_3; | 57 | QWidget *tab, *tab_2, *tab_3; |
57 | QListView *Local_View, *Remote_View; | 58 | QListView *Local_View, *Remote_View; |
58 | 59 | ||
59 | QLineEdit *currentPathEdit; | 60 | QLineEdit *currentPathEdit; |
60 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; | 61 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; |
61 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 62 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
62 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 63 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
63 | QDir currentDir, currentRemoteDir; | 64 | QDir currentDir, currentRemoteDir; |
64 | QComboBox *currentPathCombo; | 65 | QComboBox *currentPathCombo; |
65 | QString filterStr; | 66 | QString filterStr; |
66 | QListViewItem * item; | 67 | QListViewItem * item; |
67 | bool b; | 68 | bool b; |
68 | QStringList fileSystemTypeList, fsList; | 69 | QStringList fileSystemTypeList, fsList; |
69 | int currentServerConfig; | 70 | int currentServerConfig; |
70 | protected slots: | 71 | protected slots: |
71 | void addToDocs(); | 72 | void addToDocs(); |
72 | void doLocalCd(); | 73 | void doLocalCd(); |
73 | void doRemoteCd(); | 74 | void doRemoteCd(); |
74 | // void copy(); | 75 | // void copy(); |
75 | void mkDir(); | 76 | void mkDir(); |
76 | void del(); | 77 | void del(); |
77 | void rn(); | 78 | void rn(); |
78 | void populateLocalView(); | 79 | void populateLocalView(); |
79 | void populateRemoteView(); | 80 | void populateRemoteView(); |
80 | void showHidden(); | 81 | void showHidden(); |
81 | void showMenuHidden(); | 82 | void showMenuHidden(); |
82 | void showRemoteHidden(); | 83 | void showRemoteHidden(); |
83 | void writeConfig(); | 84 | void writeConfig(); |
84 | void readConfig(); | 85 | void readConfig(); |
85 | void localListClicked(QListViewItem *); | 86 | void localListClicked(QListViewItem *); |
86 | void remoteListClicked(QListViewItem *); | 87 | void remoteListClicked(QListViewItem *); |
87 | void localListPressed( int, QListViewItem *, const QPoint&, int); | 88 | void localListPressed( int, QListViewItem *, const QPoint&, int); |
88 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); | 89 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); |
89 | void localMakDir(); | 90 | void localMakDir(); |
90 | void localDelete(); | 91 | void localDelete(); |
91 | void remoteMakDir(); | 92 | void remoteMakDir(); |
92 | void remoteDelete(); | 93 | void remoteDelete(); |
93 | /* bool remoteDirList(const QString &); */ | 94 | /* bool remoteDirList(const QString &); */ |
94 | /* bool remoteChDir(const QString &); */ | 95 | /* bool remoteChDir(const QString &); */ |
95 | void tabChanged(QWidget*); | 96 | void tabChanged(QWidget*); |
96 | void cleanUp(); | 97 | void cleanUp(); |
97 | void remoteRename(); | 98 | void remoteRename(); |
98 | void localRename(); | 99 | void localRename(); |
99 | void runThis(); | 100 | void runThis(); |
100 | void runText(); | 101 | void runText(); |
101 | void filePerms(); | 102 | void filePerms(); |
102 | void doProperties(); | 103 | void doProperties(); |
103 | void runCommand(); | 104 | void runCommand(); |
104 | void runCommandStd(); | 105 | void runCommandStd(); |
105 | QStringList getPath(); | 106 | QStringList getPath(); |
106 | void mkSym(); | 107 | void mkSym(); |
107 | void switchToLocalTab(); | 108 | void switchToLocalTab(); |
108 | void switchToRemoteTab(); | 109 | void switchToRemoteTab(); |
109 | 110 | ||
110 | protected: | 111 | protected: |
111 | bool zaurusDevice; | 112 | bool zaurusDevice; |
112 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 113 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
113 | QStringList remoteDirPathStringList, localDirPathStringList; | 114 | QStringList remoteDirPathStringList, localDirPathStringList; |
114 | 115 | ||
115 | void init(); | 116 | void init(); |
116 | void initConnections(); | 117 | void initConnections(); |
117 | void keyReleaseEvent( QKeyEvent *); | 118 | void keyReleaseEvent( QKeyEvent *); |
118 | QString getFileSystemType(const QString &); | 119 | QString getFileSystemType(const QString &); |
119 | QString getDiskSpace(const QString &); | 120 | QString getDiskSpace(const QString &); |
120 | void parsetab(const QString &fileName); | 121 | void parsetab(const QString &fileName); |
121 | QString checkDiskSpace(const QString &); | 122 | QString checkDiskSpace(const QString &); |
122 | 123 | ||
123 | protected slots: | 124 | protected slots: |
124 | void showFileMenu(); | 125 | void showFileMenu(); |
125 | void cancelMenuTimer(); | 126 | void cancelMenuTimer(); |
126 | void homeButtonPushed(); | 127 | void homeButtonPushed(); |
127 | void docButtonPushed(); | 128 | void docButtonPushed(); |
128 | void SDButtonPushed(); | 129 | void SDButtonPushed(); |
129 | void CFButtonPushed(); | 130 | void CFButtonPushed(); |
130 | void QPEButtonPushed(); | 131 | void QPEButtonPushed(); |
131 | void upDir(); | 132 | void upDir(); |
132 | void currentPathComboChanged(); | 133 | void currentPathComboChanged(); |
133 | void copy(); | 134 | void copy(); |
134 | void copyAs(); | 135 | void copyAs(); |
135 | void copySameDir(); | 136 | void copySameDir(); |
136 | void currentPathComboActivated(const QString &); | 137 | void currentPathComboActivated(const QString &); |
137 | void fillCombo(const QString &); | 138 | void fillCombo(const QString &); |
138 | bool copyFile( const QString & , const QString & ); | 139 | bool copyFile( const QString & , const QString & ); |
139 | void move(); | 140 | void move(); |
140 | void fileStatus(); | 141 | void fileStatus(); |
141 | void doAbout(); | 142 | void doAbout(); |
142 | void doBeam(); | 143 | void doBeam(); |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 4c24e83..619a7a9 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -1,162 +1,164 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | advancedfmData.cpp | 2 | advancedfmData.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Mon 09-23-2002 13:24:11 | 4 | ** Created: Mon 09-23-2002 13:24:11 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #include "advancedfm.h" | 12 | #include "advancedfm.h" |
13 | 13 | ||
14 | #include <qpe/qpeapplication.h> | 14 | #include <qpe/qpeapplication.h> |
15 | #include <qpe/qpemenubar.h> | 15 | #include <qpe/qpemenubar.h> |
16 | #include <qpe/qpetoolbar.h> | 16 | #include <qpe/qpetoolbar.h> |
17 | #include <qpe/resource.h> | 17 | #include <qpe/resource.h> |
18 | 18 | ||
19 | #include <qlayout.h> | 19 | #include <qlayout.h> |
20 | #include <qpixmap.h> | 20 | #include <qpixmap.h> |
21 | #include <qcombobox.h> | 21 | #include <qcombobox.h> |
22 | #include <qpopupmenu.h> | 22 | #include <qpopupmenu.h> |
23 | #include <qtabwidget.h> | 23 | #include <qtabwidget.h> |
24 | #include <qtoolbutton.h> | 24 | #include <qtoolbutton.h> |
25 | #include <qtabwidget.h> | 25 | #include <qtabwidget.h> |
26 | #include <qlineedit.h> | 26 | #include <qlineedit.h> |
27 | #include <qlistview.h> | 27 | #include <qlistview.h> |
28 | 28 | ||
29 | #include <sys/utsname.h> | 29 | #include <sys/utsname.h> |
30 | 30 | ||
31 | 31 | ||
32 | void AdvancedFm::init() { | 32 | void AdvancedFm::init() { |
33 | 33 | #if defined(QT_QWS_OPIE) | |
34 | setCaption( tr( "AdvancedFm" ) ); | 34 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); |
35 | #endif | ||
36 | setCaption( tr( "AdvancedFm" ) ); | ||
35 | 37 | ||
36 | QGridLayout *layout = new QGridLayout( this ); | 38 | QGridLayout *layout = new QGridLayout( this ); |
37 | layout->setSpacing( 2); | 39 | layout->setSpacing( 2); |
38 | layout->setMargin( 2); | 40 | layout->setMargin( 2); |
39 | 41 | ||
40 | 42 | ||
41 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 43 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
42 | fileMenu = new QPopupMenu( this ); | 44 | fileMenu = new QPopupMenu( this ); |
43 | viewMenu = new QPopupMenu( this ); | 45 | viewMenu = new QPopupMenu( this ); |
44 | 46 | ||
45 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 47 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
46 | 48 | ||
47 | menuBar->insertItem( tr( "File" ), fileMenu); | 49 | menuBar->insertItem( tr( "File" ), fileMenu); |
48 | menuBar->insertItem( tr( "View" ), viewMenu); | 50 | menuBar->insertItem( tr( "View" ), viewMenu); |
49 | 51 | ||
50 | qpeDirButton= new QToolButton(this,"QPEButton"); | 52 | qpeDirButton= new QToolButton(this,"QPEButton"); |
51 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 53 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
52 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | 54 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); |
53 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | 55 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); |
54 | 56 | ||
55 | cfButton = new QToolButton( this,"CFButton"); | 57 | cfButton = new QToolButton( this,"CFButton"); |
56 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 58 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
57 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 59 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
58 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); | 60 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); |
59 | 61 | ||
60 | sdButton = new QToolButton( this,"SDButton"); | 62 | sdButton = new QToolButton( this,"SDButton"); |
61 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); | 63 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); |
62 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 64 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
63 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); | 65 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); |
64 | 66 | ||
65 | cdUpButton = new QToolButton( this,"cdUpButton"); | 67 | cdUpButton = new QToolButton( this,"cdUpButton"); |
66 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 68 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
67 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 69 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
68 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); | 70 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); |
69 | 71 | ||
70 | docButton = new QToolButton( this,"docsButton"); | 72 | docButton = new QToolButton( this,"docsButton"); |
71 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 73 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
72 | docButton->setFixedSize( QSize( 20, 20 ) ); | 74 | docButton->setFixedSize( QSize( 20, 20 ) ); |
73 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); | 75 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); |
74 | 76 | ||
75 | homeButton = new QToolButton( this,"homeButton"); | 77 | homeButton = new QToolButton( this,"homeButton"); |
76 | homeButton->setPixmap(Resource::loadPixmap("home")); | 78 | homeButton->setPixmap(Resource::loadPixmap("home")); |
77 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 79 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
78 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); | 80 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); |
79 | 81 | ||
80 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 82 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); |
81 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 83 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
82 | fileMenu->insertSeparator(); | 84 | fileMenu->insertSeparator(); |
83 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 85 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
84 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 86 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
85 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 87 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
86 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 88 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
87 | fileMenu->insertSeparator(); | 89 | fileMenu->insertSeparator(); |
88 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 90 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
89 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 91 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
90 | fileMenu->setCheckable(TRUE); | 92 | fileMenu->setCheckable(TRUE); |
91 | 93 | ||
92 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 94 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
93 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 95 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
94 | viewMenu->insertSeparator(); | 96 | viewMenu->insertSeparator(); |
95 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 97 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
96 | viewMenu->setCheckable(TRUE); | 98 | viewMenu->setCheckable(TRUE); |
97 | 99 | ||
98 | 100 | ||
99 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 101 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
100 | currentPathCombo->setEditable(TRUE); | 102 | currentPathCombo->setEditable(TRUE); |
101 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 103 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
102 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 104 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
103 | 105 | ||
104 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 106 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
105 | 107 | ||
106 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 108 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
107 | 109 | ||
108 | 110 | ||
109 | TabWidget = new QTabWidget( this, "TabWidget" ); | 111 | TabWidget = new QTabWidget( this, "TabWidget" ); |
110 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); | 112 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); |
111 | 113 | ||
112 | tab = new QWidget( TabWidget, "tab" ); | 114 | tab = new QWidget( TabWidget, "tab" ); |
113 | tabLayout = new QGridLayout( tab ); | 115 | tabLayout = new QGridLayout( tab ); |
114 | tabLayout->setSpacing( 2); | 116 | tabLayout->setSpacing( 2); |
115 | tabLayout->setMargin( 2); | 117 | tabLayout->setMargin( 2); |
116 | 118 | ||
117 | Local_View = new QListView( tab, "Local_View" ); | 119 | Local_View = new QListView( tab, "Local_View" ); |
118 | Local_View->addColumn( tr("File"),130); | 120 | Local_View->addColumn( tr("File"),130); |
119 | Local_View->addColumn( tr("Size"),-1); | 121 | Local_View->addColumn( tr("Size"),-1); |
120 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 122 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
121 | Local_View->addColumn( tr("Date"),-1); | 123 | Local_View->addColumn( tr("Date"),-1); |
122 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 124 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
123 | Local_View->setAllColumnsShowFocus(TRUE); | 125 | Local_View->setAllColumnsShowFocus(TRUE); |
124 | Local_View->setMultiSelection( TRUE ); | 126 | Local_View->setMultiSelection( TRUE ); |
125 | Local_View->setSelectionMode(QListView::Extended); | 127 | Local_View->setSelectionMode(QListView::Extended); |
126 | 128 | ||
127 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 129 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
128 | 130 | ||
129 | tabLayout->addWidget( Local_View, 0, 0 ); | 131 | tabLayout->addWidget( Local_View, 0, 0 ); |
130 | 132 | ||
131 | TabWidget->insertTab( tab, tr("1")); | 133 | TabWidget->insertTab( tab, tr("1")); |
132 | 134 | ||
133 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 135 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
134 | tabLayout_2 = new QGridLayout( tab_2 ); | 136 | tabLayout_2 = new QGridLayout( tab_2 ); |
135 | tabLayout_2->setSpacing( 2); | 137 | tabLayout_2->setSpacing( 2); |
136 | tabLayout_2->setMargin( 2); | 138 | tabLayout_2->setMargin( 2); |
137 | 139 | ||
138 | Remote_View = new QListView( tab_2, "Remote_View" ); | 140 | Remote_View = new QListView( tab_2, "Remote_View" ); |
139 | Remote_View->addColumn( tr("File"),130); | 141 | Remote_View->addColumn( tr("File"),130); |
140 | Remote_View->addColumn( tr("Size"),-1); | 142 | Remote_View->addColumn( tr("Size"),-1); |
141 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 143 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
142 | Remote_View->addColumn( tr("Date"),-1); | 144 | Remote_View->addColumn( tr("Date"),-1); |
143 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 145 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
144 | Remote_View->setAllColumnsShowFocus(TRUE); | 146 | Remote_View->setAllColumnsShowFocus(TRUE); |
145 | Remote_View->setMultiSelection( TRUE ); | 147 | Remote_View->setMultiSelection( TRUE ); |
146 | Remote_View->setSelectionMode(QListView::Extended); | 148 | Remote_View->setSelectionMode(QListView::Extended); |
147 | 149 | ||
148 | 150 | ||
149 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 151 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
150 | 152 | ||
151 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 153 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
152 | 154 | ||
153 | 155 | ||
154 | TabWidget->insertTab( tab_2, tr( "2")); | 156 | TabWidget->insertTab( tab_2, tr( "2")); |
155 | 157 | ||
156 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 158 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
157 | tabLayout_3 = new QGridLayout( tab_3 ); | 159 | tabLayout_3 = new QGridLayout( tab_3 ); |
158 | tabLayout_3->setSpacing( 2); | 160 | tabLayout_3->setSpacing( 2); |
159 | tabLayout_3->setMargin( 2); | 161 | tabLayout_3->setMargin( 2); |
160 | 162 | ||
161 | 163 | ||
162 | // OFileDialog fileDialog; | 164 | // OFileDialog fileDialog; |
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 7ee5065..6d37904 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -218,271 +218,277 @@ void AdvancedFm::localDelete() { | |||
218 | // system( cmd.latin1()); | 218 | // system( cmd.latin1()); |
219 | populateLocalView(); | 219 | populateLocalView(); |
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 | } | 227 | } |
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | void AdvancedFm::remoteDelete() { | 231 | void AdvancedFm::remoteDelete() { |
232 | QStringList curFileList = getPath(); | 232 | QStringList curFileList = getPath(); |
233 | if( curFileList.count() > 0) { | 233 | if( curFileList.count() > 0) { |
234 | QString myFile; | 234 | QString myFile; |
235 | 235 | ||
236 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 236 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
237 | myFile = (*it); | 237 | myFile = (*it); |
238 | if(myFile.find(" -> ",0,TRUE) != -1) | 238 | if(myFile.find(" -> ",0,TRUE) != -1) |
239 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 239 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
240 | QString f = currentRemoteDir.canonicalPath(); | 240 | QString f = currentRemoteDir.canonicalPath(); |
241 | if(f.right(1).find("/",0,TRUE) == -1) | 241 | if(f.right(1).find("/",0,TRUE) == -1) |
242 | f+="/"; | 242 | f+="/"; |
243 | f+=myFile; | 243 | f+=myFile; |
244 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 244 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
245 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 245 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
246 | "\nand all it's contents ?", | 246 | "\nand all it's contents ?", |
247 | tr("Yes"),tr("No"),0,0,1) ) { | 247 | tr("Yes"),tr("No"),0,0,1) ) { |
248 | case 0: { | 248 | case 0: { |
249 | f=f.left(f.length()-1); | 249 | f=f.left(f.length()-1); |
250 | QString cmd="rm -rf "+f; | 250 | QString cmd="rm -rf "+f; |
251 | system( cmd.latin1()); | 251 | system( cmd.latin1()); |
252 | populateRemoteView(); | 252 | populateRemoteView(); |
253 | } | 253 | } |
254 | break; | 254 | break; |
255 | case 1: | 255 | case 1: |
256 | // exit | 256 | // exit |
257 | break; | 257 | break; |
258 | }; | 258 | }; |
259 | 259 | ||
260 | } else { | 260 | } else { |
261 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 261 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
262 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 262 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
263 | case 0: { | 263 | case 0: { |
264 | QString cmd="rm "+f; | 264 | QString cmd="rm "+f; |
265 | QFile file(f); | 265 | QFile file(f); |
266 | file.remove(); | 266 | file.remove(); |
267 | // system( cmd.latin1()); | 267 | // system( cmd.latin1()); |
268 | populateRemoteView(); | 268 | populateRemoteView(); |
269 | } | 269 | } |
270 | break; | 270 | break; |
271 | case 1: | 271 | case 1: |
272 | // exit | 272 | // exit |
273 | break; | 273 | break; |
274 | }; | 274 | }; |
275 | } | 275 | } |
276 | } | 276 | } |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
280 | void AdvancedFm::localRename() { | 280 | void AdvancedFm::localRename() { |
281 | QString curFile = Local_View->currentItem()->text(0); | 281 | QString curFile = Local_View->currentItem()->text(0); |
282 | qDebug("currentItem "+curFile); | 282 | qDebug("currentItem "+curFile); |
283 | if( curFile !="../") { | 283 | if( curFile !="../") { |
284 | InputDialog *fileDlg; | 284 | InputDialog *fileDlg; |
285 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 285 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
286 | fileDlg->setInputText((const QString &)curFile); | 286 | fileDlg->setInputText((const QString &)curFile); |
287 | fileDlg->exec(); | 287 | fileDlg->exec(); |
288 | if( fileDlg->result() == 1 ) { | 288 | if( fileDlg->result() == 1 ) { |
289 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 289 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
290 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); | 290 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); |
291 | //+".playlist"; | 291 | //+".playlist"; |
292 | if( rename(oldname.latin1(), newName.latin1())== -1) | 292 | if( rename(oldname.latin1(), newName.latin1())== -1) |
293 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 293 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
294 | } | 294 | } |
295 | populateLocalView(); | 295 | populateLocalView(); |
296 | } | 296 | } |
297 | } | 297 | } |
298 | 298 | ||
299 | void AdvancedFm::remoteRename() | 299 | void AdvancedFm::remoteRename() |
300 | { | 300 | { |
301 | QString curFile = Remote_View->currentItem()->text(0); | 301 | QString curFile = Remote_View->currentItem()->text(0); |
302 | if( curFile !="../") { | 302 | if( curFile !="../") { |
303 | InputDialog *fileDlg; | 303 | InputDialog *fileDlg; |
304 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 304 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
305 | fileDlg->setInputText((const QString &)curFile); | 305 | fileDlg->setInputText((const QString &)curFile); |
306 | fileDlg->exec(); | 306 | fileDlg->exec(); |
307 | if( fileDlg->result() == 1 ) { | 307 | if( fileDlg->result() == 1 ) { |
308 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 308 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
309 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); | 309 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); |
310 | //+".playlist"; | 310 | //+".playlist"; |
311 | if( rename(oldname.latin1(), newName.latin1())== -1) | 311 | if( rename(oldname.latin1(), newName.latin1())== -1) |
312 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 312 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
313 | } | 313 | } |
314 | populateRemoteView(); | 314 | populateRemoteView(); |
315 | } | 315 | } |
316 | } | 316 | } |
317 | 317 | ||
318 | 318 | ||
319 | void AdvancedFm::filePerms() { | 319 | void AdvancedFm::filePerms() { |
320 | 320 | ||
321 | QStringList curFileList = getPath(); | 321 | QStringList curFileList = getPath(); |
322 | QString filePath; | 322 | QString filePath; |
323 | 323 | ||
324 | if (TabWidget->currentPageIndex() == 0) { | 324 | if (TabWidget->currentPageIndex() == 0) { |
325 | filePath = currentDir.canonicalPath()+"/"; | 325 | filePath = currentDir.canonicalPath()+"/"; |
326 | } else { | 326 | } else { |
327 | filePath= currentRemoteDir.canonicalPath()+"/"; | 327 | filePath= currentRemoteDir.canonicalPath()+"/"; |
328 | } | 328 | } |
329 | 329 | ||
330 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 330 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
331 | filePermissions *filePerm; | 331 | filePermissions *filePerm; |
332 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 332 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
333 | filePerm->showMaximized(); | 333 | filePerm->showMaximized(); |
334 | filePerm->exec(); | 334 | filePerm->exec(); |
335 | if( filePerm) | 335 | if( filePerm) |
336 | delete filePerm; | 336 | delete filePerm; |
337 | } | 337 | } |
338 | if (TabWidget->currentPageIndex() == 0) { | 338 | if (TabWidget->currentPageIndex() == 0) { |
339 | populateLocalView(); | 339 | populateLocalView(); |
340 | } else { | 340 | } else { |
341 | populateRemoteView(); | 341 | populateRemoteView(); |
342 | } | 342 | } |
343 | } | 343 | } |
344 | 344 | ||
345 | void AdvancedFm::doProperties() { | 345 | void AdvancedFm::doProperties() { |
346 | #if defined(QT_QWS_OPIE) | ||
347 | |||
346 | QStringList curFileList = getPath(); | 348 | QStringList curFileList = getPath(); |
349 | |||
347 | QString filePath; | 350 | QString filePath; |
348 | if (TabWidget->currentPageIndex() == 0) { | 351 | if (TabWidget->currentPageIndex() == 0) { |
349 | filePath = currentDir.canonicalPath()+"/"; | 352 | filePath = currentDir.canonicalPath()+"/"; |
350 | } else { | 353 | } else { |
351 | filePath= currentRemoteDir.canonicalPath()+"/"; | 354 | filePath= currentRemoteDir.canonicalPath()+"/"; |
352 | } | 355 | } |
353 | // qDebug("%d",curFileList.count()); | 356 | qDebug("%d",curFileList.count()); |
354 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 357 | |
358 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | ||
355 | qDebug((filePath+*it)); | 359 | qDebug((filePath+*it)); |
356 | DocLnk lnk( (filePath+*it)); | 360 | DocLnk lnk( (filePath+*it)); |
357 | LnkProperties prop( &lnk ); | 361 | LnkProperties prop( &lnk ); |
358 | prop.showMaximized(); | 362 | prop.showMaximized(); |
359 | prop.exec(); | 363 | prop.exec(); |
360 | } | 364 | } |
365 | #endif | ||
366 | |||
361 | } | 367 | } |
362 | 368 | ||
363 | void AdvancedFm::upDir() { | 369 | void AdvancedFm::upDir() { |
364 | if (TabWidget->currentPageIndex() == 0) { | 370 | if (TabWidget->currentPageIndex() == 0) { |
365 | QString current = currentDir.canonicalPath(); | 371 | QString current = currentDir.canonicalPath(); |
366 | QDir dir(current); | 372 | QDir dir(current); |
367 | dir.cdUp(); | 373 | dir.cdUp(); |
368 | current = dir.canonicalPath(); | 374 | current = dir.canonicalPath(); |
369 | chdir( current.latin1() ); | 375 | chdir( current.latin1() ); |
370 | currentDir.cd( current, TRUE); | 376 | currentDir.cd( current, TRUE); |
371 | populateLocalView(); | 377 | populateLocalView(); |
372 | update(); | 378 | update(); |
373 | } else { | 379 | } else { |
374 | QString current = currentRemoteDir.canonicalPath(); | 380 | QString current = currentRemoteDir.canonicalPath(); |
375 | QDir dir(current); | 381 | QDir dir(current); |
376 | dir.cdUp(); | 382 | dir.cdUp(); |
377 | current = dir.canonicalPath(); | 383 | current = dir.canonicalPath(); |
378 | chdir( current.latin1() ); | 384 | chdir( current.latin1() ); |
379 | currentRemoteDir.cd( current, TRUE); | 385 | currentRemoteDir.cd( current, TRUE); |
380 | populateRemoteView(); | 386 | populateRemoteView(); |
381 | update(); | 387 | update(); |
382 | } | 388 | } |
383 | } | 389 | } |
384 | 390 | ||
385 | void AdvancedFm::copy() { | 391 | void AdvancedFm::copy() { |
386 | qApp->processEvents(); | 392 | qApp->processEvents(); |
387 | QStringList curFileList = getPath(); | 393 | QStringList curFileList = getPath(); |
388 | if( curFileList.count() > 0) { | 394 | if( curFileList.count() > 0) { |
389 | QString curFile, item, destFile; | 395 | QString curFile, item, destFile; |
390 | if (TabWidget->currentPageIndex() == 0) { | 396 | if (TabWidget->currentPageIndex() == 0) { |
391 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 397 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
392 | item=(*it); | 398 | item=(*it); |
393 | 399 | ||
394 | if(item.find("->",0,TRUE)) //symlink | 400 | if(item.find("->",0,TRUE)) //symlink |
395 | item = item.left(item.find("->",0,TRUE)); | 401 | item = item.left(item.find("->",0,TRUE)); |
396 | 402 | ||
397 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; | 403 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; |
398 | qDebug("Destination file is "+destFile); | 404 | qDebug("Destination file is "+destFile); |
399 | 405 | ||
400 | curFile = currentDir.canonicalPath()+"/"+ item; | 406 | curFile = currentDir.canonicalPath()+"/"+ item; |
401 | qDebug("CurrentFile file is " + curFile); | 407 | qDebug("CurrentFile file is " + curFile); |
402 | 408 | ||
403 | QFile f(destFile); | 409 | QFile f(destFile); |
404 | if( f.exists()) { | 410 | if( f.exists()) { |
405 | switch ( QMessageBox::warning(this,tr("Delete"), | 411 | switch ( QMessageBox::warning(this,tr("Delete"), |
406 | destFile+tr(" already exists\nDo you really want to delete it?"), | 412 | destFile+tr(" already exists\nDo you really want to delete it?"), |
407 | tr("Yes"),tr("No"),0,0,1) ) { | 413 | tr("Yes"),tr("No"),0,0,1) ) { |
408 | case 0: | 414 | case 0: |
409 | f.remove(); | 415 | f.remove(); |
410 | break; | 416 | break; |
411 | case 1: | 417 | case 1: |
412 | return; | 418 | return; |
413 | break; | 419 | break; |
414 | }; | 420 | }; |
415 | } | 421 | } |
416 | if(!copyFile(destFile, curFile) ) { | 422 | if(!copyFile(destFile, curFile) ) { |
417 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 423 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
418 | return; | 424 | return; |
419 | } | 425 | } |
420 | } | 426 | } |
421 | populateRemoteView(); | 427 | populateRemoteView(); |
422 | TabWidget->setCurrentPage(1); | 428 | TabWidget->setCurrentPage(1); |
423 | 429 | ||
424 | } else { | 430 | } else { |
425 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 431 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
426 | item= (*it); | 432 | item= (*it); |
427 | 433 | ||
428 | if(item.find("->",0,TRUE)) //symlink | 434 | if(item.find("->",0,TRUE)) //symlink |
429 | item = item.left(item.find("->",0,TRUE)); | 435 | item = item.left(item.find("->",0,TRUE)); |
430 | 436 | ||
431 | destFile = currentDir.canonicalPath()+"/"+ item; | 437 | destFile = currentDir.canonicalPath()+"/"+ item; |
432 | qDebug("Destination file is "+destFile); | 438 | qDebug("Destination file is "+destFile); |
433 | 439 | ||
434 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; | 440 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; |
435 | qDebug("CurrentFile file is " + curFile); | 441 | qDebug("CurrentFile file is " + curFile); |
436 | 442 | ||
437 | QFile f(destFile); | 443 | QFile f(destFile); |
438 | if( f.exists()) { | 444 | if( f.exists()) { |
439 | switch ( QMessageBox::warning(this,tr("Delete"), | 445 | switch ( QMessageBox::warning(this,tr("Delete"), |
440 | destFile+tr(" already exists\nDo you really want to delete it?"), | 446 | destFile+tr(" already exists\nDo you really want to delete it?"), |
441 | tr("Yes"),tr("No"),0,0,1) ) { | 447 | tr("Yes"),tr("No"),0,0,1) ) { |
442 | case 0: | 448 | case 0: |
443 | f.remove(); | 449 | f.remove(); |
444 | break; | 450 | break; |
445 | case 1: | 451 | case 1: |
446 | return; | 452 | return; |
447 | break; | 453 | break; |
448 | }; | 454 | }; |
449 | } | 455 | } |
450 | if(!copyFile(destFile, curFile) ) { | 456 | if(!copyFile(destFile, curFile) ) { |
451 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 457 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
452 | +curFile +tr("to\n")+destFile); | 458 | +curFile +tr("to\n")+destFile); |
453 | return; | 459 | return; |
454 | 460 | ||
455 | } | 461 | } |
456 | } | 462 | } |
457 | populateLocalView(); | 463 | populateLocalView(); |
458 | TabWidget->setCurrentPage(0); | 464 | TabWidget->setCurrentPage(0); |
459 | } | 465 | } |
460 | 466 | ||
461 | } | 467 | } |
462 | } | 468 | } |
463 | 469 | ||
464 | void AdvancedFm::copyAs() { | 470 | void AdvancedFm::copyAs() { |
465 | qApp->processEvents(); | 471 | qApp->processEvents(); |
466 | 472 | ||
467 | QStringList curFileList = getPath(); | 473 | QStringList curFileList = getPath(); |
468 | QString curFile; | 474 | QString curFile; |
469 | InputDialog *fileDlg; | 475 | InputDialog *fileDlg; |
470 | if (TabWidget->currentPageIndex() == 0) { | 476 | if (TabWidget->currentPageIndex() == 0) { |
471 | qDebug("tab 1"); | 477 | qDebug("tab 1"); |
472 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 478 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
473 | QString destFile; | 479 | QString destFile; |
474 | curFile = currentDir.canonicalPath()+"/"+(*it); | 480 | curFile = currentDir.canonicalPath()+"/"+(*it); |
475 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 481 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
476 | 482 | ||
477 | fileDlg->setInputText((const QString &) destFile ); | 483 | fileDlg->setInputText((const QString &) destFile ); |
478 | fileDlg->exec(); | 484 | fileDlg->exec(); |
479 | 485 | ||
480 | if( fileDlg->result() == 1 ) { | 486 | if( fileDlg->result() == 1 ) { |
481 | QString filename = fileDlg->LineEdit1->text(); | 487 | QString filename = fileDlg->LineEdit1->text(); |
482 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 488 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
483 | 489 | ||
484 | QFile f(destFile); | 490 | QFile f(destFile); |
485 | if( f.exists()) { | 491 | if( f.exists()) { |
486 | switch (QMessageBox::warning(this,tr("Delete"), | 492 | switch (QMessageBox::warning(this,tr("Delete"), |
487 | destFile+tr(" already exists\nDo you really want to delete it?"), | 493 | destFile+tr(" already exists\nDo you really want to delete it?"), |
488 | tr("Yes"),tr("No"),0,0,1) ) { | 494 | tr("Yes"),tr("No"),0,0,1) ) { |