-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 56 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 5 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.pro | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 80 |
5 files changed, 99 insertions, 58 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index f23fd86..08dc24e 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,855 +1,875 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | AdvancedFm.cpp | 2 | AdvancedFm.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #define DEVELOPERS_VERSION | 12 | #define DEVELOPERS_VERSION |
13 | #include "advancedfm.h" | 13 | #include "advancedfm.h" |
14 | 14 | ||
15 | #include <opie/otabwidget.h> | ||
15 | // #include <opie/ofileselector.h> | 16 | // #include <opie/ofileselector.h> |
16 | // #include <opie/ofiledialog.h> | 17 | // #include <opie/ofiledialog.h> |
17 | 18 | ||
18 | #include <qpe/filemanager.h> | 19 | #include <qpe/filemanager.h> |
19 | #include <qpe/qcopenvelope_qws.h> | 20 | #include <qpe/qcopenvelope_qws.h> |
20 | #include <qpe/qpemenubar.h> | 21 | #include <qpe/qpemenubar.h> |
21 | #include <qpe/qpetoolbar.h> | 22 | #include <qpe/qpetoolbar.h> |
22 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
24 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
25 | #include <qpe/mimetype.h> | 26 | #include <qpe/mimetype.h> |
26 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
27 | #include <qpe/ir.h> | 28 | #include <qpe/ir.h> |
28 | #include <qpe/resource.h> | 29 | #include <qpe/resource.h> |
29 | 30 | ||
30 | #include <qtabwidget.h> | 31 | #include <qtabwidget.h> |
31 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
32 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
33 | #include <qdatetime.h> | 34 | #include <qdatetime.h> |
34 | #include <qdir.h> | 35 | #include <qdir.h> |
35 | #include <qfile.h> | 36 | #include <qfile.h> |
36 | #include <qstring.h> | 37 | #include <qstring.h> |
37 | #include <qcombobox.h> | 38 | #include <qcombobox.h> |
38 | #include <qpopupmenu.h> | 39 | #include <qpopupmenu.h> |
39 | #include <qlistview.h> | 40 | #include <qlistview.h> |
40 | #include <qmainwindow.h> | 41 | #include <qmainwindow.h> |
41 | #include <qlabel.h> | 42 | #include <qlabel.h> |
42 | #include <qprogressbar.h> | 43 | #include <qprogressbar.h> |
43 | #include <qspinbox.h> | 44 | #include <qspinbox.h> |
44 | #include <qwidget.h> | 45 | #include <qwidget.h> |
45 | #include <qlayout.h> | 46 | #include <qlayout.h> |
46 | #include <qimage.h> | 47 | #include <qimage.h> |
47 | #include <qpixmap.h> | 48 | #include <qpixmap.h> |
48 | #include <qmessagebox.h> | 49 | #include <qmessagebox.h> |
49 | #include <qlineedit.h> | 50 | #include <qlineedit.h> |
50 | #include <qregexp.h> | 51 | #include <qregexp.h> |
51 | 52 | ||
52 | #include <unistd.h> | 53 | #include <unistd.h> |
53 | #include <stdlib.h> | 54 | #include <stdlib.h> |
54 | #include <sys/stat.h> | 55 | #include <sys/stat.h> |
55 | #include <dirent.h> | 56 | #include <dirent.h> |
56 | #include <stdio.h> | 57 | #include <stdio.h> |
57 | #include <time.h> | 58 | #include <time.h> |
58 | #include <fcntl.h> | 59 | #include <fcntl.h> |
59 | #include <mntent.h> | 60 | #include <mntent.h> |
60 | #include <string.h> | 61 | #include <string.h> |
61 | #include <errno.h> | 62 | #include <errno.h> |
62 | #include <sys/vfs.h> | 63 | #include <sys/vfs.h> |
63 | #include <mntent.h> | 64 | #include <mntent.h> |
64 | #include <sys/utsname.h> | 65 | #include <sys/utsname.h> |
65 | 66 | ||
66 | AdvancedFm::AdvancedFm( ) | 67 | AdvancedFm::AdvancedFm( ) |
67 | : QMainWindow( ) { | 68 | : QMainWindow( ) { |
68 | init(); | 69 | init(); |
69 | initConnections(); | 70 | initConnections(); |
70 | populateLocalView(); | 71 | populateLocalView(); |
71 | populateRemoteView(); | 72 | populateRemoteView(); |
72 | currentPathCombo->setFocus(); | 73 | currentPathCombo->setFocus(); |
73 | } | 74 | } |
74 | 75 | ||
75 | AdvancedFm::~AdvancedFm() { | 76 | AdvancedFm::~AdvancedFm() { |
76 | } | 77 | } |
77 | 78 | ||
78 | void AdvancedFm::cleanUp() { | 79 | void AdvancedFm::cleanUp() { |
79 | QString sfile=QDir::homeDirPath(); | 80 | QString sfile=QDir::homeDirPath(); |
80 | if(sfile.right(1) != "/") | 81 | if(sfile.right(1) != "/") |
81 | sfile+="/._temp"; | 82 | sfile+="/._temp"; |
82 | else | 83 | else |
83 | sfile+="._temp"; | 84 | sfile+="._temp"; |
84 | QFile file( sfile); | 85 | QFile file( sfile); |
85 | if(file.exists()) | 86 | if(file.exists()) |
86 | file.remove(); | 87 | file.remove(); |
87 | } | 88 | } |
88 | 89 | ||
89 | void AdvancedFm::tabChanged(QWidget *) { | 90 | void AdvancedFm::tabChanged(QWidget *) { |
90 | if (TabWidget->currentPageIndex() == 0) { | 91 | if (TabWidget->getCurrentTab() == 0) { |
92 | // if (TabWidget->currentPageIndex() == 0) { | ||
91 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 93 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
92 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 94 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
93 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 95 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
94 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 96 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
95 | setCaption("AdvancedFm :: "+fs+" :: " | 97 | setCaption("AdvancedFm :: "+fs+" :: " |
96 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); | 98 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
97 | 99 | ||
98 | } | 100 | } |
99 | if (TabWidget->currentPageIndex() == 1) { | 101 | if (TabWidget->getCurrentTab() == 1) { |
102 | |||
103 | // if (TabWidget->currentPageIndex() == 1) { | ||
100 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 104 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
101 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 105 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
102 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 106 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
103 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 107 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
104 | setCaption("AdvancedFm :: "+fs+" :: " | 108 | setCaption("AdvancedFm :: "+fs+" :: " |
105 | +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); | 109 | +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); |
106 | } | 110 | } |
107 | } | 111 | } |
108 | 112 | ||
109 | 113 | ||
110 | void AdvancedFm::populateLocalView() { | 114 | void AdvancedFm::populateLocalView() { |
111 | QPixmap pm; | 115 | QPixmap pm; |
112 | Local_View->clear(); | 116 | Local_View->clear(); |
113 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 117 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
114 | currentDir.setMatchAllDirs(TRUE); | 118 | currentDir.setMatchAllDirs(TRUE); |
115 | currentDir.setNameFilter(filterStr); | 119 | currentDir.setNameFilter(filterStr); |
116 | QString fileL, fileS, fileDate; | 120 | QString fileL, fileS, fileDate; |
117 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 121 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
118 | setCaption("AdvancedFm :: "+fs+" :: " | 122 | setCaption("AdvancedFm :: "+fs+" :: " |
119 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); | 123 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
120 | bool isDir=FALSE; | 124 | bool isDir=FALSE; |
121 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 125 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
122 | QFileInfoListIterator it(*list); | 126 | QFileInfoListIterator it(*list); |
123 | QFileInfo *fi; | 127 | QFileInfo *fi; |
124 | while ( (fi=it.current()) ) { | 128 | while ( (fi=it.current()) ) { |
125 | if (fi->isSymLink() ) { | 129 | if (fi->isSymLink() ) { |
126 | QString symLink=fi->readLink(); | 130 | QString symLink=fi->readLink(); |
127 | QFileInfo sym( symLink); | 131 | QFileInfo sym( symLink); |
128 | fileS.sprintf( "%10i", sym.size() ); | 132 | fileS.sprintf( "%10i", sym.size() ); |
129 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); | 133 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); |
130 | fileDate = sym.lastModified().toString(); | 134 | fileDate = sym.lastModified().toString(); |
131 | } else { | 135 | } else { |
132 | fileS.sprintf( "%10i", fi->size() ); | 136 | fileS.sprintf( "%10i", fi->size() ); |
133 | fileL.sprintf( "%s",fi->fileName().data() ); | 137 | fileL.sprintf( "%s",fi->fileName().data() ); |
134 | fileDate= fi->lastModified().toString(); | 138 | fileDate= fi->lastModified().toString(); |
135 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 139 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
136 | fileL+="/"; | 140 | fileL+="/"; |
137 | isDir=TRUE; | 141 | isDir=TRUE; |
138 | } | 142 | } |
139 | } | 143 | } |
140 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | 144 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); |
141 | if(fileL !="./" && fi->exists()) { | 145 | if(fileL !="./" && fi->exists()) { |
142 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); | 146 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); |
143 | 147 | ||
144 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 148 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
145 | 149 | ||
146 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 150 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
147 | pm = Resource::loadPixmap( "lockedfolder" ); | 151 | pm = Resource::loadPixmap( "lockedfolder" ); |
148 | else | 152 | else |
149 | pm= Resource::loadPixmap( "folder" ); | 153 | pm= Resource::loadPixmap( "folder" ); |
150 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 154 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
151 | pm = Resource::loadPixmap( "exec"); | 155 | pm = Resource::loadPixmap( "exec"); |
152 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 156 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
153 | | fileInfo.permission( QFileInfo::ExeGroup) | 157 | | fileInfo.permission( QFileInfo::ExeGroup) |
154 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 158 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
155 | pm = Resource::loadPixmap( "exec"); | 159 | pm = Resource::loadPixmap( "exec"); |
156 | } else if( !fi->isReadable() ) { | 160 | } else if( !fi->isReadable() ) { |
157 | pm = Resource::loadPixmap( "locked" ); | 161 | pm = Resource::loadPixmap( "locked" ); |
158 | } else { //everything else goes by mimetype | 162 | } else { //everything else goes by mimetype |
159 | MimeType mt(fi->filePath()); | 163 | MimeType mt(fi->filePath()); |
160 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 164 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
161 | if(pm.isNull()) | 165 | if(pm.isNull()) |
162 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 166 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
163 | } | 167 | } |
164 | item->setPixmap( 0,pm); | 168 | item->setPixmap( 0,pm); |
165 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 169 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
166 | // overlay link image | 170 | // overlay link image |
167 | pm= Resource::loadPixmap( "folder" ); | 171 | pm= Resource::loadPixmap( "folder" ); |
168 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 172 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
169 | QPainter painter( &pm ); | 173 | QPainter painter( &pm ); |
170 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 174 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
171 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 175 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
172 | item->setPixmap( 0, pm); | 176 | item->setPixmap( 0, pm); |
173 | } | 177 | } |
174 | } | 178 | } |
175 | isDir=FALSE; | 179 | isDir=FALSE; |
176 | ++it; | 180 | ++it; |
177 | } | 181 | } |
178 | 182 | ||
179 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { | 183 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { |
180 | struct stat buf; | 184 | struct stat buf; |
181 | dev_t devT; | 185 | dev_t devT; |
182 | DIR *dir; | 186 | DIR *dir; |
183 | struct dirent *mydirent; | 187 | struct dirent *mydirent; |
184 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) | 188 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) |
185 | while ((mydirent = readdir(dir)) != NULL) { | 189 | while ((mydirent = readdir(dir)) != NULL) { |
186 | lstat( mydirent->d_name, &buf); | 190 | lstat( mydirent->d_name, &buf); |
187 | qDebug(mydirent->d_name); | 191 | qDebug(mydirent->d_name); |
188 | fileL.sprintf("%s", mydirent->d_name); | 192 | fileL.sprintf("%s", mydirent->d_name); |
189 | devT = buf.st_dev; | 193 | devT = buf.st_dev; |
190 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 194 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
191 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 195 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
192 | if( fileL.find(".") == -1 ){ | 196 | if( fileL.find(".") == -1 ){ |
193 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); | 197 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); |
194 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 198 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
195 | item->setPixmap( 0,pm); | 199 | item->setPixmap( 0,pm); |
196 | } | 200 | } |
197 | } | 201 | } |
198 | 202 | ||
199 | closedir(dir); | 203 | closedir(dir); |
200 | } | 204 | } |
201 | 205 | ||
202 | Local_View->setSorting( 3,FALSE); | 206 | Local_View->setSorting( 3,FALSE); |
203 | fillCombo( (const QString &) currentDir.canonicalPath()); | 207 | fillCombo( (const QString &) currentDir.canonicalPath()); |
204 | } | 208 | } |
205 | 209 | ||
206 | 210 | ||
207 | void AdvancedFm::populateRemoteView() { | 211 | void AdvancedFm::populateRemoteView() { |
208 | QPixmap pm; | 212 | QPixmap pm; |
209 | Remote_View->clear(); | 213 | Remote_View->clear(); |
210 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 214 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
211 | currentRemoteDir.setMatchAllDirs(TRUE); | 215 | currentRemoteDir.setMatchAllDirs(TRUE); |
212 | currentRemoteDir.setNameFilter(filterStr); | 216 | currentRemoteDir.setNameFilter(filterStr); |
213 | QString fileL, fileS, fileDate; | 217 | QString fileL, fileS, fileDate; |
214 | 218 | ||
215 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 219 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
216 | setCaption("AdvancedFm :: "+fs+" :: " | 220 | setCaption("AdvancedFm :: "+fs+" :: " |
217 | +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); | 221 | +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); |
218 | bool isDir=FALSE; | 222 | bool isDir=FALSE; |
219 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 223 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
220 | QFileInfoListIterator it(*list); | 224 | QFileInfoListIterator it(*list); |
221 | QFileInfo *fi; | 225 | QFileInfo *fi; |
222 | while ( (fi=it.current()) ) { | 226 | while ( (fi=it.current()) ) { |
223 | if (fi->isSymLink() ){ | 227 | if (fi->isSymLink() ){ |
224 | QString symLink=fi->readLink(); | 228 | QString symLink=fi->readLink(); |
225 | // qDebug("Symlink detected "+symLink); | 229 | // qDebug("Symlink detected "+symLink); |
226 | QFileInfo sym( symLink); | 230 | QFileInfo sym( symLink); |
227 | fileS.sprintf( "%10i", sym.size() ); | 231 | fileS.sprintf( "%10i", sym.size() ); |
228 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); | 232 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); |
229 | fileDate = sym.lastModified().toString(); | 233 | fileDate = sym.lastModified().toString(); |
230 | } else { | 234 | } else { |
231 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 235 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
232 | fileS.sprintf( "%10i", fi->size() ); | 236 | fileS.sprintf( "%10i", fi->size() ); |
233 | fileL.sprintf( "%s",fi->fileName().data() ); | 237 | fileL.sprintf( "%s",fi->fileName().data() ); |
234 | fileDate= fi->lastModified().toString(); | 238 | fileDate= fi->lastModified().toString(); |
235 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { | 239 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { |
236 | fileL+="/"; | 240 | fileL+="/"; |
237 | isDir=TRUE; | 241 | isDir=TRUE; |
238 | // qDebug( fileL); | 242 | // qDebug( fileL); |
239 | } | 243 | } |
240 | } | 244 | } |
241 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); | 245 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); |
242 | if(fileL !="./" && fi->exists()) { | 246 | if(fileL !="./" && fi->exists()) { |
243 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 247 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
244 | QPixmap pm; | 248 | QPixmap pm; |
245 | 249 | ||
246 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 250 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
247 | if( !QDir( fi->filePath() ).isReadable()) | 251 | if( !QDir( fi->filePath() ).isReadable()) |
248 | pm = Resource::loadPixmap( "lockedfolder" ); | 252 | pm = Resource::loadPixmap( "lockedfolder" ); |
249 | else | 253 | else |
250 | pm= Resource::loadPixmap( "folder" ); | 254 | pm= Resource::loadPixmap( "folder" ); |
251 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 255 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
252 | pm = Resource::loadPixmap( "exec"); | 256 | pm = Resource::loadPixmap( "exec"); |
253 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 257 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
254 | | fileInfo.permission( QFileInfo::ExeGroup) | 258 | | fileInfo.permission( QFileInfo::ExeGroup) |
255 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 259 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
256 | pm = Resource::loadPixmap( "exec"); | 260 | pm = Resource::loadPixmap( "exec"); |
257 | } else if( !fi->isReadable() ) { | 261 | } else if( !fi->isReadable() ) { |
258 | pm = Resource::loadPixmap( "locked" ); | 262 | pm = Resource::loadPixmap( "locked" ); |
259 | } else { | 263 | } else { |
260 | MimeType mt(fi->filePath()); | 264 | MimeType mt(fi->filePath()); |
261 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 265 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
262 | if(pm.isNull()) | 266 | if(pm.isNull()) |
263 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 267 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
264 | } | 268 | } |
265 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 269 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
266 | // overlay link image | 270 | // overlay link image |
267 | pm= Resource::loadPixmap( "folder" ); | 271 | pm= Resource::loadPixmap( "folder" ); |
268 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 272 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
269 | QPainter painter( &pm ); | 273 | QPainter painter( &pm ); |
270 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 274 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
271 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 275 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
272 | } | 276 | } |
273 | item->setPixmap( 0, pm); | 277 | item->setPixmap( 0, pm); |
274 | } | 278 | } |
275 | isDir=FALSE; | 279 | isDir=FALSE; |
276 | ++it; | 280 | ++it; |
277 | } | 281 | } |
278 | 282 | ||
279 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 283 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
280 | struct stat buf; | 284 | struct stat buf; |
281 | DIR *dir; | 285 | DIR *dir; |
282 | struct dirent *mydirent; | 286 | struct dirent *mydirent; |
283 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 287 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
284 | while ((mydirent = readdir(dir)) != NULL) { | 288 | while ((mydirent = readdir(dir)) != NULL) { |
285 | lstat( mydirent->d_name, &buf); | 289 | lstat( mydirent->d_name, &buf); |
286 | qDebug(mydirent->d_name); | 290 | qDebug(mydirent->d_name); |
287 | fileL.sprintf("%s", mydirent->d_name); | 291 | fileL.sprintf("%s", mydirent->d_name); |
288 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); | 292 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); |
289 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 293 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
290 | if( fileL.find(".") == -1 ){ | 294 | if( fileL.find(".") == -1 ){ |
291 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 295 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
292 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 296 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
293 | item->setPixmap( 0,pm); | 297 | item->setPixmap( 0,pm); |
294 | } | 298 | } |
295 | } | 299 | } |
296 | 300 | ||
297 | closedir(dir); | 301 | closedir(dir); |
298 | } | 302 | } |
299 | 303 | ||
300 | Remote_View->setSorting( 3,FALSE); | 304 | Remote_View->setSorting( 3,FALSE); |
301 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); | 305 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); |
302 | } | 306 | } |
303 | 307 | ||
304 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) { | 308 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) { |
305 | if(selectedItem) { | 309 | if(selectedItem) { |
306 | QString strItem=selectedItem->text(0); | 310 | QString strItem=selectedItem->text(0); |
307 | QString strSize=selectedItem->text(1); | 311 | QString strSize=selectedItem->text(1); |
308 | strSize=strSize.stripWhiteSpace(); | 312 | strSize=strSize.stripWhiteSpace(); |
309 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 313 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
310 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 314 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
311 | if(QDir(strItem2).exists() ) { | 315 | if(QDir(strItem2).exists() ) { |
312 | currentDir.cd(strItem2, TRUE); | 316 | currentDir.cd(strItem2, TRUE); |
313 | populateLocalView(); | 317 | populateLocalView(); |
314 | 318 | ||
315 | } | 319 | } |
316 | } else { // not a symlink | 320 | } else { // not a symlink |
317 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 321 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
318 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 322 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
319 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 323 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
320 | currentDir.cd(strItem,FALSE); | 324 | currentDir.cd(strItem,FALSE); |
321 | populateLocalView(); | 325 | populateLocalView(); |
322 | Local_View->ensureItemVisible(Local_View->firstChild()); | 326 | Local_View->ensureItemVisible(Local_View->firstChild()); |
323 | 327 | ||
324 | } else { | 328 | } else { |
325 | currentDir.cdUp(); | 329 | currentDir.cdUp(); |
326 | populateLocalView(); | 330 | populateLocalView(); |
327 | Local_View->ensureItemVisible(Local_View->firstChild()); | 331 | Local_View->ensureItemVisible(Local_View->firstChild()); |
328 | } | 332 | } |
329 | if(QDir(strItem).exists()){ | 333 | if(QDir(strItem).exists()){ |
330 | currentDir.cd(strItem, TRUE); | 334 | currentDir.cd(strItem, TRUE); |
331 | Local_View->ensureItemVisible(Local_View->firstChild()); | 335 | Local_View->ensureItemVisible(Local_View->firstChild()); |
332 | populateLocalView(); | 336 | populateLocalView(); |
333 | } | 337 | } |
334 | } else { | 338 | } else { |
335 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 339 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
336 | if( QFile::exists(strItem ) ) { | 340 | if( QFile::exists(strItem ) ) { |
337 | // qDebug("clicked item "+strItem); | 341 | // qDebug("clicked item "+strItem); |
338 | // DocLnk doc( strItem, FALSE ); | 342 | // DocLnk doc( strItem, FALSE ); |
339 | // doc.execute(); | 343 | // doc.execute(); |
340 | // Local_View->clearSelection(); | 344 | // Local_View->clearSelection(); |
341 | } | 345 | } |
342 | } //end not symlink | 346 | } //end not symlink |
343 | chdir(strItem.latin1()); | 347 | chdir(strItem.latin1()); |
344 | } | 348 | } |
345 | 349 | ||
346 | } | 350 | } |
347 | } | 351 | } |
348 | 352 | ||
349 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) { | 353 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) { |
350 | 354 | ||
351 | if(selectedItem) { | 355 | if(selectedItem) { |
352 | QString strItem=selectedItem->text(0); | 356 | QString strItem=selectedItem->text(0); |
353 | QString strSize=selectedItem->text(1); | 357 | QString strSize=selectedItem->text(1); |
354 | strSize=strSize.stripWhiteSpace(); | 358 | strSize=strSize.stripWhiteSpace(); |
355 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 359 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
356 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 360 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
357 | currentRemoteDir.cd(strItem2, TRUE); | 361 | currentRemoteDir.cd(strItem2, TRUE); |
358 | populateRemoteView(); | 362 | populateRemoteView(); |
359 | } else { // not a symlink | 363 | } else { // not a symlink |
360 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 364 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
361 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { | 365 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { |
362 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 366 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
363 | currentRemoteDir.cd(strItem,FALSE); | 367 | currentRemoteDir.cd(strItem,FALSE); |
364 | populateRemoteView(); | 368 | populateRemoteView(); |
365 | Remote_View->ensureItemVisible(Remote_View->firstChild()); | 369 | Remote_View->ensureItemVisible(Remote_View->firstChild()); |
366 | } else { | 370 | } else { |
367 | currentRemoteDir.cdUp(); | 371 | currentRemoteDir.cdUp(); |
368 | populateRemoteView(); | 372 | populateRemoteView(); |
369 | Remote_View->ensureItemVisible(Remote_View->firstChild()); | 373 | Remote_View->ensureItemVisible(Remote_View->firstChild()); |
370 | } | 374 | } |
371 | if(QDir(strItem).exists()){ | 375 | if(QDir(strItem).exists()){ |
372 | currentRemoteDir.cd(strItem, TRUE); | 376 | currentRemoteDir.cd(strItem, TRUE); |
373 | populateRemoteView(); | 377 | populateRemoteView(); |
374 | Remote_View->ensureItemVisible(Remote_View->firstChild()); | 378 | Remote_View->ensureItemVisible(Remote_View->firstChild()); |
375 | } | 379 | } |
376 | } else { | 380 | } else { |
377 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 381 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
378 | if( QFile::exists(strItem ) ) { | 382 | if( QFile::exists(strItem ) ) { |
379 | // qDebug("clicked item "+strItem); | 383 | // qDebug("clicked item "+strItem); |
380 | // DocLnk doc( strItem, FALSE ); | 384 | // DocLnk doc( strItem, FALSE ); |
381 | // doc.execute(); | 385 | // doc.execute(); |
382 | // Remote_View->clearSelection(); | 386 | // Remote_View->clearSelection(); |
383 | } | 387 | } |
384 | } //end not symlink | 388 | } //end not symlink |
385 | chdir(strItem.latin1()); | 389 | chdir(strItem.latin1()); |
386 | } | 390 | } |
387 | } | 391 | } |
388 | } | 392 | } |
389 | 393 | ||
390 | 394 | ||
391 | void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 395 | void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
392 | // qDebug("list pressed"); | 396 | // qDebug("list pressed"); |
393 | switch (mouse) { | 397 | switch (mouse) { |
394 | case 1: | 398 | case 1: |
395 | break; | 399 | break; |
396 | case 2: | 400 | case 2: |
397 | menuTimer.start( 500, TRUE ); | 401 | menuTimer.start( 500, TRUE ); |
398 | qDebug("Start menu timer\n"); | 402 | qDebug("Start menu timer\n"); |
399 | break; | 403 | break; |
400 | }; | 404 | }; |
401 | } | 405 | } |
402 | 406 | ||
403 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { | 407 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { |
404 | 408 | ||
405 | switch (mouse) { | 409 | switch (mouse) { |
406 | case 1: | 410 | case 1: |
407 | break; | 411 | break; |
408 | case 2: | 412 | case 2: |
409 | menuTimer.start( 500, TRUE ); | 413 | menuTimer.start( 500, TRUE ); |
410 | qDebug("Start menu timer"); | 414 | qDebug("Start menu timer"); |
411 | break; | 415 | break; |
412 | }; | 416 | }; |
413 | } | 417 | } |
414 | 418 | ||
415 | 419 | ||
416 | void AdvancedFm::switchToLocalTab() { | 420 | void AdvancedFm::switchToLocalTab() { |
417 | TabWidget->setCurrentPage(0); | 421 | TabWidget->setCurrentTab(0); |
418 | Local_View->setFocus(); | 422 | Local_View->setFocus(); |
419 | } | 423 | } |
420 | 424 | ||
421 | void AdvancedFm::switchToRemoteTab() { | 425 | void AdvancedFm::switchToRemoteTab() { |
422 | TabWidget->setCurrentPage(1); | 426 | TabWidget->setCurrentTab(1); |
423 | Remote_View->setFocus(); | 427 | Remote_View->setFocus(); |
424 | } | 428 | } |
425 | 429 | ||
426 | void AdvancedFm::readConfig() { | 430 | void AdvancedFm::readConfig() { |
427 | Config cfg("AdvancedFm"); | 431 | Config cfg("AdvancedFm"); |
428 | } | 432 | } |
429 | 433 | ||
430 | void AdvancedFm::writeConfig() { | 434 | void AdvancedFm::writeConfig() { |
431 | Config cfg("AdvancedFm"); | 435 | Config cfg("AdvancedFm"); |
432 | } | 436 | } |
433 | 437 | ||
434 | void AdvancedFm::currentPathComboChanged() { | 438 | void AdvancedFm::currentPathComboChanged() { |
435 | if (TabWidget->currentPageIndex() == 0) { | 439 | if (TabWidget->getCurrentTab() == 0) { |
440 | // if (TabWidget->currentPageIndex() == 0) { | ||
436 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 441 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
437 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 442 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
438 | populateLocalView(); | 443 | populateLocalView(); |
439 | } else { | 444 | } else { |
440 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 445 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
441 | } | 446 | } |
442 | } | 447 | } |
443 | if (TabWidget->currentPageIndex() == 0) { | 448 | if (TabWidget->getCurrentTab() == 0) { |
449 | // if (TabWidget->currentPageIndex() == 0) { | ||
444 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 450 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
445 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); | 451 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); |
446 | populateRemoteView(); | 452 | populateRemoteView(); |
447 | } else { | 453 | } else { |
448 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 454 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
449 | } | 455 | } |
450 | } | 456 | } |
451 | } | 457 | } |
452 | 458 | ||
453 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 459 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
454 | 460 | ||
455 | if (TabWidget->currentPageIndex() == 0) { | 461 | if (TabWidget->getCurrentTab() == 0) { |
462 | // if (TabWidget->currentPageIndex() == 0) { | ||
456 | currentPathCombo->lineEdit()->setText( currentPath); | 463 | currentPathCombo->lineEdit()->setText( currentPath); |
457 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 464 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
458 | currentPathCombo->clear(); | 465 | currentPathCombo->clear(); |
459 | localDirPathStringList.prepend( currentPath ); | 466 | localDirPathStringList.prepend( currentPath ); |
460 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 467 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
461 | } | 468 | } |
462 | } else { | 469 | } else { |
463 | currentPathCombo->lineEdit()->setText( currentPath); | 470 | currentPathCombo->lineEdit()->setText( currentPath); |
464 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 471 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
465 | currentPathCombo->clear(); | 472 | currentPathCombo->clear(); |
466 | remoteDirPathStringList.prepend( currentPath ); | 473 | remoteDirPathStringList.prepend( currentPath ); |
467 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 474 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
468 | } | 475 | } |
469 | } | 476 | } |
470 | } | 477 | } |
471 | 478 | ||
472 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 479 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
473 | if (TabWidget->currentPageIndex() == 0) { | 480 | if (TabWidget->getCurrentTab() == 0) { |
481 | // if (TabWidget->currentPageIndex() == 0) { | ||
474 | chdir( currentPath.latin1() ); | 482 | chdir( currentPath.latin1() ); |
475 | currentDir.cd( currentPath, TRUE); | 483 | currentDir.cd( currentPath, TRUE); |
476 | populateLocalView(); | 484 | populateLocalView(); |
477 | update(); | 485 | update(); |
478 | } else { | 486 | } else { |
479 | chdir( currentPath.latin1() ); | 487 | chdir( currentPath.latin1() ); |
480 | currentRemoteDir.cd( currentPath, TRUE); | 488 | currentRemoteDir.cd( currentPath, TRUE); |
481 | populateRemoteView(); | 489 | populateRemoteView(); |
482 | update(); | 490 | update(); |
483 | } | 491 | } |
484 | } | 492 | } |
485 | 493 | ||
486 | QStringList AdvancedFm::getPath() { | 494 | QStringList AdvancedFm::getPath() { |
487 | QStringList strList; | 495 | QStringList strList; |
488 | if (TabWidget->currentPageIndex() == 0) { | 496 | if (TabWidget->getCurrentTab() == 0) { |
497 | // if (TabWidget->currentPageIndex() == 0) { | ||
489 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 498 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
490 | QListViewItemIterator it( Local_View ); | 499 | QListViewItemIterator it( Local_View ); |
491 | for ( ; it.current(); ++it ) { | 500 | for ( ; it.current(); ++it ) { |
492 | if ( it.current()->isSelected() ) { | 501 | if ( it.current()->isSelected() ) { |
493 | strList << it.current()->text(0); | 502 | strList << it.current()->text(0); |
494 | qDebug(it.current()->text(0)); | 503 | qDebug(it.current()->text(0)); |
495 | } | 504 | } |
496 | } | 505 | } |
497 | return strList; | 506 | return strList; |
498 | } else { | 507 | } else { |
499 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 508 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
500 | QListViewItemIterator it( Remote_View ); | 509 | QListViewItemIterator it( Remote_View ); |
501 | for ( ; it.current(); ++it ) { | 510 | for ( ; it.current(); ++it ) { |
502 | if ( it.current()->isSelected() ) { | 511 | if ( it.current()->isSelected() ) { |
503 | strList << it.current()->text(0); | 512 | strList << it.current()->text(0); |
504 | qDebug(it.current()->text(0)); | 513 | qDebug(it.current()->text(0)); |
505 | } | 514 | } |
506 | } | 515 | } |
507 | return strList; | 516 | return strList; |
508 | } | 517 | } |
509 | return ""; | 518 | return ""; |
510 | } | 519 | } |
511 | 520 | ||
512 | void AdvancedFm::homeButtonPushed() { | 521 | void AdvancedFm::homeButtonPushed() { |
513 | QString current = QDir::homeDirPath(); | 522 | QString current = QDir::homeDirPath(); |
514 | chdir( current.latin1() ); | 523 | chdir( current.latin1() ); |
515 | if (TabWidget->currentPageIndex() == 0) { | 524 | if (TabWidget->getCurrentTab() == 0) { |
525 | // if (TabWidget->currentPageIndex() == 0) { | ||
516 | currentDir.cd( current, TRUE); | 526 | currentDir.cd( current, TRUE); |
517 | populateLocalView(); | 527 | populateLocalView(); |
518 | } else { | 528 | } else { |
519 | currentRemoteDir.cd( current, TRUE); | 529 | currentRemoteDir.cd( current, TRUE); |
520 | populateRemoteView(); | 530 | populateRemoteView(); |
521 | } | 531 | } |
522 | update(); | 532 | update(); |
523 | } | 533 | } |
524 | 534 | ||
525 | void AdvancedFm::docButtonPushed() { | 535 | void AdvancedFm::docButtonPushed() { |
526 | QString current = QPEApplication::documentDir(); | 536 | QString current = QPEApplication::documentDir(); |
527 | chdir( current.latin1() ); | 537 | chdir( current.latin1() ); |
528 | if (TabWidget->currentPageIndex() == 0) { | 538 | |
539 | if (TabWidget->getCurrentTab() == 0) { | ||
540 | //if (TabWidget->currentPageIndex() == 0) { | ||
529 | currentDir.cd( current, TRUE); | 541 | currentDir.cd( current, TRUE); |
530 | populateLocalView(); | 542 | populateLocalView(); |
531 | } else { | 543 | } else { |
532 | currentRemoteDir.cd( current, TRUE); | 544 | currentRemoteDir.cd( current, TRUE); |
533 | populateRemoteView(); | 545 | populateRemoteView(); |
534 | } | 546 | } |
535 | update(); | 547 | update(); |
536 | } | 548 | } |
537 | 549 | ||
538 | void AdvancedFm::SDButtonPushed() { | 550 | void AdvancedFm::SDButtonPushed() { |
539 | QString current = "/mnt/card";// this can change so fix | 551 | QString current = "/mnt/card";// this can change so fix |
540 | chdir( current.latin1() ); | 552 | chdir( current.latin1() ); |
541 | if (TabWidget->currentPageIndex() == 0) { | 553 | if (TabWidget->getCurrentTab() == 0) { |
554 | // if (TabWidget->currentPageIndex() == 0) { | ||
542 | currentDir.cd( current, TRUE); | 555 | currentDir.cd( current, TRUE); |
543 | populateLocalView(); | 556 | populateLocalView(); |
544 | } else { | 557 | } else { |
545 | currentRemoteDir.cd( current, TRUE); | 558 | currentRemoteDir.cd( current, TRUE); |
546 | populateRemoteView(); | 559 | populateRemoteView(); |
547 | } | 560 | } |
548 | update(); | 561 | update(); |
549 | 562 | ||
550 | } | 563 | } |
551 | 564 | ||
552 | void AdvancedFm::CFButtonPushed() { | 565 | void AdvancedFm::CFButtonPushed() { |
553 | QString current; | 566 | QString current; |
554 | if(zaurusDevice) | 567 | if(zaurusDevice) |
555 | current= "/mnt/cf"; //zaurus | 568 | current= "/mnt/cf"; //zaurus |
556 | else | 569 | else |
557 | current = "/mnt/hda"; //ipaq | 570 | current = "/mnt/hda"; //ipaq |
558 | 571 | ||
559 | chdir( current.latin1() ); | 572 | chdir( current.latin1() ); |
560 | if (TabWidget->currentPageIndex() == 0) { | 573 | if (TabWidget->getCurrentTab() == 0) { |
574 | // if (TabWidget->currentPageIndex() == 0) { | ||
561 | currentDir.cd( current, TRUE); | 575 | currentDir.cd( current, TRUE); |
562 | populateLocalView(); | 576 | populateLocalView(); |
563 | } else { | 577 | } else { |
564 | currentRemoteDir.cd( current, TRUE); | 578 | currentRemoteDir.cd( current, TRUE); |
565 | populateRemoteView(); | 579 | populateRemoteView(); |
566 | } | 580 | } |
567 | update(); | 581 | update(); |
568 | } | 582 | } |
569 | 583 | ||
570 | 584 | ||
571 | 585 | ||
572 | void AdvancedFm::doAbout() { | 586 | void AdvancedFm::doAbout() { |
573 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" | 587 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" |
574 | "is copyright 2002 by\n" | 588 | "is copyright 2002 by\n" |
575 | "L.J.Potter<llornkcor@handhelds.org>\n" | 589 | "L.J.Potter<llornkcor@handhelds.org>\n" |
576 | "and is licensed by the GPL")); | 590 | "and is licensed by the GPL")); |
577 | } | 591 | } |
578 | 592 | ||
579 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { | 593 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { |
580 | if( TabWidget->hasFocus()) | 594 | if( TabWidget->hasFocus()) |
581 | switch ( e->key() ) { | 595 | switch ( e->key() ) { |
582 | case Key_Delete: | 596 | case Key_Delete: |
583 | del(); | 597 | del(); |
584 | break; | 598 | break; |
585 | case Key_H: | 599 | case Key_H: |
586 | showHidden(); | 600 | showHidden(); |
587 | break; | 601 | break; |
588 | case Key_E: | 602 | case Key_E: |
589 | runThis(); | 603 | runThis(); |
590 | break; | 604 | break; |
591 | case Key_C: | 605 | case Key_C: |
592 | copy(); | 606 | copy(); |
593 | break; | 607 | break; |
594 | case Key_A: | 608 | case Key_A: |
595 | copyAs(); | 609 | copyAs(); |
596 | break; | 610 | break; |
597 | case Key_M: | 611 | case Key_M: |
598 | move(); | 612 | move(); |
599 | break; | 613 | break; |
600 | case Key_R: | 614 | case Key_R: |
601 | rn(); | 615 | rn(); |
602 | break; | 616 | break; |
603 | case Key_I: | 617 | case Key_I: |
604 | fileStatus(); | 618 | fileStatus(); |
605 | break; | 619 | break; |
606 | case Key_U: | 620 | case Key_U: |
607 | upDir(); | 621 | upDir(); |
608 | break; | 622 | break; |
609 | case Key_P: | 623 | case Key_P: |
610 | filePerms(); | 624 | filePerms(); |
611 | break; | 625 | break; |
612 | case Key_N: | 626 | case Key_N: |
613 | mkDir(); | 627 | mkDir(); |
614 | break; | 628 | break; |
615 | case Key_1: | 629 | case Key_1: |
616 | switchToLocalTab(); | 630 | switchToLocalTab(); |
617 | break; | 631 | break; |
618 | case Key_2: | 632 | case Key_2: |
619 | switchToRemoteTab(); | 633 | switchToRemoteTab(); |
620 | break; | 634 | break; |
621 | case Key_3: | 635 | case Key_3: |
622 | CFButtonPushed(); | 636 | CFButtonPushed(); |
623 | break; | 637 | break; |
624 | case Key_4: | 638 | case Key_4: |
625 | SDButtonPushed(); | 639 | SDButtonPushed(); |
626 | break; | 640 | break; |
627 | case Key_5: | 641 | case Key_5: |
628 | homeButtonPushed(); | 642 | homeButtonPushed(); |
629 | break; | 643 | break; |
630 | case Key_6: | 644 | case Key_6: |
631 | docButtonPushed(); | 645 | docButtonPushed(); |
632 | break; | 646 | break; |
633 | case Key_7: | 647 | case Key_7: |
634 | break; | 648 | break; |
635 | case Key_8: | 649 | case Key_8: |
636 | break; | 650 | break; |
637 | case Key_9: | 651 | case Key_9: |
638 | break; | 652 | break; |
639 | case Key_0: | 653 | case Key_0: |
640 | break; | 654 | break; |
641 | } | 655 | } |
642 | } | 656 | } |
643 | 657 | ||
644 | 658 | ||
645 | void AdvancedFm::QPEButtonPushed() { | 659 | void AdvancedFm::QPEButtonPushed() { |
646 | QString current = QPEApplication::qpeDir(); | 660 | QString current = QPEApplication::qpeDir(); |
647 | chdir( current.latin1() ); | 661 | chdir( current.latin1() ); |
648 | if (TabWidget->currentPageIndex() == 0) { | 662 | if (TabWidget->getCurrentTab() == 0) { |
663 | // if (TabWidget->currentPageIndex() == 0) { | ||
649 | currentDir.cd( current, TRUE); | 664 | currentDir.cd( current, TRUE); |
650 | populateLocalView(); | 665 | populateLocalView(); |
651 | } else { | 666 | } else { |
652 | currentRemoteDir.cd( current, TRUE); | 667 | currentRemoteDir.cd( current, TRUE); |
653 | populateRemoteView(); | 668 | populateRemoteView(); |
654 | } | 669 | } |
655 | update(); | 670 | update(); |
656 | } | 671 | } |
657 | 672 | ||
658 | void AdvancedFm::parsetab(const QString &fileName) { | 673 | void AdvancedFm::parsetab(const QString &fileName) { |
659 | 674 | ||
660 | fileSystemTypeList.clear(); | 675 | fileSystemTypeList.clear(); |
661 | fsList.clear(); | 676 | fsList.clear(); |
662 | struct mntent *me; | 677 | struct mntent *me; |
663 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 678 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
664 | if ( mntfp ) { | 679 | if ( mntfp ) { |
665 | while ( (me = getmntent( mntfp )) != 0 ) { | 680 | while ( (me = getmntent( mntfp )) != 0 ) { |
666 | QString deviceName = me->mnt_fsname; | 681 | QString deviceName = me->mnt_fsname; |
667 | QString filesystemType = me->mnt_type; | 682 | QString filesystemType = me->mnt_type; |
668 | QString mountDir = me->mnt_dir; | 683 | QString mountDir = me->mnt_dir; |
669 | if(deviceName != "none") { | 684 | if(deviceName != "none") { |
670 | if( fsList.contains(filesystemType) == 0 | 685 | if( fsList.contains(filesystemType) == 0 |
671 | & filesystemType.find("proc",0,TRUE) == -1 | 686 | & filesystemType.find("proc",0,TRUE) == -1 |
672 | & filesystemType.find("cramfs",0,TRUE) == -1 | 687 | & filesystemType.find("cramfs",0,TRUE) == -1 |
673 | & filesystemType.find("auto",0,TRUE) == -1) | 688 | & filesystemType.find("auto",0,TRUE) == -1) |
674 | fsList << filesystemType; | 689 | fsList << filesystemType; |
675 | fileSystemTypeList << mountDir+"::"+filesystemType; | 690 | fileSystemTypeList << mountDir+"::"+filesystemType; |
676 | } | 691 | } |
677 | } | 692 | } |
678 | } | 693 | } |
679 | endmntent( mntfp ); | 694 | endmntent( mntfp ); |
680 | } | 695 | } |
681 | 696 | ||
682 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { | 697 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { |
683 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 698 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
684 | QString current = currentText;//.right( currentText.length()-1); | 699 | QString current = currentText;//.right( currentText.length()-1); |
685 | QString baseFs; | 700 | QString baseFs; |
686 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { | 701 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { |
687 | QString temp = (*it); | 702 | QString temp = (*it); |
688 | QString path = temp.left(temp.find("::",0,TRUE) ); | 703 | QString path = temp.left(temp.find("::",0,TRUE) ); |
689 | path = path.right( path.length()-1); | 704 | path = path.right( path.length()-1); |
690 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 705 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
691 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { | 706 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { |
692 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 707 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
693 | } | 708 | } |
694 | } | 709 | } |
695 | return baseFs; | 710 | return baseFs; |
696 | } | 711 | } |
697 | 712 | ||
698 | QString AdvancedFm::getDiskSpace( const QString &path) { | 713 | QString AdvancedFm::getDiskSpace( const QString &path) { |
699 | struct statfs fss; | 714 | struct statfs fss; |
700 | if ( !statfs( path.latin1(), &fss ) ) { | 715 | if ( !statfs( path.latin1(), &fss ) ) { |
701 | int blkSize = fss.f_bsize; | 716 | int blkSize = fss.f_bsize; |
702 | // int totalBlks = fs.f_blocks; | 717 | // int totalBlks = fs.f_blocks; |
703 | int availBlks = fss.f_bavail; | 718 | int availBlks = fss.f_bavail; |
704 | 719 | ||
705 | long mult = blkSize / 1024; | 720 | long mult = blkSize / 1024; |
706 | long div = 1024 / blkSize; | 721 | long div = 1024 / blkSize; |
707 | if ( !mult ) mult = 1; | 722 | if ( !mult ) mult = 1; |
708 | if ( !div ) div = 1; | 723 | if ( !div ) div = 1; |
709 | 724 | ||
710 | return QString::number(availBlks * mult / div); | 725 | return QString::number(availBlks * mult / div); |
711 | } | 726 | } |
712 | return ""; | 727 | return ""; |
713 | } | 728 | } |
714 | 729 | ||
715 | 730 | ||
716 | void AdvancedFm::showFileMenu() { | 731 | void AdvancedFm::showFileMenu() { |
717 | 732 | ||
718 | QString curApp; | 733 | QString curApp; |
719 | bool isLocalView = false; | 734 | bool isLocalView = false; |
720 | if (TabWidget->currentPageIndex() == 0) { | 735 | if (TabWidget->getCurrentTab() == 0) { |
736 | // if (TabWidget->currentPageIndex() == 0) { | ||
721 | isLocalView = TRUE; | 737 | isLocalView = TRUE; |
722 | curApp = Local_View->currentItem()->text(0); | 738 | curApp = Local_View->currentItem()->text(0); |
723 | } else { | 739 | } else { |
724 | curApp = Remote_View->currentItem()->text(0); | 740 | curApp = Remote_View->currentItem()->text(0); |
725 | } | 741 | } |
726 | 742 | ||
727 | MimeType mt( curApp ); | 743 | MimeType mt( curApp ); |
728 | const AppLnk* app = mt.application(); | 744 | const AppLnk* app = mt.application(); |
729 | QFile fi(curApp); | 745 | QFile fi(curApp); |
730 | QPopupMenu *m = new QPopupMenu(0); | 746 | QPopupMenu *m = new QPopupMenu(0); |
731 | QPopupMenu *n = new QPopupMenu(0); | 747 | QPopupMenu *n = new QPopupMenu(0); |
732 | // QPopupMenu *o = new QPopupMenu(0); | 748 | // QPopupMenu *o = new QPopupMenu(0); |
733 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 749 | if (TabWidget->getCurrentTab() == 0) |
734 | 750 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | |
751 | else | ||
752 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); | ||
753 | |||
735 | if ( QFileInfo(fi).isDir() ) { | 754 | if ( QFileInfo(fi).isDir() ) { |
736 | m->insertSeparator(); | 755 | m->insertSeparator(); |
737 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 756 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
738 | } else { | 757 | } else { |
739 | 758 | ||
740 | if ( app ) | 759 | if ( app ) |
741 | m->insertItem( app->pixmap(), tr( "Open in " | 760 | m->insertItem( app->pixmap(), tr( "Open in " |
742 | + app->name() ), this, SLOT( runThis() ) ); | 761 | + app->name() ), this, SLOT( runThis() ) ); |
743 | else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this | 762 | else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this |
744 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); | 763 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); |
745 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); | 764 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); |
746 | } | 765 | } |
747 | 766 | ||
748 | m->insertItem(tr("Actions"),n); | 767 | m->insertItem(tr("Actions"),n); |
749 | if(isLocalView) | 768 | if(isLocalView) |
750 | n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 769 | n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
751 | else | 770 | else |
752 | n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 771 | n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
753 | 772 | ||
754 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 773 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
755 | 774 | ||
756 | n->insertSeparator(); | 775 | n->insertSeparator(); |
757 | 776 | ||
758 | 777 | ||
759 | if(isLocalView) | 778 | if(isLocalView) |
760 | n->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 779 | n->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
761 | else | 780 | else |
762 | n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 781 | n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
763 | 782 | ||
764 | n->insertItem( tr( "Copy" ), this, SLOT( copy() )); | 783 | n->insertItem( tr( "Copy" ), this, SLOT( copy() )); |
765 | n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 784 | n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
766 | n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); | 785 | n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); |
767 | n->insertItem( tr( "Move" ), this, SLOT( move() )); | 786 | n->insertItem( tr( "Move" ), this, SLOT( move() )); |
768 | 787 | ||
769 | n->insertSeparator(); | 788 | n->insertSeparator(); |
770 | 789 | ||
771 | if(isLocalView) | 790 | if(isLocalView) |
772 | n->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 791 | n->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
773 | else | 792 | else |
774 | n->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 793 | n->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
775 | 794 | ||
776 | 795 | ||
777 | m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 796 | m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
778 | 797 | ||
779 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 798 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
780 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 799 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
781 | 800 | ||
782 | m->insertSeparator(); | 801 | m->insertSeparator(); |
783 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 802 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
784 | 803 | ||
785 | #if defined(QT_QWS_OPIE) | 804 | #if defined(QT_QWS_OPIE) |
786 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 805 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
787 | #endif | 806 | #endif |
788 | m->setCheckable(TRUE); | 807 | m->setCheckable(TRUE); |
789 | if (!b) | 808 | if (!b) |
790 | m->setItemChecked(m->idAt(0),TRUE); | 809 | m->setItemChecked(m->idAt(0),TRUE); |
791 | else | 810 | else |
792 | m->setItemChecked(m->idAt(0),FALSE); | 811 | m->setItemChecked(m->idAt(0),FALSE); |
793 | 812 | ||
794 | if(Ir::supported()) | 813 | if(Ir::supported()) |
795 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); | 814 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); |
796 | m->setFocus(); | 815 | m->setFocus(); |
797 | m->exec( QCursor::pos() ); | 816 | m->exec( QCursor::pos() ); |
798 | sleep(1); | 817 | sleep(1); |
799 | if(m) delete m; | 818 | if(m) delete m; |
800 | } | 819 | } |
801 | 820 | ||
802 | 821 | ||
803 | void AdvancedFm::cancelMenuTimer() { | 822 | void AdvancedFm::cancelMenuTimer() { |
804 | 823 | ||
805 | // qDebug("selectionChanged: cancel menu timer"); | 824 | // qDebug("selectionChanged: cancel menu timer"); |
806 | if( menuTimer.isActive() ) | 825 | if( menuTimer.isActive() ) |
807 | menuTimer.stop(); | 826 | menuTimer.stop(); |
808 | } | 827 | } |
809 | 828 | ||
810 | QString AdvancedFm::checkDiskSpace(const QString &path) { | 829 | QString AdvancedFm::checkDiskSpace(const QString &path) { |
811 | struct statfs fss; | 830 | struct statfs fss; |
812 | if ( !statfs( path.latin1(), &fss ) ) { | 831 | if ( !statfs( path.latin1(), &fss ) ) { |
813 | int blkSize = fss.f_bsize; | 832 | int blkSize = fss.f_bsize; |
814 | // int totalBlks = fs.f_blocks; | 833 | // int totalBlks = fs.f_blocks; |
815 | int availBlks = fss.f_bavail; | 834 | int availBlks = fss.f_bavail; |
816 | 835 | ||
817 | long mult = blkSize / 1024; | 836 | long mult = blkSize / 1024; |
818 | long div = 1024 / blkSize; | 837 | long div = 1024 / blkSize; |
819 | if ( !mult ) mult = 1; | 838 | if ( !mult ) mult = 1; |
820 | if ( !div ) div = 1; | 839 | if ( !div ) div = 1; |
821 | 840 | ||
822 | 841 | ||
823 | return QString::number(availBlks * mult / div); | 842 | return QString::number(availBlks * mult / div); |
824 | } | 843 | } |
825 | return ""; | 844 | return ""; |
826 | } | 845 | } |
827 | 846 | ||
828 | void AdvancedFm::addToDocs() { | 847 | void AdvancedFm::addToDocs() { |
829 | QStringList strListPaths = getPath(); | 848 | QStringList strListPaths = getPath(); |
830 | if( strListPaths.count() > 0) { | 849 | if( strListPaths.count() > 0) { |
831 | QString curFile; | 850 | QString curFile; |
832 | if (TabWidget->currentPageIndex() == 0) { | 851 | if (TabWidget->getCurrentTab() == 0) { |
852 | // if (TabWidget->currentPageIndex() == 0) { | ||
833 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { | 853 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { |
834 | curFile = currentDir.canonicalPath()+"/"+(*it); | 854 | curFile = currentDir.canonicalPath()+"/"+(*it); |
835 | qDebug(curFile); | 855 | qDebug(curFile); |
836 | DocLnk f; | 856 | DocLnk f; |
837 | // curFile.replace(QRegExp("\\..*"),""); | 857 | // curFile.replace(QRegExp("\\..*"),""); |
838 | f.setName((*it)); | 858 | f.setName((*it)); |
839 | f.setFile( curFile); | 859 | f.setFile( curFile); |
840 | f.writeLink(); | 860 | f.writeLink(); |
841 | } | 861 | } |
842 | } else { | 862 | } else { |
843 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { | 863 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { |
844 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 864 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
845 | qDebug(curFile); | 865 | qDebug(curFile); |
846 | 866 | ||
847 | DocLnk f; | 867 | DocLnk f; |
848 | // curFile.replace(QRegExp("\\..*"),""); | 868 | // curFile.replace(QRegExp("\\..*"),""); |
849 | f.setName((*it)); | 869 | f.setName((*it)); |
850 | f.setFile( curFile); | 870 | f.setFile( curFile); |
851 | f.writeLink(); | 871 | f.writeLink(); |
852 | } | 872 | } |
853 | } | 873 | } |
854 | } | 874 | } |
855 | } | 875 | } |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index f846c66..12ebbf2 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -1,150 +1,153 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | advancedfm.h | 2 | advancedfm.h |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #ifndef ADVANCEDFM_H | 12 | #ifndef ADVANCEDFM_H |
13 | #define ADVANCEDFM_H | 13 | #define ADVANCEDFM_H |
14 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties | 14 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties |
15 | #define QT_QWS_OPIE | 15 | #define QT_QWS_OPIE |
16 | 16 | ||
17 | //#include <opie/otabwidget.h> | ||
17 | #include <qpe/ir.h> | 18 | #include <qpe/ir.h> |
18 | 19 | ||
19 | #include <qvariant.h> | 20 | #include <qvariant.h> |
20 | #include <qdialog.h> | 21 | #include <qdialog.h> |
21 | #include <qmainwindow.h> | 22 | #include <qmainwindow.h> |
22 | #include <qstringlist.h> | 23 | #include <qstringlist.h> |
23 | #include <qdir.h> | 24 | #include <qdir.h> |
24 | #include <qstring.h> | 25 | #include <qstring.h> |
25 | #include <qpoint.h> | 26 | #include <qpoint.h> |
26 | #include <qtimer.h> | 27 | #include <qtimer.h> |
27 | 28 | ||
29 | class OTabWidget; | ||
28 | class QVBoxLayout; | 30 | class QVBoxLayout; |
29 | class QHBoxLayout; | 31 | class QHBoxLayout; |
30 | class QGridLayout; | 32 | class QGridLayout; |
31 | class QComboBox; | 33 | class QComboBox; |
32 | class QListView; | 34 | class QListView; |
33 | class QListviewItem; | 35 | class QListviewItem; |
34 | class QLabel; | 36 | class QLabel; |
35 | class QProgressBar; | 37 | class QProgressBar; |
36 | class QSpinBox; | 38 | class QSpinBox; |
37 | class QTabWidget; | 39 | class QTabWidget; |
38 | class QWidget; | 40 | class QWidget; |
39 | class QPEToolBar; | 41 | class QPEToolBar; |
40 | class QPEMenuBar; | 42 | class QPEMenuBar; |
41 | class QPopupMenu; | 43 | class QPopupMenu; |
42 | class QFile; | 44 | class QFile; |
43 | class QListViewItem; | 45 | class QListViewItem; |
44 | class QLineEdit; | 46 | class QLineEdit; |
45 | //class QPushButton; | 47 | //class QPushButton; |
46 | class QToolButton; | 48 | class QToolButton; |
47 | class Ir; | 49 | class Ir; |
48 | 50 | ||
49 | class AdvancedFm : public QMainWindow | 51 | class AdvancedFm : public QMainWindow |
50 | { | 52 | { |
51 | Q_OBJECT | 53 | Q_OBJECT |
52 | public: | 54 | public: |
53 | AdvancedFm(); | 55 | AdvancedFm(); |
54 | ~AdvancedFm(); | 56 | ~AdvancedFm(); |
55 | 57 | ||
56 | QTabWidget *TabWidget; | 58 | OTabWidget *TabWidget; |
59 | // QTabWidget *TabWidget; | ||
57 | QWidget *tab, *tab_2, *tab_3; | 60 | QWidget *tab, *tab_2, *tab_3; |
58 | QListView *Local_View, *Remote_View; | 61 | QListView *Local_View, *Remote_View; |
59 | 62 | ||
60 | QLineEdit *currentPathEdit; | 63 | QLineEdit *currentPathEdit; |
61 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; | 64 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; |
62 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 65 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
63 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 66 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
64 | QDir currentDir, currentRemoteDir; | 67 | QDir currentDir, currentRemoteDir; |
65 | QComboBox *currentPathCombo; | 68 | QComboBox *currentPathCombo; |
66 | QString filterStr; | 69 | QString filterStr; |
67 | QListViewItem * item; | 70 | QListViewItem * item; |
68 | bool b; | 71 | bool b; |
69 | QStringList fileSystemTypeList, fsList; | 72 | QStringList fileSystemTypeList, fsList; |
70 | int currentServerConfig; | 73 | int currentServerConfig; |
71 | protected slots: | 74 | protected slots: |
72 | void addToDocs(); | 75 | void addToDocs(); |
73 | void doLocalCd(); | 76 | void doLocalCd(); |
74 | void doRemoteCd(); | 77 | void doRemoteCd(); |
75 | // void copy(); | 78 | // void copy(); |
76 | void mkDir(); | 79 | void mkDir(); |
77 | void del(); | 80 | void del(); |
78 | void rn(); | 81 | void rn(); |
79 | void populateLocalView(); | 82 | void populateLocalView(); |
80 | void populateRemoteView(); | 83 | void populateRemoteView(); |
81 | void showHidden(); | 84 | void showHidden(); |
82 | void showMenuHidden(); | 85 | void showMenuHidden(); |
83 | void showRemoteHidden(); | 86 | void showRemoteHidden(); |
84 | void writeConfig(); | 87 | void writeConfig(); |
85 | void readConfig(); | 88 | void readConfig(); |
86 | void localListClicked(QListViewItem *); | 89 | void localListClicked(QListViewItem *); |
87 | void remoteListClicked(QListViewItem *); | 90 | void remoteListClicked(QListViewItem *); |
88 | void localListPressed( int, QListViewItem *, const QPoint&, int); | 91 | void localListPressed( int, QListViewItem *, const QPoint&, int); |
89 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); | 92 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); |
90 | void localMakDir(); | 93 | void localMakDir(); |
91 | void localDelete(); | 94 | void localDelete(); |
92 | void remoteMakDir(); | 95 | void remoteMakDir(); |
93 | void remoteDelete(); | 96 | void remoteDelete(); |
94 | /* bool remoteDirList(const QString &); */ | 97 | /* bool remoteDirList(const QString &); */ |
95 | /* bool remoteChDir(const QString &); */ | 98 | /* bool remoteChDir(const QString &); */ |
96 | void tabChanged(QWidget*); | 99 | void tabChanged(QWidget*); |
97 | void cleanUp(); | 100 | void cleanUp(); |
98 | void remoteRename(); | 101 | void remoteRename(); |
99 | void localRename(); | 102 | void localRename(); |
100 | void runThis(); | 103 | void runThis(); |
101 | void runText(); | 104 | void runText(); |
102 | void filePerms(); | 105 | void filePerms(); |
103 | void doProperties(); | 106 | void doProperties(); |
104 | void runCommand(); | 107 | void runCommand(); |
105 | void runCommandStd(); | 108 | void runCommandStd(); |
106 | QStringList getPath(); | 109 | QStringList getPath(); |
107 | void mkSym(); | 110 | void mkSym(); |
108 | void switchToLocalTab(); | 111 | void switchToLocalTab(); |
109 | void switchToRemoteTab(); | 112 | void switchToRemoteTab(); |
110 | 113 | ||
111 | protected: | 114 | protected: |
112 | bool zaurusDevice; | 115 | bool zaurusDevice; |
113 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 116 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
114 | QStringList remoteDirPathStringList, localDirPathStringList; | 117 | QStringList remoteDirPathStringList, localDirPathStringList; |
115 | 118 | ||
116 | void init(); | 119 | void init(); |
117 | void initConnections(); | 120 | void initConnections(); |
118 | void keyReleaseEvent( QKeyEvent *); | 121 | void keyReleaseEvent( QKeyEvent *); |
119 | QString getFileSystemType(const QString &); | 122 | QString getFileSystemType(const QString &); |
120 | QString getDiskSpace(const QString &); | 123 | QString getDiskSpace(const QString &); |
121 | void parsetab(const QString &fileName); | 124 | void parsetab(const QString &fileName); |
122 | QString checkDiskSpace(const QString &); | 125 | QString checkDiskSpace(const QString &); |
123 | 126 | ||
124 | protected slots: | 127 | protected slots: |
125 | void showFileMenu(); | 128 | void showFileMenu(); |
126 | void cancelMenuTimer(); | 129 | void cancelMenuTimer(); |
127 | void homeButtonPushed(); | 130 | void homeButtonPushed(); |
128 | void docButtonPushed(); | 131 | void docButtonPushed(); |
129 | void SDButtonPushed(); | 132 | void SDButtonPushed(); |
130 | void CFButtonPushed(); | 133 | void CFButtonPushed(); |
131 | void QPEButtonPushed(); | 134 | void QPEButtonPushed(); |
132 | void upDir(); | 135 | void upDir(); |
133 | void currentPathComboChanged(); | 136 | void currentPathComboChanged(); |
134 | void copy(); | 137 | void copy(); |
135 | void copyAs(); | 138 | void copyAs(); |
136 | void copySameDir(); | 139 | void copySameDir(); |
137 | void currentPathComboActivated(const QString &); | 140 | void currentPathComboActivated(const QString &); |
138 | void fillCombo(const QString &); | 141 | void fillCombo(const QString &); |
139 | bool copyFile( const QString & , const QString & ); | 142 | bool copyFile( const QString & , const QString & ); |
140 | void move(); | 143 | void move(); |
141 | void fileStatus(); | 144 | void fileStatus(); |
142 | void doAbout(); | 145 | void doAbout(); |
143 | void doBeam(); | 146 | void doBeam(); |
144 | void fileBeamFinished( Ir *); | 147 | void fileBeamFinished( Ir *); |
145 | 148 | ||
146 | private: | 149 | private: |
147 | QTimer menuTimer; | 150 | QTimer menuTimer; |
148 | }; | 151 | }; |
149 | 152 | ||
150 | #endif // ADVANCEDFM_H | 153 | #endif // ADVANCEDFM_H |
diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro index eb4f122..3896f50 100644 --- a/noncore/apps/advancedfm/advancedfm.pro +++ b/noncore/apps/advancedfm/advancedfm.pro | |||
@@ -1,25 +1,25 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | HEADERS = advancedfm.h inputDialog.h filePermissions.h output.h | 3 | HEADERS = advancedfm.h inputDialog.h filePermissions.h output.h |
4 | SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp inputDialog.cpp filePermissions.cpp output.cpp main.cpp | 4 | SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp inputDialog.cpp filePermissions.cpp output.cpp main.cpp |
5 | TARGET = advancedfm | 5 | TARGET = advancedfm |
6 | REQUIRES=medium-config | 6 | REQUIRES=medium-config |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | DESTDIR = $(OPIEDIR)/bin | 9 | DESTDIR = $(OPIEDIR)/bin |
10 | LIBS += -lqpe | 10 | LIBS += -lqpe -lopie |
11 | 11 | ||
12 | TRANSLATIONS = ../../../i18n/de/advancedfm.ts \ | 12 | TRANSLATIONS = ../../../i18n/de/advancedfm.ts \ |
13 | ../../../i18n/en/advancedfm.ts \ | 13 | ../../../i18n/en/advancedfm.ts \ |
14 | ../../../i18n/es/advancedfm.ts \ | 14 | ../../../i18n/es/advancedfm.ts \ |
15 | ../../../i18n/fr/advancedfm.ts \ | 15 | ../../../i18n/fr/advancedfm.ts \ |
16 | ../../../i18n/hu/advancedfm.ts \ | 16 | ../../../i18n/hu/advancedfm.ts \ |
17 | ../../../i18n/ja/advancedfm.ts \ | 17 | ../../../i18n/ja/advancedfm.ts \ |
18 | ../../../i18n/ko/advancedfm.ts \ | 18 | ../../../i18n/ko/advancedfm.ts \ |
19 | ../../../i18n/no/advancedfm.ts \ | 19 | ../../../i18n/no/advancedfm.ts \ |
20 | ../../../i18n/pl/advancedfm.ts \ | 20 | ../../../i18n/pl/advancedfm.ts \ |
21 | ../../../i18n/pt/advancedfm.ts \ | 21 | ../../../i18n/pt/advancedfm.ts \ |
22 | ../../../i18n/pt_BR/advancedfm.ts \ | 22 | ../../../i18n/pt_BR/advancedfm.ts \ |
23 | ../../../i18n/sl/advancedfm.ts \ | 23 | ../../../i18n/sl/advancedfm.ts \ |
24 | ../../../i18n/zh_CN/advancedfm.ts \ | 24 | ../../../i18n/zh_CN/advancedfm.ts \ |
25 | ../../../i18n/zh_TW/advancedfm.ts | 25 | ../../../i18n/zh_TW/advancedfm.ts |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 619a7a9..7188640 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -1,237 +1,239 @@ | |||
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 <opie/otabwidget.h> | ||
14 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
15 | #include <qpe/qpemenubar.h> | 16 | #include <qpe/qpemenubar.h> |
16 | #include <qpe/qpetoolbar.h> | 17 | #include <qpe/qpetoolbar.h> |
17 | #include <qpe/resource.h> | 18 | #include <qpe/resource.h> |
18 | 19 | ||
19 | #include <qlayout.h> | 20 | #include <qlayout.h> |
20 | #include <qpixmap.h> | 21 | #include <qpixmap.h> |
21 | #include <qcombobox.h> | 22 | #include <qcombobox.h> |
22 | #include <qpopupmenu.h> | 23 | #include <qpopupmenu.h> |
23 | #include <qtabwidget.h> | 24 | #include <qtabwidget.h> |
24 | #include <qtoolbutton.h> | 25 | #include <qtoolbutton.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 | #if defined(QT_QWS_OPIE) | 33 | #if defined(QT_QWS_OPIE) |
34 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); | 34 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); |
35 | #endif | 35 | #endif |
36 | setCaption( tr( "AdvancedFm" ) ); | 36 | setCaption( tr( "AdvancedFm" ) ); |
37 | 37 | ||
38 | QGridLayout *layout = new QGridLayout( this ); | 38 | QGridLayout *layout = new QGridLayout( this ); |
39 | layout->setSpacing( 2); | 39 | layout->setSpacing( 2); |
40 | layout->setMargin( 2); | 40 | layout->setMargin( 2); |
41 | 41 | ||
42 | 42 | ||
43 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 43 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
44 | fileMenu = new QPopupMenu( this ); | 44 | fileMenu = new QPopupMenu( this ); |
45 | viewMenu = new QPopupMenu( this ); | 45 | viewMenu = new QPopupMenu( this ); |
46 | 46 | ||
47 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 47 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
48 | 48 | ||
49 | menuBar->insertItem( tr( "File" ), fileMenu); | 49 | menuBar->insertItem( tr( "File" ), fileMenu); |
50 | menuBar->insertItem( tr( "View" ), viewMenu); | 50 | menuBar->insertItem( tr( "View" ), viewMenu); |
51 | 51 | ||
52 | qpeDirButton= new QToolButton(this,"QPEButton"); | 52 | qpeDirButton= new QToolButton(this,"QPEButton"); |
53 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 53 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
54 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | 54 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); |
55 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | 55 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); |
56 | 56 | ||
57 | cfButton = new QToolButton( this,"CFButton"); | 57 | cfButton = new QToolButton( this,"CFButton"); |
58 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 58 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
59 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 59 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
60 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); | 60 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); |
61 | 61 | ||
62 | sdButton = new QToolButton( this,"SDButton"); | 62 | sdButton = new QToolButton( this,"SDButton"); |
63 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); | 63 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); |
64 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 64 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
65 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); | 65 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); |
66 | 66 | ||
67 | cdUpButton = new QToolButton( this,"cdUpButton"); | 67 | cdUpButton = new QToolButton( this,"cdUpButton"); |
68 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 68 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
69 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 69 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
70 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); | 70 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); |
71 | 71 | ||
72 | docButton = new QToolButton( this,"docsButton"); | 72 | docButton = new QToolButton( this,"docsButton"); |
73 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 73 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
74 | docButton->setFixedSize( QSize( 20, 20 ) ); | 74 | docButton->setFixedSize( QSize( 20, 20 ) ); |
75 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); | 75 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); |
76 | 76 | ||
77 | homeButton = new QToolButton( this,"homeButton"); | 77 | homeButton = new QToolButton( this,"homeButton"); |
78 | homeButton->setPixmap(Resource::loadPixmap("home")); | 78 | homeButton->setPixmap(Resource::loadPixmap("home")); |
79 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 79 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
80 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); | 80 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); |
81 | 81 | ||
82 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 82 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); |
83 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 83 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
84 | fileMenu->insertSeparator(); | 84 | fileMenu->insertSeparator(); |
85 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 85 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
86 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 86 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
87 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 87 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
88 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 88 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
89 | fileMenu->insertSeparator(); | 89 | fileMenu->insertSeparator(); |
90 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 90 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
91 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 91 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
92 | fileMenu->setCheckable(TRUE); | 92 | fileMenu->setCheckable(TRUE); |
93 | 93 | ||
94 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 94 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
95 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 95 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
96 | viewMenu->insertSeparator(); | 96 | viewMenu->insertSeparator(); |
97 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 97 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
98 | viewMenu->setCheckable(TRUE); | 98 | viewMenu->setCheckable(TRUE); |
99 | 99 | ||
100 | 100 | ||
101 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 101 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
102 | currentPathCombo->setEditable(TRUE); | 102 | currentPathCombo->setEditable(TRUE); |
103 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 103 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
104 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 104 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
105 | 105 | ||
106 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 106 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
107 | 107 | ||
108 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 108 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
109 | 109 | ||
110 | 110 | ||
111 | TabWidget = new QTabWidget( this, "TabWidget" ); | 111 | TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); |
112 | // TabWidget = new QTabWidget( this, "TabWidget" ); | ||
112 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); | 113 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); |
113 | 114 | ||
114 | tab = new QWidget( TabWidget, "tab" ); | 115 | tab = new QWidget( TabWidget, "tab" ); |
115 | tabLayout = new QGridLayout( tab ); | 116 | tabLayout = new QGridLayout( tab ); |
116 | tabLayout->setSpacing( 2); | 117 | tabLayout->setSpacing( 2); |
117 | tabLayout->setMargin( 2); | 118 | tabLayout->setMargin( 2); |
118 | 119 | ||
119 | Local_View = new QListView( tab, "Local_View" ); | 120 | Local_View = new QListView( tab, "Local_View" ); |
120 | Local_View->addColumn( tr("File"),130); | 121 | Local_View->addColumn( tr("File"),130); |
121 | Local_View->addColumn( tr("Size"),-1); | 122 | Local_View->addColumn( tr("Size"),-1); |
122 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 123 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
123 | Local_View->addColumn( tr("Date"),-1); | 124 | Local_View->addColumn( tr("Date"),-1); |
124 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 125 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
125 | Local_View->setAllColumnsShowFocus(TRUE); | 126 | Local_View->setAllColumnsShowFocus(TRUE); |
126 | Local_View->setMultiSelection( TRUE ); | 127 | Local_View->setMultiSelection( TRUE ); |
127 | Local_View->setSelectionMode(QListView::Extended); | 128 | Local_View->setSelectionMode(QListView::Extended); |
128 | 129 | ||
129 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 130 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
130 | 131 | ||
131 | tabLayout->addWidget( Local_View, 0, 0 ); | 132 | tabLayout->addWidget( Local_View, 0, 0 ); |
132 | 133 | ||
133 | TabWidget->insertTab( tab, tr("1")); | 134 | TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1")); |
135 | // TabWidget->insertTab( tab, tr("1")); | ||
134 | 136 | ||
135 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 137 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
136 | tabLayout_2 = new QGridLayout( tab_2 ); | 138 | tabLayout_2 = new QGridLayout( tab_2 ); |
137 | tabLayout_2->setSpacing( 2); | 139 | tabLayout_2->setSpacing( 2); |
138 | tabLayout_2->setMargin( 2); | 140 | tabLayout_2->setMargin( 2); |
139 | 141 | ||
140 | Remote_View = new QListView( tab_2, "Remote_View" ); | 142 | Remote_View = new QListView( tab_2, "Remote_View" ); |
141 | Remote_View->addColumn( tr("File"),130); | 143 | Remote_View->addColumn( tr("File"),130); |
142 | Remote_View->addColumn( tr("Size"),-1); | 144 | Remote_View->addColumn( tr("Size"),-1); |
143 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 145 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
144 | Remote_View->addColumn( tr("Date"),-1); | 146 | Remote_View->addColumn( tr("Date"),-1); |
145 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 147 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
146 | Remote_View->setAllColumnsShowFocus(TRUE); | 148 | Remote_View->setAllColumnsShowFocus(TRUE); |
147 | Remote_View->setMultiSelection( TRUE ); | 149 | Remote_View->setMultiSelection( TRUE ); |
148 | Remote_View->setSelectionMode(QListView::Extended); | 150 | Remote_View->setSelectionMode(QListView::Extended); |
149 | 151 | ||
150 | 152 | ||
151 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 153 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
152 | 154 | ||
153 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 155 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
154 | 156 | ||
155 | 157 | TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); | |
156 | TabWidget->insertTab( tab_2, tr( "2")); | 158 | // TabWidget->insertTab( tab_2, tr( "2")); |
157 | 159 | ||
158 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 160 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
159 | tabLayout_3 = new QGridLayout( tab_3 ); | 161 | tabLayout_3 = new QGridLayout( tab_3 ); |
160 | tabLayout_3->setSpacing( 2); | 162 | tabLayout_3->setSpacing( 2); |
161 | tabLayout_3->setMargin( 2); | 163 | tabLayout_3->setMargin( 2); |
162 | 164 | ||
163 | 165 | ||
164 | // OFileDialog fileDialog; | 166 | // OFileDialog fileDialog; |
165 | // fileDialog; | 167 | // fileDialog; |
166 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 168 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
167 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 169 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
168 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 170 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
169 | 171 | ||
170 | QListView *fileTree; | 172 | QListView *fileTree; |
171 | fileTree = new QListView( tab_3, "tree" ); | 173 | fileTree = new QListView( tab_3, "tree" ); |
172 | 174 | ||
173 | 175 | ||
174 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 176 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
175 | 177 | ||
176 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 178 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
177 | */ | 179 | */ |
178 | 180 | ||
179 | /////////////// | 181 | /////////////// |
180 | 182 | ||
181 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 183 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
182 | if (uname(&name) != -1) { | 184 | if (uname(&name) != -1) { |
183 | QString release=name.release; | 185 | QString release=name.release; |
184 | if(release.find("embedix",0,TRUE) !=-1) { | 186 | if(release.find("embedix",0,TRUE) !=-1) { |
185 | zaurusDevice=TRUE; | 187 | zaurusDevice=TRUE; |
186 | } else { | 188 | } else { |
187 | zaurusDevice=FALSE; | 189 | zaurusDevice=FALSE; |
188 | sdButton->hide(); | 190 | sdButton->hide(); |
189 | } | 191 | } |
190 | } | 192 | } |
191 | 193 | ||
192 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 194 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
193 | currentDir.setPath( QDir::currentDirPath()); | 195 | currentDir.setPath( QDir::currentDirPath()); |
194 | 196 | ||
195 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 197 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
196 | currentRemoteDir.setPath( QDir::currentDirPath()); | 198 | currentRemoteDir.setPath( QDir::currentDirPath()); |
197 | 199 | ||
198 | b = TRUE; | 200 | b = TRUE; |
199 | 201 | ||
200 | filterStr="*"; | 202 | filterStr="*"; |
201 | b=FALSE; | 203 | b=FALSE; |
202 | 204 | TabWidget->setCurrentTab(0); | |
203 | 205 | ||
204 | } | 206 | } |
205 | 207 | ||
206 | void AdvancedFm::initConnections() { | 208 | void AdvancedFm::initConnections() { |
207 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 209 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
208 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); | 210 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); |
209 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | 211 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); |
210 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | 212 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); |
211 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 213 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
212 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 214 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
213 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 215 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
214 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 216 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
215 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 217 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
216 | 218 | ||
217 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 219 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
218 | this,SLOT(currentPathComboChanged())); | 220 | this,SLOT(currentPathComboChanged())); |
219 | 221 | ||
220 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 222 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
221 | this,SLOT( localListClicked(QListViewItem *)) ); | 223 | this,SLOT( localListClicked(QListViewItem *)) ); |
222 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 224 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
223 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | 225 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); |
224 | 226 | ||
225 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | 227 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); |
226 | 228 | ||
227 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 229 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
228 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 230 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
229 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 231 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
230 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 232 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
231 | 233 | ||
232 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 234 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
233 | this,SLOT(tabChanged(QWidget*))); | 235 | this,SLOT(tabChanged(QWidget*))); |
234 | 236 | ||
235 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); | 237 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); |
236 | 238 | ||
237 | } | 239 | } |
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 5fa8d0c..27a119f 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -1,948 +1,964 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | AdvancedFm.cpp | 2 | AdvancedFm.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #include "advancedfm.h" | 12 | #include "advancedfm.h" |
13 | #include "inputDialog.h" | 13 | #include "inputDialog.h" |
14 | #include "output.h" | 14 | #include "output.h" |
15 | #include "filePermissions.h" | 15 | #include "filePermissions.h" |
16 | 16 | ||
17 | #include <opie/otabwidget.h> | ||
18 | |||
17 | #include <qpe/lnkproperties.h> | 19 | #include <qpe/lnkproperties.h> |
18 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
19 | #include <qpe/qpemenubar.h> | 21 | #include <qpe/qpemenubar.h> |
20 | #include <qpe/qpetoolbar.h> | 22 | #include <qpe/qpetoolbar.h> |
21 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
24 | #include <qpe/ir.h> | 26 | #include <qpe/ir.h> |
25 | 27 | ||
26 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
27 | #include <qmultilineedit.h> | 29 | #include <qmultilineedit.h> |
28 | 30 | ||
29 | #include <qstring.h> | 31 | #include <qstring.h> |
30 | 32 | ||
31 | #include <qlayout.h> | 33 | #include <qlayout.h> |
32 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
33 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
34 | #include <qpopupmenu.h> | 36 | #include <qpopupmenu.h> |
35 | #include <qtabwidget.h> | 37 | #include <qtabwidget.h> |
36 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
37 | #include <qtabwidget.h> | 39 | #include <qtabwidget.h> |
38 | #include <qlineedit.h> | 40 | #include <qlineedit.h> |
39 | #include <qlistview.h> | 41 | #include <qlistview.h> |
40 | 42 | ||
41 | #include <stdlib.h> | 43 | #include <stdlib.h> |
42 | #include <unistd.h> | 44 | #include <unistd.h> |
43 | #include <sys/stat.h> | 45 | #include <sys/stat.h> |
44 | #include <dirent.h> | 46 | #include <dirent.h> |
45 | 47 | ||
46 | 48 | ||
47 | void AdvancedFm::doLocalCd() { | 49 | void AdvancedFm::doLocalCd() { |
48 | localListClicked( Local_View->currentItem()); | 50 | localListClicked( Local_View->currentItem()); |
49 | } | 51 | } |
50 | 52 | ||
51 | void AdvancedFm::doRemoteCd() { | 53 | void AdvancedFm::doRemoteCd() { |
52 | localListClicked( Remote_View->currentItem()); | 54 | localListClicked( Remote_View->currentItem()); |
53 | } | 55 | } |
54 | 56 | ||
55 | void AdvancedFm::showMenuHidden() { | 57 | void AdvancedFm::showMenuHidden() { |
56 | if(TabWidget->currentPageIndex() == 0) | 58 | if (b) { |
57 | showHidden(); | 59 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
58 | else | 60 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
59 | showRemoteHidden(); | 61 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
62 | // b=FALSE; | ||
63 | |||
64 | } else { | ||
65 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | ||
66 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | ||
67 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | ||
68 | // b=TRUE; | ||
69 | } | ||
70 | populateLocalView(); | ||
71 | populateRemoteView(); | ||
72 | // if(TabWidget->getCurrentTab() == 0) | ||
73 | // showHidden(); | ||
74 | // else | ||
75 | // showRemoteHidden(); | ||
60 | // if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); | 76 | // if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); |
61 | if(b) b = false; else b = true; | 77 | if(b) b = false; else b = true; |
62 | } | 78 | } |
63 | 79 | ||
64 | void AdvancedFm::showHidden() { | 80 | void AdvancedFm::showHidden() { |
65 | if (b) { | 81 | if (b) { |
66 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 82 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
67 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 83 | // fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
68 | // b=FALSE; | 84 | // b=FALSE; |
69 | 85 | ||
70 | } else { | 86 | } else { |
71 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 87 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
72 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 88 | // fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
73 | // b=TRUE; | 89 | // b=TRUE; |
74 | } | 90 | } |
75 | populateLocalView(); | 91 | populateLocalView(); |
76 | } | 92 | } |
77 | 93 | ||
78 | void AdvancedFm::showRemoteHidden() { | 94 | void AdvancedFm::showRemoteHidden() { |
79 | if (b) { | 95 | if (b) { |
80 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 96 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
81 | // b=TRUE; | 97 | // b=TRUE; |
82 | 98 | ||
83 | } else { | 99 | } else { |
84 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 100 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
85 | // b=FALSE; | 101 | // b=FALSE; |
86 | } | 102 | } |
87 | populateRemoteView(); | 103 | populateRemoteView(); |
88 | } | 104 | } |
89 | 105 | ||
90 | void AdvancedFm::runThis() { | 106 | void AdvancedFm::runThis() { |
91 | QString fs; | 107 | QString fs; |
92 | if (TabWidget->currentPageIndex() == 0) { | 108 | if (TabWidget->getCurrentTab() == 0) { |
93 | QString curFile = Local_View->currentItem()->text(0); | 109 | QString curFile = Local_View->currentItem()->text(0); |
94 | if(curFile != "../") { | 110 | if(curFile != "../") { |
95 | 111 | ||
96 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 112 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
97 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 113 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
98 | qDebug( fileInfo.owner()); | 114 | qDebug( fileInfo.owner()); |
99 | if( (fileInfo.permission( QFileInfo::ExeUser) | 115 | if( (fileInfo.permission( QFileInfo::ExeUser) |
100 | | fileInfo.permission( QFileInfo::ExeGroup) | 116 | | fileInfo.permission( QFileInfo::ExeGroup) |
101 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 117 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
102 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 118 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
103 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 119 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
104 | e << curFile; | 120 | e << curFile; |
105 | } else { | 121 | } else { |
106 | curFile = currentDir.canonicalPath()+"/"+curFile; | 122 | curFile = currentDir.canonicalPath()+"/"+curFile; |
107 | DocLnk nf(curFile); | 123 | DocLnk nf(curFile); |
108 | QString execStr = nf.exec(); | 124 | QString execStr = nf.exec(); |
109 | qDebug( execStr); | 125 | qDebug( execStr); |
110 | if( execStr.isEmpty() ) { | 126 | if( execStr.isEmpty() ) { |
111 | } else { | 127 | } else { |
112 | nf.execute(); | 128 | nf.execute(); |
113 | } | 129 | } |
114 | } | 130 | } |
115 | } | 131 | } |
116 | } else { | 132 | } else { |
117 | QString curFile = Remote_View->currentItem()->text(0); | 133 | QString curFile = Remote_View->currentItem()->text(0); |
118 | if(curFile != "../") { | 134 | if(curFile != "../") { |
119 | 135 | ||
120 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 136 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
121 | qDebug("Filesystemtype is "+fs); | 137 | qDebug("Filesystemtype is "+fs); |
122 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 138 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
123 | if( (fileInfo.permission( QFileInfo::ExeUser) | 139 | if( (fileInfo.permission( QFileInfo::ExeUser) |
124 | | fileInfo.permission( QFileInfo::ExeGroup) | 140 | | fileInfo.permission( QFileInfo::ExeGroup) |
125 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 141 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
126 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 142 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
127 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 143 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
128 | e << curFile; | 144 | e << curFile; |
129 | } else { | 145 | } else { |
130 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 146 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
131 | DocLnk nf(curFile); | 147 | DocLnk nf(curFile); |
132 | QString execStr = nf.exec(); | 148 | QString execStr = nf.exec(); |
133 | qDebug(execStr); | 149 | qDebug(execStr); |
134 | if( execStr.isEmpty() ) { | 150 | if( execStr.isEmpty() ) { |
135 | } else { | 151 | } else { |
136 | nf.execute(); | 152 | nf.execute(); |
137 | } | 153 | } |
138 | } | 154 | } |
139 | } | 155 | } |
140 | } | 156 | } |
141 | } | 157 | } |
142 | 158 | ||
143 | void AdvancedFm::runText() { | 159 | void AdvancedFm::runText() { |
144 | if (TabWidget->currentPageIndex() == 0) { | 160 | if (TabWidget->getCurrentTab() == 0) { |
145 | QString curFile = Local_View->currentItem()->text(0); | 161 | QString curFile = Local_View->currentItem()->text(0); |
146 | if(curFile != "../") { | 162 | if(curFile != "../") { |
147 | curFile = currentDir.canonicalPath()+"/"+curFile; | 163 | curFile = currentDir.canonicalPath()+"/"+curFile; |
148 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 164 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
149 | e << curFile; | 165 | e << curFile; |
150 | } | 166 | } |
151 | } else { | 167 | } else { |
152 | QString curFile = Remote_View->currentItem()->text(0); | 168 | QString curFile = Remote_View->currentItem()->text(0); |
153 | if(curFile != "../") { | 169 | if(curFile != "../") { |
154 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 170 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
155 | DocLnk nf(curFile); | 171 | DocLnk nf(curFile); |
156 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 172 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
157 | e << curFile; | 173 | e << curFile; |
158 | } | 174 | } |
159 | } | 175 | } |
160 | } | 176 | } |
161 | 177 | ||
162 | void AdvancedFm::localMakDir() { | 178 | void AdvancedFm::localMakDir() { |
163 | InputDialog *fileDlg; | 179 | InputDialog *fileDlg; |
164 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 180 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
165 | fileDlg->exec(); | 181 | fileDlg->exec(); |
166 | if( fileDlg->result() == 1 ) { | 182 | if( fileDlg->result() == 1 ) { |
167 | QString filename = fileDlg->LineEdit1->text(); | 183 | QString filename = fileDlg->LineEdit1->text(); |
168 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 184 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
169 | } | 185 | } |
170 | populateLocalView(); | 186 | populateLocalView(); |
171 | } | 187 | } |
172 | 188 | ||
173 | void AdvancedFm::remoteMakDir() { | 189 | void AdvancedFm::remoteMakDir() { |
174 | InputDialog *fileDlg; | 190 | InputDialog *fileDlg; |
175 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 191 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
176 | fileDlg->exec(); | 192 | fileDlg->exec(); |
177 | if( fileDlg->result() == 1 ) { | 193 | if( fileDlg->result() == 1 ) { |
178 | QString filename = fileDlg->LineEdit1->text(); | 194 | QString filename = fileDlg->LineEdit1->text(); |
179 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 195 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
180 | } | 196 | } |
181 | populateRemoteView(); | 197 | populateRemoteView(); |
182 | } | 198 | } |
183 | 199 | ||
184 | void AdvancedFm::localDelete() { | 200 | void AdvancedFm::localDelete() { |
185 | QStringList curFileList = getPath(); | 201 | QStringList curFileList = getPath(); |
186 | if(curFileList.count() > 0) { | 202 | if(curFileList.count() > 0) { |
187 | QString myFile; | 203 | QString myFile; |
188 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 204 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
189 | myFile = (*it); | 205 | myFile = (*it); |
190 | if( myFile.find(" -> ",0,TRUE) != -1) | 206 | if( myFile.find(" -> ",0,TRUE) != -1) |
191 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 207 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
192 | 208 | ||
193 | QString f = currentDir.canonicalPath(); | 209 | QString f = currentDir.canonicalPath(); |
194 | if(f.right(1).find("/",0,TRUE) == -1) | 210 | if(f.right(1).find("/",0,TRUE) == -1) |
195 | f+="/"; | 211 | f+="/"; |
196 | f+=myFile; | 212 | f+=myFile; |
197 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 213 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
198 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 214 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
199 | "\nand all it's contents ?" | 215 | "\nand all it's contents ?" |
200 | ,tr("Yes"),tr("No"),0,0,1) ) { | 216 | ,tr("Yes"),tr("No"),0,0,1) ) { |
201 | case 0: { | 217 | case 0: { |
202 | f=f.left(f.length()-1); | 218 | f=f.left(f.length()-1); |
203 | QString cmd="rm -rf "+f; | 219 | QString cmd="rm -rf "+f; |
204 | system( cmd.latin1()); | 220 | system( cmd.latin1()); |
205 | populateLocalView(); | 221 | populateLocalView(); |
206 | } | 222 | } |
207 | break; | 223 | break; |
208 | case 1: | 224 | case 1: |
209 | // exit | 225 | // exit |
210 | break; | 226 | break; |
211 | }; | 227 | }; |
212 | 228 | ||
213 | } else { | 229 | } else { |
214 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 230 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
215 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 231 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
216 | case 0: { | 232 | case 0: { |
217 | QString cmd="rm "+f; | 233 | QString cmd="rm "+f; |
218 | QFile file(f); | 234 | QFile file(f); |
219 | file.remove(); | 235 | file.remove(); |
220 | // system( cmd.latin1()); | 236 | // system( cmd.latin1()); |
221 | populateLocalView(); | 237 | populateLocalView(); |
222 | } | 238 | } |
223 | break; | 239 | break; |
224 | case 1: | 240 | case 1: |
225 | // exit | 241 | // exit |
226 | break; | 242 | break; |
227 | }; | 243 | }; |
228 | } | 244 | } |
229 | } | 245 | } |
230 | } | 246 | } |
231 | } | 247 | } |
232 | 248 | ||
233 | void AdvancedFm::remoteDelete() { | 249 | void AdvancedFm::remoteDelete() { |
234 | QStringList curFileList = getPath(); | 250 | QStringList curFileList = getPath(); |
235 | if( curFileList.count() > 0) { | 251 | if( curFileList.count() > 0) { |
236 | QString myFile; | 252 | QString myFile; |
237 | 253 | ||
238 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 254 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
239 | myFile = (*it); | 255 | myFile = (*it); |
240 | if(myFile.find(" -> ",0,TRUE) != -1) | 256 | if(myFile.find(" -> ",0,TRUE) != -1) |
241 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 257 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
242 | QString f = currentRemoteDir.canonicalPath(); | 258 | QString f = currentRemoteDir.canonicalPath(); |
243 | if(f.right(1).find("/",0,TRUE) == -1) | 259 | if(f.right(1).find("/",0,TRUE) == -1) |
244 | f+="/"; | 260 | f+="/"; |
245 | f+=myFile; | 261 | f+=myFile; |
246 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 262 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
247 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 263 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
248 | "\nand all it's contents ?", | 264 | "\nand all it's contents ?", |
249 | tr("Yes"),tr("No"),0,0,1) ) { | 265 | tr("Yes"),tr("No"),0,0,1) ) { |
250 | case 0: { | 266 | case 0: { |
251 | f=f.left(f.length()-1); | 267 | f=f.left(f.length()-1); |
252 | QString cmd="rm -rf "+f; | 268 | QString cmd="rm -rf "+f; |
253 | system( cmd.latin1()); | 269 | system( cmd.latin1()); |
254 | populateRemoteView(); | 270 | populateRemoteView(); |
255 | } | 271 | } |
256 | break; | 272 | break; |
257 | case 1: | 273 | case 1: |
258 | // exit | 274 | // exit |
259 | break; | 275 | break; |
260 | }; | 276 | }; |
261 | 277 | ||
262 | } else { | 278 | } else { |
263 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 279 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
264 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 280 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
265 | case 0: { | 281 | case 0: { |
266 | QString cmd="rm "+f; | 282 | QString cmd="rm "+f; |
267 | QFile file(f); | 283 | QFile file(f); |
268 | file.remove(); | 284 | file.remove(); |
269 | // system( cmd.latin1()); | 285 | // system( cmd.latin1()); |
270 | populateRemoteView(); | 286 | populateRemoteView(); |
271 | } | 287 | } |
272 | break; | 288 | break; |
273 | case 1: | 289 | case 1: |
274 | // exit | 290 | // exit |
275 | break; | 291 | break; |
276 | }; | 292 | }; |
277 | } | 293 | } |
278 | } | 294 | } |
279 | } | 295 | } |
280 | } | 296 | } |
281 | 297 | ||
282 | void AdvancedFm::localRename() { | 298 | void AdvancedFm::localRename() { |
283 | QString curFile = Local_View->currentItem()->text(0); | 299 | QString curFile = Local_View->currentItem()->text(0); |
284 | qDebug("currentItem "+curFile); | 300 | qDebug("currentItem "+curFile); |
285 | if( curFile !="../") { | 301 | if( curFile !="../") { |
286 | InputDialog *fileDlg; | 302 | InputDialog *fileDlg; |
287 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 303 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
288 | fileDlg->setInputText((const QString &)curFile); | 304 | fileDlg->setInputText((const QString &)curFile); |
289 | fileDlg->exec(); | 305 | fileDlg->exec(); |
290 | if( fileDlg->result() == 1 ) { | 306 | if( fileDlg->result() == 1 ) { |
291 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 307 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
292 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); | 308 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); |
293 | //+".playlist"; | 309 | //+".playlist"; |
294 | if( rename(oldname.latin1(), newName.latin1())== -1) | 310 | if( rename(oldname.latin1(), newName.latin1())== -1) |
295 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 311 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
296 | } | 312 | } |
297 | populateLocalView(); | 313 | populateLocalView(); |
298 | } | 314 | } |
299 | } | 315 | } |
300 | 316 | ||
301 | void AdvancedFm::remoteRename() | 317 | void AdvancedFm::remoteRename() |
302 | { | 318 | { |
303 | QString curFile = Remote_View->currentItem()->text(0); | 319 | QString curFile = Remote_View->currentItem()->text(0); |
304 | if( curFile !="../") { | 320 | if( curFile !="../") { |
305 | InputDialog *fileDlg; | 321 | InputDialog *fileDlg; |
306 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 322 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
307 | fileDlg->setInputText((const QString &)curFile); | 323 | fileDlg->setInputText((const QString &)curFile); |
308 | fileDlg->exec(); | 324 | fileDlg->exec(); |
309 | if( fileDlg->result() == 1 ) { | 325 | if( fileDlg->result() == 1 ) { |
310 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 326 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
311 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); | 327 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); |
312 | //+".playlist"; | 328 | //+".playlist"; |
313 | if( rename(oldname.latin1(), newName.latin1())== -1) | 329 | if( rename(oldname.latin1(), newName.latin1())== -1) |
314 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 330 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
315 | } | 331 | } |
316 | populateRemoteView(); | 332 | populateRemoteView(); |
317 | } | 333 | } |
318 | } | 334 | } |
319 | 335 | ||
320 | 336 | ||
321 | void AdvancedFm::filePerms() { | 337 | void AdvancedFm::filePerms() { |
322 | 338 | ||
323 | QStringList curFileList = getPath(); | 339 | QStringList curFileList = getPath(); |
324 | QString filePath; | 340 | QString filePath; |
325 | 341 | ||
326 | if (TabWidget->currentPageIndex() == 0) { | 342 | if (TabWidget->getCurrentTab() == 0) { |
327 | filePath = currentDir.canonicalPath()+"/"; | 343 | filePath = currentDir.canonicalPath()+"/"; |
328 | } else { | 344 | } else { |
329 | filePath= currentRemoteDir.canonicalPath()+"/"; | 345 | filePath= currentRemoteDir.canonicalPath()+"/"; |
330 | } | 346 | } |
331 | 347 | ||
332 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 348 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
333 | filePermissions *filePerm; | 349 | filePermissions *filePerm; |
334 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 350 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
335 | filePerm->showMaximized(); | 351 | filePerm->showMaximized(); |
336 | filePerm->exec(); | 352 | filePerm->exec(); |
337 | if( filePerm) | 353 | if( filePerm) |
338 | delete filePerm; | 354 | delete filePerm; |
339 | } | 355 | } |
340 | if (TabWidget->currentPageIndex() == 0) { | 356 | if (TabWidget->getCurrentTab() == 0) { |
341 | populateLocalView(); | 357 | populateLocalView(); |
342 | } else { | 358 | } else { |
343 | populateRemoteView(); | 359 | populateRemoteView(); |
344 | } | 360 | } |
345 | } | 361 | } |
346 | 362 | ||
347 | void AdvancedFm::doProperties() { | 363 | void AdvancedFm::doProperties() { |
348 | #if defined(QT_QWS_OPIE) | 364 | #if defined(QT_QWS_OPIE) |
349 | 365 | ||
350 | QStringList curFileList = getPath(); | 366 | QStringList curFileList = getPath(); |
351 | 367 | ||
352 | QString filePath; | 368 | QString filePath; |
353 | if (TabWidget->currentPageIndex() == 0) { | 369 | if (TabWidget->getCurrentTab() == 0) { |
354 | filePath = currentDir.canonicalPath()+"/"; | 370 | filePath = currentDir.canonicalPath()+"/"; |
355 | } else { | 371 | } else { |
356 | filePath= currentRemoteDir.canonicalPath()+"/"; | 372 | filePath= currentRemoteDir.canonicalPath()+"/"; |
357 | } | 373 | } |
358 | qDebug("%d",curFileList.count()); | 374 | qDebug("%d",curFileList.count()); |
359 | 375 | ||
360 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 376 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
361 | qDebug((filePath+*it)); | 377 | qDebug((filePath+*it)); |
362 | DocLnk lnk( (filePath+*it)); | 378 | DocLnk lnk( (filePath+*it)); |
363 | LnkProperties prop( &lnk ); | 379 | LnkProperties prop( &lnk ); |
364 | prop.showMaximized(); | 380 | prop.showMaximized(); |
365 | prop.exec(); | 381 | prop.exec(); |
366 | } | 382 | } |
367 | #endif | 383 | #endif |
368 | 384 | ||
369 | } | 385 | } |
370 | 386 | ||
371 | void AdvancedFm::upDir() { | 387 | void AdvancedFm::upDir() { |
372 | if (TabWidget->currentPageIndex() == 0) { | 388 | if (TabWidget->getCurrentTab() == 0) { |
373 | QString current = currentDir.canonicalPath(); | 389 | QString current = currentDir.canonicalPath(); |
374 | QDir dir(current); | 390 | QDir dir(current); |
375 | dir.cdUp(); | 391 | dir.cdUp(); |
376 | current = dir.canonicalPath(); | 392 | current = dir.canonicalPath(); |
377 | chdir( current.latin1() ); | 393 | chdir( current.latin1() ); |
378 | currentDir.cd( current, TRUE); | 394 | currentDir.cd( current, TRUE); |
379 | populateLocalView(); | 395 | populateLocalView(); |
380 | update(); | 396 | update(); |
381 | } else { | 397 | } else { |
382 | QString current = currentRemoteDir.canonicalPath(); | 398 | QString current = currentRemoteDir.canonicalPath(); |
383 | QDir dir(current); | 399 | QDir dir(current); |
384 | dir.cdUp(); | 400 | dir.cdUp(); |
385 | current = dir.canonicalPath(); | 401 | current = dir.canonicalPath(); |
386 | chdir( current.latin1() ); | 402 | chdir( current.latin1() ); |
387 | currentRemoteDir.cd( current, TRUE); | 403 | currentRemoteDir.cd( current, TRUE); |
388 | populateRemoteView(); | 404 | populateRemoteView(); |
389 | update(); | 405 | update(); |
390 | } | 406 | } |
391 | } | 407 | } |
392 | 408 | ||
393 | void AdvancedFm::copy() { | 409 | void AdvancedFm::copy() { |
394 | qApp->processEvents(); | 410 | qApp->processEvents(); |
395 | QStringList curFileList = getPath(); | 411 | QStringList curFileList = getPath(); |
396 | if( curFileList.count() > 0) { | 412 | if( curFileList.count() > 0) { |
397 | QString curFile, item, destFile; | 413 | QString curFile, item, destFile; |
398 | if (TabWidget->currentPageIndex() == 0) { | 414 | if (TabWidget->getCurrentTab() == 0) { |
399 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 415 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
400 | item=(*it); | 416 | item=(*it); |
401 | 417 | ||
402 | if(item.find("->",0,TRUE)) //symlink | 418 | if(item.find("->",0,TRUE)) //symlink |
403 | item = item.left(item.find("->",0,TRUE)); | 419 | item = item.left(item.find("->",0,TRUE)); |
404 | 420 | ||
405 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; | 421 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; |
406 | qDebug("Destination file is "+destFile); | 422 | qDebug("Destination file is "+destFile); |
407 | 423 | ||
408 | curFile = currentDir.canonicalPath()+"/"+ item; | 424 | curFile = currentDir.canonicalPath()+"/"+ item; |
409 | qDebug("CurrentFile file is " + curFile); | 425 | qDebug("CurrentFile file is " + curFile); |
410 | 426 | ||
411 | QFile f(destFile); | 427 | QFile f(destFile); |
412 | if( f.exists()) { | 428 | if( f.exists()) { |
413 | switch ( QMessageBox::warning(this,tr("Delete"), | 429 | switch ( QMessageBox::warning(this,tr("Delete"), |
414 | destFile+tr(" already exists\nDo you really want to delete it?"), | 430 | destFile+tr(" already exists\nDo you really want to delete it?"), |
415 | tr("Yes"),tr("No"),0,0,1) ) { | 431 | tr("Yes"),tr("No"),0,0,1) ) { |
416 | case 0: | 432 | case 0: |
417 | f.remove(); | 433 | f.remove(); |
418 | break; | 434 | break; |
419 | case 1: | 435 | case 1: |
420 | return; | 436 | return; |
421 | break; | 437 | break; |
422 | }; | 438 | }; |
423 | } | 439 | } |
424 | if(!copyFile(destFile, curFile) ) { | 440 | if(!copyFile(destFile, curFile) ) { |
425 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 441 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
426 | return; | 442 | return; |
427 | } | 443 | } |
428 | } | 444 | } |
429 | populateRemoteView(); | 445 | populateRemoteView(); |
430 | TabWidget->setCurrentPage(1); | 446 | TabWidget->setCurrentTab(1); |
431 | 447 | ||
432 | } else { | 448 | } else { |
433 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 449 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
434 | item= (*it); | 450 | item= (*it); |
435 | 451 | ||
436 | if(item.find("->",0,TRUE)) //symlink | 452 | if(item.find("->",0,TRUE)) //symlink |
437 | item = item.left(item.find("->",0,TRUE)); | 453 | item = item.left(item.find("->",0,TRUE)); |
438 | 454 | ||
439 | destFile = currentDir.canonicalPath()+"/"+ item; | 455 | destFile = currentDir.canonicalPath()+"/"+ item; |
440 | qDebug("Destination file is "+destFile); | 456 | qDebug("Destination file is "+destFile); |
441 | 457 | ||
442 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; | 458 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; |
443 | qDebug("CurrentFile file is " + curFile); | 459 | qDebug("CurrentFile file is " + curFile); |
444 | 460 | ||
445 | QFile f(destFile); | 461 | QFile f(destFile); |
446 | if( f.exists()) { | 462 | if( f.exists()) { |
447 | switch ( QMessageBox::warning(this,tr("Delete"), | 463 | switch ( QMessageBox::warning(this,tr("Delete"), |
448 | destFile+tr(" already exists\nDo you really want to delete it?"), | 464 | destFile+tr(" already exists\nDo you really want to delete it?"), |
449 | tr("Yes"),tr("No"),0,0,1) ) { | 465 | tr("Yes"),tr("No"),0,0,1) ) { |
450 | case 0: | 466 | case 0: |
451 | f.remove(); | 467 | f.remove(); |
452 | break; | 468 | break; |
453 | case 1: | 469 | case 1: |
454 | return; | 470 | return; |
455 | break; | 471 | break; |
456 | }; | 472 | }; |
457 | } | 473 | } |
458 | if(!copyFile(destFile, curFile) ) { | 474 | if(!copyFile(destFile, curFile) ) { |
459 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 475 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
460 | +curFile +tr("to\n")+destFile); | 476 | +curFile +tr("to\n")+destFile); |
461 | return; | 477 | return; |
462 | 478 | ||
463 | } | 479 | } |
464 | } | 480 | } |
465 | populateLocalView(); | 481 | populateLocalView(); |
466 | TabWidget->setCurrentPage(0); | 482 | TabWidget->setCurrentTab(0); |
467 | } | 483 | } |
468 | 484 | ||
469 | } | 485 | } |
470 | } | 486 | } |
471 | 487 | ||
472 | void AdvancedFm::copyAs() { | 488 | void AdvancedFm::copyAs() { |
473 | qApp->processEvents(); | 489 | qApp->processEvents(); |
474 | 490 | ||
475 | QStringList curFileList = getPath(); | 491 | QStringList curFileList = getPath(); |
476 | QString curFile; | 492 | QString curFile; |
477 | InputDialog *fileDlg; | 493 | InputDialog *fileDlg; |
478 | if (TabWidget->currentPageIndex() == 0) { | 494 | if (TabWidget->getCurrentTab() == 0) { |
479 | qDebug("tab 1"); | 495 | qDebug("tab 1"); |
480 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 496 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
481 | QString destFile; | 497 | QString destFile; |
482 | curFile = currentDir.canonicalPath()+"/"+(*it); | 498 | curFile = currentDir.canonicalPath()+"/"+(*it); |
483 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 499 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
484 | 500 | ||
485 | fileDlg->setInputText((const QString &) destFile ); | 501 | fileDlg->setInputText((const QString &) destFile ); |
486 | fileDlg->exec(); | 502 | fileDlg->exec(); |
487 | 503 | ||
488 | if( fileDlg->result() == 1 ) { | 504 | if( fileDlg->result() == 1 ) { |
489 | QString filename = fileDlg->LineEdit1->text(); | 505 | QString filename = fileDlg->LineEdit1->text(); |
490 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 506 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
491 | 507 | ||
492 | QFile f(destFile); | 508 | QFile f(destFile); |
493 | if( f.exists()) { | 509 | if( f.exists()) { |
494 | switch (QMessageBox::warning(this,tr("Delete"), | 510 | switch (QMessageBox::warning(this,tr("Delete"), |
495 | destFile+tr(" already exists\nDo you really want to delete it?"), | 511 | destFile+tr(" already exists\nDo you really want to delete it?"), |
496 | tr("Yes"),tr("No"),0,0,1) ) { | 512 | tr("Yes"),tr("No"),0,0,1) ) { |
497 | case 0: | 513 | case 0: |
498 | f.remove(); | 514 | f.remove(); |
499 | break; | 515 | break; |
500 | case 1: | 516 | case 1: |
501 | return; | 517 | return; |
502 | break; | 518 | break; |
503 | }; | 519 | }; |
504 | } | 520 | } |
505 | if(!copyFile(destFile, curFile) ) { | 521 | if(!copyFile(destFile, curFile) ) { |
506 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 522 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
507 | +curFile +tr("to\n")+destFile); | 523 | +curFile +tr("to\n")+destFile); |
508 | return; | 524 | return; |
509 | } | 525 | } |
510 | } | 526 | } |
511 | delete fileDlg; | 527 | delete fileDlg; |
512 | 528 | ||
513 | } | 529 | } |
514 | populateRemoteView(); | 530 | populateRemoteView(); |
515 | TabWidget->setCurrentPage(1); | 531 | TabWidget->setCurrentTab(1); |
516 | 532 | ||
517 | } else { | 533 | } else { |
518 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 534 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
519 | 535 | ||
520 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 536 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
521 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 537 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
522 | 538 | ||
523 | QString destFile; | 539 | QString destFile; |
524 | fileDlg->setInputText((const QString &) destFile); | 540 | fileDlg->setInputText((const QString &) destFile); |
525 | fileDlg->exec(); | 541 | fileDlg->exec(); |
526 | 542 | ||
527 | if( fileDlg->result() == 1 ) { | 543 | if( fileDlg->result() == 1 ) { |
528 | QString filename = fileDlg->LineEdit1->text(); | 544 | QString filename = fileDlg->LineEdit1->text(); |
529 | destFile = currentDir.canonicalPath()+"/"+filename; | 545 | destFile = currentDir.canonicalPath()+"/"+filename; |
530 | 546 | ||
531 | QFile f( destFile); | 547 | QFile f( destFile); |
532 | if( f.exists()) { | 548 | if( f.exists()) { |
533 | switch ( QMessageBox::warning(this,tr("Delete"), | 549 | switch ( QMessageBox::warning(this,tr("Delete"), |
534 | destFile+tr(" already exists\nDo you really want to delete it?"), | 550 | destFile+tr(" already exists\nDo you really want to delete it?"), |
535 | tr("Yes"),tr("No"),0,0,1) ) { | 551 | tr("Yes"),tr("No"),0,0,1) ) { |
536 | case 0: | 552 | case 0: |
537 | f.remove(); | 553 | f.remove(); |
538 | break; | 554 | break; |
539 | case 1: | 555 | case 1: |
540 | return; | 556 | return; |
541 | break; | 557 | break; |
542 | }; | 558 | }; |
543 | } | 559 | } |
544 | if(!copyFile(destFile, curFile) ) { | 560 | if(!copyFile(destFile, curFile) ) { |
545 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 561 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
546 | +curFile +tr("to\n")+destFile); | 562 | +curFile +tr("to\n")+destFile); |
547 | return; | 563 | return; |
548 | } | 564 | } |
549 | 565 | ||
550 | } | 566 | } |
551 | delete fileDlg; | 567 | delete fileDlg; |
552 | 568 | ||
553 | } | 569 | } |
554 | populateLocalView(); | 570 | populateLocalView(); |
555 | TabWidget->setCurrentPage(0); | 571 | TabWidget->setCurrentTab(0); |
556 | } | 572 | } |
557 | } | 573 | } |
558 | 574 | ||
559 | void AdvancedFm::copySameDir() { | 575 | void AdvancedFm::copySameDir() { |
560 | qApp->processEvents(); | 576 | qApp->processEvents(); |
561 | QStringList curFileList = getPath(); | 577 | QStringList curFileList = getPath(); |
562 | QString curFile, item, destFile; | 578 | QString curFile, item, destFile; |
563 | InputDialog *fileDlg; | 579 | InputDialog *fileDlg; |
564 | 580 | ||
565 | if (TabWidget->currentPageIndex() == 0) { | 581 | if (TabWidget->getCurrentTab() == 0) { |
566 | 582 | ||
567 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 583 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
568 | item=(*it); | 584 | item=(*it); |
569 | curFile = currentDir.canonicalPath()+"/"+ item; | 585 | curFile = currentDir.canonicalPath()+"/"+ item; |
570 | 586 | ||
571 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 587 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
572 | fileDlg->setInputText((const QString &) destFile ); | 588 | fileDlg->setInputText((const QString &) destFile ); |
573 | fileDlg->exec(); | 589 | fileDlg->exec(); |
574 | 590 | ||
575 | if( fileDlg->result() == 1 ) { | 591 | if( fileDlg->result() == 1 ) { |
576 | 592 | ||
577 | QString filename = fileDlg->LineEdit1->text(); | 593 | QString filename = fileDlg->LineEdit1->text(); |
578 | destFile = currentDir.canonicalPath()+"/"+filename; | 594 | destFile = currentDir.canonicalPath()+"/"+filename; |
579 | 595 | ||
580 | QFile f(destFile); | 596 | QFile f(destFile); |
581 | if( f.exists()) { | 597 | if( f.exists()) { |
582 | switch (QMessageBox::warning(this,tr("Delete"), | 598 | switch (QMessageBox::warning(this,tr("Delete"), |
583 | destFile+tr(" already exists\nDo you really want to delete it?"), | 599 | destFile+tr(" already exists\nDo you really want to delete it?"), |
584 | tr("Yes"),tr("No"),0,0,1) ) { | 600 | tr("Yes"),tr("No"),0,0,1) ) { |
585 | case 0: | 601 | case 0: |
586 | 602 | ||
587 | f.remove(); | 603 | f.remove(); |
588 | break; | 604 | break; |
589 | case 1: | 605 | case 1: |
590 | return; | 606 | return; |
591 | break; | 607 | break; |
592 | }; | 608 | }; |
593 | } | 609 | } |
594 | if(!copyFile(destFile, curFile) ) { | 610 | if(!copyFile(destFile, curFile) ) { |
595 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 611 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
596 | +curFile +tr("to\n")+destFile); | 612 | +curFile +tr("to\n")+destFile); |
597 | return; | 613 | return; |
598 | } | 614 | } |
599 | 615 | ||
600 | qDebug("copy "+curFile+" as "+destFile); | 616 | qDebug("copy "+curFile+" as "+destFile); |
601 | } | 617 | } |
602 | delete fileDlg; | 618 | delete fileDlg; |
603 | } | 619 | } |
604 | populateLocalView(); | 620 | populateLocalView(); |
605 | 621 | ||
606 | } else { | 622 | } else { |
607 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 623 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
608 | item=(*it); | 624 | item=(*it); |
609 | curFile = currentRemoteDir.canonicalPath()+"/"+ item; | 625 | curFile = currentRemoteDir.canonicalPath()+"/"+ item; |
610 | 626 | ||
611 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 627 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
612 | fileDlg->setInputText((const QString &) destFile); | 628 | fileDlg->setInputText((const QString &) destFile); |
613 | fileDlg->exec(); | 629 | fileDlg->exec(); |
614 | if( fileDlg->result() == 1 ) { | 630 | if( fileDlg->result() == 1 ) { |
615 | QString filename = fileDlg->LineEdit1->text(); | 631 | QString filename = fileDlg->LineEdit1->text(); |
616 | 632 | ||
617 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 633 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
618 | 634 | ||
619 | QFile f(destFile); | 635 | QFile f(destFile); |
620 | if( f.exists()) { | 636 | if( f.exists()) { |
621 | switch ( QMessageBox::warning(this,tr("Delete"), | 637 | switch ( QMessageBox::warning(this,tr("Delete"), |
622 | destFile+tr(" already exists\nDo you really want to delete it?"), | 638 | destFile+tr(" already exists\nDo you really want to delete it?"), |
623 | tr("Yes"),tr("No"),0,0,1) ) { | 639 | tr("Yes"),tr("No"),0,0,1) ) { |
624 | case 0: | 640 | case 0: |
625 | f.remove(); | 641 | f.remove(); |
626 | break; | 642 | break; |
627 | case 1: | 643 | case 1: |
628 | return; | 644 | return; |
629 | break; | 645 | break; |
630 | }; | 646 | }; |
631 | } | 647 | } |
632 | if(!copyFile(destFile, curFile) ) { | 648 | if(!copyFile(destFile, curFile) ) { |
633 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 649 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
634 | +curFile +tr("to\n")+destFile); | 650 | +curFile +tr("to\n")+destFile); |
635 | return; | 651 | return; |
636 | } | 652 | } |
637 | qDebug("copy "+curFile+" as "+destFile); | 653 | qDebug("copy "+curFile+" as "+destFile); |
638 | } | 654 | } |
639 | delete fileDlg; | 655 | delete fileDlg; |
640 | } | 656 | } |
641 | populateRemoteView(); | 657 | populateRemoteView(); |
642 | } | 658 | } |
643 | } | 659 | } |
644 | 660 | ||
645 | void AdvancedFm::move() { | 661 | void AdvancedFm::move() { |
646 | qApp->processEvents(); | 662 | qApp->processEvents(); |
647 | 663 | ||
648 | QStringList curFileList = getPath(); | 664 | QStringList curFileList = getPath(); |
649 | if( curFileList.count() > 0) { | 665 | if( curFileList.count() > 0) { |
650 | QString curFile, destFile, item; | 666 | QString curFile, destFile, item; |
651 | 667 | ||
652 | if (TabWidget->currentPageIndex() == 0) { | 668 | if (TabWidget->getCurrentTab() == 0) { |
653 | 669 | ||
654 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 670 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
655 | item=(*it); | 671 | item=(*it); |
656 | QString destFile = currentRemoteDir.canonicalPath(); | 672 | QString destFile = currentRemoteDir.canonicalPath(); |
657 | 673 | ||
658 | if(destFile.right(1).find("/",0,TRUE) == -1) | 674 | if(destFile.right(1).find("/",0,TRUE) == -1) |
659 | destFile+="/"; | 675 | destFile+="/"; |
660 | destFile += item; | 676 | destFile += item; |
661 | curFile = currentDir.canonicalPath(); | 677 | curFile = currentDir.canonicalPath(); |
662 | 678 | ||
663 | qDebug("Destination file is "+destFile); | 679 | qDebug("Destination file is "+destFile); |
664 | 680 | ||
665 | if(curFile.right(1).find("/",0,TRUE) == -1) | 681 | if(curFile.right(1).find("/",0,TRUE) == -1) |
666 | curFile +="/"; | 682 | curFile +="/"; |
667 | 683 | ||
668 | curFile+= item; | 684 | curFile+= item; |
669 | qDebug("CurrentFile file is " + curFile); | 685 | qDebug("CurrentFile file is " + curFile); |
670 | 686 | ||
671 | QFile f( curFile); | 687 | QFile f( curFile); |
672 | if( f.exists()) { | 688 | if( f.exists()) { |
673 | if(!copyFile( destFile, curFile) ) { | 689 | if(!copyFile( destFile, curFile) ) { |
674 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); | 690 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); |
675 | return; | 691 | return; |
676 | } else | 692 | } else |
677 | QFile::remove(curFile); | 693 | QFile::remove(curFile); |
678 | } | 694 | } |
679 | } | 695 | } |
680 | 696 | ||
681 | TabWidget->setCurrentPage(1); | 697 | TabWidget->setCurrentTab(1); |
682 | 698 | ||
683 | } else { //view 2 | 699 | } else { //view 2 |
684 | 700 | ||
685 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 701 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
686 | item = (*it); | 702 | item = (*it); |
687 | QString destFile = currentDir.canonicalPath(); | 703 | QString destFile = currentDir.canonicalPath(); |
688 | 704 | ||
689 | if(destFile.right(1).find("/",0,TRUE) == -1) | 705 | if(destFile.right(1).find("/",0,TRUE) == -1) |
690 | destFile+="/"; | 706 | destFile+="/"; |
691 | 707 | ||
692 | destFile += item; | 708 | destFile += item; |
693 | 709 | ||
694 | qDebug("Destination file is "+destFile); | 710 | qDebug("Destination file is "+destFile); |
695 | 711 | ||
696 | curFile = currentRemoteDir.canonicalPath(); | 712 | curFile = currentRemoteDir.canonicalPath(); |
697 | 713 | ||
698 | if(curFile.right(1).find("/",0,TRUE) == -1) | 714 | if(curFile.right(1).find("/",0,TRUE) == -1) |
699 | curFile +="/"; | 715 | curFile +="/"; |
700 | curFile+= item; | 716 | curFile+= item; |
701 | qDebug("CurrentFile file is " + curFile); | 717 | qDebug("CurrentFile file is " + curFile); |
702 | 718 | ||
703 | QFile f( curFile); | 719 | QFile f( curFile); |
704 | if( f.exists()) { | 720 | if( f.exists()) { |
705 | if(!copyFile( destFile, curFile) ) { | 721 | if(!copyFile( destFile, curFile) ) { |
706 | QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); | 722 | QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); |
707 | return; | 723 | return; |
708 | } else | 724 | } else |
709 | QFile::remove( curFile); | 725 | QFile::remove( curFile); |
710 | } | 726 | } |
711 | TabWidget->setCurrentPage(0); | 727 | TabWidget->setCurrentTab(0); |
712 | } | 728 | } |
713 | } | 729 | } |
714 | populateRemoteView(); | 730 | populateRemoteView(); |
715 | populateLocalView(); | 731 | populateLocalView(); |
716 | } | 732 | } |
717 | } | 733 | } |
718 | 734 | ||
719 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) { | 735 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) { |
720 | char bf[ 50000 ]; | 736 | char bf[ 50000 ]; |
721 | int bytesRead; | 737 | int bytesRead; |
722 | bool success = TRUE; | 738 | bool success = TRUE; |
723 | struct stat status; | 739 | struct stat status; |
724 | 740 | ||
725 | QFile s( src ); | 741 | QFile s( src ); |
726 | QFile d( dest ); | 742 | QFile d( dest ); |
727 | 743 | ||
728 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { | 744 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { |
729 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { | 745 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { |
730 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ | 746 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ |
731 | success = FALSE; | 747 | success = FALSE; |
732 | break; | 748 | break; |
733 | } | 749 | } |
734 | } | 750 | } |
735 | if( success && (bytesRead > 0) ){ | 751 | if( success && (bytesRead > 0) ){ |
736 | d.writeBlock( bf, bytesRead ); | 752 | d.writeBlock( bf, bytesRead ); |
737 | } | 753 | } |
738 | } else { | 754 | } else { |
739 | success = FALSE; | 755 | success = FALSE; |
740 | } | 756 | } |
741 | 757 | ||
742 | // Set file permissions | 758 | // Set file permissions |
743 | if( stat( (const char *) src, &status ) == 0 ){ | 759 | if( stat( (const char *) src, &status ) == 0 ){ |
744 | chmod( (const char *) dest, status.st_mode ); | 760 | chmod( (const char *) dest, status.st_mode ); |
745 | } | 761 | } |
746 | 762 | ||
747 | return success; | 763 | return success; |
748 | } | 764 | } |
749 | 765 | ||
750 | void AdvancedFm::runCommand() { | 766 | void AdvancedFm::runCommand() { |
751 | QString curFile; | 767 | QString curFile; |
752 | if (TabWidget->currentPageIndex() == 0) { | 768 | if (TabWidget->getCurrentTab() == 0) { |
753 | if( Local_View->currentItem()) | 769 | if( Local_View->currentItem()) |
754 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); | 770 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
755 | } else { | 771 | } else { |
756 | if(Remote_View->currentItem()) | 772 | if(Remote_View->currentItem()) |
757 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); | 773 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); |
758 | } | 774 | } |
759 | 775 | ||
760 | InputDialog *fileDlg; | 776 | InputDialog *fileDlg; |
761 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 777 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
762 | fileDlg->setInputText(curFile); | 778 | fileDlg->setInputText(curFile); |
763 | fileDlg->exec(); | 779 | fileDlg->exec(); |
764 | QString command; | 780 | QString command; |
765 | if( fileDlg->result() == 1 ) { | 781 | if( fileDlg->result() == 1 ) { |
766 | command = fileDlg->LineEdit1->text(); | 782 | command = fileDlg->LineEdit1->text(); |
767 | 783 | ||
768 | Output *outDlg; | 784 | Output *outDlg; |
769 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 785 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
770 | outDlg->showMaximized(); | 786 | outDlg->showMaximized(); |
771 | outDlg->show(); | 787 | outDlg->show(); |
772 | qApp->processEvents(); | 788 | qApp->processEvents(); |
773 | FILE *fp; | 789 | FILE *fp; |
774 | char line[130]; | 790 | char line[130]; |
775 | sleep(1); | 791 | sleep(1); |
776 | command +=" 2>&1"; | 792 | command +=" 2>&1"; |
777 | fp = popen( (const char *) command, "r"); | 793 | fp = popen( (const char *) command, "r"); |
778 | if ( !fp ) { | 794 | if ( !fp ) { |
779 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 795 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
780 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); | 796 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); |
781 | pclose(fp); | 797 | pclose(fp); |
782 | return; | 798 | return; |
783 | } else { | 799 | } else { |
784 | while ( fgets( line, sizeof line, fp)) { | 800 | while ( fgets( line, sizeof line, fp)) { |
785 | QString lineStr = line; | 801 | QString lineStr = line; |
786 | lineStr=lineStr.left(lineStr.length()-1); | 802 | lineStr=lineStr.left(lineStr.length()-1); |
787 | outDlg->OutputEdit->append(lineStr); | 803 | outDlg->OutputEdit->append(lineStr); |
788 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 804 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
789 | } | 805 | } |
790 | } | 806 | } |
791 | pclose(fp); | 807 | pclose(fp); |
792 | 808 | ||
793 | } | 809 | } |
794 | } | 810 | } |
795 | 811 | ||
796 | void AdvancedFm::runCommandStd() { | 812 | void AdvancedFm::runCommandStd() { |
797 | QString curFile; | 813 | QString curFile; |
798 | if (TabWidget->currentPageIndex() == 0) { | 814 | if (TabWidget->getCurrentTab() == 0) { |
799 | if( Local_View->currentItem()) | 815 | if( Local_View->currentItem()) |
800 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); | 816 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
801 | } else { | 817 | } else { |
802 | if(Remote_View->currentItem()) | 818 | if(Remote_View->currentItem()) |
803 | curFile = currentRemoteDir.canonicalPath() +"/" | 819 | curFile = currentRemoteDir.canonicalPath() +"/" |
804 | + Remote_View->currentItem()->text(0); | 820 | + Remote_View->currentItem()->text(0); |
805 | } | 821 | } |
806 | 822 | ||
807 | InputDialog *fileDlg; | 823 | InputDialog *fileDlg; |
808 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 824 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
809 | fileDlg->setInputText(curFile); | 825 | fileDlg->setInputText(curFile); |
810 | fileDlg->exec(); | 826 | fileDlg->exec(); |
811 | QString command; | 827 | QString command; |
812 | if( fileDlg->result() == 1 ) { | 828 | if( fileDlg->result() == 1 ) { |
813 | qApp->processEvents(); | 829 | qApp->processEvents(); |
814 | command = fileDlg->LineEdit1->text() + " &"; | 830 | command = fileDlg->LineEdit1->text() + " &"; |
815 | system(command.latin1()); | 831 | system(command.latin1()); |
816 | } | 832 | } |
817 | } | 833 | } |
818 | 834 | ||
819 | void AdvancedFm::fileStatus() { | 835 | void AdvancedFm::fileStatus() { |
820 | QString curFile; | 836 | QString curFile; |
821 | if (TabWidget->currentPageIndex() == 0) { | 837 | if (TabWidget->getCurrentTab() == 0) { |
822 | curFile = Local_View->currentItem()->text(0); | 838 | curFile = Local_View->currentItem()->text(0); |
823 | } else { | 839 | } else { |
824 | curFile = Remote_View->currentItem()->text(0); | 840 | curFile = Remote_View->currentItem()->text(0); |
825 | } | 841 | } |
826 | QString command = " stat -l "+ curFile +" 2>&1"; | 842 | QString command = " stat -l "+ curFile +" 2>&1"; |
827 | Output *outDlg; | 843 | Output *outDlg; |
828 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 844 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
829 | outDlg->showMaximized(); | 845 | outDlg->showMaximized(); |
830 | outDlg->show(); | 846 | outDlg->show(); |
831 | qApp->processEvents(); | 847 | qApp->processEvents(); |
832 | FILE *fp; | 848 | FILE *fp; |
833 | char line[130]; | 849 | char line[130]; |
834 | sleep(1); | 850 | sleep(1); |
835 | fp = popen( (const char *) command, "r"); | 851 | fp = popen( (const char *) command, "r"); |
836 | if ( !fp ) { | 852 | if ( !fp ) { |
837 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 853 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
838 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); | 854 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); |
839 | pclose(fp); | 855 | pclose(fp); |
840 | return; | 856 | return; |
841 | } else { | 857 | } else { |
842 | while ( fgets( line, sizeof line, fp)) { | 858 | while ( fgets( line, sizeof line, fp)) { |
843 | outDlg->OutputEdit->append(line); | 859 | outDlg->OutputEdit->append(line); |
844 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 860 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
845 | 861 | ||
846 | } | 862 | } |
847 | 863 | ||
848 | } | 864 | } |
849 | pclose(fp); | 865 | pclose(fp); |
850 | } | 866 | } |
851 | 867 | ||
852 | void AdvancedFm::mkDir() { | 868 | void AdvancedFm::mkDir() { |
853 | if (TabWidget->currentPageIndex() == 0) | 869 | if (TabWidget->getCurrentTab() == 0) |
854 | localMakDir(); | 870 | localMakDir(); |
855 | else | 871 | else |
856 | remoteMakDir(); | 872 | remoteMakDir(); |
857 | 873 | ||
858 | } | 874 | } |
859 | 875 | ||
860 | void AdvancedFm::rn() { | 876 | void AdvancedFm::rn() { |
861 | if (TabWidget->currentPageIndex() == 0) | 877 | if (TabWidget->getCurrentTab() == 0) |
862 | localRename(); | 878 | localRename(); |
863 | else | 879 | else |
864 | remoteRename(); | 880 | remoteRename(); |
865 | 881 | ||
866 | } | 882 | } |
867 | 883 | ||
868 | void AdvancedFm::del() { | 884 | void AdvancedFm::del() { |
869 | if (TabWidget->currentPageIndex() == 0) | 885 | if (TabWidget->getCurrentTab() == 0) |
870 | localDelete(); | 886 | localDelete(); |
871 | else | 887 | else |
872 | remoteDelete(); | 888 | remoteDelete(); |
873 | } | 889 | } |
874 | 890 | ||
875 | void AdvancedFm::mkSym() { | 891 | void AdvancedFm::mkSym() { |
876 | QString cmd; | 892 | QString cmd; |
877 | QStringList curFileList = getPath(); | 893 | QStringList curFileList = getPath(); |
878 | if( curFileList.count() > 0) { | 894 | if( curFileList.count() > 0) { |
879 | 895 | ||
880 | if (TabWidget->currentPageIndex() == 0) { | 896 | if (TabWidget->getCurrentTab() == 0) { |
881 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 897 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
882 | 898 | ||
883 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); | 899 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); |
884 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 900 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
885 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 901 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
886 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 902 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
887 | cmd = "ln -s "+curFile+" "+destName; | 903 | cmd = "ln -s "+curFile+" "+destName; |
888 | qDebug(cmd); | 904 | qDebug(cmd); |
889 | system(cmd.latin1() ); | 905 | system(cmd.latin1() ); |
890 | } | 906 | } |
891 | populateRemoteView(); | 907 | populateRemoteView(); |
892 | TabWidget->setCurrentPage(1); | 908 | TabWidget->setCurrentTab(1); |
893 | } else { | 909 | } else { |
894 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 910 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
895 | 911 | ||
896 | QString destName = currentDir.canonicalPath()+"/"+(*it); | 912 | QString destName = currentDir.canonicalPath()+"/"+(*it); |
897 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 913 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
898 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 914 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
899 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 915 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
900 | 916 | ||
901 | cmd = "ln -s "+curFile+" "+destName; | 917 | cmd = "ln -s "+curFile+" "+destName; |
902 | qDebug(cmd); | 918 | qDebug(cmd); |
903 | system(cmd.latin1() ); | 919 | system(cmd.latin1() ); |
904 | } | 920 | } |
905 | populateLocalView(); | 921 | populateLocalView(); |
906 | TabWidget->setCurrentPage(0); | 922 | TabWidget->setCurrentTab(0); |
907 | } | 923 | } |
908 | } | 924 | } |
909 | } | 925 | } |
910 | 926 | ||
911 | void AdvancedFm::doBeam() { | 927 | void AdvancedFm::doBeam() { |
912 | Ir ir; | 928 | Ir ir; |
913 | if(!ir.supported()){ | 929 | if(!ir.supported()){ |
914 | } else { | 930 | } else { |
915 | 931 | ||
916 | QStringList curFileList = getPath(); | 932 | QStringList curFileList = getPath(); |
917 | if( curFileList.count() > 0) { | 933 | if( curFileList.count() > 0) { |
918 | 934 | ||
919 | if (TabWidget->currentPageIndex() == 0) { | 935 | if (TabWidget->getCurrentTab() == 0) { |
920 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 936 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
921 | 937 | ||
922 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 938 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
923 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 939 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
924 | Ir *file = new Ir(this, "IR"); | 940 | Ir *file = new Ir(this, "IR"); |
925 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 941 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
926 | file->send( curFile, curFile ); | 942 | file->send( curFile, curFile ); |
927 | } | 943 | } |
928 | 944 | ||
929 | } else { | 945 | } else { |
930 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 946 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
931 | 947 | ||
932 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 948 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
933 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 949 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
934 | Ir *file = new Ir(this, "IR"); | 950 | Ir *file = new Ir(this, "IR"); |
935 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 951 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
936 | file->send( curFile, curFile ); | 952 | file->send( curFile, curFile ); |
937 | 953 | ||
938 | } | 954 | } |
939 | } | 955 | } |
940 | } | 956 | } |
941 | } | 957 | } |
942 | 958 | ||
943 | } | 959 | } |
944 | 960 | ||
945 | void AdvancedFm::fileBeamFinished( Ir *) { | 961 | void AdvancedFm::fileBeamFinished( Ir *) { |
946 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 962 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
947 | 963 | ||
948 | } | 964 | } |