summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-16 03:59:23 (UTC)
committer llornkcor <llornkcor>2002-11-16 03:59:23 (UTC)
commitb17b2274c200403da25a994ed9d8ba4856d725c0 (patch) (unidiff)
treed3f64243b4f0a8b8ec6300ac33430633da9543a8
parentd3e670971b2b721eb2b484801cf1c6ecbf52d436 (diff)
downloadopie-b17b2274c200403da25a994ed9d8ba4856d725c0.zip
opie-b17b2274c200403da25a994ed9d8ba4856d725c0.tar.gz
opie-b17b2274c200403da25a994ed9d8ba4856d725c0.tar.bz2
various changes, popupmenu at complete left.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp6
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp1
2 files changed, 4 insertions, 3 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 08dc24e..23244a2 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,271 +1,271 @@
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/filemanager.h> 19#include <qpe/filemanager.h>
20#include <qpe/qcopenvelope_qws.h> 20#include <qpe/qcopenvelope_qws.h>
21#include <qpe/qpemenubar.h> 21#include <qpe/qpemenubar.h>
22#include <qpe/qpetoolbar.h> 22#include <qpe/qpetoolbar.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25#include <qpe/config.h> 25#include <qpe/config.h>
26#include <qpe/mimetype.h> 26#include <qpe/mimetype.h>
27#include <qpe/applnk.h> 27#include <qpe/applnk.h>
28#include <qpe/ir.h> 28#include <qpe/ir.h>
29#include <qpe/resource.h> 29#include <qpe/resource.h>
30 30
31#include <qtabwidget.h> 31#include <qtabwidget.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qpushbutton.h> 33#include <qpushbutton.h>
34#include <qdatetime.h> 34#include <qdatetime.h>
35#include <qdir.h> 35#include <qdir.h>
36#include <qfile.h> 36#include <qfile.h>
37#include <qstring.h> 37#include <qstring.h>
38#include <qcombobox.h> 38#include <qcombobox.h>
39#include <qpopupmenu.h> 39#include <qpopupmenu.h>
40#include <qlistview.h> 40#include <qlistview.h>
41#include <qmainwindow.h> 41#include <qmainwindow.h>
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qprogressbar.h> 43#include <qprogressbar.h>
44#include <qspinbox.h> 44#include <qspinbox.h>
45#include <qwidget.h> 45#include <qwidget.h>
46#include <qlayout.h> 46#include <qlayout.h>
47#include <qimage.h> 47#include <qimage.h>
48#include <qpixmap.h> 48#include <qpixmap.h>
49#include <qmessagebox.h> 49#include <qmessagebox.h>
50#include <qlineedit.h> 50#include <qlineedit.h>
51#include <qregexp.h> 51#include <qregexp.h>
52 52
53#include <unistd.h> 53#include <unistd.h>
54#include <stdlib.h> 54#include <stdlib.h>
55#include <sys/stat.h> 55#include <sys/stat.h>
56#include <dirent.h> 56#include <dirent.h>
57#include <stdio.h> 57#include <stdio.h>
58#include <time.h> 58#include <time.h>
59#include <fcntl.h> 59#include <fcntl.h>
60#include <mntent.h> 60#include <mntent.h>
61#include <string.h> 61#include <string.h>
62#include <errno.h> 62#include <errno.h>
63#include <sys/vfs.h> 63#include <sys/vfs.h>
64#include <mntent.h> 64#include <mntent.h>
65#include <sys/utsname.h> 65#include <sys/utsname.h>
66 66
67AdvancedFm::AdvancedFm( ) 67AdvancedFm::AdvancedFm( )
68 : QMainWindow( ) { 68 : QMainWindow( ) {
69 init(); 69 init();
70 initConnections(); 70 initConnections();
71 populateLocalView(); 71 populateLocalView();
72 populateRemoteView(); 72 populateRemoteView();
73 currentPathCombo->setFocus(); 73 currentPathCombo->setFocus();
74} 74}
75 75
76AdvancedFm::~AdvancedFm() { 76AdvancedFm::~AdvancedFm() {
77} 77}
78 78
79void AdvancedFm::cleanUp() { 79void AdvancedFm::cleanUp() {
80 QString sfile=QDir::homeDirPath(); 80 QString sfile=QDir::homeDirPath();
81 if(sfile.right(1) != "/") 81 if(sfile.right(1) != "/")
82 sfile+="/._temp"; 82 sfile+="/._temp";
83 else 83 else
84 sfile+="._temp"; 84 sfile+="._temp";
85 QFile file( sfile); 85 QFile file( sfile);
86 if(file.exists()) 86 if(file.exists())
87 file.remove(); 87 file.remove();
88} 88}
89 89
90void AdvancedFm::tabChanged(QWidget *) { 90void AdvancedFm::tabChanged(QWidget *) {
91 if (TabWidget->getCurrentTab() == 0) { 91 if (TabWidget->getCurrentTab() == 0) {
92// if (TabWidget->currentPageIndex() == 0) { 92// if (TabWidget->currentPageIndex() == 0) {
93 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 93 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
94 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); 94 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE);
95 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); 95 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE);
96 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 96 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath());
97 setCaption("AdvancedFm :: "+fs+" :: " 97 setCaption("AdvancedFm :: "+fs+" :: "
98 +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); 98 +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" );
99 99
100 } 100 }
101 if (TabWidget->getCurrentTab() == 1) { 101 if (TabWidget->getCurrentTab() == 1) {
102 102
103// if (TabWidget->currentPageIndex() == 1) { 103// if (TabWidget->currentPageIndex() == 1) {
104 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); 104 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath());
105 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); 105 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE);
106 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); 106 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE);
107 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 107 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
108 setCaption("AdvancedFm :: "+fs+" :: " 108 setCaption("AdvancedFm :: "+fs+" :: "
109 +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); 109 +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" );
110 } 110 }
111} 111}
112 112
113 113
114void AdvancedFm::populateLocalView() { 114void AdvancedFm::populateLocalView() {
115 QPixmap pm; 115 QPixmap pm;
116 Local_View->clear(); 116 Local_View->clear();
117 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 117 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
118 currentDir.setMatchAllDirs(TRUE); 118 currentDir.setMatchAllDirs(TRUE);
119 currentDir.setNameFilter(filterStr); 119 currentDir.setNameFilter(filterStr);
120 QString fileL, fileS, fileDate; 120 QString fileL, fileS, fileDate;
121 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 121 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath());
122 setCaption("AdvancedFm :: "+fs+" :: " 122 setCaption("AdvancedFm :: "+fs+" :: "
123 +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); 123 +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" );
124 bool isDir=FALSE; 124 bool isDir=FALSE;
125 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 125 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
126 QFileInfoListIterator it(*list); 126 QFileInfoListIterator it(*list);
127 QFileInfo *fi; 127 QFileInfo *fi;
128 while ( (fi=it.current()) ) { 128 while ( (fi=it.current()) ) {
129 if (fi->isSymLink() ) { 129 if (fi->isSymLink() ) {
130 QString symLink=fi->readLink(); 130 QString symLink=fi->readLink();
131 QFileInfo sym( symLink); 131 QFileInfo sym( symLink);
132 fileS.sprintf( "%10i", sym.size() ); 132 fileS.sprintf( "%10i", sym.size() );
133 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); 133 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() );
134 fileDate = sym.lastModified().toString(); 134 fileDate = sym.lastModified().toString();
135 } else { 135 } else {
136 fileS.sprintf( "%10i", fi->size() ); 136 fileS.sprintf( "%10i", fi->size() );
137 fileL.sprintf( "%s",fi->fileName().data() ); 137 fileL.sprintf( "%s",fi->fileName().data() );
138 fileDate= fi->lastModified().toString(); 138 fileDate= fi->lastModified().toString();
139 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { 139 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) {
140 fileL+="/"; 140 fileL+="/";
141 isDir=TRUE; 141 isDir=TRUE;
142 } 142 }
143 } 143 }
144 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); 144 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL);
145 if(fileL !="./" && fi->exists()) { 145 if(fileL !="./" && fi->exists()) {
146 item= new QListViewItem( Local_View, fileL, fileS , fileDate); 146 item= new QListViewItem( Local_View, fileL, fileS , fileDate);
147 147
148 if(isDir || fileL.find("/",0,TRUE) != -1) { 148 if(isDir || fileL.find("/",0,TRUE) != -1) {
149 149
150 if( !QDir( fi->filePath() ).isReadable()) //is directory 150 if( !QDir( fi->filePath() ).isReadable()) //is directory
151 pm = Resource::loadPixmap( "lockedfolder" ); 151 pm = Resource::loadPixmap( "lockedfolder" );
152 else 152 else
153 pm= Resource::loadPixmap( "folder" ); 153 pm= Resource::loadPixmap( "folder" );
154 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 154 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
155 pm = Resource::loadPixmap( "exec"); 155 pm = Resource::loadPixmap( "exec");
156 } else if( (fileInfo.permission( QFileInfo::ExeUser) 156 } else if( (fileInfo.permission( QFileInfo::ExeUser)
157 | fileInfo.permission( QFileInfo::ExeGroup) 157 | fileInfo.permission( QFileInfo::ExeGroup)
158 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 158 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
159 pm = Resource::loadPixmap( "exec"); 159 pm = Resource::loadPixmap( "exec");
160 } else if( !fi->isReadable() ) { 160 } else if( !fi->isReadable() ) {
161 pm = Resource::loadPixmap( "locked" ); 161 pm = Resource::loadPixmap( "locked" );
162 } else { //everything else goes by mimetype 162 } else { //everything else goes by mimetype
163 MimeType mt(fi->filePath()); 163 MimeType mt(fi->filePath());
164 pm=mt.pixmap(); //sets the correct pixmap for mimetype 164 pm=mt.pixmap(); //sets the correct pixmap for mimetype
165 if(pm.isNull()) 165 if(pm.isNull())
166 pm = Resource::loadPixmap( "UnknownDocument-14" ); 166 pm = Resource::loadPixmap( "UnknownDocument-14" );
167 } 167 }
168 item->setPixmap( 0,pm); 168 item->setPixmap( 0,pm);
169 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 169 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
170 // overlay link image 170 // overlay link image
171 pm= Resource::loadPixmap( "folder" ); 171 pm= Resource::loadPixmap( "folder" );
172 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 172 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
173 QPainter painter( &pm ); 173 QPainter painter( &pm );
174 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 174 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
175 pm.setMask( pm.createHeuristicMask( FALSE ) ); 175 pm.setMask( pm.createHeuristicMask( FALSE ) );
176 item->setPixmap( 0, pm); 176 item->setPixmap( 0, pm);
177 } 177 }
178 } 178 }
179 isDir=FALSE; 179 isDir=FALSE;
180 ++it; 180 ++it;
181 } 181 }
182 182
183 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { 183 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) {
184 struct stat buf; 184 struct stat buf;
185 dev_t devT; 185 dev_t devT;
186 DIR *dir; 186 DIR *dir;
187 struct dirent *mydirent; 187 struct dirent *mydirent;
188 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) 188 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL)
189 while ((mydirent = readdir(dir)) != NULL) { 189 while ((mydirent = readdir(dir)) != NULL) {
190 lstat( mydirent->d_name, &buf); 190 lstat( mydirent->d_name, &buf);
191 qDebug(mydirent->d_name); 191 qDebug(mydirent->d_name);
192 fileL.sprintf("%s", mydirent->d_name); 192 fileL.sprintf("%s", mydirent->d_name);
193 devT = buf.st_dev; 193 devT = buf.st_dev;
194 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 194 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
195 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 195 fileDate.sprintf("%s", ctime( &buf.st_mtime));
196 if( fileL.find(".") == -1 ){ 196 if( fileL.find(".") == -1 ){
197 item= new QListViewItem( Local_View, fileL, fileS, fileDate); 197 item= new QListViewItem( Local_View, fileL, fileS, fileDate);
198 pm = Resource::loadPixmap( "UnknownDocument-14" ); 198 pm = Resource::loadPixmap( "UnknownDocument-14" );
199 item->setPixmap( 0,pm); 199 item->setPixmap( 0,pm);
200 } 200 }
201 } 201 }
202 202
203 closedir(dir); 203 closedir(dir);
204 } 204 }
205 205
206 Local_View->setSorting( 3,FALSE); 206 Local_View->setSorting( 3,FALSE);
207 fillCombo( (const QString &) currentDir.canonicalPath()); 207 fillCombo( (const QString &) currentDir.canonicalPath());
208} 208}
209 209
210 210
211void AdvancedFm::populateRemoteView() { 211void AdvancedFm::populateRemoteView() {
212 QPixmap pm; 212 QPixmap pm;
213 Remote_View->clear(); 213 Remote_View->clear();
214 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 214 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
215 currentRemoteDir.setMatchAllDirs(TRUE); 215 currentRemoteDir.setMatchAllDirs(TRUE);
216 currentRemoteDir.setNameFilter(filterStr); 216 currentRemoteDir.setNameFilter(filterStr);
217 QString fileL, fileS, fileDate; 217 QString fileL, fileS, fileDate;
218 218
219 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 219 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
220 setCaption("AdvancedFm :: "+fs+" :: " 220 setCaption("AdvancedFm :: "+fs+" :: "
221 +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); 221 +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" );
222 bool isDir=FALSE; 222 bool isDir=FALSE;
223 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 223 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
224 QFileInfoListIterator it(*list); 224 QFileInfoListIterator it(*list);
225 QFileInfo *fi; 225 QFileInfo *fi;
226 while ( (fi=it.current()) ) { 226 while ( (fi=it.current()) ) {
227 if (fi->isSymLink() ){ 227 if (fi->isSymLink() ){
228 QString symLink=fi->readLink(); 228 QString symLink=fi->readLink();
229 // qDebug("Symlink detected "+symLink); 229 // qDebug("Symlink detected "+symLink);
230 QFileInfo sym( symLink); 230 QFileInfo sym( symLink);
231 fileS.sprintf( "%10i", sym.size() ); 231 fileS.sprintf( "%10i", sym.size() );
232 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); 232 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() );
233 fileDate = sym.lastModified().toString(); 233 fileDate = sym.lastModified().toString();
234 } else { 234 } else {
235 // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 235 // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
236 fileS.sprintf( "%10i", fi->size() ); 236 fileS.sprintf( "%10i", fi->size() );
237 fileL.sprintf( "%s",fi->fileName().data() ); 237 fileL.sprintf( "%s",fi->fileName().data() );
238 fileDate= fi->lastModified().toString(); 238 fileDate= fi->lastModified().toString();
239 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { 239 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) {
240 fileL+="/"; 240 fileL+="/";
241 isDir=TRUE; 241 isDir=TRUE;
242 // qDebug( fileL); 242 // qDebug( fileL);
243 } 243 }
244 } 244 }
245 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); 245 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL);
246 if(fileL !="./" && fi->exists()) { 246 if(fileL !="./" && fi->exists()) {
247 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 247 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
248 QPixmap pm; 248 QPixmap pm;
249 249
250 if(isDir || fileL.find("/",0,TRUE) != -1) { 250 if(isDir || fileL.find("/",0,TRUE) != -1) {
251 if( !QDir( fi->filePath() ).isReadable()) 251 if( !QDir( fi->filePath() ).isReadable())
252 pm = Resource::loadPixmap( "lockedfolder" ); 252 pm = Resource::loadPixmap( "lockedfolder" );
253 else 253 else
254 pm= Resource::loadPixmap( "folder" ); 254 pm= Resource::loadPixmap( "folder" );
255 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 255 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
256 pm = Resource::loadPixmap( "exec"); 256 pm = Resource::loadPixmap( "exec");
257 } else if( (fileInfo.permission( QFileInfo::ExeUser) 257 } else if( (fileInfo.permission( QFileInfo::ExeUser)
258 | fileInfo.permission( QFileInfo::ExeGroup) 258 | fileInfo.permission( QFileInfo::ExeGroup)
259 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 259 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
260 pm = Resource::loadPixmap( "exec"); 260 pm = Resource::loadPixmap( "exec");
261 } else if( !fi->isReadable() ) { 261 } else if( !fi->isReadable() ) {
262 pm = Resource::loadPixmap( "locked" ); 262 pm = Resource::loadPixmap( "locked" );
263 } else { 263 } else {
264 MimeType mt(fi->filePath()); 264 MimeType mt(fi->filePath());
265 pm=mt.pixmap(); //sets the correct pixmap for mimetype 265 pm=mt.pixmap(); //sets the correct pixmap for mimetype
266 if(pm.isNull()) 266 if(pm.isNull())
267 pm = Resource::loadPixmap( "UnknownDocument-14" ); 267 pm = Resource::loadPixmap( "UnknownDocument-14" );
268 } 268 }
269 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 269 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
270 // overlay link image 270 // overlay link image
271 pm= Resource::loadPixmap( "folder" ); 271 pm= Resource::loadPixmap( "folder" );
@@ -560,316 +560,316 @@ void AdvancedFm::SDButtonPushed() {
560 } 560 }
561 update(); 561 update();
562 562
563} 563}
564 564
565void AdvancedFm::CFButtonPushed() { 565void AdvancedFm::CFButtonPushed() {
566 QString current; 566 QString current;
567 if(zaurusDevice) 567 if(zaurusDevice)
568 current= "/mnt/cf"; //zaurus 568 current= "/mnt/cf"; //zaurus
569 else 569 else
570 current = "/mnt/hda"; //ipaq 570 current = "/mnt/hda"; //ipaq
571 571
572 chdir( current.latin1() ); 572 chdir( current.latin1() );
573 if (TabWidget->getCurrentTab() == 0) { 573 if (TabWidget->getCurrentTab() == 0) {
574// if (TabWidget->currentPageIndex() == 0) { 574// if (TabWidget->currentPageIndex() == 0) {
575 currentDir.cd( current, TRUE); 575 currentDir.cd( current, TRUE);
576 populateLocalView(); 576 populateLocalView();
577 } else { 577 } else {
578 currentRemoteDir.cd( current, TRUE); 578 currentRemoteDir.cd( current, TRUE);
579 populateRemoteView(); 579 populateRemoteView();
580 } 580 }
581 update(); 581 update();
582} 582}
583 583
584 584
585 585
586void AdvancedFm::doAbout() { 586void AdvancedFm::doAbout() {
587 QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" 587 QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n"
588 "is copyright 2002 by\n" 588 "is copyright 2002 by\n"
589 "L.J.Potter<llornkcor@handhelds.org>\n" 589 "L.J.Potter<llornkcor@handhelds.org>\n"
590 "and is licensed by the GPL")); 590 "and is licensed by the GPL"));
591} 591}
592 592
593void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { 593void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
594 if( TabWidget->hasFocus()) 594 if( TabWidget->hasFocus())
595 switch ( e->key() ) { 595 switch ( e->key() ) {
596 case Key_Delete: 596 case Key_Delete:
597 del(); 597 del();
598 break; 598 break;
599 case Key_H: 599 case Key_H:
600 showHidden(); 600 showHidden();
601 break; 601 break;
602 case Key_E: 602 case Key_E:
603 runThis(); 603 runThis();
604 break; 604 break;
605 case Key_C: 605 case Key_C:
606 copy(); 606 copy();
607 break; 607 break;
608 case Key_A: 608 case Key_A:
609 copyAs(); 609 copyAs();
610 break; 610 break;
611 case Key_M: 611 case Key_M:
612 move(); 612 move();
613 break; 613 break;
614 case Key_R: 614 case Key_R:
615 rn(); 615 rn();
616 break; 616 break;
617 case Key_I: 617 case Key_I:
618 fileStatus(); 618 fileStatus();
619 break; 619 break;
620 case Key_U: 620 case Key_U:
621 upDir(); 621 upDir();
622 break; 622 break;
623 case Key_P: 623 case Key_P:
624 filePerms(); 624 filePerms();
625 break; 625 break;
626 case Key_N: 626 case Key_N:
627 mkDir(); 627 mkDir();
628 break; 628 break;
629 case Key_1: 629 case Key_1:
630 switchToLocalTab(); 630 switchToLocalTab();
631 break; 631 break;
632 case Key_2: 632 case Key_2:
633 switchToRemoteTab(); 633 switchToRemoteTab();
634 break; 634 break;
635 case Key_3: 635 case Key_3:
636 CFButtonPushed(); 636 CFButtonPushed();
637 break; 637 break;
638 case Key_4: 638 case Key_4:
639 SDButtonPushed(); 639 SDButtonPushed();
640 break; 640 break;
641 case Key_5: 641 case Key_5:
642 homeButtonPushed(); 642 homeButtonPushed();
643 break; 643 break;
644 case Key_6: 644 case Key_6:
645 docButtonPushed(); 645 docButtonPushed();
646 break; 646 break;
647 case Key_7: 647 case Key_7:
648 break; 648 break;
649 case Key_8: 649 case Key_8:
650 break; 650 break;
651 case Key_9: 651 case Key_9:
652 break; 652 break;
653 case Key_0: 653 case Key_0:
654 break; 654 break;
655 } 655 }
656} 656}
657 657
658 658
659void AdvancedFm::QPEButtonPushed() { 659void AdvancedFm::QPEButtonPushed() {
660 QString current = QPEApplication::qpeDir(); 660 QString current = QPEApplication::qpeDir();
661 chdir( current.latin1() ); 661 chdir( current.latin1() );
662 if (TabWidget->getCurrentTab() == 0) { 662 if (TabWidget->getCurrentTab() == 0) {
663// if (TabWidget->currentPageIndex() == 0) { 663// if (TabWidget->currentPageIndex() == 0) {
664 currentDir.cd( current, TRUE); 664 currentDir.cd( current, TRUE);
665 populateLocalView(); 665 populateLocalView();
666 } else { 666 } else {
667 currentRemoteDir.cd( current, TRUE); 667 currentRemoteDir.cd( current, TRUE);
668 populateRemoteView(); 668 populateRemoteView();
669 } 669 }
670 update(); 670 update();
671} 671}
672 672
673void AdvancedFm::parsetab(const QString &fileName) { 673void AdvancedFm::parsetab(const QString &fileName) {
674 674
675 fileSystemTypeList.clear(); 675 fileSystemTypeList.clear();
676 fsList.clear(); 676 fsList.clear();
677 struct mntent *me; 677 struct mntent *me;
678 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 678 FILE *mntfp = setmntent( fileName.latin1(), "r" );
679 if ( mntfp ) { 679 if ( mntfp ) {
680 while ( (me = getmntent( mntfp )) != 0 ) { 680 while ( (me = getmntent( mntfp )) != 0 ) {
681 QString deviceName = me->mnt_fsname; 681 QString deviceName = me->mnt_fsname;
682 QString filesystemType = me->mnt_type; 682 QString filesystemType = me->mnt_type;
683 QString mountDir = me->mnt_dir; 683 QString mountDir = me->mnt_dir;
684 if(deviceName != "none") { 684 if(deviceName != "none") {
685 if( fsList.contains(filesystemType) == 0 685 if( fsList.contains(filesystemType) == 0
686 & filesystemType.find("proc",0,TRUE) == -1 686 & filesystemType.find("proc",0,TRUE) == -1
687 & filesystemType.find("cramfs",0,TRUE) == -1 687 & filesystemType.find("cramfs",0,TRUE) == -1
688 & filesystemType.find("auto",0,TRUE) == -1) 688 & filesystemType.find("auto",0,TRUE) == -1)
689 fsList << filesystemType; 689 fsList << filesystemType;
690 fileSystemTypeList << mountDir+"::"+filesystemType; 690 fileSystemTypeList << mountDir+"::"+filesystemType;
691 } 691 }
692 } 692 }
693 } 693 }
694 endmntent( mntfp ); 694 endmntent( mntfp );
695} 695}
696 696
697QString AdvancedFm::getFileSystemType(const QString &currentText) { 697QString AdvancedFm::getFileSystemType(const QString &currentText) {
698 parsetab("/etc/mtab"); //why did TT forget filesystem type? 698 parsetab("/etc/mtab"); //why did TT forget filesystem type?
699 QString current = currentText;//.right( currentText.length()-1); 699 QString current = currentText;//.right( currentText.length()-1);
700 QString baseFs; 700 QString baseFs;
701 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 701 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
702 QString temp = (*it); 702 QString temp = (*it);
703 QString path = temp.left(temp.find("::",0,TRUE) ); 703 QString path = temp.left(temp.find("::",0,TRUE) );
704 path = path.right( path.length()-1); 704 path = path.right( path.length()-1);
705 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 705 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
706 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 706 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
707 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 707 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
708 } 708 }
709 } 709 }
710 return baseFs; 710 return baseFs;
711} 711}
712 712
713QString AdvancedFm::getDiskSpace( const QString &path) { 713QString AdvancedFm::getDiskSpace( const QString &path) {
714 struct statfs fss; 714 struct statfs fss;
715 if ( !statfs( path.latin1(), &fss ) ) { 715 if ( !statfs( path.latin1(), &fss ) ) {
716 int blkSize = fss.f_bsize; 716 int blkSize = fss.f_bsize;
717 // int totalBlks = fs.f_blocks; 717 // int totalBlks = fs.f_blocks;
718 int availBlks = fss.f_bavail; 718 int availBlks = fss.f_bavail;
719 719
720 long mult = blkSize / 1024; 720 long mult = blkSize / 1024;
721 long div = 1024 / blkSize; 721 long div = 1024 / blkSize;
722 if ( !mult ) mult = 1; 722 if ( !mult ) mult = 1;
723 if ( !div ) div = 1; 723 if ( !div ) div = 1;
724 724
725 return QString::number(availBlks * mult / div); 725 return QString::number(availBlks * mult / div);
726 } 726 }
727 return ""; 727 return "";
728} 728}
729 729
730 730
731void AdvancedFm::showFileMenu() { 731void AdvancedFm::showFileMenu() {
732 732
733 QString curApp; 733 QString curApp;
734 bool isLocalView = false; 734 bool isLocalView = false;
735 if (TabWidget->getCurrentTab() == 0) { 735 if (TabWidget->getCurrentTab() == 0) {
736// if (TabWidget->currentPageIndex() == 0) { 736// if (TabWidget->currentPageIndex() == 0) {
737 isLocalView = TRUE; 737 isLocalView = TRUE;
738 curApp = Local_View->currentItem()->text(0); 738 curApp = Local_View->currentItem()->text(0);
739 } else { 739 } else {
740 curApp = Remote_View->currentItem()->text(0); 740 curApp = Remote_View->currentItem()->text(0);
741 } 741 }
742 742
743 MimeType mt( curApp ); 743 MimeType mt( curApp );
744 const AppLnk* app = mt.application(); 744 const AppLnk* app = mt.application();
745 QFile fi(curApp); 745 QFile fi(curApp);
746 QPopupMenu *m = new QPopupMenu(0); 746 QPopupMenu *m = new QPopupMenu(0);
747 QPopupMenu *n = new QPopupMenu(0); 747 QPopupMenu *n = new QPopupMenu(0);
748 // QPopupMenu *o = new QPopupMenu(0); 748 // QPopupMenu *o = new QPopupMenu(0);
749 if (TabWidget->getCurrentTab() == 0) 749 if (TabWidget->getCurrentTab() == 0)
750 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 750 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
751 else 751 else
752 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); 752 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() ));
753 753
754 if ( QFileInfo(fi).isDir() ) { 754 if ( QFileInfo(fi).isDir() ) {
755 m->insertSeparator(); 755 m->insertSeparator();
756 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 756 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
757 } else { 757 } else {
758 758
759 if ( app ) 759 if ( app )
760 m->insertItem( app->pixmap(), tr( "Open in " 760 m->insertItem( app->pixmap(), tr( "Open in "
761 + app->name() ), this, SLOT( runThis() ) ); 761 + app->name() ), this, SLOT( runThis() ) );
762 else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this 762 else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this
763 m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); 763 m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) );
764 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); 764 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) );
765 } 765 }
766 766
767 m->insertItem(tr("Actions"),n); 767 m->insertItem(tr("Actions"),n);
768 if(isLocalView) 768 if(isLocalView)
769 n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 769 n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
770 else 770 else
771 n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 771 n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
772 772
773 n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 773 n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
774 774
775 n->insertSeparator(); 775 n->insertSeparator();
776 776
777 777
778 if(isLocalView) 778 if(isLocalView)
779 n->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 779 n->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
780 else 780 else
781 n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 781 n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
782 782
783 n->insertItem( tr( "Copy" ), this, SLOT( copy() )); 783 n->insertItem( tr( "Copy" ), this, SLOT( copy() ));
784 n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 784 n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
785 n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); 785 n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() ));
786 n->insertItem( tr( "Move" ), this, SLOT( move() )); 786 n->insertItem( tr( "Move" ), this, SLOT( move() ));
787 787
788 n->insertSeparator(); 788 n->insertSeparator();
789 789
790 if(isLocalView) 790 if(isLocalView)
791 n->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 791 n->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
792 else 792 else
793 n->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 793 n->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
794 794
795 795
796 m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); 796 m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
797 797
798 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 798 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
799 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 799 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
800 800
801 m->insertSeparator(); 801 m->insertSeparator();
802 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 802 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
803 803
804#if defined(QT_QWS_OPIE) 804#if defined(QT_QWS_OPIE)
805 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 805 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
806#endif 806#endif
807 m->setCheckable(TRUE); 807 m->setCheckable(TRUE);
808 if (!b) 808 if (!b)
809 m->setItemChecked(m->idAt(0),TRUE); 809 m->setItemChecked(m->idAt(0),TRUE);
810 else 810 else
811 m->setItemChecked(m->idAt(0),FALSE); 811 m->setItemChecked(m->idAt(0),FALSE);
812 812
813 if(Ir::supported()) 813 if(Ir::supported())
814 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); 814 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
815 m->setFocus(); 815 m->setFocus();
816 m->exec( QCursor::pos() ); 816 m->exec( QPoint( 4,QCursor::pos().y()) );
817 sleep(1); 817
818 if(m) delete m; 818 if(m) delete m;
819} 819}
820 820
821 821
822void AdvancedFm::cancelMenuTimer() { 822void AdvancedFm::cancelMenuTimer() {
823 823
824// qDebug("selectionChanged: cancel menu timer"); 824// qDebug("selectionChanged: cancel menu timer");
825 if( menuTimer.isActive() ) 825 if( menuTimer.isActive() )
826 menuTimer.stop(); 826 menuTimer.stop();
827} 827}
828 828
829QString AdvancedFm::checkDiskSpace(const QString &path) { 829QString AdvancedFm::checkDiskSpace(const QString &path) {
830 struct statfs fss; 830 struct statfs fss;
831 if ( !statfs( path.latin1(), &fss ) ) { 831 if ( !statfs( path.latin1(), &fss ) ) {
832 int blkSize = fss.f_bsize; 832 int blkSize = fss.f_bsize;
833// int totalBlks = fs.f_blocks; 833// int totalBlks = fs.f_blocks;
834 int availBlks = fss.f_bavail; 834 int availBlks = fss.f_bavail;
835 835
836 long mult = blkSize / 1024; 836 long mult = blkSize / 1024;
837 long div = 1024 / blkSize; 837 long div = 1024 / blkSize;
838 if ( !mult ) mult = 1; 838 if ( !mult ) mult = 1;
839 if ( !div ) div = 1; 839 if ( !div ) div = 1;
840 840
841 841
842 return QString::number(availBlks * mult / div); 842 return QString::number(availBlks * mult / div);
843 } 843 }
844 return ""; 844 return "";
845} 845}
846 846
847void AdvancedFm::addToDocs() { 847void AdvancedFm::addToDocs() {
848 QStringList strListPaths = getPath(); 848 QStringList strListPaths = getPath();
849 if( strListPaths.count() > 0) { 849 if( strListPaths.count() > 0) {
850 QString curFile; 850 QString curFile;
851 if (TabWidget->getCurrentTab() == 0) { 851 if (TabWidget->getCurrentTab() == 0) {
852// if (TabWidget->currentPageIndex() == 0) { 852// if (TabWidget->currentPageIndex() == 0) {
853 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 853 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
854 curFile = currentDir.canonicalPath()+"/"+(*it); 854 curFile = currentDir.canonicalPath()+"/"+(*it);
855 qDebug(curFile); 855 qDebug(curFile);
856 DocLnk f; 856 DocLnk f;
857// curFile.replace(QRegExp("\\..*"),""); 857// curFile.replace(QRegExp("\\..*"),"");
858 f.setName((*it)); 858 f.setName((*it));
859 f.setFile( curFile); 859 f.setFile( curFile);
860 f.writeLink(); 860 f.writeLink();
861 } 861 }
862 } else { 862 } else {
863 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 863 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
864 curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 864 curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
865 qDebug(curFile); 865 qDebug(curFile);
866 866
867 DocLnk f; 867 DocLnk f;
868// curFile.replace(QRegExp("\\..*"),""); 868// curFile.replace(QRegExp("\\..*"),"");
869 f.setName((*it)); 869 f.setName((*it));
870 f.setFile( curFile); 870 f.setFile( curFile);
871 f.writeLink(); 871 f.writeLink();
872 } 872 }
873 } 873 }
874 } 874 }
875} 875}
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index f0a0a35..0966f02 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -1,240 +1,241 @@
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 19
20#include <qlayout.h> 20#include <qlayout.h>
21#include <qpixmap.h> 21#include <qpixmap.h>
22#include <qcombobox.h> 22#include <qcombobox.h>
23#include <qpopupmenu.h> 23#include <qpopupmenu.h>
24#include <qtabwidget.h> 24#include <qtabwidget.h>
25#include <qtoolbutton.h> 25#include <qtoolbutton.h>
26#include <qlineedit.h> 26#include <qlineedit.h>
27#include <qlistview.h> 27#include <qlistview.h>
28 28
29#include <sys/utsname.h> 29#include <sys/utsname.h>
30 30
31 31
32void AdvancedFm::init() { 32void AdvancedFm::init() {
33#if defined(QT_QWS_OPIE) 33#if defined(QT_QWS_OPIE)
34 qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); 34 qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!");
35#endif 35#endif
36 setCaption( tr( "AdvancedFm" ) ); 36 setCaption( tr( "AdvancedFm" ) );
37 37
38 QGridLayout *layout = new QGridLayout( this ); 38 QGridLayout *layout = new QGridLayout( this );
39 layout->setSpacing( 2); 39 layout->setSpacing( 2);
40 layout->setMargin( 2); 40 layout->setMargin( 2);
41 41
42 42
43 QPEMenuBar *menuBar = new QPEMenuBar(this); 43 QPEMenuBar *menuBar = new QPEMenuBar(this);
44 fileMenu = new QPopupMenu( this ); 44 fileMenu = new QPopupMenu( this );
45 viewMenu = new QPopupMenu( this ); 45 viewMenu = new QPopupMenu( this );
46 46
47 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); 47 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 );
48 48
49 menuBar->insertItem( tr( "File" ), fileMenu); 49 menuBar->insertItem( tr( "File" ), fileMenu);
50 menuBar->insertItem( tr( "View" ), viewMenu); 50 menuBar->insertItem( tr( "View" ), viewMenu);
51 51
52 qpeDirButton= new QToolButton(this,"QPEButton"); 52 qpeDirButton= new QToolButton(this,"QPEButton");
53 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); 53 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
54 qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); 54 qpeDirButton ->setFixedSize( QSize( 20, 20 ) );
55 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); 55 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2);
56 56
57 cfButton = new QToolButton( this,"CFButton"); 57 cfButton = new QToolButton( this,"CFButton");
58 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); 58 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
59 cfButton ->setFixedSize( QSize( 20, 20 ) ); 59 cfButton ->setFixedSize( QSize( 20, 20 ) );
60 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); 60 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3);
61 61
62 sdButton = new QToolButton( this,"SDButton"); 62 sdButton = new QToolButton( this,"SDButton");
63 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); 63 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard"));
64 sdButton->setFixedSize( QSize( 20, 20 ) ); 64 sdButton->setFixedSize( QSize( 20, 20 ) );
65 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); 65 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4);
66 66
67 cdUpButton = new QToolButton( this,"cdUpButton"); 67 cdUpButton = new QToolButton( this,"cdUpButton");
68 cdUpButton->setPixmap(Resource::loadPixmap("up")); 68 cdUpButton->setPixmap(Resource::loadPixmap("up"));
69 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 69 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
70 layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); 70 layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5);
71 71
72 docButton = new QToolButton( this,"docsButton"); 72 docButton = new QToolButton( this,"docsButton");
73 docButton->setPixmap(Resource::loadPixmap("DocsIcon")); 73 docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
74 docButton->setFixedSize( QSize( 20, 20 ) ); 74 docButton->setFixedSize( QSize( 20, 20 ) );
75 layout->addMultiCellWidget( docButton, 0, 0, 6, 6); 75 layout->addMultiCellWidget( docButton, 0, 0, 6, 6);
76 76
77 homeButton = new QToolButton( this,"homeButton"); 77 homeButton = new QToolButton( this,"homeButton");
78 homeButton->setPixmap(Resource::loadPixmap("home")); 78 homeButton->setPixmap(Resource::loadPixmap("home"));
79 homeButton->setFixedSize( QSize( 20, 20 ) ); 79 homeButton->setFixedSize( QSize( 20, 20 ) );
80 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); 80 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7);
81 81
82 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); 82 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
83 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 83 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
84 fileMenu->insertSeparator(); 84 fileMenu->insertSeparator();
85 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 85 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
86 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); 86 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
87 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 87 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
88 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 88 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
89 fileMenu->insertSeparator(); 89 fileMenu->insertSeparator();
90 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
90 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); 91 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() ));
91 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); 92 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
92 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); 93 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
93 fileMenu->setCheckable(TRUE); 94 fileMenu->setCheckable(TRUE);
94 95
95 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 96 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
96 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 97 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
97 viewMenu->insertSeparator(); 98 viewMenu->insertSeparator();
98 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 99 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
99 viewMenu->setCheckable(TRUE); 100 viewMenu->setCheckable(TRUE);
100 101
101 102
102 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 103 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
103 currentPathCombo->setEditable(TRUE); 104 currentPathCombo->setEditable(TRUE);
104 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); 105 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
105 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 106 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
106 107
107 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 108 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
108 109
109 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); 110 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
110 111
111 112
112 TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); 113 TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab);
113// TabWidget = new QTabWidget( this, "TabWidget" ); 114// TabWidget = new QTabWidget( this, "TabWidget" );
114 layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); 115 layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7);
115 116
116 tab = new QWidget( TabWidget, "tab" ); 117 tab = new QWidget( TabWidget, "tab" );
117 tabLayout = new QGridLayout( tab ); 118 tabLayout = new QGridLayout( tab );
118 tabLayout->setSpacing( 2); 119 tabLayout->setSpacing( 2);
119 tabLayout->setMargin( 2); 120 tabLayout->setMargin( 2);
120 121
121 Local_View = new QListView( tab, "Local_View" ); 122 Local_View = new QListView( tab, "Local_View" );
122 Local_View->addColumn( tr("File"),130); 123 Local_View->addColumn( tr("File"),130);
123 Local_View->addColumn( tr("Size"),-1); 124 Local_View->addColumn( tr("Size"),-1);
124 Local_View->setColumnAlignment(1,QListView::AlignRight); 125 Local_View->setColumnAlignment(1,QListView::AlignRight);
125 Local_View->addColumn( tr("Date"),-1); 126 Local_View->addColumn( tr("Date"),-1);
126 Local_View->setColumnAlignment(2,QListView::AlignRight); 127 Local_View->setColumnAlignment(2,QListView::AlignRight);
127 Local_View->setAllColumnsShowFocus(TRUE); 128 Local_View->setAllColumnsShowFocus(TRUE);
128 Local_View->setMultiSelection( TRUE ); 129 Local_View->setMultiSelection( TRUE );
129 Local_View->setSelectionMode(QListView::Extended); 130 Local_View->setSelectionMode(QListView::Extended);
130 131
131 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 132 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
132 133
133 tabLayout->addWidget( Local_View, 0, 0 ); 134 tabLayout->addWidget( Local_View, 0, 0 );
134 135
135 TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1")); 136 TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1"));
136// TabWidget->insertTab( tab, tr("1")); 137// TabWidget->insertTab( tab, tr("1"));
137 138
138 tab_2 = new QWidget( TabWidget, "tab_2" ); 139 tab_2 = new QWidget( TabWidget, "tab_2" );
139 tabLayout_2 = new QGridLayout( tab_2 ); 140 tabLayout_2 = new QGridLayout( tab_2 );
140 tabLayout_2->setSpacing( 2); 141 tabLayout_2->setSpacing( 2);
141 tabLayout_2->setMargin( 2); 142 tabLayout_2->setMargin( 2);
142 143
143 Remote_View = new QListView( tab_2, "Remote_View" ); 144 Remote_View = new QListView( tab_2, "Remote_View" );
144 Remote_View->addColumn( tr("File"),130); 145 Remote_View->addColumn( tr("File"),130);
145 Remote_View->addColumn( tr("Size"),-1); 146 Remote_View->addColumn( tr("Size"),-1);
146 Remote_View->setColumnAlignment(1,QListView::AlignRight); 147 Remote_View->setColumnAlignment(1,QListView::AlignRight);
147 Remote_View->addColumn( tr("Date"),-1); 148 Remote_View->addColumn( tr("Date"),-1);
148 Remote_View->setColumnAlignment(2,QListView::AlignRight); 149 Remote_View->setColumnAlignment(2,QListView::AlignRight);
149 Remote_View->setAllColumnsShowFocus(TRUE); 150 Remote_View->setAllColumnsShowFocus(TRUE);
150 Remote_View->setMultiSelection( TRUE ); 151 Remote_View->setMultiSelection( TRUE );
151 Remote_View->setSelectionMode(QListView::Extended); 152 Remote_View->setSelectionMode(QListView::Extended);
152 153
153 154
154 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 155 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
155 156
156 tabLayout_2->addWidget( Remote_View, 0, 0 ); 157 tabLayout_2->addWidget( Remote_View, 0, 0 );
157 158
158 TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); 159 TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2"));
159// TabWidget->insertTab( tab_2, tr( "2")); 160// TabWidget->insertTab( tab_2, tr( "2"));
160 161
161 /* tab_3 = new QWidget( TabWidget, "tab_3" ); 162 /* tab_3 = new QWidget( TabWidget, "tab_3" );
162 tabLayout_3 = new QGridLayout( tab_3 ); 163 tabLayout_3 = new QGridLayout( tab_3 );
163 tabLayout_3->setSpacing( 2); 164 tabLayout_3->setSpacing( 2);
164 tabLayout_3->setMargin( 2); 165 tabLayout_3->setMargin( 2);
165 166
166 167
167 // OFileDialog fileDialog; 168 // OFileDialog fileDialog;
168 // fileDialog; 169 // fileDialog;
169 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy 170 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy
170 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); 171 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow");
171 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); 172 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/");
172 173
173 QListView *fileTree; 174 QListView *fileTree;
174 fileTree = new QListView( tab_3, "tree" ); 175 fileTree = new QListView( tab_3, "tree" );
175 176
176 177
177 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); 178 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
178 179
179 TabWidget->insertTab( tab_3, tr( "Remote" ) ); 180 TabWidget->insertTab( tab_3, tr( "Remote" ) );
180 */ 181 */
181 182
182 /////////////// 183 ///////////////
183 184
184 struct utsname name; /* check for embedix kernel running on the zaurus*/ 185 struct utsname name; /* check for embedix kernel running on the zaurus*/
185 if (uname(&name) != -1) { 186 if (uname(&name) != -1) {
186 QString release=name.release; 187 QString release=name.release;
187 if(release.find("embedix",0,TRUE) !=-1) { 188 if(release.find("embedix",0,TRUE) !=-1) {
188 zaurusDevice=TRUE; 189 zaurusDevice=TRUE;
189 } else { 190 } else {
190 zaurusDevice=FALSE; 191 zaurusDevice=FALSE;
191 sdButton->hide(); 192 sdButton->hide();
192 } 193 }
193 } 194 }
194 195
195 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 196 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
196 currentDir.setPath( QDir::currentDirPath()); 197 currentDir.setPath( QDir::currentDirPath());
197 198
198 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 199 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
199 currentRemoteDir.setPath( QDir::currentDirPath()); 200 currentRemoteDir.setPath( QDir::currentDirPath());
200 201
201 b = TRUE; 202 b = TRUE;
202 203
203 filterStr="*"; 204 filterStr="*";
204 b=FALSE; 205 b=FALSE;
205 TabWidget->setCurrentTab(0); 206 TabWidget->setCurrentTab(0);
206 207
207} 208}
208 209
209void AdvancedFm::initConnections() { 210void AdvancedFm::initConnections() {
210 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 211 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
211 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); 212 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) );
212 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); 213 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) );
213 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); 214 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) );
214 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 215 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
215 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 216 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
216 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 217 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
217 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 218 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
218 this, SLOT( currentPathComboActivated( const QString & ) ) ); 219 this, SLOT( currentPathComboActivated( const QString & ) ) );
219 220
220 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 221 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
221 this,SLOT(currentPathComboChanged())); 222 this,SLOT(currentPathComboChanged()));
222 223
223 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 224 connect( Local_View, SIGNAL( clicked( QListViewItem*)),
224 this,SLOT( localListClicked(QListViewItem *)) ); 225 this,SLOT( localListClicked(QListViewItem *)) );
225 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 226 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
226 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); 227 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) );
227 228
228 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); 229 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
229 230
230 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 231 connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
231 this,SLOT( remoteListClicked(QListViewItem *)) ); 232 this,SLOT( remoteListClicked(QListViewItem *)) );
232 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 233 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
233 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 234 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) );
234 235
235 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 236 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
236 this,SLOT(tabChanged(QWidget*))); 237 this,SLOT(tabChanged(QWidget*)));
237 238
238 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); 239 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) );
239 240
240} 241}