summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfm.cpp
Unidiff
Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp57
1 files changed, 22 insertions, 35 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index a47edd8..afb44f5 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -35,11 +35,7 @@
35 35
36using namespace Opie::Ui; 36using namespace Opie::Ui;
37 37
38#ifdef NOQUICKLAUNCH
39AdvancedFm::AdvancedFm( )
40#else
41AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) 38AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
42#endif
43 : QMainWindow( ) { 39 : QMainWindow( ) {
44 init(); 40 init();
45 renameBox = 0; 41 renameBox = 0;
@@ -71,7 +67,7 @@ void AdvancedFm::cleanUp() {
71} 67}
72 68
73void AdvancedFm::tabChanged(QWidget *) { 69void AdvancedFm::tabChanged(QWidget *) {
74// owarn << "tab changed" << oendl; 70// owarn << "tab changed" << oendl;
75 QString path = CurrentDir()->canonicalPath(); 71 QString path = CurrentDir()->canonicalPath();
76 currentPathCombo->lineEdit()->setText( path ); 72 currentPathCombo->lineEdit()->setText( path );
77 73
@@ -93,13 +89,13 @@ void AdvancedFm::tabChanged(QWidget *) {
93 89
94void AdvancedFm::populateView() { 90void AdvancedFm::populateView() {
95 91
96// owarn << "PopulateView" << oendl; 92// owarn << "PopulateView" << oendl;
97 QPixmap pm; 93 QPixmap pm;
98 QListView *thisView = CurrentView(); 94 QListView *thisView = CurrentView();
99 QDir *thisDir = CurrentDir(); 95 QDir *thisDir = CurrentDir();
100 QString path = thisDir->canonicalPath(); 96 QString path = thisDir->canonicalPath();
101 97
102//owarn << "path is "+path << oendl; 98//owarn << "path is "+path << oendl;
103 thisView->clear(); 99 thisView->clear();
104 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 100 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
105 thisDir->setMatchAllDirs(TRUE); 101 thisDir->setMatchAllDirs(TRUE);
@@ -160,7 +156,7 @@ void AdvancedFm::populateView() {
160 } 156 }
161 } 157 }
162 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { 158 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
163 // odebug << " overlay link image" << oendl; 159 // odebug << " overlay link image" << oendl;
164 pm= Resource::loadPixmap( "advancedfm/symlink" ); 160 pm= Resource::loadPixmap( "advancedfm/symlink" );
165 // pm= Resource::loadPixmap( "folder" ); 161 // pm= Resource::loadPixmap( "folder" );
166// QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 162// QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
@@ -184,7 +180,7 @@ void AdvancedFm::populateView() {
184 if((dir = opendir( path.latin1())) != NULL) 180 if((dir = opendir( path.latin1())) != NULL)
185 while ((mydirent = readdir(dir)) != NULL) { 181 while ((mydirent = readdir(dir)) != NULL) {
186 lstat( mydirent->d_name, &buf); 182 lstat( mydirent->d_name, &buf);
187// odebug << mydirent->d_name << oendl; 183// odebug << mydirent->d_name << oendl;
188 fileL.sprintf("%s", mydirent->d_name); 184 fileL.sprintf("%s", mydirent->d_name);
189 devT = buf.st_dev; 185 devT = buf.st_dev;
190 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 186 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
@@ -209,7 +205,7 @@ void AdvancedFm::rePopulate() {
209 populateView(); 205 populateView();
210 206
211// int tmpTab = whichTab; 207// int tmpTab = whichTab;
212// // odebug << "" << tmpTab << "" << oendl; 208// // odebug << "" << tmpTab << "" << oendl;
213 209
214// for(int i =1; i < 3; i++) { 210// for(int i =1; i < 3; i++) {
215// TabWidget->setCurrentWidget(i - 1); 211// TabWidget->setCurrentWidget(i - 1);
@@ -219,10 +215,10 @@ void AdvancedFm::rePopulate() {
219} 215}
220 216
221void AdvancedFm::ListClicked(QListViewItem *selectedItem) { 217void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
222//owarn << "listclicked" << oendl; 218//owarn << "listclicked" << oendl;
223 if(selectedItem) { 219 if(selectedItem) {
224 QString strItem=selectedItem->text(0); 220 QString strItem=selectedItem->text(0);
225// owarn << strItem << oendl; 221// owarn << strItem << oendl;
226 QString strSize=selectedItem->text(1); 222 QString strSize=selectedItem->text(1);
227 strSize=strSize.stripWhiteSpace(); 223 strSize=strSize.stripWhiteSpace();
228 bool isDirectory = false; 224 bool isDirectory = false;
@@ -259,21 +255,18 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , in
259 } 255 }
260 } 256 }
261 break; 257 break;
262 case 2:
263 menuTimer.start( 500, TRUE );
264 break;
265 }; 258 };
266} 259}
267 260
268 261
269void AdvancedFm::switchToLocalTab() { 262void AdvancedFm::switchToLocalTab() {
270//owarn << "switch to local view" << oendl; 263//owarn << "switch to local view" << oendl;
271 TabWidget->setCurrentWidget(0); 264 TabWidget->setCurrentWidget(0);
272 Local_View->setFocus(); 265 Local_View->setFocus();
273} 266}
274 267
275void AdvancedFm::switchToRemoteTab() { 268void AdvancedFm::switchToRemoteTab() {
276//owarn << "switch to local view" << oendl; 269//owarn << "switch to local view" << oendl;
277 TabWidget->setCurrentWidget(1); 270 TabWidget->setCurrentWidget(1);
278 Remote_View->setFocus(); 271 Remote_View->setFocus();
279} 272}
@@ -329,7 +322,7 @@ QStringList AdvancedFm::getPath() {
329 for ( ; it.current(); ++it ) { 322 for ( ; it.current(); ++it ) {
330 if ( it.current()->isSelected() ) { 323 if ( it.current()->isSelected() ) {
331 strList << it.current()->text(0); 324 strList << it.current()->text(0);
332// odebug << it.current()->text(0) << oendl; 325// odebug << it.current()->text(0) << oendl;
333 } 326 }
334 } 327 }
335 return strList; 328 return strList;
@@ -380,7 +373,7 @@ void AdvancedFm::doAbout() {
380} 373}
381 374
382void AdvancedFm::keyPressEvent( QKeyEvent *e) { 375void AdvancedFm::keyPressEvent( QKeyEvent *e) {
383// owarn << "key " << e->key() << "" << oendl; 376// owarn << "key " << e->key() << "" << oendl;
384// if( CurrentView()->hasFocus() ) 377// if( CurrentView()->hasFocus() )
385 { 378 {
386 switch ( e->key() ) { 379 switch ( e->key() ) {
@@ -606,12 +599,6 @@ void AdvancedFm::showFileMenu() {
606} 599}
607 600
608 601
609void AdvancedFm::cancelMenuTimer() {
610
611 if( menuTimer.isActive() )
612 menuTimer.stop();
613}
614
615QString AdvancedFm::checkDiskSpace(const QString &path) { 602QString AdvancedFm::checkDiskSpace(const QString &path) {
616 struct statfs fss; 603 struct statfs fss;
617 if ( !statfs( path.latin1(), &fss ) ) { 604 if ( !statfs( path.latin1(), &fss ) ) {
@@ -638,7 +625,7 @@ void AdvancedFm::addToDocs() {
638 QString curFile; 625 QString curFile;
639 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 626 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
640 curFile = thisDir->canonicalPath()+"/"+(*it); 627 curFile = thisDir->canonicalPath()+"/"+(*it);
641// odebug << curFile << oendl; 628// odebug << curFile << oendl;
642 QFileInfo fi(curFile); 629 QFileInfo fi(curFile);
643 DocLnk f; 630 DocLnk f;
644// curFile.replace(QRegExp("\\..*"),""); 631// curFile.replace(QRegExp("\\..*"),"");
@@ -711,7 +698,7 @@ void AdvancedFm::addCustomDir() {
711} 698}
712 699
713void AdvancedFm::removeCustomDir() { 700void AdvancedFm::removeCustomDir() {
714// odebug << "remove custom dir" << oendl; 701// odebug << "remove custom dir" << oendl;
715 Config cfg("AdvancedFm"); 702 Config cfg("AdvancedFm");
716 cfg.setGroup("Menu"); 703 cfg.setGroup("Menu");
717 QString dir; 704 QString dir;
@@ -746,7 +733,7 @@ void AdvancedFm::removeCustomDir() {
746} 733}
747 734
748void AdvancedFm::gotoCustomDir(const QString &dir) { 735void AdvancedFm::gotoCustomDir(const QString &dir) {
749// odebug << "gotoCustomDir(const QString &dir) " +dir << oendl; 736// odebug << "gotoCustomDir(const QString &dir) " +dir << oendl;
750// QString curDir = dir; 737// QString curDir = dir;
751// QDir *thisDir = CurrentDir(); 738// QDir *thisDir = CurrentDir();
752// if( curDir.isEmpty()) { 739// if( curDir.isEmpty()) {
@@ -787,10 +774,10 @@ QDir *AdvancedFm::OtherDir() {
787 774
788QListView * AdvancedFm::CurrentView() { 775QListView * AdvancedFm::CurrentView() {
789 if ( whichTab == 1) { 776 if ( whichTab == 1) {
790// owarn << "CurrentView Tab 1" << oendl; 777// owarn << "CurrentView Tab 1" << oendl;
791 return Local_View; 778 return Local_View;
792 } else { 779 } else {
793// owarn << "CurrentView Tab 2" << oendl; 780// owarn << "CurrentView Tab 2" << oendl;
794 return Remote_View; 781 return Remote_View;
795 } 782 }
796} 783}
@@ -803,7 +790,7 @@ QListView * AdvancedFm::OtherView() {
803} 790}
804 791
805void AdvancedFm::setOtherTabCurrent() { 792void AdvancedFm::setOtherTabCurrent() {
806// owarn << "setOtherTabCurrent() " << whichTab << "" << oendl; 793// owarn << "setOtherTabCurrent() " << whichTab << "" << oendl;
807 if ( whichTab == 1) { 794 if ( whichTab == 1) {
808 TabWidget->setCurrentWidget(1); 795 TabWidget->setCurrentWidget(1);
809 } else { 796 } else {
@@ -814,10 +801,10 @@ void AdvancedFm::setOtherTabCurrent() {
814} 801}
815 802
816void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { 803void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
817// odebug << "qcop message "+msg << oendl; 804// odebug << "qcop message "+msg << oendl;
818 QDataStream stream ( data, IO_ReadOnly ); 805 QDataStream stream ( data, IO_ReadOnly );
819 if ( msg == "openDirectory(QString)" ) { 806 if ( msg == "openDirectory(QString)" ) {
820// odebug << "received" << oendl; 807// odebug << "received" << oendl;
821 QString file; 808 QString file;
822 stream >> file; 809 stream >> file;
823 gotoDirectory( (const QString &) file); 810 gotoDirectory( (const QString &) file);
@@ -830,7 +817,7 @@ void AdvancedFm::setDocument(const QString &file) {
830} 817}
831 818
832void AdvancedFm::gotoDirectory(const QString &file) { 819void AdvancedFm::gotoDirectory(const QString &file) {
833// owarn << "goto dir "+file << oendl; 820// owarn << "goto dir "+file << oendl;
834 QString curDir = file; 821 QString curDir = file;
835 QDir *thisDir = CurrentDir(); 822 QDir *thisDir = CurrentDir();
836 if(QDir( curDir).exists() ) { 823 if(QDir( curDir).exists() ) {
@@ -866,7 +853,7 @@ void AdvancedFm::findFile(const QString &fileName) {
866} 853}
867 854
868void AdvancedFm::slotSwitchMenu(int ) { 855void AdvancedFm::slotSwitchMenu(int ) {
869// odebug << "Switch " << item << "" << oendl; 856// odebug << "Switch " << item << "" << oendl;
870 // viewMenu->setItemChecked(item, true); 857 // viewMenu->setItemChecked(item, true);
871} 858}
872 859