author | drw <drw> | 2004-02-23 18:27:31 (UTC) |
---|---|---|
committer | drw <drw> | 2004-02-23 18:27:31 (UTC) |
commit | bce2a9995fa423f9fc796b46c548e47a45c9d247 (patch) (unidiff) | |
tree | d6af972e78fa2ca9721172a14ce2d83bae35c2bd /noncore | |
parent | 398c7d54acfc203ec90644d6c63e5b200391e906 (diff) | |
download | opie-bce2a9995fa423f9fc796b46c548e47a45c9d247.zip opie-bce2a9995fa423f9fc796b46c548e47a45c9d247.tar.gz opie-bce2a9995fa423f9fc796b46c548e47a45c9d247.tar.bz2 |
AdvancedFM: libopie->libopie2
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 206 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 12 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.pro | 10 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 161 | ||||
-rw-r--r-- | noncore/apps/advancedfm/config.in | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/main.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/advancedfm/opie-advancedfm.control | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/output.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/output.h | 18 |
10 files changed, 209 insertions, 222 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 9c13e53..5148172 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -3,30 +3,24 @@ | |||
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 | |||
16 | // #include <opie/ofileselector.h> | ||
17 | // #include <opie/ofiledialog.h> | ||
18 | |||
19 | #include <opie/osplitter.h> | ||
20 | |||
21 | #include <qpe/filemanager.h> | 15 | #include <qpe/filemanager.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 16 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/qpeapplication.h> | 17 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
25 | #include <qpe/mimetype.h> | 19 | #include <qpe/mimetype.h> |
26 | #include <qpe/applnk.h> | 20 | #include <qpe/applnk.h> |
27 | #include <qpe/ir.h> | 21 | #include <qpe/ir.h> |
28 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
29 | #include <qpe/menubutton.h> | 23 | #include <qpe/menubutton.h> |
30 | 24 | ||
31 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
32 | #include <qfile.h> | 26 | #include <qfile.h> |
@@ -99,131 +93,131 @@ void AdvancedFm::tabChanged(QWidget *) { | |||
99 | 93 | ||
100 | QString fs= getFileSystemType( (const QString &) path); | 94 | QString fs= getFileSystemType( (const QString &) path); |
101 | 95 | ||
102 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 96 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
103 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); | 97 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); |
104 | chdir( path.latin1()); | 98 | chdir( path.latin1()); |
105 | } | 99 | } |
106 | 100 | ||
107 | 101 | ||
108 | void AdvancedFm::populateView() { | 102 | void AdvancedFm::populateView() { |
109 | 103 | ||
110 | // qWarning("PopulateView"); | 104 | // qWarning("PopulateView"); |
111 | QPixmap pm; | 105 | QPixmap pm; |
112 | QListView *thisView = CurrentView(); | 106 | QListView *thisView = CurrentView(); |
113 | QDir *thisDir = CurrentDir(); | 107 | QDir *thisDir = CurrentDir(); |
114 | QString path = thisDir->canonicalPath(); | 108 | QString path = thisDir->canonicalPath(); |
115 | 109 | ||
116 | //qWarning("path is "+path); | 110 | //qWarning("path is "+path); |
117 | thisView->clear(); | 111 | thisView->clear(); |
118 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 112 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
119 | thisDir->setMatchAllDirs(TRUE); | 113 | thisDir->setMatchAllDirs(TRUE); |
120 | thisDir->setNameFilter(filterStr); | 114 | thisDir->setNameFilter(filterStr); |
121 | QString fileL, fileS, fileDate; | 115 | QString fileL, fileS, fileDate; |
122 | QString fs= getFileSystemType((const QString &) path); | 116 | QString fs= getFileSystemType((const QString &) path); |
123 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 117 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
124 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); | 118 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); |
125 | bool isDir=FALSE; | 119 | bool isDir=FALSE; |
126 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 120 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
127 | QFileInfoListIterator it(*list); | 121 | QFileInfoListIterator it(*list); |
128 | QFileInfo *fi; | 122 | QFileInfo *fi; |
129 | while ( (fi=it.current()) ) { | 123 | while ( (fi=it.current()) ) { |
130 | if (fi->isSymLink() ) { | 124 | if (fi->isSymLink() ) { |
131 | QString symLink=fi->readLink(); | 125 | QString symLink=fi->readLink(); |
132 | QFileInfo sym( symLink); | 126 | QFileInfo sym( symLink); |
133 | fileS.sprintf( "%10i", sym.size() ); | 127 | fileS.sprintf( "%10i", sym.size() ); |
134 | fileL = fi->fileName() +" -> " + sym.filePath().data(); | 128 | fileL = fi->fileName() +" -> " + sym.filePath().data(); |
135 | fileDate = sym.lastModified().toString(); | 129 | fileDate = sym.lastModified().toString(); |
136 | } else { | 130 | } else { |
137 | fileS.sprintf( "%10i", fi->size() ); | 131 | fileS.sprintf( "%10i", fi->size() ); |
138 | fileL = fi->fileName(); | 132 | fileL = fi->fileName(); |
139 | fileDate= fi->lastModified().toString(); | 133 | fileDate= fi->lastModified().toString(); |
140 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { | 134 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { |
141 | // if(fileL == "..") | 135 | // if(fileL == "..") |
142 | fileL += "/"; | 136 | fileL += "/"; |
143 | isDir=TRUE; | 137 | isDir=TRUE; |
144 | } | 138 | } |
145 | } | 139 | } |
146 | QFileInfo fileInfo( path + "/" + fileL); | 140 | QFileInfo fileInfo( path + "/" + fileL); |
147 | 141 | ||
148 | if(fileL !="./" && fi->exists()) { | 142 | if(fileL !="./" && fi->exists()) { |
149 | item = new QListViewItem( thisView, fileL, fileS , fileDate); | 143 | item = new QListViewItem( thisView, fileL, fileS , fileDate); |
150 | 144 | ||
151 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 145 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
152 | 146 | ||
153 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 147 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
154 | pm = Resource::loadPixmap( "lockedfolder" ); | 148 | pm = Resource::loadPixmap( "lockedfolder" ); |
155 | else | 149 | else |
156 | pm= Resource::loadPixmap( "folder" ); | 150 | pm= Resource::loadPixmap( "folder" ); |
157 | } | 151 | } |
158 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 152 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
159 | pm = Resource::loadPixmap( "exec"); | 153 | pm = Resource::loadPixmap( "exec"); |
160 | } | 154 | } |
161 | else if( (fileInfo.permission( QFileInfo::ExeUser) | 155 | else if( (fileInfo.permission( QFileInfo::ExeUser) |
162 | | fileInfo.permission( QFileInfo::ExeGroup) | 156 | | fileInfo.permission( QFileInfo::ExeGroup) |
163 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 157 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
164 | pm = Resource::loadPixmap( "exec"); | 158 | pm = Resource::loadPixmap( "exec"); |
165 | } | 159 | } |
166 | else if( !fi->isReadable() ) { | 160 | else if( !fi->isReadable() ) { |
167 | pm = Resource::loadPixmap( "locked" ); | 161 | pm = Resource::loadPixmap( "locked" ); |
168 | } | 162 | } |
169 | else { //everything else goes by mimetype | 163 | else { //everything else goes by mimetype |
170 | MimeType mt(fi->filePath()); | 164 | MimeType mt(fi->filePath()); |
171 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 165 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
172 | if(pm.isNull()) { | 166 | if(pm.isNull()) { |
173 | pm = unknownXpm; | 167 | pm = unknownXpm; |
174 | } | 168 | } |
175 | } | 169 | } |
176 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { | 170 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { |
177 | // qDebug(" overlay link image"); | 171 | // qDebug(" overlay link image"); |
178 | pm= Resource::loadPixmap( "advancedfm/symlink" ); | 172 | pm= Resource::loadPixmap( "advancedfm/symlink" ); |
179 | // pm= Resource::loadPixmap( "folder" ); | 173 | // pm= Resource::loadPixmap( "folder" ); |
180 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 174 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
181 | // QPainter painter( &pm ); | 175 | // QPainter painter( &pm ); |
182 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 176 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
183 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); | 177 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); |
184 | } | 178 | } |
185 | item->setPixmap( 0,pm); | 179 | item->setPixmap( 0,pm); |
186 | 180 | ||
187 | } | 181 | } |
188 | isDir=FALSE; | 182 | isDir=FALSE; |
189 | ++it; | 183 | ++it; |
190 | } | 184 | } |
191 | 185 | ||
192 | if( path.find("dev",0,TRUE) != -1) { | 186 | if( path.find("dev",0,TRUE) != -1) { |
193 | struct stat buf; | 187 | struct stat buf; |
194 | dev_t devT; | 188 | dev_t devT; |
195 | DIR *dir; | 189 | DIR *dir; |
196 | struct dirent *mydirent; | 190 | struct dirent *mydirent; |
197 | 191 | ||
198 | if((dir = opendir( path.latin1())) != NULL) | 192 | if((dir = opendir( path.latin1())) != NULL) |
199 | while ((mydirent = readdir(dir)) != NULL) { | 193 | while ((mydirent = readdir(dir)) != NULL) { |
200 | lstat( mydirent->d_name, &buf); | 194 | lstat( mydirent->d_name, &buf); |
201 | // qDebug(mydirent->d_name); | 195 | // qDebug(mydirent->d_name); |
202 | fileL.sprintf("%s", mydirent->d_name); | 196 | fileL.sprintf("%s", mydirent->d_name); |
203 | devT = buf.st_dev; | 197 | devT = buf.st_dev; |
204 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 198 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
205 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 199 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
206 | if( fileL.find(".") == -1 ) { | 200 | if( fileL.find(".") == -1 ) { |
207 | item= new QListViewItem( thisView, fileL, fileS, fileDate); | 201 | item= new QListViewItem( thisView, fileL, fileS, fileDate); |
208 | pm = unknownXpm; | 202 | pm = unknownXpm; |
209 | item->setPixmap( 0,pm); | 203 | item->setPixmap( 0,pm); |
210 | } | 204 | } |
211 | } | 205 | } |
212 | 206 | ||
213 | closedir(dir); | 207 | closedir(dir); |
214 | } | 208 | } |
215 | 209 | ||
216 | thisView->setSorting( 3,FALSE); | 210 | thisView->setSorting( 3,FALSE); |
217 | fillCombo( (const QString &) path ); | 211 | fillCombo( (const QString &) path ); |
218 | } | 212 | } |
219 | 213 | ||
220 | void AdvancedFm::rePopulate() { | 214 | void AdvancedFm::rePopulate() { |
221 | populateView(); | 215 | populateView(); |
222 | setOtherTabCurrent(); | 216 | setOtherTabCurrent(); |
223 | populateView(); | 217 | populateView(); |
224 | 218 | ||
225 | // int tmpTab = whichTab; | 219 | // int tmpTab = whichTab; |
226 | // // qDebug("%d", tmpTab); | 220 | // // qDebug("%d", tmpTab); |
227 | 221 | ||
228 | // for(int i =1; i < 3; i++) { | 222 | // for(int i =1; i < 3; i++) { |
229 | // TabWidget->setCurrentWidget(i - 1); | 223 | // TabWidget->setCurrentWidget(i - 1); |
@@ -774,25 +768,25 @@ void AdvancedFm::gotoCustomDir(const QString &dir) { | |||
774 | gotoDirectory( dir); | 768 | gotoDirectory( dir); |
775 | // if(QDir( curDir).exists() ) | 769 | // if(QDir( curDir).exists() ) |
776 | // { | 770 | // { |
777 | // thisDir->setPath( curDir ); | 771 | // thisDir->setPath( curDir ); |
778 | // chdir( curDir.latin1() ); | 772 | // chdir( curDir.latin1() ); |
779 | // thisDir->cd( curDir, TRUE); | 773 | // thisDir->cd( curDir, TRUE); |
780 | // populateView(); | 774 | // populateView(); |
781 | // } | 775 | // } |
782 | } | 776 | } |
783 | } | 777 | } |
784 | 778 | ||
785 | QDir *AdvancedFm::CurrentDir() { | 779 | QDir *AdvancedFm::CurrentDir() { |
786 | 780 | ||
787 | if ( whichTab == 1) { | 781 | if ( whichTab == 1) { |
788 | return ¤tDir; | 782 | return ¤tDir; |
789 | } else { | 783 | } else { |
790 | return ¤tRemoteDir; | 784 | return ¤tRemoteDir; |
791 | } | 785 | } |
792 | } | 786 | } |
793 | 787 | ||
794 | QDir *AdvancedFm::OtherDir() { | 788 | QDir *AdvancedFm::OtherDir() { |
795 | if ( whichTab == 1) { | 789 | if ( whichTab == 1) { |
796 | return ¤tRemoteDir; | 790 | return ¤tRemoteDir; |
797 | } else { | 791 | } else { |
798 | return ¤tDir; | 792 | return ¤tDir; |
@@ -815,25 +809,25 @@ QListView * AdvancedFm::OtherView() { | |||
815 | else | 809 | else |
816 | return Local_View; | 810 | return Local_View; |
817 | } | 811 | } |
818 | 812 | ||
819 | void AdvancedFm::setOtherTabCurrent() { | 813 | void AdvancedFm::setOtherTabCurrent() { |
820 | // qWarning("setOtherTabCurrent() %d", whichTab); | 814 | // qWarning("setOtherTabCurrent() %d", whichTab); |
821 | if ( whichTab == 1) { | 815 | if ( whichTab == 1) { |
822 | TabWidget->setCurrentWidget(1); | 816 | TabWidget->setCurrentWidget(1); |
823 | } else { | 817 | } else { |
824 | TabWidget->setCurrentWidget(0); | 818 | TabWidget->setCurrentWidget(0); |
825 | } | 819 | } |
826 | OtherView()->setFocus(); | 820 | OtherView()->setFocus(); |
827 | OtherView()->setSelected( CurrentView()->firstChild(), true); | 821 | OtherView()->setSelected( CurrentView()->firstChild(), true); |
828 | } | 822 | } |
829 | 823 | ||
830 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { | 824 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { |
831 | // qDebug("qcop message "+msg ); | 825 | // qDebug("qcop message "+msg ); |
832 | QDataStream stream ( data, IO_ReadOnly ); | 826 | QDataStream stream ( data, IO_ReadOnly ); |
833 | if ( msg == "openDirectory(QString)" ) { | 827 | if ( msg == "openDirectory(QString)" ) { |
834 | // qDebug("received"); | 828 | // qDebug("received"); |
835 | QString file; | 829 | QString file; |
836 | stream >> file; | 830 | stream >> file; |
837 | gotoDirectory( (const QString &) file); | 831 | gotoDirectory( (const QString &) file); |
838 | } | 832 | } |
839 | } | 833 | } |
@@ -855,25 +849,25 @@ void AdvancedFm::gotoDirectory(const QString &file) { | |||
855 | } | 849 | } |
856 | else if(QFileInfo(curDir).exists()) { | 850 | else if(QFileInfo(curDir).exists()) { |
857 | QFileInfo fileInfo(curDir); | 851 | QFileInfo fileInfo(curDir); |
858 | curDir=fileInfo.dirPath(); | 852 | curDir=fileInfo.dirPath(); |
859 | if(QDir( curDir).exists() ) { | 853 | if(QDir( curDir).exists() ) { |
860 | thisDir->setPath( curDir ); | 854 | thisDir->setPath( curDir ); |
861 | chdir( curDir.latin1() ); | 855 | chdir( curDir.latin1() ); |
862 | thisDir->cd( curDir, TRUE); | 856 | thisDir->cd( curDir, TRUE); |
863 | populateView(); | 857 | populateView(); |
864 | } | 858 | } |
865 | findFile(file); | 859 | findFile(file); |
866 | } | 860 | } |
867 | 861 | ||
868 | } | 862 | } |
869 | 863 | ||
870 | void AdvancedFm::findFile(const QString &fileName) { | 864 | void AdvancedFm::findFile(const QString &fileName) { |
871 | QFileInfo fi(fileName); | 865 | QFileInfo fi(fileName); |
872 | QListView *thisView = CurrentView(); | 866 | QListView *thisView = CurrentView(); |
873 | QListViewItemIterator it( thisView ); | 867 | QListViewItemIterator it( thisView ); |
874 | for ( ; it.current(); ++it ) { | 868 | for ( ; it.current(); ++it ) { |
875 | if(it.current()->text(0) == fi.fileName()) { | 869 | if(it.current()->text(0) == fi.fileName()) { |
876 | it.current()->setSelected(true); | 870 | it.current()->setSelected(true); |
877 | thisView->ensureItemVisible(it.current()); | 871 | thisView->ensureItemVisible(it.current()); |
878 | } | 872 | } |
879 | } | 873 | } |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index bfefa77..547fa7c 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -5,51 +5,51 @@ | |||
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 | #ifndef ADVANCEDFM_H | 12 | #ifndef ADVANCEDFM_H |
13 | #define ADVANCEDFM_H | 13 | #define ADVANCEDFM_H |
14 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties | 14 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties |
15 | #define QT_QWS_OPIE | 15 | #define QT_QWS_OPIE |
16 | 16 | ||
17 | //#include <opie/otabwidget.h> | 17 | #include <opie2/oprocess.h> |
18 | #include <opie/oprocess.h> | 18 | #include <opie2/osplitter.h> |
19 | 19 | ||
20 | #include <qpe/ir.h> | 20 | #include <qpe/ir.h> |
21 | #include <qpe/qcopenvelope_qws.h> | 21 | #include <qpe/qcopenvelope_qws.h> |
22 | 22 | ||
23 | #include <qvariant.h> | 23 | #include <qvariant.h> |
24 | #include <qdialog.h> | 24 | #include <qdialog.h> |
25 | #include <qmainwindow.h> | 25 | #include <qmainwindow.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | #include <qdir.h> | 27 | #include <qdir.h> |
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | #include <qpoint.h> | 29 | #include <qpoint.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qpixmap.h> | 31 | #include <qpixmap.h> |
32 | 32 | ||
33 | class OSplitter; | 33 | using Opie::OSplitter; |
34 | |||
34 | class QVBoxLayout; | 35 | class QVBoxLayout; |
35 | class QHBoxLayout; | 36 | class QHBoxLayout; |
36 | class QGridLayout; | 37 | class QGridLayout; |
37 | class QComboBox; | 38 | class QComboBox; |
38 | class QListView; | 39 | class QListView; |
39 | class QListviewItem; | 40 | class QListviewItem; |
40 | class QLabel; | 41 | class QLabel; |
41 | class QProgressBar; | 42 | class QProgressBar; |
42 | class QSpinBox; | 43 | class QSpinBox; |
43 | class QTabWidget; | ||
44 | class QWidget; | 44 | class QWidget; |
45 | class QPopupMenu; | 45 | class QPopupMenu; |
46 | class QFile; | 46 | class QFile; |
47 | class QListViewItem; | 47 | class QListViewItem; |
48 | class QLineEdit; | 48 | class QLineEdit; |
49 | class MenuButton; | 49 | class MenuButton; |
50 | 50 | ||
51 | class QToolButton; | 51 | class QToolButton; |
52 | class Ir; | 52 | class Ir; |
53 | 53 | ||
54 | class AdvancedFm : public QMainWindow | 54 | class AdvancedFm : public QMainWindow |
55 | { | 55 | { |
@@ -152,41 +152,41 @@ protected slots: | |||
152 | void copyAs(); | 152 | void copyAs(); |
153 | void copySameDir(); | 153 | void copySameDir(); |
154 | void currentPathComboActivated(const QString &); | 154 | void currentPathComboActivated(const QString &); |
155 | void fillCombo(const QString &); | 155 | void fillCombo(const QString &); |
156 | bool copyFile( const QString & , const QString & ); | 156 | bool copyFile( const QString & , const QString & ); |
157 | void move(); | 157 | void move(); |
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 | // void slotSwitchtoLocal(int); | 165 | // void slotSwitchtoLocal(int); |
166 | 166 | ||
167 | private: | 167 | private: |
168 | MenuButton *menuButton; | 168 | MenuButton *menuButton; |
169 | QString oldName; | 169 | QString oldName; |
170 | QTimer menuTimer; | 170 | QTimer menuTimer; |
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 gotoDirectory(const QString &); | 179 | void gotoDirectory(const QString &); |
180 | void navigateToSelected(); | 180 | void navigateToSelected(); |
181 | void findFile(const QString &); | 181 | void findFile(const QString &); |
182 | 182 | ||
183 | private slots: | 183 | private slots: |
184 | void processEnded(OProcess *); | 184 | void processEnded(OProcess *); |
185 | void oprocessStderr(OProcess *, char *, int); | 185 | void oprocessStderr(OProcess *, char *, int); |
186 | void gotoCustomDir(const QString &); | 186 | void gotoCustomDir(const QString &); |
187 | void qcopReceive(const QCString&, const QByteArray&); | 187 | void qcopReceive(const QCString&, const QByteArray&); |
188 | void setDocument(const QString &); | 188 | void setDocument(const QString &); |
189 | 189 | ||
190 | }; | 190 | }; |
191 | 191 | ||
192 | #endif // ADVANCEDFM_H | 192 | #endif // ADVANCEDFM_H |
diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro index 70db018..ca9856b 100644 --- a/noncore/apps/advancedfm/advancedfm.pro +++ b/noncore/apps/advancedfm/advancedfm.pro | |||
@@ -1,35 +1,35 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG += qt warn_on release quick-app | 2 | CONFIG += qt warn_on release quick-app |
3 | # CONFIG += qt warn_on release | 3 | # CONFIG += qt warn_on release |
4 | HEADERS = advancedfm.h filePermissions.h output.h | 4 | HEADERS = advancedfm.h filePermissions.h output.h |
5 | SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp | 5 | SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp |
6 | TARGET = advancedfm | 6 | TARGET = advancedfm |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe -lopie | 9 | LIBS += -lqpe -lopiecore2 -lopieui2 |
10 | 10 | ||
11 | TRANSLATIONS = ../../../i18n/de/advancedfm.ts \ | 11 | TRANSLATIONS = ../../../i18n/de/advancedfm.ts \ |
12 | ../../../i18n/nl/advancedfm.ts \ | 12 | ../../../i18n/nl/advancedfm.ts \ |
13 | ../../../i18n/da/advancedfm.ts \ | 13 | ../../../i18n/da/advancedfm.ts \ |
14 | ../../../i18n/xx/advancedfm.ts \ | 14 | ../../../i18n/xx/advancedfm.ts \ |
15 | ../../../i18n/en/advancedfm.ts \ | 15 | ../../../i18n/en/advancedfm.ts \ |
16 | ../../../i18n/es/advancedfm.ts \ | 16 | ../../../i18n/es/advancedfm.ts \ |
17 | ../../../i18n/fr/advancedfm.ts \ | 17 | ../../../i18n/fr/advancedfm.ts \ |
18 | ../../../i18n/hu/advancedfm.ts \ | 18 | ../../../i18n/hu/advancedfm.ts \ |
19 | ../../../i18n/ja/advancedfm.ts \ | 19 | ../../../i18n/ja/advancedfm.ts \ |
20 | ../../../i18n/ko/advancedfm.ts \ | 20 | ../../../i18n/ko/advancedfm.ts \ |
21 | ../../../i18n/no/advancedfm.ts \ | 21 | ../../../i18n/no/advancedfm.ts \ |
22 | ../../../i18n/pl/advancedfm.ts \ | 22 | ../../../i18n/pl/advancedfm.ts \ |
23 | ../../../i18n/pt/advancedfm.ts \ | 23 | ../../../i18n/pt/advancedfm.ts \ |
24 | ../../../i18n/pt_BR/advancedfm.ts \ | 24 | ../../../i18n/pt_BR/advancedfm.ts \ |
25 | ../../../i18n/sl/advancedfm.ts \ | 25 | ../../../i18n/sl/advancedfm.ts \ |
26 | ../../../i18n/zh_CN/advancedfm.ts \ | 26 | ../../../i18n/zh_CN/advancedfm.ts \ |
27 | ../../../i18n/zh_TW/advancedfm.ts | 27 | ../../../i18n/zh_TW/advancedfm.ts |
28 | 28 | ||
29 | 29 | ||
30 | !contains(CONFIG,quick-app) { | 30 | !contains(CONFIG,quick-app) { |
31 | DESTDIR = $(OPIEDIR)/bin | 31 | DESTDIR = $(OPIEDIR)/bin |
32 | DEFINES += NOQUICKLAUNCH | 32 | DEFINES += NOQUICKLAUNCH |
33 | } | 33 | } |
34 | 34 | ||
35 | include ( $(OPIEDIR)/include.pro ) | 35 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index ddaa39a..763ae34 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -2,27 +2,25 @@ | |||
2 | advancedfmData.cpp | 2 | advancedfmData.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Mon 09-23-2002 13:24:11 | 4 | ** Created: Mon 09-23-2002 13:24:11 |
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 | #include "advancedfm.h" | 12 | #include "advancedfm.h" |
13 | 13 | ||
14 | #include <opie/osplitter.h> | ||
15 | #include <qpe/storage.h> | 14 | #include <qpe/storage.h> |
16 | |||
17 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
18 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
19 | #include <qpe/menubutton.h> | 17 | #include <qpe/menubutton.h> |
20 | 18 | ||
21 | #include <qlayout.h> | 19 | #include <qlayout.h> |
22 | #include <qhbox.h> | 20 | #include <qhbox.h> |
23 | #include <qmenubar.h> | 21 | #include <qmenubar.h> |
24 | #include <qcombobox.h> | 22 | #include <qcombobox.h> |
25 | #include <qtoolbutton.h> | 23 | #include <qtoolbutton.h> |
26 | #include <qlineedit.h> | 24 | #include <qlineedit.h> |
27 | #include <qlistview.h> | 25 | #include <qlistview.h> |
28 | 26 | ||
@@ -120,73 +118,73 @@ void AdvancedFm::init() { | |||
120 | menuButton->setUseLabel(false); | 118 | menuButton->setUseLabel(false); |
121 | menuButton->setMaximumWidth( 20 ); | 119 | menuButton->setMaximumWidth( 20 ); |
122 | menuButton->insertItem( s_addBookmark); | 120 | menuButton->insertItem( s_addBookmark); |
123 | menuButton->insertItem( s_removeBookmark); | 121 | menuButton->insertItem( s_removeBookmark); |
124 | menuButton->insertSeparator(); | 122 | menuButton->insertSeparator(); |
125 | menuButton->setFocusPolicy(NoFocus); | 123 | menuButton->setFocusPolicy(NoFocus); |
126 | 124 | ||
127 | customDirsToMenu(); | 125 | customDirsToMenu(); |
128 | 126 | ||
129 | currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" ); | 127 | currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" ); |
130 | currentPathCombo->setEditable(TRUE); | 128 | currentPathCombo->setEditable(TRUE); |
131 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 129 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
132 | currentPathCombo->setFocusPolicy(NoFocus); | 130 | currentPathCombo->setFocusPolicy(NoFocus); |
133 | layout->addWidget( lineBox ); | 131 | layout->addWidget( lineBox ); |
134 | 132 | ||
135 | 133 | ||
136 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); | 134 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); |
137 | // TabWidget = new QTabWidget( this, "TabWidget" ); | 135 | // TabWidget = new QTabWidget( this, "TabWidget" ); |
138 | layout->addWidget( TabWidget, 4 ); | 136 | layout->addWidget( TabWidget, 4 ); |
139 | 137 | ||
140 | tab = new QWidget( TabWidget, "tab" ); | 138 | tab = new QWidget( TabWidget, "tab" ); |
141 | tabLayout = new QGridLayout( tab ); | 139 | tabLayout = new QGridLayout( tab ); |
142 | tabLayout->setSpacing( 2); | 140 | tabLayout->setSpacing( 2); |
143 | tabLayout->setMargin( 2); | 141 | tabLayout->setMargin( 2); |
144 | 142 | ||
145 | Local_View = new QListView( tab, "Local_View" ); | 143 | Local_View = new QListView( tab, "Local_View" ); |
146 | Local_View->addColumn( tr("File"),130); | 144 | Local_View->addColumn( tr("File"),130); |
147 | Local_View->addColumn( tr("Size"),-1); | 145 | Local_View->addColumn( tr("Size"),-1); |
148 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 146 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
149 | Local_View->addColumn( tr("Date"),-1); | 147 | Local_View->addColumn( tr("Date"),-1); |
150 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 148 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
151 | Local_View->setAllColumnsShowFocus(TRUE); | 149 | Local_View->setAllColumnsShowFocus(TRUE); |
152 | Local_View->setMultiSelection( TRUE ); | 150 | Local_View->setMultiSelection( TRUE ); |
153 | Local_View->setSelectionMode(QListView::Extended); | 151 | Local_View->setSelectionMode(QListView::Extended); |
154 | Local_View->setFocusPolicy(StrongFocus); | 152 | Local_View->setFocusPolicy(StrongFocus); |
155 | Local_View->installEventFilter( this ); | 153 | Local_View->installEventFilter( this ); |
156 | 154 | ||
157 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 155 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
158 | 156 | ||
159 | tabLayout->addWidget( Local_View, 0, 0 ); | 157 | tabLayout->addWidget( Local_View, 0, 0 ); |
160 | 158 | ||
161 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); | 159 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); |
162 | // TabWidget->insertTab( tab, tr("1")); | 160 | // TabWidget->insertTab( tab, tr("1")); |
163 | 161 | ||
164 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 162 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
165 | tabLayout_2 = new QGridLayout( tab_2 ); | 163 | tabLayout_2 = new QGridLayout( tab_2 ); |
166 | tabLayout_2->setSpacing( 2); | 164 | tabLayout_2->setSpacing( 2); |
167 | tabLayout_2->setMargin( 2); | 165 | tabLayout_2->setMargin( 2); |
168 | 166 | ||
169 | Remote_View = new QListView( tab_2, "Remote_View" ); | 167 | Remote_View = new QListView( tab_2, "Remote_View" ); |
170 | Remote_View->addColumn( tr("File"),130); | 168 | Remote_View->addColumn( tr("File"),130); |
171 | Remote_View->addColumn( tr("Size"),-1); | 169 | Remote_View->addColumn( tr("Size"),-1); |
172 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 170 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
173 | Remote_View->addColumn( tr("Date"),-1); | 171 | Remote_View->addColumn( tr("Date"),-1); |
174 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 172 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
175 | Remote_View->setAllColumnsShowFocus(TRUE); | 173 | Remote_View->setAllColumnsShowFocus(TRUE); |
176 | Remote_View->setMultiSelection( TRUE ); | 174 | Remote_View->setMultiSelection( TRUE ); |
177 | Remote_View->setSelectionMode(QListView::Extended); | 175 | Remote_View->setSelectionMode(QListView::Extended); |
178 | Remote_View->setFocusPolicy(StrongFocus); | 176 | Remote_View->setFocusPolicy(StrongFocus); |
179 | Remote_View->installEventFilter( this ); | 177 | Remote_View->installEventFilter( this ); |
180 | 178 | ||
181 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 179 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
182 | 180 | ||
183 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 181 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
184 | 182 | ||
185 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); | 183 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); |
186 | TabWidget->setSizeChange( 370 ); | 184 | TabWidget->setSizeChange( 370 ); |
187 | // TabWidget->insertTab( tab_2, tr( "2")); | 185 | // TabWidget->insertTab( tab_2, tr( "2")); |
188 | 186 | ||
189 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 187 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
190 | tabLayout_3 = new QGridLayout( tab_3 ); | 188 | tabLayout_3 = new QGridLayout( tab_3 ); |
191 | tabLayout_3->setSpacing( 2); | 189 | tabLayout_3->setSpacing( 2); |
192 | tabLayout_3->setMargin( 2); | 190 | tabLayout_3->setMargin( 2); |
@@ -202,25 +200,25 @@ void AdvancedFm::init() { | |||
202 | fileTree = new QListView( tab_3, "tree" ); | 200 | fileTree = new QListView( tab_3, "tree" ); |
203 | 201 | ||
204 | 202 | ||
205 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 203 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
206 | 204 | ||
207 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 205 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
208 | */ | 206 | */ |
209 | 207 | ||
210 | /////////////// | 208 | /////////////// |
211 | 209 | ||
212 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 210 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
213 | zaurusDevice=TRUE; | 211 | zaurusDevice=TRUE; |
214 | else | 212 | else |
215 | zaurusDevice=FALSE; | 213 | zaurusDevice=FALSE; |
216 | 214 | ||
217 | 215 | ||
218 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { | 216 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { |
219 | qDebug("not have sd"); | 217 | qDebug("not have sd"); |
220 | sdButton->hide(); | 218 | sdButton->hide(); |
221 | } | 219 | } |
222 | if( !StorageInfo::hasCf() ) { | 220 | if( !StorageInfo::hasCf() ) { |
223 | qDebug("not have cf"); | 221 | qDebug("not have cf"); |
224 | cfButton->hide(); | 222 | cfButton->hide(); |
225 | } | 223 | } |
226 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 224 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 78f9da2..18bbd43 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -4,27 +4,24 @@ | |||
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 | #include "advancedfm.h" | 12 | #include "advancedfm.h" |
13 | #include "output.h" | 13 | #include "output.h" |
14 | #include "filePermissions.h" | 14 | #include "filePermissions.h" |
15 | 15 | ||
16 | #include <opie/otabwidget.h> | ||
17 | #include <opie/oprocess.h> | ||
18 | |||
19 | #include <qpe/lnkproperties.h> | 16 | #include <qpe/lnkproperties.h> |
20 | #include <qpe/qpeapplication.h> | 17 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/resource.h> | 18 | #include <qpe/resource.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 19 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/applnk.h> | 20 | #include <qpe/applnk.h> |
24 | #include <qpe/ir.h> | 21 | #include <qpe/ir.h> |
25 | 22 | ||
26 | #include <qmessagebox.h> | 23 | #include <qmessagebox.h> |
27 | #include <qmultilineedit.h> | 24 | #include <qmultilineedit.h> |
28 | 25 | ||
29 | #include <qstring.h> | 26 | #include <qstring.h> |
30 | 27 | ||
@@ -60,36 +57,36 @@ void AdvancedFm::doDirChange() { | |||
60 | 57 | ||
61 | void AdvancedFm::showMenuHidden() { | 58 | void AdvancedFm::showMenuHidden() { |
62 | if (b) { | 59 | if (b) { |
63 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 60 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
64 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 61 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
65 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 62 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
66 | } else { | 63 | } else { |
67 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 64 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
68 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 65 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
69 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 66 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
70 | } | 67 | } |
71 | b = !b; | 68 | b = !b; |
72 | populateView(); | 69 | populateView(); |
73 | } | 70 | } |
74 | 71 | ||
75 | void AdvancedFm::showHidden() { | 72 | void AdvancedFm::showHidden() { |
76 | if (b) { | 73 | if (b) { |
77 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 74 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
78 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 75 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
79 | } else { | 76 | } else { |
80 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 77 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
81 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 78 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
82 | } | 79 | } |
83 | populateView(); | 80 | populateView(); |
84 | } | 81 | } |
85 | 82 | ||
86 | QString AdvancedFm::dealWithSymName(const QString &fileName) { | 83 | QString AdvancedFm::dealWithSymName(const QString &fileName) { |
87 | QString strItem = fileName; | 84 | QString strItem = fileName; |
88 | return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 85 | return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
89 | } | 86 | } |
90 | 87 | ||
91 | void AdvancedFm::runThis() { | 88 | void AdvancedFm::runThis() { |
92 | if( !CurrentView()->currentItem()) return; | 89 | if( !CurrentView()->currentItem()) return; |
93 | QString fs; | 90 | QString fs; |
94 | QDir *thisDir = CurrentDir(); | 91 | QDir *thisDir = CurrentDir(); |
95 | 92 | ||
@@ -137,25 +134,25 @@ void AdvancedFm::runText() { | |||
137 | } | 134 | } |
138 | } | 135 | } |
139 | 136 | ||
140 | void AdvancedFm::makeDir() { | 137 | void AdvancedFm::makeDir() { |
141 | InputDialog *fileDlg; | 138 | InputDialog *fileDlg; |
142 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 139 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
143 | fileDlg->exec(); | 140 | fileDlg->exec(); |
144 | if( fileDlg->result() == 1 ) { | 141 | if( fileDlg->result() == 1 ) { |
145 | QDir *thisDir = CurrentDir(); | 142 | QDir *thisDir = CurrentDir(); |
146 | QString filename = fileDlg->LineEdit1->text(); | 143 | QString filename = fileDlg->LineEdit1->text(); |
147 | thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); | 144 | thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); |
148 | } | 145 | } |
149 | populateView(); | 146 | populateView(); |
150 | } | 147 | } |
151 | 148 | ||
152 | void AdvancedFm::doDelete() { | 149 | void AdvancedFm::doDelete() { |
153 | QStringList curFileList = getPath(); | 150 | QStringList curFileList = getPath(); |
154 | bool doMsg=true; | 151 | bool doMsg=true; |
155 | int count = curFileList.count(); | 152 | int count = curFileList.count(); |
156 | if( count > 0) { | 153 | if( count > 0) { |
157 | if(count > 1 ) { | 154 | if(count > 1 ) { |
158 | QString msg; | 155 | QString msg; |
159 | msg=tr("Really delete\n%1 files?").arg(count); | 156 | msg=tr("Really delete\n%1 files?").arg(count); |
160 | switch ( QMessageBox::warning(this,tr("Delete"),msg | 157 | switch ( QMessageBox::warning(this,tr("Delete"),msg |
161 | ,tr("Yes"),tr("No"),0,0,1) ) | 158 | ,tr("Yes"),tr("No"),0,0,1) ) |
@@ -174,86 +171,86 @@ void AdvancedFm::doDelete() { | |||
174 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 171 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
175 | myFile = (*it); | 172 | myFile = (*it); |
176 | if( myFile.find(" -> ",0,TRUE) != -1) | 173 | if( myFile.find(" -> ",0,TRUE) != -1) |
177 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 174 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
178 | 175 | ||
179 | QString f = CurrentDir()->canonicalPath(); | 176 | QString f = CurrentDir()->canonicalPath(); |
180 | if(f.right(1).find("/",0,TRUE) == -1) | 177 | if(f.right(1).find("/",0,TRUE) == -1) |
181 | f += "/"; | 178 | f += "/"; |
182 | f += myFile; | 179 | f += myFile; |
183 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 180 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
184 | //if file is a directory | 181 | //if file is a directory |
185 | 182 | ||
186 | switch ( QMessageBox::warning( this, tr("Delete Directory?"), | 183 | switch ( QMessageBox::warning( this, tr("Delete Directory?"), |
187 | tr("Really delete %1\nand all it's contents ?" ).arg( f ) , | 184 | tr("Really delete %1\nand all it's contents ?" ).arg( f ) , |
188 | tr("Yes"), tr("No"), 0, 0, 1) ) { | 185 | tr("Yes"), tr("No"), 0, 0, 1) ) { |
189 | case 0: | 186 | case 0: |
190 | { | 187 | { |
191 | f=f.left(f.length()-1); | 188 | f=f.left(f.length()-1); |
192 | QString cmd="rm -rf "+f; | 189 | QString cmd="rm -rf "+f; |
193 | startProcess( (const QString)cmd.latin1() ); | 190 | startProcess( (const QString)cmd.latin1() ); |
194 | populateView(); | 191 | populateView(); |
195 | } | 192 | } |
196 | break; | 193 | break; |
197 | case 1: | 194 | case 1: |
198 | // exit | 195 | // exit |
199 | break; | 196 | break; |
200 | }; | 197 | }; |
201 | 198 | ||
202 | } else { | 199 | } else { |
203 | if(doMsg) { | 200 | if(doMsg) { |
204 | switch ( QMessageBox::warning(this,tr("Delete"), | 201 | switch ( QMessageBox::warning(this,tr("Delete"), |
205 | tr("Really delete\n%1?").arg( myFile ), | 202 | tr("Really delete\n%1?").arg( myFile ), |
206 | tr("Yes"), tr("No"), 0, 0, 1) ) { | 203 | tr("Yes"), tr("No"), 0, 0, 1) ) { |
207 | case 1: | 204 | case 1: |
208 | return; | 205 | return; |
209 | break; | 206 | break; |
210 | }; | 207 | }; |
211 | } | 208 | } |
212 | 209 | ||
213 | QString cmd="rm "+f; | 210 | QString cmd="rm "+f; |
214 | QFile file(f); | 211 | QFile file(f); |
215 | QFileInfo fi(myFile); | 212 | QFileInfo fi(myFile); |
216 | if( fi.fileName().find("../",0,TRUE)==-1) { | 213 | if( fi.fileName().find("../",0,TRUE)==-1) { |
217 | // qDebug("remove link files "+myFile); | 214 | // qDebug("remove link files "+myFile); |
218 | 215 | ||
219 | // DocLnk lnk(f); | 216 | // DocLnk lnk(f); |
220 | DocLnk *lnk; | 217 | DocLnk *lnk; |
221 | lnk = new DocLnk(f); | 218 | lnk = new DocLnk(f); |
222 | // qDebug("Deleting doclnk " + lnk->linkFile()); | 219 | // qDebug("Deleting doclnk " + lnk->linkFile()); |
223 | if(lnk->isValid()) | 220 | if(lnk->isValid()) |
224 | lnk->removeLinkFile(); | 221 | lnk->removeLinkFile(); |
225 | // delete lnk; | 222 | // delete lnk; |
226 | file.remove(); | 223 | file.remove(); |
227 | } | 224 | } |
228 | } | 225 | } |
229 | } | 226 | } |
230 | } | 227 | } |
231 | populateView(); | 228 | populateView(); |
232 | } | 229 | } |
233 | 230 | ||
234 | void AdvancedFm::filePerms() { | 231 | void AdvancedFm::filePerms() { |
235 | QStringList curFileList = getPath(); | 232 | QStringList curFileList = getPath(); |
236 | QString filePath; | 233 | QString filePath; |
237 | 234 | ||
238 | filePath = CurrentDir()->canonicalPath()+"/"; | 235 | filePath = CurrentDir()->canonicalPath()+"/"; |
239 | 236 | ||
240 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 237 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
241 | filePermissions *filePerm; | 238 | filePermissions *filePerm; |
242 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 239 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
243 | QPEApplication::execDialog( filePerm ); | 240 | QPEApplication::execDialog( filePerm ); |
244 | if( filePerm ) | 241 | if( filePerm ) |
245 | delete filePerm; | 242 | delete filePerm; |
246 | } | 243 | } |
247 | populateView(); | 244 | populateView(); |
248 | } | 245 | } |
249 | 246 | ||
250 | void AdvancedFm::doProperties() { | 247 | void AdvancedFm::doProperties() { |
251 | #if defined(QT_QWS_OPIE) | 248 | #if defined(QT_QWS_OPIE) |
252 | 249 | ||
253 | QStringList curFileList = getPath(); | 250 | QStringList curFileList = getPath(); |
254 | 251 | ||
255 | QString filePath; | 252 | QString filePath; |
256 | filePath = CurrentDir()->canonicalPath()+"/"; | 253 | filePath = CurrentDir()->canonicalPath()+"/"; |
257 | 254 | ||
258 | // qDebug("%d",curFileList.count()); | 255 | // qDebug("%d",curFileList.count()); |
259 | 256 | ||
@@ -267,25 +264,25 @@ void AdvancedFm::doProperties() { | |||
267 | 264 | ||
268 | } | 265 | } |
269 | 266 | ||
270 | void AdvancedFm::upDir() { | 267 | void AdvancedFm::upDir() { |
271 | QDir *thisDir = CurrentDir(); | 268 | QDir *thisDir = CurrentDir(); |
272 | QString current = thisDir->canonicalPath(); | 269 | QString current = thisDir->canonicalPath(); |
273 | QDir dir(current); | 270 | QDir dir(current); |
274 | dir.cdUp(); | 271 | dir.cdUp(); |
275 | current = dir.canonicalPath(); | 272 | current = dir.canonicalPath(); |
276 | chdir( current.latin1() ); | 273 | chdir( current.latin1() ); |
277 | thisDir->cd( current, TRUE); | 274 | thisDir->cd( current, TRUE); |
278 | 275 | ||
279 | populateView(); | 276 | populateView(); |
280 | update(); | 277 | update(); |
281 | } | 278 | } |
282 | 279 | ||
283 | void AdvancedFm::copy() { | 280 | void AdvancedFm::copy() { |
284 | qApp->processEvents(); | 281 | qApp->processEvents(); |
285 | QStringList curFileList = getPath(); | 282 | QStringList curFileList = getPath(); |
286 | 283 | ||
287 | QDir *thisDir = CurrentDir(); | 284 | QDir *thisDir = CurrentDir(); |
288 | QDir *thatDir = OtherDir(); | 285 | QDir *thatDir = OtherDir(); |
289 | 286 | ||
290 | bool doMsg=true; | 287 | bool doMsg=true; |
291 | int count=curFileList.count(); | 288 | int count=curFileList.count(); |
@@ -328,26 +325,26 @@ void AdvancedFm::copy() { | |||
328 | break; | 325 | break; |
329 | }; | 326 | }; |
330 | } | 327 | } |
331 | f.remove(); | 328 | f.remove(); |
332 | } | 329 | } |
333 | 330 | ||
334 | if( !copyFile( curFile, destFile) ) { | 331 | if( !copyFile( curFile, destFile) ) { |
335 | QMessageBox::message("AdvancedFm", | 332 | QMessageBox::message("AdvancedFm", |
336 | tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) ); | 333 | tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) ); |
337 | return; | 334 | return; |
338 | } | 335 | } |
339 | } | 336 | } |
340 | setOtherTabCurrent(); | 337 | setOtherTabCurrent(); |
341 | rePopulate(); | 338 | rePopulate(); |
342 | } | 339 | } |
343 | } | 340 | } |
344 | 341 | ||
345 | void AdvancedFm::copyAs() { | 342 | void AdvancedFm::copyAs() { |
346 | qApp->processEvents(); | 343 | qApp->processEvents(); |
347 | 344 | ||
348 | QStringList curFileList = getPath(); | 345 | QStringList curFileList = getPath(); |
349 | QString curFile, item; | 346 | QString curFile, item; |
350 | InputDialog *fileDlg; | 347 | InputDialog *fileDlg; |
351 | 348 | ||
352 | QDir *thisDir = CurrentDir(); | 349 | QDir *thisDir = CurrentDir(); |
353 | QDir *thatDir = OtherDir(); | 350 | QDir *thatDir = OtherDir(); |
@@ -378,26 +375,26 @@ void AdvancedFm::copyAs() { | |||
378 | break; | 375 | break; |
379 | }; | 376 | }; |
380 | } | 377 | } |
381 | if( !copyFile( curFile, destFile) ) { | 378 | if( !copyFile( curFile, destFile) ) { |
382 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 379 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
383 | +curFile +tr("to\n")+destFile); | 380 | +curFile +tr("to\n")+destFile); |
384 | return; | 381 | return; |
385 | } | 382 | } |
386 | } | 383 | } |
387 | delete fileDlg; | 384 | delete fileDlg; |
388 | 385 | ||
389 | } | 386 | } |
390 | rePopulate(); | 387 | rePopulate(); |
391 | setOtherTabCurrent(); | 388 | setOtherTabCurrent(); |
392 | } | 389 | } |
393 | 390 | ||
394 | void AdvancedFm::copySameDir() { | 391 | void AdvancedFm::copySameDir() { |
395 | qApp->processEvents(); | 392 | qApp->processEvents(); |
396 | QStringList curFileList = getPath(); | 393 | QStringList curFileList = getPath(); |
397 | QString curFile, item, destFile; | 394 | QString curFile, item, destFile; |
398 | InputDialog *fileDlg; | 395 | InputDialog *fileDlg; |
399 | 396 | ||
400 | QDir *thisDir = CurrentDir(); | 397 | QDir *thisDir = CurrentDir(); |
401 | 398 | ||
402 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 399 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
403 | item=(*it); | 400 | item=(*it); |
@@ -427,136 +424,136 @@ void AdvancedFm::copySameDir() { | |||
427 | }; | 424 | }; |
428 | } | 425 | } |
429 | if(!copyFile( curFile,destFile) ) { | 426 | if(!copyFile( curFile,destFile) ) { |
430 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 427 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
431 | +curFile +tr("to\n")+destFile); | 428 | +curFile +tr("to\n")+destFile); |
432 | return; | 429 | return; |
433 | } | 430 | } |
434 | 431 | ||
435 | // qDebug("copy "+curFile+" as "+destFile); | 432 | // qDebug("copy "+curFile+" as "+destFile); |
436 | } | 433 | } |
437 | delete fileDlg; | 434 | delete fileDlg; |
438 | } | 435 | } |
439 | rePopulate(); | 436 | rePopulate(); |
440 | } | 437 | } |
441 | 438 | ||
442 | void AdvancedFm::move() { | 439 | void AdvancedFm::move() { |
443 | qApp->processEvents(); | 440 | qApp->processEvents(); |
444 | 441 | ||
445 | QStringList curFileList = getPath(); | 442 | QStringList curFileList = getPath(); |
446 | if( curFileList.count() > 0) { | 443 | if( curFileList.count() > 0) { |
447 | QString curFile, destFile, item; | 444 | QString curFile, destFile, item; |
448 | 445 | ||
449 | QDir *thisDir = CurrentDir(); | 446 | QDir *thisDir = CurrentDir(); |
450 | QDir *thatDir = OtherDir(); | 447 | QDir *thatDir = OtherDir(); |
451 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 448 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
452 | item=(*it); | 449 | item=(*it); |
453 | QString destFile = thatDir->canonicalPath(); | 450 | QString destFile = thatDir->canonicalPath(); |
454 | 451 | ||
455 | if(destFile.right(1).find("/",0,TRUE) == -1) | 452 | if(destFile.right(1).find("/",0,TRUE) == -1) |
456 | destFile+="/"; | 453 | destFile+="/"; |
457 | destFile += item; | 454 | destFile += item; |
458 | // qDebug("Destination file is "+destFile); | 455 | // qDebug("Destination file is "+destFile); |
459 | 456 | ||
460 | curFile = thisDir->canonicalPath(); | 457 | curFile = thisDir->canonicalPath(); |
461 | if(curFile.right(1).find("/",0,TRUE) == -1) | 458 | if(curFile.right(1).find("/",0,TRUE) == -1) |
462 | curFile +="/"; | 459 | curFile +="/"; |
463 | curFile+= item; | 460 | curFile+= item; |
464 | // qDebug("CurrentFile file is " + curFile); | 461 | // qDebug("CurrentFile file is " + curFile); |
465 | 462 | ||
466 | if(QFileInfo(curFile).isDir()) { | 463 | if(QFileInfo(curFile).isDir()) { |
467 | moveDirectory( curFile, destFile ); | 464 | moveDirectory( curFile, destFile ); |
468 | rePopulate(); | 465 | rePopulate(); |
469 | return; | 466 | return; |
470 | } | 467 | } |
471 | 468 | ||
472 | QFile f( curFile); | 469 | QFile f( curFile); |
473 | if( f.exists()) { | 470 | if( f.exists()) { |
474 | if( !copyFile( curFile, destFile) ) { | 471 | if( !copyFile( curFile, destFile) ) { |
475 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); | 472 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); |
476 | return; | 473 | return; |
477 | } else | 474 | } else |
478 | QFile::remove(curFile); | 475 | QFile::remove(curFile); |
479 | } | 476 | } |
480 | } | 477 | } |
481 | 478 | ||
482 | } | 479 | } |
483 | rePopulate(); | 480 | rePopulate(); |
484 | setOtherTabCurrent(); | 481 | setOtherTabCurrent(); |
485 | } | 482 | } |
486 | 483 | ||
487 | bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { | 484 | bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { |
488 | int err = 0; | 485 | int err = 0; |
489 | if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src; | 486 | if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src; |
490 | err = system((const char*)cmd); | 487 | err = system((const char*)cmd); |
491 | } else | 488 | } else |
492 | err = -1; | 489 | err = -1; |
493 | 490 | ||
494 | if(err!=0) { | 491 | if(err!=0) { |
495 | QMessageBox::message(tr("Note"),tr("Could not move\n") + src); | 492 | QMessageBox::message(tr("Note"),tr("Could not move\n") + src); |
496 | return false; | 493 | return false; |
497 | } | 494 | } |
498 | return true; | 495 | return true; |
499 | } | 496 | } |
500 | 497 | ||
501 | bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { | 498 | bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { |
502 | 499 | ||
503 | QStringcmd = "/bin/cp -fpR " + src + " " + dest; | 500 | QString cmd = "/bin/cp -fpR " + src + " " + dest; |
504 | qWarning(cmd); | 501 | qWarning(cmd); |
505 | interr = system( (const char *) cmd ); | 502 | int err = system( (const char *) cmd ); |
506 | if ( err != 0 ) { | 503 | if ( err != 0 ) { |
507 | QMessageBox::message("AdvancedFm", | 504 | QMessageBox::message("AdvancedFm", |
508 | tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) ); | 505 | tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) ); |
509 | return false; | 506 | return false; |
510 | } | 507 | } |
511 | 508 | ||
512 | return true; | 509 | return true; |
513 | } | 510 | } |
514 | 511 | ||
515 | 512 | ||
516 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { | 513 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { |
517 | 514 | ||
518 | 515 | ||
519 | if(QFileInfo(src).isDir()) { | 516 | if(QFileInfo(src).isDir()) { |
520 | if( copyDirectory( src, dest )) { | 517 | if( copyDirectory( src, dest )) { |
521 | setOtherTabCurrent(); | 518 | setOtherTabCurrent(); |
522 | populateView(); | 519 | populateView(); |
523 | return true; | 520 | return true; |
524 | } | 521 | } |
525 | else | 522 | else |
526 | return false; | 523 | return false; |
527 | } | 524 | } |
528 | 525 | ||
529 | 526 | ||
530 | bool success = true; | 527 | bool success = true; |
531 | struct stat status; | 528 | struct stat status; |
532 | QFile srcFile(src); | 529 | QFile srcFile(src); |
533 | QFile destFile(dest); | 530 | QFile destFile(dest); |
534 | int err=0; | 531 | int err=0; |
535 | int read_fd=0; | 532 | int read_fd=0; |
536 | int write_fd=0; | 533 | int write_fd=0; |
537 | struct stat stat_buf; | 534 | struct stat stat_buf; |
538 | off_t offset = 0; | 535 | off_t offset = 0; |
539 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { | 536 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { |
540 | // qWarning("open failed"); | 537 | // qWarning("open failed"); |
541 | return success = false; | 538 | return success = false; |
542 | } | 539 | } |
543 | read_fd = srcFile.handle(); | 540 | read_fd = srcFile.handle(); |
544 | if(read_fd != -1) { | 541 | if(read_fd != -1) { |
545 | fstat (read_fd, &stat_buf); | 542 | fstat (read_fd, &stat_buf); |
546 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { | 543 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { |
547 | // qWarning("destfile open failed"); | 544 | // qWarning("destfile open failed"); |
548 | return success = false; | 545 | return success = false; |
549 | } | 546 | } |
550 | write_fd = destFile.handle(); | 547 | write_fd = destFile.handle(); |
551 | if(write_fd != -1) { | 548 | if(write_fd != -1) { |
552 | err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); | 549 | err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); |
553 | if( err == -1) { | 550 | if( err == -1) { |
554 | QString msg; | 551 | QString msg; |
555 | switch(err) { | 552 | switch(err) { |
556 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; | 553 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; |
557 | case EINVAL: msg = "Descriptor is not valid or locked. "; | 554 | case EINVAL: msg = "Descriptor is not valid or locked. "; |
558 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; | 555 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; |
559 | case EIO: msg = "Unspecified error while reading from in_fd."; | 556 | case EIO: msg = "Unspecified error while reading from in_fd."; |
560 | }; | 557 | }; |
561 | success = false; | 558 | success = false; |
562 | // qWarning(msg); | 559 | // qWarning(msg); |
@@ -668,27 +665,27 @@ void AdvancedFm::mkSym() { | |||
668 | } | 665 | } |
669 | 666 | ||
670 | QString curFile = thisDir->canonicalPath()+"/"+(*it); | 667 | QString curFile = thisDir->canonicalPath()+"/"+(*it); |
671 | 668 | ||
672 | if( curFile.right(1) == "/") { | 669 | if( curFile.right(1) == "/") { |
673 | curFile = curFile.left( curFile.length() -1); | 670 | curFile = curFile.left( curFile.length() -1); |
674 | } | 671 | } |
675 | 672 | ||
676 | cmd = "ln -s "+curFile+" "+destName; | 673 | cmd = "ln -s "+curFile+" "+destName; |
677 | // qDebug(cmd); | 674 | // qDebug(cmd); |
678 | startProcess( (const QString)cmd ); | 675 | startProcess( (const QString)cmd ); |
679 | } | 676 | } |
680 | rePopulate(); | 677 | rePopulate(); |
681 | setOtherTabCurrent(); | 678 | setOtherTabCurrent(); |
682 | } | 679 | } |
683 | } | 680 | } |
684 | 681 | ||
685 | void AdvancedFm::doBeam() { | 682 | void AdvancedFm::doBeam() { |
686 | Ir ir; | 683 | Ir ir; |
687 | if(!ir.supported()) { | 684 | if(!ir.supported()) { |
688 | } else { | 685 | } else { |
689 | QStringList curFileList = getPath(); | 686 | QStringList curFileList = getPath(); |
690 | if( curFileList.count() > 0) { | 687 | if( curFileList.count() > 0) { |
691 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 688 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
692 | QString curFile = (*it); | 689 | QString curFile = (*it); |
693 | QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; | 690 | QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; |
694 | if( curFilePath.right(1) == "/") { | 691 | if( curFilePath.right(1) == "/") { |
@@ -722,25 +719,25 @@ void AdvancedFm::startProcess(const QString & cmd) { | |||
722 | connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)), | 719 | connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)), |
723 | this, SLOT( oprocessStderr(OProcess *, char *, int))); | 720 | this, SLOT( oprocessStderr(OProcess *, char *, int))); |
724 | 721 | ||
725 | command << "/bin/sh"; | 722 | command << "/bin/sh"; |
726 | command << "-c"; | 723 | command << "-c"; |
727 | command << cmd.latin1(); | 724 | command << cmd.latin1(); |
728 | *process << command; | 725 | *process << command; |
729 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) | 726 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) |
730 | qDebug("could not start process"); | 727 | qDebug("could not start process"); |
731 | } | 728 | } |
732 | 729 | ||
733 | void AdvancedFm::processEnded(OProcess *) { | 730 | void AdvancedFm::processEnded(OProcess *) { |
734 | rePopulate(); | 731 | rePopulate(); |
735 | } | 732 | } |
736 | 733 | ||
737 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { | 734 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { |
738 | // qWarning("received stderrt %d bytes", buflen); | 735 | // qWarning("received stderrt %d bytes", buflen); |
739 | 736 | ||
740 | QString lineStr = buffer; | 737 | QString lineStr = buffer; |
741 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); | 738 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); |
742 | } | 739 | } |
743 | 740 | ||
744 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { | 741 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { |
745 | if ( o->inherits( "QLineEdit" ) ) { | 742 | if ( o->inherits( "QLineEdit" ) ) { |
746 | if ( e->type() == QEvent::KeyPress ) { | 743 | if ( e->type() == QEvent::KeyPress ) { |
@@ -788,63 +785,63 @@ void AdvancedFm::cancelRename() { | |||
788 | view->viewport()->setFocusProxy( view); | 785 | view->viewport()->setFocusProxy( view); |
789 | view->setFocus(); | 786 | view->setFocus(); |
790 | } | 787 | } |
791 | } | 788 | } |
792 | 789 | ||
793 | void AdvancedFm::doRename(QListView * view) { | 790 | void AdvancedFm::doRename(QListView * view) { |
794 | if( !CurrentView()->currentItem()) return; | 791 | if( !CurrentView()->currentItem()) return; |
795 | 792 | ||
796 | QRect r = view->itemRect( view->currentItem( )); | 793 | QRect r = view->itemRect( view->currentItem( )); |
797 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); | 794 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); |
798 | r.setX( view->contentsX() ); | 795 | r.setX( view->contentsX() ); |
799 | 796 | ||
800 | if ( r.width() > view->visibleWidth() ) | 797 | if ( r.width() > view->visibleWidth() ) |
801 | r.setWidth( view->visibleWidth() ); | 798 | r.setWidth( view->visibleWidth() ); |
802 | 799 | ||
803 | renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); | 800 | renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); |
804 | renameBox->setFrame(true); | 801 | renameBox->setFrame(true); |
805 | 802 | ||
806 | renameBox->setText( view->currentItem()->text(0) ); | 803 | renameBox->setText( view->currentItem()->text(0) ); |
807 | 804 | ||
808 | renameBox->selectAll(); | 805 | renameBox->selectAll(); |
809 | renameBox->installEventFilter( this ); | 806 | renameBox->installEventFilter( this ); |
810 | 807 | ||
811 | view->addChild( renameBox, r.x(), r.y() ); | 808 | view->addChild( renameBox, r.x(), r.y() ); |
812 | 809 | ||
813 | renameBox->resize( r.size() ); | 810 | renameBox->resize( r.size() ); |
814 | 811 | ||
815 | view->viewport()->setFocusProxy( renameBox ); | 812 | view->viewport()->setFocusProxy( renameBox ); |
816 | 813 | ||
817 | renameBox->setFocus(); | 814 | renameBox->setFocus(); |
818 | renameBox->show(); | 815 | renameBox->show(); |
819 | } | 816 | } |
820 | 817 | ||
821 | 818 | ||
822 | void AdvancedFm::renameIt() { | 819 | void AdvancedFm::renameIt() { |
823 | if( !CurrentView()->currentItem()) return; | 820 | if( !CurrentView()->currentItem()) return; |
824 | 821 | ||
825 | QListView *thisView = CurrentView(); | 822 | QListView *thisView = CurrentView(); |
826 | oldName = thisView->currentItem()->text(0); | 823 | oldName = thisView->currentItem()->text(0); |
827 | doRename( thisView ); | 824 | doRename( thisView ); |
828 | } | 825 | } |
829 | 826 | ||
830 | void AdvancedFm::okRename() { | 827 | void AdvancedFm::okRename() { |
831 | if( !CurrentView()->currentItem()) return; | 828 | if( !CurrentView()->currentItem()) return; |
832 | 829 | ||
833 | QString newName = renameBox->text(); | 830 | QString newName = renameBox->text(); |
834 | cancelRename(); | 831 | cancelRename(); |
835 | QListView * view = CurrentView(); | 832 | QListView * view = CurrentView(); |
836 | QString path = CurrentDir()->canonicalPath() + "/"; | 833 | QString path = CurrentDir()->canonicalPath() + "/"; |
837 | oldName = path + oldName; | 834 | oldName = path + oldName; |
838 | newName = path + newName; | 835 | newName = path + newName; |
839 | if( rename( oldName.latin1(), newName.latin1())== -1) | 836 | if( rename( oldName.latin1(), newName.latin1())== -1) |
840 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 837 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
841 | else | 838 | else |
842 | oldName = ""; | 839 | oldName = ""; |
843 | view->takeItem( view->currentItem() ); | 840 | view->takeItem( view->currentItem() ); |
844 | delete view->currentItem(); | 841 | delete view->currentItem(); |
845 | rePopulate(); | 842 | rePopulate(); |
846 | } | 843 | } |
847 | 844 | ||
848 | void AdvancedFm::openSearch() { | 845 | void AdvancedFm::openSearch() { |
849 | QMessageBox::message(tr("Note"),tr("Not Yet Implemented")); | 846 | QMessageBox::message(tr("Note"),tr("Not Yet Implemented")); |
850 | } | 847 | } |
diff --git a/noncore/apps/advancedfm/config.in b/noncore/apps/advancedfm/config.in index 72a1f1b..0ba1487 100644 --- a/noncore/apps/advancedfm/config.in +++ b/noncore/apps/advancedfm/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config ADVANCEDFM | 1 | config ADVANCEDFM |
2 | boolean "opie-advancedfm (advanced file manager)" | 2 | boolean "opie-advancedfm (advanced file manager)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI |
diff --git a/noncore/apps/advancedfm/main.cpp b/noncore/apps/advancedfm/main.cpp index 51e38dc..3c1a164 100644 --- a/noncore/apps/advancedfm/main.cpp +++ b/noncore/apps/advancedfm/main.cpp | |||
@@ -1,33 +1,33 @@ | |||
1 | 1 | ||
2 | /*************************************************************************** | 2 | /*************************************************************************** |
3 | main.cpp - description | 3 | main.cpp - description |
4 | ------------------- | 4 | ------------------- |
5 | begin : March 10, 2002 | 5 | begin : March 10, 2002 |
6 | copyright : (C) 2002 by llornkcor | 6 | copyright : (C) 2002 by llornkcor |
7 | email : ljp@llornkcor.com | 7 | email : ljp@llornkcor.com |
8 | * This program is free software; you can redistribute it and/or modify * | 8 | * This program is free software; you can redistribute it and/or modify * |
9 | * it under the terms of the GNU General Public License as published by * | 9 | * it under the terms of the GNU General Public License as published by * |
10 | * the Free Software Foundation; either version 2 of the License, or * | 10 | * the Free Software Foundation; either version 2 of the License, or * |
11 | * (at your option) any later version. * | 11 | * (at your option) any later version. * |
12 | ***************************************************************************/ | 12 | ***************************************************************************/ |
13 | #include <qpe/qpeapplication.h> | ||
14 | |||
15 | |||
16 | 13 | ||
17 | #include "advancedfm.h" | 14 | #include "advancedfm.h" |
18 | 15 | ||
19 | #ifdef NOQUICKLAUNCH | 16 | #ifdef NOQUICKLAUNCH |
17 | |||
18 | #include <qpe/qpeapplication.h> | ||
19 | |||
20 | int main(int argc, char *argv[]) | 20 | int main(int argc, char *argv[]) |
21 | { | 21 | { |
22 | QPEApplication a(argc, argv); | 22 | QPEApplication a(argc, argv); |
23 | 23 | ||
24 | AdvancedFm advencedFm; | 24 | AdvancedFm advencedFm; |
25 | a.showMainWidget( &advencedFm); | 25 | a.showMainWidget( &advencedFm); |
26 | return a.exec(); | 26 | return a.exec(); |
27 | } | 27 | } |
28 | #else | 28 | #else |
29 | #include <opie/oapplicationfactory.h> | 29 | #include <opie2/oapplicationfactory.h> |
30 | 30 | ||
31 | OPIE_EXPORT_APP( OApplicationFactory<AdvancedFm> ) | 31 | OPIE_EXPORT_APP( OApplicationFactory<AdvancedFm> ) |
32 | 32 | ||
33 | #endif | 33 | #endif |
diff --git a/noncore/apps/advancedfm/opie-advancedfm.control b/noncore/apps/advancedfm/opie-advancedfm.control index 5bab6ab..bb311c1 100644 --- a/noncore/apps/advancedfm/opie-advancedfm.control +++ b/noncore/apps/advancedfm/opie-advancedfm.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-advancedfm | 1 | Package: opie-advancedfm |
2 | Files: plugins/application/libadvancedfm.so* bin/advancedfm apps/Applications/advancedfm.desktop pics/advancedfm | 2 | Files: plugins/application/libadvancedfm.so* bin/advancedfm apps/Applications/advancedfm.desktop pics/advancedfm |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: L.J. Potter <lpotter@trolltech.com> | 5 | Maintainer: L.J. Potter <lpotter@trolltech.com> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal, libopiecore2, libopieui2 |
8 | Description: Advanced File Manager | 8 | Description: Advanced File Manager |
9 | The advanced file manager for the Opie environment. | 9 | The advanced file manager for the Opie environment. |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp index 33abdfc..7dc2416 100644 --- a/noncore/apps/advancedfm/output.cpp +++ b/noncore/apps/advancedfm/output.cpp | |||
@@ -1,21 +1,19 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** outputEdit.cpp | 2 | ** outputEdit.cpp |
3 | ** | 3 | ** |
4 | ** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com> | 4 | ** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com> |
5 | ****************************************************************************/ | 5 | ****************************************************************************/ |
6 | #include "output.h" | 6 | #include "output.h" |
7 | 7 | ||
8 | #include <opie/oprocess.h> | ||
9 | |||
10 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
11 | #include <qpe/applnk.h> | 9 | #include <qpe/applnk.h> |
12 | 10 | ||
13 | #include <qfile.h> | 11 | #include <qfile.h> |
14 | #include <qmultilineedit.h> | 12 | #include <qmultilineedit.h> |
15 | #include <qpushbutton.h> | 13 | #include <qpushbutton.h> |
16 | #include <qlayout.h> | 14 | #include <qlayout.h> |
17 | 15 | ||
18 | #include <errno.h> | 16 | #include <errno.h> |
19 | 17 | ||
20 | /* XPM */ | 18 | /* XPM */ |
21 | static char * filesave_xpm[] = { | 19 | static char * filesave_xpm[] = { |
diff --git a/noncore/apps/advancedfm/output.h b/noncore/apps/advancedfm/output.h index 199a684..26c0fa0 100644 --- a/noncore/apps/advancedfm/output.h +++ b/noncore/apps/advancedfm/output.h | |||
@@ -7,59 +7,59 @@ | |||
7 | ** WARNING! All changes made in this file will be lost! | 7 | ** WARNING! All changes made in this file will be lost! |
8 | ****************************************************************************/ | 8 | ****************************************************************************/ |
9 | #ifndef OUTPUT_H | 9 | #ifndef OUTPUT_H |
10 | #define OUTPUT_H | 10 | #define OUTPUT_H |
11 | 11 | ||
12 | #include <qvariant.h> | 12 | #include <qvariant.h> |
13 | #include <qdialog.h> | 13 | #include <qdialog.h> |
14 | #include <qcstring.h> | 14 | #include <qcstring.h> |
15 | #include <qstringlist.h> | 15 | #include <qstringlist.h> |
16 | #include <qlineedit.h> | 16 | #include <qlineedit.h> |
17 | #include <qwhatsthis.h> | 17 | #include <qwhatsthis.h> |
18 | 18 | ||
19 | #include <opie/oprocess.h> | 19 | #include <opie2/oprocess.h> |
20 | 20 | ||
21 | class QVBoxLayout; | 21 | class QVBoxLayout; |
22 | class QHBoxLayout; | 22 | class QHBoxLayout; |
23 | class QGridLayout; | 23 | class QGridLayout; |
24 | class QMultiLineEdit; | 24 | class QMultiLineEdit; |
25 | 25 | ||
26 | class Output : public QDialog | 26 | class Output : public QDialog |
27 | { | 27 | { |
28 | Q_OBJECT | 28 | Q_OBJECT |
29 | 29 | ||
30 | public: | 30 | public: |
31 | Output(const QStringList commands=0, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 31 | Output(const QStringList commands=0, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
32 | ~Output(); | 32 | ~Output(); |
33 | 33 | ||
34 | QMultiLineEdit* OutputEdit; | 34 | QMultiLineEdit* OutputEdit; |
35 | 35 | ||
36 | protected: | 36 | protected: |
37 | QGridLayout* OutputLayout; | 37 | QGridLayout* OutputLayout; |
38 | OProcess *proc; | 38 | OProcess *proc; |
39 | protected slots: | 39 | protected slots: |
40 | void saveOutput(); | 40 | void saveOutput(); |
41 | void commandStdout(OProcess*, char *, int); | 41 | void commandStdout(OProcess*, char *, int); |
42 | void commandStdin(const QByteArray &); | 42 | void commandStdin(const QByteArray &); |
43 | void commandStderr(OProcess*, char *, int); | 43 | void commandStderr(OProcess*, char *, int); |
44 | void processFinished(); | 44 | void processFinished(); |
45 | private: | 45 | private: |
46 | QString cmmd; | 46 | QString cmmd; |
47 | 47 | ||
48 | }; | 48 | }; |
49 | 49 | ||
50 | class InputDialog : public QDialog | 50 | class InputDialog : public QDialog |
51 | { | 51 | { |
52 | Q_OBJECT | 52 | Q_OBJECT |
53 | 53 | ||
54 | public: | 54 | public: |
55 | InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 55 | InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
56 | ~InputDialog(); | 56 | ~InputDialog(); |
57 | QString inputText; | 57 | QString inputText; |
58 | QLineEdit* LineEdit1; | 58 | QLineEdit* LineEdit1; |
59 | void setInputText(const QString &); | 59 | void setInputText(const QString &); |
60 | private slots: | 60 | private slots: |
61 | void returned(); | 61 | void returned(); |
62 | 62 | ||
63 | }; | 63 | }; |
64 | 64 | ||
65 | #endif // OUTPUT_H | 65 | #endif // OUTPUT_H |