author | llornkcor <llornkcor> | 2002-08-06 13:59:45 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-06 13:59:45 (UTC) |
commit | 64888e9cd2f4c8f40f08a6712e2fd27220ff14ad (patch) (unidiff) | |
tree | 862bcda0849bf79b3eeb6fbab1ef18d08b005dc9 | |
parent | b980135ff5ce5447ca41411b6ace74ce2803fadb (diff) | |
download | opie-64888e9cd2f4c8f40f08a6712e2fd27220ff14ad.zip opie-64888e9cd2f4c8f40f08a6712e2fd27220ff14ad.tar.gz opie-64888e9cd2f4c8f40f08a6712e2fd27220ff14ad.tar.bz2 |
re-add missing diskspace function
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 22 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.pro | 28 |
2 files changed, 31 insertions, 19 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index b169a79..7ee78c0 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,149 +1,149 @@ | |||
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 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties | 13 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties |
14 | 14 | ||
15 | #include "advancedfm.h" | 15 | #include "advancedfm.h" |
16 | #include "inputDialog.h" | 16 | #include "inputDialog.h" |
17 | #include "filePermissions.h" | 17 | #include "filePermissions.h" |
18 | #include "output.h" | 18 | #include "output.h" |
19 | 19 | ||
20 | #include <opie/ofileselector.h> | 20 | // #include <opie/ofileselector.h> |
21 | #include <opie/ofiledialog.h> | 21 | // #include <opie/ofiledialog.h> |
22 | 22 | ||
23 | 23 | ||
24 | #include <qpe/lnkproperties.h> | 24 | #include <qpe/lnkproperties.h> |
25 | #include <qpe/filemanager.h> | 25 | #include <qpe/filemanager.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
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 | 75 | ||
76 | AdvancedFm::AdvancedFm( ) | 76 | AdvancedFm::AdvancedFm( ) |
77 | : QMainWindow( ) | 77 | : QMainWindow( ) |
78 | { | 78 | { |
79 | setCaption( tr( "AdvancedFm" ) ); | 79 | setCaption( tr( "AdvancedFm" ) ); |
80 | 80 | ||
81 | QGridLayout *layout = new QGridLayout( this ); | 81 | QGridLayout *layout = new QGridLayout( this ); |
82 | layout->setSpacing( 2); | 82 | layout->setSpacing( 2); |
83 | layout->setMargin( 2); | 83 | layout->setMargin( 2); |
84 | 84 | ||
85 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 85 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
86 | 86 | ||
87 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 87 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
88 | fileMenu = new QPopupMenu( this ); | 88 | fileMenu = new QPopupMenu( this ); |
89 | viewMenu = new QPopupMenu( this ); | 89 | viewMenu = new QPopupMenu( this ); |
90 | 90 | ||
91 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 91 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
92 | 92 | ||
93 | menuBar->insertItem( tr( "File" ), fileMenu); | 93 | menuBar->insertItem( tr( "File" ), fileMenu); |
94 | menuBar->insertItem( tr( "View" ), viewMenu); | 94 | menuBar->insertItem( tr( "View" ), viewMenu); |
95 | 95 | ||
96 | qpeDirButton= new QToolButton(this,"QPEButton"); | 96 | qpeDirButton= new QToolButton(this,"QPEButton"); |
97 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 97 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
98 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | 98 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); |
99 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); | 99 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); |
100 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | 100 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); |
101 | 101 | ||
102 | cfButton = new QToolButton( this,"CFButton"); | 102 | cfButton = new QToolButton( this,"CFButton"); |
103 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 103 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
104 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 104 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
105 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | 105 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); |
106 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); | 106 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); |
107 | 107 | ||
108 | sdButton = new QToolButton( this,"SDButton"); | 108 | sdButton = new QToolButton( this,"SDButton"); |
109 | sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard")); | 109 | sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard")); |
110 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 110 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
111 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | 111 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); |
112 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); | 112 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); |
113 | 113 | ||
114 | cdUpButton = new QToolButton( this,"cdUpButton"); | 114 | cdUpButton = new QToolButton( this,"cdUpButton"); |
115 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 115 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
116 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 116 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
117 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 117 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
118 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); | 118 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); |
119 | 119 | ||
120 | docButton = new QToolButton( this,"docsButton"); | 120 | docButton = new QToolButton( this,"docsButton"); |
121 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 121 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
122 | docButton->setFixedSize( QSize( 20, 20 ) ); | 122 | docButton->setFixedSize( QSize( 20, 20 ) ); |
123 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 123 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
124 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); | 124 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); |
125 | 125 | ||
126 | homeButton = new QToolButton( this,"homeButton"); | 126 | homeButton = new QToolButton( this,"homeButton"); |
127 | homeButton->setPixmap(Resource::loadPixmap("home")); | 127 | homeButton->setPixmap(Resource::loadPixmap("home")); |
128 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 128 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
129 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 129 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
130 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); | 130 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); |
131 | 131 | ||
132 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 132 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
133 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 133 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
134 | fileMenu->insertSeparator(); | 134 | fileMenu->insertSeparator(); |
135 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 135 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
136 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 136 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
137 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 137 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
138 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 138 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
139 | fileMenu->insertSeparator(); | 139 | fileMenu->insertSeparator(); |
140 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 140 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
141 | fileMenu->setCheckable(TRUE); | 141 | fileMenu->setCheckable(TRUE); |
142 | 142 | ||
143 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 143 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
144 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 144 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
145 | viewMenu->insertSeparator(); | 145 | viewMenu->insertSeparator(); |
146 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 146 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
147 | viewMenu->setCheckable(TRUE); | 147 | viewMenu->setCheckable(TRUE); |
148 | 148 | ||
149 | 149 | ||
@@ -1607,282 +1607,294 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | |||
1607 | break; | 1607 | break; |
1608 | case Key_U: | 1608 | case Key_U: |
1609 | upDir(); | 1609 | upDir(); |
1610 | break; | 1610 | break; |
1611 | case Key_P: | 1611 | case Key_P: |
1612 | filePerms(); | 1612 | filePerms(); |
1613 | break; | 1613 | break; |
1614 | case Key_N: | 1614 | case Key_N: |
1615 | mkDir(); | 1615 | mkDir(); |
1616 | break; | 1616 | break; |
1617 | case Key_1: | 1617 | case Key_1: |
1618 | switchToLocalTab(); | 1618 | switchToLocalTab(); |
1619 | break; | 1619 | break; |
1620 | case Key_2: | 1620 | case Key_2: |
1621 | switchToRemoteTab(); | 1621 | switchToRemoteTab(); |
1622 | break; | 1622 | break; |
1623 | case Key_3: | 1623 | case Key_3: |
1624 | CFButtonPushed(); | 1624 | CFButtonPushed(); |
1625 | break; | 1625 | break; |
1626 | case Key_4: | 1626 | case Key_4: |
1627 | SDButtonPushed(); | 1627 | SDButtonPushed(); |
1628 | break; | 1628 | break; |
1629 | case Key_5: | 1629 | case Key_5: |
1630 | homeButtonPushed(); | 1630 | homeButtonPushed(); |
1631 | break; | 1631 | break; |
1632 | case Key_6: | 1632 | case Key_6: |
1633 | docButtonPushed(); | 1633 | docButtonPushed(); |
1634 | break; | 1634 | break; |
1635 | case Key_7: | 1635 | case Key_7: |
1636 | break; | 1636 | break; |
1637 | case Key_8: | 1637 | case Key_8: |
1638 | break; | 1638 | break; |
1639 | case Key_9: | 1639 | case Key_9: |
1640 | break; | 1640 | break; |
1641 | case Key_0: | 1641 | case Key_0: |
1642 | break; | 1642 | break; |
1643 | } | 1643 | } |
1644 | } | 1644 | } |
1645 | 1645 | ||
1646 | void AdvancedFm::mkSym() { | 1646 | void AdvancedFm::mkSym() { |
1647 | QString cmd; | 1647 | QString cmd; |
1648 | QStringList curFileList = getPath(); | 1648 | QStringList curFileList = getPath(); |
1649 | if( curFileList.count() > 0) { | 1649 | if( curFileList.count() > 0) { |
1650 | 1650 | ||
1651 | if (TabWidget->currentPageIndex() == 0) { | 1651 | if (TabWidget->currentPageIndex() == 0) { |
1652 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1652 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1653 | 1653 | ||
1654 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); | 1654 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); |
1655 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 1655 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
1656 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 1656 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
1657 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1657 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1658 | cmd = "ln -s "+curFile+" "+destName; | 1658 | cmd = "ln -s "+curFile+" "+destName; |
1659 | qDebug(cmd); | 1659 | qDebug(cmd); |
1660 | system(cmd.latin1() ); | 1660 | system(cmd.latin1() ); |
1661 | } | 1661 | } |
1662 | populateRemoteView(); | 1662 | populateRemoteView(); |
1663 | TabWidget->setCurrentPage(1); | 1663 | TabWidget->setCurrentPage(1); |
1664 | } else { | 1664 | } else { |
1665 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1665 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1666 | 1666 | ||
1667 | QString destName = currentDir.canonicalPath()+"/"+(*it); | 1667 | QString destName = currentDir.canonicalPath()+"/"+(*it); |
1668 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 1668 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
1669 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1669 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1670 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1670 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1671 | 1671 | ||
1672 | cmd = "ln -s "+curFile+" "+destName; | 1672 | cmd = "ln -s "+curFile+" "+destName; |
1673 | qDebug(cmd); | 1673 | qDebug(cmd); |
1674 | system(cmd.latin1() ); | 1674 | system(cmd.latin1() ); |
1675 | } | 1675 | } |
1676 | populateLocalView(); | 1676 | populateLocalView(); |
1677 | TabWidget->setCurrentPage(0); | 1677 | TabWidget->setCurrentPage(0); |
1678 | } | 1678 | } |
1679 | } | 1679 | } |
1680 | } | 1680 | } |
1681 | 1681 | ||
1682 | void AdvancedFm::QPEButtonPushed() { | 1682 | void AdvancedFm::QPEButtonPushed() { |
1683 | QString current = QPEApplication::qpeDir(); | 1683 | QString current = QPEApplication::qpeDir(); |
1684 | chdir( current.latin1() ); | 1684 | chdir( current.latin1() ); |
1685 | if (TabWidget->currentPageIndex() == 0) { | 1685 | if (TabWidget->currentPageIndex() == 0) { |
1686 | currentDir.cd( current, TRUE); | 1686 | currentDir.cd( current, TRUE); |
1687 | populateLocalView(); | 1687 | populateLocalView(); |
1688 | } else { | 1688 | } else { |
1689 | currentRemoteDir.cd( current, TRUE); | 1689 | currentRemoteDir.cd( current, TRUE); |
1690 | populateRemoteView(); | 1690 | populateRemoteView(); |
1691 | } | 1691 | } |
1692 | update(); | 1692 | update(); |
1693 | } | 1693 | } |
1694 | 1694 | ||
1695 | void AdvancedFm::parsetab(const QString &fileName) { | 1695 | void AdvancedFm::parsetab(const QString &fileName) { |
1696 | 1696 | ||
1697 | fileSystemTypeList.clear(); | 1697 | fileSystemTypeList.clear(); |
1698 | fsList.clear(); | 1698 | fsList.clear(); |
1699 | struct mntent *me; | 1699 | struct mntent *me; |
1700 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 1700 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
1701 | if ( mntfp ) { | 1701 | if ( mntfp ) { |
1702 | while ( (me = getmntent( mntfp )) != 0 ) { | 1702 | while ( (me = getmntent( mntfp )) != 0 ) { |
1703 | QString deviceName = me->mnt_fsname; | 1703 | QString deviceName = me->mnt_fsname; |
1704 | QString filesystemType = me->mnt_type; | 1704 | QString filesystemType = me->mnt_type; |
1705 | QString mountDir = me->mnt_dir; | 1705 | QString mountDir = me->mnt_dir; |
1706 | if(deviceName != "none") { | 1706 | if(deviceName != "none") { |
1707 | if( fsList.contains(filesystemType) == 0 | 1707 | if( fsList.contains(filesystemType) == 0 |
1708 | & filesystemType.find("proc",0,TRUE) == -1 | 1708 | & filesystemType.find("proc",0,TRUE) == -1 |
1709 | & filesystemType.find("cramfs",0,TRUE) == -1 | 1709 | & filesystemType.find("cramfs",0,TRUE) == -1 |
1710 | & filesystemType.find("auto",0,TRUE) == -1) | 1710 | & filesystemType.find("auto",0,TRUE) == -1) |
1711 | fsList << filesystemType; | 1711 | fsList << filesystemType; |
1712 | fileSystemTypeList << mountDir+"::"+filesystemType; | 1712 | fileSystemTypeList << mountDir+"::"+filesystemType; |
1713 | } | 1713 | } |
1714 | } | 1714 | } |
1715 | } | 1715 | } |
1716 | endmntent( mntfp ); | 1716 | endmntent( mntfp ); |
1717 | } | 1717 | } |
1718 | 1718 | ||
1719 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { | 1719 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { |
1720 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 1720 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
1721 | QString current = currentText;//.right( currentText.length()-1); | 1721 | QString current = currentText;//.right( currentText.length()-1); |
1722 | QString baseFs; | 1722 | QString baseFs; |
1723 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { | 1723 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { |
1724 | QString temp = (*it); | 1724 | QString temp = (*it); |
1725 | QString path = temp.left(temp.find("::",0,TRUE) ); | 1725 | QString path = temp.left(temp.find("::",0,TRUE) ); |
1726 | path = path.right( path.length()-1); | 1726 | path = path.right( path.length()-1); |
1727 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 1727 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
1728 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { | 1728 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { |
1729 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 1729 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
1730 | } | 1730 | } |
1731 | } | 1731 | } |
1732 | return baseFs; | 1732 | return baseFs; |
1733 | } | 1733 | } |
1734 | 1734 | ||
1735 | QString AdvancedFm::getDiskSpace( const QString &) { | 1735 | QString AdvancedFm::getDiskSpace( const QString &path) { |
1736 | 1736 | struct statfs fss; | |
1737 | if ( !statfs( path.latin1(), &fss ) ) { | ||
1738 | int blkSize = fss.f_bsize; | ||
1739 | // int totalBlks = fs.f_blocks; | ||
1740 | int availBlks = fss.f_bavail; | ||
1741 | |||
1742 | long mult = blkSize / 1024; | ||
1743 | long div = 1024 / blkSize; | ||
1744 | if ( !mult ) mult = 1; | ||
1745 | if ( !div ) div = 1; | ||
1746 | |||
1747 | return QString::number(availBlks * mult / div); | ||
1748 | } | ||
1749 | return ""; | ||
1737 | } | 1750 | } |
1738 | 1751 | ||
1739 | void AdvancedFm::doBeam() { | 1752 | void AdvancedFm::doBeam() { |
1740 | Ir ir; | 1753 | Ir ir; |
1741 | if(!ir.supported()){ | 1754 | if(!ir.supported()){ |
1742 | } else { | 1755 | } else { |
1743 | 1756 | ||
1744 | QStringList curFileList = getPath(); | 1757 | QStringList curFileList = getPath(); |
1745 | if( curFileList.count() > 0) { | 1758 | if( curFileList.count() > 0) { |
1746 | 1759 | ||
1747 | if (TabWidget->currentPageIndex() == 0) { | 1760 | if (TabWidget->currentPageIndex() == 0) { |
1748 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1761 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1749 | 1762 | ||
1750 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 1763 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
1751 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1764 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1752 | Ir *file = new Ir(this, "IR"); | 1765 | Ir *file = new Ir(this, "IR"); |
1753 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 1766 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
1754 | file->send( curFile, curFile ); | 1767 | file->send( curFile, curFile ); |
1755 | } | 1768 | } |
1756 | 1769 | ||
1757 | } else { | 1770 | } else { |
1758 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1771 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1759 | 1772 | ||
1760 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1773 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1761 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1774 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1762 | Ir *file = new Ir(this, "IR"); | 1775 | Ir *file = new Ir(this, "IR"); |
1763 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 1776 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
1764 | file->send( curFile, curFile ); | 1777 | file->send( curFile, curFile ); |
1765 | 1778 | ||
1766 | } | 1779 | } |
1767 | } | 1780 | } |
1768 | } | 1781 | } |
1769 | } | 1782 | } |
1770 | 1783 | ||
1771 | } | 1784 | } |
1772 | 1785 | ||
1773 | void AdvancedFm::fileBeamFinished( Ir *ir) { | 1786 | void AdvancedFm::fileBeamFinished( Ir *ir) { |
1774 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 1787 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
1775 | 1788 | ||
1776 | } | 1789 | } |
1777 | 1790 | ||
1778 | void AdvancedFm::showFileMenu() { | 1791 | void AdvancedFm::showFileMenu() { |
1779 | 1792 | ||
1780 | QString curApp; | 1793 | QString curApp; |
1781 | bool isLocalView = false; | 1794 | bool isLocalView = false; |
1782 | if (TabWidget->currentPageIndex() == 0) { | 1795 | if (TabWidget->currentPageIndex() == 0) { |
1783 | isLocalView = TRUE; | 1796 | isLocalView = TRUE; |
1784 | curApp = Local_View->currentItem()->text(0); | 1797 | curApp = Local_View->currentItem()->text(0); |
1785 | } else { | 1798 | } else { |
1786 | curApp = Remote_View->currentItem()->text(0); | 1799 | curApp = Remote_View->currentItem()->text(0); |
1787 | } | 1800 | } |
1788 | 1801 | ||
1789 | MimeType mt( curApp ); | 1802 | MimeType mt( curApp ); |
1790 | const AppLnk* app = mt.application(); | 1803 | const AppLnk* app = mt.application(); |
1791 | QFile fi(curApp); | 1804 | QFile fi(curApp); |
1792 | 1805 | ||
1793 | QPopupMenu *m = new QPopupMenu(0); | 1806 | QPopupMenu *m = new QPopupMenu(0); |
1794 | 1807 | ||
1795 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 1808 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
1796 | m->insertSeparator(); | 1809 | m->insertSeparator(); |
1797 | if ( QFileInfo(fi).isDir() ) { | 1810 | if ( QFileInfo(fi).isDir() ) { |
1798 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 1811 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
1799 | } else { | 1812 | } else { |
1800 | 1813 | ||
1801 | if ( app ) | 1814 | if ( app ) |
1802 | m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) ); | 1815 | m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) ); |
1803 | else if( QFileInfo(fi).isExecutable() ) | 1816 | else if( QFileInfo(fi).isExecutable() ) |
1804 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); | 1817 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); |
1805 | 1818 | ||
1806 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); | 1819 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); |
1807 | } | 1820 | } |
1808 | m->insertSeparator(); | 1821 | m->insertSeparator(); |
1809 | 1822 | ||
1810 | 1823 | ||
1811 | if(isLocalView) | 1824 | if(isLocalView) |
1812 | m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 1825 | m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
1813 | else | 1826 | else |
1814 | m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 1827 | m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
1815 | 1828 | ||
1816 | m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 1829 | m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
1817 | m->insertSeparator(); | 1830 | m->insertSeparator(); |
1818 | 1831 | ||
1819 | if(isLocalView) | 1832 | if(isLocalView) |
1820 | m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 1833 | m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
1821 | else | 1834 | else |
1822 | m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 1835 | m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
1823 | 1836 | ||
1824 | m->insertItem( tr( "Copy" ), this, SLOT( copy() )); | 1837 | m->insertItem( tr( "Copy" ), this, SLOT( copy() )); |
1825 | m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 1838 | m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
1826 | m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); | 1839 | m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); |
1827 | m->insertItem( tr( "Move" ), this, SLOT( move() )); | 1840 | m->insertItem( tr( "Move" ), this, SLOT( move() )); |
1828 | m->insertSeparator(); | 1841 | m->insertSeparator(); |
1829 | 1842 | ||
1830 | if(isLocalView) | 1843 | if(isLocalView) |
1831 | m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); | 1844 | m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); |
1832 | else | 1845 | else |
1833 | m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); | 1846 | m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); |
1834 | 1847 | ||
1835 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 1848 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
1836 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 1849 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
1837 | m->insertSeparator(); | 1850 | m->insertSeparator(); |
1838 | 1851 | ||
1839 | if(isLocalView) | 1852 | if(isLocalView) |
1840 | m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 1853 | m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
1841 | else | 1854 | else |
1842 | m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 1855 | m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
1843 | 1856 | ||
1844 | m->insertSeparator(); | 1857 | m->insertSeparator(); |
1845 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 1858 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
1846 | 1859 | ||
1847 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings | 1860 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings |
1848 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 1861 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
1849 | m->setCheckable(TRUE); | 1862 | m->setCheckable(TRUE); |
1850 | if (!b) | 1863 | if (!b) |
1851 | m->setItemChecked(m->idAt(0),TRUE); | 1864 | m->setItemChecked(m->idAt(0),TRUE); |
1852 | else | 1865 | else |
1853 | m->setItemChecked(m->idAt(0),FALSE); | 1866 | m->setItemChecked(m->idAt(0),FALSE); |
1854 | if(Ir::supported()) | 1867 | if(Ir::supported()) |
1855 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); | 1868 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); |
1856 | m->setFocus(); | 1869 | m->setFocus(); |
1857 | m->exec( QCursor::pos() ); | 1870 | m->exec( QCursor::pos() ); |
1858 | sleep(1); | 1871 | sleep(1); |
1859 | if(m) delete m; | 1872 | if(m) delete m; |
1860 | } | 1873 | } |
1861 | 1874 | ||
1862 | 1875 | ||
1863 | void AdvancedFm::cancelMenuTimer() { | 1876 | void AdvancedFm::cancelMenuTimer() { |
1864 | 1877 | ||
1865 | qDebug("selectionChanged: cancel menu timer"); | 1878 | qDebug("selectionChanged: cancel menu timer"); |
1866 | if( menuTimer.isActive() ) | 1879 | if( menuTimer.isActive() ) |
1867 | menuTimer.stop(); | 1880 | menuTimer.stop(); |
1868 | } | 1881 | } |
1869 | 1882 | ||
1870 | QString AdvancedFm::checkDiskSpace(const QString &path) { | 1883 | QString AdvancedFm::checkDiskSpace(const QString &path) { |
1871 | |||
1872 | struct statfs fss; | 1884 | struct statfs fss; |
1873 | if ( !statfs( path.latin1(), &fss ) ) { | 1885 | if ( !statfs( path.latin1(), &fss ) ) { |
1874 | int blkSize = fss.f_bsize; | 1886 | int blkSize = fss.f_bsize; |
1875 | // int totalBlks = fs.f_blocks; | 1887 | // int totalBlks = fs.f_blocks; |
1876 | int availBlks = fss.f_bavail; | 1888 | int availBlks = fss.f_bavail; |
1877 | 1889 | ||
1878 | long mult = blkSize / 1024; | 1890 | long mult = blkSize / 1024; |
1879 | long div = 1024 / blkSize; | 1891 | long div = 1024 / blkSize; |
1880 | if ( !mult ) mult = 1; | 1892 | if ( !mult ) mult = 1; |
1881 | if ( !div ) div = 1; | 1893 | if ( !div ) div = 1; |
1882 | 1894 | ||
1883 | 1895 | ||
1884 | return QString::number(availBlks * mult / div); | 1896 | return QString::number(availBlks * mult / div); |
1885 | } | 1897 | } |
1886 | return ""; | 1898 | return ""; |
1887 | } | 1899 | } |
1888 | 1900 | ||
diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro index e99ab12..0f0f770 100644 --- a/noncore/apps/advancedfm/advancedfm.pro +++ b/noncore/apps/advancedfm/advancedfm.pro | |||
@@ -1,25 +1,25 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | HEADERS = advancedfm.h inputDialog.h filePermissions.h output.h | 3 | HEADERS = advancedfm.h inputDialog.h filePermissions.h output.h |
4 | SOURCES = advancedfm.cpp inputDialog.cpp filePermissions.cpp output.cpp main.cpp | 4 | SOURCES = advancedfm.cpp inputDialog.cpp filePermissions.cpp output.cpp main.cpp |
5 | TARGET = advancedfm | 5 | TARGET = advancedfm |
6 | REQUIRES=medium-config | 6 | REQUIRES=medium-config |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | DESTDIR = $(OPIEDIR)/bin | 9 | DESTDIR = $(OPIEDIR)/bin |
10 | LIBS += -lqpe -lopie | 10 | LIBS += -lqpe |
11 | 11 | ||
12 | TRANSLATIONS = ../../../i18n/de/advancedfm.ts \ | 12 | TRANSLATIONS = ../../../i18n/de/advancedfm.ts \ |
13 | ../../../i18n/en/advancedfm.ts \ | 13 | ../../../i18n/en/advancedfm.ts \ |
14 | ../../../i18n/es/advancedfm.ts \ | 14 | ../../../i18n/es/advancedfm.ts \ |
15 | ../../../i18n/fr/advancedfm.ts \ | 15 | ../../../i18n/fr/advancedfm.ts \ |
16 | ../../../i18n/hu/advancedfm.ts \ | 16 | ../../../i18n/hu/advancedfm.ts \ |
17 | ../../../i18n/ja/advancedfm.ts \ | 17 | ../../../i18n/ja/advancedfm.ts \ |
18 | ../../../i18n/ko/advancedfm.ts \ | 18 | ../../../i18n/ko/advancedfm.ts \ |
19 | ../../../i18n/no/advancedfm.ts \ | 19 | ../../../i18n/no/advancedfm.ts \ |
20 | ../../../i18n/pl/advancedfm.ts \ | 20 | ../../../i18n/pl/advancedfm.ts \ |
21 | ../../../i18n/pt/advancedfm.ts \ | 21 | ../../../i18n/pt/advancedfm.ts \ |
22 | ../../../i18n/pt_BR/advancedfm.ts \ | 22 | ../../../i18n/pt_BR/advancedfm.ts \ |
23 | ../../../i18n/sl/advancedfm.ts \ | 23 | ../../../i18n/sl/advancedfm.ts \ |
24 | ../../../i18n/zh_CN/advancedfm.ts \ | 24 | ../../../i18n/zh_CN/advancedfm.ts \ |
25 | ../../../i18n/zh_TW/advancedfm.ts | 25 | ../../../i18n/zh_TW/advancedfm.ts |