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