summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp41
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp2
3 files changed, 7 insertions, 37 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index ec7a08a..f1be471 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,39 +1,42 @@
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
17#include <opie2/ostorageinfo.h>
18
16#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
17#include <qpe/config.h> 20#include <qpe/config.h>
18#include <qpe/mimetype.h> 21#include <qpe/mimetype.h>
19#include <qpe/applnk.h> 22#include <qpe/applnk.h>
20#include <qpe/resource.h> 23#include <qpe/resource.h>
21#include <qpe/menubutton.h> 24#include <qpe/menubutton.h>
22 25
23#include <qcombobox.h> 26#include <qcombobox.h>
24#include <qpopupmenu.h> 27#include <qpopupmenu.h>
25#include <qlistview.h> 28#include <qlistview.h>
26#include <qmessagebox.h> 29#include <qmessagebox.h>
27#include <qlineedit.h> 30#include <qlineedit.h>
28 31
29 32
30#include <sys/stat.h> 33#include <sys/stat.h>
31#include <time.h> 34#include <time.h>
32#include <dirent.h> 35#include <dirent.h>
33#include <fcntl.h> 36#include <fcntl.h>
34#include <sys/vfs.h> 37#include <sys/vfs.h>
35#include <mntent.h> 38#include <mntent.h>
36 39
37using namespace Opie::Ui; 40using namespace Opie::Ui;
38 41
39AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) 42AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
@@ -189,66 +192,51 @@ void AdvancedFm::populateView() {
189// odebug << mydirent->d_name << oendl; 192// odebug << mydirent->d_name << oendl;
190 fileL.sprintf("%s", mydirent->d_name); 193 fileL.sprintf("%s", mydirent->d_name);
191 devT = buf.st_dev; 194 devT = buf.st_dev;
192 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 195 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
193 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 196 fileDate.sprintf("%s", ctime( &buf.st_mtime));
194 if( fileL.find(".") == -1 ) { 197 if( fileL.find(".") == -1 ) {
195 item= new QListViewItem( thisView, fileL, fileS, fileDate); 198 item= new QListViewItem( thisView, fileL, fileS, fileDate);
196 pm = unknownXpm; 199 pm = unknownXpm;
197 item->setPixmap( 0,pm); 200 item->setPixmap( 0,pm);
198 } 201 }
199 } 202 }
200 203
201 closedir(dir); 204 closedir(dir);
202 } 205 }
203 206
204 thisView->setSorting( 3,FALSE); 207 thisView->setSorting( 3,FALSE);
205 fillCombo( (const QString &) path ); 208 fillCombo( (const QString &) path );
206} 209}
207 210
208void AdvancedFm::rePopulate() { 211void AdvancedFm::rePopulate() {
209 // qDebug("repopulate views"); 212 // qDebug("repopulate views");
210 populateView(); 213 populateView();
211 setOtherTabCurrent(); 214 setOtherTabCurrent();
212 populateView(); 215 populateView();
213
214// int tmpTab = whichTab;
215// // odebug << "" << tmpTab << "" << oendl;
216
217// for(int i =1; i < 3; i++) {
218// TabWidget->setCurrentWidget(i - 1);
219// populateView();
220// }
221// TabWidget->setCurrentWidget( tmpTab - 1);
222} 216}
223 217
224void AdvancedFm::ListClicked(QListViewItem *selectedItem) { 218void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
225 // if ( TabWidget->currentWidget() == tab)
226 // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local");
227 // else
228 // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote");
229
230
231 if(selectedItem) { 219 if(selectedItem) {
232 QString strItem=selectedItem->text(0); 220 QString strItem=selectedItem->text(0);
233// owarn << strItem << oendl; 221// owarn << strItem << oendl;
234 QString strSize=selectedItem->text(1); 222 QString strSize=selectedItem->text(1);
235 strSize=strSize.stripWhiteSpace(); 223 strSize=strSize.stripWhiteSpace();
236 bool isDirectory = false; 224 bool isDirectory = false;
237 QString strItem2; 225 QString strItem2;
238 226
239 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink 227 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink
240 strItem2 = dealWithSymName((const QString&)strItem); 228 strItem2 = dealWithSymName((const QString&)strItem);
241 if(QDir(strItem2).exists() ) 229 if(QDir(strItem2).exists() )
242 strItem = strItem2; 230 strItem = strItem2;
243 } 231 }
244 232
245 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 233 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
246 234
247 if(QDir(strItem).exists()) 235 if(QDir(strItem).exists())
248 isDirectory = true; 236 isDirectory = true;
249 } 237 }
250 238
251 if( isDirectory ) { 239 if( isDirectory ) {
252 CurrentDir()->cd( strItem, TRUE); 240 CurrentDir()->cd( strItem, TRUE);
253 populateView(); 241 populateView();
254 CurrentView()->ensureItemVisible( CurrentView()->firstChild()); 242 CurrentView()->ensureItemVisible( CurrentView()->firstChild());
@@ -256,49 +244,48 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
256 chdir( strItem.latin1()); 244 chdir( strItem.latin1());
257 } 245 }
258} 246}
259 247
260void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { 248void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) {
261 Q_UNUSED(item); 249 Q_UNUSED(item);
262 switch (mouse) { 250 switch (mouse) {
263 case 1: 251 case 1:
264 { 252 {
265 if(renameBox != 0 ) { 253 if(renameBox != 0 ) {
266 cancelRename(); 254 cancelRename();
267 } 255 }
268 } 256 }
269 break; 257 break;
270// case 2: 258// case 2:
271// menuTimer.start( 50, TRUE ); 259// menuTimer.start( 50, TRUE );
272// break; 260// break;
273 }; 261 };
274} 262}
275 263
276 264
277void AdvancedFm::refreshCurrentTab() { 265void AdvancedFm::refreshCurrentTab() {
278 populateView(); 266 populateView();
279 // if ( TabWidget->currentWidget() == tab) { 267 // if ( TabWidget->currentWidget() == tab) {
280
281} 268}
282 269
283void AdvancedFm::switchToLocalTab() { 270void AdvancedFm::switchToLocalTab() {
284 TabWidget->setCurrentWidget(0); 271 TabWidget->setCurrentWidget(0);
285 // Local_View->setFocus(); 272 // Local_View->setFocus();
286 whichTab = 1; 273 whichTab = 1;
287} 274}
288 275
289void AdvancedFm::switchToRemoteTab() { 276void AdvancedFm::switchToRemoteTab() {
290 TabWidget->setCurrentWidget(1); 277 TabWidget->setCurrentWidget(1);
291 // Remote_View->setFocus(); 278 // Remote_View->setFocus();
292 whichTab = 2; 279 whichTab = 2;
293} 280}
294 281
295void AdvancedFm::currentPathComboChanged() { 282void AdvancedFm::currentPathComboChanged() {
296 QString pDir = currentPathCombo->lineEdit()->text(); 283 QString pDir = currentPathCombo->lineEdit()->text();
297 if(QDir(pDir).exists()) { 284 if(QDir(pDir).exists()) {
298 CurrentDir()->setPath(pDir ); 285 CurrentDir()->setPath(pDir );
299 populateView(); 286 populateView();
300 } else { 287 } else {
301 QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir)); 288 QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir));
302 } 289 }
303} 290}
304 291
@@ -331,56 +318,55 @@ QStringList AdvancedFm::getPath() {
331 if ( it.current()->isSelected() ) { 318 if ( it.current()->isSelected() ) {
332 strList << it.current()->text(0); 319 strList << it.current()->text(0);
333// odebug << it.current()->text(0) << oendl; 320// odebug << it.current()->text(0) << oendl;
334 } 321 }
335 } 322 }
336 return strList; 323 return strList;
337} 324}
338 325
339void AdvancedFm::changeTo(const QString dir) { 326void AdvancedFm::changeTo(const QString dir) {
340 chdir( dir.latin1()); 327 chdir( dir.latin1());
341 CurrentDir()->cd(dir, TRUE); 328 CurrentDir()->cd(dir, TRUE);
342 populateView(); 329 populateView();
343 update(); 330 update();
344} 331}
345 332
346void AdvancedFm::homeButtonPushed() { 333void AdvancedFm::homeButtonPushed() {
347 changeTo(QDir::homeDirPath()); 334 changeTo(QDir::homeDirPath());
348} 335}
349 336
350void AdvancedFm::docButtonPushed() { 337void AdvancedFm::docButtonPushed() {
351 changeTo(QPEApplication::documentDir()); 338 changeTo(QPEApplication::documentDir());
352} 339}
353 340
354void AdvancedFm::SDButtonPushed() { 341void AdvancedFm::SDButtonPushed() {
355 changeTo("/mnt/card");// this can change so fix 342 Opie::Core::OStorageInfo info;
343 changeTo(info.sdPath());
356} 344}
357 345
358void AdvancedFm::CFButtonPushed() { 346void AdvancedFm::CFButtonPushed() {
359 if(zaurusDevice) 347 Opie::Core::OStorageInfo info;
360 changeTo("/mnt/cf"); //zaurus 348 changeTo(info.cfPath());
361 else
362 changeTo("/mnt/hda"); //ipaq
363} 349}
364 350
365void AdvancedFm::QPEButtonPushed() { 351void AdvancedFm::QPEButtonPushed() {
366 changeTo(QPEApplication::qpeDir()); 352 changeTo(QPEApplication::qpeDir());
367} 353}
368 354
369void AdvancedFm::doAbout() { 355void AdvancedFm::doAbout() {
370 QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); 356 QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>"));
371} 357}
372 358
373void AdvancedFm::keyPressEvent( QKeyEvent *e) { 359void AdvancedFm::keyPressEvent( QKeyEvent *e) {
374 Q_UNUSED(e); 360 Q_UNUSED(e);
375} 361}
376 362
377void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { 363void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
378// if( CurrentView()->hasFocus() ) 364// if( CurrentView()->hasFocus() )
379// e->ignore(); 365// e->ignore();
380 if( currentPathCombo->lineEdit()->hasFocus()) { 366 if( currentPathCombo->lineEdit()->hasFocus()) {
381 // qDebug("shout!"); 367 // qDebug("shout!");
382 } 368 }
383 369
384 else if( e->key() == Key_Left ) 370 else if( e->key() == Key_Left )
385 upDir(); 371 upDir();
386 else if( e->key() == Key_Return || e->key() == Key_Enter) 372 else if( e->key() == Key_Return || e->key() == Key_Enter)
@@ -749,50 +735,37 @@ QListView * AdvancedFm::OtherView() {
749void AdvancedFm::setOtherTabCurrent() { 735void AdvancedFm::setOtherTabCurrent() {
750 // qDebug("setOtherTabCurrent() %d",whichTab); 736 // qDebug("setOtherTabCurrent() %d",whichTab);
751 if ( whichTab == 1) { 737 if ( whichTab == 1) {
752 TabWidget->setCurrentWidget(1); 738 TabWidget->setCurrentWidget(1);
753 } else { 739 } else {
754 TabWidget->setCurrentWidget(0); 740 TabWidget->setCurrentWidget(0);
755 } 741 }
756// OtherView()->setFocus(); 742// OtherView()->setFocus();
757 OtherView()->setSelected( CurrentView()->firstChild(), true); 743 OtherView()->setSelected( CurrentView()->firstChild(), true);
758} 744}
759 745
760void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { 746void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
761// odebug << "qcop message "+msg << oendl; 747// odebug << "qcop message "+msg << oendl;
762 QDataStream stream ( data, IO_ReadOnly ); 748 QDataStream stream ( data, IO_ReadOnly );
763 if ( msg == "openDirectory(QString)" ) { 749 if ( msg == "openDirectory(QString)" ) {
764// odebug << "received" << oendl; 750// odebug << "received" << oendl;
765 QString file; 751 QString file;
766 stream >> file; 752 stream >> file;
767 changeTo( (const QString &) file); 753 changeTo( (const QString &) file);
768 } 754 }
769} 755}
770 756
771void AdvancedFm::setDocument(const QString &file) { 757void AdvancedFm::setDocument(const QString &file) {
772 changeTo( file); 758 changeTo( file);
773
774} 759}
775 760
776 761
777void AdvancedFm::findFile(const QString &fileName) {
778 QFileInfo fi(fileName);
779 QListView *thisView = CurrentView();
780 QListViewItemIterator it( thisView );
781 for ( ; it.current(); ++it ) {
782 if(it.current()->text(0) == fi.fileName()) {
783 it.current()->setSelected(true);
784 thisView->ensureItemVisible(it.current());
785 }
786 }
787}
788
789void AdvancedFm::slotSwitchMenu(int item) { 762void AdvancedFm::slotSwitchMenu(int item) {
790 Q_UNUSED(item); 763 Q_UNUSED(item);
791 // qDebug( "Switch %d",item); 764 // qDebug( "Switch %d",item);
792 // viewMenu->setItemChecked(item, true); 765 // viewMenu->setItemChecked(item, true);
793} 766}
794 767
795void AdvancedFm::navigateToSelected() { 768void AdvancedFm::navigateToSelected() {
796 if( !CurrentView()->currentItem()) return; 769 if( !CurrentView()->currentItem()) return;
797 doDirChange(); 770 doDirChange();
798} 771}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 6f7eb96..42f3bc6 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -156,37 +156,36 @@ protected slots:
156 void fillCombo(const QString &); 156 void fillCombo(const QString &);
157 bool copyFile( const QString & , const QString & ); 157 bool copyFile( const QString & , const QString & );
158 void fileStatus(); 158 void fileStatus();
159 void doAbout(); 159 void doAbout();
160 void doBeam(); 160 void doBeam();
161 void fileBeamFinished( Ir *); 161 void fileBeamFinished( Ir *);
162 bool copyDirectory( const QString & , const QString & ); 162 bool copyDirectory( const QString & , const QString & );
163// void navigateToSelected(); 163// void navigateToSelected();
164 bool moveDirectory( const QString & , const QString & ); 164 bool moveDirectory( const QString & , const QString & );
165 165
166// void slotSwitchtoLocal(int); 166// void slotSwitchtoLocal(int);
167 167
168private: 168private:
169 MenuButton *menuButton; 169 MenuButton *menuButton;
170 QString oldName, localViewDir, remoteViewDir; 170 QString oldName, localViewDir, remoteViewDir;
171 void startProcess(const QString &); 171 void startProcess(const QString &);
172 bool eventFilter( QObject * , QEvent * ); 172 bool eventFilter( QObject * , QEvent * );
173 void cancelRename(); 173 void cancelRename();
174 void doRename(QListView *); 174 void doRename(QListView *);
175 void okRename(); 175 void okRename();
176 void customDirsToMenu(); 176 void customDirsToMenu();
177 void addCustomDir(); 177 void addCustomDir();
178 void removeCustomDir(); 178 void removeCustomDir();
179 void navigateToSelected(); 179 void navigateToSelected();
180 void findFile(const QString &);
181 180
182private slots: 181private slots:
183 void processEnded(Opie::Core::OProcess *); 182 void processEnded(Opie::Core::OProcess *);
184 void oprocessStderr(Opie::Core::OProcess *, char *, int); 183 void oprocessStderr(Opie::Core::OProcess *, char *, int);
185 void gotoCustomDir(const QString &); 184 void gotoCustomDir(const QString &);
186 void qcopReceive(const QCString&, const QByteArray&); 185 void qcopReceive(const QCString&, const QByteArray&);
187 void setDocument(const QString &); 186 void setDocument(const QString &);
188 // void doMenu(int 187 // void doMenu(int
189 188
190}; 189};
191 190
192#endif // ADVANCEDFM_H 191#endif // ADVANCEDFM_H
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index 1047c5a..9be0ceb 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -35,50 +35,48 @@ using namespace Opie::Ui;
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
60
61 qpeDirButton= new QToolButton( 0,"QPEButton"); 59 qpeDirButton= new QToolButton( 0,"QPEButton");
62 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); 60 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
63 qpeDirButton->setAutoRaise( true ); 61 qpeDirButton->setAutoRaise( true );
64 menuBar->insertItem( qpeDirButton ); 62 menuBar->insertItem( qpeDirButton );
65 63
66 cfButton = new QToolButton( 0, "CFButton"); 64 cfButton = new QToolButton( 0, "CFButton");
67 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); 65 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
68 cfButton->setAutoRaise( true ); 66 cfButton->setAutoRaise( true );
69 menuBar->insertItem( cfButton ); 67 menuBar->insertItem( cfButton );
70 68
71 sdButton = new QToolButton( 0, "SDButton"); 69 sdButton = new QToolButton( 0, "SDButton");
72 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); 70 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard"));
73 sdButton->setAutoRaise( true ); 71 sdButton->setAutoRaise( true );
74 menuBar->insertItem( sdButton ); 72 menuBar->insertItem( sdButton );
75 73
76 docButton = new QToolButton( 0,"docsButton"); 74 docButton = new QToolButton( 0,"docsButton");
77 docButton->setPixmap(Resource::loadPixmap("DocsIcon")); 75 docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
78 docButton->setAutoRaise( true ); 76 docButton->setAutoRaise( true );
79 menuBar->insertItem( docButton ); 77 menuBar->insertItem( docButton );
80 78
81 homeButton = new QToolButton( 0, "homeButton"); 79 homeButton = new QToolButton( 0, "homeButton");
82 homeButton->setPixmap(Resource::loadPixmap("home")); 80 homeButton->setPixmap(Resource::loadPixmap("home"));
83 homeButton->setAutoRaise( true ); 81 homeButton->setAutoRaise( true );
84 menuBar->insertItem( homeButton ); 82 menuBar->insertItem( homeButton );