-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 57 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 8 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 15 | ||||
-rw-r--r-- | noncore/apps/advancedfm/main.cpp | 2 |
4 files changed, 31 insertions, 51 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index a47edd8..afb44f5 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,431 +1,424 @@ | |||
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 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
16 | #include <qpe/config.h> | 16 | #include <qpe/config.h> |
17 | #include <qpe/mimetype.h> | 17 | #include <qpe/mimetype.h> |
18 | #include <qpe/applnk.h> | 18 | #include <qpe/applnk.h> |
19 | #include <qpe/resource.h> | 19 | #include <qpe/resource.h> |
20 | #include <qpe/menubutton.h> | 20 | #include <qpe/menubutton.h> |
21 | 21 | ||
22 | #include <qcombobox.h> | 22 | #include <qcombobox.h> |
23 | #include <qpopupmenu.h> | 23 | #include <qpopupmenu.h> |
24 | #include <qlistview.h> | 24 | #include <qlistview.h> |
25 | #include <qmessagebox.h> | 25 | #include <qmessagebox.h> |
26 | #include <qlineedit.h> | 26 | #include <qlineedit.h> |
27 | 27 | ||
28 | 28 | ||
29 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
30 | #include <time.h> | 30 | #include <time.h> |
31 | #include <dirent.h> | 31 | #include <dirent.h> |
32 | #include <fcntl.h> | 32 | #include <fcntl.h> |
33 | #include <sys/vfs.h> | 33 | #include <sys/vfs.h> |
34 | #include <mntent.h> | 34 | #include <mntent.h> |
35 | 35 | ||
36 | using namespace Opie::Ui; | 36 | using namespace Opie::Ui; |
37 | 37 | ||
38 | #ifdef NOQUICKLAUNCH | ||
39 | AdvancedFm::AdvancedFm( ) | ||
40 | #else | ||
41 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) | 38 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) |
42 | #endif | ||
43 | : QMainWindow( ) { | 39 | : QMainWindow( ) { |
44 | init(); | 40 | init(); |
45 | renameBox = 0; | 41 | renameBox = 0; |
46 | 42 | ||
47 | unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 43 | unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
48 | 44 | ||
49 | initConnections(); | 45 | initConnections(); |
50 | whichTab=1; | 46 | whichTab=1; |
51 | rePopulate(); | 47 | rePopulate(); |
52 | currentPathCombo->setFocus(); | 48 | currentPathCombo->setFocus(); |
53 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); | 49 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); |
54 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), | 50 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
55 | this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); | 51 | this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); |
56 | } | 52 | } |
57 | 53 | ||
58 | AdvancedFm::~AdvancedFm() { | 54 | AdvancedFm::~AdvancedFm() { |
59 | } | 55 | } |
60 | 56 | ||
61 | 57 | ||
62 | void AdvancedFm::cleanUp() { | 58 | void AdvancedFm::cleanUp() { |
63 | QString sfile=QDir::homeDirPath(); | 59 | QString sfile=QDir::homeDirPath(); |
64 | if(sfile.right(1) != "/") | 60 | if(sfile.right(1) != "/") |
65 | sfile+="/._temp"; | 61 | sfile+="/._temp"; |
66 | else | 62 | else |
67 | sfile+="._temp"; | 63 | sfile+="._temp"; |
68 | QFile file( sfile); | 64 | QFile file( sfile); |
69 | if(file.exists()) | 65 | if(file.exists()) |
70 | file.remove(); | 66 | file.remove(); |
71 | } | 67 | } |
72 | 68 | ||
73 | void AdvancedFm::tabChanged(QWidget *) { | 69 | void AdvancedFm::tabChanged(QWidget *) { |
74 | // owarn << "tab changed" << oendl; | 70 | // owarn << "tab changed" << oendl; |
75 | QString path = CurrentDir()->canonicalPath(); | 71 | QString path = CurrentDir()->canonicalPath(); |
76 | currentPathCombo->lineEdit()->setText( path ); | 72 | currentPathCombo->lineEdit()->setText( path ); |
77 | 73 | ||
78 | if(whichTab == 1) { | 74 | if(whichTab == 1) { |
79 | viewMenu->setItemChecked(viewMenu->idAt(0), true); | 75 | viewMenu->setItemChecked(viewMenu->idAt(0), true); |
80 | viewMenu->setItemChecked(viewMenu->idAt(1), false); | 76 | viewMenu->setItemChecked(viewMenu->idAt(1), false); |
81 | } else { | 77 | } else { |
82 | viewMenu->setItemChecked(viewMenu->idAt(0), false); | 78 | viewMenu->setItemChecked(viewMenu->idAt(0), false); |
83 | viewMenu->setItemChecked(viewMenu->idAt(1), true); | 79 | viewMenu->setItemChecked(viewMenu->idAt(1), true); |
84 | } | 80 | } |
85 | 81 | ||
86 | QString fs= getFileSystemType( (const QString &) path); | 82 | QString fs= getFileSystemType( (const QString &) path); |
87 | 83 | ||
88 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 84 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
89 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); | 85 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); |
90 | chdir( path.latin1()); | 86 | chdir( path.latin1()); |
91 | } | 87 | } |
92 | 88 | ||
93 | 89 | ||
94 | void AdvancedFm::populateView() { | 90 | void AdvancedFm::populateView() { |
95 | 91 | ||
96 | // owarn << "PopulateView" << oendl; | 92 | // owarn << "PopulateView" << oendl; |
97 | QPixmap pm; | 93 | QPixmap pm; |
98 | QListView *thisView = CurrentView(); | 94 | QListView *thisView = CurrentView(); |
99 | QDir *thisDir = CurrentDir(); | 95 | QDir *thisDir = CurrentDir(); |
100 | QString path = thisDir->canonicalPath(); | 96 | QString path = thisDir->canonicalPath(); |
101 | 97 | ||
102 | //owarn << "path is "+path << oendl; | 98 | //owarn << "path is "+path << oendl; |
103 | thisView->clear(); | 99 | thisView->clear(); |
104 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 100 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
105 | thisDir->setMatchAllDirs(TRUE); | 101 | thisDir->setMatchAllDirs(TRUE); |
106 | thisDir->setNameFilter(filterStr); | 102 | thisDir->setNameFilter(filterStr); |
107 | QString fileL, fileS, fileDate; | 103 | QString fileL, fileS, fileDate; |
108 | QString fs= getFileSystemType((const QString &) path); | 104 | QString fs= getFileSystemType((const QString &) path); |
109 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 105 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
110 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); | 106 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); |
111 | bool isDir=FALSE; | 107 | bool isDir=FALSE; |
112 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 108 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
113 | QFileInfoListIterator it(*list); | 109 | QFileInfoListIterator it(*list); |
114 | QFileInfo *fi; | 110 | QFileInfo *fi; |
115 | while ( (fi=it.current()) ) { | 111 | while ( (fi=it.current()) ) { |
116 | if (fi->isSymLink() ) { | 112 | if (fi->isSymLink() ) { |
117 | QString symLink=fi->readLink(); | 113 | QString symLink=fi->readLink(); |
118 | QFileInfo sym( symLink); | 114 | QFileInfo sym( symLink); |
119 | fileS.sprintf( "%10i", sym.size() ); | 115 | fileS.sprintf( "%10i", sym.size() ); |
120 | fileL = fi->fileName() +" -> " + sym.filePath().data(); | 116 | fileL = fi->fileName() +" -> " + sym.filePath().data(); |
121 | fileDate = sym.lastModified().toString(); | 117 | fileDate = sym.lastModified().toString(); |
122 | } else { | 118 | } else { |
123 | fileS.sprintf( "%10i", fi->size() ); | 119 | fileS.sprintf( "%10i", fi->size() ); |
124 | fileL = fi->fileName(); | 120 | fileL = fi->fileName(); |
125 | fileDate= fi->lastModified().toString(); | 121 | fileDate= fi->lastModified().toString(); |
126 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { | 122 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { |
127 | // if(fileL == "..") | 123 | // if(fileL == "..") |
128 | fileL += "/"; | 124 | fileL += "/"; |
129 | isDir=TRUE; | 125 | isDir=TRUE; |
130 | } | 126 | } |
131 | } | 127 | } |
132 | QFileInfo fileInfo( path + "/" + fileL); | 128 | QFileInfo fileInfo( path + "/" + fileL); |
133 | 129 | ||
134 | if(fileL !="./" && fi->exists()) { | 130 | if(fileL !="./" && fi->exists()) { |
135 | item = new QListViewItem( thisView, fileL, fileS , fileDate); | 131 | item = new QListViewItem( thisView, fileL, fileS , fileDate); |
136 | 132 | ||
137 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 133 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
138 | 134 | ||
139 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 135 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
140 | pm = Resource::loadPixmap( "lockedfolder" ); | 136 | pm = Resource::loadPixmap( "lockedfolder" ); |
141 | else | 137 | else |
142 | pm= Resource::loadPixmap( "folder" ); | 138 | pm= Resource::loadPixmap( "folder" ); |
143 | } | 139 | } |
144 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 140 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
145 | pm = Resource::loadPixmap( "exec"); | 141 | pm = Resource::loadPixmap( "exec"); |
146 | } | 142 | } |
147 | else if( (fileInfo.permission( QFileInfo::ExeUser) | 143 | else if( (fileInfo.permission( QFileInfo::ExeUser) |
148 | | fileInfo.permission( QFileInfo::ExeGroup) | 144 | | fileInfo.permission( QFileInfo::ExeGroup) |
149 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 145 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
150 | pm = Resource::loadPixmap( "exec"); | 146 | pm = Resource::loadPixmap( "exec"); |
151 | } | 147 | } |
152 | else if( !fi->isReadable() ) { | 148 | else if( !fi->isReadable() ) { |
153 | pm = Resource::loadPixmap( "locked" ); | 149 | pm = Resource::loadPixmap( "locked" ); |
154 | } | 150 | } |
155 | else { //everything else goes by mimetype | 151 | else { //everything else goes by mimetype |
156 | MimeType mt(fi->filePath()); | 152 | MimeType mt(fi->filePath()); |
157 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 153 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
158 | if(pm.isNull()) { | 154 | if(pm.isNull()) { |
159 | pm = unknownXpm; | 155 | pm = unknownXpm; |
160 | } | 156 | } |
161 | } | 157 | } |
162 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { | 158 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { |
163 | // odebug << " overlay link image" << oendl; | 159 | // odebug << " overlay link image" << oendl; |
164 | pm= Resource::loadPixmap( "advancedfm/symlink" ); | 160 | pm= Resource::loadPixmap( "advancedfm/symlink" ); |
165 | // pm= Resource::loadPixmap( "folder" ); | 161 | // pm= Resource::loadPixmap( "folder" ); |
166 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 162 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
167 | // QPainter painter( &pm ); | 163 | // QPainter painter( &pm ); |
168 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 164 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
169 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); | 165 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); |
170 | } | 166 | } |
171 | item->setPixmap( 0,pm); | 167 | item->setPixmap( 0,pm); |
172 | 168 | ||
173 | } | 169 | } |
174 | isDir=FALSE; | 170 | isDir=FALSE; |
175 | ++it; | 171 | ++it; |
176 | } | 172 | } |
177 | 173 | ||
178 | if( path.find("dev",0,TRUE) != -1) { | 174 | if( path.find("dev",0,TRUE) != -1) { |
179 | struct stat buf; | 175 | struct stat buf; |
180 | dev_t devT; | 176 | dev_t devT; |
181 | DIR *dir; | 177 | DIR *dir; |
182 | struct dirent *mydirent; | 178 | struct dirent *mydirent; |
183 | 179 | ||
184 | if((dir = opendir( path.latin1())) != NULL) | 180 | if((dir = opendir( path.latin1())) != NULL) |
185 | while ((mydirent = readdir(dir)) != NULL) { | 181 | while ((mydirent = readdir(dir)) != NULL) { |
186 | lstat( mydirent->d_name, &buf); | 182 | lstat( mydirent->d_name, &buf); |
187 | // odebug << mydirent->d_name << oendl; | 183 | // odebug << mydirent->d_name << oendl; |
188 | fileL.sprintf("%s", mydirent->d_name); | 184 | fileL.sprintf("%s", mydirent->d_name); |
189 | devT = buf.st_dev; | 185 | devT = buf.st_dev; |
190 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 186 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
191 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 187 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
192 | if( fileL.find(".") == -1 ) { | 188 | if( fileL.find(".") == -1 ) { |
193 | item= new QListViewItem( thisView, fileL, fileS, fileDate); | 189 | item= new QListViewItem( thisView, fileL, fileS, fileDate); |
194 | pm = unknownXpm; | 190 | pm = unknownXpm; |
195 | item->setPixmap( 0,pm); | 191 | item->setPixmap( 0,pm); |
196 | } | 192 | } |
197 | } | 193 | } |
198 | 194 | ||
199 | closedir(dir); | 195 | closedir(dir); |
200 | } | 196 | } |
201 | 197 | ||
202 | thisView->setSorting( 3,FALSE); | 198 | thisView->setSorting( 3,FALSE); |
203 | fillCombo( (const QString &) path ); | 199 | fillCombo( (const QString &) path ); |
204 | } | 200 | } |
205 | 201 | ||
206 | void AdvancedFm::rePopulate() { | 202 | void AdvancedFm::rePopulate() { |
207 | populateView(); | 203 | populateView(); |
208 | setOtherTabCurrent(); | 204 | setOtherTabCurrent(); |
209 | populateView(); | 205 | populateView(); |
210 | 206 | ||
211 | // int tmpTab = whichTab; | 207 | // int tmpTab = whichTab; |
212 | // // odebug << "" << tmpTab << "" << oendl; | 208 | // // odebug << "" << tmpTab << "" << oendl; |
213 | 209 | ||
214 | // for(int i =1; i < 3; i++) { | 210 | // for(int i =1; i < 3; i++) { |
215 | // TabWidget->setCurrentWidget(i - 1); | 211 | // TabWidget->setCurrentWidget(i - 1); |
216 | // populateView(); | 212 | // populateView(); |
217 | // } | 213 | // } |
218 | // TabWidget->setCurrentWidget( tmpTab - 1); | 214 | // TabWidget->setCurrentWidget( tmpTab - 1); |
219 | } | 215 | } |
220 | 216 | ||
221 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { | 217 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { |
222 | //owarn << "listclicked" << oendl; | 218 | //owarn << "listclicked" << oendl; |
223 | if(selectedItem) { | 219 | if(selectedItem) { |
224 | QString strItem=selectedItem->text(0); | 220 | QString strItem=selectedItem->text(0); |
225 | // owarn << strItem << oendl; | 221 | // owarn << strItem << oendl; |
226 | QString strSize=selectedItem->text(1); | 222 | QString strSize=selectedItem->text(1); |
227 | strSize=strSize.stripWhiteSpace(); | 223 | strSize=strSize.stripWhiteSpace(); |
228 | bool isDirectory = false; | 224 | bool isDirectory = false; |
229 | QString strItem2; | 225 | QString strItem2; |
230 | 226 | ||
231 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink | 227 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink |
232 | strItem2 = dealWithSymName((const QString&)strItem); | 228 | strItem2 = dealWithSymName((const QString&)strItem); |
233 | if(QDir(strItem2).exists() ) | 229 | if(QDir(strItem2).exists() ) |
234 | strItem = strItem2; | 230 | strItem = strItem2; |
235 | } | 231 | } |
236 | 232 | ||
237 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 233 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
238 | 234 | ||
239 | if(QDir(strItem).exists()) | 235 | if(QDir(strItem).exists()) |
240 | isDirectory = true; | 236 | isDirectory = true; |
241 | } | 237 | } |
242 | 238 | ||
243 | if( isDirectory ) { | 239 | if( isDirectory ) { |
244 | CurrentDir()->cd( strItem, TRUE); | 240 | CurrentDir()->cd( strItem, TRUE); |
245 | populateView(); | 241 | populateView(); |
246 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); | 242 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); |
247 | } | 243 | } |
248 | chdir( strItem.latin1()); | 244 | chdir( strItem.latin1()); |
249 | } | 245 | } |
250 | } | 246 | } |
251 | 247 | ||
252 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { | 248 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { |
253 | dealWithSchmooSchmaa( item->listView()); | 249 | dealWithSchmooSchmaa( item->listView()); |
254 | switch (mouse) { | 250 | switch (mouse) { |
255 | case 1: | 251 | case 1: |
256 | { | 252 | { |
257 | if(renameBox != 0 ) { | 253 | if(renameBox != 0 ) { |
258 | cancelRename(); | 254 | cancelRename(); |
259 | } | 255 | } |
260 | } | 256 | } |
261 | break; | 257 | break; |
262 | case 2: | ||
263 | menuTimer.start( 500, TRUE ); | ||
264 | break; | ||
265 | }; | 258 | }; |
266 | } | 259 | } |
267 | 260 | ||
268 | 261 | ||
269 | void AdvancedFm::switchToLocalTab() { | 262 | void AdvancedFm::switchToLocalTab() { |
270 | //owarn << "switch to local view" << oendl; | 263 | //owarn << "switch to local view" << oendl; |
271 | TabWidget->setCurrentWidget(0); | 264 | TabWidget->setCurrentWidget(0); |
272 | Local_View->setFocus(); | 265 | Local_View->setFocus(); |
273 | } | 266 | } |
274 | 267 | ||
275 | void AdvancedFm::switchToRemoteTab() { | 268 | void AdvancedFm::switchToRemoteTab() { |
276 | //owarn << "switch to local view" << oendl; | 269 | //owarn << "switch to local view" << oendl; |
277 | TabWidget->setCurrentWidget(1); | 270 | TabWidget->setCurrentWidget(1); |
278 | Remote_View->setFocus(); | 271 | Remote_View->setFocus(); |
279 | } | 272 | } |
280 | 273 | ||
281 | void AdvancedFm::readConfig() { | 274 | void AdvancedFm::readConfig() { |
282 | Config cfg("AdvancedFm"); | 275 | Config cfg("AdvancedFm"); |
283 | } | 276 | } |
284 | 277 | ||
285 | void AdvancedFm::writeConfig() { | 278 | void AdvancedFm::writeConfig() { |
286 | Config cfg("AdvancedFm"); | 279 | Config cfg("AdvancedFm"); |
287 | } | 280 | } |
288 | 281 | ||
289 | void AdvancedFm::currentPathComboChanged() { | 282 | void AdvancedFm::currentPathComboChanged() { |
290 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 283 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
291 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); | 284 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); |
292 | populateView(); | 285 | populateView(); |
293 | } else { | 286 | } else { |
294 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 287 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
295 | } | 288 | } |
296 | } | 289 | } |
297 | 290 | ||
298 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 291 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
299 | 292 | ||
300 | if ( whichTab == 1) { | 293 | if ( whichTab == 1) { |
301 | currentPathCombo->lineEdit()->setText( currentPath); | 294 | currentPathCombo->lineEdit()->setText( currentPath); |
302 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 295 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
303 | currentPathCombo->clear(); | 296 | currentPathCombo->clear(); |
304 | localDirPathStringList.prepend( currentPath ); | 297 | localDirPathStringList.prepend( currentPath ); |
305 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 298 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
306 | } | 299 | } |
307 | } else { | 300 | } else { |
308 | currentPathCombo->lineEdit()->setText( currentPath); | 301 | currentPathCombo->lineEdit()->setText( currentPath); |
309 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 302 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
310 | currentPathCombo->clear(); | 303 | currentPathCombo->clear(); |
311 | remoteDirPathStringList.prepend( currentPath ); | 304 | remoteDirPathStringList.prepend( currentPath ); |
312 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 305 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
313 | } | 306 | } |
314 | } | 307 | } |
315 | } | 308 | } |
316 | 309 | ||
317 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 310 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
318 | chdir( currentPath.latin1() ); | 311 | chdir( currentPath.latin1() ); |
319 | CurrentDir()->cd( currentPath, TRUE); | 312 | CurrentDir()->cd( currentPath, TRUE); |
320 | populateView(); | 313 | populateView(); |
321 | update(); | 314 | update(); |
322 | } | 315 | } |
323 | 316 | ||
324 | QStringList AdvancedFm::getPath() { | 317 | QStringList AdvancedFm::getPath() { |
325 | QStringList strList; | 318 | QStringList strList; |
326 | QListView *thisView=CurrentView(); | 319 | QListView *thisView=CurrentView(); |
327 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); | 320 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); |
328 | QListViewItemIterator it( thisView ); | 321 | QListViewItemIterator it( thisView ); |
329 | for ( ; it.current(); ++it ) { | 322 | for ( ; it.current(); ++it ) { |
330 | if ( it.current()->isSelected() ) { | 323 | if ( it.current()->isSelected() ) { |
331 | strList << it.current()->text(0); | 324 | strList << it.current()->text(0); |
332 | // odebug << it.current()->text(0) << oendl; | 325 | // odebug << it.current()->text(0) << oendl; |
333 | } | 326 | } |
334 | } | 327 | } |
335 | return strList; | 328 | return strList; |
336 | } | 329 | } |
337 | 330 | ||
338 | void AdvancedFm::homeButtonPushed() { | 331 | void AdvancedFm::homeButtonPushed() { |
339 | QString current = QDir::homeDirPath(); | 332 | QString current = QDir::homeDirPath(); |
340 | chdir( current.latin1() ); | 333 | chdir( current.latin1() ); |
341 | CurrentDir()->cd( current, TRUE); | 334 | CurrentDir()->cd( current, TRUE); |
342 | populateView(); | 335 | populateView(); |
343 | update(); | 336 | update(); |
344 | } | 337 | } |
345 | 338 | ||
346 | void AdvancedFm::docButtonPushed() { | 339 | void AdvancedFm::docButtonPushed() { |
347 | QString current = QPEApplication::documentDir(); | 340 | QString current = QPEApplication::documentDir(); |
348 | chdir( current.latin1() ); | 341 | chdir( current.latin1() ); |
349 | CurrentDir()->cd( current, TRUE); | 342 | CurrentDir()->cd( current, TRUE); |
350 | populateView(); | 343 | populateView(); |
351 | update(); | 344 | update(); |
352 | } | 345 | } |
353 | 346 | ||
354 | void AdvancedFm::SDButtonPushed() { | 347 | void AdvancedFm::SDButtonPushed() { |
355 | QString current = "/mnt/card";// this can change so fix | 348 | QString current = "/mnt/card";// this can change so fix |
356 | chdir( current.latin1() ); | 349 | chdir( current.latin1() ); |
357 | CurrentDir()->cd( current, TRUE); | 350 | CurrentDir()->cd( current, TRUE); |
358 | populateView(); | 351 | populateView(); |
359 | update(); | 352 | update(); |
360 | } | 353 | } |
361 | 354 | ||
362 | void AdvancedFm::CFButtonPushed() { | 355 | void AdvancedFm::CFButtonPushed() { |
363 | QString current; | 356 | QString current; |
364 | if(zaurusDevice) | 357 | if(zaurusDevice) |
365 | current= "/mnt/cf"; //zaurus | 358 | current= "/mnt/cf"; //zaurus |
366 | else | 359 | else |
367 | current = "/mnt/hda"; //ipaq | 360 | current = "/mnt/hda"; //ipaq |
368 | chdir( current.latin1() ); | 361 | chdir( current.latin1() ); |
369 | CurrentDir()->cd( current, TRUE); | 362 | CurrentDir()->cd( current, TRUE); |
370 | populateView(); | 363 | populateView(); |
371 | update(); | 364 | update(); |
372 | } | 365 | } |
373 | 366 | ||
374 | 367 | ||
375 | void AdvancedFm::doAbout() { | 368 | void AdvancedFm::doAbout() { |
376 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" | 369 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" |
377 | "is copyright 2002-2003 by\n" | 370 | "is copyright 2002-2003 by\n" |
378 | "L.J.Potter<llornkcor@handhelds.org>\n" | 371 | "L.J.Potter<llornkcor@handhelds.org>\n" |
379 | "and is licensed by the GPL")); | 372 | "and is licensed by the GPL")); |
380 | } | 373 | } |
381 | 374 | ||
382 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { | 375 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { |
383 | // owarn << "key " << e->key() << "" << oendl; | 376 | // owarn << "key " << e->key() << "" << oendl; |
384 | // if( CurrentView()->hasFocus() ) | 377 | // if( CurrentView()->hasFocus() ) |
385 | { | 378 | { |
386 | switch ( e->key() ) { | 379 | switch ( e->key() ) { |
387 | case Key_Left: | 380 | case Key_Left: |
388 | upDir(); | 381 | upDir(); |
389 | break; | 382 | break; |
390 | case Key_Next: | 383 | case Key_Next: |
391 | break; | 384 | break; |
392 | case Key_Return: | 385 | case Key_Return: |
393 | case Key_Enter: | 386 | case Key_Enter: |
394 | navigateToSelected(); | 387 | navigateToSelected(); |
395 | break; | 388 | break; |
396 | case Key_Tab: { | 389 | case Key_Tab: { |
397 | setOtherTabCurrent(); | 390 | setOtherTabCurrent(); |
398 | } | 391 | } |
399 | break; | 392 | break; |
400 | case Key_Delete: | 393 | case Key_Delete: |
401 | del(); | 394 | del(); |
402 | break; | 395 | break; |
403 | case Key_A: | 396 | case Key_A: |
404 | copyAs(); | 397 | copyAs(); |
405 | break; | 398 | break; |
406 | case Key_C: | 399 | case Key_C: |
407 | copy(); | 400 | copy(); |
408 | break; | 401 | break; |
409 | case Key_E: | 402 | case Key_E: |
410 | runThis(); | 403 | runThis(); |
411 | break; | 404 | break; |
412 | case Key_G: | 405 | case Key_G: |
413 | { | 406 | { |
414 | currentPathCombo->lineEdit()->setFocus(); | 407 | currentPathCombo->lineEdit()->setFocus(); |
415 | } | 408 | } |
416 | break; | 409 | break; |
417 | 410 | ||
418 | case Key_H: | 411 | case Key_H: |
419 | showHidden(); | 412 | showHidden(); |
420 | break; | 413 | break; |
421 | case Key_I: | 414 | case Key_I: |
422 | fileStatus(); | 415 | fileStatus(); |
423 | break; | 416 | break; |
424 | case Key_M: | 417 | case Key_M: |
425 | move(); | 418 | move(); |
426 | break; | 419 | break; |
427 | case Key_N: | 420 | case Key_N: |
428 | mkDir(); | 421 | mkDir(); |
429 | break; | 422 | break; |
430 | case Key_P: | 423 | case Key_P: |
431 | filePerms(); | 424 | filePerms(); |
@@ -561,325 +554,319 @@ void AdvancedFm::showFileMenu() { | |||
561 | + app->name() ), this, SLOT( runThis() ) ); | 554 | + app->name() ), this, SLOT( runThis() ) ); |
562 | else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this | 555 | else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this |
563 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); | 556 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); |
564 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); | 557 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); |
565 | } | 558 | } |
566 | 559 | ||
567 | m->insertItem(tr("Actions"),n); | 560 | m->insertItem(tr("Actions"),n); |
568 | n->insertItem( tr( "Make Directory" ), this, SLOT( makeDir() )); | 561 | n->insertItem( tr( "Make Directory" ), this, SLOT( makeDir() )); |
569 | 562 | ||
570 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 563 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
571 | 564 | ||
572 | n->insertSeparator(); | 565 | n->insertSeparator(); |
573 | n->insertItem( tr( "Rename" ), this, SLOT( renameIt() )); | 566 | n->insertItem( tr( "Rename" ), this, SLOT( renameIt() )); |
574 | 567 | ||
575 | n->insertItem( tr( "Copy" ), this, SLOT( copy() )); | 568 | n->insertItem( tr( "Copy" ), this, SLOT( copy() )); |
576 | n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 569 | n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
577 | n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); | 570 | n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); |
578 | n->insertItem( tr( "Move" ), this, SLOT( move() )); | 571 | n->insertItem( tr( "Move" ), this, SLOT( move() )); |
579 | 572 | ||
580 | n->insertSeparator(); | 573 | n->insertSeparator(); |
581 | n->insertItem( tr( "Delete" ), this, SLOT( doDelete() )); | 574 | n->insertItem( tr( "Delete" ), this, SLOT( doDelete() )); |
582 | m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 575 | m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
583 | 576 | ||
584 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 577 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
585 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 578 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
586 | 579 | ||
587 | m->insertSeparator(); | 580 | m->insertSeparator(); |
588 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 581 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
589 | 582 | ||
590 | #if defined(QT_QWS_OPIE) | 583 | #if defined(QT_QWS_OPIE) |
591 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 584 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
592 | #endif | 585 | #endif |
593 | m->setCheckable(TRUE); | 586 | m->setCheckable(TRUE); |
594 | if (!b) | 587 | if (!b) |
595 | m->setItemChecked(m->idAt(0),TRUE); | 588 | m->setItemChecked(m->idAt(0),TRUE); |
596 | else | 589 | else |
597 | m->setItemChecked(m->idAt(0),FALSE); | 590 | m->setItemChecked(m->idAt(0),FALSE); |
598 | 591 | ||
599 | if(Ir::supported()) | 592 | if(Ir::supported()) |
600 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); | 593 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); |
601 | m->setFocus(); | 594 | m->setFocus(); |
602 | 595 | ||
603 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 596 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
604 | 597 | ||
605 | if(m) delete m; | 598 | if(m) delete m; |
606 | } | 599 | } |
607 | 600 | ||
608 | 601 | ||
609 | void AdvancedFm::cancelMenuTimer() { | ||
610 | |||
611 | if( menuTimer.isActive() ) | ||
612 | menuTimer.stop(); | ||
613 | } | ||
614 | |||
615 | QString AdvancedFm::checkDiskSpace(const QString &path) { | 602 | QString AdvancedFm::checkDiskSpace(const QString &path) { |
616 | struct statfs fss; | 603 | struct statfs fss; |
617 | if ( !statfs( path.latin1(), &fss ) ) { | 604 | if ( !statfs( path.latin1(), &fss ) ) { |
618 | int blkSize = fss.f_bsize; | 605 | int blkSize = fss.f_bsize; |
619 | // int totalBlks = fs.f_blocks; | 606 | // int totalBlks = fs.f_blocks; |
620 | int availBlks = fss.f_bavail; | 607 | int availBlks = fss.f_bavail; |
621 | 608 | ||
622 | long mult = blkSize / 1024; | 609 | long mult = blkSize / 1024; |
623 | long div = 1024 / blkSize; | 610 | long div = 1024 / blkSize; |
624 | if ( !mult ) mult = 1; | 611 | if ( !mult ) mult = 1; |
625 | if ( !div ) div = 1; | 612 | if ( !div ) div = 1; |
626 | 613 | ||
627 | 614 | ||
628 | return QString::number(availBlks * mult / div); | 615 | return QString::number(availBlks * mult / div); |
629 | } | 616 | } |
630 | return ""; | 617 | return ""; |
631 | } | 618 | } |
632 | 619 | ||
633 | void AdvancedFm::addToDocs() { | 620 | void AdvancedFm::addToDocs() { |
634 | QStringList strListPaths = getPath(); | 621 | QStringList strListPaths = getPath(); |
635 | QDir *thisDir = CurrentDir(); | 622 | QDir *thisDir = CurrentDir(); |
636 | 623 | ||
637 | if( strListPaths.count() > 0) { | 624 | if( strListPaths.count() > 0) { |
638 | QString curFile; | 625 | QString curFile; |
639 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { | 626 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { |
640 | curFile = thisDir->canonicalPath()+"/"+(*it); | 627 | curFile = thisDir->canonicalPath()+"/"+(*it); |
641 | // odebug << curFile << oendl; | 628 | // odebug << curFile << oendl; |
642 | QFileInfo fi(curFile); | 629 | QFileInfo fi(curFile); |
643 | DocLnk f; | 630 | DocLnk f; |
644 | // curFile.replace(QRegExp("\\..*"),""); | 631 | // curFile.replace(QRegExp("\\..*"),""); |
645 | f.setName(fi.baseName() ); | 632 | f.setName(fi.baseName() ); |
646 | f.setFile( curFile); | 633 | f.setFile( curFile); |
647 | f.writeLink(); | 634 | f.writeLink(); |
648 | } | 635 | } |
649 | } | 636 | } |
650 | } | 637 | } |
651 | 638 | ||
652 | 639 | ||
653 | void AdvancedFm::customDirsToMenu() { | 640 | void AdvancedFm::customDirsToMenu() { |
654 | 641 | ||
655 | Config cfg("AdvancedFm"); | 642 | Config cfg("AdvancedFm"); |
656 | cfg.setGroup("Menu"); | 643 | cfg.setGroup("Menu"); |
657 | 644 | ||
658 | QStringList list = cfg.readListEntry( "CustomDir", ','); | 645 | QStringList list = cfg.readListEntry( "CustomDir", ','); |
659 | menuButton->insertItems(list ); | 646 | menuButton->insertItems(list ); |
660 | 647 | ||
661 | // for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 648 | // for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
662 | // { | 649 | // { |
663 | // customDirMenu->insertItem(*it ); | 650 | // customDirMenu->insertItem(*it ); |
664 | // } | 651 | // } |
665 | } | 652 | } |
666 | 653 | ||
667 | void AdvancedFm::dirMenuSelected(int item) { | 654 | void AdvancedFm::dirMenuSelected(int item) { |
668 | switch(item) | 655 | switch(item) |
669 | { | 656 | { |
670 | 657 | ||
671 | case -21: | 658 | case -21: |
672 | case 0: | 659 | case 0: |
673 | addCustomDir(); | 660 | addCustomDir(); |
674 | break; | 661 | break; |
675 | case -22: | 662 | case -22: |
676 | case 1: | 663 | case 1: |
677 | removeCustomDir(); | 664 | removeCustomDir(); |
678 | break; | 665 | break; |
679 | default: | 666 | default: |
680 | { | 667 | { |
681 | // gotoCustomDir( menuButton->text(item)); | 668 | // gotoCustomDir( menuButton->text(item)); |
682 | // gotoCustomDir( customDirMenu->text(item)); | 669 | // gotoCustomDir( customDirMenu->text(item)); |
683 | } | 670 | } |
684 | break; | 671 | break; |
685 | 672 | ||
686 | }; | 673 | }; |
687 | } | 674 | } |
688 | 675 | ||
689 | void AdvancedFm::addCustomDir() { | 676 | void AdvancedFm::addCustomDir() { |
690 | Config cfg("AdvancedFm"); | 677 | Config cfg("AdvancedFm"); |
691 | cfg.setGroup("Menu"); | 678 | cfg.setGroup("Menu"); |
692 | QString dir; | 679 | QString dir; |
693 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); | 680 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); |
694 | 681 | ||
695 | dir = CurrentDir()->canonicalPath(); | 682 | dir = CurrentDir()->canonicalPath(); |
696 | 683 | ||
697 | bool addIt=true; | 684 | bool addIt=true; |
698 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 685 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
699 | if( dir == (*it)) { | 686 | if( dir == (*it)) { |
700 | addIt=false; | 687 | addIt=false; |
701 | } | 688 | } |
702 | } | 689 | } |
703 | if(addIt) { | 690 | if(addIt) { |
704 | menuButton->insertItem(dir); | 691 | menuButton->insertItem(dir); |
705 | // customDirMenu->insertItem(dir); | 692 | // customDirMenu->insertItem(dir); |
706 | list << dir; | 693 | list << dir; |
707 | } | 694 | } |
708 | 695 | ||
709 | cfg.writeEntry("CustomDir", list, ','); | 696 | cfg.writeEntry("CustomDir", list, ','); |
710 | cfg.write(); | 697 | cfg.write(); |
711 | } | 698 | } |
712 | 699 | ||
713 | void AdvancedFm::removeCustomDir() { | 700 | void AdvancedFm::removeCustomDir() { |
714 | // odebug << "remove custom dir" << oendl; | 701 | // odebug << "remove custom dir" << oendl; |
715 | Config cfg("AdvancedFm"); | 702 | Config cfg("AdvancedFm"); |
716 | cfg.setGroup("Menu"); | 703 | cfg.setGroup("Menu"); |
717 | QString dir; | 704 | QString dir; |
718 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); | 705 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); |
719 | QStringList list2; | 706 | QStringList list2; |
720 | dir = CurrentDir()->canonicalPath(); | 707 | dir = CurrentDir()->canonicalPath(); |
721 | int ramble=2; | 708 | int ramble=2; |
722 | // int ramble=-24; | 709 | // int ramble=-24; |
723 | //first remove list | 710 | //first remove list |
724 | if(list.grep(dir,true).isEmpty()) { | 711 | if(list.grep(dir,true).isEmpty()) { |
725 | QMessageBox::message(tr( "AdvancedFm" ), | 712 | QMessageBox::message(tr( "AdvancedFm" ), |
726 | tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); | 713 | tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); |
727 | } else { | 714 | } else { |
728 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 715 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
729 | if((*it) != dir) { | 716 | if((*it) != dir) { |
730 | //current item is not our current dir, so add it to temp list | 717 | //current item is not our current dir, so add it to temp list |
731 | list2 <<(*it); | 718 | list2 <<(*it); |
732 | } else { | 719 | } else { |
733 | // customDirMenu->removeItem( ramble); | 720 | // customDirMenu->removeItem( ramble); |
734 | menuButton->remove( ramble); | 721 | menuButton->remove( ramble); |
735 | 722 | ||
736 | } | 723 | } |
737 | ramble++; | 724 | ramble++; |
738 | // ramble--; | 725 | // ramble--; |
739 | } | 726 | } |
740 | 727 | ||
741 | cfg.writeEntry("CustomDir", list2, ','); | 728 | cfg.writeEntry("CustomDir", list2, ','); |
742 | cfg.write(); | 729 | cfg.write(); |
743 | } | 730 | } |
744 | // customDirsToMenu(); | 731 | // customDirsToMenu(); |
745 | 732 | ||
746 | } | 733 | } |
747 | 734 | ||
748 | void AdvancedFm::gotoCustomDir(const QString &dir) { | 735 | void AdvancedFm::gotoCustomDir(const QString &dir) { |
749 | // odebug << "gotoCustomDir(const QString &dir) " +dir << oendl; | 736 | // odebug << "gotoCustomDir(const QString &dir) " +dir << oendl; |
750 | // QString curDir = dir; | 737 | // QString curDir = dir; |
751 | // QDir *thisDir = CurrentDir(); | 738 | // QDir *thisDir = CurrentDir(); |
752 | // if( curDir.isEmpty()) { | 739 | // if( curDir.isEmpty()) { |
753 | // } | 740 | // } |
754 | if( dir == s_addBookmark) { | 741 | if( dir == s_addBookmark) { |
755 | addCustomDir(); | 742 | addCustomDir(); |
756 | } | 743 | } |
757 | if( dir == s_removeBookmark) { | 744 | if( dir == s_removeBookmark) { |
758 | removeCustomDir( ); | 745 | removeCustomDir( ); |
759 | } else { | 746 | } else { |
760 | gotoDirectory( dir); | 747 | gotoDirectory( dir); |
761 | // if(QDir( curDir).exists() ) | 748 | // if(QDir( curDir).exists() ) |
762 | // { | 749 | // { |
763 | // thisDir->setPath( curDir ); | 750 | // thisDir->setPath( curDir ); |
764 | // chdir( curDir.latin1() ); | 751 | // chdir( curDir.latin1() ); |
765 | // thisDir->cd( curDir, TRUE); | 752 | // thisDir->cd( curDir, TRUE); |
766 | // populateView(); | 753 | // populateView(); |
767 | // } | 754 | // } |
768 | } | 755 | } |
769 | } | 756 | } |
770 | 757 | ||
771 | QDir *AdvancedFm::CurrentDir() { | 758 | QDir *AdvancedFm::CurrentDir() { |
772 | 759 | ||
773 | if ( whichTab == 1) { | 760 | if ( whichTab == 1) { |
774 | return ¤tDir; | 761 | return ¤tDir; |
775 | } else { | 762 | } else { |
776 | return ¤tRemoteDir; | 763 | return ¤tRemoteDir; |
777 | } | 764 | } |
778 | } | 765 | } |
779 | 766 | ||
780 | QDir *AdvancedFm::OtherDir() { | 767 | QDir *AdvancedFm::OtherDir() { |
781 | if ( whichTab == 1) { | 768 | if ( whichTab == 1) { |
782 | return ¤tRemoteDir; | 769 | return ¤tRemoteDir; |
783 | } else { | 770 | } else { |
784 | return ¤tDir; | 771 | return ¤tDir; |
785 | } | 772 | } |
786 | } | 773 | } |
787 | 774 | ||
788 | QListView * AdvancedFm::CurrentView() { | 775 | QListView * AdvancedFm::CurrentView() { |
789 | if ( whichTab == 1) { | 776 | if ( whichTab == 1) { |
790 | // owarn << "CurrentView Tab 1" << oendl; | 777 | // owarn << "CurrentView Tab 1" << oendl; |
791 | return Local_View; | 778 | return Local_View; |
792 | } else { | 779 | } else { |
793 | // owarn << "CurrentView Tab 2" << oendl; | 780 | // owarn << "CurrentView Tab 2" << oendl; |
794 | return Remote_View; | 781 | return Remote_View; |
795 | } | 782 | } |
796 | } | 783 | } |
797 | 784 | ||
798 | QListView * AdvancedFm::OtherView() { | 785 | QListView * AdvancedFm::OtherView() { |
799 | if ( whichTab == 1) | 786 | if ( whichTab == 1) |
800 | return Remote_View; | 787 | return Remote_View; |
801 | else | 788 | else |
802 | return Local_View; | 789 | return Local_View; |
803 | } | 790 | } |
804 | 791 | ||
805 | void AdvancedFm::setOtherTabCurrent() { | 792 | void AdvancedFm::setOtherTabCurrent() { |
806 | // owarn << "setOtherTabCurrent() " << whichTab << "" << oendl; | 793 | // owarn << "setOtherTabCurrent() " << whichTab << "" << oendl; |
807 | if ( whichTab == 1) { | 794 | if ( whichTab == 1) { |
808 | TabWidget->setCurrentWidget(1); | 795 | TabWidget->setCurrentWidget(1); |
809 | } else { | 796 | } else { |
810 | TabWidget->setCurrentWidget(0); | 797 | TabWidget->setCurrentWidget(0); |
811 | } | 798 | } |
812 | OtherView()->setFocus(); | 799 | OtherView()->setFocus(); |
813 | OtherView()->setSelected( CurrentView()->firstChild(), true); | 800 | OtherView()->setSelected( CurrentView()->firstChild(), true); |
814 | } | 801 | } |
815 | 802 | ||
816 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { | 803 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { |
817 | // odebug << "qcop message "+msg << oendl; | 804 | // odebug << "qcop message "+msg << oendl; |
818 | QDataStream stream ( data, IO_ReadOnly ); | 805 | QDataStream stream ( data, IO_ReadOnly ); |
819 | if ( msg == "openDirectory(QString)" ) { | 806 | if ( msg == "openDirectory(QString)" ) { |
820 | // odebug << "received" << oendl; | 807 | // odebug << "received" << oendl; |
821 | QString file; | 808 | QString file; |
822 | stream >> file; | 809 | stream >> file; |
823 | gotoDirectory( (const QString &) file); | 810 | gotoDirectory( (const QString &) file); |
824 | } | 811 | } |
825 | } | 812 | } |
826 | 813 | ||
827 | void AdvancedFm::setDocument(const QString &file) { | 814 | void AdvancedFm::setDocument(const QString &file) { |
828 | gotoDirectory( file); | 815 | gotoDirectory( file); |
829 | 816 | ||
830 | } | 817 | } |
831 | 818 | ||
832 | void AdvancedFm::gotoDirectory(const QString &file) { | 819 | void AdvancedFm::gotoDirectory(const QString &file) { |
833 | // owarn << "goto dir "+file << oendl; | 820 | // owarn << "goto dir "+file << oendl; |
834 | QString curDir = file; | 821 | QString curDir = file; |
835 | QDir *thisDir = CurrentDir(); | 822 | QDir *thisDir = CurrentDir(); |
836 | if(QDir( curDir).exists() ) { | 823 | if(QDir( curDir).exists() ) { |
837 | thisDir->setPath( curDir ); | 824 | thisDir->setPath( curDir ); |
838 | chdir( curDir.latin1() ); | 825 | chdir( curDir.latin1() ); |
839 | thisDir->cd( curDir, TRUE); | 826 | thisDir->cd( curDir, TRUE); |
840 | populateView(); | 827 | populateView(); |
841 | } | 828 | } |
842 | else if(QFileInfo(curDir).exists()) { | 829 | else if(QFileInfo(curDir).exists()) { |
843 | QFileInfo fileInfo(curDir); | 830 | QFileInfo fileInfo(curDir); |
844 | curDir=fileInfo.dirPath(); | 831 | curDir=fileInfo.dirPath(); |
845 | if(QDir( curDir).exists() ) { | 832 | if(QDir( curDir).exists() ) { |
846 | thisDir->setPath( curDir ); | 833 | thisDir->setPath( curDir ); |
847 | chdir( curDir.latin1() ); | 834 | chdir( curDir.latin1() ); |
848 | thisDir->cd( curDir, TRUE); | 835 | thisDir->cd( curDir, TRUE); |
849 | populateView(); | 836 | populateView(); |
850 | } | 837 | } |
851 | findFile(file); | 838 | findFile(file); |
852 | } | 839 | } |
853 | 840 | ||
854 | } | 841 | } |
855 | 842 | ||
856 | void AdvancedFm::findFile(const QString &fileName) { | 843 | void AdvancedFm::findFile(const QString &fileName) { |
857 | QFileInfo fi(fileName); | 844 | QFileInfo fi(fileName); |
858 | QListView *thisView = CurrentView(); | 845 | QListView *thisView = CurrentView(); |
859 | QListViewItemIterator it( thisView ); | 846 | QListViewItemIterator it( thisView ); |
860 | for ( ; it.current(); ++it ) { | 847 | for ( ; it.current(); ++it ) { |
861 | if(it.current()->text(0) == fi.fileName()) { | 848 | if(it.current()->text(0) == fi.fileName()) { |
862 | it.current()->setSelected(true); | 849 | it.current()->setSelected(true); |
863 | thisView->ensureItemVisible(it.current()); | 850 | thisView->ensureItemVisible(it.current()); |
864 | } | 851 | } |
865 | } | 852 | } |
866 | } | 853 | } |
867 | 854 | ||
868 | void AdvancedFm::slotSwitchMenu(int ) { | 855 | void AdvancedFm::slotSwitchMenu(int ) { |
869 | // odebug << "Switch " << item << "" << oendl; | 856 | // odebug << "Switch " << item << "" << oendl; |
870 | // viewMenu->setItemChecked(item, true); | 857 | // viewMenu->setItemChecked(item, true); |
871 | } | 858 | } |
872 | 859 | ||
873 | void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) { | 860 | void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) { |
874 | tabChanged( w); | 861 | tabChanged( w); |
875 | if( w == Local_View) { | 862 | if( w == Local_View) { |
876 | Remote_View->clearFocus(); | 863 | Remote_View->clearFocus(); |
877 | } else { | 864 | } else { |
878 | Local_View->clearFocus(); | 865 | Local_View->clearFocus(); |
879 | } | 866 | } |
880 | } | 867 | } |
881 | 868 | ||
882 | void AdvancedFm::navigateToSelected() { | 869 | void AdvancedFm::navigateToSelected() { |
883 | if( !CurrentView()->currentItem()) return; | 870 | if( !CurrentView()->currentItem()) return; |
884 | doDirChange(); | 871 | doDirChange(); |
885 | } | 872 | } |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 4eaa6d6..effda0b 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -10,182 +10,176 @@ | |||
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 <opie2/oprocess.h> | 17 | #include <opie2/oprocess.h> |
18 | #include <opie2/osplitter.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 | 33 | ||
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 QWidget; | 43 | class QWidget; |
44 | class QPopupMenu; | 44 | class QPopupMenu; |
45 | class QFile; | 45 | class QFile; |
46 | class QListViewItem; | 46 | class QListViewItem; |
47 | class QLineEdit; | 47 | class QLineEdit; |
48 | class MenuButton; | 48 | class MenuButton; |
49 | 49 | ||
50 | class QToolButton; | 50 | class QToolButton; |
51 | class Ir; | 51 | class Ir; |
52 | 52 | ||
53 | class AdvancedFm : public QMainWindow | 53 | class AdvancedFm : public QMainWindow |
54 | { | 54 | { |
55 | Q_OBJECT | 55 | Q_OBJECT |
56 | public: | 56 | public: |
57 | static QString appName() { return QString::fromLatin1("advancedfm"); } | 57 | static QString appName() { return QString::fromLatin1("advancedfm"); } |
58 | #ifdef NOQUICKLAUNCH | ||
59 | AdvancedFm(); | ||
60 | #else | ||
61 | AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0); | 58 | AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0); |
62 | #endif | ||
63 | ~AdvancedFm(); | 59 | ~AdvancedFm(); |
64 | protected slots: | 60 | protected slots: |
65 | void slotSwitchMenu(int); | 61 | void slotSwitchMenu(int); |
66 | void selectAll(); | 62 | void selectAll(); |
67 | void addToDocs(); | 63 | void addToDocs(); |
68 | void doDirChange(); | 64 | void doDirChange(); |
69 | void mkDir(); | 65 | void mkDir(); |
70 | void del(); | 66 | void del(); |
71 | void rn(); | 67 | void rn(); |
72 | void populateView(); | 68 | void populateView(); |
73 | void rePopulate(); | 69 | void rePopulate(); |
74 | void showHidden(); | 70 | void showHidden(); |
75 | void showMenuHidden(); | 71 | void showMenuHidden(); |
76 | void writeConfig(); | 72 | void writeConfig(); |
77 | void readConfig(); | 73 | void readConfig(); |
78 | void ListClicked(QListViewItem *); | 74 | void ListClicked(QListViewItem *); |
79 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 75 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
80 | void makeDir(); | 76 | void makeDir(); |
81 | void doDelete(); | 77 | void doDelete(); |
82 | void tabChanged(QWidget*); | 78 | void tabChanged(QWidget*); |
83 | void cleanUp(); | 79 | void cleanUp(); |
84 | void renameIt(); | 80 | void renameIt(); |
85 | void runThis(); | 81 | void runThis(); |
86 | void runText(); | 82 | void runText(); |
87 | void filePerms(); | 83 | void filePerms(); |
88 | void doProperties(); | 84 | void doProperties(); |
89 | void runCommand(); | 85 | void runCommand(); |
90 | void runCommandStd(); | 86 | void runCommandStd(); |
91 | QStringList getPath(); | 87 | QStringList getPath(); |
92 | void mkSym(); | 88 | void mkSym(); |
93 | void switchToLocalTab(); | 89 | void switchToLocalTab(); |
94 | void switchToRemoteTab(); | 90 | void switchToRemoteTab(); |
95 | 91 | ||
96 | protected: | 92 | protected: |
97 | 93 | ||
98 | Opie::Ui::OSplitter *TabWidget; | 94 | Opie::Ui::OSplitter *TabWidget; |
99 | QCopChannel * channel; | 95 | QCopChannel * channel; |
100 | QPixmap unknownXpm; | 96 | QPixmap unknownXpm; |
101 | int whichTab; | 97 | int whichTab; |
102 | // QTabWidget *TabWidget; | 98 | // QTabWidget *TabWidget; |
103 | QWidget *tab, *tab_2, *tab_3; | 99 | QWidget *tab, *tab_2, *tab_3; |
104 | QListView *Local_View, *Remote_View; | 100 | QListView *Local_View, *Remote_View; |
105 | 101 | ||
106 | QLineEdit *currentPathEdit; | 102 | QLineEdit *currentPathEdit; |
107 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; | 103 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; |
108 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 104 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
109 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 105 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
110 | QDir currentDir, currentRemoteDir; | 106 | QDir currentDir, currentRemoteDir; |
111 | QComboBox *currentPathCombo; | 107 | QComboBox *currentPathCombo; |
112 | QString filterStr, s_addBookmark, s_removeBookmark; | 108 | QString filterStr, s_addBookmark, s_removeBookmark; |
113 | QListViewItem * item; | 109 | QListViewItem * item; |
114 | bool b; | 110 | bool b; |
115 | QStringList fileSystemTypeList, fsList; | 111 | QStringList fileSystemTypeList, fsList; |
116 | int currentServerConfig; | 112 | int currentServerConfig; |
117 | bool zaurusDevice; | 113 | bool zaurusDevice; |
118 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 114 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
119 | QStringList remoteDirPathStringList, localDirPathStringList; | 115 | QStringList remoteDirPathStringList, localDirPathStringList; |
120 | QLineEdit *renameBox; | 116 | QLineEdit *renameBox; |
121 | 117 | ||
122 | void init(); | 118 | void init(); |
123 | void initConnections(); | 119 | void initConnections(); |
124 | void keyReleaseEvent( QKeyEvent *); | 120 | void keyReleaseEvent( QKeyEvent *); |
125 | void keyPressEvent( QKeyEvent *); | 121 | void keyPressEvent( QKeyEvent *); |
126 | QString getFileSystemType(const QString &); | 122 | QString getFileSystemType(const QString &); |
127 | QString getDiskSpace(const QString &); | 123 | QString getDiskSpace(const QString &); |
128 | void parsetab(const QString &fileName); | 124 | void parsetab(const QString &fileName); |
129 | QString checkDiskSpace(const QString &); | 125 | QString checkDiskSpace(const QString &); |
130 | QString dealWithSymName(const QString &); | 126 | QString dealWithSymName(const QString &); |
131 | QDir *CurrentDir(); | 127 | QDir *CurrentDir(); |
132 | QDir *OtherDir(); | 128 | QDir *OtherDir(); |
133 | QListView *CurrentView(); | 129 | QListView *CurrentView(); |
134 | QListView *OtherView(); | 130 | QListView *OtherView(); |
135 | void setOtherTabCurrent(); | 131 | void setOtherTabCurrent(); |
136 | void dealWithSchmooSchmaa(QWidget *); | 132 | void dealWithSchmooSchmaa(QWidget *); |
137 | 133 | ||
138 | protected slots: | 134 | protected slots: |
139 | void openSearch(); | 135 | void openSearch(); |
140 | void dirMenuSelected(int); | 136 | void dirMenuSelected(int); |
141 | void showFileMenu(); | 137 | void showFileMenu(); |
142 | void cancelMenuTimer(); | ||
143 | void homeButtonPushed(); | 138 | void homeButtonPushed(); |
144 | void docButtonPushed(); | 139 | void docButtonPushed(); |
145 | void SDButtonPushed(); | 140 | void SDButtonPushed(); |
146 | void CFButtonPushed(); | 141 | void CFButtonPushed(); |
147 | void QPEButtonPushed(); | 142 | void QPEButtonPushed(); |
148 | void upDir(); | 143 | void upDir(); |
149 | void currentPathComboChanged(); | 144 | void currentPathComboChanged(); |
150 | void copy(); | 145 | void copy(); |
151 | void copyAs(); | 146 | void copyAs(); |
152 | void copySameDir(); | 147 | void copySameDir(); |
153 | void currentPathComboActivated(const QString &); | 148 | void currentPathComboActivated(const QString &); |
154 | void fillCombo(const QString &); | 149 | void fillCombo(const QString &); |
155 | bool copyFile( const QString & , const QString & ); | 150 | bool copyFile( const QString & , const QString & ); |
156 | void move(); | 151 | void move(); |
157 | void fileStatus(); | 152 | void fileStatus(); |
158 | void doAbout(); | 153 | void doAbout(); |
159 | void doBeam(); | 154 | void doBeam(); |
160 | void fileBeamFinished( Ir *); | 155 | void fileBeamFinished( Ir *); |
161 | bool copyDirectory( const QString & , const QString & ); | 156 | bool copyDirectory( const QString & , const QString & ); |
162 | // void navigateToSelected(); | 157 | // void navigateToSelected(); |
163 | bool moveDirectory( const QString & , const QString & ); | 158 | bool moveDirectory( const QString & , const QString & ); |
164 | // void slotSwitchtoLocal(int); | 159 | // void slotSwitchtoLocal(int); |
165 | 160 | ||
166 | private: | 161 | private: |
167 | MenuButton *menuButton; | 162 | MenuButton *menuButton; |
168 | QString oldName; | 163 | QString oldName; |
169 | QTimer menuTimer; | ||
170 | void startProcess(const QString &); | 164 | void startProcess(const QString &); |
171 | bool eventFilter( QObject * , QEvent * ); | 165 | bool eventFilter( QObject * , QEvent * ); |
172 | void cancelRename(); | 166 | void cancelRename(); |
173 | void doRename(QListView *); | 167 | void doRename(QListView *); |
174 | void okRename(); | 168 | void okRename(); |
175 | void customDirsToMenu(); | 169 | void customDirsToMenu(); |
176 | void addCustomDir(); | 170 | void addCustomDir(); |
177 | void removeCustomDir(); | 171 | void removeCustomDir(); |
178 | void gotoDirectory(const QString &); | 172 | void gotoDirectory(const QString &); |
179 | void navigateToSelected(); | 173 | void navigateToSelected(); |
180 | void findFile(const QString &); | 174 | void findFile(const QString &); |
181 | 175 | ||
182 | private slots: | 176 | private slots: |
183 | void processEnded(Opie::Core::OProcess *); | 177 | void processEnded(Opie::Core::OProcess *); |
184 | void oprocessStderr(Opie::Core::OProcess *, char *, int); | 178 | void oprocessStderr(Opie::Core::OProcess *, char *, int); |
185 | void gotoCustomDir(const QString &); | 179 | void gotoCustomDir(const QString &); |
186 | void qcopReceive(const QCString&, const QByteArray&); | 180 | void qcopReceive(const QCString&, const QByteArray&); |
187 | void setDocument(const QString &); | 181 | void setDocument(const QString &); |
188 | 182 | ||
189 | }; | 183 | }; |
190 | 184 | ||
191 | #endif // ADVANCEDFM_H | 185 | #endif // ADVANCEDFM_H |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 29335f8..dc7e8e1 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -116,179 +116,180 @@ void AdvancedFm::init() { | |||
116 | // customDirMenu->insertItem(tr("Remove This Directory")); | 116 | // customDirMenu->insertItem(tr("Remove This Directory")); |
117 | // customDirMenu->insertSeparator(); | 117 | // customDirMenu->insertSeparator(); |
118 | 118 | ||
119 | QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later | 119 | QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later |
120 | CBHB->setMargin( 0 ); | 120 | CBHB->setMargin( 0 ); |
121 | CBHB->setSpacing( 1 ); | 121 | CBHB->setSpacing( 1 ); |
122 | 122 | ||
123 | menuButton = new MenuButton( this ); | 123 | menuButton = new MenuButton( this ); |
124 | 124 | ||
125 | menuButton->setUseLabel(false); | 125 | menuButton->setUseLabel(false); |
126 | menuButton->setMaximumWidth( 20 ); | 126 | menuButton->setMaximumWidth( 20 ); |
127 | menuButton->insertItem( s_addBookmark); | 127 | menuButton->insertItem( s_addBookmark); |
128 | menuButton->insertItem( s_removeBookmark); | 128 | menuButton->insertItem( s_removeBookmark); |
129 | menuButton->insertSeparator(); | 129 | menuButton->insertSeparator(); |
130 | menuButton->setFocusPolicy(NoFocus); | 130 | menuButton->setFocusPolicy(NoFocus); |
131 | CBHB->addWidget( menuButton ); | 131 | CBHB->addWidget( menuButton ); |
132 | 132 | ||
133 | customDirsToMenu(); | 133 | customDirsToMenu(); |
134 | 134 | ||
135 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 135 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
136 | currentPathCombo->setEditable(TRUE); | 136 | currentPathCombo->setEditable(TRUE); |
137 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 137 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
138 | currentPathCombo->setFocusPolicy(NoFocus); | 138 | currentPathCombo->setFocusPolicy(NoFocus); |
139 | CBHB->addWidget( currentPathCombo ); | 139 | CBHB->addWidget( currentPathCombo ); |
140 | 140 | ||
141 | layout->addLayout( CBHB ); | 141 | layout->addLayout( CBHB ); |
142 | 142 | ||
143 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); | 143 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); |
144 | // TabWidget = new QTabWidget( this, "TabWidget" ); | 144 | // TabWidget = new QTabWidget( this, "TabWidget" ); |
145 | layout->addWidget( TabWidget, 4 ); | 145 | layout->addWidget( TabWidget, 4 ); |
146 | 146 | ||
147 | tab = new QWidget( TabWidget, "tab" ); | 147 | tab = new QWidget( TabWidget, "tab" ); |
148 | tabLayout = new QGridLayout( tab ); | 148 | tabLayout = new QGridLayout( tab ); |
149 | tabLayout->setSpacing( 2); | 149 | tabLayout->setSpacing( 2); |
150 | tabLayout->setMargin( 2); | 150 | tabLayout->setMargin( 2); |
151 | 151 | ||
152 | Local_View = new QListView( tab, "Local_View" ); | 152 | Local_View = new QListView( tab, "Local_View" ); |
153 | Local_View->addColumn( tr("File"),130); | 153 | Local_View->addColumn( tr("File"),130); |
154 | Local_View->addColumn( tr("Size"),-1); | 154 | Local_View->addColumn( tr("Size"),-1); |
155 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 155 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
156 | Local_View->addColumn( tr("Date"),-1); | 156 | Local_View->addColumn( tr("Date"),-1); |
157 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 157 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
158 | Local_View->setAllColumnsShowFocus(TRUE); | 158 | Local_View->setAllColumnsShowFocus(TRUE); |
159 | Local_View->setMultiSelection( TRUE ); | 159 | Local_View->setMultiSelection( TRUE ); |
160 | Local_View->setSelectionMode(QListView::Extended); | 160 | Local_View->setSelectionMode(QListView::Extended); |
161 | Local_View->setFocusPolicy(StrongFocus); | 161 | Local_View->setFocusPolicy(StrongFocus); |
162 | Local_View->installEventFilter( this ); | 162 | Local_View->installEventFilter( this ); |
163 | 163 | ||
164 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 164 | QPEApplication::setStylusOperation( Local_View->viewport() , QPEApplication::RightOnHold); |
165 | 165 | ||
166 | tabLayout->addWidget( Local_View, 0, 0 ); | 166 | tabLayout->addWidget( Local_View, 0, 0 ); |
167 | 167 | ||
168 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); | 168 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); |
169 | // TabWidget->insertTab( tab, tr("1")); | 169 | // TabWidget->insertTab( tab, tr("1")); |
170 | 170 | ||
171 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 171 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
172 | tabLayout_2 = new QGridLayout( tab_2 ); | 172 | tabLayout_2 = new QGridLayout( tab_2 ); |
173 | tabLayout_2->setSpacing( 2); | 173 | tabLayout_2->setSpacing( 2); |
174 | tabLayout_2->setMargin( 2); | 174 | tabLayout_2->setMargin( 2); |
175 | 175 | ||
176 | Remote_View = new QListView( tab_2, "Remote_View" ); | 176 | Remote_View = new QListView( tab_2, "Remote_View" ); |
177 | Remote_View->addColumn( tr("File"),130); | 177 | Remote_View->addColumn( tr("File"),130); |
178 | Remote_View->addColumn( tr("Size"),-1); | 178 | Remote_View->addColumn( tr("Size"),-1); |
179 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 179 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
180 | Remote_View->addColumn( tr("Date"),-1); | 180 | Remote_View->addColumn( tr("Date"),-1); |
181 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 181 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
182 | Remote_View->setAllColumnsShowFocus(TRUE); | 182 | Remote_View->setAllColumnsShowFocus(TRUE); |
183 | Remote_View->setMultiSelection( TRUE ); | 183 | Remote_View->setMultiSelection( TRUE ); |
184 | Remote_View->setSelectionMode(QListView::Extended); | 184 | Remote_View->setSelectionMode(QListView::Extended); |
185 | Remote_View->setFocusPolicy(StrongFocus); | 185 | Remote_View->setFocusPolicy(StrongFocus); |
186 | Remote_View->installEventFilter( this ); | 186 | Remote_View->installEventFilter( this ); |
187 | 187 | ||
188 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 188 | QPEApplication::setStylusOperation( Remote_View->viewport(), QPEApplication::RightOnHold); |
189 | 189 | ||
190 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 190 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
191 | 191 | ||
192 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); | 192 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); |
193 | TabWidget->setSizeChange( 370 ); | 193 | TabWidget->setSizeChange( 370 ); |
194 | // TabWidget->insertTab( tab_2, tr( "2")); | 194 | // TabWidget->insertTab( tab_2, tr( "2")); |
195 | 195 | ||
196 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 196 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
197 | tabLayout_3 = new QGridLayout( tab_3 ); | 197 | tabLayout_3 = new QGridLayout( tab_3 ); |
198 | tabLayout_3->setSpacing( 2); | 198 | tabLayout_3->setSpacing( 2); |
199 | tabLayout_3->setMargin( 2); | 199 | tabLayout_3->setMargin( 2); |
200 | 200 | ||
201 | 201 | ||
202 | // OFileDialog fileDialog; | 202 | // OFileDialog fileDialog; |
203 | // fileDialog; | 203 | // fileDialog; |
204 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 204 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
205 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 205 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
206 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 206 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
207 | 207 | ||
208 | QListView *fileTree; | 208 | QListView *fileTree; |
209 | fileTree = new QListView( tab_3, "tree" ); | 209 | fileTree = new QListView( tab_3, "tree" ); |
210 | 210 | ||
211 | 211 | ||
212 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 212 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
213 | 213 | ||
214 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 214 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
215 | */ | 215 | */ |
216 | 216 | ||
217 | /////////////// | 217 | /////////////// |
218 | 218 | ||
219 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 219 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
220 | zaurusDevice=TRUE; | 220 | zaurusDevice=TRUE; |
221 | else | 221 | else |
222 | zaurusDevice=FALSE; | 222 | zaurusDevice=FALSE; |
223 | 223 | ||
224 | 224 | ||
225 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { | 225 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { |
226 | odebug << "not have sd" << oendl; | 226 | odebug << "not have sd" << oendl; |
227 | sdButton->hide(); | 227 | sdButton->hide(); |
228 | } | 228 | } |
229 | if( !StorageInfo::hasCf() ) { | 229 | if( !StorageInfo::hasCf() ) { |
230 | odebug << "not have cf" << oendl; | 230 | odebug << "not have cf" << oendl; |
231 | cfButton->hide(); | 231 | cfButton->hide(); |
232 | } | 232 | } |
233 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 233 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
234 | currentDir.setPath( QDir::currentDirPath()); | 234 | currentDir.setPath( QDir::currentDirPath()); |
235 | 235 | ||
236 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 236 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
237 | currentRemoteDir.setPath( QDir::currentDirPath()); | 237 | currentRemoteDir.setPath( QDir::currentDirPath()); |
238 | 238 | ||
239 | // b = TRUE; | 239 | // b = TRUE; |
240 | 240 | ||
241 | filterStr="*"; | 241 | filterStr="*"; |
242 | showMenuHidden(); | 242 | showMenuHidden(); |
243 | TabWidget->setCurrentWidget(0); | 243 | TabWidget->setCurrentWidget(0); |
244 | 244 | ||
245 | } | 245 | } |
246 | 246 | ||
247 | void AdvancedFm::initConnections() | 247 | void AdvancedFm::initConnections() |
248 | { | 248 | { |
249 | 249 | ||
250 | connect( qApp,SIGNAL( aboutToQuit()), | 250 | connect( qApp,SIGNAL( aboutToQuit()), |
251 | this, SLOT( cleanUp()) ); | 251 | this, SLOT( cleanUp()) ); |
252 | connect( qpeDirButton ,SIGNAL(released()), | 252 | connect( qpeDirButton ,SIGNAL(released()), |
253 | this,SLOT( QPEButtonPushed()) ); | 253 | this,SLOT( QPEButtonPushed()) ); |
254 | connect( cfButton ,SIGNAL(released()), | 254 | connect( cfButton ,SIGNAL(released()), |
255 | this,SLOT( CFButtonPushed()) ); | 255 | this,SLOT( CFButtonPushed()) ); |
256 | connect( sdButton ,SIGNAL(released()), | 256 | connect( sdButton ,SIGNAL(released()), |
257 | this,SLOT( SDButtonPushed()) ); | 257 | this,SLOT( SDButtonPushed()) ); |
258 | connect( cdUpButton ,SIGNAL(released()), | 258 | connect( cdUpButton ,SIGNAL(released()), |
259 | this,SLOT( upDir()) ); | 259 | this,SLOT( upDir()) ); |
260 | connect( docButton,SIGNAL(released()), | 260 | connect( docButton,SIGNAL(released()), |
261 | this,SLOT( docButtonPushed()) ); | 261 | this,SLOT( docButtonPushed()) ); |
262 | connect( homeButton,SIGNAL(released()), | 262 | connect( homeButton,SIGNAL(released()), |
263 | this,SLOT( homeButtonPushed()) ); | 263 | this,SLOT( homeButtonPushed()) ); |
264 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), | 264 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), |
265 | this, SLOT( currentPathComboActivated(const QString&) ) ); | 265 | this, SLOT( currentPathComboActivated(const QString&) ) ); |
266 | 266 | ||
267 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 267 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
268 | this,SLOT(currentPathComboChanged())); | 268 | this,SLOT(currentPathComboChanged())); |
269 | 269 | ||
270 | connect( Local_View, SIGNAL( clicked(QListViewItem*)), | 270 | connect( Local_View, SIGNAL( clicked(QListViewItem*)), |
271 | this,SLOT( ListClicked(QListViewItem*)) ); | 271 | this,SLOT( ListClicked(QListViewItem*)) ); |
272 | 272 | ||
273 | connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 273 | connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
274 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); | 274 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); |
275 | 275 | ||
276 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | ||
277 | |||
278 | connect( Remote_View, SIGNAL( clicked(QListViewItem*)), | 276 | connect( Remote_View, SIGNAL( clicked(QListViewItem*)), |
279 | this,SLOT( ListClicked(QListViewItem*)) ); | 277 | this,SLOT( ListClicked(QListViewItem*)) ); |
280 | connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 278 | connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
281 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); | 279 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); |
282 | 280 | ||
283 | connect( TabWidget,SIGNAL(currentChanged(QWidget*)), | 281 | connect( TabWidget,SIGNAL(currentChanged(QWidget*)), |
284 | this,SLOT(tabChanged(QWidget*))); | 282 | this,SLOT(tabChanged(QWidget*))); |
285 | 283 | ||
286 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); | 284 | connect( Remote_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&, int)), |
285 | this, SLOT(showFileMenu())); | ||
286 | connect( Local_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&,int)), | ||
287 | this, SLOT(showFileMenu())); | ||
287 | 288 | ||
288 | connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&))); | 289 | connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&))); |
289 | // connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int))); | 290 | // connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int))); |
290 | connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int))); | 291 | connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int))); |
291 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); | 292 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); |
292 | 293 | ||
293 | } | 294 | } |
294 | 295 | ||
diff --git a/noncore/apps/advancedfm/main.cpp b/noncore/apps/advancedfm/main.cpp index df0d4af..06fc741 100644 --- a/noncore/apps/advancedfm/main.cpp +++ b/noncore/apps/advancedfm/main.cpp | |||
@@ -1,22 +1,20 @@ | |||
1 | 1 | ||
2 | /*************************************************************************** | 2 | /*************************************************************************** |
3 | using namespace Opie::Core; | ||
4 | using namespace Opie::Core; | ||
5 | main.cpp - description | 3 | main.cpp - description |
6 | ------------------- | 4 | ------------------- |
7 | begin : March 10, 2002 | 5 | begin : March 10, 2002 |
8 | copyright : (C) 2002 by llornkcor | 6 | copyright : (C) 2002 by llornkcor |
9 | email : ljp@llornkcor.com | 7 | email : ljp@llornkcor.com |
10 | * 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 * |
11 | * 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 * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 10 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 11 | * (at your option) any later version. * |
14 | ***************************************************************************/ | 12 | ***************************************************************************/ |
15 | 13 | ||
16 | #include "advancedfm.h" | 14 | #include "advancedfm.h" |
17 | #include <opie2/oapplicationfactory.h> | 15 | #include <opie2/oapplicationfactory.h> |
18 | 16 | ||
19 | using namespace Opie::Core; | 17 | using namespace Opie::Core; |
20 | 18 | ||
21 | OPIE_EXPORT_APP( OApplicationFactory<AdvancedFm> ) | 19 | OPIE_EXPORT_APP( OApplicationFactory<AdvancedFm> ) |
22 | 20 | ||