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