author | llornkcor <llornkcor> | 2002-08-06 14:42:54 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-06 14:42:54 (UTC) |
commit | e6a512dc2e0602298f8a745036d25eb171ced977 (patch) (unidiff) | |
tree | 38a1df282028ac69fba494dba2ca41d04e565a54 | |
parent | 64888e9cd2f4c8f40f08a6712e2fd27220ff14ad (diff) | |
download | opie-e6a512dc2e0602298f8a745036d25eb171ced977.zip opie-e6a512dc2e0602298f8a745036d25eb171ced977.tar.gz opie-e6a512dc2e0602298f8a745036d25eb171ced977.tar.bz2 |
fixed proper path for familiar cf, and hide sd for non zaurus
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 39 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 1 |
2 files changed, 29 insertions, 11 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 7ee78c0..0f2555d 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -27,96 +27,97 @@ | |||
27 | #include <qpe/qpemenubar.h> | 27 | #include <qpe/qpemenubar.h> |
28 | #include <qpe/qpetoolbar.h> | 28 | #include <qpe/qpetoolbar.h> |
29 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
31 | #include <qpe/qcopenvelope_qws.h> | 31 | #include <qpe/qcopenvelope_qws.h> |
32 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
33 | #include <qpe/mimetype.h> | 33 | #include <qpe/mimetype.h> |
34 | #include <qpe/applnk.h> | 34 | #include <qpe/applnk.h> |
35 | #include <qpe/ir.h> | 35 | #include <qpe/ir.h> |
36 | 36 | ||
37 | //#include <opie/ofileselector.h> | 37 | //#include <opie/ofileselector.h> |
38 | #include <qmultilineedit.h> | 38 | #include <qmultilineedit.h> |
39 | 39 | ||
40 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qtoolbutton.h> | 42 | #include <qtoolbutton.h> |
43 | #include <qdatetime.h> | 43 | #include <qdatetime.h> |
44 | #include <qdir.h> | 44 | #include <qdir.h> |
45 | #include <qfile.h> | 45 | #include <qfile.h> |
46 | #include <qstring.h> | 46 | #include <qstring.h> |
47 | #include <qcombobox.h> | 47 | #include <qcombobox.h> |
48 | #include <qpopupmenu.h> | 48 | #include <qpopupmenu.h> |
49 | #include <qlistview.h> | 49 | #include <qlistview.h> |
50 | #include <qmainwindow.h> | 50 | #include <qmainwindow.h> |
51 | #include <qlabel.h> | 51 | #include <qlabel.h> |
52 | #include <qprogressbar.h> | 52 | #include <qprogressbar.h> |
53 | #include <qspinbox.h> | 53 | #include <qspinbox.h> |
54 | #include <qtabwidget.h> | 54 | #include <qtabwidget.h> |
55 | #include <qwidget.h> | 55 | #include <qwidget.h> |
56 | #include <qlayout.h> | 56 | #include <qlayout.h> |
57 | #include <qimage.h> | 57 | #include <qimage.h> |
58 | #include <qpixmap.h> | 58 | #include <qpixmap.h> |
59 | #include <qmessagebox.h> | 59 | #include <qmessagebox.h> |
60 | #include <qlineedit.h> | 60 | #include <qlineedit.h> |
61 | #include <qregexp.h> | 61 | #include <qregexp.h> |
62 | 62 | ||
63 | #include <unistd.h> | 63 | #include <unistd.h> |
64 | #include <stdlib.h> | 64 | #include <stdlib.h> |
65 | #include <sys/stat.h> | 65 | #include <sys/stat.h> |
66 | #include <dirent.h> | 66 | #include <dirent.h> |
67 | #include <stdio.h> | 67 | #include <stdio.h> |
68 | #include <time.h> | 68 | #include <time.h> |
69 | #include <fcntl.h> | 69 | #include <fcntl.h> |
70 | #include <mntent.h> | 70 | #include <mntent.h> |
71 | #include <string.h> | 71 | #include <string.h> |
72 | #include <errno.h> | 72 | #include <errno.h> |
73 | #include <sys/vfs.h> | 73 | #include <sys/vfs.h> |
74 | #include <mntent.h> | 74 | #include <mntent.h> |
75 | #include <sys/utsname.h> | ||
75 | 76 | ||
76 | AdvancedFm::AdvancedFm( ) | 77 | AdvancedFm::AdvancedFm( ) |
77 | : QMainWindow( ) | 78 | : QMainWindow( ) |
78 | { | 79 | { |
79 | setCaption( tr( "AdvancedFm" ) ); | 80 | setCaption( tr( "AdvancedFm" ) ); |
80 | 81 | ||
81 | QGridLayout *layout = new QGridLayout( this ); | 82 | QGridLayout *layout = new QGridLayout( this ); |
82 | layout->setSpacing( 2); | 83 | layout->setSpacing( 2); |
83 | layout->setMargin( 2); | 84 | layout->setMargin( 2); |
84 | 85 | ||
85 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 86 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
86 | 87 | ||
87 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 88 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
88 | fileMenu = new QPopupMenu( this ); | 89 | fileMenu = new QPopupMenu( this ); |
89 | viewMenu = new QPopupMenu( this ); | 90 | viewMenu = new QPopupMenu( this ); |
90 | 91 | ||
91 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 92 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
92 | 93 | ||
93 | menuBar->insertItem( tr( "File" ), fileMenu); | 94 | menuBar->insertItem( tr( "File" ), fileMenu); |
94 | menuBar->insertItem( tr( "View" ), viewMenu); | 95 | menuBar->insertItem( tr( "View" ), viewMenu); |
95 | 96 | ||
96 | qpeDirButton= new QToolButton(this,"QPEButton"); | 97 | qpeDirButton= new QToolButton(this,"QPEButton"); |
97 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 98 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
98 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | 99 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); |
99 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); | 100 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); |
100 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | 101 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); |
101 | 102 | ||
102 | cfButton = new QToolButton( this,"CFButton"); | 103 | cfButton = new QToolButton( this,"CFButton"); |
103 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 104 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
104 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 105 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
105 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | 106 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); |
106 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); | 107 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); |
107 | 108 | ||
108 | sdButton = new QToolButton( this,"SDButton"); | 109 | sdButton = new QToolButton( this,"SDButton"); |
109 | sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard")); | 110 | sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard")); |
110 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 111 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
111 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | 112 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); |
112 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); | 113 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); |
113 | 114 | ||
114 | cdUpButton = new QToolButton( this,"cdUpButton"); | 115 | cdUpButton = new QToolButton( this,"cdUpButton"); |
115 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 116 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
116 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 117 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
117 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 118 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
118 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); | 119 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); |
119 | 120 | ||
120 | docButton = new QToolButton( this,"docsButton"); | 121 | docButton = new QToolButton( this,"docsButton"); |
121 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 122 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
122 | docButton->setFixedSize( QSize( 20, 20 ) ); | 123 | docButton->setFixedSize( QSize( 20, 20 ) ); |
@@ -202,97 +203,108 @@ AdvancedFm::AdvancedFm( ) | |||
202 | Remote_View = new QListView( tab_2, "Remote_View" ); | 203 | Remote_View = new QListView( tab_2, "Remote_View" ); |
203 | Remote_View->addColumn( tr("File"),130); | 204 | Remote_View->addColumn( tr("File"),130); |
204 | Remote_View->addColumn( tr("Size"),-1); | 205 | Remote_View->addColumn( tr("Size"),-1); |
205 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 206 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
206 | Remote_View->addColumn( tr("Date"),-1); | 207 | Remote_View->addColumn( tr("Date"),-1); |
207 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 208 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
208 | Remote_View->setAllColumnsShowFocus(TRUE); | 209 | Remote_View->setAllColumnsShowFocus(TRUE); |
209 | Remote_View->setMultiSelection( TRUE ); | 210 | Remote_View->setMultiSelection( TRUE ); |
210 | Remote_View->setSelectionMode(QListView::Extended); | 211 | Remote_View->setSelectionMode(QListView::Extended); |
211 | 212 | ||
212 | 213 | ||
213 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 214 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
214 | 215 | ||
215 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 216 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
216 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 217 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
217 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 218 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
218 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 219 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
219 | 220 | ||
220 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 221 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
221 | 222 | ||
222 | 223 | ||
223 | TabWidget->insertTab( tab_2, tr( "2")); | 224 | TabWidget->insertTab( tab_2, tr( "2")); |
224 | 225 | ||
225 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 226 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
226 | this,SLOT(tabChanged(QWidget*))); | 227 | this,SLOT(tabChanged(QWidget*))); |
227 | 228 | ||
228 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 229 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
229 | tabLayout_3 = new QGridLayout( tab_3 ); | 230 | tabLayout_3 = new QGridLayout( tab_3 ); |
230 | tabLayout_3->setSpacing( 2); | 231 | tabLayout_3->setSpacing( 2); |
231 | tabLayout_3->setMargin( 2); | 232 | tabLayout_3->setMargin( 2); |
232 | 233 | ||
233 | 234 | ||
234 | // OFileDialog fileDialog; | 235 | // OFileDialog fileDialog; |
235 | // fileDialog; | 236 | // fileDialog; |
236 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 237 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
237 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 238 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
238 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 239 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
239 | 240 | ||
240 | QListView *fileTree; | 241 | QListView *fileTree; |
241 | fileTree = new QListView( tab_3, "tree" ); | 242 | fileTree = new QListView( tab_3, "tree" ); |
242 | 243 | ||
243 | 244 | ||
244 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 245 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
245 | 246 | ||
246 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 247 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
247 | */ | 248 | */ |
248 | 249 | ||
249 | /////////////// | 250 | /////////////// |
250 | 251 | ||
252 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | ||
253 | if (uname(&name) != -1) { | ||
254 | QString release=name.release; | ||
255 | if(release.find("embedix",0,TRUE) !=-1) { | ||
256 | zaurusDevice=TRUE; | ||
257 | } else { | ||
258 | zaurusDevice=FALSE; | ||
259 | sdButton->hide(); | ||
260 | } | ||
261 | } | ||
262 | |||
251 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 263 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
252 | currentDir.setPath( QDir::currentDirPath()); | 264 | currentDir.setPath( QDir::currentDirPath()); |
253 | 265 | ||
254 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 266 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
255 | currentRemoteDir.setPath( QDir::currentDirPath()); | 267 | currentRemoteDir.setPath( QDir::currentDirPath()); |
256 | 268 | ||
257 | b = TRUE; | 269 | b = TRUE; |
258 | 270 | ||
259 | filterStr="*"; | 271 | filterStr="*"; |
260 | b=FALSE; | 272 | b=FALSE; |
261 | 273 | ||
262 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); | 274 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); |
263 | 275 | ||
264 | populateLocalView(); | 276 | populateLocalView(); |
265 | populateRemoteView(); | 277 | populateRemoteView(); |
266 | currentPathCombo->setFocus(); | 278 | currentPathCombo->setFocus(); |
267 | } | 279 | } |
268 | 280 | ||
269 | AdvancedFm::~AdvancedFm() | 281 | AdvancedFm::~AdvancedFm() |
270 | { | 282 | { |
271 | } | 283 | } |
272 | 284 | ||
273 | void AdvancedFm::cleanUp() | 285 | void AdvancedFm::cleanUp() |
274 | { | 286 | { |
275 | QString sfile=QDir::homeDirPath(); | 287 | QString sfile=QDir::homeDirPath(); |
276 | if(sfile.right(1) != "/") | 288 | if(sfile.right(1) != "/") |
277 | sfile+="/._temp"; | 289 | sfile+="/._temp"; |
278 | else | 290 | else |
279 | sfile+="._temp"; | 291 | sfile+="._temp"; |
280 | QFile file( sfile); | 292 | QFile file( sfile); |
281 | if(file.exists()) | 293 | if(file.exists()) |
282 | file.remove(); | 294 | file.remove(); |
283 | } | 295 | } |
284 | 296 | ||
285 | void AdvancedFm::tabChanged(QWidget *w) | 297 | void AdvancedFm::tabChanged(QWidget *w) |
286 | { | 298 | { |
287 | if (TabWidget->currentPageIndex() == 0) { | 299 | if (TabWidget->currentPageIndex() == 0) { |
288 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 300 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
289 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 301 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
290 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 302 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
291 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 303 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
292 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); | 304 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
293 | 305 | ||
294 | } | 306 | } |
295 | if (TabWidget->currentPageIndex() == 1) { | 307 | if (TabWidget->currentPageIndex() == 1) { |
296 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 308 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
297 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 309 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
298 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 310 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
@@ -1017,106 +1029,111 @@ QStringList AdvancedFm::getPath() { | |||
1017 | } | 1029 | } |
1018 | } | 1030 | } |
1019 | return strList; | 1031 | return strList; |
1020 | } | 1032 | } |
1021 | return ""; | 1033 | return ""; |
1022 | } | 1034 | } |
1023 | 1035 | ||
1024 | void AdvancedFm::homeButtonPushed() { | 1036 | void AdvancedFm::homeButtonPushed() { |
1025 | QString current = QDir::homeDirPath(); | 1037 | QString current = QDir::homeDirPath(); |
1026 | chdir( current.latin1() ); | 1038 | chdir( current.latin1() ); |
1027 | if (TabWidget->currentPageIndex() == 0) { | 1039 | if (TabWidget->currentPageIndex() == 0) { |
1028 | currentDir.cd( current, TRUE); | 1040 | currentDir.cd( current, TRUE); |
1029 | populateLocalView(); | 1041 | populateLocalView(); |
1030 | } else { | 1042 | } else { |
1031 | currentRemoteDir.cd( current, TRUE); | 1043 | currentRemoteDir.cd( current, TRUE); |
1032 | populateRemoteView(); | 1044 | populateRemoteView(); |
1033 | } | 1045 | } |
1034 | update(); | 1046 | update(); |
1035 | } | 1047 | } |
1036 | 1048 | ||
1037 | void AdvancedFm::docButtonPushed() { | 1049 | void AdvancedFm::docButtonPushed() { |
1038 | QString current = QPEApplication::documentDir(); | 1050 | QString current = QPEApplication::documentDir(); |
1039 | chdir( current.latin1() ); | 1051 | chdir( current.latin1() ); |
1040 | if (TabWidget->currentPageIndex() == 0) { | 1052 | if (TabWidget->currentPageIndex() == 0) { |
1041 | currentDir.cd( current, TRUE); | 1053 | currentDir.cd( current, TRUE); |
1042 | populateLocalView(); | 1054 | populateLocalView(); |
1043 | } else { | 1055 | } else { |
1044 | currentRemoteDir.cd( current, TRUE); | 1056 | currentRemoteDir.cd( current, TRUE); |
1045 | populateRemoteView(); | 1057 | populateRemoteView(); |
1046 | } | 1058 | } |
1047 | update(); | 1059 | update(); |
1048 | } | 1060 | } |
1049 | 1061 | ||
1050 | void AdvancedFm::SDButtonPushed() { | 1062 | void AdvancedFm::SDButtonPushed() { |
1051 | QString current = "/mnt/card"; | 1063 | QString current = "/mnt/card"; |
1052 | chdir( current.latin1() ); | 1064 | chdir( current.latin1() ); |
1053 | if (TabWidget->currentPageIndex() == 0) { | 1065 | if (TabWidget->currentPageIndex() == 0) { |
1054 | currentDir.cd( current, TRUE); | 1066 | currentDir.cd( current, TRUE); |
1055 | populateLocalView(); | 1067 | populateLocalView(); |
1056 | } else { | 1068 | } else { |
1057 | currentRemoteDir.cd( current, TRUE); | 1069 | currentRemoteDir.cd( current, TRUE); |
1058 | populateRemoteView(); | 1070 | populateRemoteView(); |
1059 | } | 1071 | } |
1060 | update(); | 1072 | update(); |
1061 | 1073 | ||
1062 | } | 1074 | } |
1063 | 1075 | ||
1064 | void AdvancedFm::CFButtonPushed() { | 1076 | void AdvancedFm::CFButtonPushed() { |
1065 | QString current = "/mnt/cf"; | 1077 | QString current; |
1066 | chdir( current.latin1() ); | 1078 | if(zaurusDevice) |
1067 | if (TabWidget->currentPageIndex() == 0) { | 1079 | current= "/mnt/cf"; |
1068 | currentDir.cd( current, TRUE); | 1080 | else |
1069 | populateLocalView(); | 1081 | current = "/mnt/hda"; |
1070 | } else { | 1082 | |
1071 | currentRemoteDir.cd( current, TRUE); | 1083 | chdir( current.latin1() ); |
1072 | populateRemoteView(); | 1084 | if (TabWidget->currentPageIndex() == 0) { |
1073 | } | 1085 | currentDir.cd( current, TRUE); |
1074 | update(); | 1086 | populateLocalView(); |
1087 | } else { | ||
1088 | currentRemoteDir.cd( current, TRUE); | ||
1089 | populateRemoteView(); | ||
1090 | } | ||
1091 | update(); | ||
1075 | 1092 | ||
1076 | } | 1093 | } |
1077 | 1094 | ||
1078 | 1095 | ||
1079 | void AdvancedFm::upDir() | 1096 | void AdvancedFm::upDir() |
1080 | { | 1097 | { |
1081 | if (TabWidget->currentPageIndex() == 0) { | 1098 | if (TabWidget->currentPageIndex() == 0) { |
1082 | QString current = currentDir.canonicalPath(); | 1099 | QString current = currentDir.canonicalPath(); |
1083 | QDir dir(current); | 1100 | QDir dir(current); |
1084 | dir.cdUp(); | 1101 | dir.cdUp(); |
1085 | current = dir.canonicalPath(); | 1102 | current = dir.canonicalPath(); |
1086 | chdir( current.latin1() ); | 1103 | chdir( current.latin1() ); |
1087 | currentDir.cd( current, TRUE); | 1104 | currentDir.cd( current, TRUE); |
1088 | populateLocalView(); | 1105 | populateLocalView(); |
1089 | update(); | 1106 | update(); |
1090 | } else { | 1107 | } else { |
1091 | QString current = currentRemoteDir.canonicalPath(); | 1108 | QString current = currentRemoteDir.canonicalPath(); |
1092 | QDir dir(current); | 1109 | QDir dir(current); |
1093 | dir.cdUp(); | 1110 | dir.cdUp(); |
1094 | current = dir.canonicalPath(); | 1111 | current = dir.canonicalPath(); |
1095 | chdir( current.latin1() ); | 1112 | chdir( current.latin1() ); |
1096 | currentRemoteDir.cd( current, TRUE); | 1113 | currentRemoteDir.cd( current, TRUE); |
1097 | populateRemoteView(); | 1114 | populateRemoteView(); |
1098 | update(); | 1115 | update(); |
1099 | } | 1116 | } |
1100 | } | 1117 | } |
1101 | 1118 | ||
1102 | void AdvancedFm::copy() | 1119 | void AdvancedFm::copy() |
1103 | { | 1120 | { |
1104 | qApp->processEvents(); | 1121 | qApp->processEvents(); |
1105 | QStringList curFileList = getPath(); | 1122 | QStringList curFileList = getPath(); |
1106 | if( curFileList.count() > 0) { | 1123 | if( curFileList.count() > 0) { |
1107 | QString curFile; | 1124 | QString curFile; |
1108 | if (TabWidget->currentPageIndex() == 0) { | 1125 | if (TabWidget->currentPageIndex() == 0) { |
1109 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1126 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1110 | 1127 | ||
1111 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1128 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1112 | qDebug("Destination file is "+destFile); | 1129 | qDebug("Destination file is "+destFile); |
1113 | 1130 | ||
1114 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1131 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1115 | qDebug("CurrentFile file is " + curFile); | 1132 | qDebug("CurrentFile file is " + curFile); |
1116 | 1133 | ||
1117 | QFile f(destFile); | 1134 | QFile f(destFile); |
1118 | if( f.exists()) { | 1135 | if( f.exists()) { |
1119 | switch ( QMessageBox::warning(this,tr("Delete"), | 1136 | switch ( QMessageBox::warning(this,tr("Delete"), |
1120 | destFile+tr(" already exists\nDo you really want to delete it?"), | 1137 | destFile+tr(" already exists\nDo you really want to delete it?"), |
1121 | tr("Yes"),tr("No"),0,0,1) ) { | 1138 | tr("Yes"),tr("No"),0,0,1) ) { |
1122 | case 0: | 1139 | case 0: |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 78f0bad..5b714ae 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -60,84 +60,85 @@ public: | |||
60 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 60 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
61 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 61 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
62 | QDir currentDir, currentRemoteDir; | 62 | QDir currentDir, currentRemoteDir; |
63 | QComboBox *currentPathCombo; | 63 | QComboBox *currentPathCombo; |
64 | QString filterStr; | 64 | QString filterStr; |
65 | QListViewItem * item; | 65 | QListViewItem * item; |
66 | bool b; | 66 | bool b; |
67 | QStringList fileSystemTypeList, fsList; | 67 | QStringList fileSystemTypeList, fsList; |
68 | int currentServerConfig; | 68 | int currentServerConfig; |
69 | protected slots: | 69 | protected slots: |
70 | void doLocalCd(); | 70 | void doLocalCd(); |
71 | void doRemoteCd(); | 71 | void doRemoteCd(); |
72 | // void copy(); | 72 | // void copy(); |
73 | void mkDir(); | 73 | void mkDir(); |
74 | void del(); | 74 | void del(); |
75 | void rn(); | 75 | void rn(); |
76 | void populateLocalView(); | 76 | void populateLocalView(); |
77 | void populateRemoteView(); | 77 | void populateRemoteView(); |
78 | void showHidden(); | 78 | void showHidden(); |
79 | void showRemoteHidden(); | 79 | void showRemoteHidden(); |
80 | void writeConfig(); | 80 | void writeConfig(); |
81 | void readConfig(); | 81 | void readConfig(); |
82 | void localListClicked(QListViewItem *); | 82 | void localListClicked(QListViewItem *); |
83 | void remoteListClicked(QListViewItem *); | 83 | void remoteListClicked(QListViewItem *); |
84 | void localListPressed( int, QListViewItem *, const QPoint&, int); | 84 | void localListPressed( int, QListViewItem *, const QPoint&, int); |
85 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); | 85 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); |
86 | void localMakDir(); | 86 | void localMakDir(); |
87 | void localDelete(); | 87 | void localDelete(); |
88 | void remoteMakDir(); | 88 | void remoteMakDir(); |
89 | void remoteDelete(); | 89 | void remoteDelete(); |
90 | /* bool remoteDirList(const QString &); */ | 90 | /* bool remoteDirList(const QString &); */ |
91 | /* bool remoteChDir(const QString &); */ | 91 | /* bool remoteChDir(const QString &); */ |
92 | void tabChanged(QWidget*); | 92 | void tabChanged(QWidget*); |
93 | void cleanUp(); | 93 | void cleanUp(); |
94 | void remoteRename(); | 94 | void remoteRename(); |
95 | void localRename(); | 95 | void localRename(); |
96 | void runThis(); | 96 | void runThis(); |
97 | void runText(); | 97 | void runText(); |
98 | void filePerms(); | 98 | void filePerms(); |
99 | void doProperties(); | 99 | void doProperties(); |
100 | void runCommand(); | 100 | void runCommand(); |
101 | void runCommandStd(); | 101 | void runCommandStd(); |
102 | QStringList getPath(); | 102 | QStringList getPath(); |
103 | void mkSym(); | 103 | void mkSym(); |
104 | void switchToLocalTab(); | 104 | void switchToLocalTab(); |
105 | void switchToRemoteTab(); | 105 | void switchToRemoteTab(); |
106 | 106 | ||
107 | protected: | 107 | protected: |
108 | bool zaurusDevice; | ||
108 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 109 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
109 | QStringList remoteDirPathStringList, localDirPathStringList; | 110 | QStringList remoteDirPathStringList, localDirPathStringList; |
110 | 111 | ||
111 | void keyReleaseEvent( QKeyEvent *); | 112 | void keyReleaseEvent( QKeyEvent *); |
112 | QString getFileSystemType(const QString &); | 113 | QString getFileSystemType(const QString &); |
113 | QString getDiskSpace(const QString &); | 114 | QString getDiskSpace(const QString &); |
114 | 115 | ||
115 | void parsetab(const QString &fileName); | 116 | void parsetab(const QString &fileName); |
116 | QString checkDiskSpace(const QString &); | 117 | QString checkDiskSpace(const QString &); |
117 | protected slots: | 118 | protected slots: |
118 | void showFileMenu(); | 119 | void showFileMenu(); |
119 | void cancelMenuTimer(); | 120 | void cancelMenuTimer(); |
120 | void homeButtonPushed(); | 121 | void homeButtonPushed(); |
121 | void docButtonPushed(); | 122 | void docButtonPushed(); |
122 | void SDButtonPushed(); | 123 | void SDButtonPushed(); |
123 | void CFButtonPushed(); | 124 | void CFButtonPushed(); |
124 | void QPEButtonPushed(); | 125 | void QPEButtonPushed(); |
125 | void upDir(); | 126 | void upDir(); |
126 | void currentPathComboChanged(); | 127 | void currentPathComboChanged(); |
127 | void copy(); | 128 | void copy(); |
128 | void copyAs(); | 129 | void copyAs(); |
129 | void copySameDir(); | 130 | void copySameDir(); |
130 | void currentPathComboActivated(const QString &); | 131 | void currentPathComboActivated(const QString &); |
131 | void fillCombo(const QString &); | 132 | void fillCombo(const QString &); |
132 | bool copyFile( const QString & , const QString & ); | 133 | bool copyFile( const QString & , const QString & ); |
133 | void move(); | 134 | void move(); |
134 | void fileStatus(); | 135 | void fileStatus(); |
135 | void doAbout(); | 136 | void doAbout(); |
136 | void doBeam(); | 137 | void doBeam(); |
137 | void fileBeamFinished( Ir *); | 138 | void fileBeamFinished( Ir *); |
138 | 139 | ||
139 | private: | 140 | private: |
140 | QTimer menuTimer; | 141 | QTimer menuTimer; |
141 | }; | 142 | }; |
142 | 143 | ||
143 | #endif // ADVANCEDFM_H | 144 | #endif // ADVANCEDFM_H |