author | llornkcor <llornkcor> | 2004-01-08 22:46:40 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-01-08 22:46:40 (UTC) |
commit | b52dbdb9e992bd891d69601a6425086099e2ea04 (patch) (unidiff) | |
tree | 16f57fb5e0063c5095161b30a898287e22e318b5 | |
parent | 5862ce131c780c38d5df7d336ec5d8fb8f62a0bc (diff) | |
download | opie-b52dbdb9e992bd891d69601a6425086099e2ea04.zip opie-b52dbdb9e992bd891d69601a6425086099e2ea04.tar.gz opie-b52dbdb9e992bd891d69601a6425086099e2ea04.tar.bz2 |
make quicklaunch again
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 5 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.pro | 28 | ||||
-rw-r--r-- | noncore/apps/advancedfm/main.cpp | 6 |
4 files changed, 44 insertions, 5 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index ac16540..9c13e53 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,895 +1,899 @@ | |||
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 | #include "advancedfm.h" | 13 | #include "advancedfm.h" |
14 | 14 | ||
15 | 15 | ||
16 | // #include <opie/ofileselector.h> | 16 | // #include <opie/ofileselector.h> |
17 | // #include <opie/ofiledialog.h> | 17 | // #include <opie/ofiledialog.h> |
18 | 18 | ||
19 | #include <opie/osplitter.h> | 19 | #include <opie/osplitter.h> |
20 | 20 | ||
21 | #include <qpe/filemanager.h> | 21 | #include <qpe/filemanager.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qpe/mimetype.h> | 25 | #include <qpe/mimetype.h> |
26 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
27 | #include <qpe/ir.h> | 27 | #include <qpe/ir.h> |
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #include <qpe/menubutton.h> | 29 | #include <qpe/menubutton.h> |
30 | 30 | ||
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qlistview.h> | 35 | #include <qlistview.h> |
36 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qlayout.h> | 38 | #include <qlayout.h> |
39 | #include <qimage.h> | 39 | #include <qimage.h> |
40 | #include <qmessagebox.h> | 40 | #include <qmessagebox.h> |
41 | #include <qlineedit.h> | 41 | #include <qlineedit.h> |
42 | 42 | ||
43 | #include <qpe/qpemessagebox.h> | 43 | #include <qpe/qpemessagebox.h> |
44 | 44 | ||
45 | #include <sys/stat.h> | 45 | #include <sys/stat.h> |
46 | #include <time.h> | 46 | #include <time.h> |
47 | #include <dirent.h> | 47 | #include <dirent.h> |
48 | #include <fcntl.h> | 48 | #include <fcntl.h> |
49 | #include <sys/vfs.h> | 49 | #include <sys/vfs.h> |
50 | #include <mntent.h> | 50 | #include <mntent.h> |
51 | 51 | ||
52 | #ifdef NOQUICKLAUNCH | ||
52 | AdvancedFm::AdvancedFm( ) | 53 | AdvancedFm::AdvancedFm( ) |
54 | #else | ||
55 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) | ||
56 | #endif | ||
53 | : QMainWindow( ) { | 57 | : QMainWindow( ) { |
54 | init(); | 58 | init(); |
55 | renameBox = 0; | 59 | renameBox = 0; |
56 | 60 | ||
57 | unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 61 | unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
58 | 62 | ||
59 | initConnections(); | 63 | initConnections(); |
60 | whichTab=1; | 64 | whichTab=1; |
61 | rePopulate(); | 65 | rePopulate(); |
62 | currentPathCombo->setFocus(); | 66 | currentPathCombo->setFocus(); |
63 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); | 67 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); |
64 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 68 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
65 | this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); | 69 | this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); |
66 | } | 70 | } |
67 | 71 | ||
68 | AdvancedFm::~AdvancedFm() { | 72 | AdvancedFm::~AdvancedFm() { |
69 | } | 73 | } |
70 | 74 | ||
71 | 75 | ||
72 | void AdvancedFm::cleanUp() { | 76 | void AdvancedFm::cleanUp() { |
73 | QString sfile=QDir::homeDirPath(); | 77 | QString sfile=QDir::homeDirPath(); |
74 | if(sfile.right(1) != "/") | 78 | if(sfile.right(1) != "/") |
75 | sfile+="/._temp"; | 79 | sfile+="/._temp"; |
76 | else | 80 | else |
77 | sfile+="._temp"; | 81 | sfile+="._temp"; |
78 | QFile file( sfile); | 82 | QFile file( sfile); |
79 | if(file.exists()) | 83 | if(file.exists()) |
80 | file.remove(); | 84 | file.remove(); |
81 | } | 85 | } |
82 | 86 | ||
83 | void AdvancedFm::tabChanged(QWidget *) { | 87 | void AdvancedFm::tabChanged(QWidget *) { |
84 | // qWarning("tab changed"); | 88 | // qWarning("tab changed"); |
85 | QString path = CurrentDir()->canonicalPath(); | 89 | QString path = CurrentDir()->canonicalPath(); |
86 | currentPathCombo->lineEdit()->setText( path ); | 90 | currentPathCombo->lineEdit()->setText( path ); |
87 | 91 | ||
88 | if(whichTab == 1) { | 92 | if(whichTab == 1) { |
89 | viewMenu->setItemChecked(viewMenu->idAt(0), true); | 93 | viewMenu->setItemChecked(viewMenu->idAt(0), true); |
90 | viewMenu->setItemChecked(viewMenu->idAt(1), false); | 94 | viewMenu->setItemChecked(viewMenu->idAt(1), false); |
91 | } else { | 95 | } else { |
92 | viewMenu->setItemChecked(viewMenu->idAt(0), false); | 96 | viewMenu->setItemChecked(viewMenu->idAt(0), false); |
93 | viewMenu->setItemChecked(viewMenu->idAt(1), true); | 97 | viewMenu->setItemChecked(viewMenu->idAt(1), true); |
94 | } | 98 | } |
95 | 99 | ||
96 | QString fs= getFileSystemType( (const QString &) path); | 100 | QString fs= getFileSystemType( (const QString &) path); |
97 | 101 | ||
98 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 102 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
99 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); | 103 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); |
100 | chdir( path.latin1()); | 104 | chdir( path.latin1()); |
101 | } | 105 | } |
102 | 106 | ||
103 | 107 | ||
104 | void AdvancedFm::populateView() { | 108 | void AdvancedFm::populateView() { |
105 | 109 | ||
106 | qWarning("PopulateView"); | 110 | // qWarning("PopulateView"); |
107 | QPixmap pm; | 111 | QPixmap pm; |
108 | QListView *thisView = CurrentView(); | 112 | QListView *thisView = CurrentView(); |
109 | QDir *thisDir = CurrentDir(); | 113 | QDir *thisDir = CurrentDir(); |
110 | QString path = thisDir->canonicalPath(); | 114 | QString path = thisDir->canonicalPath(); |
111 | 115 | ||
112 | qWarning("path is "+path); | 116 | //qWarning("path is "+path); |
113 | thisView->clear(); | 117 | thisView->clear(); |
114 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 118 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
115 | thisDir->setMatchAllDirs(TRUE); | 119 | thisDir->setMatchAllDirs(TRUE); |
116 | thisDir->setNameFilter(filterStr); | 120 | thisDir->setNameFilter(filterStr); |
117 | QString fileL, fileS, fileDate; | 121 | QString fileL, fileS, fileDate; |
118 | QString fs= getFileSystemType((const QString &) path); | 122 | QString fs= getFileSystemType((const QString &) path); |
119 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 123 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
120 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); | 124 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); |
121 | bool isDir=FALSE; | 125 | bool isDir=FALSE; |
122 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 126 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
123 | QFileInfoListIterator it(*list); | 127 | QFileInfoListIterator it(*list); |
124 | QFileInfo *fi; | 128 | QFileInfo *fi; |
125 | while ( (fi=it.current()) ) { | 129 | while ( (fi=it.current()) ) { |
126 | if (fi->isSymLink() ) { | 130 | if (fi->isSymLink() ) { |
127 | QString symLink=fi->readLink(); | 131 | QString symLink=fi->readLink(); |
128 | QFileInfo sym( symLink); | 132 | QFileInfo sym( symLink); |
129 | fileS.sprintf( "%10i", sym.size() ); | 133 | fileS.sprintf( "%10i", sym.size() ); |
130 | fileL = fi->fileName() +" -> " + sym.filePath().data(); | 134 | fileL = fi->fileName() +" -> " + sym.filePath().data(); |
131 | fileDate = sym.lastModified().toString(); | 135 | fileDate = sym.lastModified().toString(); |
132 | } else { | 136 | } else { |
133 | fileS.sprintf( "%10i", fi->size() ); | 137 | fileS.sprintf( "%10i", fi->size() ); |
134 | fileL = fi->fileName(); | 138 | fileL = fi->fileName(); |
135 | fileDate= fi->lastModified().toString(); | 139 | fileDate= fi->lastModified().toString(); |
136 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { | 140 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { |
137 | // if(fileL == "..") | 141 | // if(fileL == "..") |
138 | fileL += "/"; | 142 | fileL += "/"; |
139 | isDir=TRUE; | 143 | isDir=TRUE; |
140 | } | 144 | } |
141 | } | 145 | } |
142 | QFileInfo fileInfo( path + "/" + fileL); | 146 | QFileInfo fileInfo( path + "/" + fileL); |
143 | 147 | ||
144 | if(fileL !="./" && fi->exists()) { | 148 | if(fileL !="./" && fi->exists()) { |
145 | item = new QListViewItem( thisView, fileL, fileS , fileDate); | 149 | item = new QListViewItem( thisView, fileL, fileS , fileDate); |
146 | 150 | ||
147 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 151 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
148 | 152 | ||
149 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 153 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
150 | pm = Resource::loadPixmap( "lockedfolder" ); | 154 | pm = Resource::loadPixmap( "lockedfolder" ); |
151 | else | 155 | else |
152 | pm= Resource::loadPixmap( "folder" ); | 156 | pm= Resource::loadPixmap( "folder" ); |
153 | } | 157 | } |
154 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 158 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
155 | pm = Resource::loadPixmap( "exec"); | 159 | pm = Resource::loadPixmap( "exec"); |
156 | } | 160 | } |
157 | else if( (fileInfo.permission( QFileInfo::ExeUser) | 161 | else if( (fileInfo.permission( QFileInfo::ExeUser) |
158 | | fileInfo.permission( QFileInfo::ExeGroup) | 162 | | fileInfo.permission( QFileInfo::ExeGroup) |
159 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 163 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
160 | pm = Resource::loadPixmap( "exec"); | 164 | pm = Resource::loadPixmap( "exec"); |
161 | } | 165 | } |
162 | else if( !fi->isReadable() ) { | 166 | else if( !fi->isReadable() ) { |
163 | pm = Resource::loadPixmap( "locked" ); | 167 | pm = Resource::loadPixmap( "locked" ); |
164 | } | 168 | } |
165 | else { //everything else goes by mimetype | 169 | else { //everything else goes by mimetype |
166 | MimeType mt(fi->filePath()); | 170 | MimeType mt(fi->filePath()); |
167 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 171 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
168 | if(pm.isNull()) { | 172 | if(pm.isNull()) { |
169 | pm = unknownXpm; | 173 | pm = unknownXpm; |
170 | } | 174 | } |
171 | } | 175 | } |
172 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { | 176 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { |
173 | // qDebug(" overlay link image"); | 177 | // qDebug(" overlay link image"); |
174 | pm= Resource::loadPixmap( "advancedfm/symlink" ); | 178 | pm= Resource::loadPixmap( "advancedfm/symlink" ); |
175 | // pm= Resource::loadPixmap( "folder" ); | 179 | // pm= Resource::loadPixmap( "folder" ); |
176 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 180 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
177 | // QPainter painter( &pm ); | 181 | // QPainter painter( &pm ); |
178 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 182 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
179 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); | 183 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); |
180 | } | 184 | } |
181 | item->setPixmap( 0,pm); | 185 | item->setPixmap( 0,pm); |
182 | 186 | ||
183 | } | 187 | } |
184 | isDir=FALSE; | 188 | isDir=FALSE; |
185 | ++it; | 189 | ++it; |
186 | } | 190 | } |
187 | 191 | ||
188 | if( path.find("dev",0,TRUE) != -1) { | 192 | if( path.find("dev",0,TRUE) != -1) { |
189 | struct stat buf; | 193 | struct stat buf; |
190 | dev_t devT; | 194 | dev_t devT; |
191 | DIR *dir; | 195 | DIR *dir; |
192 | struct dirent *mydirent; | 196 | struct dirent *mydirent; |
193 | 197 | ||
194 | if((dir = opendir( path.latin1())) != NULL) | 198 | if((dir = opendir( path.latin1())) != NULL) |
195 | while ((mydirent = readdir(dir)) != NULL) { | 199 | while ((mydirent = readdir(dir)) != NULL) { |
196 | lstat( mydirent->d_name, &buf); | 200 | lstat( mydirent->d_name, &buf); |
197 | // qDebug(mydirent->d_name); | 201 | // qDebug(mydirent->d_name); |
198 | fileL.sprintf("%s", mydirent->d_name); | 202 | fileL.sprintf("%s", mydirent->d_name); |
199 | devT = buf.st_dev; | 203 | devT = buf.st_dev; |
200 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 204 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
201 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 205 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
202 | if( fileL.find(".") == -1 ) { | 206 | if( fileL.find(".") == -1 ) { |
203 | item= new QListViewItem( thisView, fileL, fileS, fileDate); | 207 | item= new QListViewItem( thisView, fileL, fileS, fileDate); |
204 | pm = unknownXpm; | 208 | pm = unknownXpm; |
205 | item->setPixmap( 0,pm); | 209 | item->setPixmap( 0,pm); |
206 | } | 210 | } |
207 | } | 211 | } |
208 | 212 | ||
209 | closedir(dir); | 213 | closedir(dir); |
210 | } | 214 | } |
211 | 215 | ||
212 | thisView->setSorting( 3,FALSE); | 216 | thisView->setSorting( 3,FALSE); |
213 | fillCombo( (const QString &) path ); | 217 | fillCombo( (const QString &) path ); |
214 | } | 218 | } |
215 | 219 | ||
216 | void AdvancedFm::rePopulate() { | 220 | void AdvancedFm::rePopulate() { |
217 | populateView(); | 221 | populateView(); |
218 | setOtherTabCurrent(); | 222 | setOtherTabCurrent(); |
219 | populateView(); | 223 | populateView(); |
220 | 224 | ||
221 | // int tmpTab = whichTab; | 225 | // int tmpTab = whichTab; |
222 | // // qDebug("%d", tmpTab); | 226 | // // qDebug("%d", tmpTab); |
223 | 227 | ||
224 | // for(int i =1; i < 3; i++) { | 228 | // for(int i =1; i < 3; i++) { |
225 | // TabWidget->setCurrentWidget(i - 1); | 229 | // TabWidget->setCurrentWidget(i - 1); |
226 | // populateView(); | 230 | // populateView(); |
227 | // } | 231 | // } |
228 | // TabWidget->setCurrentWidget( tmpTab - 1); | 232 | // TabWidget->setCurrentWidget( tmpTab - 1); |
229 | } | 233 | } |
230 | 234 | ||
231 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { | 235 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { |
232 | //qWarning("listclicked"); | 236 | //qWarning("listclicked"); |
233 | if(selectedItem) { | 237 | if(selectedItem) { |
234 | QString strItem=selectedItem->text(0); | 238 | QString strItem=selectedItem->text(0); |
235 | // qWarning(strItem); | 239 | // qWarning(strItem); |
236 | QString strSize=selectedItem->text(1); | 240 | QString strSize=selectedItem->text(1); |
237 | strSize=strSize.stripWhiteSpace(); | 241 | strSize=strSize.stripWhiteSpace(); |
238 | bool isDirectory = false; | 242 | bool isDirectory = false; |
239 | QString strItem2; | 243 | QString strItem2; |
240 | 244 | ||
241 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink | 245 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink |
242 | strItem2 = dealWithSymName((const QString&)strItem); | 246 | strItem2 = dealWithSymName((const QString&)strItem); |
243 | if(QDir(strItem2).exists() ) | 247 | if(QDir(strItem2).exists() ) |
244 | strItem = strItem2; | 248 | strItem = strItem2; |
245 | } | 249 | } |
246 | 250 | ||
247 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 251 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
248 | 252 | ||
249 | if(QDir(strItem).exists()) | 253 | if(QDir(strItem).exists()) |
250 | isDirectory = true; | 254 | isDirectory = true; |
251 | } | 255 | } |
252 | 256 | ||
253 | if( isDirectory ) { | 257 | if( isDirectory ) { |
254 | CurrentDir()->cd( strItem, TRUE); | 258 | CurrentDir()->cd( strItem, TRUE); |
255 | populateView(); | 259 | populateView(); |
256 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); | 260 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); |
257 | } | 261 | } |
258 | chdir( strItem.latin1()); | 262 | chdir( strItem.latin1()); |
259 | } | 263 | } |
260 | } | 264 | } |
261 | 265 | ||
262 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { | 266 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { |
263 | dealWithSchmooSchmaa( item->listView()); | 267 | dealWithSchmooSchmaa( item->listView()); |
264 | switch (mouse) { | 268 | switch (mouse) { |
265 | case 1: | 269 | case 1: |
266 | { | 270 | { |
267 | if(renameBox != 0 ) { | 271 | if(renameBox != 0 ) { |
268 | cancelRename(); | 272 | cancelRename(); |
269 | } | 273 | } |
270 | } | 274 | } |
271 | break; | 275 | break; |
272 | case 2: | 276 | case 2: |
273 | menuTimer.start( 500, TRUE ); | 277 | menuTimer.start( 500, TRUE ); |
274 | break; | 278 | break; |
275 | }; | 279 | }; |
276 | } | 280 | } |
277 | 281 | ||
278 | 282 | ||
279 | void AdvancedFm::switchToLocalTab() { | 283 | void AdvancedFm::switchToLocalTab() { |
280 | //qWarning("switch to local view"); | 284 | //qWarning("switch to local view"); |
281 | TabWidget->setCurrentWidget(0); | 285 | TabWidget->setCurrentWidget(0); |
282 | Local_View->setFocus(); | 286 | Local_View->setFocus(); |
283 | } | 287 | } |
284 | 288 | ||
285 | void AdvancedFm::switchToRemoteTab() { | 289 | void AdvancedFm::switchToRemoteTab() { |
286 | //qWarning("switch to local view"); | 290 | //qWarning("switch to local view"); |
287 | TabWidget->setCurrentWidget(1); | 291 | TabWidget->setCurrentWidget(1); |
288 | Remote_View->setFocus(); | 292 | Remote_View->setFocus(); |
289 | } | 293 | } |
290 | 294 | ||
291 | void AdvancedFm::readConfig() { | 295 | void AdvancedFm::readConfig() { |
292 | Config cfg("AdvancedFm"); | 296 | Config cfg("AdvancedFm"); |
293 | } | 297 | } |
294 | 298 | ||
295 | void AdvancedFm::writeConfig() { | 299 | void AdvancedFm::writeConfig() { |
296 | Config cfg("AdvancedFm"); | 300 | Config cfg("AdvancedFm"); |
297 | } | 301 | } |
298 | 302 | ||
299 | void AdvancedFm::currentPathComboChanged() { | 303 | void AdvancedFm::currentPathComboChanged() { |
300 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 304 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
301 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); | 305 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); |
302 | populateView(); | 306 | populateView(); |
303 | } else { | 307 | } else { |
304 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 308 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
305 | } | 309 | } |
306 | } | 310 | } |
307 | 311 | ||
308 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 312 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
309 | 313 | ||
310 | if ( whichTab == 1) { | 314 | if ( whichTab == 1) { |
311 | currentPathCombo->lineEdit()->setText( currentPath); | 315 | currentPathCombo->lineEdit()->setText( currentPath); |
312 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 316 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
313 | currentPathCombo->clear(); | 317 | currentPathCombo->clear(); |
314 | localDirPathStringList.prepend( currentPath ); | 318 | localDirPathStringList.prepend( currentPath ); |
315 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 319 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
316 | } | 320 | } |
317 | } else { | 321 | } else { |
318 | currentPathCombo->lineEdit()->setText( currentPath); | 322 | currentPathCombo->lineEdit()->setText( currentPath); |
319 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 323 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
320 | currentPathCombo->clear(); | 324 | currentPathCombo->clear(); |
321 | remoteDirPathStringList.prepend( currentPath ); | 325 | remoteDirPathStringList.prepend( currentPath ); |
322 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 326 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
323 | } | 327 | } |
324 | } | 328 | } |
325 | } | 329 | } |
326 | 330 | ||
327 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 331 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
328 | chdir( currentPath.latin1() ); | 332 | chdir( currentPath.latin1() ); |
329 | CurrentDir()->cd( currentPath, TRUE); | 333 | CurrentDir()->cd( currentPath, TRUE); |
330 | populateView(); | 334 | populateView(); |
331 | update(); | 335 | update(); |
332 | } | 336 | } |
333 | 337 | ||
334 | QStringList AdvancedFm::getPath() { | 338 | QStringList AdvancedFm::getPath() { |
335 | QStringList strList; | 339 | QStringList strList; |
336 | QListView *thisView=CurrentView(); | 340 | QListView *thisView=CurrentView(); |
337 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); | 341 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); |
338 | QListViewItemIterator it( thisView ); | 342 | QListViewItemIterator it( thisView ); |
339 | for ( ; it.current(); ++it ) { | 343 | for ( ; it.current(); ++it ) { |
340 | if ( it.current()->isSelected() ) { | 344 | if ( it.current()->isSelected() ) { |
341 | strList << it.current()->text(0); | 345 | strList << it.current()->text(0); |
342 | // qDebug(it.current()->text(0)); | 346 | // qDebug(it.current()->text(0)); |
343 | } | 347 | } |
344 | } | 348 | } |
345 | return strList; | 349 | return strList; |
346 | } | 350 | } |
347 | 351 | ||
348 | void AdvancedFm::homeButtonPushed() { | 352 | void AdvancedFm::homeButtonPushed() { |
349 | QString current = QDir::homeDirPath(); | 353 | QString current = QDir::homeDirPath(); |
350 | chdir( current.latin1() ); | 354 | chdir( current.latin1() ); |
351 | CurrentDir()->cd( current, TRUE); | 355 | CurrentDir()->cd( current, TRUE); |
352 | populateView(); | 356 | populateView(); |
353 | update(); | 357 | update(); |
354 | } | 358 | } |
355 | 359 | ||
356 | void AdvancedFm::docButtonPushed() { | 360 | void AdvancedFm::docButtonPushed() { |
357 | QString current = QPEApplication::documentDir(); | 361 | QString current = QPEApplication::documentDir(); |
358 | chdir( current.latin1() ); | 362 | chdir( current.latin1() ); |
359 | CurrentDir()->cd( current, TRUE); | 363 | CurrentDir()->cd( current, TRUE); |
360 | populateView(); | 364 | populateView(); |
361 | update(); | 365 | update(); |
362 | } | 366 | } |
363 | 367 | ||
364 | void AdvancedFm::SDButtonPushed() { | 368 | void AdvancedFm::SDButtonPushed() { |
365 | QString current = "/mnt/card";// this can change so fix | 369 | QString current = "/mnt/card";// this can change so fix |
366 | chdir( current.latin1() ); | 370 | chdir( current.latin1() ); |
367 | CurrentDir()->cd( current, TRUE); | 371 | CurrentDir()->cd( current, TRUE); |
368 | populateView(); | 372 | populateView(); |
369 | update(); | 373 | update(); |
370 | } | 374 | } |
371 | 375 | ||
372 | void AdvancedFm::CFButtonPushed() { | 376 | void AdvancedFm::CFButtonPushed() { |
373 | QString current; | 377 | QString current; |
374 | if(zaurusDevice) | 378 | if(zaurusDevice) |
375 | current= "/mnt/cf"; //zaurus | 379 | current= "/mnt/cf"; //zaurus |
376 | else | 380 | else |
377 | current = "/mnt/hda"; //ipaq | 381 | current = "/mnt/hda"; //ipaq |
378 | chdir( current.latin1() ); | 382 | chdir( current.latin1() ); |
379 | CurrentDir()->cd( current, TRUE); | 383 | CurrentDir()->cd( current, TRUE); |
380 | populateView(); | 384 | populateView(); |
381 | update(); | 385 | update(); |
382 | } | 386 | } |
383 | 387 | ||
384 | 388 | ||
385 | void AdvancedFm::doAbout() { | 389 | void AdvancedFm::doAbout() { |
386 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" | 390 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" |
387 | "is copyright 2002-2003 by\n" | 391 | "is copyright 2002-2003 by\n" |
388 | "L.J.Potter<llornkcor@handhelds.org>\n" | 392 | "L.J.Potter<llornkcor@handhelds.org>\n" |
389 | "and is licensed by the GPL")); | 393 | "and is licensed by the GPL")); |
390 | } | 394 | } |
391 | 395 | ||
392 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { | 396 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { |
393 | // qWarning("key %d", e->key()); | 397 | // qWarning("key %d", e->key()); |
394 | // if( CurrentView()->hasFocus() ) | 398 | // if( CurrentView()->hasFocus() ) |
395 | { | 399 | { |
396 | switch ( e->key() ) { | 400 | switch ( e->key() ) { |
397 | case Key_Left: | 401 | case Key_Left: |
398 | upDir(); | 402 | upDir(); |
399 | break; | 403 | break; |
400 | case Key_Next: | 404 | case Key_Next: |
401 | break; | 405 | break; |
402 | case Key_Return: | 406 | case Key_Return: |
403 | case Key_Enter: | 407 | case Key_Enter: |
404 | navigateToSelected(); | 408 | navigateToSelected(); |
405 | break; | 409 | break; |
406 | case Key_Tab: { | 410 | case Key_Tab: { |
407 | setOtherTabCurrent(); | 411 | setOtherTabCurrent(); |
408 | } | 412 | } |
409 | break; | 413 | break; |
410 | case Key_Delete: | 414 | case Key_Delete: |
411 | del(); | 415 | del(); |
412 | break; | 416 | break; |
413 | case Key_A: | 417 | case Key_A: |
414 | copyAs(); | 418 | copyAs(); |
415 | break; | 419 | break; |
416 | case Key_C: | 420 | case Key_C: |
417 | copy(); | 421 | copy(); |
418 | break; | 422 | break; |
419 | case Key_E: | 423 | case Key_E: |
420 | runThis(); | 424 | runThis(); |
421 | break; | 425 | break; |
422 | case Key_G: | 426 | case Key_G: |
423 | { | 427 | { |
424 | currentPathCombo->lineEdit()->setFocus(); | 428 | currentPathCombo->lineEdit()->setFocus(); |
425 | } | 429 | } |
426 | break; | 430 | break; |
427 | 431 | ||
428 | case Key_H: | 432 | case Key_H: |
429 | showHidden(); | 433 | showHidden(); |
430 | break; | 434 | break; |
431 | case Key_I: | 435 | case Key_I: |
432 | fileStatus(); | 436 | fileStatus(); |
433 | break; | 437 | break; |
434 | case Key_M: | 438 | case Key_M: |
435 | move(); | 439 | move(); |
436 | break; | 440 | break; |
437 | case Key_N: | 441 | case Key_N: |
438 | mkDir(); | 442 | mkDir(); |
439 | break; | 443 | break; |
440 | case Key_P: | 444 | case Key_P: |
441 | filePerms(); | 445 | filePerms(); |
442 | break; | 446 | break; |
443 | case Key_R: | 447 | case Key_R: |
444 | rn(); | 448 | rn(); |
445 | break; | 449 | break; |
446 | case Key_U: | 450 | case Key_U: |
447 | upDir(); | 451 | upDir(); |
448 | break; | 452 | break; |
449 | case Key_1: | 453 | case Key_1: |
450 | switchToLocalTab(); | 454 | switchToLocalTab(); |
451 | break; | 455 | break; |
452 | case Key_2: | 456 | case Key_2: |
453 | switchToRemoteTab(); | 457 | switchToRemoteTab(); |
454 | break; | 458 | break; |
455 | case Key_3: | 459 | case Key_3: |
456 | CFButtonPushed(); | 460 | CFButtonPushed(); |
457 | break; | 461 | break; |
458 | case Key_4: | 462 | case Key_4: |
459 | SDButtonPushed(); | 463 | SDButtonPushed(); |
460 | break; | 464 | break; |
461 | case Key_5: | 465 | case Key_5: |
462 | homeButtonPushed(); | 466 | homeButtonPushed(); |
463 | break; | 467 | break; |
464 | case Key_6: | 468 | case Key_6: |
465 | docButtonPushed(); | 469 | docButtonPushed(); |
466 | break; | 470 | break; |
467 | case Key_7: | 471 | case Key_7: |
468 | break; | 472 | break; |
469 | case Key_8: | 473 | case Key_8: |
470 | break; | 474 | break; |
471 | case Key_9: | 475 | case Key_9: |
472 | break; | 476 | break; |
473 | case Key_0: | 477 | case Key_0: |
474 | break; | 478 | break; |
475 | }; | 479 | }; |
476 | e->accept(); | 480 | e->accept(); |
477 | } | 481 | } |
478 | } | 482 | } |
479 | 483 | ||
480 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { | 484 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { |
481 | if( CurrentView()->hasFocus() ) | 485 | if( CurrentView()->hasFocus() ) |
482 | e->ignore(); | 486 | e->ignore(); |
483 | } | 487 | } |
484 | 488 | ||
485 | 489 | ||
486 | void AdvancedFm::QPEButtonPushed() { | 490 | void AdvancedFm::QPEButtonPushed() { |
487 | QString current = QPEApplication::qpeDir(); | 491 | QString current = QPEApplication::qpeDir(); |
488 | chdir( current.latin1() ); | 492 | chdir( current.latin1() ); |
489 | CurrentDir()->cd( current, TRUE); | 493 | CurrentDir()->cd( current, TRUE); |
490 | populateView(); | 494 | populateView(); |
491 | update(); | 495 | update(); |
492 | } | 496 | } |
493 | 497 | ||
494 | void AdvancedFm::parsetab(const QString &fileName) { | 498 | void AdvancedFm::parsetab(const QString &fileName) { |
495 | 499 | ||
496 | fileSystemTypeList.clear(); | 500 | fileSystemTypeList.clear(); |
497 | fsList.clear(); | 501 | fsList.clear(); |
498 | struct mntent *me; | 502 | struct mntent *me; |
499 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 503 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
500 | if ( mntfp ) { | 504 | if ( mntfp ) { |
501 | while ( (me = getmntent( mntfp )) != 0 ) { | 505 | while ( (me = getmntent( mntfp )) != 0 ) { |
502 | QString deviceName = me->mnt_fsname; | 506 | QString deviceName = me->mnt_fsname; |
503 | QString filesystemType = me->mnt_type; | 507 | QString filesystemType = me->mnt_type; |
504 | QString mountDir = me->mnt_dir; | 508 | QString mountDir = me->mnt_dir; |
505 | if(deviceName != "none") { | 509 | if(deviceName != "none") { |
506 | if( fsList.contains(filesystemType) == 0 | 510 | if( fsList.contains(filesystemType) == 0 |
507 | & filesystemType.find("proc",0,TRUE) == -1 | 511 | & filesystemType.find("proc",0,TRUE) == -1 |
508 | & filesystemType.find("cramfs",0,TRUE) == -1 | 512 | & filesystemType.find("cramfs",0,TRUE) == -1 |
509 | & filesystemType.find("auto",0,TRUE) == -1) | 513 | & filesystemType.find("auto",0,TRUE) == -1) |
510 | fsList << filesystemType; | 514 | fsList << filesystemType; |
511 | fileSystemTypeList << mountDir+"::"+filesystemType; | 515 | fileSystemTypeList << mountDir+"::"+filesystemType; |
512 | } | 516 | } |
513 | } | 517 | } |
514 | } | 518 | } |
515 | endmntent( mntfp ); | 519 | endmntent( mntfp ); |
516 | } | 520 | } |
517 | 521 | ||
518 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { | 522 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { |
519 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 523 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
520 | QString current = currentText;//.right( currentText.length()-1); | 524 | QString current = currentText;//.right( currentText.length()-1); |
521 | QString baseFs; | 525 | QString baseFs; |
522 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { | 526 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { |
523 | QString temp = (*it); | 527 | QString temp = (*it); |
524 | QString path = temp.left(temp.find("::",0,TRUE) ); | 528 | QString path = temp.left(temp.find("::",0,TRUE) ); |
525 | path = path.right( path.length()-1); | 529 | path = path.right( path.length()-1); |
526 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 530 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
527 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { | 531 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { |
528 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 532 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
529 | } | 533 | } |
530 | } | 534 | } |
531 | return baseFs; | 535 | return baseFs; |
532 | } | 536 | } |
533 | 537 | ||
534 | QString AdvancedFm::getDiskSpace( const QString &path) { | 538 | QString AdvancedFm::getDiskSpace( const QString &path) { |
535 | struct statfs fss; | 539 | struct statfs fss; |
536 | if ( !statfs( path.latin1(), &fss ) ) { | 540 | if ( !statfs( path.latin1(), &fss ) ) { |
537 | int blkSize = fss.f_bsize; | 541 | int blkSize = fss.f_bsize; |
538 | // int totalBlks = fs.f_blocks; | 542 | // int totalBlks = fs.f_blocks; |
539 | int availBlks = fss.f_bavail; | 543 | int availBlks = fss.f_bavail; |
540 | 544 | ||
541 | long mult = blkSize / 1024; | 545 | long mult = blkSize / 1024; |
542 | long div = 1024 / blkSize; | 546 | long div = 1024 / blkSize; |
543 | if ( !mult ) mult = 1; | 547 | if ( !mult ) mult = 1; |
544 | if ( !div ) div = 1; | 548 | if ( !div ) div = 1; |
545 | 549 | ||
546 | return QString::number(availBlks * mult / div); | 550 | return QString::number(availBlks * mult / div); |
547 | } | 551 | } |
548 | return ""; | 552 | return ""; |
549 | } | 553 | } |
550 | 554 | ||
551 | 555 | ||
552 | void AdvancedFm::showFileMenu() { | 556 | void AdvancedFm::showFileMenu() { |
553 | QString curApp; | 557 | QString curApp; |
554 | curApp = CurrentView()->currentItem()->text(0); | 558 | curApp = CurrentView()->currentItem()->text(0); |
555 | 559 | ||
556 | MimeType mt( curApp ); | 560 | MimeType mt( curApp ); |
557 | const AppLnk* app = mt.application(); | 561 | const AppLnk* app = mt.application(); |
558 | QFile fi(curApp); | 562 | QFile fi(curApp); |
559 | QPopupMenu *m = new QPopupMenu(0); | 563 | QPopupMenu *m = new QPopupMenu(0); |
560 | QPopupMenu *n = new QPopupMenu(0); | 564 | QPopupMenu *n = new QPopupMenu(0); |
561 | // QPopupMenu *o = new QPopupMenu(0); | 565 | // QPopupMenu *o = new QPopupMenu(0); |
562 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 566 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
563 | 567 | ||
564 | if ( QFileInfo(fi).isDir() ) { | 568 | if ( QFileInfo(fi).isDir() ) { |
565 | m->insertSeparator(); | 569 | m->insertSeparator(); |
566 | m->insertItem( tr( "Change Directory" ), this, SLOT( doDirChange() )); | 570 | m->insertItem( tr( "Change Directory" ), this, SLOT( doDirChange() )); |
567 | } else { | 571 | } else { |
568 | 572 | ||
569 | if ( app ) | 573 | if ( app ) |
570 | m->insertItem( app->pixmap(), tr( "Open in " | 574 | m->insertItem( app->pixmap(), tr( "Open in " |
571 | + app->name() ), this, SLOT( runThis() ) ); | 575 | + app->name() ), this, SLOT( runThis() ) ); |
572 | else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this | 576 | else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this |
573 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); | 577 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); |
574 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); | 578 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); |
575 | } | 579 | } |
576 | 580 | ||
577 | m->insertItem(tr("Actions"),n); | 581 | m->insertItem(tr("Actions"),n); |
578 | n->insertItem( tr( "Make Directory" ), this, SLOT( makeDir() )); | 582 | n->insertItem( tr( "Make Directory" ), this, SLOT( makeDir() )); |
579 | 583 | ||
580 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 584 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
581 | 585 | ||
582 | n->insertSeparator(); | 586 | n->insertSeparator(); |
583 | n->insertItem( tr( "Rename" ), this, SLOT( renameIt() )); | 587 | n->insertItem( tr( "Rename" ), this, SLOT( renameIt() )); |
584 | 588 | ||
585 | n->insertItem( tr( "Copy" ), this, SLOT( copy() )); | 589 | n->insertItem( tr( "Copy" ), this, SLOT( copy() )); |
586 | n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 590 | n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
587 | n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); | 591 | n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); |
588 | n->insertItem( tr( "Move" ), this, SLOT( move() )); | 592 | n->insertItem( tr( "Move" ), this, SLOT( move() )); |
589 | 593 | ||
590 | n->insertSeparator(); | 594 | n->insertSeparator(); |
591 | n->insertItem( tr( "Delete" ), this, SLOT( doDelete() )); | 595 | n->insertItem( tr( "Delete" ), this, SLOT( doDelete() )); |
592 | m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 596 | m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
593 | 597 | ||
594 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 598 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
595 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 599 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
596 | 600 | ||
597 | m->insertSeparator(); | 601 | m->insertSeparator(); |
598 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 602 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
599 | 603 | ||
600 | #if defined(QT_QWS_OPIE) | 604 | #if defined(QT_QWS_OPIE) |
601 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 605 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
602 | #endif | 606 | #endif |
603 | m->setCheckable(TRUE); | 607 | m->setCheckable(TRUE); |
604 | if (!b) | 608 | if (!b) |
605 | m->setItemChecked(m->idAt(0),TRUE); | 609 | m->setItemChecked(m->idAt(0),TRUE); |
606 | else | 610 | else |
607 | m->setItemChecked(m->idAt(0),FALSE); | 611 | m->setItemChecked(m->idAt(0),FALSE); |
608 | 612 | ||
609 | if(Ir::supported()) | 613 | if(Ir::supported()) |
610 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); | 614 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); |
611 | m->setFocus(); | 615 | m->setFocus(); |
612 | 616 | ||
613 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 617 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
614 | 618 | ||
615 | if(m) delete m; | 619 | if(m) delete m; |
616 | } | 620 | } |
617 | 621 | ||
618 | 622 | ||
619 | void AdvancedFm::cancelMenuTimer() { | 623 | void AdvancedFm::cancelMenuTimer() { |
620 | 624 | ||
621 | if( menuTimer.isActive() ) | 625 | if( menuTimer.isActive() ) |
622 | menuTimer.stop(); | 626 | menuTimer.stop(); |
623 | } | 627 | } |
624 | 628 | ||
625 | QString AdvancedFm::checkDiskSpace(const QString &path) { | 629 | QString AdvancedFm::checkDiskSpace(const QString &path) { |
626 | struct statfs fss; | 630 | struct statfs fss; |
627 | if ( !statfs( path.latin1(), &fss ) ) { | 631 | if ( !statfs( path.latin1(), &fss ) ) { |
628 | int blkSize = fss.f_bsize; | 632 | int blkSize = fss.f_bsize; |
629 | // int totalBlks = fs.f_blocks; | 633 | // int totalBlks = fs.f_blocks; |
630 | int availBlks = fss.f_bavail; | 634 | int availBlks = fss.f_bavail; |
631 | 635 | ||
632 | long mult = blkSize / 1024; | 636 | long mult = blkSize / 1024; |
633 | long div = 1024 / blkSize; | 637 | long div = 1024 / blkSize; |
634 | if ( !mult ) mult = 1; | 638 | if ( !mult ) mult = 1; |
635 | if ( !div ) div = 1; | 639 | if ( !div ) div = 1; |
636 | 640 | ||
637 | 641 | ||
638 | return QString::number(availBlks * mult / div); | 642 | return QString::number(availBlks * mult / div); |
639 | } | 643 | } |
640 | return ""; | 644 | return ""; |
641 | } | 645 | } |
642 | 646 | ||
643 | void AdvancedFm::addToDocs() { | 647 | void AdvancedFm::addToDocs() { |
644 | QStringList strListPaths = getPath(); | 648 | QStringList strListPaths = getPath(); |
645 | QDir *thisDir = CurrentDir(); | 649 | QDir *thisDir = CurrentDir(); |
646 | 650 | ||
647 | if( strListPaths.count() > 0) { | 651 | if( strListPaths.count() > 0) { |
648 | QString curFile; | 652 | QString curFile; |
649 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { | 653 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { |
650 | curFile = thisDir->canonicalPath()+"/"+(*it); | 654 | curFile = thisDir->canonicalPath()+"/"+(*it); |
651 | // qDebug(curFile); | 655 | // qDebug(curFile); |
652 | QFileInfo fi(curFile); | 656 | QFileInfo fi(curFile); |
653 | DocLnk f; | 657 | DocLnk f; |
654 | // curFile.replace(QRegExp("\\..*"),""); | 658 | // curFile.replace(QRegExp("\\..*"),""); |
655 | f.setName(fi.baseName() ); | 659 | f.setName(fi.baseName() ); |
656 | f.setFile( curFile); | 660 | f.setFile( curFile); |
657 | f.writeLink(); | 661 | f.writeLink(); |
658 | } | 662 | } |
659 | } | 663 | } |
660 | } | 664 | } |
661 | 665 | ||
662 | 666 | ||
663 | void AdvancedFm::customDirsToMenu() { | 667 | void AdvancedFm::customDirsToMenu() { |
664 | 668 | ||
665 | Config cfg("AdvancedFm"); | 669 | Config cfg("AdvancedFm"); |
666 | cfg.setGroup("Menu"); | 670 | cfg.setGroup("Menu"); |
667 | 671 | ||
668 | QStringList list = cfg.readListEntry( "CustomDir", ','); | 672 | QStringList list = cfg.readListEntry( "CustomDir", ','); |
669 | menuButton->insertItems(list ); | 673 | menuButton->insertItems(list ); |
670 | 674 | ||
671 | // for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 675 | // for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
672 | // { | 676 | // { |
673 | // customDirMenu->insertItem(*it ); | 677 | // customDirMenu->insertItem(*it ); |
674 | // } | 678 | // } |
675 | } | 679 | } |
676 | 680 | ||
677 | void AdvancedFm::dirMenuSelected(int item) { | 681 | void AdvancedFm::dirMenuSelected(int item) { |
678 | switch(item) | 682 | switch(item) |
679 | { | 683 | { |
680 | 684 | ||
681 | case -21: | 685 | case -21: |
682 | case 0: | 686 | case 0: |
683 | addCustomDir(); | 687 | addCustomDir(); |
684 | break; | 688 | break; |
685 | case -22: | 689 | case -22: |
686 | case 1: | 690 | case 1: |
687 | removeCustomDir(); | 691 | removeCustomDir(); |
688 | break; | 692 | break; |
689 | default: | 693 | default: |
690 | { | 694 | { |
691 | // gotoCustomDir( menuButton->text(item)); | 695 | // gotoCustomDir( menuButton->text(item)); |
692 | // gotoCustomDir( customDirMenu->text(item)); | 696 | // gotoCustomDir( customDirMenu->text(item)); |
693 | } | 697 | } |
694 | break; | 698 | break; |
695 | 699 | ||
696 | }; | 700 | }; |
697 | } | 701 | } |
698 | 702 | ||
699 | void AdvancedFm::addCustomDir() { | 703 | void AdvancedFm::addCustomDir() { |
700 | Config cfg("AdvancedFm"); | 704 | Config cfg("AdvancedFm"); |
701 | cfg.setGroup("Menu"); | 705 | cfg.setGroup("Menu"); |
702 | QString dir; | 706 | QString dir; |
703 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); | 707 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); |
704 | 708 | ||
705 | dir = CurrentDir()->canonicalPath(); | 709 | dir = CurrentDir()->canonicalPath(); |
706 | 710 | ||
707 | bool addIt=true; | 711 | bool addIt=true; |
708 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 712 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
709 | if( dir == (*it)) { | 713 | if( dir == (*it)) { |
710 | addIt=false; | 714 | addIt=false; |
711 | } | 715 | } |
712 | } | 716 | } |
713 | if(addIt) { | 717 | if(addIt) { |
714 | menuButton->insertItem(dir); | 718 | menuButton->insertItem(dir); |
715 | // customDirMenu->insertItem(dir); | 719 | // customDirMenu->insertItem(dir); |
716 | list << dir; | 720 | list << dir; |
717 | } | 721 | } |
718 | 722 | ||
719 | cfg.writeEntry("CustomDir", list, ','); | 723 | cfg.writeEntry("CustomDir", list, ','); |
720 | cfg.write(); | 724 | cfg.write(); |
721 | } | 725 | } |
722 | 726 | ||
723 | void AdvancedFm::removeCustomDir() { | 727 | void AdvancedFm::removeCustomDir() { |
724 | // qDebug("remove custom dir"); | 728 | // qDebug("remove custom dir"); |
725 | Config cfg("AdvancedFm"); | 729 | Config cfg("AdvancedFm"); |
726 | cfg.setGroup("Menu"); | 730 | cfg.setGroup("Menu"); |
727 | QString dir; | 731 | QString dir; |
728 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); | 732 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); |
729 | QStringList list2; | 733 | QStringList list2; |
730 | dir = CurrentDir()->canonicalPath(); | 734 | dir = CurrentDir()->canonicalPath(); |
731 | int ramble=2; | 735 | int ramble=2; |
732 | // int ramble=-24; | 736 | // int ramble=-24; |
733 | //first remove list | 737 | //first remove list |
734 | if(list.grep(dir,true).isEmpty()) { | 738 | if(list.grep(dir,true).isEmpty()) { |
735 | QMessageBox::message(tr( "AdvancedFm" ), | 739 | QMessageBox::message(tr( "AdvancedFm" ), |
736 | tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); | 740 | tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); |
737 | } else { | 741 | } else { |
738 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 742 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
739 | if((*it) != dir) { | 743 | if((*it) != dir) { |
740 | //current item is not our current dir, so add it to temp list | 744 | //current item is not our current dir, so add it to temp list |
741 | list2 <<(*it); | 745 | list2 <<(*it); |
742 | } else { | 746 | } else { |
743 | // customDirMenu->removeItem( ramble); | 747 | // customDirMenu->removeItem( ramble); |
744 | menuButton->remove( ramble); | 748 | menuButton->remove( ramble); |
745 | 749 | ||
746 | } | 750 | } |
747 | ramble++; | 751 | ramble++; |
748 | // ramble--; | 752 | // ramble--; |
749 | } | 753 | } |
750 | 754 | ||
751 | cfg.writeEntry("CustomDir", list2, ','); | 755 | cfg.writeEntry("CustomDir", list2, ','); |
752 | cfg.write(); | 756 | cfg.write(); |
753 | } | 757 | } |
754 | // customDirsToMenu(); | 758 | // customDirsToMenu(); |
755 | 759 | ||
756 | } | 760 | } |
757 | 761 | ||
758 | void AdvancedFm::gotoCustomDir(const QString &dir) { | 762 | void AdvancedFm::gotoCustomDir(const QString &dir) { |
759 | // qDebug("gotoCustomDir(const QString &dir) " +dir ); | 763 | // qDebug("gotoCustomDir(const QString &dir) " +dir ); |
760 | // QString curDir = dir; | 764 | // QString curDir = dir; |
761 | // QDir *thisDir = CurrentDir(); | 765 | // QDir *thisDir = CurrentDir(); |
762 | // if( curDir.isEmpty()) { | 766 | // if( curDir.isEmpty()) { |
763 | // } | 767 | // } |
764 | if( dir == s_addBookmark) { | 768 | if( dir == s_addBookmark) { |
765 | addCustomDir(); | 769 | addCustomDir(); |
766 | } | 770 | } |
767 | if( dir == s_removeBookmark) { | 771 | if( dir == s_removeBookmark) { |
768 | removeCustomDir( ); | 772 | removeCustomDir( ); |
769 | } else { | 773 | } else { |
770 | gotoDirectory( dir); | 774 | gotoDirectory( dir); |
771 | // if(QDir( curDir).exists() ) | 775 | // if(QDir( curDir).exists() ) |
772 | // { | 776 | // { |
773 | // thisDir->setPath( curDir ); | 777 | // thisDir->setPath( curDir ); |
774 | // chdir( curDir.latin1() ); | 778 | // chdir( curDir.latin1() ); |
775 | // thisDir->cd( curDir, TRUE); | 779 | // thisDir->cd( curDir, TRUE); |
776 | // populateView(); | 780 | // populateView(); |
777 | // } | 781 | // } |
778 | } | 782 | } |
779 | } | 783 | } |
780 | 784 | ||
781 | QDir *AdvancedFm::CurrentDir() { | 785 | QDir *AdvancedFm::CurrentDir() { |
782 | 786 | ||
783 | if ( whichTab == 1) { | 787 | if ( whichTab == 1) { |
784 | return ¤tDir; | 788 | return ¤tDir; |
785 | } else { | 789 | } else { |
786 | return ¤tRemoteDir; | 790 | return ¤tRemoteDir; |
787 | } | 791 | } |
788 | } | 792 | } |
789 | 793 | ||
790 | QDir *AdvancedFm::OtherDir() { | 794 | QDir *AdvancedFm::OtherDir() { |
791 | if ( whichTab == 1) { | 795 | if ( whichTab == 1) { |
792 | return ¤tRemoteDir; | 796 | return ¤tRemoteDir; |
793 | } else { | 797 | } else { |
794 | return ¤tDir; | 798 | return ¤tDir; |
795 | } | 799 | } |
796 | } | 800 | } |
797 | 801 | ||
798 | QListView * AdvancedFm::CurrentView() { | 802 | QListView * AdvancedFm::CurrentView() { |
799 | if ( whichTab == 1) { | 803 | if ( whichTab == 1) { |
800 | // qWarning("CurrentView Tab 1"); | 804 | // qWarning("CurrentView Tab 1"); |
801 | return Local_View; | 805 | return Local_View; |
802 | } else { | 806 | } else { |
803 | // qWarning("CurrentView Tab 2"); | 807 | // qWarning("CurrentView Tab 2"); |
804 | return Remote_View; | 808 | return Remote_View; |
805 | } | 809 | } |
806 | } | 810 | } |
807 | 811 | ||
808 | QListView * AdvancedFm::OtherView() { | 812 | QListView * AdvancedFm::OtherView() { |
809 | if ( whichTab == 1) | 813 | if ( whichTab == 1) |
810 | return Remote_View; | 814 | return Remote_View; |
811 | else | 815 | else |
812 | return Local_View; | 816 | return Local_View; |
813 | } | 817 | } |
814 | 818 | ||
815 | void AdvancedFm::setOtherTabCurrent() { | 819 | void AdvancedFm::setOtherTabCurrent() { |
816 | qWarning("setOtherTabCurrent() %d", whichTab); | 820 | // qWarning("setOtherTabCurrent() %d", whichTab); |
817 | if ( whichTab == 1) { | 821 | if ( whichTab == 1) { |
818 | TabWidget->setCurrentWidget(1); | 822 | TabWidget->setCurrentWidget(1); |
819 | } else { | 823 | } else { |
820 | TabWidget->setCurrentWidget(0); | 824 | TabWidget->setCurrentWidget(0); |
821 | } | 825 | } |
822 | OtherView()->setFocus(); | 826 | OtherView()->setFocus(); |
823 | OtherView()->setSelected( CurrentView()->firstChild(), true); | 827 | OtherView()->setSelected( CurrentView()->firstChild(), true); |
824 | } | 828 | } |
825 | 829 | ||
826 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { | 830 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { |
827 | // qDebug("qcop message "+msg ); | 831 | // qDebug("qcop message "+msg ); |
828 | QDataStream stream ( data, IO_ReadOnly ); | 832 | QDataStream stream ( data, IO_ReadOnly ); |
829 | if ( msg == "openDirectory(QString)" ) { | 833 | if ( msg == "openDirectory(QString)" ) { |
830 | // qDebug("received"); | 834 | // qDebug("received"); |
831 | QString file; | 835 | QString file; |
832 | stream >> file; | 836 | stream >> file; |
833 | gotoDirectory( (const QString &) file); | 837 | gotoDirectory( (const QString &) file); |
834 | } | 838 | } |
835 | } | 839 | } |
836 | 840 | ||
837 | void AdvancedFm::setDocument(const QString &file) { | 841 | void AdvancedFm::setDocument(const QString &file) { |
838 | gotoDirectory( file); | 842 | gotoDirectory( file); |
839 | 843 | ||
840 | } | 844 | } |
841 | 845 | ||
842 | void AdvancedFm::gotoDirectory(const QString &file) { | 846 | void AdvancedFm::gotoDirectory(const QString &file) { |
843 | // qWarning("goto dir "+file); | 847 | // qWarning("goto dir "+file); |
844 | QString curDir = file; | 848 | QString curDir = file; |
845 | QDir *thisDir = CurrentDir(); | 849 | QDir *thisDir = CurrentDir(); |
846 | if(QDir( curDir).exists() ) { | 850 | if(QDir( curDir).exists() ) { |
847 | thisDir->setPath( curDir ); | 851 | thisDir->setPath( curDir ); |
848 | chdir( curDir.latin1() ); | 852 | chdir( curDir.latin1() ); |
849 | thisDir->cd( curDir, TRUE); | 853 | thisDir->cd( curDir, TRUE); |
850 | populateView(); | 854 | populateView(); |
851 | } | 855 | } |
852 | else if(QFileInfo(curDir).exists()) { | 856 | else if(QFileInfo(curDir).exists()) { |
853 | QFileInfo fileInfo(curDir); | 857 | QFileInfo fileInfo(curDir); |
854 | curDir=fileInfo.dirPath(); | 858 | curDir=fileInfo.dirPath(); |
855 | if(QDir( curDir).exists() ) { | 859 | if(QDir( curDir).exists() ) { |
856 | thisDir->setPath( curDir ); | 860 | thisDir->setPath( curDir ); |
857 | chdir( curDir.latin1() ); | 861 | chdir( curDir.latin1() ); |
858 | thisDir->cd( curDir, TRUE); | 862 | thisDir->cd( curDir, TRUE); |
859 | populateView(); | 863 | populateView(); |
860 | } | 864 | } |
861 | findFile(file); | 865 | findFile(file); |
862 | } | 866 | } |
863 | 867 | ||
864 | } | 868 | } |
865 | 869 | ||
866 | void AdvancedFm::findFile(const QString &fileName) { | 870 | void AdvancedFm::findFile(const QString &fileName) { |
867 | QFileInfo fi(fileName); | 871 | QFileInfo fi(fileName); |
868 | QListView *thisView = CurrentView(); | 872 | QListView *thisView = CurrentView(); |
869 | QListViewItemIterator it( thisView ); | 873 | QListViewItemIterator it( thisView ); |
870 | for ( ; it.current(); ++it ) { | 874 | for ( ; it.current(); ++it ) { |
871 | if(it.current()->text(0) == fi.fileName()) { | 875 | if(it.current()->text(0) == fi.fileName()) { |
872 | it.current()->setSelected(true); | 876 | it.current()->setSelected(true); |
873 | thisView->ensureItemVisible(it.current()); | 877 | thisView->ensureItemVisible(it.current()); |
874 | } | 878 | } |
875 | } | 879 | } |
876 | } | 880 | } |
877 | 881 | ||
878 | void AdvancedFm::slotSwitchMenu(int ) { | 882 | void AdvancedFm::slotSwitchMenu(int ) { |
879 | // qDebug("Switch %d", item); | 883 | // qDebug("Switch %d", item); |
880 | // viewMenu->setItemChecked(item, true); | 884 | // viewMenu->setItemChecked(item, true); |
881 | } | 885 | } |
882 | 886 | ||
883 | void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) { | 887 | void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) { |
884 | tabChanged( w); | 888 | tabChanged( w); |
885 | if( w == Local_View) { | 889 | if( w == Local_View) { |
886 | Remote_View->clearFocus(); | 890 | Remote_View->clearFocus(); |
887 | } else { | 891 | } else { |
888 | Local_View->clearFocus(); | 892 | Local_View->clearFocus(); |
889 | } | 893 | } |
890 | } | 894 | } |
891 | 895 | ||
892 | void AdvancedFm::navigateToSelected() { | 896 | void AdvancedFm::navigateToSelected() { |
893 | if( !CurrentView()->currentItem()) return; | 897 | if( !CurrentView()->currentItem()) return; |
894 | doDirChange(); | 898 | doDirChange(); |
895 | } | 899 | } |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index be574c4..bfefa77 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -1,187 +1,192 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | advancedfm.h | 2 | advancedfm.h |
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 | #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 <opie/otabwidget.h> |
18 | #include <opie/oprocess.h> | 18 | #include <opie/oprocess.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 | class OSplitter; |
34 | class QVBoxLayout; | 34 | class QVBoxLayout; |
35 | class QHBoxLayout; | 35 | class QHBoxLayout; |
36 | class QGridLayout; | 36 | class QGridLayout; |
37 | class QComboBox; | 37 | class QComboBox; |
38 | class QListView; | 38 | class QListView; |
39 | class QListviewItem; | 39 | class QListviewItem; |
40 | class QLabel; | 40 | class QLabel; |
41 | class QProgressBar; | 41 | class QProgressBar; |
42 | class QSpinBox; | 42 | class QSpinBox; |
43 | class QTabWidget; | 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 | { |
56 | Q_OBJECT | 56 | Q_OBJECT |
57 | public: | 57 | public: |
58 | static QString appName() { return QString::fromLatin1("advancedfm"); } | ||
59 | #ifdef NOQUICKLAUNCH | ||
58 | AdvancedFm(); | 60 | AdvancedFm(); |
61 | #else | ||
62 | AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0); | ||
63 | #endif | ||
59 | ~AdvancedFm(); | 64 | ~AdvancedFm(); |
60 | protected slots: | 65 | protected slots: |
61 | void slotSwitchMenu(int); | 66 | void slotSwitchMenu(int); |
62 | void selectAll(); | 67 | void selectAll(); |
63 | void addToDocs(); | 68 | void addToDocs(); |
64 | void doDirChange(); | 69 | void doDirChange(); |
65 | void mkDir(); | 70 | void mkDir(); |
66 | void del(); | 71 | void del(); |
67 | void rn(); | 72 | void rn(); |
68 | void populateView(); | 73 | void populateView(); |
69 | void rePopulate(); | 74 | void rePopulate(); |
70 | void showHidden(); | 75 | void showHidden(); |
71 | void showMenuHidden(); | 76 | void showMenuHidden(); |
72 | void writeConfig(); | 77 | void writeConfig(); |
73 | void readConfig(); | 78 | void readConfig(); |
74 | void ListClicked(QListViewItem *); | 79 | void ListClicked(QListViewItem *); |
75 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 80 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
76 | void makeDir(); | 81 | void makeDir(); |
77 | void doDelete(); | 82 | void doDelete(); |
78 | void tabChanged(QWidget*); | 83 | void tabChanged(QWidget*); |
79 | void cleanUp(); | 84 | void cleanUp(); |
80 | void renameIt(); | 85 | void renameIt(); |
81 | void runThis(); | 86 | void runThis(); |
82 | void runText(); | 87 | void runText(); |
83 | void filePerms(); | 88 | void filePerms(); |
84 | void doProperties(); | 89 | void doProperties(); |
85 | void runCommand(); | 90 | void runCommand(); |
86 | void runCommandStd(); | 91 | void runCommandStd(); |
87 | QStringList getPath(); | 92 | QStringList getPath(); |
88 | void mkSym(); | 93 | void mkSym(); |
89 | void switchToLocalTab(); | 94 | void switchToLocalTab(); |
90 | void switchToRemoteTab(); | 95 | void switchToRemoteTab(); |
91 | 96 | ||
92 | protected: | 97 | protected: |
93 | 98 | ||
94 | OSplitter *TabWidget; | 99 | OSplitter *TabWidget; |
95 | QCopChannel * channel; | 100 | QCopChannel * channel; |
96 | QPixmap unknownXpm; | 101 | QPixmap unknownXpm; |
97 | int whichTab; | 102 | int whichTab; |
98 | // QTabWidget *TabWidget; | 103 | // QTabWidget *TabWidget; |
99 | QWidget *tab, *tab_2, *tab_3; | 104 | QWidget *tab, *tab_2, *tab_3; |
100 | QListView *Local_View, *Remote_View; | 105 | QListView *Local_View, *Remote_View; |
101 | 106 | ||
102 | QLineEdit *currentPathEdit; | 107 | QLineEdit *currentPathEdit; |
103 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; | 108 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; |
104 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 109 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
105 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 110 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
106 | QDir currentDir, currentRemoteDir; | 111 | QDir currentDir, currentRemoteDir; |
107 | QComboBox *currentPathCombo; | 112 | QComboBox *currentPathCombo; |
108 | QString filterStr, s_addBookmark, s_removeBookmark; | 113 | QString filterStr, s_addBookmark, s_removeBookmark; |
109 | QListViewItem * item; | 114 | QListViewItem * item; |
110 | bool b; | 115 | bool b; |
111 | QStringList fileSystemTypeList, fsList; | 116 | QStringList fileSystemTypeList, fsList; |
112 | int currentServerConfig; | 117 | int currentServerConfig; |
113 | bool zaurusDevice; | 118 | bool zaurusDevice; |
114 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 119 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
115 | QStringList remoteDirPathStringList, localDirPathStringList; | 120 | QStringList remoteDirPathStringList, localDirPathStringList; |
116 | QLineEdit *renameBox; | 121 | QLineEdit *renameBox; |
117 | 122 | ||
118 | void init(); | 123 | void init(); |
119 | void initConnections(); | 124 | void initConnections(); |
120 | void keyReleaseEvent( QKeyEvent *); | 125 | void keyReleaseEvent( QKeyEvent *); |
121 | void keyPressEvent( QKeyEvent *); | 126 | void keyPressEvent( QKeyEvent *); |
122 | QString getFileSystemType(const QString &); | 127 | QString getFileSystemType(const QString &); |
123 | QString getDiskSpace(const QString &); | 128 | QString getDiskSpace(const QString &); |
124 | void parsetab(const QString &fileName); | 129 | void parsetab(const QString &fileName); |
125 | QString checkDiskSpace(const QString &); | 130 | QString checkDiskSpace(const QString &); |
126 | QString dealWithSymName(const QString &); | 131 | QString dealWithSymName(const QString &); |
127 | QDir *CurrentDir(); | 132 | QDir *CurrentDir(); |
128 | QDir *OtherDir(); | 133 | QDir *OtherDir(); |
129 | QListView *CurrentView(); | 134 | QListView *CurrentView(); |
130 | QListView *OtherView(); | 135 | QListView *OtherView(); |
131 | void setOtherTabCurrent(); | 136 | void setOtherTabCurrent(); |
132 | void dealWithSchmooSchmaa(QWidget *); | 137 | void dealWithSchmooSchmaa(QWidget *); |
133 | 138 | ||
134 | protected slots: | 139 | protected slots: |
135 | void openSearch(); | 140 | void openSearch(); |
136 | void dirMenuSelected(int); | 141 | void dirMenuSelected(int); |
137 | void showFileMenu(); | 142 | void showFileMenu(); |
138 | void cancelMenuTimer(); | 143 | void cancelMenuTimer(); |
139 | void homeButtonPushed(); | 144 | void homeButtonPushed(); |
140 | void docButtonPushed(); | 145 | void docButtonPushed(); |
141 | void SDButtonPushed(); | 146 | void SDButtonPushed(); |
142 | void CFButtonPushed(); | 147 | void CFButtonPushed(); |
143 | void QPEButtonPushed(); | 148 | void QPEButtonPushed(); |
144 | void upDir(); | 149 | void upDir(); |
145 | void currentPathComboChanged(); | 150 | void currentPathComboChanged(); |
146 | void copy(); | 151 | void copy(); |
147 | void copyAs(); | 152 | void copyAs(); |
148 | void copySameDir(); | 153 | void copySameDir(); |
149 | void currentPathComboActivated(const QString &); | 154 | void currentPathComboActivated(const QString &); |
150 | void fillCombo(const QString &); | 155 | void fillCombo(const QString &); |
151 | bool copyFile( const QString & , const QString & ); | 156 | bool copyFile( const QString & , const QString & ); |
152 | void move(); | 157 | void move(); |
153 | void fileStatus(); | 158 | void fileStatus(); |
154 | void doAbout(); | 159 | void doAbout(); |
155 | void doBeam(); | 160 | void doBeam(); |
156 | void fileBeamFinished( Ir *); | 161 | void fileBeamFinished( Ir *); |
157 | bool copyDirectory( const QString & , const QString & ); | 162 | bool copyDirectory( const QString & , const QString & ); |
158 | // void navigateToSelected(); | 163 | // void navigateToSelected(); |
159 | bool moveDirectory( const QString & , const QString & ); | 164 | bool moveDirectory( const QString & , const QString & ); |
160 | // void slotSwitchtoLocal(int); | 165 | // void slotSwitchtoLocal(int); |
161 | 166 | ||
162 | private: | 167 | private: |
163 | MenuButton *menuButton; | 168 | MenuButton *menuButton; |
164 | QString oldName; | 169 | QString oldName; |
165 | QTimer menuTimer; | 170 | QTimer menuTimer; |
166 | void startProcess(const QString &); | 171 | void startProcess(const QString &); |
167 | bool eventFilter( QObject * , QEvent * ); | 172 | bool eventFilter( QObject * , QEvent * ); |
168 | void cancelRename(); | 173 | void cancelRename(); |
169 | void doRename(QListView *); | 174 | void doRename(QListView *); |
170 | void okRename(); | 175 | void okRename(); |
171 | void customDirsToMenu(); | 176 | void customDirsToMenu(); |
172 | void addCustomDir(); | 177 | void addCustomDir(); |
173 | void removeCustomDir(); | 178 | void removeCustomDir(); |
174 | void gotoDirectory(const QString &); | 179 | void gotoDirectory(const QString &); |
175 | void navigateToSelected(); | 180 | void navigateToSelected(); |
176 | void findFile(const QString &); | 181 | void findFile(const QString &); |
177 | 182 | ||
178 | private slots: | 183 | private slots: |
179 | void processEnded(OProcess *); | 184 | void processEnded(OProcess *); |
180 | void oprocessStderr(OProcess *, char *, int); | 185 | void oprocessStderr(OProcess *, char *, int); |
181 | void gotoCustomDir(const QString &); | 186 | void gotoCustomDir(const QString &); |
182 | void qcopReceive(const QCString&, const QByteArray&); | 187 | void qcopReceive(const QCString&, const QByteArray&); |
183 | void setDocument(const QString &); | 188 | void setDocument(const QString &); |
184 | 189 | ||
185 | }; | 190 | }; |
186 | 191 | ||
187 | #endif // ADVANCEDFM_H | 192 | #endif // ADVANCEDFM_H |
diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro index 590db6a..70db018 100644 --- a/noncore/apps/advancedfm/advancedfm.pro +++ b/noncore/apps/advancedfm/advancedfm.pro | |||
@@ -1,11 +1,35 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release quick-app |
3 | # CONFIG += qt warn_on release | ||
3 | HEADERS = advancedfm.h filePermissions.h output.h | 4 | HEADERS = advancedfm.h filePermissions.h output.h |
4 | 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 |
5 | TARGET = advancedfm | 6 | TARGET = advancedfm |
6 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
8 | DESTDIR = $(OPIEDIR)/bin | ||
9 | LIBS += -lqpe -lopie | 9 | LIBS += -lqpe -lopie |
10 | 10 | ||
11 | TRANSLATIONS = ../../../i18n/de/advancedfm.ts \ | ||
12 | ../../../i18n/nl/advancedfm.ts \ | ||
13 | ../../../i18n/da/advancedfm.ts \ | ||
14 | ../../../i18n/xx/advancedfm.ts \ | ||
15 | ../../../i18n/en/advancedfm.ts \ | ||
16 | ../../../i18n/es/advancedfm.ts \ | ||
17 | ../../../i18n/fr/advancedfm.ts \ | ||
18 | ../../../i18n/hu/advancedfm.ts \ | ||
19 | ../../../i18n/ja/advancedfm.ts \ | ||
20 | ../../../i18n/ko/advancedfm.ts \ | ||
21 | ../../../i18n/no/advancedfm.ts \ | ||
22 | ../../../i18n/pl/advancedfm.ts \ | ||
23 | ../../../i18n/pt/advancedfm.ts \ | ||
24 | ../../../i18n/pt_BR/advancedfm.ts \ | ||
25 | ../../../i18n/sl/advancedfm.ts \ | ||
26 | ../../../i18n/zh_CN/advancedfm.ts \ | ||
27 | ../../../i18n/zh_TW/advancedfm.ts | ||
28 | |||
29 | |||
30 | !contains(CONFIG,quick-app) { | ||
31 | DESTDIR = $(OPIEDIR)/bin | ||
32 | DEFINES += NOQUICKLAUNCH | ||
33 | } | ||
34 | |||
11 | include ( $(OPIEDIR)/include.pro ) | 35 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/apps/advancedfm/main.cpp b/noncore/apps/advancedfm/main.cpp index 8cacc4a..51e38dc 100644 --- a/noncore/apps/advancedfm/main.cpp +++ b/noncore/apps/advancedfm/main.cpp | |||
@@ -1,27 +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> | 13 | #include <qpe/qpeapplication.h> |
14 | 14 | ||
15 | 15 | ||
16 | 16 | ||
17 | #include "advancedfm.h" | 17 | #include "advancedfm.h" |
18 | 18 | ||
19 | #ifdef NOQUICKLAUNCH | ||
19 | int main(int argc, char *argv[]) | 20 | int main(int argc, char *argv[]) |
20 | { | 21 | { |
21 | QPEApplication a(argc, argv); | 22 | QPEApplication a(argc, argv); |
22 | 23 | ||
23 | AdvancedFm advencedFm; | 24 | AdvancedFm advencedFm; |
24 | a.showMainWidget( &advencedFm); | 25 | a.showMainWidget( &advencedFm); |
25 | return a.exec(); | 26 | return a.exec(); |
26 | } | 27 | } |
28 | #else | ||
29 | #include <opie/oapplicationfactory.h> | ||
27 | 30 | ||
31 | OPIE_EXPORT_APP( OApplicationFactory<AdvancedFm> ) | ||
32 | |||
33 | #endif | ||