author | llornkcor <llornkcor> | 2004-09-25 06:51:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-25 06:51:24 (UTC) |
commit | 3d4aef2df9828aedccf5d576ecbc8aad6621362e (patch) (unidiff) | |
tree | 435f8e3b658ef45d8e95d29a305d20c62e01c24e | |
parent | 448e2835ff7b84162022b62f8570935739a167bb (diff) | |
download | opie-3d4aef2df9828aedccf5d576ecbc8aad6621362e.zip opie-3d4aef2df9828aedccf5d576ecbc8aad6621362e.tar.gz opie-3d4aef2df9828aedccf5d576ecbc8aad6621362e.tar.bz2 |
not hardcoded path
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 41 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 1 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 2 |
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 | |||
@@ -4,24 +4,27 @@ | |||
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> |
@@ -201,42 +204,27 @@ void AdvancedFm::populateView() { | |||
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 | ||
208 | void AdvancedFm::rePopulate() { | 211 | void 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 | ||
224 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { | 218 | void 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; |
@@ -268,25 +256,24 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , in | |||
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 | ||
277 | void AdvancedFm::refreshCurrentTab() { | 265 | void AdvancedFm::refreshCurrentTab() { |
278 | populateView(); | 266 | populateView(); |
279 | // if ( TabWidget->currentWidget() == tab) { | 267 | // if ( TabWidget->currentWidget() == tab) { |
280 | |||
281 | } | 268 | } |
282 | 269 | ||
283 | void AdvancedFm::switchToLocalTab() { | 270 | void 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 | ||
289 | void AdvancedFm::switchToRemoteTab() { | 276 | void AdvancedFm::switchToRemoteTab() { |
290 | TabWidget->setCurrentWidget(1); | 277 | TabWidget->setCurrentWidget(1); |
291 | // Remote_View->setFocus(); | 278 | // Remote_View->setFocus(); |
292 | whichTab = 2; | 279 | whichTab = 2; |
@@ -343,32 +330,31 @@ void AdvancedFm::changeTo(const QString dir) { | |||
343 | update(); | 330 | update(); |
344 | } | 331 | } |
345 | 332 | ||
346 | void AdvancedFm::homeButtonPushed() { | 333 | void AdvancedFm::homeButtonPushed() { |
347 | changeTo(QDir::homeDirPath()); | 334 | changeTo(QDir::homeDirPath()); |
348 | } | 335 | } |
349 | 336 | ||
350 | void AdvancedFm::docButtonPushed() { | 337 | void AdvancedFm::docButtonPushed() { |
351 | changeTo(QPEApplication::documentDir()); | 338 | changeTo(QPEApplication::documentDir()); |
352 | } | 339 | } |
353 | 340 | ||
354 | void AdvancedFm::SDButtonPushed() { | 341 | void AdvancedFm::SDButtonPushed() { |
355 | changeTo("/mnt/card");// this can change so fix | 342 | Opie::Core::OStorageInfo info; |
343 | changeTo(info.sdPath()); | ||
356 | } | 344 | } |
357 | 345 | ||
358 | void AdvancedFm::CFButtonPushed() { | 346 | void 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 | ||
365 | void AdvancedFm::QPEButtonPushed() { | 351 | void AdvancedFm::QPEButtonPushed() { |
366 | changeTo(QPEApplication::qpeDir()); | 352 | changeTo(QPEApplication::qpeDir()); |
367 | } | 353 | } |
368 | 354 | ||
369 | void AdvancedFm::doAbout() { | 355 | void 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 | ||
373 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { | 359 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { |
374 | Q_UNUSED(e); | 360 | Q_UNUSED(e); |
@@ -761,38 +747,25 @@ void 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 | ||
771 | void AdvancedFm::setDocument(const QString &file) { | 757 | void AdvancedFm::setDocument(const QString &file) { |
772 | changeTo( file); | 758 | changeTo( file); |
773 | |||
774 | } | 759 | } |
775 | 760 | ||
776 | 761 | ||
777 | void 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 | |||
789 | void AdvancedFm::slotSwitchMenu(int item) { | 762 | void 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 | ||
795 | void AdvancedFm::navigateToSelected() { | 768 | void 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 | |||
@@ -168,25 +168,24 @@ protected slots: | |||
168 | private: | 168 | private: |
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 | ||
182 | private slots: | 181 | private 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 | |||
@@ -47,26 +47,24 @@ void AdvancedFm::init() { | |||
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")); |