-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 55 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 7 |
2 files changed, 51 insertions, 11 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index d4351b0..6b7fa1f 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,879 +1,912 @@ | |||
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 | 15 | ||
16 | // #include <opie/ofileselector.h> | 16 | // #include <opie/ofileselector.h> |
17 | // #include <opie/ofiledialog.h> | 17 | // #include <opie/ofiledialog.h> |
18 | 18 | ||
19 | #include <opie/otabwidget.h> | 19 | #include <opie/otabwidget.h> |
20 | 20 | ||
21 | #include <qpe/filemanager.h> | 21 | #include <qpe/filemanager.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qpe/mimetype.h> | 25 | #include <qpe/mimetype.h> |
26 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
27 | #include <qpe/ir.h> | 27 | #include <qpe/ir.h> |
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #include <qpe/menubutton.h> | 29 | #include <qpe/menubutton.h> |
30 | 30 | ||
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qlistview.h> | 35 | #include <qlistview.h> |
36 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qlayout.h> | 38 | #include <qlayout.h> |
39 | #include <qimage.h> | 39 | #include <qimage.h> |
40 | #include <qmessagebox.h> | 40 | #include <qmessagebox.h> |
41 | #include <qlineedit.h> | 41 | #include <qlineedit.h> |
42 | 42 | ||
43 | #include <sys/stat.h> | 43 | #include <sys/stat.h> |
44 | #include <time.h> | 44 | #include <time.h> |
45 | #include <dirent.h> | 45 | #include <dirent.h> |
46 | #include <fcntl.h> | 46 | #include <fcntl.h> |
47 | #include <sys/vfs.h> | 47 | #include <sys/vfs.h> |
48 | #include <mntent.h> | 48 | #include <mntent.h> |
49 | 49 | ||
50 | AdvancedFm::AdvancedFm( ) | 50 | AdvancedFm::AdvancedFm( ) |
51 | : QMainWindow( ) { | 51 | : QMainWindow( ) { |
52 | init(); | 52 | init(); |
53 | renameBox = 0; | 53 | renameBox = 0; |
54 | 54 | ||
55 | unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 55 | unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
56 | 56 | ||
57 | initConnections(); | 57 | initConnections(); |
58 | whichTab=1; | 58 | whichTab=1; |
59 | rePopulate(); | 59 | rePopulate(); |
60 | currentPathCombo->setFocus(); | 60 | currentPathCombo->setFocus(); |
61 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); | ||
62 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | ||
63 | this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); | ||
61 | } | 64 | } |
62 | 65 | ||
63 | AdvancedFm::~AdvancedFm() { | 66 | AdvancedFm::~AdvancedFm() { |
64 | } | 67 | } |
65 | 68 | ||
66 | 69 | ||
67 | void AdvancedFm::cleanUp() | 70 | void AdvancedFm::cleanUp() |
68 | { | 71 | { |
69 | QString sfile=QDir::homeDirPath(); | 72 | QString sfile=QDir::homeDirPath(); |
70 | if(sfile.right(1) != "/") | 73 | if(sfile.right(1) != "/") |
71 | sfile+="/._temp"; | 74 | sfile+="/._temp"; |
72 | else | 75 | else |
73 | sfile+="._temp"; | 76 | sfile+="._temp"; |
74 | QFile file( sfile); | 77 | QFile file( sfile); |
75 | if(file.exists()) | 78 | if(file.exists()) |
76 | file.remove(); | 79 | file.remove(); |
77 | } | 80 | } |
78 | 81 | ||
79 | void AdvancedFm::tabChanged(QWidget *w) | 82 | void AdvancedFm::tabChanged(QWidget *w) |
80 | { | 83 | { |
81 | if( w == tab) | 84 | if( w == tab) |
82 | whichTab = 1; | 85 | whichTab = 1; |
83 | else | 86 | else |
84 | whichTab = 2; | 87 | whichTab = 2; |
85 | 88 | ||
86 | // qDebug("tab changed %d", whichTab ); | 89 | // qDebug("tab changed %d", whichTab ); |
87 | 90 | ||
88 | QString path = CurrentDir()->canonicalPath(); | 91 | QString path = CurrentDir()->canonicalPath(); |
89 | currentPathCombo->lineEdit()->setText( path ); | 92 | currentPathCombo->lineEdit()->setText( path ); |
90 | 93 | ||
91 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 94 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
92 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 95 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
93 | 96 | ||
94 | QString fs= getFileSystemType( (const QString &) path); | 97 | QString fs= getFileSystemType( (const QString &) path); |
95 | 98 | ||
96 | setCaption("AdvancedFm :: "+fs+" :: " | 99 | setCaption("AdvancedFm :: "+fs+" :: " |
97 | +checkDiskSpace( (const QString &) path )+ " kB free" ); | 100 | +checkDiskSpace( (const QString &) path )+ " kB free" ); |
98 | chdir( path.latin1()); | 101 | chdir( path.latin1()); |
99 | } | 102 | } |
100 | 103 | ||
101 | 104 | ||
102 | void AdvancedFm::populateView() | 105 | void AdvancedFm::populateView() |
103 | { | 106 | { |
104 | QPixmap pm; | 107 | QPixmap pm; |
105 | QListView *thisView = CurrentView(); | 108 | QListView *thisView = CurrentView(); |
106 | QDir *thisDir = CurrentDir(); | 109 | QDir *thisDir = CurrentDir(); |
107 | QString path = thisDir->canonicalPath(); | 110 | QString path = thisDir->canonicalPath(); |
108 | 111 | ||
109 | thisView->clear(); | 112 | thisView->clear(); |
110 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 113 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
111 | thisDir->setMatchAllDirs(TRUE); | 114 | thisDir->setMatchAllDirs(TRUE); |
112 | thisDir->setNameFilter(filterStr); | 115 | thisDir->setNameFilter(filterStr); |
113 | QString fileL, fileS, fileDate; | 116 | QString fileL, fileS, fileDate; |
114 | QString fs= getFileSystemType((const QString &) path); | 117 | QString fs= getFileSystemType((const QString &) path); |
115 | setCaption("AdvancedFm :: "+fs+" :: " | 118 | setCaption("AdvancedFm :: "+fs+" :: " |
116 | +checkDiskSpace((const QString &) path)+" kB free" ); | 119 | +checkDiskSpace((const QString &) path)+" kB free" ); |
117 | bool isDir=FALSE; | 120 | bool isDir=FALSE; |
118 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 121 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
119 | QFileInfoListIterator it(*list); | 122 | QFileInfoListIterator it(*list); |
120 | QFileInfo *fi; | 123 | QFileInfo *fi; |
121 | while ( (fi=it.current()) ) | 124 | while ( (fi=it.current()) ) |
122 | { | 125 | { |
123 | if (fi->isSymLink() ) | 126 | if (fi->isSymLink() ) |
124 | { | 127 | { |
125 | QString symLink=fi->readLink(); | 128 | QString symLink=fi->readLink(); |
126 | QFileInfo sym( symLink); | 129 | QFileInfo sym( symLink); |
127 | fileS.sprintf( "%10i", sym.size() ); | 130 | fileS.sprintf( "%10i", sym.size() ); |
128 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); | 131 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); |
129 | fileDate = sym.lastModified().toString(); | 132 | fileDate = sym.lastModified().toString(); |
130 | } | 133 | } |
131 | else | 134 | else |
132 | { | 135 | { |
133 | fileS.sprintf( "%10i", fi->size() ); | 136 | fileS.sprintf( "%10i", fi->size() ); |
134 | fileL.sprintf( "%s",fi->fileName().data() ); | 137 | fileL.sprintf( "%s",fi->fileName().data() ); |
135 | fileDate= fi->lastModified().toString(); | 138 | fileDate= fi->lastModified().toString(); |
136 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) | 139 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) |
137 | { | 140 | { |
138 | fileL+="/"; | 141 | fileL+="/"; |
139 | isDir=TRUE; | 142 | isDir=TRUE; |
140 | } | 143 | } |
141 | } | 144 | } |
142 | 145 | ||
143 | QFileInfo fileInfo( path + "/" + fileL); | 146 | QFileInfo fileInfo( path + "/" + fileL); |
144 | 147 | ||
145 | if(fileL !="./" && fi->exists()) | 148 | if(fileL !="./" && fi->exists()) |
146 | { | 149 | { |
147 | item= new QListViewItem( thisView, fileL, fileS , fileDate); | 150 | item= new QListViewItem( thisView, fileL, fileS , fileDate); |
148 | 151 | ||
149 | if(isDir || fileL.find("/",0,TRUE) != -1) | 152 | if(isDir || fileL.find("/",0,TRUE) != -1) |
150 | { | 153 | { |
151 | 154 | ||
152 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 155 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
153 | pm = Resource::loadPixmap( "lockedfolder" ); | 156 | pm = Resource::loadPixmap( "lockedfolder" ); |
154 | else | 157 | else |
155 | pm= Resource::loadPixmap( "folder" ); | 158 | pm= Resource::loadPixmap( "folder" ); |
156 | } | 159 | } |
157 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) | 160 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) |
158 | { | 161 | { |
159 | pm = Resource::loadPixmap( "exec"); | 162 | pm = Resource::loadPixmap( "exec"); |
160 | } | 163 | } |
161 | else if( (fileInfo.permission( QFileInfo::ExeUser) | 164 | else if( (fileInfo.permission( QFileInfo::ExeUser) |
162 | | fileInfo.permission( QFileInfo::ExeGroup) | 165 | | fileInfo.permission( QFileInfo::ExeGroup) |
163 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) | 166 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) |
164 | { | 167 | { |
165 | pm = Resource::loadPixmap( "exec"); | 168 | pm = Resource::loadPixmap( "exec"); |
166 | } | 169 | } |
167 | else if( !fi->isReadable() ) | 170 | else if( !fi->isReadable() ) |
168 | { | 171 | { |
169 | pm = Resource::loadPixmap( "locked" ); | 172 | pm = Resource::loadPixmap( "locked" ); |
170 | } | 173 | } |
171 | else { //everything else goes by mimetype | 174 | else { //everything else goes by mimetype |
172 | MimeType mt(fi->filePath()); | 175 | MimeType mt(fi->filePath()); |
173 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 176 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
174 | if(pm.isNull()) { | 177 | if(pm.isNull()) { |
175 | pm = unknownXpm; | 178 | pm = unknownXpm; |
176 | } | 179 | } |
177 | } | 180 | } |
178 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) | 181 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) |
179 | { | 182 | { |
180 | // overlay link image | 183 | // overlay link image |
181 | pm= Resource::loadPixmap( "folder" ); | 184 | pm= Resource::loadPixmap( "folder" ); |
182 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 185 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
183 | QPainter painter( &pm ); | 186 | QPainter painter( &pm ); |
184 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 187 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
185 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 188 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
186 | } | 189 | } |
187 | item->setPixmap( 0,pm); | 190 | item->setPixmap( 0,pm); |
188 | 191 | ||
189 | } | 192 | } |
190 | isDir=FALSE; | 193 | isDir=FALSE; |
191 | ++it; | 194 | ++it; |
192 | } | 195 | } |
193 | 196 | ||
194 | if( path.find("dev",0,TRUE) != -1) | 197 | if( path.find("dev",0,TRUE) != -1) |
195 | { | 198 | { |
196 | struct stat buf; | 199 | struct stat buf; |
197 | dev_t devT; | 200 | dev_t devT; |
198 | DIR *dir; | 201 | DIR *dir; |
199 | struct dirent *mydirent; | 202 | struct dirent *mydirent; |
200 | 203 | ||
201 | if((dir = opendir( path.latin1())) != NULL) | 204 | if((dir = opendir( path.latin1())) != NULL) |
202 | while ((mydirent = readdir(dir)) != NULL) | 205 | while ((mydirent = readdir(dir)) != NULL) |
203 | { | 206 | { |
204 | lstat( mydirent->d_name, &buf); | 207 | lstat( mydirent->d_name, &buf); |
205 | // qDebug(mydirent->d_name); | 208 | // qDebug(mydirent->d_name); |
206 | fileL.sprintf("%s", mydirent->d_name); | 209 | fileL.sprintf("%s", mydirent->d_name); |
207 | devT = buf.st_dev; | 210 | devT = buf.st_dev; |
208 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 211 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
209 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 212 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
210 | if( fileL.find(".") == -1 ) | 213 | if( fileL.find(".") == -1 ) |
211 | { | 214 | { |
212 | item= new QListViewItem( thisView, fileL, fileS, fileDate); | 215 | item= new QListViewItem( thisView, fileL, fileS, fileDate); |
213 | pm = unknownXpm; | 216 | pm = unknownXpm; |
214 | item->setPixmap( 0,pm); | 217 | item->setPixmap( 0,pm); |
215 | } | 218 | } |
216 | } | 219 | } |
217 | 220 | ||
218 | closedir(dir); | 221 | closedir(dir); |
219 | } | 222 | } |
220 | 223 | ||
221 | thisView->setSorting( 3,FALSE); | 224 | thisView->setSorting( 3,FALSE); |
222 | fillCombo( (const QString &) path ); | 225 | fillCombo( (const QString &) path ); |
223 | } | 226 | } |
224 | 227 | ||
225 | void AdvancedFm::rePopulate() | 228 | void AdvancedFm::rePopulate() |
226 | { | 229 | { |
227 | int tmpTab = whichTab; | 230 | int tmpTab = whichTab; |
228 | qDebug("%d", tmpTab); | 231 | qDebug("%d", tmpTab); |
229 | 232 | ||
230 | for(int i =1; i < 3; i++) | 233 | for(int i =1; i < 3; i++) |
231 | { | 234 | { |
232 | TabWidget->setCurrentTab(i - 1); | 235 | TabWidget->setCurrentTab(i - 1); |
233 | populateView(); | 236 | populateView(); |
234 | } | 237 | } |
235 | TabWidget->setCurrentTab( tmpTab - 1); | 238 | TabWidget->setCurrentTab( tmpTab - 1); |
236 | } | 239 | } |
237 | 240 | ||
238 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) | 241 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) |
239 | { | 242 | { |
240 | if(selectedItem) | 243 | if(selectedItem) |
241 | { | 244 | { |
242 | QString strItem=selectedItem->text(0); | 245 | QString strItem=selectedItem->text(0); |
243 | QString strSize=selectedItem->text(1); | 246 | QString strSize=selectedItem->text(1); |
244 | strSize=strSize.stripWhiteSpace(); | 247 | strSize=strSize.stripWhiteSpace(); |
245 | bool isDirectory = false; | 248 | bool isDirectory = false; |
246 | QString strItem2; | 249 | QString strItem2; |
247 | 250 | ||
248 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink | 251 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink |
249 | { | 252 | { |
250 | strItem2 = dealWithSymName((const QString&)strItem); | 253 | strItem2 = dealWithSymName((const QString&)strItem); |
251 | if(QDir(strItem2).exists() ) | 254 | if(QDir(strItem2).exists() ) |
252 | strItem = strItem2; | 255 | strItem = strItem2; |
253 | } | 256 | } |
254 | 257 | ||
255 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) | 258 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) |
256 | { | 259 | { |
257 | 260 | ||
258 | if(QDir(strItem).exists()) | 261 | if(QDir(strItem).exists()) |
259 | isDirectory = true; | 262 | isDirectory = true; |
260 | } | 263 | } |
261 | 264 | ||
262 | if( isDirectory ) | 265 | if( isDirectory ) |
263 | { | 266 | { |
264 | CurrentDir()->cd( strItem, TRUE); | 267 | CurrentDir()->cd( strItem, TRUE); |
265 | populateView(); | 268 | populateView(); |
266 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); | 269 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); |
267 | } | 270 | } |
268 | chdir( strItem.latin1()); | 271 | chdir( strItem.latin1()); |
269 | } | 272 | } |
270 | } | 273 | } |
271 | 274 | ||
272 | void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 275 | void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
273 | switch (mouse) { | 276 | switch (mouse) { |
274 | case 1: | 277 | case 1: |
275 | { | 278 | { |
276 | if(renameBox != 0 ) | 279 | if(renameBox != 0 ) |
277 | { | 280 | { |
278 | cancelRename(); | 281 | cancelRename(); |
279 | } | 282 | } |
280 | } | 283 | } |
281 | break; | 284 | break; |
282 | case 2: | 285 | case 2: |
283 | menuTimer.start( 500, TRUE ); | 286 | menuTimer.start( 500, TRUE ); |
284 | break; | 287 | break; |
285 | }; | 288 | }; |
286 | } | 289 | } |
287 | 290 | ||
288 | void AdvancedFm::switchToLocalTab() | 291 | void AdvancedFm::switchToLocalTab() |
289 | { | 292 | { |
290 | TabWidget->setCurrentTab(0); | 293 | TabWidget->setCurrentTab(0); |
291 | Local_View->setFocus(); | 294 | Local_View->setFocus(); |
292 | } | 295 | } |
293 | 296 | ||
294 | void AdvancedFm::switchToRemoteTab() | 297 | void AdvancedFm::switchToRemoteTab() |
295 | { | 298 | { |
296 | TabWidget->setCurrentTab(1); | 299 | TabWidget->setCurrentTab(1); |
297 | Remote_View->setFocus(); | 300 | Remote_View->setFocus(); |
298 | } | 301 | } |
299 | 302 | ||
300 | void AdvancedFm::readConfig() | 303 | void AdvancedFm::readConfig() |
301 | { | 304 | { |
302 | Config cfg("AdvancedFm"); | 305 | Config cfg("AdvancedFm"); |
303 | } | 306 | } |
304 | 307 | ||
305 | void AdvancedFm::writeConfig() | 308 | void AdvancedFm::writeConfig() |
306 | { | 309 | { |
307 | Config cfg("AdvancedFm"); | 310 | Config cfg("AdvancedFm"); |
308 | } | 311 | } |
309 | 312 | ||
310 | void AdvancedFm::currentPathComboChanged() | 313 | void AdvancedFm::currentPathComboChanged() |
311 | { | 314 | { |
312 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) | 315 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) |
313 | { | 316 | { |
314 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); | 317 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); |
315 | populateView(); | 318 | populateView(); |
316 | } | 319 | } |
317 | else | 320 | else |
318 | { | 321 | { |
319 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 322 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
320 | } | 323 | } |
321 | } | 324 | } |
322 | 325 | ||
323 | void AdvancedFm::fillCombo(const QString ¤tPath) | 326 | void AdvancedFm::fillCombo(const QString ¤tPath) |
324 | { | 327 | { |
325 | // qDebug("%d",TabWidget->currentTab()); | 328 | // qDebug("%d",TabWidget->currentTab()); |
326 | if ( whichTab == 1) | 329 | if ( whichTab == 1) |
327 | { | 330 | { |
328 | currentPathCombo->lineEdit()->setText( currentPath); | 331 | currentPathCombo->lineEdit()->setText( currentPath); |
329 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) | 332 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) |
330 | { | 333 | { |
331 | currentPathCombo->clear(); | 334 | currentPathCombo->clear(); |
332 | localDirPathStringList.prepend( currentPath ); | 335 | localDirPathStringList.prepend( currentPath ); |
333 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 336 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
334 | } | 337 | } |
335 | } | 338 | } |
336 | else | 339 | else |
337 | { | 340 | { |
338 | currentPathCombo->lineEdit()->setText( currentPath); | 341 | currentPathCombo->lineEdit()->setText( currentPath); |
339 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) | 342 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) |
340 | { | 343 | { |
341 | currentPathCombo->clear(); | 344 | currentPathCombo->clear(); |
342 | remoteDirPathStringList.prepend( currentPath ); | 345 | remoteDirPathStringList.prepend( currentPath ); |
343 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 346 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
344 | } | 347 | } |
345 | } | 348 | } |
346 | } | 349 | } |
347 | 350 | ||
348 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) | 351 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) |
349 | { | 352 | { |
350 | chdir( currentPath.latin1() ); | 353 | chdir( currentPath.latin1() ); |
351 | CurrentDir()->cd( currentPath, TRUE); | 354 | CurrentDir()->cd( currentPath, TRUE); |
352 | populateView(); | 355 | populateView(); |
353 | update(); | 356 | update(); |
354 | } | 357 | } |
355 | 358 | ||
356 | QStringList AdvancedFm::getPath() | 359 | QStringList AdvancedFm::getPath() |
357 | { | 360 | { |
358 | QStringList strList; | 361 | QStringList strList; |
359 | QListView *thisView=CurrentView(); | 362 | QListView *thisView=CurrentView(); |
360 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); | 363 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); |
361 | QListViewItemIterator it( thisView ); | 364 | QListViewItemIterator it( thisView ); |
362 | for ( ; it.current(); ++it ) | 365 | for ( ; it.current(); ++it ) |
363 | { | 366 | { |
364 | if ( it.current()->isSelected() ) | 367 | if ( it.current()->isSelected() ) |
365 | { | 368 | { |
366 | strList << it.current()->text(0); | 369 | strList << it.current()->text(0); |
367 | // qDebug(it.current()->text(0)); | 370 | // qDebug(it.current()->text(0)); |
368 | } | 371 | } |
369 | } | 372 | } |
370 | return strList; | 373 | return strList; |
371 | } | 374 | } |
372 | 375 | ||
373 | void AdvancedFm::homeButtonPushed() | 376 | void AdvancedFm::homeButtonPushed() |
374 | { | 377 | { |
375 | QString current = QDir::homeDirPath(); | 378 | QString current = QDir::homeDirPath(); |
376 | chdir( current.latin1() ); | 379 | chdir( current.latin1() ); |
377 | CurrentDir()->cd( current, TRUE); | 380 | CurrentDir()->cd( current, TRUE); |
378 | populateView(); | 381 | populateView(); |
379 | update(); | 382 | update(); |
380 | } | 383 | } |
381 | 384 | ||
382 | void AdvancedFm::docButtonPushed() | 385 | void AdvancedFm::docButtonPushed() |
383 | { | 386 | { |
384 | QString current = QPEApplication::documentDir(); | 387 | QString current = QPEApplication::documentDir(); |
385 | chdir( current.latin1() ); | 388 | chdir( current.latin1() ); |
386 | CurrentDir()->cd( current, TRUE); | 389 | CurrentDir()->cd( current, TRUE); |
387 | populateView(); | 390 | populateView(); |
388 | update(); | 391 | update(); |
389 | } | 392 | } |
390 | 393 | ||
391 | void AdvancedFm::SDButtonPushed() | 394 | void AdvancedFm::SDButtonPushed() |
392 | { | 395 | { |
393 | QString current = "/mnt/card";// this can change so fix | 396 | QString current = "/mnt/card";// this can change so fix |
394 | chdir( current.latin1() ); | 397 | chdir( current.latin1() ); |
395 | CurrentDir()->cd( current, TRUE); | 398 | CurrentDir()->cd( current, TRUE); |
396 | populateView(); | 399 | populateView(); |
397 | update(); | 400 | update(); |
398 | } | 401 | } |
399 | 402 | ||
400 | void AdvancedFm::CFButtonPushed() | 403 | void AdvancedFm::CFButtonPushed() |
401 | { | 404 | { |
402 | QString current; | 405 | QString current; |
403 | if(zaurusDevice) | 406 | if(zaurusDevice) |
404 | current= "/mnt/cf"; //zaurus | 407 | current= "/mnt/cf"; //zaurus |
405 | else | 408 | else |
406 | current = "/mnt/hda"; //ipaq | 409 | current = "/mnt/hda"; //ipaq |
407 | chdir( current.latin1() ); | 410 | chdir( current.latin1() ); |
408 | CurrentDir()->cd( current, TRUE); | 411 | CurrentDir()->cd( current, TRUE); |
409 | populateView(); | 412 | populateView(); |
410 | update(); | 413 | update(); |
411 | } | 414 | } |
412 | 415 | ||
413 | 416 | ||
414 | void AdvancedFm::doAbout() | 417 | void AdvancedFm::doAbout() |
415 | { | 418 | { |
416 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" | 419 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" |
417 | "is copyright 2002-2003 by\n" | 420 | "is copyright 2002-2003 by\n" |
418 | "L.J.Potter<llornkcor@handhelds.org>\n" | 421 | "L.J.Potter<llornkcor@handhelds.org>\n" |
419 | "and is licensed by the GPL")); | 422 | "and is licensed by the GPL")); |
420 | } | 423 | } |
421 | 424 | ||
422 | void AdvancedFm::keyPressEvent( QKeyEvent *e) | 425 | void AdvancedFm::keyPressEvent( QKeyEvent *e) |
423 | { | 426 | { |
424 | // e->accept(); | 427 | // e->accept(); |
425 | if( CurrentView()->hasFocus() ) | 428 | if( CurrentView()->hasFocus() ) |
426 | { | 429 | { |
427 | switch ( e->key() ) { | 430 | switch ( e->key() ) { |
428 | case Key_Delete: | 431 | case Key_Delete: |
429 | del(); | 432 | del(); |
430 | break; | 433 | break; |
431 | case Key_A: | 434 | case Key_A: |
432 | copyAs(); | 435 | copyAs(); |
433 | break; | 436 | break; |
434 | case Key_C: | 437 | case Key_C: |
435 | copy(); | 438 | copy(); |
436 | break; | 439 | break; |
437 | case Key_E: | 440 | case Key_E: |
438 | runThis(); | 441 | runThis(); |
439 | break; | 442 | break; |
440 | case Key_G: | 443 | case Key_G: |
441 | { | 444 | { |
442 | currentPathCombo->lineEdit()->setFocus(); | 445 | currentPathCombo->lineEdit()->setFocus(); |
443 | } | 446 | } |
444 | break; | 447 | break; |
445 | 448 | ||
446 | case Key_H: | 449 | case Key_H: |
447 | showHidden(); | 450 | showHidden(); |
448 | break; | 451 | break; |
449 | case Key_I: | 452 | case Key_I: |
450 | fileStatus(); | 453 | fileStatus(); |
451 | break; | 454 | break; |
452 | case Key_M: | 455 | case Key_M: |
453 | move(); | 456 | move(); |
454 | break; | 457 | break; |
455 | case Key_N: | 458 | case Key_N: |
456 | mkDir(); | 459 | mkDir(); |
457 | break; | 460 | break; |
458 | case Key_P: | 461 | case Key_P: |
459 | filePerms(); | 462 | filePerms(); |
460 | break; | 463 | break; |
461 | case Key_R: | 464 | case Key_R: |
462 | rn(); | 465 | rn(); |
463 | break; | 466 | break; |
464 | case Key_U: | 467 | case Key_U: |
465 | upDir(); | 468 | upDir(); |
466 | break; | 469 | break; |
467 | case Key_1: | 470 | case Key_1: |
468 | switchToLocalTab(); | 471 | switchToLocalTab(); |
469 | break; | 472 | break; |
470 | case Key_2: | 473 | case Key_2: |
471 | switchToRemoteTab(); | 474 | switchToRemoteTab(); |
472 | break; | 475 | break; |
473 | case Key_3: | 476 | case Key_3: |
474 | CFButtonPushed(); | 477 | CFButtonPushed(); |
475 | break; | 478 | break; |
476 | case Key_4: | 479 | case Key_4: |
477 | SDButtonPushed(); | 480 | SDButtonPushed(); |
478 | break; | 481 | break; |
479 | case Key_5: | 482 | case Key_5: |
480 | homeButtonPushed(); | 483 | homeButtonPushed(); |
481 | break; | 484 | break; |
482 | case Key_6: | 485 | case Key_6: |
483 | docButtonPushed(); | 486 | docButtonPushed(); |
484 | break; | 487 | break; |
485 | case Key_7: | 488 | case Key_7: |
486 | break; | 489 | break; |
487 | case Key_8: | 490 | case Key_8: |
488 | break; | 491 | break; |
489 | case Key_9: | 492 | case Key_9: |
490 | break; | 493 | break; |
491 | case Key_0: | 494 | case Key_0: |
492 | break; | 495 | break; |
493 | }; | 496 | }; |
494 | e->accept(); | 497 | e->accept(); |
495 | } | 498 | } |
496 | } | 499 | } |
497 | 500 | ||
498 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | 501 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) |
499 | { | 502 | { |
500 | if( CurrentView()->hasFocus() ) | 503 | if( CurrentView()->hasFocus() ) |
501 | e->ignore(); | 504 | e->ignore(); |
502 | } | 505 | } |
503 | 506 | ||
504 | 507 | ||
505 | void AdvancedFm::QPEButtonPushed() | 508 | void AdvancedFm::QPEButtonPushed() |
506 | { | 509 | { |
507 | QString current = QPEApplication::qpeDir(); | 510 | QString current = QPEApplication::qpeDir(); |
508 | chdir( current.latin1() ); | 511 | chdir( current.latin1() ); |
509 | CurrentDir()->cd( current, TRUE); | 512 | CurrentDir()->cd( current, TRUE); |
510 | populateView(); | 513 | populateView(); |
511 | update(); | 514 | update(); |
512 | } | 515 | } |
513 | 516 | ||
514 | void AdvancedFm::parsetab(const QString &fileName) | 517 | void AdvancedFm::parsetab(const QString &fileName) |
515 | { | 518 | { |
516 | 519 | ||
517 | fileSystemTypeList.clear(); | 520 | fileSystemTypeList.clear(); |
518 | fsList.clear(); | 521 | fsList.clear(); |
519 | struct mntent *me; | 522 | struct mntent *me; |
520 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 523 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
521 | if ( mntfp ) | 524 | if ( mntfp ) |
522 | { | 525 | { |
523 | while ( (me = getmntent( mntfp )) != 0 ) | 526 | while ( (me = getmntent( mntfp )) != 0 ) |
524 | { | 527 | { |
525 | QString deviceName = me->mnt_fsname; | 528 | QString deviceName = me->mnt_fsname; |
526 | QString filesystemType = me->mnt_type; | 529 | QString filesystemType = me->mnt_type; |
527 | QString mountDir = me->mnt_dir; | 530 | QString mountDir = me->mnt_dir; |
528 | if(deviceName != "none") | 531 | if(deviceName != "none") |
529 | { | 532 | { |
530 | if( fsList.contains(filesystemType) == 0 | 533 | if( fsList.contains(filesystemType) == 0 |
531 | & filesystemType.find("proc",0,TRUE) == -1 | 534 | & filesystemType.find("proc",0,TRUE) == -1 |
532 | & filesystemType.find("cramfs",0,TRUE) == -1 | 535 | & filesystemType.find("cramfs",0,TRUE) == -1 |
533 | & filesystemType.find("auto",0,TRUE) == -1) | 536 | & filesystemType.find("auto",0,TRUE) == -1) |
534 | fsList << filesystemType; | 537 | fsList << filesystemType; |
535 | fileSystemTypeList << mountDir+"::"+filesystemType; | 538 | fileSystemTypeList << mountDir+"::"+filesystemType; |
536 | } | 539 | } |
537 | } | 540 | } |
538 | } | 541 | } |
539 | endmntent( mntfp ); | 542 | endmntent( mntfp ); |
540 | } | 543 | } |
541 | 544 | ||
542 | QString AdvancedFm::getFileSystemType(const QString ¤tText) | 545 | QString AdvancedFm::getFileSystemType(const QString ¤tText) |
543 | { | 546 | { |
544 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 547 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
545 | QString current = currentText;//.right( currentText.length()-1); | 548 | QString current = currentText;//.right( currentText.length()-1); |
546 | QString baseFs; | 549 | QString baseFs; |
547 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { | 550 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { |
548 | QString temp = (*it); | 551 | QString temp = (*it); |
549 | QString path = temp.left(temp.find("::",0,TRUE) ); | 552 | QString path = temp.left(temp.find("::",0,TRUE) ); |
550 | path = path.right( path.length()-1); | 553 | path = path.right( path.length()-1); |
551 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 554 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
552 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { | 555 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { |
553 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 556 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
554 | } | 557 | } |
555 | } | 558 | } |
556 | return baseFs; | 559 | return baseFs; |
557 | } | 560 | } |
558 | 561 | ||
559 | QString AdvancedFm::getDiskSpace( const QString &path) | 562 | QString AdvancedFm::getDiskSpace( const QString &path) |
560 | { | 563 | { |
561 | struct statfs fss; | 564 | struct statfs fss; |
562 | if ( !statfs( path.latin1(), &fss ) ) { | 565 | if ( !statfs( path.latin1(), &fss ) ) { |
563 | int blkSize = fss.f_bsize; | 566 | int blkSize = fss.f_bsize; |
564 | // int totalBlks = fs.f_blocks; | 567 | // int totalBlks = fs.f_blocks; |
565 | int availBlks = fss.f_bavail; | 568 | int availBlks = fss.f_bavail; |
566 | 569 | ||
567 | long mult = blkSize / 1024; | 570 | long mult = blkSize / 1024; |
568 | long div = 1024 / blkSize; | 571 | long div = 1024 / blkSize; |
569 | if ( !mult ) mult = 1; | 572 | if ( !mult ) mult = 1; |
570 | if ( !div ) div = 1; | 573 | if ( !div ) div = 1; |
571 | 574 | ||
572 | return QString::number(availBlks * mult / div); | 575 | return QString::number(availBlks * mult / div); |
573 | } | 576 | } |
574 | return ""; | 577 | return ""; |
575 | } | 578 | } |
576 | 579 | ||
577 | 580 | ||
578 | void AdvancedFm::showFileMenu() | 581 | void AdvancedFm::showFileMenu() |
579 | { | 582 | { |
580 | QString curApp; | 583 | QString curApp; |
581 | curApp = CurrentView()->currentItem()->text(0); | 584 | curApp = CurrentView()->currentItem()->text(0); |
582 | 585 | ||
583 | MimeType mt( curApp ); | 586 | MimeType mt( curApp ); |
584 | const AppLnk* app = mt.application(); | 587 | const AppLnk* app = mt.application(); |
585 | QFile fi(curApp); | 588 | QFile fi(curApp); |
586 | QPopupMenu *m = new QPopupMenu(0); | 589 | QPopupMenu *m = new QPopupMenu(0); |
587 | QPopupMenu *n = new QPopupMenu(0); | 590 | QPopupMenu *n = new QPopupMenu(0); |
588 | // QPopupMenu *o = new QPopupMenu(0); | 591 | // QPopupMenu *o = new QPopupMenu(0); |
589 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 592 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
590 | 593 | ||
591 | if ( QFileInfo(fi).isDir() ) | 594 | if ( QFileInfo(fi).isDir() ) |
592 | { | 595 | { |
593 | m->insertSeparator(); | 596 | m->insertSeparator(); |
594 | m->insertItem( tr( "Change Directory" ), this, SLOT( doDirChange() )); | 597 | m->insertItem( tr( "Change Directory" ), this, SLOT( doDirChange() )); |
595 | } | 598 | } |
596 | else | 599 | else |
597 | { | 600 | { |
598 | 601 | ||
599 | if ( app ) | 602 | if ( app ) |
600 | m->insertItem( app->pixmap(), tr( "Open in " | 603 | m->insertItem( app->pixmap(), tr( "Open in " |
601 | + app->name() ), this, SLOT( runThis() ) ); | 604 | + app->name() ), this, SLOT( runThis() ) ); |
602 | else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this | 605 | else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this |
603 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); | 606 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); |
604 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); | 607 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); |
605 | } | 608 | } |
606 | 609 | ||
607 | m->insertItem(tr("Actions"),n); | 610 | m->insertItem(tr("Actions"),n); |
608 | n->insertItem( tr( "Make Directory" ), this, SLOT( makeDir() )); | 611 | n->insertItem( tr( "Make Directory" ), this, SLOT( makeDir() )); |
609 | 612 | ||
610 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 613 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
611 | 614 | ||
612 | n->insertSeparator(); | 615 | n->insertSeparator(); |
613 | n->insertItem( tr( "Rename" ), this, SLOT( renameIt() )); | 616 | n->insertItem( tr( "Rename" ), this, SLOT( renameIt() )); |
614 | 617 | ||
615 | n->insertItem( tr( "Copy" ), this, SLOT( copy() )); | 618 | n->insertItem( tr( "Copy" ), this, SLOT( copy() )); |
616 | n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 619 | n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
617 | n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); | 620 | n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); |
618 | n->insertItem( tr( "Move" ), this, SLOT( move() )); | 621 | n->insertItem( tr( "Move" ), this, SLOT( move() )); |
619 | 622 | ||
620 | n->insertSeparator(); | 623 | n->insertSeparator(); |
621 | n->insertItem( tr( "Delete" ), this, SLOT( doDelete() )); | 624 | n->insertItem( tr( "Delete" ), this, SLOT( doDelete() )); |
622 | m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 625 | m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
623 | 626 | ||
624 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 627 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
625 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 628 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
626 | 629 | ||
627 | m->insertSeparator(); | 630 | m->insertSeparator(); |
628 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 631 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
629 | 632 | ||
630 | #if defined(QT_QWS_OPIE) | 633 | #if defined(QT_QWS_OPIE) |
631 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 634 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
632 | #endif | 635 | #endif |
633 | m->setCheckable(TRUE); | 636 | m->setCheckable(TRUE); |
634 | if (!b) | 637 | if (!b) |
635 | m->setItemChecked(m->idAt(0),TRUE); | 638 | m->setItemChecked(m->idAt(0),TRUE); |
636 | else | 639 | else |
637 | m->setItemChecked(m->idAt(0),FALSE); | 640 | m->setItemChecked(m->idAt(0),FALSE); |
638 | 641 | ||
639 | if(Ir::supported()) | 642 | if(Ir::supported()) |
640 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); | 643 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); |
641 | m->setFocus(); | 644 | m->setFocus(); |
642 | m->exec( QPoint( 4,QCursor::pos().y()) ); | 645 | m->exec( QPoint( 4,QCursor::pos().y()) ); |
643 | 646 | ||
644 | if(m) delete m; | 647 | if(m) delete m; |
645 | } | 648 | } |
646 | 649 | ||
647 | 650 | ||
648 | void AdvancedFm::cancelMenuTimer() | 651 | void AdvancedFm::cancelMenuTimer() |
649 | { | 652 | { |
650 | // qDebug("selectionChanged: cancel menu timer"); | 653 | // qDebug("selectionChanged: cancel menu timer"); |
651 | if( menuTimer.isActive() ) | 654 | if( menuTimer.isActive() ) |
652 | menuTimer.stop(); | 655 | menuTimer.stop(); |
653 | } | 656 | } |
654 | 657 | ||
655 | QString AdvancedFm::checkDiskSpace(const QString &path) | 658 | QString AdvancedFm::checkDiskSpace(const QString &path) |
656 | { | 659 | { |
657 | struct statfs fss; | 660 | struct statfs fss; |
658 | if ( !statfs( path.latin1(), &fss ) ) | 661 | if ( !statfs( path.latin1(), &fss ) ) |
659 | { | 662 | { |
660 | int blkSize = fss.f_bsize; | 663 | int blkSize = fss.f_bsize; |
661 | // int totalBlks = fs.f_blocks; | 664 | // int totalBlks = fs.f_blocks; |
662 | int availBlks = fss.f_bavail; | 665 | int availBlks = fss.f_bavail; |
663 | 666 | ||
664 | long mult = blkSize / 1024; | 667 | long mult = blkSize / 1024; |
665 | long div = 1024 / blkSize; | 668 | long div = 1024 / blkSize; |
666 | if ( !mult ) mult = 1; | 669 | if ( !mult ) mult = 1; |
667 | if ( !div ) div = 1; | 670 | if ( !div ) div = 1; |
668 | 671 | ||
669 | 672 | ||
670 | return QString::number(availBlks * mult / div); | 673 | return QString::number(availBlks * mult / div); |
671 | } | 674 | } |
672 | return ""; | 675 | return ""; |
673 | } | 676 | } |
674 | 677 | ||
675 | void AdvancedFm::addToDocs() | 678 | void AdvancedFm::addToDocs() |
676 | { | 679 | { |
677 | QStringList strListPaths = getPath(); | 680 | QStringList strListPaths = getPath(); |
678 | QDir *thisDir = CurrentDir(); | 681 | QDir *thisDir = CurrentDir(); |
679 | 682 | ||
680 | if( strListPaths.count() > 0) | 683 | if( strListPaths.count() > 0) |
681 | { | 684 | { |
682 | QString curFile; | 685 | QString curFile; |
683 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) | 686 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) |
684 | { | 687 | { |
685 | curFile = thisDir->canonicalPath()+"/"+(*it); | 688 | curFile = thisDir->canonicalPath()+"/"+(*it); |
686 | // qDebug(curFile); | 689 | // qDebug(curFile); |
687 | DocLnk f; | 690 | DocLnk f; |
688 | // curFile.replace(QRegExp("\\..*"),""); | 691 | // curFile.replace(QRegExp("\\..*"),""); |
689 | f.setName((*it)); | 692 | f.setName((*it)); |
690 | f.setFile( curFile); | 693 | f.setFile( curFile); |
691 | f.writeLink(); | 694 | f.writeLink(); |
692 | } | 695 | } |
693 | } | 696 | } |
694 | } | 697 | } |
695 | 698 | ||
696 | 699 | ||
697 | void AdvancedFm::customDirsToMenu() | 700 | void AdvancedFm::customDirsToMenu() |
698 | { | 701 | { |
699 | 702 | ||
700 | Config cfg("AdvancedFm"); | 703 | Config cfg("AdvancedFm"); |
701 | cfg.setGroup("Menu"); | 704 | cfg.setGroup("Menu"); |
702 | 705 | ||
703 | QStringList list = cfg.readListEntry( "CustomDir", ','); | 706 | QStringList list = cfg.readListEntry( "CustomDir", ','); |
704 | menuButton->insertItems(list ); | 707 | menuButton->insertItems(list ); |
705 | 708 | ||
706 | // for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 709 | // for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
707 | // { | 710 | // { |
708 | // customDirMenu->insertItem(*it ); | 711 | // customDirMenu->insertItem(*it ); |
709 | // } | 712 | // } |
710 | } | 713 | } |
711 | 714 | ||
712 | void AdvancedFm::dirMenuSelected(int item) | 715 | void AdvancedFm::dirMenuSelected(int item) |
713 | { | 716 | { |
714 | qDebug("menu item %d", item); | 717 | qDebug("menu item %d", item); |
715 | switch(item) | 718 | switch(item) |
716 | { | 719 | { |
717 | 720 | ||
718 | case -21: | 721 | case -21: |
719 | case 0: | 722 | case 0: |
720 | addCustomDir(); | 723 | addCustomDir(); |
721 | break; | 724 | break; |
722 | case -22: | 725 | case -22: |
723 | case 1: | 726 | case 1: |
724 | removeCustomDir(); | 727 | removeCustomDir(); |
725 | break; | 728 | break; |
726 | default: | 729 | default: |
727 | { | 730 | { |
728 | // gotoCustomDir( menuButton->text(item)); | 731 | // gotoCustomDir( menuButton->text(item)); |
729 | // gotoCustomDir( customDirMenu->text(item)); | 732 | // gotoCustomDir( customDirMenu->text(item)); |
730 | } | 733 | } |
731 | break; | 734 | break; |
732 | 735 | ||
733 | }; | 736 | }; |
734 | } | 737 | } |
735 | 738 | ||
736 | void AdvancedFm::addCustomDir() | 739 | void AdvancedFm::addCustomDir() |
737 | { | 740 | { |
738 | Config cfg("AdvancedFm"); | 741 | Config cfg("AdvancedFm"); |
739 | cfg.setGroup("Menu"); | 742 | cfg.setGroup("Menu"); |
740 | QString dir; | 743 | QString dir; |
741 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); | 744 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); |
742 | 745 | ||
743 | dir = CurrentDir()->canonicalPath(); | 746 | dir = CurrentDir()->canonicalPath(); |
744 | 747 | ||
745 | bool addIt=true; | 748 | bool addIt=true; |
746 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 749 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
747 | { | 750 | { |
748 | if( dir == (*it)) | 751 | if( dir == (*it)) |
749 | { | 752 | { |
750 | addIt=false; | 753 | addIt=false; |
751 | } | 754 | } |
752 | } | 755 | } |
753 | if(addIt) | 756 | if(addIt) |
754 | { | 757 | { |
755 | menuButton->insertItem(dir); | 758 | menuButton->insertItem(dir); |
756 | // customDirMenu->insertItem(dir); | 759 | // customDirMenu->insertItem(dir); |
757 | list << dir; | 760 | list << dir; |
758 | } | 761 | } |
759 | 762 | ||
760 | cfg.writeEntry("CustomDir", list, ','); | 763 | cfg.writeEntry("CustomDir", list, ','); |
761 | cfg.write(); | 764 | cfg.write(); |
762 | } | 765 | } |
763 | 766 | ||
764 | void AdvancedFm::removeCustomDir() | 767 | void AdvancedFm::removeCustomDir() |
765 | { | 768 | { |
766 | // qDebug("remove custom dir"); | 769 | // qDebug("remove custom dir"); |
767 | Config cfg("AdvancedFm"); | 770 | Config cfg("AdvancedFm"); |
768 | cfg.setGroup("Menu"); | 771 | cfg.setGroup("Menu"); |
769 | QString dir; | 772 | QString dir; |
770 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); | 773 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); |
771 | QStringList list2; | 774 | QStringList list2; |
772 | dir = CurrentDir()->canonicalPath(); | 775 | dir = CurrentDir()->canonicalPath(); |
773 | int ramble=2; | 776 | int ramble=2; |
774 | // int ramble=-24; | 777 | // int ramble=-24; |
775 | //first remove list | 778 | //first remove list |
776 | if(list.grep(dir,true).isEmpty()) | 779 | if(list.grep(dir,true).isEmpty()) |
777 | { | 780 | { |
778 | QMessageBox::message(tr( "AdvancedFm" ), | 781 | QMessageBox::message(tr( "AdvancedFm" ), |
779 | tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); | 782 | tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); |
780 | } | 783 | } |
781 | else | 784 | else |
782 | { | 785 | { |
783 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 786 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
784 | { | 787 | { |
785 | if((*it) != dir)//current item is not our current dir, so add it to temp list | 788 | if((*it) != dir)//current item is not our current dir, so add it to temp list |
786 | { | 789 | { |
787 | list2 <<(*it); | 790 | list2 <<(*it); |
788 | } | 791 | } |
789 | else | 792 | else |
790 | { | 793 | { |
791 | // customDirMenu->removeItem( ramble); | 794 | // customDirMenu->removeItem( ramble); |
792 | menuButton->remove( ramble); | 795 | menuButton->remove( ramble); |
793 | 796 | ||
794 | } | 797 | } |
795 | ramble++; | 798 | ramble++; |
796 | // ramble--; | 799 | // ramble--; |
797 | } | 800 | } |
798 | 801 | ||
799 | cfg.writeEntry("CustomDir", list2, ','); | 802 | cfg.writeEntry("CustomDir", list2, ','); |
800 | cfg.write(); | 803 | cfg.write(); |
801 | } | 804 | } |
802 | // customDirsToMenu(); | 805 | // customDirsToMenu(); |
803 | 806 | ||
804 | } | 807 | } |
805 | 808 | ||
806 | void AdvancedFm::gotoCustomDir(const QString &dir) | 809 | void AdvancedFm::gotoCustomDir(const QString &dir) |
807 | { | 810 | { |
808 | // qDebug("gotoCustomDir(const QString &dir) " +dir ); | 811 | // qDebug("gotoCustomDir(const QString &dir) " +dir ); |
809 | QString curDir = dir; | 812 | // QString curDir = dir; |
810 | QDir *thisDir = CurrentDir(); | 813 | // QDir *thisDir = CurrentDir(); |
811 | // if( curDir.isEmpty()) { | 814 | // if( curDir.isEmpty()) { |
812 | // } | 815 | // } |
813 | if( curDir == s_addBookmark) | 816 | if( dir == s_addBookmark) |
814 | { | 817 | { |
815 | addCustomDir(); | 818 | addCustomDir(); |
816 | } | 819 | } |
817 | if( curDir == s_removeBookmark) | 820 | if( dir == s_removeBookmark) |
818 | { | 821 | { |
819 | removeCustomDir( ); | 822 | removeCustomDir( ); |
820 | } | 823 | } |
821 | else | 824 | else |
822 | { | 825 | { |
823 | if(QDir( curDir).exists() ) | 826 | gotoDirectory( dir); |
824 | { | 827 | // if(QDir( curDir).exists() ) |
825 | thisDir->setPath( curDir ); | 828 | // { |
826 | chdir( curDir.latin1() ); | 829 | // thisDir->setPath( curDir ); |
827 | thisDir->cd( curDir, TRUE); | 830 | // chdir( curDir.latin1() ); |
828 | populateView(); | 831 | // thisDir->cd( curDir, TRUE); |
829 | } | 832 | // populateView(); |
833 | // } | ||
830 | } | 834 | } |
831 | } | 835 | } |
832 | 836 | ||
833 | QDir *AdvancedFm::CurrentDir() | 837 | QDir *AdvancedFm::CurrentDir() |
834 | { | 838 | { |
835 | if ( whichTab == 1) | 839 | if ( whichTab == 1) |
836 | { | 840 | { |
837 | return ¤tDir; | 841 | return ¤tDir; |
838 | } | 842 | } |
839 | else | 843 | else |
840 | { | 844 | { |
841 | return ¤tRemoteDir; | 845 | return ¤tRemoteDir; |
842 | } | 846 | } |
843 | } | 847 | } |
844 | 848 | ||
845 | QDir *AdvancedFm::OtherDir() | 849 | QDir *AdvancedFm::OtherDir() |
846 | { | 850 | { |
847 | if ( whichTab == 1) | 851 | if ( whichTab == 1) |
848 | { | 852 | { |
849 | return ¤tRemoteDir; | 853 | return ¤tRemoteDir; |
850 | } | 854 | } |
851 | else | 855 | else |
852 | { | 856 | { |
853 | return ¤tDir; | 857 | return ¤tDir; |
854 | } | 858 | } |
855 | } | 859 | } |
856 | 860 | ||
857 | QListView * AdvancedFm::CurrentView() | 861 | QListView * AdvancedFm::CurrentView() |
858 | { | 862 | { |
859 | if ( whichTab == 1) | 863 | if ( whichTab == 1) |
860 | return Local_View; | 864 | return Local_View; |
861 | else | 865 | else |
862 | return Remote_View; | 866 | return Remote_View; |
863 | } | 867 | } |
864 | 868 | ||
865 | QListView * AdvancedFm::OtherView() | 869 | QListView * AdvancedFm::OtherView() |
866 | { | 870 | { |
867 | if ( whichTab == 1) | 871 | if ( whichTab == 1) |
868 | return Remote_View; | 872 | return Remote_View; |
869 | else | 873 | else |
870 | return Local_View; | 874 | return Local_View; |
871 | } | 875 | } |
872 | 876 | ||
873 | void AdvancedFm::setOtherTabCurrent() | 877 | void AdvancedFm::setOtherTabCurrent() |
874 | { | 878 | { |
875 | if ( whichTab == 1) | 879 | if ( whichTab == 1) |
876 | TabWidget->setCurrentTab(1); | 880 | TabWidget->setCurrentTab(1); |
877 | else | 881 | else |
878 | TabWidget->setCurrentTab(0); | 882 | TabWidget->setCurrentTab(0); |
879 | } | 883 | } |
884 | |||
885 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { | ||
886 | qDebug("qcop message "+msg ); | ||
887 | QDataStream stream ( data, IO_ReadOnly ); | ||
888 | if ( msg == "openDirectory(QString)" ) { | ||
889 | qDebug("received"); | ||
890 | QString file; | ||
891 | stream >> file; | ||
892 | gotoDirectory( (const QString &) file); | ||
893 | } | ||
894 | } | ||
895 | |||
896 | void AdvancedFm::setDocument(const QString &file) { | ||
897 | gotoDirectory( file); | ||
898 | |||
899 | } | ||
900 | |||
901 | void AdvancedFm::gotoDirectory(const QString &file) { | ||
902 | |||
903 | QString curDir = file; | ||
904 | QDir *thisDir = CurrentDir(); | ||
905 | |||
906 | if(QDir( curDir).exists() ) { | ||
907 | thisDir->setPath( curDir ); | ||
908 | chdir( curDir.latin1() ); | ||
909 | thisDir->cd( curDir, TRUE); | ||
910 | populateView(); | ||
911 | } | ||
912 | } | ||
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 4480051..c9a5525 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -1,171 +1,178 @@ | |||
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 <opie/otabwidget.h> |
18 | #include <opie/oprocess.h> | 18 | #include <opie/oprocess.h> |
19 | |||
19 | #include <qpe/ir.h> | 20 | #include <qpe/ir.h> |
21 | #include <qpe/qcopenvelope_qws.h> | ||
20 | 22 | ||
21 | #include <qvariant.h> | 23 | #include <qvariant.h> |
22 | #include <qdialog.h> | 24 | #include <qdialog.h> |
23 | #include <qmainwindow.h> | 25 | #include <qmainwindow.h> |
24 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
25 | #include <qdir.h> | 27 | #include <qdir.h> |
26 | #include <qstring.h> | 28 | #include <qstring.h> |
27 | #include <qpoint.h> | 29 | #include <qpoint.h> |
28 | #include <qtimer.h> | 30 | #include <qtimer.h> |
29 | #include <qpixmap.h> | 31 | #include <qpixmap.h> |
30 | 32 | ||
31 | class OTabWidget; | 33 | class OTabWidget; |
32 | class QVBoxLayout; | 34 | class QVBoxLayout; |
33 | class QHBoxLayout; | 35 | class QHBoxLayout; |
34 | class QGridLayout; | 36 | class QGridLayout; |
35 | class QComboBox; | 37 | class QComboBox; |
36 | class QListView; | 38 | class QListView; |
37 | class QListviewItem; | 39 | class QListviewItem; |
38 | class QLabel; | 40 | class QLabel; |
39 | class QProgressBar; | 41 | class QProgressBar; |
40 | class QSpinBox; | 42 | class QSpinBox; |
41 | class QTabWidget; | 43 | class QTabWidget; |
42 | class QWidget; | 44 | class QWidget; |
43 | class QPopupMenu; | 45 | class QPopupMenu; |
44 | class QFile; | 46 | class QFile; |
45 | class QListViewItem; | 47 | class QListViewItem; |
46 | class QLineEdit; | 48 | class QLineEdit; |
47 | class MenuButton; | 49 | class MenuButton; |
48 | 50 | ||
49 | class QToolButton; | 51 | class QToolButton; |
50 | class Ir; | 52 | class Ir; |
51 | 53 | ||
52 | class AdvancedFm : public QMainWindow | 54 | class AdvancedFm : public QMainWindow |
53 | { | 55 | { |
54 | Q_OBJECT | 56 | Q_OBJECT |
55 | public: | 57 | public: |
56 | AdvancedFm(); | 58 | AdvancedFm(); |
57 | ~AdvancedFm(); | 59 | ~AdvancedFm(); |
58 | protected slots: | 60 | protected slots: |
59 | void selectAll(); | 61 | void selectAll(); |
60 | void addToDocs(); | 62 | void addToDocs(); |
61 | void doDirChange(); | 63 | void doDirChange(); |
62 | void mkDir(); | 64 | void mkDir(); |
63 | void del(); | 65 | void del(); |
64 | void rn(); | 66 | void rn(); |
65 | void populateView(); | 67 | void populateView(); |
66 | void rePopulate(); | 68 | void rePopulate(); |
67 | void showHidden(); | 69 | void showHidden(); |
68 | void showMenuHidden(); | 70 | void showMenuHidden(); |
69 | void writeConfig(); | 71 | void writeConfig(); |
70 | void readConfig(); | 72 | void readConfig(); |
71 | void ListClicked(QListViewItem *); | 73 | void ListClicked(QListViewItem *); |
72 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 74 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
73 | void makeDir(); | 75 | void makeDir(); |
74 | void doDelete(); | 76 | void doDelete(); |
75 | void tabChanged(QWidget*); | 77 | void tabChanged(QWidget*); |
76 | void cleanUp(); | 78 | void cleanUp(); |
77 | void renameIt(); | 79 | void renameIt(); |
78 | void runThis(); | 80 | void runThis(); |
79 | void runText(); | 81 | void runText(); |
80 | void filePerms(); | 82 | void filePerms(); |
81 | void doProperties(); | 83 | void doProperties(); |
82 | void runCommand(); | 84 | void runCommand(); |
83 | void runCommandStd(); | 85 | void runCommandStd(); |
84 | QStringList getPath(); | 86 | QStringList getPath(); |
85 | void mkSym(); | 87 | void mkSym(); |
86 | void switchToLocalTab(); | 88 | void switchToLocalTab(); |
87 | void switchToRemoteTab(); | 89 | void switchToRemoteTab(); |
88 | 90 | ||
89 | protected: | 91 | protected: |
90 | 92 | ||
91 | OTabWidget *TabWidget; | 93 | OTabWidget *TabWidget; |
94 | QCopChannel * channel; | ||
92 | QPixmap unknownXpm; | 95 | QPixmap unknownXpm; |
93 | int whichTab; | 96 | int whichTab; |
94 | // QTabWidget *TabWidget; | 97 | // QTabWidget *TabWidget; |
95 | QWidget *tab, *tab_2, *tab_3; | 98 | QWidget *tab, *tab_2, *tab_3; |
96 | QListView *Local_View, *Remote_View; | 99 | QListView *Local_View, *Remote_View; |
97 | 100 | ||
98 | QLineEdit *currentPathEdit; | 101 | QLineEdit *currentPathEdit; |
99 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; | 102 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; |
100 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 103 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
101 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 104 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
102 | QDir currentDir, currentRemoteDir; | 105 | QDir currentDir, currentRemoteDir; |
103 | QComboBox *currentPathCombo; | 106 | QComboBox *currentPathCombo; |
104 | QString filterStr, s_addBookmark, s_removeBookmark; | 107 | QString filterStr, s_addBookmark, s_removeBookmark; |
105 | QListViewItem * item; | 108 | QListViewItem * item; |
106 | bool b; | 109 | bool b; |
107 | QStringList fileSystemTypeList, fsList; | 110 | QStringList fileSystemTypeList, fsList; |
108 | int currentServerConfig; | 111 | int currentServerConfig; |
109 | bool zaurusDevice; | 112 | bool zaurusDevice; |
110 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 113 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
111 | QStringList remoteDirPathStringList, localDirPathStringList; | 114 | QStringList remoteDirPathStringList, localDirPathStringList; |
112 | QLineEdit *renameBox; | 115 | QLineEdit *renameBox; |
113 | 116 | ||
114 | void init(); | 117 | void init(); |
115 | void initConnections(); | 118 | void initConnections(); |
116 | void keyReleaseEvent( QKeyEvent *); | 119 | void keyReleaseEvent( QKeyEvent *); |
117 | void keyPressEvent( QKeyEvent *); | 120 | void keyPressEvent( QKeyEvent *); |
118 | QString getFileSystemType(const QString &); | 121 | QString getFileSystemType(const QString &); |
119 | QString getDiskSpace(const QString &); | 122 | QString getDiskSpace(const QString &); |
120 | void parsetab(const QString &fileName); | 123 | void parsetab(const QString &fileName); |
121 | QString checkDiskSpace(const QString &); | 124 | QString checkDiskSpace(const QString &); |
122 | QString dealWithSymName(const QString &); | 125 | QString dealWithSymName(const QString &); |
123 | QDir *CurrentDir(); | 126 | QDir *CurrentDir(); |
124 | QDir *OtherDir(); | 127 | QDir *OtherDir(); |
125 | QListView *CurrentView(); | 128 | QListView *CurrentView(); |
126 | QListView *OtherView(); | 129 | QListView *OtherView(); |
127 | void setOtherTabCurrent(); | 130 | void setOtherTabCurrent(); |
128 | 131 | ||
129 | protected slots: | 132 | protected slots: |
130 | void dirMenuSelected(int); | 133 | void dirMenuSelected(int); |
131 | void showFileMenu(); | 134 | void showFileMenu(); |
132 | void cancelMenuTimer(); | 135 | void cancelMenuTimer(); |
133 | void homeButtonPushed(); | 136 | void homeButtonPushed(); |
134 | void docButtonPushed(); | 137 | void docButtonPushed(); |
135 | void SDButtonPushed(); | 138 | void SDButtonPushed(); |
136 | void CFButtonPushed(); | 139 | void CFButtonPushed(); |
137 | void QPEButtonPushed(); | 140 | void QPEButtonPushed(); |
138 | void upDir(); | 141 | void upDir(); |
139 | void currentPathComboChanged(); | 142 | void currentPathComboChanged(); |
140 | void copy(); | 143 | void copy(); |
141 | void copyAs(); | 144 | void copyAs(); |
142 | void copySameDir(); | 145 | void copySameDir(); |
143 | void currentPathComboActivated(const QString &); | 146 | void currentPathComboActivated(const QString &); |
144 | void fillCombo(const QString &); | 147 | void fillCombo(const QString &); |
145 | bool copyFile( const QString & , const QString & ); | 148 | bool copyFile( const QString & , const QString & ); |
146 | void move(); | 149 | void move(); |
147 | void fileStatus(); | 150 | void fileStatus(); |
148 | void doAbout(); | 151 | void doAbout(); |
149 | void doBeam(); | 152 | void doBeam(); |
150 | void fileBeamFinished( Ir *); | 153 | void fileBeamFinished( Ir *); |
151 | 154 | ||
152 | private: | 155 | private: |
153 | MenuButton *menuButton; | 156 | MenuButton *menuButton; |
154 | QString oldName; | 157 | QString oldName; |
155 | QTimer menuTimer; | 158 | QTimer menuTimer; |
156 | void startProcess(const QString &); | 159 | void startProcess(const QString &); |
157 | bool eventFilter( QObject * , QEvent * ); | 160 | bool eventFilter( QObject * , QEvent * ); |
158 | void cancelRename(); | 161 | void cancelRename(); |
159 | void doRename(QListView *); | 162 | void doRename(QListView *); |
160 | void okRename(); | 163 | void okRename(); |
161 | void customDirsToMenu(); | 164 | void customDirsToMenu(); |
162 | void addCustomDir(); | 165 | void addCustomDir(); |
163 | void removeCustomDir(); | 166 | void removeCustomDir(); |
167 | void gotoDirectory(const QString &); | ||
164 | 168 | ||
165 | private slots: | 169 | private slots: |
166 | void processEnded(OProcess *); | 170 | void processEnded(OProcess *); |
167 | void oprocessStderr(OProcess *, char *, int); | 171 | void oprocessStderr(OProcess *, char *, int); |
168 | void gotoCustomDir(const QString &); | 172 | void gotoCustomDir(const QString &); |
173 | void qcopReceive(const QCString&, const QByteArray&); | ||
174 | void setDocument(const QString &); | ||
175 | |||
169 | }; | 176 | }; |
170 | 177 | ||
171 | #endif // ADVANCEDFM_H | 178 | #endif // ADVANCEDFM_H |